… | |
… | |
345 | } smooth_key; |
345 | } smooth_key; |
346 | |
346 | |
347 | static void |
347 | static void |
348 | smooth_or_bits (HV *hv, smooth_key *key, IV bits) |
348 | smooth_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 | |
|
|
405 | static AV *texture_av; |
|
|
406 | |
405 | MODULE = CFPlus PACKAGE = CFPlus |
407 | MODULE = CFPlus PACKAGE = CFPlus |
406 | |
408 | |
407 | PROTOTYPES: ENABLE |
409 | PROTOTYPES: ENABLE |
408 | |
410 | |
409 | BOOT: |
411 | BOOT: |
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[] = { |
… | |
… | |
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 | |
2371 | int glGenTexture () |
2376 | int 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 | |
2381 | void glDeleteTexture (int name) |
2389 | void glDeleteTexture (int name) |
2382 | CODE: |
2390 | CODE: |
2383 | { |
2391 | { |
2384 | GLuint name_ = name; |
2392 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
2393 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
|
|
2394 | av_push (texture_av, (SV *)name); |
2385 | glDeleteTextures (1, &name_); |
2395 | /*glDeleteTextures (1, &name_);*/ |
2386 | } |
2396 | } |
2387 | |
2397 | |
2388 | int glGenList () |
2398 | int glGenList () |
2389 | CODE: |
2399 | CODE: |
2390 | RETVAL = glGenLists (1); |
2400 | RETVAL = glGenLists (1); |