ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.285 by root, Sat Dec 20 19:45:49 2008 UTC vs.
Revision 1.291 by root, Thu Nov 26 07:19:11 2009 UTC

81#define expect_false(expr) expect ((expr) != 0, 0) 81#define expect_false(expr) expect ((expr) != 0, 0)
82#define expect_true(expr) expect ((expr) != 0, 1) 82#define expect_true(expr) expect ((expr) != 0, 1)
83 83
84#define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ 84#define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */
85 85
86#define FOW_DARKNESS 16 86#define FOW_DARKNESS 64
87 87
88#define MAP_EXTEND_X 32 88#define MAP_EXTEND_X 32
89#define MAP_EXTEND_Y 512 89#define MAP_EXTEND_Y 512
90 90
91#define MIN_FONT_HEIGHT 10 91#define MIN_FONT_HEIGHT 10
2016 rc_key_t key; 2016 rc_key_t key;
2017 rc_array_t *arr, *arr_hidden; 2017 rc_array_t *arr, *arr_hidden;
2018 2018
2019 pl_tex.name = 0; 2019 pl_tex.name = 0;
2020 2020
2021 // thats current max. sorry. 2021 // that's current max. sorry.
2022 if (sw > 255) sw = 255; 2022 if (sw > 255) sw = 255;
2023 if (sh > 255) sh = 255; 2023 if (sh > 255) sh = 255;
2024 2024
2025 // clear key, in case of extra padding 2025 // clear key, in case of extra padding
2026 memset (&skey, 0, sizeof (skey)); 2026 memset (&skey, 0, sizeof (skey));
2174 if (cell->flags & 1) 2174 if (cell->flags & 1)
2175 { 2175 {
2176 rc_key_t key_ov = key; 2176 rc_key_t key_ov = key;
2177 maptex tex = self->tex [TEXID_SPEECH]; 2177 maptex tex = self->tex [TEXID_SPEECH];
2178 rc_array_t *arr; 2178 rc_array_t *arr;
2179 int px = x * T + T * 2 / 32;
2180 int py = y * T - T * 6 / 32;
2179 2181
2180 key_ov.texname = tex.name; 2182 key_ov.texname = tex.name;
2181 arr = rc_array (rc_ov, &key_ov); 2183 arr = rc_array (rc_ov, &key_ov);
2182
2183 int px = x * T + T * 2 / 32;
2184 int py = y * T - T * 6 / 32;
2185 2184
2186 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2185 rc_t2f_v3f (arr, 0 , 0 , px , py , 0);
2187 rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); 2186 rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0);
2188 rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); 2187 rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0);
2189 rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); 2188 rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0);
2367 }; 2366 };
2368 2367
2369 int x, y; 2368 int x, y;
2370 2369
2371 glEnable (GL_TEXTURE_2D); 2370 glEnable (GL_TEXTURE_2D);
2371 /* GL_REPLACE would be correct, as we don't need to modulate alpha,
2372 * but the nvidia driver (185.18.14) mishandles alpha textures
2373 * ansd takes the colour from god knows where instead of using
2374 * Cp. MODULATE results in the same colour, but slightly different
2375 * alpha, but atcually gives us the correct colour with nvidia.
2376 */
2372 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 2377 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
2373 glEnable (GL_BLEND); 2378 glEnable (GL_BLEND);
2374 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 2379 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2375 glBegin (GL_QUADS); 2380 glBegin (GL_QUADS);
2376 2381
2377 for (y = 0; y < h; y++) 2382 for (y = 0; y < h; y++)
2384 float *c = color [m & 15]; 2389 float *c = color [m & 15];
2385 2390
2386 float tx1 = m & 0x40 ? 0.5 : 0.; 2391 float tx1 = m & 0x40 ? 0.5 : 0.;
2387 float tx2 = tx1 + 0.5; 2392 float tx2 = tx1 + 0.5;
2388 2393
2389 glColor4f (c[0], c[1], c[2], 0.75); 2394 glColor4f (c[0], c[1], c[2], 1);
2390 glTexCoord2f (tx1, 0.); glVertex2i (x , y ); 2395 glTexCoord2f (tx1, 0.); glVertex2i (x , y );
2391 glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1); 2396 glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1);
2392 glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1); 2397 glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1);
2393 glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y ); 2398 glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y );
2394 } 2399 }
2951 const_iv (GL_NICEST), 2956 const_iv (GL_NICEST),
2952 const_iv (GL_V2F), 2957 const_iv (GL_V2F),
2953 const_iv (GL_V3F), 2958 const_iv (GL_V3F),
2954 const_iv (GL_T2F_V3F), 2959 const_iv (GL_T2F_V3F),
2955 const_iv (GL_T2F_N3F_V3F), 2960 const_iv (GL_T2F_N3F_V3F),
2961 const_iv (GL_FUNC_ADD),
2962 const_iv (GL_FUNC_SUBTRACT),
2963 const_iv (GL_FUNC_REVERSE_SUBTRACT),
2956# undef const_iv 2964# undef const_iv
2957 }; 2965 };
2958 2966
2959 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 2967 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
2960 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 2968 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
2967disable_GL_EXT_blend_func_separate () 2975disable_GL_EXT_blend_func_separate ()
2968 CODE: 2976 CODE:
2969 gl.BlendFuncSeparate = 0; 2977 gl.BlendFuncSeparate = 0;
2970 gl.BlendFuncSeparateEXT = 0; 2978 gl.BlendFuncSeparateEXT = 0;
2971 2979
2980void
2981apple_nvidia_bug (int enable)
2982
2972char * 2983char *
2973gl_vendor () 2984gl_vendor ()
2974 CODE: 2985 CODE:
2975 RETVAL = (char *)glGetString (GL_VENDOR); 2986 RETVAL = (char *)glGetString (GL_VENDOR);
2976 OUTPUT: 2987 OUTPUT:
3024void glBlendFunc (int sfactor, int dfactor) 3035void glBlendFunc (int sfactor, int dfactor)
3025 3036
3026void glBlendFuncSeparate (int sa, int da, int saa, int daa) 3037void glBlendFuncSeparate (int sa, int da, int saa, int daa)
3027 CODE: 3038 CODE:
3028 gl_BlendFuncSeparate (sa, da, saa, daa); 3039 gl_BlendFuncSeparate (sa, da, saa, daa);
3040
3041void glBlendEquation (int se)
3029 3042
3030void glDepthMask (int flag) 3043void glDepthMask (int flag)
3031 3044
3032void glLogicOp (int opcode) 3045void glLogicOp (int opcode)
3033 3046

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines