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.296 by root, Mon Dec 21 23:52:34 2009 UTC vs.
Revision 1.300 by root, Thu Dec 24 10:47:45 2009 UTC

41#include <SDL_opengl.h> 41#include <SDL_opengl.h>
42 42
43/* work around os x broken headers */ 43/* work around os x broken headers */
44#ifdef __MACOSX__ 44#ifdef __MACOSX__
45typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); 45typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
46typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
47typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
46#endif 48#endif
47 49
48#define PANGO_ENABLE_BACKEND 50#define PANGO_ENABLE_BACKEND
49#define G_DISABLE_CAST_CHECKS 51#define G_DISABLE_CAST_CHECKS
50 52
97 99
98#define KMOD_LRAM 0x10000 // our extension 100#define KMOD_LRAM 0x10000 // our extension
99 101
100#define TEXID_SPEECH 1 102#define TEXID_SPEECH 1
101#define TEXID_NOFACE 2 103#define TEXID_NOFACE 2
102#define TEXID_HIDDEN 3
103 104
104static AV *texture_av; 105static AV *texture_av;
105 106
106static struct 107static struct
107{ 108{
929 930
930 SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra"); 931 SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra");
931#define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); 932#define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name);
932#include "glfunc.h" 933#include "glfunc.h"
933#undef GL_FUNC 934#undef GL_FUNC
935
936 if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB;
937 if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB;
934 } 938 }
935} 939}
936 OUTPUT: 940 OUTPUT:
937 RETVAL 941 RETVAL
938 942
1671void 1675void
1672draw_fow_texture (float intensity, int hidden_tex, int name1, uint8_t *data1, float s, float t, int w, int h, float blend = 0.f, int dx = 0, int dy = 0, int name2 = 0, uint8_t *data2 = data1) 1676draw_fow_texture (float intensity, int hidden_tex, int name1, uint8_t *data1, float s, float t, int w, int h, float blend = 0.f, int dx = 0, int dy = 0, int name2 = 0, uint8_t *data2 = data1)
1673 PROTOTYPE: @ 1677 PROTOTYPE: @
1674 CODE: 1678 CODE:
1675{ 1679{
1680 glEnable (GL_BLEND);
1681 glBlendFunc (intensity ? GL_SRC_ALPHA : GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1676 glEnable (GL_TEXTURE_2D); 1682 glEnable (GL_TEXTURE_2D);
1677 glEnable (GL_BLEND);
1678 glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
1679 glBindTexture (GL_TEXTURE_2D, name1); 1683 glBindTexture (GL_TEXTURE_2D, name1);
1680 1684
1681 glColor3f (intensity, intensity, intensity); 1685 glColor3f (intensity, intensity, intensity);
1682 glPushMatrix (); 1686 glPushMatrix ();
1683 glScalef (1./3, 1./3, 1.); 1687 glScalef (1./3, 1./3, 1.);
1698 glBindTexture (GL_TEXTURE_2D, name2); 1702 glBindTexture (GL_TEXTURE_2D, name2);
1699 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); 1703 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
1700 1704
1701 /* rgb == rgb(glcolor) */ 1705 /* rgb == rgb(glcolor) */
1702 glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); 1706 glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
1703 glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT); 1707 glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR);
1704 glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); 1708 glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
1705 1709
1706 /* alpha = interpolate t0, t1 by env_alpha */ 1710 /* alpha = interpolate t0, t1 by env_alpha */
1707 glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); 1711 glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color);
1708 1712
2141 int pl_x, pl_y; 2145 int pl_x, pl_y;
2142 maptex pl_tex; 2146 maptex pl_tex;
2143 rc_t *rc = rc_alloc (); 2147 rc_t *rc = rc_alloc ();
2144 rc_t *rc_ov = rc_alloc (); 2148 rc_t *rc_ov = rc_alloc ();
2145 rc_key_t key; 2149 rc_key_t key;
2146 rc_array_t *arr, *arr_hidden; 2150 rc_array_t *arr;
2147 2151
2148 pl_tex.name = 0; 2152 pl_tex.name = 0;
2149 2153
2150 // that's current max. sorry. 2154 // that's current max. sorry.
2151 if (sw > 255) sw = 255; 2155 if (sw > 255) sw = 255;
2188 } 2192 }
2189 2193
2190 glEnable (GL_BLEND); 2194 glEnable (GL_BLEND);
2191 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 2195 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2192 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 2196 glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
2193
2194 key.texname = self->tex [TEXID_HIDDEN].name;
2195 arr_hidden = rc_array (rc_ov, &key);
2196 2197
2197 for (z = 0; z <= 2; z++) 2198 for (z = 0; z <= 2; z++)
2198 { 2199 {
2199 memset (smooth_level, 0, sizeof (smooth_level)); 2200 memset (smooth_level, 0, sizeof (smooth_level));
2200 key.texname = -1; 2201 key.texname = -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines