… | |
… | |
55 | #if 0 |
55 | #if 0 |
56 | # define PARACHUTE SDL_INIT_NOPARACHUTE |
56 | # define PARACHUTE SDL_INIT_NOPARACHUTE |
57 | #else |
57 | #else |
58 | # define PARACHUTE 0 |
58 | # define PARACHUTE 0 |
59 | #endif |
59 | #endif |
|
|
60 | |
|
|
61 | static AV *texture_av; |
60 | |
62 | |
61 | static struct |
63 | static struct |
62 | { |
64 | { |
63 | #define GL_FUNC(ptr,name) ptr name; |
65 | #define GL_FUNC(ptr,name) ptr name; |
64 | #include "glfunc.h" |
66 | #include "glfunc.h" |
… | |
… | |
400 | |
402 | |
401 | /* SDL should provide this, really. */ |
403 | /* SDL should provide this, really. */ |
402 | #define SDLK_MODIFIER_MIN 300 |
404 | #define SDLK_MODIFIER_MIN 300 |
403 | #define SDLK_MODIFIER_MAX 314 |
405 | #define SDLK_MODIFIER_MAX 314 |
404 | |
406 | |
405 | static AV *texture_av; |
|
|
406 | |
|
|
407 | MODULE = CFPlus PACKAGE = CFPlus |
407 | MODULE = CFPlus PACKAGE = CFPlus |
408 | |
408 | |
409 | PROTOTYPES: ENABLE |
409 | PROTOTYPES: ENABLE |
410 | |
410 | |
411 | BOOT: |
411 | BOOT: |
412 | { |
412 | { |
413 | texture_av = newAV (); |
|
|
414 | AvREAL_off (texture_av); |
|
|
415 | |
|
|
416 | HV *stash = gv_stashpv ("CFPlus", 1); |
413 | HV *stash = gv_stashpv ("CFPlus", 1); |
417 | static const struct { |
414 | static const struct { |
418 | const char *name; |
415 | const char *name; |
419 | IV iv; |
416 | IV iv; |
420 | } *civ, const_iv[] = { |
417 | } *civ, const_iv[] = { |
… | |
… | |
619 | RETVAL = !!SDL_SetVideoMode ( |
616 | RETVAL = !!SDL_SetVideoMode ( |
620 | w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0) |
617 | w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0) |
621 | ); |
618 | ); |
622 | if (RETVAL) |
619 | if (RETVAL) |
623 | { |
620 | { |
|
|
621 | av_clear (texture_av); |
|
|
622 | |
624 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
623 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
625 | # define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
624 | # define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
626 | # include "glfunc.h" |
625 | # include "glfunc.h" |
627 | # undef GL_FUNC |
626 | # undef GL_FUNC |
|
|
627 | |
628 | } |
628 | } |
629 | OUTPUT: |
629 | OUTPUT: |
630 | RETVAL |
630 | RETVAL |
631 | |
631 | |
632 | void |
632 | void |
… | |
… | |
1396 | CODE: |
1396 | CODE: |
1397 | { |
1397 | { |
1398 | if (dx > 0) |
1398 | if (dx > 0) |
1399 | map_blank (self, self->x, self->y, dx, self->h); |
1399 | map_blank (self, self->x, self->y, dx, self->h); |
1400 | else if (dx < 0) |
1400 | else if (dx < 0) |
1401 | 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); |
1402 | |
1402 | |
1403 | if (dy > 0) |
1403 | if (dy > 0) |
1404 | map_blank (self, self->x, self->y, self->w, dy); |
1404 | map_blank (self, self->x, self->y, self->w, dy); |
1405 | else if (dy < 0) |
1405 | else if (dy < 0) |
1406 | 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); |
1407 | |
1407 | |
1408 | self->ox += dx; self->x += dx; |
1408 | self->ox += dx; self->x += dx; |
1409 | self->oy += dy; self->y += dy; |
1409 | self->oy += dy; self->y += dy; |
1410 | |
1410 | |
1411 | while (self->y < 0) |
1411 | while (self->y < 0) |
… | |
… | |
2215 | # undef const_iv |
2215 | # undef const_iv |
2216 | }; |
2216 | }; |
2217 | |
2217 | |
2218 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
2218 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
2219 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
2219 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
2220 | |
|
|
2221 | texture_av = newAV (); |
|
|
2222 | AvREAL_off (texture_av); |
2220 | } |
2223 | } |
2221 | |
2224 | |
2222 | char * |
2225 | char * |
2223 | gl_vendor () |
2226 | gl_vendor () |
2224 | CODE: |
2227 | CODE: |
… | |
… | |
2387 | RETVAL |
2390 | RETVAL |
2388 | |
2391 | |
2389 | void glDeleteTexture (int name) |
2392 | void glDeleteTexture (int name) |
2390 | CODE: |
2393 | CODE: |
2391 | { |
2394 | { |
|
|
2395 | /* make a half-assed attempt at returning the memory used by the texture */ |
|
|
2396 | /* textures are frequently being reused by cfplus anyway */ |
2392 | glBindTexture (GL_TEXTURE_2D, name); |
2397 | glBindTexture (GL_TEXTURE_2D, name); |
2393 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
2398 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
2394 | av_push (texture_av, (SV *)name); |
2399 | av_push (texture_av, (SV *)name); |
2395 | /*glDeleteTextures (1, &name_);*/ |
2400 | /*glDeleteTextures (1, &name_);*/ |
2396 | } |
2401 | } |