--- deliantra/Deliantra-Client/Client.xs 2008/12/20 19:45:49 1.285 +++ deliantra/Deliantra-Client/Client.xs 2009/12/17 02:49:38 1.293 @@ -83,7 +83,7 @@ #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ -#define FOW_DARKNESS 16 +#define FOW_DARKNESS 64 #define MAP_EXTEND_X 32 #define MAP_EXTEND_Y 512 @@ -1660,6 +1660,35 @@ } } +void +draw_fow_texture (float intensity, int name1, float s1, float t1, float w1, float h1) + PROTOTYPE: @ + CODE: +{ + glEnable (GL_TEXTURE_2D); + glEnable (GL_BLEND); + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + + glColor4f (intensity, intensity, intensity, 0.9); + glPushMatrix (); + glScalef (1./3, 1./3, 1.); + + glBindTexture (GL_TEXTURE_2D, name1); + + glBegin (GL_QUADS); + glTexCoord2f ( 0, 0); glVertex2f ( 0, 0); + glTexCoord2f ( 0, t1); glVertex2f ( 0, h1); + glTexCoord2f (s1, t1); glVertex2f (w1, h1); + glTexCoord2f (s1, 0); glVertex2f (w1, 0); + glEnd (); + + glPopMatrix (); + + glDisable (GL_TEXTURE_2D); + glDisable (GL_BLEND); +} + IV texture_valid_2d (GLint internalformat, GLsizei w, GLsizei h, GLenum format, GLenum type) CODE: { @@ -2018,7 +2047,7 @@ pl_tex.name = 0; - // thats current max. sorry. + // that's current max. sorry. if (sw > 255) sw = 255; if (sh > 255) sh = 255; @@ -2176,13 +2205,12 @@ rc_key_t key_ov = key; maptex tex = self->tex [TEXID_SPEECH]; rc_array_t *arr; + int px = x * T + T * 2 / 32; + int py = y * T - T * 6 / 32; key_ov.texname = tex.name; arr = rc_array (rc_ov, &key_ov); - int px = x * T + T * 2 / 32; - int py = y * T - T * 6 / 32; - rc_t2f_v3f (arr, 0 , 0 , px , py , 0); rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); @@ -2369,7 +2397,13 @@ int x, y; glEnable (GL_TEXTURE_2D); - glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + /* GL_REPLACE would be correct, as we don't need to modulate alpha, + * but the nvidia driver (185.18.14) mishandles alpha textures + * ansd takes the colour from god knows where instead of using + * Cp. MODULATE results in the same colour, but slightly different + * alpha, but atcually gives us the correct colour with nvidia. + */ + glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin (GL_QUADS); @@ -2386,7 +2420,7 @@ float tx1 = m & 0x40 ? 0.5 : 0.; float tx2 = tx1 + 0.5; - glColor4f (c[0], c[1], c[2], 0.75); + glColor4f (c[0], c[1], c[2], 1); glTexCoord2f (tx1, 0.); glVertex2i (x , y ); glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1); glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1); @@ -2855,6 +2889,7 @@ const_iv (GL_VENDOR), const_iv (GL_VERSION), const_iv (GL_EXTENSIONS), + const_iv (GL_MAX_TEXTURE_UNITS), const_iv (GL_COLOR_MATERIAL), const_iv (GL_SMOOTH), const_iv (GL_FLAT), @@ -2876,6 +2911,10 @@ const_iv (GL_DST_ALPHA), const_iv (GL_ONE_MINUS_SRC_ALPHA), const_iv (GL_ONE_MINUS_DST_ALPHA), + const_iv (GL_SRC_COLOR), + const_iv (GL_DST_COLOR), + const_iv (GL_ONE_MINUS_SRC_COLOR), + const_iv (GL_ONE_MINUS_DST_COLOR), const_iv (GL_SRC_ALPHA_SATURATE), const_iv (GL_RGB), const_iv (GL_RGBA), @@ -2953,6 +2992,9 @@ const_iv (GL_V3F), const_iv (GL_T2F_V3F), const_iv (GL_T2F_N3F_V3F), + const_iv (GL_FUNC_ADD), + const_iv (GL_FUNC_SUBTRACT), + const_iv (GL_FUNC_REVERSE_SUBTRACT), # undef const_iv }; @@ -2969,6 +3011,9 @@ gl.BlendFuncSeparate = 0; gl.BlendFuncSeparateEXT = 0; +void +apple_nvidia_bug (int enable) + char * gl_vendor () CODE: @@ -3027,6 +3072,8 @@ CODE: gl_BlendFuncSeparate (sa, da, saa, daa); +# void glBlendEquation (int se) + void glDepthMask (int flag) void glLogicOp (int opcode)