… | |
… | |
15 | |
15 | |
16 | #include "EXTERN.h" |
16 | #include "EXTERN.h" |
17 | #include "perl.h" |
17 | #include "perl.h" |
18 | #include "XSUB.h" |
18 | #include "XSUB.h" |
19 | |
19 | |
|
|
20 | #include "flat_hash_map.hpp" |
|
|
21 | |
20 | #ifdef _WIN32 |
22 | #ifdef _WIN32 |
21 | # undef pipe |
23 | # undef pipe |
22 | // microsoft vs. C |
24 | // microsoft vs. C |
23 | # define sqrtf(x) sqrt(x) |
25 | # define sqrtf(x) sqrt(x) |
24 | # define atan2f(x,y) atan2(x,y) |
26 | # define atan2f(x,y) atan2(x,y) |
25 | # define M_PI 3.14159265f |
27 | # define M_PI 3.14159265f |
26 | #endif |
28 | #endif |
27 | |
29 | |
28 | #include <assert.h> |
30 | #include <cassert> |
29 | #include <math.h> |
31 | #include <cmath> |
30 | #include <string.h> |
32 | #include <cstring> |
31 | #include <stdio.h> |
33 | #include <cstdio> |
32 | #include <stdlib.h> |
34 | #include <cstdlib> |
|
|
35 | |
|
|
36 | #include <utility> |
33 | |
37 | |
34 | #define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW |
38 | #define USE_RWOPS 1 // for SDL_mixer:LoadMUS_RW |
35 | |
39 | |
36 | #include <SDL.h> |
40 | #include <SDL.h> |
37 | #include <SDL_thread.h> |
41 | #include <SDL_thread.h> |
… | |
… | |
48 | #endif |
52 | #endif |
49 | |
53 | |
50 | #define PANGO_ENABLE_BACKEND |
54 | #define PANGO_ENABLE_BACKEND |
51 | #define G_DISABLE_CAST_CHECKS |
55 | #define G_DISABLE_CAST_CHECKS |
52 | |
56 | |
53 | #include <glib/gmacros.h> |
57 | #include <glib.h> |
54 | |
58 | |
55 | #include <pango/pango.h> |
59 | #include <pango/pango.h> |
56 | |
60 | |
57 | #ifndef PANGO_VERSION_CHECK |
61 | #ifndef PANGO_VERSION_CHECK |
58 | # define PANGO_VERSION_CHECK(a,b,c) 0 |
62 | # define PANGO_VERSION_CHECK(a,b,c) 0 |
… | |
… | |
100 | #define KMOD_LRAM 0x10000 // our extension |
104 | #define KMOD_LRAM 0x10000 // our extension |
101 | |
105 | |
102 | #define TEXID_SPEECH 1 |
106 | #define TEXID_SPEECH 1 |
103 | #define TEXID_NOFACE 2 |
107 | #define TEXID_NOFACE 2 |
104 | |
108 | |
|
|
109 | static char * |
|
|
110 | fast_sv_grow (SV *sv, STRLEN need) |
|
|
111 | { |
|
|
112 | STRLEN len = SvLEN (sv); |
|
|
113 | STRLEN want = SvCUR (sv) + need; |
|
|
114 | |
|
|
115 | if (expect_false (len < want)) |
|
|
116 | { |
|
|
117 | do |
|
|
118 | len *= 2; |
|
|
119 | while (len < want); |
|
|
120 | |
|
|
121 | sv_grow (sv, len); |
|
|
122 | } |
|
|
123 | |
|
|
124 | SvCUR_set (sv, want); |
|
|
125 | return SvEND (sv) - need; |
|
|
126 | } |
|
|
127 | |
105 | static AV *texture_av; |
128 | static AV *texture_av; |
106 | |
129 | |
107 | static struct |
130 | static struct |
108 | { |
131 | { |
109 | #define GL_FUNC(ptr,name) ptr name; |
132 | #define GL_FUNC(ptr,name) ptr name; |
… | |
… | |
165 | { |
188 | { |
166 | GSList *attrs = run->item->analysis.extra_attrs; |
189 | GSList *attrs = run->item->analysis.extra_attrs; |
167 | |
190 | |
168 | while (attrs) |
191 | while (attrs) |
169 | { |
192 | { |
170 | PangoAttribute *attr = attrs->data; |
193 | PangoAttribute *attr = (PangoAttribute *)attrs->data; |
171 | |
194 | |
172 | if (attr->klass->type == PANGO_ATTR_SHAPE) |
195 | if (attr->klass->type == PANGO_ATTR_SHAPE) |
173 | return 1; |
196 | return 1; |
174 | |
197 | |
175 | attrs = attrs->next; |
198 | attrs = attrs->next; |
176 | } |
199 | } |
177 | |
200 | |
178 | return 0; |
201 | return 0; |
179 | } |
202 | } |
180 | |
203 | |
181 | typedef struct cf_layout { |
204 | struct cf_layout { |
182 | PangoLayout *pl; |
205 | PangoLayout *pl; |
183 | float r, g, b, a; // default color for rgba mode |
206 | float r, g, b, a; // default color for rgba mode |
184 | int base_height; |
207 | int base_height; |
185 | DC__Font font; |
208 | DC__Font font; |
186 | rc_t *rc; |
209 | rc_t *rc; |
187 | } *DC__Layout; |
210 | }; |
|
|
211 | |
|
|
212 | typedef cf_layout *DC__Layout; |
188 | |
213 | |
189 | static DC__Font default_font; |
214 | static DC__Font default_font; |
190 | static PangoContext *opengl_context; |
215 | static PangoContext *opengl_context; |
191 | static PangoFontMap *opengl_fontmap; |
216 | static PangoFontMap *opengl_fontmap; |
192 | |
217 | |
193 | static void |
218 | static void |
194 | substitute_func (FcPattern *pattern, gpointer data) |
219 | substitute_func (FcPattern *pattern, gpointer data) |
195 | { |
220 | { |
196 | FcPatternAddBool (pattern, FC_HINTING, 1); |
221 | FcPatternAddBool (pattern, FC_HINTING, 1); |
197 | #ifdef FC_HINT_STYLE |
222 | #ifdef FC_HINT_STYLE |
198 | FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL); |
223 | FcPatternAddInteger (pattern, FC_HINT_STYLE, FC_HINT_FULL); |
199 | #endif |
224 | #endif |
200 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
225 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
201 | } |
226 | } |
202 | |
227 | |
203 | static void |
228 | static void |
… | |
… | |
233 | } |
258 | } |
234 | |
259 | |
235 | typedef uint16_t tileid; |
260 | typedef uint16_t tileid; |
236 | typedef uint16_t faceid; |
261 | typedef uint16_t faceid; |
237 | |
262 | |
238 | typedef struct { |
263 | struct maptex |
|
|
264 | { |
239 | GLuint name; |
265 | GLuint name; |
240 | int w, h; |
266 | int w, h; |
241 | float s, t; |
267 | float s, t; |
242 | uint8_t r, g, b, a; |
268 | uint8_t r, g, b, a; |
243 | tileid smoothtile; |
269 | tileid smoothtile; |
244 | uint8_t smoothlevel; |
270 | uint8_t smoothlevel; |
245 | uint8_t unused; /* set to zero on use */ |
271 | uint8_t unused; /* set to zero on use */ |
246 | } maptex; |
272 | }; |
247 | |
273 | |
248 | typedef struct { |
274 | struct mapcell |
|
|
275 | { |
249 | uint32_t player; |
276 | uint32_t player; |
250 | tileid tile[3]; |
277 | tileid tile[3]; |
251 | uint16_t darkness; |
278 | uint16_t darkness; |
252 | uint8_t stat_width, stat_hp, flags, smoothmax; |
279 | uint8_t stat_width, stat_hp, flags, smoothmax; |
253 | } mapcell; |
280 | }; |
254 | |
281 | |
255 | typedef struct { |
282 | struct maprow |
|
|
283 | { |
256 | int32_t c0, c1; |
284 | int32_t c0, c1; |
257 | mapcell *col; |
285 | mapcell *col; |
258 | } maprow; |
286 | }; |
259 | |
287 | |
260 | typedef struct map { |
288 | struct mapgrid { |
261 | int x, y, w, h; |
289 | int x, y, w, h; |
262 | int ox, oy; /* offset to virtual global coordinate system */ |
290 | int ox, oy; /* offset to virtual global coordinate system */ |
263 | int faces; tileid *face2tile; // [faceid] |
291 | int faces; tileid *face2tile; // [faceid] |
264 | int texs; maptex *tex; // [tileid] |
292 | int texs; maptex *tex; // [tileid] |
265 | |
293 | |
266 | int32_t rows; |
294 | int32_t rows; |
267 | maprow *row; |
295 | maprow *row; |
268 | } *DC__Map; |
296 | }; |
|
|
297 | |
|
|
298 | typedef mapgrid *DC__Map; |
269 | |
299 | |
270 | static char * |
300 | static char * |
271 | prepend (char *ptr, int sze, int inc) |
301 | prepend (char *ptr, int sze, int inc) |
272 | { |
302 | { |
273 | char *p; |
303 | char *p; |
… | |
… | |
291 | |
321 | |
292 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
322 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
293 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
323 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
294 | |
324 | |
295 | static void |
325 | static void |
296 | need_facenum (struct map *self, faceid face) |
326 | need_facenum (struct mapgrid *self, faceid face) |
297 | { |
327 | { |
298 | while (self->faces <= face) |
328 | while (self->faces <= face) |
299 | { |
329 | { |
300 | Append (tileid, self->face2tile, self->faces, self->faces); |
330 | Append (tileid, self->face2tile, self->faces, self->faces); |
301 | self->faces *= 2; |
331 | self->faces *= 2; |
302 | } |
332 | } |
303 | } |
333 | } |
304 | |
334 | |
305 | static void |
335 | static void |
306 | need_texid (struct map *self, int texid) |
336 | need_texid (struct mapgrid *self, int texid) |
307 | { |
337 | { |
308 | while (self->texs <= texid) |
338 | while (self->texs <= texid) |
309 | { |
339 | { |
310 | Append (maptex, self->tex, self->texs, self->texs); |
340 | Append (maptex, self->tex, self->texs, self->texs); |
311 | self->texs *= 2; |
341 | self->texs *= 2; |
312 | } |
342 | } |
313 | } |
343 | } |
314 | |
344 | |
315 | static maprow * |
345 | static maprow * |
316 | map_get_row (DC__Map self, int y) |
346 | map_get_row (mapgrid *self, int y) |
317 | { |
347 | { |
318 | if (0 > y) |
348 | if (0 > y) |
319 | { |
349 | { |
320 | int extend = - y + MAP_EXTEND_Y; |
350 | int extend = - y + MAP_EXTEND_Y; |
321 | Prepend (maprow, self->row, self->rows, extend); |
351 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
359 | |
389 | |
360 | return row->col + (x - row->c0); |
390 | return row->col + (x - row->c0); |
361 | } |
391 | } |
362 | |
392 | |
363 | static mapcell * |
393 | static mapcell * |
364 | map_get_cell (DC__Map self, int x, int y) |
394 | map_get_cell (mapgrid *self, int x, int y) |
365 | { |
395 | { |
366 | return row_get_cell (map_get_row (self, y), x); |
396 | return row_get_cell (map_get_row (self, y), x); |
367 | } |
397 | } |
368 | |
398 | |
369 | static void |
399 | static void |
370 | map_clear (DC__Map self) |
400 | map_clear (mapgrid *self) |
371 | { |
401 | { |
372 | int r; |
402 | int r; |
373 | |
403 | |
374 | for (r = 0; r < self->rows; r++) |
404 | for (r = 0; r < self->rows; r++) |
375 | Safefree (self->row[r].col); |
405 | Safefree (self->row[r].col); |
… | |
… | |
393 | (cell)->flags = 0; \ |
423 | (cell)->flags = 0; \ |
394 | (cell)->player = 0; \ |
424 | (cell)->player = 0; \ |
395 | } while (0) |
425 | } while (0) |
396 | |
426 | |
397 | static void |
427 | static void |
398 | map_blank (DC__Map self, int x0, int y0, int w, int h) |
428 | map_blank (mapgrid *self, int x0, int y0, int w, int h) |
399 | { |
429 | { |
400 | int x, y; |
430 | int x, y; |
401 | maprow *row; |
431 | maprow *row; |
402 | mapcell *cell; |
432 | mapcell *cell; |
403 | |
433 | |
… | |
… | |
420 | CELL_CLEAR (cell); |
450 | CELL_CLEAR (cell); |
421 | } |
451 | } |
422 | } |
452 | } |
423 | } |
453 | } |
424 | |
454 | |
425 | typedef struct { |
455 | struct smooth_key |
|
|
456 | { |
426 | tileid tile; |
457 | tileid tile; |
427 | uint8_t x, y, level; |
458 | uint8_t x, y, level; |
428 | } smooth_key; |
459 | |
|
|
460 | bool operator == (const smooth_key &o) const |
|
|
461 | { |
|
|
462 | return tile == o.tile && x == o.x && y == o.y && level == o.level; |
|
|
463 | } |
|
|
464 | }; |
|
|
465 | |
|
|
466 | typedef ska::flat_hash_map<smooth_key, IV> smooth_hash; |
|
|
467 | |
|
|
468 | namespace std { |
|
|
469 | template <> |
|
|
470 | struct hash<smooth_key> |
|
|
471 | { |
|
|
472 | size_t operator () (const smooth_key &v) const |
|
|
473 | { |
|
|
474 | return v.tile + (v.x << 8) + (v.y << 16) + (v.level << 24); |
|
|
475 | } |
|
|
476 | }; |
|
|
477 | } |
429 | |
478 | |
430 | static void |
479 | static void |
431 | smooth_or_bits (HV *hv, smooth_key *key, IV bits) |
480 | smooth_or_bits (smooth_hash &h, smooth_key &key, IV bits) |
432 | { |
481 | { |
433 | SV **sv = hv_fetch (hv, (char *)key, sizeof (*key), 1); |
482 | auto &&it = h.find (key); |
434 | |
483 | |
435 | if (SvIOK (*sv)) |
484 | if (it == h.end ()) |
436 | SvIV_set (*sv, SvIVX (*sv) | bits); |
485 | h.insert (std::make_pair (key, bits)); |
437 | else |
486 | else |
438 | sv_setiv (*sv, bits); |
487 | it->second |= bits; |
439 | } |
488 | } |
440 | |
489 | |
441 | static void |
490 | static void |
442 | music_finished (void) |
491 | music_finished (void) |
443 | { |
492 | { |
… | |
… | |
460 | ev.code = 1; |
509 | ev.code = 1; |
461 | ev.data1 = (void *)(long)channel; |
510 | ev.data1 = (void *)(long)channel; |
462 | ev.data2 = 0; |
511 | ev.data2 = 0; |
463 | |
512 | |
464 | SDL_PushEvent ((SDL_Event *)&ev); |
513 | SDL_PushEvent ((SDL_Event *)&ev); |
|
|
514 | } |
|
|
515 | |
|
|
516 | // approximately divide by 255 |
|
|
517 | static unsigned int |
|
|
518 | div255 (unsigned int n) |
|
|
519 | { |
|
|
520 | return (n + (n >> 8)) >> 8; |
465 | } |
521 | } |
466 | |
522 | |
467 | static unsigned int |
523 | static unsigned int |
468 | minpot (unsigned int n) |
524 | minpot (unsigned int n) |
469 | { |
525 | { |
… | |
… | |
552 | |
608 | |
553 | return mod; |
609 | return mod; |
554 | } |
610 | } |
555 | |
611 | |
556 | static void |
612 | static void |
557 | deliantra_main () |
613 | deliantra_main (SV *real_main) |
558 | { |
614 | { |
559 | char *argv[] = { 0 }; |
615 | dSP; |
560 | call_argv ("::main", G_DISCARD | G_VOID, argv); |
616 | |
|
|
617 | PUSHMARK (SP); |
|
|
618 | call_sv (real_main, G_DISCARD | G_VOID); |
561 | } |
619 | } |
562 | |
620 | |
563 | #ifdef __MACOSX__ |
621 | #ifdef __MACOSX__ |
|
|
622 | static SV *real_main; |
|
|
623 | |
564 | /* to due surprising braindamage on the side of SDL design, we |
624 | /* to due surprising braindamage on the side of SDL design, we |
565 | * do some mind-boggling hack here: SDL requires a custom main() |
625 | * do some mind-boggling hack here: SDL requires a custom main() |
566 | * on OS X, so... we provide one and call the original main(), which, |
626 | * on OS X, so... we provide one and call the original main(), which, |
567 | * due to share dlibrary magic, calls -lSDLmain's main, not perl's main, |
627 | * due to shared library magic, calls -lSDLmain's main, not perl's main, |
568 | * and which calls our main (== SDL_main) back. |
628 | * and which calls our main (== SDL_main) back. |
569 | */ |
629 | */ |
570 | extern C_LINKAGE int |
630 | extern C_LINKAGE int |
571 | main (int argc, char *argv[]) |
631 | main (int argc, char *argv[]) |
572 | { |
632 | { |
573 | deliantra_main (); |
633 | deliantra_main (real_main); |
574 | } |
634 | } |
575 | |
635 | |
576 | #undef main |
636 | #undef main |
577 | |
637 | |
578 | extern C_LINKAGE int main (int argc, char *argv[]); |
638 | extern C_LINKAGE int main (int argc, char *argv[]); |
579 | |
639 | |
580 | static void |
640 | static void |
581 | SDL_braino (void) |
641 | SDL_main_hack (SV *real_main_) |
582 | { |
642 | { |
|
|
643 | real_main = real_main_; |
|
|
644 | |
583 | char *argv[] = { "deliantra client", 0 }; |
645 | char *argv[] = { "deliantra client", 0 }; |
584 | (main) (1, argv); |
646 | (main) (1, argv); |
585 | } |
647 | } |
586 | #else |
648 | #else |
587 | static void |
649 | static void |
588 | SDL_braino (void) |
650 | SDL_main_hack (SV *real_main) |
589 | { |
651 | { |
590 | deliantra_main (); |
652 | deliantra_main (real_main); |
591 | } |
653 | } |
592 | #endif |
654 | #endif |
593 | |
655 | |
594 | MODULE = Deliantra::Client PACKAGE = DC |
656 | MODULE = Deliantra::Client PACKAGE = DC |
595 | |
657 | |
… | |
… | |
796 | |
858 | |
797 | const_iv (FOW_DARKNESS) |
859 | const_iv (FOW_DARKNESS) |
798 | # undef const_iv |
860 | # undef const_iv |
799 | }; |
861 | }; |
800 | |
862 | |
801 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
863 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
802 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
864 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
803 | |
865 | |
804 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
866 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
805 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
867 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
806 | } |
868 | } |
807 | |
869 | |
… | |
… | |
846 | #endif |
908 | #endif |
847 | } |
909 | } |
848 | |
910 | |
849 | char *SDL_GetError () |
911 | char *SDL_GetError () |
850 | |
912 | |
851 | void SDL_braino () |
913 | void SDL_main_hack (SV *real_main) |
|
|
914 | PROTOTYPE: & |
852 | |
915 | |
853 | int SDL_Init (U32 flags) |
916 | int SDL_Init (U32 flags) |
854 | |
917 | |
855 | int SDL_InitSubSystem (U32 flags) |
918 | int SDL_InitSubSystem (U32 flags) |
856 | |
919 | |
857 | void SDL_QuitSubSystem (U32 flags) |
920 | void SDL_QuitSubSystem (U32 flags) |
858 | |
921 | |
859 | void SDL_Quit () |
922 | void SDL_Quit () |
860 | |
923 | |
861 | int SDL_GL_SetAttribute (int attr, int value) |
924 | int SDL_GL_SetAttribute (int attr, int value) |
|
|
925 | C_ARGS: (SDL_GLattr)attr, value |
862 | |
926 | |
863 | int SDL_GL_GetAttribute (int attr) |
927 | int SDL_GL_GetAttribute (int attr) |
864 | CODE: |
928 | CODE: |
865 | if (SDL_GL_GetAttribute (attr, &RETVAL)) |
929 | if (SDL_GL_GetAttribute ((SDL_GLattr)attr, &RETVAL)) |
866 | XSRETURN_UNDEF; |
930 | XSRETURN_UNDEF; |
867 | OUTPUT: |
931 | OUTPUT: |
868 | RETVAL |
932 | RETVAL |
869 | |
933 | |
870 | void |
934 | void |
… | |
… | |
925 | ); |
989 | ); |
926 | |
990 | |
927 | if (RETVAL) |
991 | if (RETVAL) |
928 | { |
992 | { |
929 | av_clear (texture_av); |
993 | av_clear (texture_av); |
930 | |
|
|
931 | SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra"); |
|
|
932 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
994 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
933 | #include "glfunc.h" |
995 | #include "glfunc.h" |
934 | #undef GL_FUNC |
996 | #undef GL_FUNC |
|
|
997 | if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB; |
|
|
998 | if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB; |
935 | } |
999 | } |
936 | } |
1000 | } |
937 | OUTPUT: |
1001 | OUTPUT: |
938 | RETVAL |
1002 | RETVAL |
|
|
1003 | |
|
|
1004 | void |
|
|
1005 | SDL_WM_SetCaption (const char *title, const char *icon) |
939 | |
1006 | |
940 | void |
1007 | void |
941 | SDL_GL_SwapBuffers () |
1008 | SDL_GL_SwapBuffers () |
942 | |
1009 | |
943 | char * |
1010 | char * |
944 | SDL_GetKeyName (int sym) |
1011 | SDL_GetKeyName (int sym) |
|
|
1012 | C_ARGS: (SDLKey)sym |
945 | |
1013 | |
946 | int |
1014 | int |
947 | SDL_GetAppState () |
1015 | SDL_GetAppState () |
948 | |
1016 | |
949 | int |
1017 | int |
950 | SDL_GetModState () |
1018 | SDL_GetModState () |
951 | |
1019 | |
|
|
1020 | int |
|
|
1021 | SDL_WaitEvent () |
|
|
1022 | C_ARGS: 0 |
|
|
1023 | |
952 | void |
1024 | void |
|
|
1025 | SDL_PumpEvents () |
|
|
1026 | |
|
|
1027 | void |
953 | poll_events () |
1028 | peep_events () |
954 | PPCODE: |
1029 | PPCODE: |
955 | { |
1030 | { |
956 | SDL_Event ev; |
1031 | SDL_Event ev; |
957 | |
1032 | |
958 | SDL_PumpEvents (); |
1033 | SDL_PumpEvents (); |
… | |
… | |
1024 | |
1099 | |
1025 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1100 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1026 | } |
1101 | } |
1027 | } |
1102 | } |
1028 | |
1103 | |
|
|
1104 | char * |
|
|
1105 | SDL_AudioDriverName () |
|
|
1106 | CODE: |
|
|
1107 | { |
|
|
1108 | char buf [256]; |
|
|
1109 | if (!SDL_AudioDriverName (buf, sizeof (buf))) |
|
|
1110 | XSRETURN_UNDEF; |
|
|
1111 | |
|
|
1112 | RETVAL = buf; |
|
|
1113 | } |
|
|
1114 | OUTPUT: |
|
|
1115 | RETVAL |
|
|
1116 | |
1029 | int |
1117 | int |
1030 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1118 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1031 | POSTCALL: |
1119 | POSTCALL: |
1032 | Mix_HookMusicFinished (music_finished); |
1120 | Mix_HookMusicFinished (music_finished); |
1033 | Mix_ChannelFinished (channel_finished); |
1121 | Mix_ChannelFinished (channel_finished); |
1034 | |
1122 | |
1035 | void |
1123 | void |
1036 | Mix_QuerySpec () |
1124 | Mix_QuerySpec () |
… | |
… | |
1095 | add_font (char *file) |
1183 | add_font (char *file) |
1096 | CODE: |
1184 | CODE: |
1097 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1185 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1098 | OUTPUT: |
1186 | OUTPUT: |
1099 | RETVAL |
1187 | RETVAL |
|
|
1188 | |
|
|
1189 | void |
|
|
1190 | IMG_Init (int flags = IMG_INIT_JPG | IMG_INIT_PNG) |
|
|
1191 | |
|
|
1192 | # MIX_INIT_MP3 gives smpeg + libstdc++ + libgcc_s |
|
|
1193 | void |
|
|
1194 | Mix_Init (int flags = MIX_INIT_MOD | MIX_INIT_OGG) |
1100 | |
1195 | |
1101 | void |
1196 | void |
1102 | load_image_inline (SV *image_) |
1197 | load_image_inline (SV *image_) |
1103 | ALIAS: |
1198 | ALIAS: |
1104 | load_image_file = 1 |
1199 | load_image_file = 1 |
… | |
… | |
1150 | |
1245 | |
1151 | SDL_LockSurface (surface2); |
1246 | SDL_LockSurface (surface2); |
1152 | EXTEND (SP, 6); |
1247 | EXTEND (SP, 6); |
1153 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
1248 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
1154 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
1249 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
1155 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
1250 | PUSHs (sv_2mortal (newSVpvn ((const char *)surface2->pixels, surface2->h * surface2->pitch))); |
1156 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
1251 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
1157 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
1252 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
1158 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
1253 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
1159 | SDL_UnlockSurface (surface2); |
1254 | SDL_UnlockSurface (surface2); |
1160 | |
1255 | |
… | |
… | |
1232 | MODULE = Deliantra::Client PACKAGE = DC::Font |
1327 | MODULE = Deliantra::Client PACKAGE = DC::Font |
1233 | |
1328 | |
1234 | PROTOTYPES: DISABLE |
1329 | PROTOTYPES: DISABLE |
1235 | |
1330 | |
1236 | DC::Font |
1331 | DC::Font |
1237 | new_from_file (SV *class, char *path, int id = 0) |
1332 | new_from_file (SV *klass, char *path, int id = 0) |
1238 | CODE: |
1333 | CODE: |
1239 | { |
1334 | { |
1240 | int count; |
1335 | int count; |
1241 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
1336 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
1242 | RETVAL = pango_fc_font_description_from_pattern (pattern, 0); |
1337 | RETVAL = pango_fc_font_description_from_pattern (pattern, 0); |
… | |
… | |
1271 | PROTOTYPE: |
1366 | PROTOTYPE: |
1272 | CODE: |
1367 | CODE: |
1273 | tc_restore (); |
1368 | tc_restore (); |
1274 | |
1369 | |
1275 | DC::Layout |
1370 | DC::Layout |
1276 | new (SV *class) |
1371 | new (SV *klass) |
1277 | CODE: |
1372 | CODE: |
1278 | New (0, RETVAL, 1, struct cf_layout); |
1373 | New (0, RETVAL, 1, struct cf_layout); |
1279 | |
1374 | |
1280 | RETVAL->pl = pango_layout_new (opengl_context); |
1375 | RETVAL->pl = pango_layout_new (opengl_context); |
1281 | RETVAL->r = 1.; |
1376 | RETVAL->r = 1.; |
… | |
… | |
1430 | |
1525 | |
1431 | void |
1526 | void |
1432 | set_height (DC::Layout self, int base_height) |
1527 | set_height (DC::Layout self, int base_height) |
1433 | CODE: |
1528 | CODE: |
1434 | if (self->base_height != base_height) |
1529 | if (self->base_height != base_height) |
1435 | { |
1530 | { |
1436 | self->base_height = base_height; |
1531 | self->base_height = base_height; |
1437 | layout_update_font (self); |
1532 | layout_update_font (self); |
1438 | } |
1533 | } |
1439 | |
1534 | |
1440 | void |
1535 | void |
… | |
… | |
1672 | void |
1767 | void |
1673 | draw_fow_texture (float intensity, int hidden_tex, int name1, uint8_t *data1, float s, float t, int w, int h, float blend = 0.f, int dx = 0, int dy = 0, int name2 = 0, uint8_t *data2 = data1) |
1768 | draw_fow_texture (float intensity, int hidden_tex, int name1, uint8_t *data1, float s, float t, int w, int h, float blend = 0.f, int dx = 0, int dy = 0, int name2 = 0, uint8_t *data2 = data1) |
1674 | PROTOTYPE: @ |
1769 | PROTOTYPE: @ |
1675 | CODE: |
1770 | CODE: |
1676 | { |
1771 | { |
|
|
1772 | glEnable (GL_BLEND); |
|
|
1773 | glBlendFunc (intensity ? GL_SRC_ALPHA : GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1677 | glEnable (GL_TEXTURE_2D); |
1774 | glEnable (GL_TEXTURE_2D); |
1678 | glEnable (GL_BLEND); |
|
|
1679 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
|
|
1680 | glBindTexture (GL_TEXTURE_2D, name1); |
1775 | glBindTexture (GL_TEXTURE_2D, name1); |
1681 | |
1776 | |
1682 | glColor3f (intensity, intensity, intensity); |
1777 | glColor3f (intensity, intensity, intensity); |
1683 | glPushMatrix (); |
1778 | glPushMatrix (); |
1684 | glScalef (1./3, 1./3, 1.); |
1779 | glScalef (1./3, 1./3, 1.); |
… | |
… | |
1699 | glBindTexture (GL_TEXTURE_2D, name2); |
1794 | glBindTexture (GL_TEXTURE_2D, name2); |
1700 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1795 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1701 | |
1796 | |
1702 | /* rgb == rgb(glcolor) */ |
1797 | /* rgb == rgb(glcolor) */ |
1703 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1798 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1704 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT); |
1799 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR); |
1705 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1800 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1706 | |
1801 | |
1707 | /* alpha = interpolate t0, t1 by env_alpha */ |
1802 | /* alpha = interpolate t0, t1 by env_alpha */ |
1708 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1803 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1709 | |
1804 | |
… | |
… | |
1804 | MODULE = Deliantra::Client PACKAGE = DC::Map |
1899 | MODULE = Deliantra::Client PACKAGE = DC::Map |
1805 | |
1900 | |
1806 | PROTOTYPES: DISABLE |
1901 | PROTOTYPES: DISABLE |
1807 | |
1902 | |
1808 | DC::Map |
1903 | DC::Map |
1809 | new (SV *class) |
1904 | new (SV *klass) |
1810 | CODE: |
1905 | CODE: |
1811 | New (0, RETVAL, 1, struct map); |
1906 | New (0, RETVAL, 1, mapgrid); |
1812 | RETVAL->x = 0; |
1907 | RETVAL->x = 0; |
1813 | RETVAL->y = 0; |
1908 | RETVAL->y = 0; |
1814 | RETVAL->w = 0; |
1909 | RETVAL->w = 0; |
1815 | RETVAL->h = 0; |
1910 | RETVAL->h = 0; |
1816 | RETVAL->ox = 0; |
1911 | RETVAL->ox = 0; |
… | |
… | |
1853 | |
1948 | |
1854 | void |
1949 | void |
1855 | set_smooth (DC::Map self, int face, int smooth, int level) |
1950 | set_smooth (DC::Map self, int face, int smooth, int level) |
1856 | CODE: |
1951 | CODE: |
1857 | { |
1952 | { |
1858 | tileid texid; |
1953 | tileid texid; |
1859 | maptex *tex; |
1954 | maptex *tex; |
1860 | |
1955 | |
1861 | if (face < 0 || face >= self->faces) |
1956 | if (face < 0 || face >= self->faces) |
1862 | return; |
1957 | return; |
1863 | |
1958 | |
1864 | if (smooth < 0 || smooth >= self->faces) |
1959 | if (smooth < 0 || smooth >= self->faces) |
1865 | return; |
1960 | return; |
1866 | |
1961 | |
1867 | texid = self->face2tile [face]; |
1962 | texid = self->face2tile [face]; |
1868 | |
1963 | |
1869 | if (!texid) |
1964 | if (!texid) |
1870 | return; |
1965 | return; |
1871 | |
1966 | |
1872 | tex = self->tex + texid; |
1967 | tex = self->tex + texid; |
… | |
… | |
1905 | } |
2000 | } |
1906 | |
2001 | |
1907 | void |
2002 | void |
1908 | expire_textures (DC::Map self, int texid, int count) |
2003 | expire_textures (DC::Map self, int texid, int count) |
1909 | PPCODE: |
2004 | PPCODE: |
1910 | for (; texid < self->texs && count; ++texid, --count) |
2005 | for (; texid < self->texs && count; ++texid, --count) |
1911 | { |
2006 | { |
1912 | maptex *tex = self->tex + texid; |
2007 | maptex *tex = self->tex + texid; |
1913 | |
2008 | |
1914 | if (tex->name) |
2009 | if (tex->name) |
1915 | { |
2010 | { |
… | |
… | |
1970 | self->y += MAP_EXTEND_Y; |
2065 | self->y += MAP_EXTEND_Y; |
1971 | } |
2066 | } |
1972 | } |
2067 | } |
1973 | |
2068 | |
1974 | SV * |
2069 | SV * |
1975 | map1a_update (DC::Map self, SV *data_, int extmap) |
2070 | map1a_update (DC::Map self, SV *data_) |
1976 | CODE: |
2071 | CODE: |
1977 | { |
2072 | { |
1978 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
2073 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1979 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
2074 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1980 | mapcell *cell; |
2075 | mapcell *cell; |
… | |
… | |
2001 | |
2096 | |
2002 | //TODO: don't trust server data to be in-range(!) |
2097 | //TODO: don't trust server data to be in-range(!) |
2003 | |
2098 | |
2004 | if (flags & 8) |
2099 | if (flags & 8) |
2005 | { |
2100 | { |
|
|
2101 | uint8_t ext, cmd; |
|
|
2102 | |
2006 | if (extmap) |
2103 | do |
2007 | { |
2104 | { |
2008 | uint8_t ext, cmd; |
2105 | ext = *data++; |
|
|
2106 | cmd = ext & 0x7f; |
2009 | |
2107 | |
2010 | do |
2108 | if (cmd < 4) |
|
|
2109 | cell->darkness = 255 - ext * 64 + 1; /* make sure this doesn't collide with FOW_DARKNESS */ |
|
|
2110 | else if (cmd == 5) // health |
2011 | { |
2111 | { |
2012 | ext = *data++; |
|
|
2013 | cmd = ext & 0x7f; |
|
|
2014 | |
|
|
2015 | if (cmd < 4) |
|
|
2016 | cell->darkness = 255 - ext * 64 + 1; /* make sure this doesn't collide with FOW_DARKNESS */ |
|
|
2017 | else if (cmd == 5) // health |
|
|
2018 | { |
|
|
2019 | cell->stat_width = 1; |
2112 | cell->stat_width = 1; |
2020 | cell->stat_hp = *data++; |
2113 | cell->stat_hp = *data++; |
2021 | } |
|
|
2022 | else if (cmd == 6) // monster width |
|
|
2023 | cell->stat_width = *data++ + 1; |
|
|
2024 | else if (cmd == 0x47) |
|
|
2025 | { |
|
|
2026 | if (*data == 1) cell->player = data [1]; |
|
|
2027 | else if (*data == 2) cell->player = data [2] + (data [1] << 8); |
|
|
2028 | else if (*data == 3) cell->player = data [3] + (data [2] << 8) + (data [1] << 16); |
|
|
2029 | else if (*data == 4) cell->player = data [4] + (data [3] << 8) + (data [2] << 16) + (data [1] << 24); |
|
|
2030 | |
|
|
2031 | data += *data + 1; |
|
|
2032 | } |
|
|
2033 | else if (cmd == 8) // cell flags |
|
|
2034 | cell->flags = *data++; |
|
|
2035 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
2036 | data += *data + 1; |
|
|
2037 | else |
|
|
2038 | data++; |
|
|
2039 | } |
2114 | } |
2040 | while (ext & 0x80); |
2115 | else if (cmd == 6) // monster width |
|
|
2116 | cell->stat_width = *data++ + 1; |
|
|
2117 | else if (cmd == 0x47) |
|
|
2118 | { |
|
|
2119 | if (*data == 1) cell->player = data [1]; |
|
|
2120 | else if (*data == 2) cell->player = data [2] + (data [1] << 8); |
|
|
2121 | else if (*data == 3) cell->player = data [3] + (data [2] << 8) + (data [1] << 16); |
|
|
2122 | else if (*data == 4) cell->player = data [4] + (data [3] << 8) + (data [2] << 16) + (data [1] << 24); |
|
|
2123 | |
|
|
2124 | data += *data + 1; |
|
|
2125 | } |
|
|
2126 | else if (cmd == 8) // cell flags |
|
|
2127 | cell->flags = *data++; |
|
|
2128 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
2129 | data += *data + 1; |
|
|
2130 | else |
|
|
2131 | data++; |
2041 | } |
2132 | } |
2042 | else |
2133 | while (ext & 0x80); |
2043 | cell->darkness = *data++ + 1; |
|
|
2044 | } |
2134 | } |
2045 | |
2135 | |
2046 | for (z = 0; z <= 2; ++z) |
2136 | for (z = 0; z <= 2; ++z) |
2047 | if (flags & (4 >> z)) |
2137 | if (flags & (4 >> z)) |
2048 | { |
2138 | { |
… | |
… | |
2096 | ? self->row + y |
2186 | ? self->row + y |
2097 | : 0; |
2187 | : 0; |
2098 | |
2188 | |
2099 | for (x = x0; x < x1; x++) |
2189 | for (x = x0; x < x1; x++) |
2100 | { |
2190 | { |
2101 | int r = 32, g = 32, b = 32, a = 192; |
2191 | unsigned int r = 32, g = 32, b = 32, a = 192; |
2102 | |
2192 | |
2103 | if (row && row->c0 <= x && x < row->c1) |
2193 | if (row && row->c0 <= x && x < row->c1) |
2104 | { |
2194 | { |
2105 | mapcell *cell = row->col + (x - row->c0); |
2195 | mapcell *cell = row->col + (x - row->c0); |
2106 | |
2196 | |
… | |
… | |
2108 | { |
2198 | { |
2109 | maptex tex = self->tex [cell->tile [z]]; |
2199 | maptex tex = self->tex [cell->tile [z]]; |
2110 | int a0 = 255 - tex.a; |
2200 | int a0 = 255 - tex.a; |
2111 | int a1 = tex.a; |
2201 | int a1 = tex.a; |
2112 | |
2202 | |
2113 | r = (r * a0 + tex.r * a1) / 255; |
2203 | r = div255 (r * a0 + tex.r * a1); |
2114 | g = (g * a0 + tex.g * a1) / 255; |
2204 | g = div255 (g * a0 + tex.g * a1); |
2115 | b = (b * a0 + tex.b * a1) / 255; |
2205 | b = div255 (b * a0 + tex.b * a1); |
2116 | a = (a * a0 + tex.a * a1) / 255; |
2206 | a = div255 (a * a0 + tex.a * a1); |
2117 | } |
2207 | } |
2118 | } |
2208 | } |
2119 | |
2209 | |
2120 | *map++ = (r ) |
2210 | *map++ = (r ) |
2121 | | (g << 8) |
2211 | | (g << 8) |
2122 | | (b << 16) |
2212 | | (b << 16) |
2123 | | (a << 24); |
2213 | | (a << 24); |
2124 | } |
2214 | } |
2125 | } |
2215 | } |
2126 | |
2216 | |
2127 | RETVAL = map_sv; |
2217 | RETVAL = map_sv; |
2128 | } |
2218 | } |
2129 | OUTPUT: |
2219 | OUTPUT: |
2130 | RETVAL |
2220 | RETVAL |
2131 | |
2221 | |
2132 | void |
2222 | void |
2133 | draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int sdx = 0, int sdy = 0) |
2223 | draw (DC::Map self, int mx, int my, int sw, int sh, int Tw, int Th, U32 player = 0xffffffff, int sdx = 0, int sdy = 0) |
2134 | CODE: |
2224 | CODE: |
2135 | { |
2225 | { |
2136 | int x, y, z; |
2226 | int x, y, z; |
2137 | |
2227 | |
2138 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
|
|
2139 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2228 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2140 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2229 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2141 | smooth_key skey; |
2230 | smooth_key skey; |
2142 | int pl_x, pl_y; |
2231 | int pl_x, pl_y; |
2143 | maptex pl_tex; |
2232 | maptex pl_tex; |
… | |
… | |
2192 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2281 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2193 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
2282 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
2194 | |
2283 | |
2195 | for (z = 0; z <= 2; z++) |
2284 | for (z = 0; z <= 2; z++) |
2196 | { |
2285 | { |
|
|
2286 | smooth_hash smooth; |
2197 | memset (smooth_level, 0, sizeof (smooth_level)); |
2287 | memset (smooth_level, 0, sizeof (smooth_level)); |
2198 | key.texname = -1; |
2288 | key.texname = -1; |
2199 | |
2289 | |
2200 | for (y = 0; y < sh; y++) |
2290 | for (y = 0; y < sh; y++) |
2201 | if (0 <= y + my && y + my < self->rows) |
2291 | if (0 <= y + my && y + my < self->rows) |
… | |
… | |
2222 | |
2312 | |
2223 | key.texname = tex.name; |
2313 | key.texname = tex.name; |
2224 | arr = rc_array (rc, &key); |
2314 | arr = rc_array (rc, &key); |
2225 | } |
2315 | } |
2226 | |
2316 | |
2227 | px = (x + 1) * T - tex.w; |
2317 | px = (x + 1) * Th - tex.w; |
2228 | py = (y + 1) * T - tex.h; |
2318 | py = (y + 1) * Tw - tex.h; |
2229 | |
2319 | |
2230 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2320 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2231 | { |
2321 | { |
2232 | pl_x = px; |
2322 | pl_x = px; |
2233 | pl_y = py; |
2323 | pl_y = py; |
… | |
… | |
2262 | |
2352 | |
2263 | // corners: 1 ┛· 2 ·┗ 4 ·· 8 ·· |
2353 | // corners: 1 ┛· 2 ·┗ 4 ·· 8 ·· |
2264 | // ·· ·· ·┏ ┓· |
2354 | // ·· ·· ·┏ ┓· |
2265 | |
2355 | |
2266 | // full tile |
2356 | // full tile |
2267 | skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x1000); |
2357 | skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x1000); |
2268 | |
2358 | |
2269 | // borders |
2359 | // borders |
2270 | skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0091); |
2360 | skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x0091); |
2271 | skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0032); |
2361 | skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0032); |
2272 | skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0064); |
2362 | skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, skey, 0x0064); |
2273 | skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, &skey, 0x00c8); |
2363 | skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, skey, 0x00c8); |
2274 | |
2364 | |
2275 | // corners |
2365 | // corners |
2276 | skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100); |
2366 | skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0100); |
2277 | skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0200); |
2367 | skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, skey, 0x0200); |
2278 | skey.x = x ; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0400); |
2368 | skey.x = x ; skey.y = y ; smooth_or_bits (smooth, skey, 0x0400); |
2279 | skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0800); |
2369 | skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, skey, 0x0800); |
2280 | } |
2370 | } |
2281 | } |
2371 | } |
2282 | |
2372 | |
2283 | if (expect_false (z == 2) && expect_false (cell->flags)) |
2373 | if (expect_false (z == 2) && expect_false (cell->flags)) |
2284 | { |
2374 | { |
… | |
… | |
2286 | if (cell->flags & 1) |
2376 | if (cell->flags & 1) |
2287 | { |
2377 | { |
2288 | rc_key_t key_ov = key; |
2378 | rc_key_t key_ov = key; |
2289 | maptex tex = self->tex [TEXID_SPEECH]; |
2379 | maptex tex = self->tex [TEXID_SPEECH]; |
2290 | rc_array_t *arr; |
2380 | rc_array_t *arr; |
2291 | int px = x * T + T * 2 / 32; |
2381 | int px = x * Tw + Tw * 2 / 32; |
2292 | int py = y * T - T * 6 / 32; |
2382 | int py = y * Th - Th * 6 / 32; |
2293 | |
2383 | |
2294 | key_ov.texname = tex.name; |
2384 | key_ov.texname = tex.name; |
2295 | arr = rc_array (rc_ov, &key_ov); |
2385 | arr = rc_array (rc_ov, &key_ov); |
2296 | |
2386 | |
2297 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2387 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2298 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
2388 | rc_t2f_v3f (arr, 0 , tex.t, px , py + Th, 0); |
2299 | rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); |
2389 | rc_t2f_v3f (arr, tex.s, tex.t, px + Tw, py + Th, 0); |
2300 | rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); |
2390 | rc_t2f_v3f (arr, tex.s, 0 , px + Tw, py , 0); |
2301 | } |
2391 | } |
2302 | } |
2392 | } |
2303 | } |
2393 | } |
2304 | } |
2394 | } |
2305 | |
2395 | |
… | |
… | |
2321 | if (smask & (((uint32_t)1) << b)) |
2411 | if (smask & (((uint32_t)1) << b)) |
2322 | { |
2412 | { |
2323 | int level = (w << 5) | b; |
2413 | int level = (w << 5) | b; |
2324 | HE *he; |
2414 | HE *he; |
2325 | |
2415 | |
2326 | hv_iterinit (smooth); |
2416 | for (auto &&it = smooth.begin (); it != smooth.end (); ++it) |
2327 | while ((he = hv_iternext (smooth))) |
|
|
2328 | { |
2417 | { |
2329 | smooth_key *skey = (smooth_key *)HeKEY (he); |
2418 | smooth_key &skey = it->first; |
2330 | IV bits = SvIVX (HeVAL (he)); |
2419 | IV bits = it->second; |
2331 | |
2420 | |
2332 | if (!(bits & 0x1000) |
2421 | if (!(bits & 0x1000) |
2333 | && skey->level == level |
2422 | && skey.level == level |
2334 | && level > smooth_max [skey->x][skey->y]) |
2423 | && level > smooth_max [skey.x][skey.y]) |
2335 | { |
2424 | { |
2336 | maptex tex = self->tex [skey->tile]; |
2425 | maptex tex = self->tex [skey.tile]; |
2337 | int px = (((int)skey->x) - 1) * T; |
2426 | int px = (((int)skey.x) - 1) * Tw; |
2338 | int py = (((int)skey->y) - 1) * T; |
2427 | int py = (((int)skey.y) - 1) * Th; |
2339 | int border = bits & 15; |
2428 | int border = bits & 15; |
2340 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2429 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2341 | float dx = tex.s * .0625f; // 16 images/row |
2430 | float dx = tex.s * .0625f; // 16 images/row |
2342 | float dy = tex.t * .5f ; // 2 images/column |
2431 | float dy = tex.t * .5f ; // 2 images/column |
2343 | |
2432 | |
… | |
… | |
2345 | { |
2434 | { |
2346 | // this time avoiding texture state changes |
2435 | // this time avoiding texture state changes |
2347 | // save gobs of state changes. |
2436 | // save gobs of state changes. |
2348 | if (key.texname != tex.name) |
2437 | if (key.texname != tex.name) |
2349 | { |
2438 | { |
2350 | self->tex [skey->tile].unused = 0; |
2439 | self->tex [skey.tile].unused = 0; |
2351 | |
2440 | |
2352 | glEnd (); |
2441 | glEnd (); |
2353 | glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); |
2442 | glBindTexture (GL_TEXTURE_2D, key.texname = tex.name); |
2354 | glBegin (GL_QUADS); |
2443 | glBegin (GL_QUADS); |
2355 | } |
2444 | } |
2356 | |
2445 | |
2357 | if (border) |
2446 | if (border) |
2358 | { |
2447 | { |
2359 | float ox = border * dx; |
2448 | float ox = border * dx; |
2360 | |
2449 | |
2361 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2450 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2362 | glTexCoord2f (ox , dy ); glVertex2i (px , py + T); |
2451 | glTexCoord2f (ox , dy ); glVertex2i (px , py + Th); |
2363 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py + T); |
2452 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th); |
2364 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + T, py ); |
2453 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py ); |
2365 | } |
2454 | } |
2366 | |
2455 | |
2367 | if (corner) |
2456 | if (corner) |
2368 | { |
2457 | { |
2369 | float ox = corner * dx; |
2458 | float ox = corner * dx; |
2370 | |
2459 | |
2371 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2460 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2372 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + T); |
2461 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th); |
2373 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + T, py + T); |
2462 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th); |
2374 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py ); |
2463 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py ); |
2375 | } |
2464 | } |
2376 | } |
2465 | } |
2377 | } |
2466 | } |
2378 | } |
2467 | } |
2379 | } |
2468 | } |
… | |
… | |
2381 | |
2470 | |
2382 | glEnd (); |
2471 | glEnd (); |
2383 | glDisable (GL_TEXTURE_2D); |
2472 | glDisable (GL_TEXTURE_2D); |
2384 | key.texname = -1; |
2473 | key.texname = -1; |
2385 | } |
2474 | } |
2386 | |
|
|
2387 | hv_clear (smooth); |
|
|
2388 | } |
2475 | } |
2389 | |
2476 | |
2390 | if (pl_tex.name) |
2477 | if (pl_tex.name) |
2391 | { |
2478 | { |
2392 | maptex tex = pl_tex; |
2479 | maptex tex = pl_tex; |
… | |
… | |
2420 | for (x = 0; x < sw; x++) |
2507 | for (x = 0; x < sw; x++) |
2421 | if (row->c0 <= x + mx && x + mx < row->c1) |
2508 | if (row->c0 <= x + mx && x + mx < row->c1) |
2422 | { |
2509 | { |
2423 | mapcell *cell = row->col + (x + mx - row->c0); |
2510 | mapcell *cell = row->col + (x + mx - row->c0); |
2424 | |
2511 | |
2425 | int px = x * T; |
2512 | int px = x * Tw; |
2426 | int py = y * T; |
2513 | int py = y * Th; |
2427 | |
2514 | |
2428 | if (expect_false (cell->player == player)) |
2515 | if (expect_false (cell->player == player)) |
2429 | { |
2516 | { |
2430 | px += sdx; |
2517 | px += sdx; |
2431 | py += sdy; |
2518 | py += sdy; |
2432 | } |
2519 | } |
2433 | |
2520 | |
2434 | if (cell->stat_hp) |
2521 | if (cell->stat_hp) |
2435 | { |
2522 | { |
2436 | int width = cell->stat_width * T; |
2523 | int width = cell->stat_width * Tw; |
2437 | int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; |
2524 | int thick = (sh * Th / 32 + 27) / 28 + 1 + cell->stat_width; |
2438 | |
2525 | |
2439 | glColor3ub (0, 0, 0); |
2526 | glColor3ub (0, 0, 0); |
2440 | glRectf (px + 1, py - thick - 2, |
2527 | glRectf (px + 1, py - thick - 2, |
2441 | px + width - 1, py); |
2528 | px + width - 1, py); |
2442 | |
2529 | |
… | |
… | |
2522 | int x, y; |
2609 | int x, y; |
2523 | int sw1 = sw + 2; |
2610 | int sw1 = sw + 2; |
2524 | int sh1 = sh + 2; |
2611 | int sh1 = sh + 2; |
2525 | int sh3 = sh * 3; |
2612 | int sh3 = sh * 3; |
2526 | int sw3 = sw * 3; |
2613 | int sw3 = sw * 3; |
2527 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2528 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2614 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2529 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
2615 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
|
|
2616 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2617 | memset (darkness1, 0, sw1*sh1); |
2530 | |
2618 | |
2531 | SvPOK_only (darkness3_sv); |
2619 | SvPOK_only (darkness3_sv); |
2532 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2620 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2533 | |
2621 | |
2534 | mx += self->x - 1; |
2622 | mx += self->x - 1; |
… | |
… | |
2660 | else |
2748 | else |
2661 | *data++ = 0; |
2749 | *data++ = 0; |
2662 | } |
2750 | } |
2663 | } |
2751 | } |
2664 | |
2752 | |
2665 | /* if size is w*h + 5 then no data has been found */ |
2753 | /* if size is w*h + 5 then no data has been found */ |
2666 | if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5) |
2754 | if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5) |
2667 | { |
2755 | { |
2668 | SvPOK_only (data_sv); |
2756 | SvPOK_only (data_sv); |
2669 | SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); |
2757 | SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); |
2670 | } |
2758 | } |
2671 | |
2759 | |
2672 | RETVAL = data_sv; |
2760 | RETVAL = data_sv; |
2673 | } |
2761 | } |
2674 | OUTPUT: |
2762 | OUTPUT: |
2675 | RETVAL |
2763 | RETVAL |
2676 | |
2764 | |
2677 | void |
2765 | void |
… | |
… | |
2684 | STRLEN len; |
2772 | STRLEN len; |
2685 | uint8_t *data, *end; |
2773 | uint8_t *data, *end; |
2686 | |
2774 | |
2687 | len = SvLEN (data_sv); |
2775 | len = SvLEN (data_sv); |
2688 | SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more |
2776 | SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more |
2689 | data = SvPVbyte_nolen (data_sv); |
2777 | data = (uint8_t *)SvPVbyte_nolen (data_sv); |
2690 | end = data + len + 8; |
2778 | end = data + len + 8; |
2691 | |
2779 | |
2692 | if (len < 5) |
2780 | if (len < 5) |
2693 | XSRETURN_EMPTY; |
2781 | XSRETURN_EMPTY; |
2694 | |
2782 | |
… | |
… | |
2755 | } |
2843 | } |
2756 | |
2844 | |
2757 | MODULE = Deliantra::Client PACKAGE = DC::RW |
2845 | MODULE = Deliantra::Client PACKAGE = DC::RW |
2758 | |
2846 | |
2759 | DC::RW |
2847 | DC::RW |
2760 | new (SV *class, SV *data_sv) |
2848 | new (SV *klass, SV *data_sv) |
2761 | CODE: |
2849 | CODE: |
2762 | { |
2850 | { |
2763 | STRLEN datalen; |
2851 | STRLEN datalen; |
2764 | char *data = SvPVbyte (data_sv, datalen); |
2852 | char *data = SvPVbyte (data_sv, datalen); |
2765 | |
2853 | |
… | |
… | |
2767 | } |
2855 | } |
2768 | OUTPUT: |
2856 | OUTPUT: |
2769 | RETVAL |
2857 | RETVAL |
2770 | |
2858 | |
2771 | DC::RW |
2859 | DC::RW |
2772 | new_from_file (SV *class, const char *path, const char *mode = "rb") |
2860 | new_from_file (SV *klass, const char *path, const char *mode = "rb") |
2773 | CODE: |
2861 | CODE: |
2774 | RETVAL = SDL_RWFromFile (path, mode); |
2862 | RETVAL = SDL_RWFromFile (path, mode); |
2775 | OUTPUT: |
2863 | OUTPUT: |
2776 | RETVAL |
2864 | RETVAL |
2777 | |
2865 | |
… | |
… | |
2795 | if (RETVAL < 0) |
2883 | if (RETVAL < 0) |
2796 | { |
2884 | { |
2797 | RETVAL = Mix_GroupOldest (-1); |
2885 | RETVAL = Mix_GroupOldest (-1); |
2798 | |
2886 | |
2799 | if (RETVAL < 0) |
2887 | if (RETVAL < 0) |
|
|
2888 | { |
|
|
2889 | // happens sometimes, maybe it just stopped playing(?) |
|
|
2890 | RETVAL = Mix_GroupAvailable (-1); |
|
|
2891 | |
|
|
2892 | if (RETVAL < 0) |
2800 | XSRETURN_UNDEF; |
2893 | XSRETURN_UNDEF; |
2801 | |
2894 | } |
|
|
2895 | else |
2802 | Mix_HaltChannel (RETVAL); |
2896 | Mix_HaltChannel (RETVAL); |
2803 | } |
2897 | } |
2804 | |
2898 | |
2805 | Mix_UnregisterAllEffects (RETVAL); |
2899 | Mix_UnregisterAllEffects (RETVAL); |
2806 | Mix_Volume (RETVAL, 128); |
2900 | Mix_Volume (RETVAL, 128); |
2807 | } |
2901 | } |
… | |
… | |
2867 | |
2961 | |
2868 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2962 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2869 | |
2963 | |
2870 | PROTOTYPES: DISABLE |
2964 | PROTOTYPES: DISABLE |
2871 | |
2965 | |
|
|
2966 | void |
|
|
2967 | decoders () |
|
|
2968 | PPCODE: |
|
|
2969 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
2970 | int i, num = Mix_GetNumChunkDecoders (); |
|
|
2971 | EXTEND (SP, num); |
|
|
2972 | for (i = 0; i < num; ++i) |
|
|
2973 | PUSHs (sv_2mortal (newSVpv (Mix_GetChunkDecoder (i), 0))); |
|
|
2974 | #else |
|
|
2975 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
2976 | #endif |
|
|
2977 | |
2872 | DC::MixChunk |
2978 | DC::MixChunk |
2873 | new (SV *class, DC::RW rwops) |
2979 | new (SV *klass, DC::RW rwops) |
2874 | CODE: |
2980 | CODE: |
2875 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2981 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2876 | OUTPUT: |
2982 | OUTPUT: |
2877 | RETVAL |
2983 | RETVAL |
2878 | |
2984 | |
… | |
… | |
2908 | OUTPUT: |
3014 | OUTPUT: |
2909 | RETVAL |
3015 | RETVAL |
2910 | |
3016 | |
2911 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
3017 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2912 | |
3018 | |
|
|
3019 | void |
|
|
3020 | decoders () |
|
|
3021 | PPCODE: |
|
|
3022 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
3023 | int i, num = Mix_GetNumMusicDecoders (); |
|
|
3024 | EXTEND (SP, num); |
|
|
3025 | for (i = 0; i < num; ++i) |
|
|
3026 | PUSHs (sv_2mortal (newSVpv (Mix_GetMusicDecoder (i), 0))); |
|
|
3027 | #else |
|
|
3028 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
3029 | #endif |
|
|
3030 | |
2913 | int |
3031 | int |
2914 | volume (int volume = -1) |
3032 | volume (int volume = -1) |
2915 | PROTOTYPE: ;$ |
3033 | PROTOTYPE: ;$ |
2916 | CODE: |
3034 | CODE: |
2917 | if (items > 0) |
3035 | if (items > 0) |
… | |
… | |
2928 | void |
3046 | void |
2929 | halt () |
3047 | halt () |
2930 | CODE: |
3048 | CODE: |
2931 | Mix_HaltMusic (); |
3049 | Mix_HaltMusic (); |
2932 | |
3050 | |
|
|
3051 | int |
|
|
3052 | playing () |
|
|
3053 | CODE: |
|
|
3054 | RETVAL = Mix_PlayingMusic (); |
|
|
3055 | OUTPUT: |
|
|
3056 | RETVAL |
|
|
3057 | |
2933 | DC::MixMusic |
3058 | DC::MixMusic |
2934 | new (SV *class, DC::RW rwops) |
3059 | new (SV *klass, DC::RW rwops) |
2935 | CODE: |
3060 | CODE: |
2936 | RETVAL = Mix_LoadMUS_RW (rwops); |
3061 | RETVAL = Mix_LoadMUS_RW (rwops); |
2937 | OUTPUT: |
3062 | OUTPUT: |
2938 | RETVAL |
3063 | RETVAL |
2939 | |
3064 | |
… | |
… | |
3076 | const_iv (GL_FUNC_SUBTRACT), |
3201 | const_iv (GL_FUNC_SUBTRACT), |
3077 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3202 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3078 | # undef const_iv |
3203 | # undef const_iv |
3079 | }; |
3204 | }; |
3080 | |
3205 | |
3081 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
3206 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
3082 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
3207 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
3083 | |
3208 | |
3084 | texture_av = newAV (); |
3209 | texture_av = newAV (); |
3085 | AvREAL_off (texture_av); |
3210 | AvREAL_off (texture_av); |
3086 | } |
3211 | } |
3087 | |
3212 | |
… | |
… | |
3092 | gl.BlendFuncSeparateEXT = 0; |
3217 | gl.BlendFuncSeparateEXT = 0; |
3093 | |
3218 | |
3094 | void |
3219 | void |
3095 | apple_nvidia_bug (int enable) |
3220 | apple_nvidia_bug (int enable) |
3096 | |
3221 | |
3097 | char * |
3222 | const char * |
3098 | gl_vendor () |
3223 | gl_vendor () |
3099 | CODE: |
3224 | CODE: |
3100 | RETVAL = (char *)glGetString (GL_VENDOR); |
3225 | RETVAL = (const char *)glGetString (GL_VENDOR); |
3101 | OUTPUT: |
3226 | OUTPUT: |
3102 | RETVAL |
3227 | RETVAL |
3103 | |
3228 | |
3104 | char * |
3229 | const char * |
3105 | gl_version () |
3230 | gl_version () |
3106 | CODE: |
3231 | CODE: |
3107 | RETVAL = (char *)glGetString (GL_VERSION); |
3232 | RETVAL = (const char *)glGetString (GL_VERSION); |
3108 | OUTPUT: |
3233 | OUTPUT: |
3109 | RETVAL |
3234 | RETVAL |
3110 | |
3235 | |
3111 | char * |
3236 | const char * |
3112 | gl_extensions () |
3237 | gl_extensions () |
3113 | CODE: |
3238 | CODE: |
3114 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
3239 | RETVAL = (const char *)glGetString (GL_EXTENSIONS); |
3115 | OUTPUT: |
3240 | OUTPUT: |
3116 | RETVAL |
3241 | RETVAL |
3117 | |
3242 | |
3118 | const char *glGetString (GLenum pname) |
3243 | const char *glGetString (GLenum pname) |
|
|
3244 | CODE: |
|
|
3245 | RETVAL = (const char *)glGetString (pname); |
|
|
3246 | OUTPUT: |
|
|
3247 | RETVAL |
3119 | |
3248 | |
3120 | GLint glGetInteger (GLenum pname) |
3249 | GLint glGetInteger (GLenum pname) |
3121 | CODE: |
3250 | CODE: |
3122 | glGetIntegerv (pname, &RETVAL); |
3251 | glGetIntegerv (pname, &RETVAL); |
3123 | OUTPUT: |
3252 | OUTPUT: |
… | |
… | |
3130 | RETVAL |
3259 | RETVAL |
3131 | |
3260 | |
3132 | int glGetError () |
3261 | int glGetError () |
3133 | |
3262 | |
3134 | void glFinish () |
3263 | void glFinish () |
|
|
3264 | |
|
|
3265 | void glFlush () |
3135 | |
3266 | |
3136 | void glClear (int mask) |
3267 | void glClear (int mask) |
3137 | |
3268 | |
3138 | void glClearColor (float r, float g, float b, float a = 1.0) |
3269 | void glClearColor (float r, float g, float b, float a = 1.0) |
3139 | PROTOTYPE: @ |
3270 | PROTOTYPE: @ |
… | |
… | |
3324 | |
3455 | |
3325 | void |
3456 | void |
3326 | find_widget (SV *self, NV x, NV y) |
3457 | find_widget (SV *self, NV x, NV y) |
3327 | PPCODE: |
3458 | PPCODE: |
3328 | { |
3459 | { |
3329 | if (within_widget (self, x, y)) |
3460 | if (within_widget (self, x, y)) |
3330 | XPUSHs (self); |
3461 | XPUSHs (self); |
3331 | } |
3462 | } |
3332 | |
3463 | |
3333 | BOOT: |
3464 | BOOT: |
3334 | { |
3465 | { |
… | |
… | |
3342 | |
3473 | |
3343 | void |
3474 | void |
3344 | draw (SV *self) |
3475 | draw (SV *self) |
3345 | CODE: |
3476 | CODE: |
3346 | { |
3477 | { |
3347 | HV *hv; |
3478 | HV *hv; |
3348 | SV **svp; |
3479 | SV **svp; |
3349 | NV x, y, w, h; |
3480 | NV x, y, w, h; |
3350 | SV *draw_x_sv = GvSV (draw_x_gv); |
3481 | SV *draw_x_sv = GvSV (draw_x_gv); |
3351 | SV *draw_y_sv = GvSV (draw_y_gv); |
3482 | SV *draw_y_sv = GvSV (draw_y_gv); |
3352 | SV *draw_w_sv = GvSV (draw_w_gv); |
3483 | SV *draw_w_sv = GvSV (draw_w_gv); |
3353 | SV *draw_h_sv = GvSV (draw_h_gv); |
3484 | SV *draw_h_sv = GvSV (draw_h_gv); |