… | |
… | |
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" |
… | |
… | |
614 | RETVAL = !!SDL_SetVideoMode ( |
616 | RETVAL = !!SDL_SetVideoMode ( |
615 | w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0) |
617 | w, h, 0, SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0) |
616 | ); |
618 | ); |
617 | if (RETVAL) |
619 | if (RETVAL) |
618 | { |
620 | { |
|
|
621 | av_clear (texture_av); |
|
|
622 | |
619 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
623 | SDL_WM_SetCaption ("Crossfire+ Client " VERSION, "Crossfire+"); |
620 | # 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); |
621 | # include "glfunc.h" |
625 | # include "glfunc.h" |
622 | # undef GL_FUNC |
626 | # undef GL_FUNC |
|
|
627 | |
623 | } |
628 | } |
624 | OUTPUT: |
629 | OUTPUT: |
625 | RETVAL |
630 | RETVAL |
626 | |
631 | |
627 | void |
632 | void |
… | |
… | |
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) |
… | |
… | |
2210 | # undef const_iv |
2215 | # undef const_iv |
2211 | }; |
2216 | }; |
2212 | |
2217 | |
2213 | 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; ) |
2214 | 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); |
2215 | } |
2223 | } |
2216 | |
2224 | |
2217 | char * |
2225 | char * |
2218 | gl_vendor () |
2226 | gl_vendor () |
2219 | CODE: |
2227 | CODE: |
… | |
… | |
2370 | |
2378 | |
2371 | int glGenTexture () |
2379 | int glGenTexture () |
2372 | CODE: |
2380 | CODE: |
2373 | { |
2381 | { |
2374 | GLuint name; |
2382 | GLuint name; |
|
|
2383 | if (AvFILL (texture_av) >= 0) |
|
|
2384 | name = (GLuint)av_pop (texture_av); |
|
|
2385 | else |
2375 | glGenTextures (1, &name); |
2386 | glGenTextures (1, &name); |
2376 | RETVAL = name; |
2387 | RETVAL = name; |
2377 | } |
2388 | } |
2378 | OUTPUT: |
2389 | OUTPUT: |
2379 | RETVAL |
2390 | RETVAL |
2380 | |
2391 | |
2381 | void glDeleteTexture (int name) |
2392 | void glDeleteTexture (int name) |
2382 | CODE: |
2393 | CODE: |
2383 | { |
2394 | { |
2384 | GLuint name_ = name; |
2395 | /* make a half-assed attempt at returning the memory used by the texture */ |
|
|
2396 | /* textures are frequently being reused by cfplus anyway */ |
|
|
2397 | glBindTexture (GL_TEXTURE_2D, name); |
|
|
2398 | glTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, 0, 0, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0); |
|
|
2399 | av_push (texture_av, (SV *)name); |
2385 | glDeleteTextures (1, &name_); |
2400 | /*glDeleteTextures (1, &name_);*/ |
2386 | } |
2401 | } |
2387 | |
2402 | |
2388 | int glGenList () |
2403 | int glGenList () |
2389 | CODE: |
2404 | CODE: |
2390 | RETVAL = glGenLists (1); |
2405 | RETVAL = glGenLists (1); |