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.180 by root, Fri Apr 13 18:11:26 2007 UTC vs.
Revision 1.187 by root, Sat Apr 21 23:36:20 2007 UTC

345} smooth_key; 345} smooth_key;
346 346
347static void 347static void
348smooth_or_bits (HV *hv, smooth_key *key, IV bits) 348smooth_or_bits (HV *hv, smooth_key *key, IV bits)
349{ 349{
350 SV **sv = hv_fetch (hv, (char *)key, sizeof (key), 1); 350 SV **sv = hv_fetch (hv, (char *)key, sizeof (*key), 1);
351 351
352 if (SvIOK (*sv)) 352 if (SvIOK (*sv))
353 SvIV_set (*sv, SvIVX (*sv) | bits); 353 SvIV_set (*sv, SvIVX (*sv) | bits);
354 else 354 else
355 sv_setiv (*sv, bits); 355 sv_setiv (*sv, bits);
400 400
401/* SDL should provide this, really. */ 401/* SDL should provide this, really. */
402#define SDLK_MODIFIER_MIN 300 402#define SDLK_MODIFIER_MIN 300
403#define SDLK_MODIFIER_MAX 314 403#define SDLK_MODIFIER_MAX 314
404 404
405static AV *texture_av;
406
405MODULE = CFPlus PACKAGE = CFPlus 407MODULE = CFPlus PACKAGE = CFPlus
406 408
407PROTOTYPES: ENABLE 409PROTOTYPES: ENABLE
408 410
409BOOT: 411BOOT:
410{ 412{
413 texture_av = newAV ();
414 AvREAL_off (texture_av);
415
411 HV *stash = gv_stashpv ("CFPlus", 1); 416 HV *stash = gv_stashpv ("CFPlus", 1);
412 static const struct { 417 static const struct {
413 const char *name; 418 const char *name;
414 IV iv; 419 IV iv;
415 } *civ, const_iv[] = { 420 } *civ, const_iv[] = {
1391 CODE: 1396 CODE:
1392{ 1397{
1393 if (dx > 0) 1398 if (dx > 0)
1394 map_blank (self, self->x, self->y, dx, self->h); 1399 map_blank (self, self->x, self->y, dx, self->h);
1395 else if (dx < 0) 1400 else if (dx < 0)
1396 map_blank (self, self->x + self->w + dx + 1, self->y, -dx, self->h); 1401 map_blank (self, self->x + self->w + dx, self->y, -dx, self->h);
1397 1402
1398 if (dy > 0) 1403 if (dy > 0)
1399 map_blank (self, self->x, self->y, self->w, dy); 1404 map_blank (self, self->x, self->y, self->w, dy);
1400 else if (dy < 0) 1405 else if (dy < 0)
1401 map_blank (self, self->x, self->y + self->h + dy + 1, self->w, -dy); 1406 map_blank (self, self->x, self->y + self->h + dy, self->w, -dy);
1402 1407
1403 self->ox += dx; self->x += dx; 1408 self->ox += dx; self->x += dx;
1404 self->oy += dy; self->y += dy; 1409 self->oy += dy; self->y += dy;
1405 1410
1406 while (self->y < 0) 1411 while (self->y < 0)
1460 } 1465 }
1461 else if (cmd == 6) // monster width 1466 else if (cmd == 6) // monster width
1462 cell->stat_width = *data++ + 1; 1467 cell->stat_width = *data++ + 1;
1463 else if (cmd == 0x47) 1468 else if (cmd == 0x47)
1464 { 1469 {
1465 if (*data == 8) 1470 if (*data == 4)
1466 ; // decode player uuid 1471 ; // decode player count
1467 1472
1468 data += *data + 1; 1473 data += *data + 1;
1469 } 1474 }
1470 else if (cmd == 8) // cell flags 1475 else if (cmd == 8) // cell flags
1471 cell->flags = *data++; 1476 cell->flags = *data++;
1712 } 1717 }
1713 } 1718 }
1714 } 1719 }
1715 } 1720 }
1716 1721
1717 // go through all smoothlevels, lowest to highest, then draw 1722 // go through all smoothlevels, lowest to highest, then draw.
1718 // this is basically counting sort 1723 // this is basically counting sort
1719 { 1724 {
1720 int w, b; 1725 int w, b;
1721 1726
1722 for (w = 0; w < 256 / 32; ++w) 1727 for (w = 0; w < 256 / 32; ++w)
2370 2375
2371int glGenTexture () 2376int glGenTexture ()
2372 CODE: 2377 CODE:
2373{ 2378{
2374 GLuint name; 2379 GLuint name;
2380 if (AvFILL (texture_av) >= 0)
2381 name = (GLuint)av_pop (texture_av);
2382 else
2375 glGenTextures (1, &name); 2383 glGenTextures (1, &name);
2376 RETVAL = name; 2384 RETVAL = name;
2377} 2385}
2378 OUTPUT: 2386 OUTPUT:
2379 RETVAL 2387 RETVAL
2380 2388
2381void glDeleteTexture (int name) 2389void glDeleteTexture (int name)
2382 CODE: 2390 CODE:
2383{ 2391{
2384 GLuint name_ = name; 2392 /* make a half-assed attempt at returning the memory used by the texture */
2393 /* textures are frequently being reused by cfplus anyway */
2394 glBindTexture (GL_TEXTURE_2D, name);
2395 glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
2396 av_push (texture_av, (SV *)name);
2385 glDeleteTextures (1, &name_); 2397 /*glDeleteTextures (1, &name_);*/
2386} 2398}
2387 2399
2388int glGenList () 2400int glGenList ()
2389 CODE: 2401 CODE:
2390 RETVAL = glGenLists (1); 2402 RETVAL = glGenLists (1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines