--- deliantra/Deliantra-Client/Client.xs 2007/08/11 13:05:58 1.226 +++ deliantra/Deliantra-Client/Client.xs 2007/08/28 01:23:47 1.235 @@ -205,7 +205,7 @@ typedef uint16_t faceid; typedef struct { - int name; + GLuint name; int w, h; float s, t; uint8_t r, g, b, a; @@ -442,6 +442,17 @@ return n + 1; } +static unsigned int +popcount (unsigned int n) +{ + n -= (n >> 1) & 0x55555555U; + n = ((n >> 2) & 0x33333333U) + (n & 0x33333333U); + n = ((n >> 4) + n) & 0x0f0f0f0fU; + n *= 0x01010101U; + + return n >> 24; +} + /* SDL should provide this, really. */ #define SDLK_MODIFIER_MIN 300 #define SDLK_MODIFIER_MAX 314 @@ -527,6 +538,8 @@ const_iv (SDL_APPMOUSEFOCUS), const_iv (SDL_APPACTIVE), + const_iv (SDLK_FIRST), + const_iv (SDLK_LAST), const_iv (SDLK_KP0), const_iv (SDLK_KP1), const_iv (SDLK_KP2), @@ -635,6 +648,10 @@ NV ceil (NV x) +IV minpot (UV n) + +IV popcount (UV n) + void pango_init () CODE: @@ -717,7 +734,7 @@ { av_clear (texture_av); - SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); + SDL_WM_SetCaption ("Crossfire TRT Client " VERSION, "Crossfire TRT"); #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); #include "glfunc.h" #undef GL_FUNC @@ -1348,8 +1365,6 @@ PROTOTYPES: ENABLE -int minpot (int n) - void pad (SV *data_, int ow, int oh, int nw, int nh) CODE: @@ -2245,7 +2260,7 @@ int x1, y1; if (*data++ != 0) - return; /* version mismatch */ + XSRETURN_EMPTY; /* version mismatch */ w = *data++ << 8; w |= *data++; h = *data++ << 8; h |= *data++; @@ -2551,6 +2566,12 @@ const_iv (GL_LUMINANCE_ALPHA), const_iv (GL_FLOAT), const_iv (GL_UNSIGNED_INT_8_8_8_8_REV), + const_iv (GL_COMPRESSED_ALPHA_ARB), + const_iv (GL_COMPRESSED_LUMINANCE_ARB), + const_iv (GL_COMPRESSED_LUMINANCE_ALPHA_ARB), + const_iv (GL_COMPRESSED_INTENSITY_ARB), + const_iv (GL_COMPRESSED_RGB_ARB), + const_iv (GL_COMPRESSED_RGBA_ARB), const_iv (GL_COMPILE), const_iv (GL_PROXY_TEXTURE_1D), const_iv (GL_PROXY_TEXTURE_2D), @@ -2599,6 +2620,7 @@ const_iv (GL_LINE_SMOOTH_HINT), const_iv (GL_POLYGON_SMOOTH_HINT), const_iv (GL_GENERATE_MIPMAP_HINT), + const_iv (GL_TEXTURE_COMPRESSION_HINT), const_iv (GL_FASTEST), const_iv (GL_DONT_CARE), const_iv (GL_NICEST), @@ -2616,6 +2638,12 @@ AvREAL_off (texture_av); } +void +disable_GL_EXT_blend_func_separate () + CODE: + gl.BlendFuncSeparate = 0; + gl.BlendFuncSeparateEXT = 0; + char * gl_vendor () CODE: @@ -2746,6 +2774,15 @@ CODE: glRectf (x1, y1, x2, y2); +void glRect_lineloop (float x1, float y1, float x2, float y2) + CODE: + glBegin (GL_LINE_LOOP); + glVertex2f (x1, y1); + glVertex2f (x2, y1); + glVertex2f (x2, y2); + glVertex2f (x1, y2); + glEnd (); + PROTOTYPES: ENABLE void glBegin (int mode) @@ -2856,8 +2893,7 @@ SV *draw_y_sv = GvSV (draw_y_gv); SV *draw_w_sv = GvSV (draw_w_gv); SV *draw_h_sv = GvSV (draw_h_gv); - SV *hover; - double draw_x, draw_y, draw_w, draw_h; + double draw_x, draw_y; if (!SvROK (self)) croak ("CFPlus::Base::draw: %s not a reference", SvPV_nolen (self)); @@ -2895,7 +2931,7 @@ if (svp && SvTRUE (*svp)) { - glColor4f (1*0.2f, 0.8*0.2f, 0.5*0.2f, 0.2f); + glColor4f (1.0f * 0.2f, 0.8f * 0.2f, 0.5f * 0.2f, 0.2f); glEnable (GL_BLEND); glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glBegin (GL_QUADS); @@ -2908,19 +2944,17 @@ } } #if 0 - if ($ENV{CFPLUS_DEBUG} & 1) { - glPushMatrix; - glColor 1, 1, 0, 1; - glTranslate 0.375, 0.375; - glBegin GL_LINE_LOOP; - glVertex 0 , 0; - glVertex $self->{w} - 1, 0; - glVertex $self->{w} - 1, $self->{h} - 1; - glVertex 0 , $self->{h} - 1; - glEnd; - glPopMatrix; - #CFPlus::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; - } + // draw borders, for debugging + glPushMatrix (); + glColor4f (1., 1., 0., 1.); + glTranslatef (.5, .5, 0.); + glBegin (GL_LINE_LOOP); + glVertex2f (0 , 0); + glVertex2f (w - 1, 0); + glVertex2f (w - 1, h - 1); + glVertex2f (0 , h - 1); + glEnd (); + glPopMatrix (); #endif PUSHMARK (SP); XPUSHs (self);