--- deliantra/Deliantra-Client/Client.xs 2006/04/19 23:37:48 1.54 +++ deliantra/Deliantra-Client/Client.xs 2006/04/23 00:57:38 1.58 @@ -35,11 +35,15 @@ typedef signed int int32_t; #endif +#include "glext.h" + #define FOW_DARKNESS 32 #define MAP_EXTEND_X 32 #define MAP_EXTEND_Y 512 +#define MIN_FONT_HEIGHT 8 * PANGO_SCALE + typedef Mix_Chunk *CFClient__MixChunk; typedef Mix_Music *CFClient__MixMusic; @@ -68,6 +72,9 @@ int height = self->base_height * (PANGO_SCALE * 8 / 10); + if (height < MIN_FONT_HEIGHT) + height = MIN_FONT_HEIGHT; + if (pango_font_description_get_size (font) != height) { pango_font_description_set_absolute_size (font, height); @@ -241,6 +248,19 @@ } } +static void +music_finished () +{ + SDL_UserEvent ev; + + ev.type = SDL_USEREVENT; + ev.code = 0; + ev.data1 = 0; + ev.data2 = 0; + + SDL_PushEvent ((SDL_Event *)&ev); +} + MODULE = CFClient PACKAGE = CFClient PROTOTYPES: ENABLE @@ -465,6 +485,8 @@ int Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) + POSTCALL: + Mix_HookMusicFinished (music_finished); void Mix_CloseAudio () @@ -935,11 +957,11 @@ } SV * -mapmap (CFClient::Map self, int w, int h) +mapmap (CFClient::Map self, int x0, int y0, int w, int h) CODE: { - int x0, x1, x; - int y0, y1, y; + int x1, x; + int y1, y; int z; SV *map_sv = newSV (w * h * sizeof (uint32_t)); uint32_t *map = (uint32_t *)SvPVX (map_sv); @@ -947,8 +969,8 @@ SvPOK_only (map_sv); SvCUR_set (map_sv, w * h * sizeof (uint32_t)); - x0 = self->x - w / 2; x1 = x0 + w; - y0 = self->y - h / 2; y1 = y0 + h; + x0 += self->x; x1 = x0 + w; + y0 += self->y; y1 = y0 + h; for (y = y0; y < y1; y++) { @@ -1098,7 +1120,7 @@ *data++ = h >> 8; *data++ = h; // we need to do this 'cause we don't keep an absolute coord system for rows - // TODO: treat rows as we treat + // TODO: treat rows as we treat columns map_get_row (self, y0 + self->y - self->oy);//D map_get_row (self, y0 + self->y - self->oy + h - 1);//D @@ -1172,7 +1194,7 @@ h = *data++ << 8; h |= *data++; // we need to do this 'cause we don't keep an absolute coord system for rows - // TODO: treat rows as we treat + // TODO: treat rows as we treat columns map_get_row (self, y0 + self->y - self->oy);//D map_get_row (self, y0 + self->y - self->oy + h - 1);//D @@ -1310,6 +1332,12 @@ const_iv (GL_REPEAT), const_iv (GL_NEAREST), const_iv (GL_LINEAR), + const_iv (GL_NEAREST_MIPMAP_NEAREST), + const_iv (GL_LINEAR_MIPMAP_NEAREST), + const_iv (GL_NEAREST_MIPMAP_LINEAR), + const_iv (GL_LINEAR_MIPMAP_LINEAR), + const_iv (GL_GENERATE_MIPMAP), + const_iv (GL_LINEAR), const_iv (GL_MODULATE), const_iv (GL_REPLACE), const_iv (GL_COLOR_BUFFER_BIT), @@ -1321,6 +1349,7 @@ const_iv (GL_CONSTANT_BORDER), const_iv (GL_LINES), const_iv (GL_QUADS), + const_iv (GL_LINE_LOOP), const_iv (GL_PERSPECTIVE_CORRECTION_HINT), const_iv (GL_FASTEST), # undef const_iv