--- deliantra/Deliantra-Client/Client.xs 2007/07/31 00:56:02 1.216 +++ deliantra/Deliantra-Client/Client.xs 2007/08/09 11:02:08 1.220 @@ -806,7 +806,7 @@ } int -Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) +Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 1024) POSTCALL: Mix_HookMusicFinished (music_finished); Mix_ChannelFinished (channel_finished); @@ -1352,6 +1352,9 @@ float t = SvNV (*hv_fetch (hv, "t", 1, 1)); int name = SvIV (*hv_fetch (hv, "name", 4, 1)); + if (name <= 0) + XSRETURN_EMPTY; + if (items < 5) { w = SvNV (*hv_fetch (hv, "w", 1, 1)); @@ -1698,7 +1701,7 @@ OUTPUT: RETVAL -void +SV * draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) CODE: { @@ -1708,6 +1711,8 @@ smooth_key skey; int x, y, z; int last_name; + AV *missing = newAV (); + RETVAL = newRV_noinc ((SV *)missing); // thats current max. sorry. if (sw > 255) sw = 255; @@ -1725,7 +1730,7 @@ glBegin (GL_QUADS); - last_name = 0; + last_name = -1; mx += self->x; my += self->y; @@ -1770,21 +1775,26 @@ if (tile) { maptex tex = self->tex [tile]; - int px = (x + 1) * T - tex.w; - int py = (y + 1) * T - tex.h; + int px, py; // suppressing texture state switches here // is only moderately effective, but worth the extra effort if (last_name != tex.name) { if (!tex.name) - tex = self->tex [2]; /* missing, replace by noface */ + { + av_push (missing, newSViv (tile)); + tex = self->tex [2]; /* missing, replace by noface */ + } glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); glBegin (GL_QUADS); } + px = (x + 1) * T - tex.w; + py = (y + 1) * T - tex.h; + 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); @@ -1889,7 +1899,10 @@ if (last_name != tex.name) { if (!tex.name) - continue; // smoothing not yet available + { + av_push (missing, newSViv (skey->tile)); + continue; // smoothing not yet available + } glEnd (); glBindTexture (GL_TEXTURE_2D, last_name = tex.name); @@ -1960,6 +1973,8 @@ } } } + OUTPUT: + RETVAL void draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) @@ -2262,10 +2277,12 @@ OUTPUT: RETVAL -void -close (CFPlus::RW self) - CODE: - SDL_RWclose (self); +# fails on win32: +# CFPlus.xs(2268) : error C2059: syntax error : '(' +#void +#close (CFPlus::RW self) +# CODE: +# (self->(close)) (self); MODULE = CFPlus PACKAGE = CFPlus::Channel @@ -2335,7 +2352,15 @@ void set_position (CFPlus::Channel self, int angle, int distance) CODE: + +void +set_position_r (CFPlus::Channel self, int dx, int dy, int maxdistance) + CODE: +{ + int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); + int angle = 360 + (int)roundf (atan2f (dx, -dy) * 180.f / (float)M_PI); Mix_SetPosition (self, angle, CLAMP (distance, 0, 255)); +} void set_reverse_stereo (CFPlus::Channel self, int flip)