--- deliantra/Deliantra-Client/Client.xs 2006/07/05 03:01:01 1.128 +++ deliantra/Deliantra-Client/Client.xs 2006/10/09 23:30:44 1.161 @@ -1,7 +1,9 @@ #ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls # include # include +# include # pragma warning(disable:4244) #endif @@ -9,6 +11,10 @@ #include "perl.h" #include "XSUB.h" +#ifdef _WIN32 +# undef pipe +#endif + #include #include #include @@ -42,8 +48,6 @@ typedef signed int int32_t; #endif -#include "glext.h" - #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, objetc replacement character */ #define FOW_DARKNESS 32 @@ -82,10 +86,10 @@ #include "pango-fontmap.c" #include "pango-render.c" -typedef Mix_Chunk *CFClient__MixChunk; -typedef Mix_Music *CFClient__MixMusic; +typedef Mix_Chunk *CFPlus__MixChunk; +typedef Mix_Music *CFPlus__MixMusic; -typedef PangoFontDescription *CFClient__Font; +typedef PangoFontDescription *CFPlus__Font; static int shape_attr_p (PangoLayoutRun *run) @@ -109,10 +113,10 @@ PangoLayout *pl; float r, g, b, a; // default color for rgba mode int base_height; - CFClient__Font font; -} *CFClient__Layout; + CFPlus__Font font; +} *CFPlus__Layout; -static CFClient__Font default_font; +static CFPlus__Font default_font; static PangoContext *opengl_context; static PangoFontMap *opengl_fontmap; @@ -127,7 +131,7 @@ } static void -layout_update_font (CFClient__Layout self) +layout_update_font (CFPlus__Layout self) { /* use a random scale factor to account for unknown descenders, 0.8 works * reasonably well with bitstream vera @@ -141,14 +145,21 @@ } static void -layout_get_pixel_size (CFClient__Layout self, int *w, int *h) +layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) { - pango_layout_get_pixel_size (self->pl, w, h); + PangoRectangle rect; + + // get_pixel_* wrongly rounds down + pango_layout_get_extents (self->pl, 0, &rect); - if (!*w) *w = 1; - if (!*h) *h = 1; + rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE; + rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE; - *w = (*w + 3) & ~3; + if (!rect.width) rect.width = 1; + if (!rect.height) rect.height = 1; + + *w = rect.width; + *h = rect.height; } typedef uint16_t mapface; @@ -161,8 +172,10 @@ } maptex; typedef struct { - int16_t darkness; + uint32_t player; mapface face[3]; + uint16_t darkness; + uint8_t stat_width, stat_hp, flags; } mapcell; typedef struct { @@ -181,7 +194,7 @@ int32_t rows; maprow *row; -} *CFClient__Map; +} *CFPlus__Map; static char * prepend (char *ptr, int sze, int inc) @@ -209,7 +222,7 @@ #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) static maprow * -map_get_row (CFClient__Map self, int y) +map_get_row (CFPlus__Map self, int y) { if (0 > y) { @@ -257,13 +270,13 @@ } static mapcell * -map_get_cell (CFClient__Map self, int x, int y) +map_get_cell (CFPlus__Map self, int x, int y) { return row_get_cell (map_get_row (self, y), x); } static void -map_clear (CFClient__Map self) +map_clear (CFPlus__Map self) { int r; @@ -281,10 +294,11 @@ } static void -map_blank (CFClient__Map self, int x0, int y0, int w, int h) +map_blank (CFPlus__Map self, int x0, int y0, int w, int h) { int x, y; maprow *row; + mapcell *cell; for (y = y0; y < y0 + h; y++) if (y >= 0) @@ -300,7 +314,12 @@ if (x >= row->c1) break; - row->col[x - row->c0].darkness = -1; + cell = row->col + x - row->c0; + + cell->darkness = 0; + cell->stat_hp = 0; + cell->flags = 0; + cell->player = 0; } } } @@ -348,13 +367,13 @@ return n + 1; } -MODULE = CFClient PACKAGE = CFClient +MODULE = CFPlus PACKAGE = CFPlus PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("CFClient", 1); + HV *stash = gv_stashpv ("CFPlus", 1); static const struct { const char *name; IV iv; @@ -465,6 +484,13 @@ newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); } +int +in_destruct () + CODE: + RETVAL = PL_main_cv == Nullcv; + OUTPUT: + RETVAL + NV floor (NV x) NV ceil (NV x) @@ -504,6 +530,10 @@ SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); +#if SDL_VERSION_ATLEAST(1,2,10) + SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1); + SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); +#endif SDL_EnableUNICODE (1); SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); @@ -600,7 +630,7 @@ break; } - XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); + XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); } } @@ -624,9 +654,38 @@ #endif void +win32_proxy_info () + PPCODE: +{ +#ifdef _WIN32 + char buffer[2048]; + DWORD buflen; + + EXTEND (SP, 3); + + buflen = sizeof (buffer); + if (InternetQueryOption (0, INTERNET_OPTION_PROXY, (void *)buffer, &buflen)) + if (((INTERNET_PROXY_INFO *)buffer)->dwAccessType == INTERNET_OPEN_TYPE_PROXY) + { + PUSHs (newSVpv (((INTERNET_PROXY_INFO *)buffer)->lpszProxy, 0)); + + buflen = sizeof (buffer); + if (InternetQueryOption (0, INTERNET_OPTION_PROXY_USERNAME, (void *)buffer, &buflen)) + { + PUSHs (newSVpv (buffer, 0)); + + buflen = sizeof (buffer); + if (InternetQueryOption (0, INTERNET_OPTION_PROXY_PASSWORD, (void *)buffer, &buflen)) + PUSHs (newSVpv (buffer, 0)); + } + } +#endif +} + +void add_font (char *file) CODE: - FcConfigAppFontAddFile (0, (const FcChar8 *)file); /* no idea wether this is required */ + FcConfigAppFontAddFile (0, (const FcChar8 *)file); void load_image_inline (SV *image_) @@ -678,15 +737,15 @@ assert (surface2->pitch == surface2->w * 4); - EXTEND (SP, 5); + SDL_LockSurface (surface2); + EXTEND (SP, 6); PUSHs (sv_2mortal (newSViv (surface2->w))); PUSHs (sv_2mortal (newSViv (surface2->h))); - SDL_LockSurface (surface2); PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); - SDL_UnlockSurface (surface2); PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); PUSHs (sv_2mortal (newSViv (GL_RGBA))); PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); + SDL_UnlockSurface (surface2); SDL_FreeSurface (surface); SDL_FreeSurface (surface2); @@ -735,13 +794,17 @@ _exit (1); void -_exit (int retval) +_exit (int retval = 0) CODE: +#ifdef WIN32 + ExitThread (retval); // unclean, please beam me up +#else _exit (retval); +#endif -MODULE = CFClient PACKAGE = CFClient::Font +MODULE = CFPlus PACKAGE = CFPlus::Font -CFClient::Font +CFPlus::Font new_from_file (SV *class, char *path, int id = 0) CODE: { @@ -754,23 +817,23 @@ RETVAL void -DESTROY (CFClient::Font self) +DESTROY (CFPlus::Font self) CODE: pango_font_description_free (self); void -make_default (CFClient::Font self) +make_default (CFPlus::Font self) CODE: default_font = self; -MODULE = CFClient PACKAGE = CFClient::Layout +MODULE = CFPlus PACKAGE = CFPlus::Layout void -clear_font_cache () +reset_glyph_cache () CODE: tc_clear (); -CFClient::Layout +CFPlus::Layout new (SV *class) CODE: New (0, RETVAL, 1, struct cf_layout); @@ -789,13 +852,13 @@ RETVAL void -DESTROY (CFClient::Layout self) +DESTROY (CFPlus::Layout self) CODE: g_object_unref (self->pl); Safefree (self); void -set_text (CFClient::Layout self, SV *text_) +set_text (CFPlus::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -805,7 +868,7 @@ } void -set_markup (CFClient::Layout self, SV *text_) +set_markup (CFPlus::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -815,7 +878,7 @@ } void -set_shapes (CFClient::Layout self, ...) +set_shapes (CFPlus::Layout self, ...) CODE: { PangoAttrList *attrs = 0; @@ -860,7 +923,7 @@ } void -get_shapes (CFClient::Layout self) +get_shapes (CFPlus::Layout self) PPCODE: { PangoLayoutIter *iter = pango_layout_get_iter (self->pl); @@ -874,6 +937,7 @@ PangoRectangle extents; pango_layout_iter_get_run_extents (iter, 0, &extents); + EXTEND (SP, 2); PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.x)))); PUSHs (sv_2mortal (newSViv (PANGO_PIXELS (extents.y)))); } @@ -884,7 +948,7 @@ } int -has_wrapped (CFClient::Layout self) +has_wrapped (CFPlus::Layout self) CODE: { int lines = 1; @@ -899,7 +963,7 @@ RETVAL SV * -get_text (CFClient::Layout self) +get_text (CFPlus::Layout self) CODE: RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); sv_utf8_decode (RETVAL); @@ -907,7 +971,7 @@ RETVAL void -set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) +set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) CODE: self->r = r; self->g = g; @@ -915,7 +979,7 @@ self->a = a; void -set_font (CFClient::Layout self, CFClient::Font font = 0) +set_font (CFPlus::Layout self, CFPlus::Font font = 0) CODE: if (self->font != font) { @@ -924,7 +988,7 @@ } void -set_height (CFClient::Layout self, int base_height) +set_height (CFPlus::Layout self, int base_height) CODE: if (self->base_height != base_height) { @@ -933,22 +997,22 @@ } void -set_width (CFClient::Layout self, int max_width = -1) +set_width (CFPlus::Layout self, int max_width = -1) CODE: pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); void -set_indent (CFClient::Layout self, int indent) +set_indent (CFPlus::Layout self, int indent) CODE: pango_layout_set_indent (self->pl, indent * PANGO_SCALE); void -set_spacing (CFClient::Layout self, int spacing) +set_spacing (CFPlus::Layout self, int spacing) CODE: pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); void -set_ellipsise (CFClient::Layout self, int ellipsise) +set_ellipsise (CFPlus::Layout self, int ellipsise) CODE: pango_layout_set_ellipsize (self->pl, ellipsise == 1 ? PANGO_ELLIPSIZE_START @@ -958,12 +1022,12 @@ ); void -set_single_paragraph_mode (CFClient::Layout self, int spm) +set_single_paragraph_mode (CFPlus::Layout self, int spm) CODE: pango_layout_set_single_paragraph_mode (self->pl, !!spm); void -size (CFClient::Layout self) +size (CFPlus::Layout self) PPCODE: { int w, h; @@ -976,7 +1040,7 @@ } int -descent (CFClient::Layout self) +descent (CFPlus::Layout self) CODE: { PangoRectangle rect; @@ -988,7 +1052,7 @@ RETVAL int -xy_to_index (CFClient::Layout self, int x, int y) +xy_to_index (CFPlus::Layout self, int x, int y) CODE: { int index, trailing; @@ -999,7 +1063,7 @@ RETVAL void -cursor_pos (CFClient::Layout self, int index) +cursor_pos (CFPlus::Layout self, int index) PPCODE: { PangoRectangle strong_pos; @@ -1012,15 +1076,16 @@ } void -render (CFClient::Layout self, float x, float y) +render (CFPlus::Layout self, float x, float y, int flags = 0) PPCODE: pango_opengl_render_layout_subpixel ( self->pl, x * PANGO_SCALE, y * PANGO_SCALE, - self->r, self->g, self->b, self->a + self->r, self->g, self->b, self->a, + flags ); -MODULE = CFClient PACKAGE = CFClient::Texture +MODULE = CFPlus PACKAGE = CFPlus::Texture void pad2pot (SV *data_, SV *w_, SV *h_) @@ -1108,9 +1173,9 @@ } } -MODULE = CFClient PACKAGE = CFClient::Map +MODULE = CFPlus PACKAGE = CFPlus::Map -CFClient::Map +CFPlus::Map new (SV *class, int map_width, int map_height) CODE: New (0, RETVAL, 1, struct map); @@ -1130,7 +1195,7 @@ RETVAL void -DESTROY (CFClient::Map self) +DESTROY (CFPlus::Map self) CODE: { map_clear (self); @@ -1140,12 +1205,12 @@ } void -clear (CFClient::Map self) +clear (CFPlus::Map self) CODE: map_clear (self); void -set_face (CFClient::Map self, int face, int texid) +set_face (CFPlus::Map self, int face, int texid) CODE: { while (self->faces <= face) @@ -1158,7 +1223,7 @@ } void -set_texture (CFClient::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) +set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) CODE: { while (self->texs <= texid) @@ -1192,7 +1257,7 @@ } int -ox (CFClient::Map self) +ox (CFPlus::Map self) ALIAS: oy = 1 x = 2 @@ -1213,18 +1278,18 @@ RETVAL void -scroll (CFClient::Map self, int dx, int dy) +scroll (CFPlus::Map self, int dx, int dy) CODE: { if (dx > 0) - map_blank (self, self->x, self->y, dx - 1, self->h); + map_blank (self, self->x, self->y, dx, self->h); else if (dx < 0) - map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); + map_blank (self, self->x + self->w + dx + 1, self->y, -dx, self->h); if (dy > 0) - map_blank (self, self->x, self->y, self->w, dy - 1); + map_blank (self, self->x, self->y, self->w, dy); else if (dy < 0) - map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); + map_blank (self, self->x, self->y + self->h + dy + 1, self->w, -dy); self->ox += dx; self->x += dx; self->oy += dy; self->y += dy; @@ -1239,7 +1304,7 @@ } void -map1a_update (CFClient::Map self, SV *data_) +map1a_update (CFPlus::Map self, SV *data_, int extmap) CODE: { uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); @@ -1247,7 +1312,7 @@ mapcell *cell; int x, y, flags; - while (data < data_end) + while (data < data_end - 1) { flags = (data [0] << 8) + data [1]; data += 2; @@ -1258,18 +1323,54 @@ if (flags & 15) { - if (cell->darkness < 0) + if (!cell->darkness) { - cell->darkness = 0; - cell->face [0] = 0; - cell->face [1] = 0; - cell->face [2] = 0; + memset (cell, 0, sizeof (*cell)); + cell->darkness = 256; } - cell->darkness = flags & 8 ? *data++ : 255; - //TODO: don't trust server data to be in-range(!) + if (flags & 8) + { + if (extmap) + { + uint8_t ext, cmd; + + do + { + ext = *data++; + cmd = ext & 0x3f; + + if (cmd < 4) + cell->darkness = 255 - ext * 64 + 1; + else if (cmd == 5) // health + { + cell->stat_width = 1; + cell->stat_hp = *data++; + } + else if (cmd == 6) // monster width + cell->stat_width = *data++ + 1; + else if (cmd == 0x47) // monster width + { + if (*data == 4) + ; // decode player tag + + data += *data + 1; + } + else if (cmd == 8) // cell flags + cell->flags = *data++; + else if (ext & 0x40) // unknown, multibyte => skip + data += *data + 1; + else + data++; + } + while (ext & 0x80); + } + else + cell->darkness = *data++ + 1; + } + if (flags & 4) { cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; @@ -1286,12 +1387,12 @@ } } else - cell->darkness = -1; + cell->darkness = 0; } } SV * -mapmap (CFClient::Map self, int x0, int y0, int w, int h) +mapmap (CFPlus::Map self, int x0, int y0, int w, int h) CODE: { int x1, x; @@ -1351,7 +1452,7 @@ RETVAL void -draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) +draw (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) CODE: { int vx, vy; @@ -1396,18 +1497,16 @@ face = cell->face [z]; - if (face) + if (face && face < self->texs) { maptex tex = self->tex [face]; - int px = (x + 1) * 32 - tex.w; int py = (y + 1) * 32 - tex.h; if (last_name != tex.name) { glEnd (); - last_name = tex.name; - glBindTexture (GL_TEXTURE_2D, last_name); + glBindTexture (GL_TEXTURE_2D, last_name = tex.name); glBegin (GL_QUADS); } @@ -1416,6 +1515,25 @@ glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); } + + if (cell->flags && z == 2) + { + if (cell->flags & 1) + { + maptex tex = self->tex [1]; + int px = (x + 1) * 32 - tex.w + 2; + int py = (y + 1) * 32 - tex.h - 6; + + glEnd (); + glBindTexture (GL_TEXTURE_2D, last_name = tex.name); + glBegin (GL_QUADS); + + glTexCoord2f (0 , 0 ); glVertex2f (px , py ); + glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); + glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); + glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); + } + } } } @@ -1423,10 +1541,41 @@ glDisable (GL_TEXTURE_2D); glDisable (GL_BLEND); + + // top layer: overlays such as the health bar + for (y = 0; y < sh; y++) + if (0 <= y + vy && y + vy < self->rows) + { + maprow *row = self->row + (y + vy); + + for (x = 0; x < sw; x++) + if (row->c0 <= x + vx && x + vx < row->c1) + { + mapcell *cell = row->col + (x + vx - row->c0); + + int px = x * 32; + int py = y * 32; + + if (cell->stat_hp) + { + int width = cell->stat_width * 32; + int thick = sh / 28 + 1 + cell->stat_width; + + glColor3ub (0, 0, 0); + glRectf (px + 1, py - thick - 2, + px + width - 1, py); + + glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0); + glRectf (px + 2, + py - thick - 1, + px + width - 2 - cell->stat_hp * (width - 4) / 255, py - 1); + } + } + } } void -draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) +draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) CODE: { static float color[16][3] = { @@ -1486,7 +1635,7 @@ } void -fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) +fow_texture (CFPlus::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) PPCODE: { int vx, vy; @@ -1512,9 +1661,9 @@ { mapcell *cell = row->col + (x + vx - row->c0); - darkness[y * sw4 + x] = cell->darkness < 0 - ? 255 - FOW_DARKNESS - : 255 - cell->darkness; + darkness[y * sw4 + x] = cell->darkness + ? 255 - (cell->darkness - 1) + : 255 - FOW_DARKNESS; } } @@ -1525,7 +1674,7 @@ } SV * -get_rect (CFClient::Map self, int x0, int y0, int w, int h) +get_rect (CFPlus::Map self, int x0, int y0, int w, int h) CODE: { int x, y, x1, y1; @@ -1597,7 +1746,7 @@ RETVAL void -set_rect (CFClient::Map self, int x0, int y0, uint8_t *data) +set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) PPCODE: { int x, y, z; @@ -1639,9 +1788,9 @@ if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } - if (cell->darkness <= 0) + if (cell->darkness == 0) { - cell->darkness = -1; + cell->darkness = 0; for (z = 0; z <= 2; z++) { @@ -1656,9 +1805,9 @@ } } -MODULE = CFClient PACKAGE = CFClient::MixChunk +MODULE = CFPlus PACKAGE = CFPlus::MixChunk -CFClient::MixChunk +CFPlus::MixChunk new_from_file (SV *class, char *path) CODE: RETVAL = Mix_LoadWAV (path); @@ -1666,25 +1815,25 @@ RETVAL void -DESTROY (CFClient::MixChunk self) +DESTROY (CFPlus::MixChunk self) CODE: Mix_FreeChunk (self); int -volume (CFClient::MixChunk self, int volume = -1) +volume (CFPlus::MixChunk self, int volume = -1) CODE: RETVAL = Mix_VolumeChunk (self, volume); OUTPUT: RETVAL int -play (CFClient::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) +play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) CODE: RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); OUTPUT: RETVAL -MODULE = CFClient PACKAGE = CFClient::MixMusic +MODULE = CFPlus PACKAGE = CFPlus::MixMusic int volume (int volume = -1) @@ -1693,7 +1842,7 @@ OUTPUT: RETVAL -CFClient::MixMusic +CFPlus::MixMusic new_from_file (SV *class, char *path) CODE: RETVAL = Mix_LoadMUS (path); @@ -1701,22 +1850,22 @@ RETVAL void -DESTROY (CFClient::MixMusic self) +DESTROY (CFPlus::MixMusic self) CODE: Mix_FreeMusic (self); int -play (CFClient::MixMusic self, int loops = -1) +play (CFPlus::MixMusic self, int loops = -1) CODE: RETVAL = Mix_PlayMusic (self, loops); OUTPUT: RETVAL -MODULE = CFClient PACKAGE = CFClient::OpenGL +MODULE = CFPlus PACKAGE = CFPlus::OpenGL BOOT: { - HV *stash = gv_stashpv ("CFClient::OpenGL", 1); + HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); static const struct { const char *name; IV iv; @@ -1789,6 +1938,7 @@ const_iv (GL_CONVOLUTION_BORDER_MODE), const_iv (GL_CONSTANT_BORDER), const_iv (GL_LINES), + const_iv (GL_LINE_STRIP), const_iv (GL_LINE_LOOP), const_iv (GL_QUADS), const_iv (GL_QUAD_STRIP), @@ -1908,10 +2058,7 @@ b *= a; } // microsoft visual "c" rounds instead of truncating... - glColor4ub (MIN ((int)(r * 256.f), 255), - MIN ((int)(g * 256.f), 255), - MIN ((int)(b * 256.f), 255), - MIN ((int)(a * 256.f), 255)); + glColor4f (r, g, b, a); void glInterleavedArrays (int format, int stride, char *data) @@ -1998,4 +2145,3 @@ void glCallList (int list) -