1 | #ifdef _WIN32 |
1 | #ifdef _WIN32 |
|
|
2 | # define WIN32_LEAN_AND_MEAN |
2 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # include <malloc.h> |
4 | # include <malloc.h> |
4 | # include <windows.h> |
5 | # include <windows.h> |
|
|
6 | # include <wininet.h> |
5 | # pragma warning(disable:4244) |
7 | # pragma warning(disable:4244) |
|
|
8 | # pragma warning(disable:4761) |
6 | #endif |
9 | #endif |
7 | |
10 | |
8 | #include "EXTERN.h" |
11 | #include "EXTERN.h" |
9 | #include "perl.h" |
12 | #include "perl.h" |
10 | #include "XSUB.h" |
13 | #include "XSUB.h" |
11 | |
14 | |
|
|
15 | #ifdef _WIN32 |
|
|
16 | # undef pipe |
|
|
17 | #endif |
|
|
18 | |
|
|
19 | #include <assert.h> |
12 | #include <math.h> |
20 | #include <math.h> |
13 | #include <string.h> |
21 | #include <string.h> |
14 | #include <stdio.h> |
22 | #include <stdio.h> |
15 | #include <stdlib.h> |
23 | #include <stdlib.h> |
16 | |
24 | |
… | |
… | |
31 | # include <sys/types.h> |
39 | # include <sys/types.h> |
32 | # include <sys/socket.h> |
40 | # include <sys/socket.h> |
33 | # include <netinet/in.h> |
41 | # include <netinet/in.h> |
34 | # include <netinet/tcp.h> |
42 | # include <netinet/tcp.h> |
35 | # include <inttypes.h> |
43 | # include <inttypes.h> |
36 | #else |
|
|
37 | typedef unsigned char uint8_t; |
|
|
38 | typedef unsigned short uint16_t; |
|
|
39 | typedef unsigned int uint32_t; |
|
|
40 | typedef signed char int8_t; |
|
|
41 | typedef signed short int16_t; |
|
|
42 | typedef signed int int32_t; |
|
|
43 | #endif |
44 | #endif |
44 | |
45 | |
45 | #include "glext.h" |
|
|
46 | |
|
|
47 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, objetc replacement character */ |
46 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ |
48 | |
47 | |
49 | #define FOW_DARKNESS 32 |
48 | #define FOW_DARKNESS 32 |
50 | |
49 | |
51 | #define MAP_EXTEND_X 32 |
50 | #define MAP_EXTEND_X 32 |
52 | #define MAP_EXTEND_Y 512 |
51 | #define MAP_EXTEND_Y 512 |
… | |
… | |
80 | |
79 | |
81 | #include "pango-font.c" |
80 | #include "pango-font.c" |
82 | #include "pango-fontmap.c" |
81 | #include "pango-fontmap.c" |
83 | #include "pango-render.c" |
82 | #include "pango-render.c" |
84 | |
83 | |
85 | typedef Mix_Chunk *CFClient__MixChunk; |
84 | typedef Mix_Chunk *CFPlus__MixChunk; |
86 | typedef Mix_Music *CFClient__MixMusic; |
85 | typedef Mix_Music *CFPlus__MixMusic; |
87 | |
86 | |
88 | typedef PangoFontDescription *CFClient__Font; |
87 | typedef PangoFontDescription *CFPlus__Font; |
89 | |
88 | |
90 | static int |
89 | static int |
91 | shape_attr_p (PangoLayoutRun *run) |
90 | shape_attr_p (PangoLayoutRun *run) |
92 | { |
91 | { |
93 | GSList *attrs = run->item->analysis.extra_attrs; |
92 | GSList *attrs = run->item->analysis.extra_attrs; |
… | |
… | |
107 | |
106 | |
108 | typedef struct cf_layout { |
107 | typedef struct cf_layout { |
109 | PangoLayout *pl; |
108 | PangoLayout *pl; |
110 | float r, g, b, a; // default color for rgba mode |
109 | float r, g, b, a; // default color for rgba mode |
111 | int base_height; |
110 | int base_height; |
112 | CFClient__Font font; |
111 | CFPlus__Font font; |
113 | } *CFClient__Layout; |
112 | } *CFPlus__Layout; |
114 | |
113 | |
115 | static CFClient__Font default_font; |
114 | static CFPlus__Font default_font; |
116 | static PangoContext *opengl_context; |
115 | static PangoContext *opengl_context; |
117 | static PangoFontMap *opengl_fontmap; |
116 | static PangoFontMap *opengl_fontmap; |
118 | |
117 | |
119 | static void |
118 | static void |
120 | substitute_func (FcPattern *pattern, gpointer data) |
119 | substitute_func (FcPattern *pattern, gpointer data) |
… | |
… | |
125 | #endif |
124 | #endif |
126 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
125 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
127 | } |
126 | } |
128 | |
127 | |
129 | static void |
128 | static void |
130 | layout_update_font (CFClient__Layout self) |
129 | layout_update_font (CFPlus__Layout self) |
131 | { |
130 | { |
132 | /* use a random scale factor to account for unknown descenders, 0.8 works |
131 | /* use a random scale factor to account for unknown descenders, 0.8 works |
133 | * reasonably well with bitstream vera |
132 | * reasonably well with bitstream vera |
134 | */ |
133 | */ |
135 | PangoFontDescription *font = self->font ? self->font : default_font; |
134 | PangoFontDescription *font = self->font ? self->font : default_font; |
… | |
… | |
139 | |
138 | |
140 | pango_layout_set_font_description (self->pl, font); |
139 | pango_layout_set_font_description (self->pl, font); |
141 | } |
140 | } |
142 | |
141 | |
143 | static void |
142 | static void |
144 | layout_get_pixel_size (CFClient__Layout self, int *w, int *h) |
143 | layout_get_pixel_size (CFPlus__Layout self, int *w, int *h) |
145 | { |
144 | { |
|
|
145 | PangoRectangle rect; |
|
|
146 | |
|
|
147 | // get_pixel_* wrongly rounds down |
146 | pango_layout_get_pixel_size (self->pl, w, h); |
148 | pango_layout_get_extents (self->pl, 0, &rect); |
147 | |
149 | |
148 | if (!*w) *w = 1; |
150 | rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE; |
149 | if (!*h) *h = 1; |
151 | rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE; |
150 | |
152 | |
151 | *w = (*w + 3) & ~3; |
153 | if (!rect.width) rect.width = 1; |
|
|
154 | if (!rect.height) rect.height = 1; |
|
|
155 | |
|
|
156 | *w = rect.width; |
|
|
157 | *h = rect.height; |
152 | } |
158 | } |
153 | |
159 | |
154 | typedef uint16_t mapface; |
160 | typedef uint16_t mapface; |
155 | |
161 | |
156 | typedef struct { |
162 | typedef struct { |
… | |
… | |
159 | float s, t; |
165 | float s, t; |
160 | uint8_t r, g, b, a; |
166 | uint8_t r, g, b, a; |
161 | } maptex; |
167 | } maptex; |
162 | |
168 | |
163 | typedef struct { |
169 | typedef struct { |
164 | int16_t darkness; |
170 | uint32_t player; |
165 | mapface face[3]; |
171 | mapface face[3]; |
|
|
172 | uint16_t darkness; |
|
|
173 | uint8_t stat_width, stat_hp, flags; |
166 | } mapcell; |
174 | } mapcell; |
167 | |
175 | |
168 | typedef struct { |
176 | typedef struct { |
169 | int32_t c0, c1; |
177 | int32_t c0, c1; |
170 | mapcell *col; |
178 | mapcell *col; |
… | |
… | |
179 | int texs; |
187 | int texs; |
180 | maptex *tex; |
188 | maptex *tex; |
181 | |
189 | |
182 | int32_t rows; |
190 | int32_t rows; |
183 | maprow *row; |
191 | maprow *row; |
184 | } *CFClient__Map; |
192 | } *CFPlus__Map; |
185 | |
193 | |
186 | static char * |
194 | static char * |
187 | prepend (char *ptr, int sze, int inc) |
195 | prepend (char *ptr, int sze, int inc) |
188 | { |
196 | { |
189 | char *p; |
197 | char *p; |
… | |
… | |
207 | |
215 | |
208 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
216 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
209 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
217 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
210 | |
218 | |
211 | static maprow * |
219 | static maprow * |
212 | map_get_row (CFClient__Map self, int y) |
220 | map_get_row (CFPlus__Map self, int y) |
213 | { |
221 | { |
214 | if (0 > y) |
222 | if (0 > y) |
215 | { |
223 | { |
216 | int extend = - y + MAP_EXTEND_Y; |
224 | int extend = - y + MAP_EXTEND_Y; |
217 | Prepend (maprow, self->row, self->rows, extend); |
225 | Prepend (maprow, self->row, self->rows, extend); |
… | |
… | |
255 | |
263 | |
256 | return row->col + (x - row->c0); |
264 | return row->col + (x - row->c0); |
257 | } |
265 | } |
258 | |
266 | |
259 | static mapcell * |
267 | static mapcell * |
260 | map_get_cell (CFClient__Map self, int x, int y) |
268 | map_get_cell (CFPlus__Map self, int x, int y) |
261 | { |
269 | { |
262 | return row_get_cell (map_get_row (self, y), x); |
270 | return row_get_cell (map_get_row (self, y), x); |
263 | } |
271 | } |
264 | |
272 | |
265 | static void |
273 | static void |
266 | map_clear (CFClient__Map self) |
274 | map_clear (CFPlus__Map self) |
267 | { |
275 | { |
268 | int r; |
276 | int r; |
269 | |
277 | |
270 | for (r = 0; r < self->rows; r++) |
278 | for (r = 0; r < self->rows; r++) |
271 | Safefree (self->row[r].col); |
279 | Safefree (self->row[r].col); |
… | |
… | |
279 | self->row = 0; |
287 | self->row = 0; |
280 | self->rows = 0; |
288 | self->rows = 0; |
281 | } |
289 | } |
282 | |
290 | |
283 | static void |
291 | static void |
284 | map_blank (CFClient__Map self, int x0, int y0, int w, int h) |
292 | map_blank (CFPlus__Map self, int x0, int y0, int w, int h) |
285 | { |
293 | { |
286 | int x, y; |
294 | int x, y; |
287 | maprow *row; |
295 | maprow *row; |
|
|
296 | mapcell *cell; |
288 | |
297 | |
289 | for (y = y0; y < y0 + h; y++) |
298 | for (y = y0; y < y0 + h; y++) |
290 | if (y >= 0) |
299 | if (y >= 0) |
291 | { |
300 | { |
292 | if (y >= self->rows) |
301 | if (y >= self->rows) |
… | |
… | |
298 | if (x >= row->c0) |
307 | if (x >= row->c0) |
299 | { |
308 | { |
300 | if (x >= row->c1) |
309 | if (x >= row->c1) |
301 | break; |
310 | break; |
302 | |
311 | |
303 | row->col[x - row->c0].darkness = -1; |
312 | cell = row->col + x - row->c0; |
|
|
313 | |
|
|
314 | cell->darkness = 0; |
|
|
315 | cell->stat_hp = 0; |
|
|
316 | cell->flags = 0; |
|
|
317 | cell->player = 0; |
304 | } |
318 | } |
305 | } |
319 | } |
306 | } |
320 | } |
307 | |
321 | |
308 | static void |
322 | static void |
… | |
… | |
346 | n |= n >> 16; |
360 | n |= n >> 16; |
347 | |
361 | |
348 | return n + 1; |
362 | return n + 1; |
349 | } |
363 | } |
350 | |
364 | |
|
|
365 | /* SDL should provide this, really. */ |
|
|
366 | #define SDLK_MODIFIER_MIN 300 |
|
|
367 | #define SDLK_MODIFIER_MAX 314 |
|
|
368 | |
351 | MODULE = CFClient PACKAGE = CFClient |
369 | MODULE = CFPlus PACKAGE = CFPlus |
352 | |
370 | |
353 | PROTOTYPES: ENABLE |
371 | PROTOTYPES: ENABLE |
354 | |
372 | |
355 | BOOT: |
373 | BOOT: |
356 | { |
374 | { |
357 | HV *stash = gv_stashpv ("CFClient", 1); |
375 | HV *stash = gv_stashpv ("CFPlus", 1); |
358 | static const struct { |
376 | static const struct { |
359 | const char *name; |
377 | const char *name; |
360 | IV iv; |
378 | IV iv; |
361 | } *civ, const_iv[] = { |
379 | } *civ, const_iv[] = { |
362 | # define const_iv(name) { # name, (IV)name } |
380 | # define const_iv(name) { # name, (IV)name } |
|
|
381 | const_iv (SDLK_MODIFIER_MIN), |
|
|
382 | const_iv (SDLK_MODIFIER_MAX), |
|
|
383 | |
363 | const_iv (SDL_ACTIVEEVENT), |
384 | const_iv (SDL_ACTIVEEVENT), |
364 | const_iv (SDL_KEYDOWN), |
385 | const_iv (SDL_KEYDOWN), |
365 | const_iv (SDL_KEYUP), |
386 | const_iv (SDL_KEYUP), |
366 | const_iv (SDL_MOUSEMOTION), |
387 | const_iv (SDL_MOUSEMOTION), |
367 | const_iv (SDL_MOUSEBUTTONDOWN), |
388 | const_iv (SDL_MOUSEBUTTONDOWN), |
… | |
… | |
376 | const_iv (SDL_EVENT_RESERVEDA), |
397 | const_iv (SDL_EVENT_RESERVEDA), |
377 | const_iv (SDL_EVENT_RESERVEDB), |
398 | const_iv (SDL_EVENT_RESERVEDB), |
378 | const_iv (SDL_VIDEORESIZE), |
399 | const_iv (SDL_VIDEORESIZE), |
379 | const_iv (SDL_VIDEOEXPOSE), |
400 | const_iv (SDL_VIDEOEXPOSE), |
380 | const_iv (SDL_USEREVENT), |
401 | const_iv (SDL_USEREVENT), |
|
|
402 | |
|
|
403 | const_iv (SDL_APPINPUTFOCUS), |
|
|
404 | const_iv (SDL_APPMOUSEFOCUS), |
|
|
405 | const_iv (SDL_APPACTIVE), |
|
|
406 | |
381 | const_iv (SDLK_KP0), |
407 | const_iv (SDLK_KP0), |
382 | const_iv (SDLK_KP1), |
408 | const_iv (SDLK_KP1), |
383 | const_iv (SDLK_KP2), |
409 | const_iv (SDLK_KP2), |
384 | const_iv (SDLK_KP3), |
410 | const_iv (SDLK_KP3), |
385 | const_iv (SDLK_KP4), |
411 | const_iv (SDLK_KP4), |
… | |
… | |
440 | const_iv (SDLK_BREAK), |
466 | const_iv (SDLK_BREAK), |
441 | const_iv (SDLK_MENU), |
467 | const_iv (SDLK_MENU), |
442 | const_iv (SDLK_POWER), |
468 | const_iv (SDLK_POWER), |
443 | const_iv (SDLK_EURO), |
469 | const_iv (SDLK_EURO), |
444 | const_iv (SDLK_UNDO), |
470 | const_iv (SDLK_UNDO), |
|
|
471 | |
445 | const_iv (KMOD_NONE), |
472 | const_iv (KMOD_NONE), |
|
|
473 | const_iv (KMOD_SHIFT), |
446 | const_iv (KMOD_LSHIFT), |
474 | const_iv (KMOD_LSHIFT), |
447 | const_iv (KMOD_RSHIFT), |
475 | const_iv (KMOD_RSHIFT), |
|
|
476 | const_iv (KMOD_CTRL), |
448 | const_iv (KMOD_LCTRL), |
477 | const_iv (KMOD_LCTRL), |
449 | const_iv (KMOD_RCTRL), |
478 | const_iv (KMOD_RCTRL), |
|
|
479 | const_iv (KMOD_ALT), |
450 | const_iv (KMOD_LALT), |
480 | const_iv (KMOD_LALT), |
451 | const_iv (KMOD_RALT), |
481 | const_iv (KMOD_RALT), |
|
|
482 | const_iv (KMOD_META), |
452 | const_iv (KMOD_LMETA), |
483 | const_iv (KMOD_LMETA), |
453 | const_iv (KMOD_RMETA), |
484 | const_iv (KMOD_RMETA), |
454 | const_iv (KMOD_NUM), |
485 | const_iv (KMOD_NUM), |
455 | const_iv (KMOD_CAPS), |
486 | const_iv (KMOD_CAPS), |
456 | const_iv (KMOD_MODE), |
487 | const_iv (KMOD_MODE), |
457 | const_iv (KMOD_CTRL), |
|
|
458 | const_iv (KMOD_SHIFT), |
|
|
459 | const_iv (KMOD_ALT), |
|
|
460 | const_iv (KMOD_META) |
|
|
461 | # undef const_iv |
488 | # undef const_iv |
462 | }; |
489 | }; |
463 | |
490 | |
464 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
491 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
465 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
492 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
493 | |
|
|
494 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
|
|
495 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
466 | } |
496 | } |
|
|
497 | |
|
|
498 | void |
|
|
499 | weaken (SV *rv) |
|
|
500 | PROTOTYPE: $ |
|
|
501 | CODE: |
|
|
502 | sv_rvweaken (rv); |
467 | |
503 | |
468 | int |
504 | int |
469 | in_destruct () |
505 | in_destruct () |
470 | CODE: |
506 | CODE: |
471 | RETVAL = PL_main_cv == Nullcv; |
507 | RETVAL = PL_main_cv == Nullcv; |
… | |
… | |
509 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
545 | SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); |
510 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
546 | SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE, 0); |
511 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
547 | SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); |
512 | |
548 | |
513 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
549 | SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); |
|
|
550 | #if SDL_VERSION_ATLEAST(1,2,10) |
|
|
551 | SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1); |
|
|
552 | SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); |
|
|
553 | #endif |
514 | |
554 | |
515 | SDL_EnableUNICODE (1); |
555 | SDL_EnableUNICODE (1); |
516 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
556 | SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); |
517 | |
557 | |
518 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
558 | m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); |
… | |
… | |
570 | case SDL_KEYDOWN: |
610 | case SDL_KEYDOWN: |
571 | case SDL_KEYUP: |
611 | case SDL_KEYUP: |
572 | hv_store (hv, "state", 5, newSViv (ev.key.state), 0); |
612 | hv_store (hv, "state", 5, newSViv (ev.key.state), 0); |
573 | hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); |
613 | hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); |
574 | hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); |
614 | hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); |
|
|
615 | hv_store (hv, "cmod", 4, newSViv (SDL_GetModState ()), 0); /* current mode */ |
575 | hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); |
616 | hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); |
576 | break; |
617 | break; |
577 | |
618 | |
578 | case SDL_ACTIVEEVENT: |
619 | case SDL_ACTIVEEVENT: |
579 | hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); |
620 | hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); |
… | |
… | |
605 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
646 | hv_store (hv, "data1", 5, newSViv ((IV)ev.user.data1), 0); |
606 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
647 | hv_store (hv, "data2", 5, newSViv ((IV)ev.user.data2), 0); |
607 | break; |
648 | break; |
608 | } |
649 | } |
609 | |
650 | |
610 | XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); |
651 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("CFPlus::UI::Event", 1)))); |
611 | } |
652 | } |
612 | } |
653 | } |
613 | |
654 | |
614 | int |
655 | int |
615 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
656 | Mix_OpenAudio (int frequency = 48000, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 2048) |
… | |
… | |
627 | lowdelay (int fd, int val = 1) |
668 | lowdelay (int fd, int val = 1) |
628 | CODE: |
669 | CODE: |
629 | #ifndef _WIN32 |
670 | #ifndef _WIN32 |
630 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
671 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
631 | #endif |
672 | #endif |
|
|
673 | |
|
|
674 | void |
|
|
675 | win32_proxy_info () |
|
|
676 | PPCODE: |
|
|
677 | { |
|
|
678 | #ifdef _WIN32 |
|
|
679 | char buffer[2048]; |
|
|
680 | DWORD buflen; |
|
|
681 | |
|
|
682 | EXTEND (SP, 3); |
|
|
683 | |
|
|
684 | buflen = sizeof (buffer); |
|
|
685 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY, (void *)buffer, &buflen)) |
|
|
686 | if (((INTERNET_PROXY_INFO *)buffer)->dwAccessType == INTERNET_OPEN_TYPE_PROXY) |
|
|
687 | { |
|
|
688 | PUSHs (newSVpv (((INTERNET_PROXY_INFO *)buffer)->lpszProxy, 0)); |
|
|
689 | |
|
|
690 | buflen = sizeof (buffer); |
|
|
691 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_USERNAME, (void *)buffer, &buflen)) |
|
|
692 | { |
|
|
693 | PUSHs (newSVpv (buffer, 0)); |
|
|
694 | |
|
|
695 | buflen = sizeof (buffer); |
|
|
696 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_PASSWORD, (void *)buffer, &buflen)) |
|
|
697 | PUSHs (newSVpv (buffer, 0)); |
|
|
698 | } |
|
|
699 | } |
|
|
700 | #endif |
|
|
701 | } |
632 | |
702 | |
633 | void |
703 | void |
634 | add_font (char *file) |
704 | add_font (char *file) |
635 | CODE: |
705 | CODE: |
636 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
706 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
… | |
… | |
740 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
810 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
741 | #endif |
811 | #endif |
742 | _exit (1); |
812 | _exit (1); |
743 | |
813 | |
744 | void |
814 | void |
745 | _exit (int retval) |
815 | _exit (int retval = 0) |
746 | CODE: |
816 | CODE: |
|
|
817 | #ifdef WIN32 |
|
|
818 | ExitThread (retval); // unclean, please beam me up |
|
|
819 | #else |
747 | _exit (retval); |
820 | _exit (retval); |
|
|
821 | #endif |
748 | |
822 | |
749 | MODULE = CFClient PACKAGE = CFClient::Font |
823 | MODULE = CFPlus PACKAGE = CFPlus::Font |
750 | |
824 | |
751 | CFClient::Font |
825 | CFPlus::Font |
752 | new_from_file (SV *class, char *path, int id = 0) |
826 | new_from_file (SV *class, char *path, int id = 0) |
753 | CODE: |
827 | CODE: |
754 | { |
828 | { |
755 | int count; |
829 | int count; |
756 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
830 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
… | |
… | |
759 | } |
833 | } |
760 | OUTPUT: |
834 | OUTPUT: |
761 | RETVAL |
835 | RETVAL |
762 | |
836 | |
763 | void |
837 | void |
764 | DESTROY (CFClient::Font self) |
838 | DESTROY (CFPlus::Font self) |
765 | CODE: |
839 | CODE: |
766 | pango_font_description_free (self); |
840 | pango_font_description_free (self); |
767 | |
841 | |
768 | void |
842 | void |
769 | make_default (CFClient::Font self) |
843 | make_default (CFPlus::Font self) |
770 | CODE: |
844 | CODE: |
771 | default_font = self; |
845 | default_font = self; |
772 | |
846 | |
773 | MODULE = CFClient PACKAGE = CFClient::Layout |
847 | MODULE = CFPlus PACKAGE = CFPlus::Layout |
774 | |
848 | |
775 | void |
849 | void |
776 | reset_glyph_cache () |
850 | reset_glyph_cache () |
777 | CODE: |
851 | CODE: |
778 | tc_clear (); |
852 | tc_clear (); |
779 | |
853 | |
780 | CFClient::Layout |
854 | CFPlus::Layout |
781 | new (SV *class) |
855 | new (SV *class) |
782 | CODE: |
856 | CODE: |
783 | New (0, RETVAL, 1, struct cf_layout); |
857 | New (0, RETVAL, 1, struct cf_layout); |
784 | |
858 | |
785 | RETVAL->pl = pango_layout_new (opengl_context); |
859 | RETVAL->pl = pango_layout_new (opengl_context); |
… | |
… | |
794 | layout_update_font (RETVAL); |
868 | layout_update_font (RETVAL); |
795 | OUTPUT: |
869 | OUTPUT: |
796 | RETVAL |
870 | RETVAL |
797 | |
871 | |
798 | void |
872 | void |
799 | DESTROY (CFClient::Layout self) |
873 | DESTROY (CFPlus::Layout self) |
800 | CODE: |
874 | CODE: |
801 | g_object_unref (self->pl); |
875 | g_object_unref (self->pl); |
802 | Safefree (self); |
876 | Safefree (self); |
803 | |
877 | |
804 | void |
878 | void |
805 | set_text (CFClient::Layout self, SV *text_) |
879 | set_text (CFPlus::Layout self, SV *text_) |
806 | CODE: |
880 | CODE: |
807 | { |
881 | { |
808 | STRLEN textlen; |
882 | STRLEN textlen; |
809 | char *text = SvPVutf8 (text_, textlen); |
883 | char *text = SvPVutf8 (text_, textlen); |
810 | |
884 | |
811 | pango_layout_set_text (self->pl, text, textlen); |
885 | pango_layout_set_text (self->pl, text, textlen); |
812 | } |
886 | } |
813 | |
887 | |
814 | void |
888 | void |
815 | set_markup (CFClient::Layout self, SV *text_) |
889 | set_markup (CFPlus::Layout self, SV *text_) |
816 | CODE: |
890 | CODE: |
817 | { |
891 | { |
818 | STRLEN textlen; |
892 | STRLEN textlen; |
819 | char *text = SvPVutf8 (text_, textlen); |
893 | char *text = SvPVutf8 (text_, textlen); |
820 | |
894 | |
821 | pango_layout_set_markup (self->pl, text, textlen); |
895 | pango_layout_set_markup (self->pl, text, textlen); |
822 | } |
896 | } |
823 | |
897 | |
824 | void |
898 | void |
825 | set_shapes (CFClient::Layout self, ...) |
899 | set_shapes (CFPlus::Layout self, ...) |
826 | CODE: |
900 | CODE: |
827 | { |
901 | { |
828 | PangoAttrList *attrs = 0; |
902 | PangoAttrList *attrs = 0; |
829 | const char *text = pango_layout_get_text (self->pl); |
903 | const char *text = pango_layout_get_text (self->pl); |
830 | const char *pos = text; |
904 | const char *pos = text; |
… | |
… | |
865 | if (attrs) |
939 | if (attrs) |
866 | pango_layout_set_attributes (self->pl, attrs); |
940 | pango_layout_set_attributes (self->pl, attrs); |
867 | } |
941 | } |
868 | |
942 | |
869 | void |
943 | void |
870 | get_shapes (CFClient::Layout self) |
944 | get_shapes (CFPlus::Layout self) |
871 | PPCODE: |
945 | PPCODE: |
872 | { |
946 | { |
873 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
947 | PangoLayoutIter *iter = pango_layout_get_iter (self->pl); |
874 | |
948 | |
875 | do |
949 | do |
… | |
… | |
890 | |
964 | |
891 | pango_layout_iter_free (iter); |
965 | pango_layout_iter_free (iter); |
892 | } |
966 | } |
893 | |
967 | |
894 | int |
968 | int |
895 | has_wrapped (CFClient::Layout self) |
969 | has_wrapped (CFPlus::Layout self) |
896 | CODE: |
970 | CODE: |
897 | { |
971 | { |
898 | int lines = 1; |
972 | int lines = 1; |
899 | const char *text = pango_layout_get_text (self->pl); |
973 | const char *text = pango_layout_get_text (self->pl); |
900 | |
974 | |
… | |
… | |
905 | } |
979 | } |
906 | OUTPUT: |
980 | OUTPUT: |
907 | RETVAL |
981 | RETVAL |
908 | |
982 | |
909 | SV * |
983 | SV * |
910 | get_text (CFClient::Layout self) |
984 | get_text (CFPlus::Layout self) |
911 | CODE: |
985 | CODE: |
912 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
986 | RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); |
913 | sv_utf8_decode (RETVAL); |
987 | sv_utf8_decode (RETVAL); |
914 | OUTPUT: |
988 | OUTPUT: |
915 | RETVAL |
989 | RETVAL |
916 | |
990 | |
917 | void |
991 | void |
918 | set_foreground (CFClient::Layout self, float r, float g, float b, float a = 1.) |
992 | set_foreground (CFPlus::Layout self, float r, float g, float b, float a = 1.) |
919 | CODE: |
993 | CODE: |
920 | self->r = r; |
994 | self->r = r; |
921 | self->g = g; |
995 | self->g = g; |
922 | self->b = b; |
996 | self->b = b; |
923 | self->a = a; |
997 | self->a = a; |
924 | |
998 | |
925 | void |
999 | void |
926 | set_font (CFClient::Layout self, CFClient::Font font = 0) |
1000 | set_font (CFPlus::Layout self, CFPlus::Font font = 0) |
927 | CODE: |
1001 | CODE: |
928 | if (self->font != font) |
1002 | if (self->font != font) |
929 | { |
1003 | { |
930 | self->font = font; |
1004 | self->font = font; |
931 | layout_update_font (self); |
1005 | layout_update_font (self); |
932 | } |
1006 | } |
933 | |
1007 | |
934 | void |
1008 | void |
935 | set_height (CFClient::Layout self, int base_height) |
1009 | set_height (CFPlus::Layout self, int base_height) |
936 | CODE: |
1010 | CODE: |
937 | if (self->base_height != base_height) |
1011 | if (self->base_height != base_height) |
938 | { |
1012 | { |
939 | self->base_height = base_height; |
1013 | self->base_height = base_height; |
940 | layout_update_font (self); |
1014 | layout_update_font (self); |
941 | } |
1015 | } |
942 | |
1016 | |
943 | void |
1017 | void |
944 | set_width (CFClient::Layout self, int max_width = -1) |
1018 | set_width (CFPlus::Layout self, int max_width = -1) |
945 | CODE: |
1019 | CODE: |
946 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
1020 | pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); |
947 | |
1021 | |
948 | void |
1022 | void |
949 | set_indent (CFClient::Layout self, int indent) |
1023 | set_indent (CFPlus::Layout self, int indent) |
950 | CODE: |
1024 | CODE: |
951 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
1025 | pango_layout_set_indent (self->pl, indent * PANGO_SCALE); |
952 | |
1026 | |
953 | void |
1027 | void |
954 | set_spacing (CFClient::Layout self, int spacing) |
1028 | set_spacing (CFPlus::Layout self, int spacing) |
955 | CODE: |
1029 | CODE: |
956 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
1030 | pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); |
957 | |
1031 | |
958 | void |
1032 | void |
959 | set_ellipsise (CFClient::Layout self, int ellipsise) |
1033 | set_ellipsise (CFPlus::Layout self, int ellipsise) |
960 | CODE: |
1034 | CODE: |
961 | pango_layout_set_ellipsize (self->pl, |
1035 | pango_layout_set_ellipsize (self->pl, |
962 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
1036 | ellipsise == 1 ? PANGO_ELLIPSIZE_START |
963 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
1037 | : ellipsise == 2 ? PANGO_ELLIPSIZE_MIDDLE |
964 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
1038 | : ellipsise == 3 ? PANGO_ELLIPSIZE_END |
965 | : PANGO_ELLIPSIZE_NONE |
1039 | : PANGO_ELLIPSIZE_NONE |
966 | ); |
1040 | ); |
967 | |
1041 | |
968 | void |
1042 | void |
969 | set_single_paragraph_mode (CFClient::Layout self, int spm) |
1043 | set_single_paragraph_mode (CFPlus::Layout self, int spm) |
970 | CODE: |
1044 | CODE: |
971 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
1045 | pango_layout_set_single_paragraph_mode (self->pl, !!spm); |
972 | |
1046 | |
973 | void |
1047 | void |
974 | size (CFClient::Layout self) |
1048 | size (CFPlus::Layout self) |
975 | PPCODE: |
1049 | PPCODE: |
976 | { |
1050 | { |
977 | int w, h; |
1051 | int w, h; |
978 | |
1052 | |
979 | layout_get_pixel_size (self, &w, &h); |
1053 | layout_get_pixel_size (self, &w, &h); |
… | |
… | |
982 | PUSHs (sv_2mortal (newSViv (w))); |
1056 | PUSHs (sv_2mortal (newSViv (w))); |
983 | PUSHs (sv_2mortal (newSViv (h))); |
1057 | PUSHs (sv_2mortal (newSViv (h))); |
984 | } |
1058 | } |
985 | |
1059 | |
986 | int |
1060 | int |
987 | descent (CFClient::Layout self) |
1061 | descent (CFPlus::Layout self) |
988 | CODE: |
1062 | CODE: |
989 | { |
1063 | { |
990 | PangoRectangle rect; |
1064 | PangoRectangle rect; |
991 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
1065 | PangoLayoutLine *line = pango_layout_get_line (self->pl, 0); |
992 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
1066 | pango_layout_line_get_pixel_extents (line, 0, &rect); |
… | |
… | |
994 | } |
1068 | } |
995 | OUTPUT: |
1069 | OUTPUT: |
996 | RETVAL |
1070 | RETVAL |
997 | |
1071 | |
998 | int |
1072 | int |
999 | xy_to_index (CFClient::Layout self, int x, int y) |
1073 | xy_to_index (CFPlus::Layout self, int x, int y) |
1000 | CODE: |
1074 | CODE: |
1001 | { |
1075 | { |
1002 | int index, trailing; |
1076 | int index, trailing; |
1003 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1077 | pango_layout_xy_to_index (self->pl, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing); |
1004 | RETVAL = index; |
1078 | RETVAL = index + trailing; |
1005 | } |
1079 | } |
1006 | OUTPUT: |
1080 | OUTPUT: |
1007 | RETVAL |
1081 | RETVAL |
1008 | |
1082 | |
1009 | void |
1083 | void |
1010 | cursor_pos (CFClient::Layout self, int index) |
1084 | cursor_pos (CFPlus::Layout self, int index) |
1011 | PPCODE: |
1085 | PPCODE: |
1012 | { |
1086 | { |
1013 | PangoRectangle strong_pos; |
1087 | PangoRectangle strong_pos; |
1014 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1088 | pango_layout_get_cursor_pos (self->pl, index, &strong_pos, 0); |
1015 | |
1089 | |
… | |
… | |
1018 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1092 | PUSHs (sv_2mortal (newSViv (strong_pos.y / PANGO_SCALE))); |
1019 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1093 | PUSHs (sv_2mortal (newSViv (strong_pos.height / PANGO_SCALE))); |
1020 | } |
1094 | } |
1021 | |
1095 | |
1022 | void |
1096 | void |
|
|
1097 | index_to_line_x (CFPlus::Layout self, int index, int trailing = 0) |
|
|
1098 | PPCODE: |
|
|
1099 | { |
|
|
1100 | int line, x; |
|
|
1101 | |
|
|
1102 | pango_layout_index_to_line_x (self->pl, index, trailing, &line, &x); |
|
|
1103 | /* pango bug: line is between 1..numlines, not 0..numlines-1 */ |
|
|
1104 | |
|
|
1105 | EXTEND (SP, 2); |
|
|
1106 | PUSHs (sv_2mortal (newSViv (line - 1))); |
|
|
1107 | PUSHs (sv_2mortal (newSViv (x / PANGO_SCALE))); |
|
|
1108 | } |
|
|
1109 | |
|
|
1110 | void |
|
|
1111 | line_x_to_index (CFPlus::Layout self, int line, int x) |
|
|
1112 | PPCODE: |
|
|
1113 | { |
|
|
1114 | PangoLayoutLine *lp; |
|
|
1115 | int index, trailing; |
|
|
1116 | |
|
|
1117 | if (line < 0) |
|
|
1118 | XSRETURN_EMPTY; |
|
|
1119 | |
|
|
1120 | if (!(lp = pango_layout_get_line (self->pl, line))) |
|
|
1121 | XSRETURN_EMPTY; /* do better */ |
|
|
1122 | |
|
|
1123 | pango_layout_line_x_to_index (lp, x * PANGO_SCALE, &index, &trailing); |
|
|
1124 | |
|
|
1125 | EXTEND (SP, 2); |
|
|
1126 | if (GIMME_V == G_SCALAR) |
|
|
1127 | PUSHs (sv_2mortal (newSViv (index + trailing))); |
|
|
1128 | else |
|
|
1129 | { |
|
|
1130 | PUSHs (sv_2mortal (newSViv (index))); |
|
|
1131 | PUSHs (sv_2mortal (newSViv (trailing))); |
|
|
1132 | } |
|
|
1133 | } |
|
|
1134 | |
|
|
1135 | void |
1023 | render (CFClient::Layout self, float x, float y) |
1136 | render (CFPlus::Layout self, float x, float y, int flags = 0) |
1024 | PPCODE: |
1137 | PPCODE: |
1025 | pango_opengl_render_layout_subpixel ( |
1138 | pango_opengl_render_layout_subpixel ( |
1026 | self->pl, |
1139 | self->pl, |
1027 | x * PANGO_SCALE, y * PANGO_SCALE, |
1140 | x * PANGO_SCALE, y * PANGO_SCALE, |
1028 | self->r, self->g, self->b, self->a |
1141 | self->r, self->g, self->b, self->a, |
|
|
1142 | flags |
1029 | ); |
1143 | ); |
1030 | |
1144 | |
1031 | MODULE = CFClient PACKAGE = CFClient::Texture |
1145 | MODULE = CFPlus PACKAGE = CFPlus::Texture |
1032 | |
1146 | |
1033 | void |
1147 | void |
1034 | pad2pot (SV *data_, SV *w_, SV *h_) |
1148 | pad2pot (SV *data_, SV *w_, SV *h_) |
1035 | CODE: |
1149 | CODE: |
1036 | { |
1150 | { |
… | |
… | |
1114 | glDisable (GL_ALPHA_TEST); |
1228 | glDisable (GL_ALPHA_TEST); |
1115 | glDisable (GL_BLEND); |
1229 | glDisable (GL_BLEND); |
1116 | } |
1230 | } |
1117 | } |
1231 | } |
1118 | |
1232 | |
1119 | MODULE = CFClient PACKAGE = CFClient::Map |
1233 | MODULE = CFPlus PACKAGE = CFPlus::Map |
1120 | |
1234 | |
1121 | CFClient::Map |
1235 | CFPlus::Map |
1122 | new (SV *class, int map_width, int map_height) |
1236 | new (SV *class) |
1123 | CODE: |
1237 | CODE: |
1124 | New (0, RETVAL, 1, struct map); |
1238 | New (0, RETVAL, 1, struct map); |
1125 | RETVAL->x = 0; |
1239 | RETVAL->x = 0; |
1126 | RETVAL->y = 0; |
1240 | RETVAL->y = 0; |
1127 | RETVAL->w = map_width; |
1241 | RETVAL->w = 0; |
1128 | RETVAL->h = map_height; |
1242 | RETVAL->h = 0; |
1129 | RETVAL->ox = 0; |
1243 | RETVAL->ox = 0; |
1130 | RETVAL->oy = 0; |
1244 | RETVAL->oy = 0; |
1131 | RETVAL->faces = 8192; |
1245 | RETVAL->faces = 8192; |
1132 | Newz (0, RETVAL->face, RETVAL->faces, mapface); |
1246 | Newz (0, RETVAL->face, RETVAL->faces, mapface); |
1133 | RETVAL->texs = 8192; |
1247 | RETVAL->texs = 8192; |
… | |
… | |
1136 | RETVAL->row = 0; |
1250 | RETVAL->row = 0; |
1137 | OUTPUT: |
1251 | OUTPUT: |
1138 | RETVAL |
1252 | RETVAL |
1139 | |
1253 | |
1140 | void |
1254 | void |
1141 | DESTROY (CFClient::Map self) |
1255 | DESTROY (CFPlus::Map self) |
1142 | CODE: |
1256 | CODE: |
1143 | { |
1257 | { |
1144 | map_clear (self); |
1258 | map_clear (self); |
1145 | Safefree (self->face); |
1259 | Safefree (self->face); |
1146 | Safefree (self->tex); |
1260 | Safefree (self->tex); |
1147 | Safefree (self); |
1261 | Safefree (self); |
1148 | } |
1262 | } |
1149 | |
1263 | |
1150 | void |
1264 | void |
|
|
1265 | resize (CFPlus::Map self, int map_width, int map_height) |
|
|
1266 | CODE: |
|
|
1267 | self->w = map_width; |
|
|
1268 | self->h = map_height; |
|
|
1269 | |
|
|
1270 | void |
1151 | clear (CFClient::Map self) |
1271 | clear (CFPlus::Map self) |
1152 | CODE: |
1272 | CODE: |
1153 | map_clear (self); |
1273 | map_clear (self); |
1154 | |
1274 | |
1155 | void |
1275 | void |
1156 | set_face (CFClient::Map self, int face, int texid) |
1276 | set_face (CFPlus::Map self, int face, int texid) |
1157 | CODE: |
1277 | CODE: |
1158 | { |
1278 | { |
1159 | while (self->faces <= face) |
1279 | while (self->faces <= face) |
1160 | { |
1280 | { |
1161 | Append (mapface, self->face, self->faces, self->faces); |
1281 | Append (mapface, self->face, self->faces, self->faces); |
… | |
… | |
1164 | |
1284 | |
1165 | self->face [face] = texid; |
1285 | self->face [face] = texid; |
1166 | } |
1286 | } |
1167 | |
1287 | |
1168 | void |
1288 | void |
1169 | set_texture (CFClient::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1289 | set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1170 | CODE: |
1290 | CODE: |
1171 | { |
1291 | { |
1172 | while (self->texs <= texid) |
1292 | while (self->texs <= texid) |
1173 | { |
1293 | { |
1174 | Append (maptex, self->tex, self->texs, self->texs); |
1294 | Append (maptex, self->tex, self->texs, self->texs); |
… | |
… | |
1198 | // from transparent color bleeding and ugly wrapping effects. |
1318 | // from transparent color bleeding and ugly wrapping effects. |
1199 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1319 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
1200 | } |
1320 | } |
1201 | |
1321 | |
1202 | int |
1322 | int |
1203 | ox (CFClient::Map self) |
1323 | ox (CFPlus::Map self) |
1204 | ALIAS: |
1324 | ALIAS: |
1205 | oy = 1 |
1325 | oy = 1 |
1206 | x = 2 |
1326 | x = 2 |
1207 | y = 3 |
1327 | y = 3 |
1208 | w = 4 |
1328 | w = 4 |
… | |
… | |
1219 | } |
1339 | } |
1220 | OUTPUT: |
1340 | OUTPUT: |
1221 | RETVAL |
1341 | RETVAL |
1222 | |
1342 | |
1223 | void |
1343 | void |
1224 | scroll (CFClient::Map self, int dx, int dy) |
1344 | scroll (CFPlus::Map self, int dx, int dy) |
1225 | CODE: |
1345 | CODE: |
1226 | { |
1346 | { |
1227 | if (dx > 0) |
1347 | if (dx > 0) |
1228 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1348 | map_blank (self, self->x, self->y, dx, self->h); |
1229 | else if (dx < 0) |
1349 | else if (dx < 0) |
1230 | map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); |
1350 | map_blank (self, self->x + self->w + dx + 1, self->y, -dx, self->h); |
1231 | |
1351 | |
1232 | if (dy > 0) |
1352 | if (dy > 0) |
1233 | map_blank (self, self->x, self->y, self->w, dy - 1); |
1353 | map_blank (self, self->x, self->y, self->w, dy); |
1234 | else if (dy < 0) |
1354 | else if (dy < 0) |
1235 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); |
1355 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, -dy); |
1236 | |
1356 | |
1237 | self->ox += dx; self->x += dx; |
1357 | self->ox += dx; self->x += dx; |
1238 | self->oy += dy; self->y += dy; |
1358 | self->oy += dy; self->y += dy; |
1239 | |
1359 | |
1240 | while (self->y < 0) |
1360 | while (self->y < 0) |
… | |
… | |
1245 | self->y += MAP_EXTEND_Y; |
1365 | self->y += MAP_EXTEND_Y; |
1246 | } |
1366 | } |
1247 | } |
1367 | } |
1248 | |
1368 | |
1249 | void |
1369 | void |
1250 | map1a_update (CFClient::Map self, SV *data_) |
1370 | map1a_update (CFPlus::Map self, SV *data_, int extmap) |
1251 | CODE: |
1371 | CODE: |
1252 | { |
1372 | { |
1253 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1373 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1254 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1374 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1255 | mapcell *cell; |
1375 | mapcell *cell; |
1256 | int x, y, flags; |
1376 | int x, y, flags; |
1257 | |
1377 | |
1258 | while (data < data_end) |
1378 | while (data < data_end - 1) |
1259 | { |
1379 | { |
1260 | flags = (data [0] << 8) + data [1]; data += 2; |
1380 | flags = (data [0] << 8) + data [1]; data += 2; |
1261 | |
1381 | |
1262 | x = self->x + ((flags >> 10) & 63); |
1382 | x = self->x + ((flags >> 10) & 63); |
1263 | y = self->y + ((flags >> 4) & 63); |
1383 | y = self->y + ((flags >> 4) & 63); |
1264 | |
1384 | |
1265 | cell = map_get_cell (self, x, y); |
1385 | cell = map_get_cell (self, x, y); |
1266 | |
1386 | |
1267 | if (flags & 15) |
1387 | if (flags & 15) |
1268 | { |
1388 | { |
1269 | if (cell->darkness < 0) |
1389 | if (!cell->darkness) |
1270 | { |
1390 | { |
|
|
1391 | memset (cell, 0, sizeof (*cell)); |
1271 | cell->darkness = 0; |
1392 | cell->darkness = 256; |
1272 | cell->face [0] = 0; |
|
|
1273 | cell->face [1] = 0; |
|
|
1274 | cell->face [2] = 0; |
|
|
1275 | } |
1393 | } |
1276 | |
1394 | |
1277 | cell->darkness = flags & 8 ? *data++ : 255; |
|
|
1278 | |
|
|
1279 | //TODO: don't trust server data to be in-range(!) |
1395 | //TODO: don't trust server data to be in-range(!) |
|
|
1396 | |
|
|
1397 | if (flags & 8) |
|
|
1398 | { |
|
|
1399 | if (extmap) |
|
|
1400 | { |
|
|
1401 | uint8_t ext, cmd; |
|
|
1402 | |
|
|
1403 | do |
|
|
1404 | { |
|
|
1405 | ext = *data++; |
|
|
1406 | cmd = ext & 0x3f; |
|
|
1407 | |
|
|
1408 | if (cmd < 4) |
|
|
1409 | cell->darkness = 255 - ext * 64 + 1; |
|
|
1410 | else if (cmd == 5) // health |
|
|
1411 | { |
|
|
1412 | cell->stat_width = 1; |
|
|
1413 | cell->stat_hp = *data++; |
|
|
1414 | } |
|
|
1415 | else if (cmd == 6) // monster width |
|
|
1416 | cell->stat_width = *data++ + 1; |
|
|
1417 | else if (cmd == 0x47) |
|
|
1418 | { |
|
|
1419 | if (*data == 8) |
|
|
1420 | ; // decode player uuid |
|
|
1421 | |
|
|
1422 | data += *data + 1; |
|
|
1423 | } |
|
|
1424 | else if (cmd == 8) // cell flags |
|
|
1425 | cell->flags = *data++; |
|
|
1426 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
1427 | data += *data + 1; |
|
|
1428 | else |
|
|
1429 | data++; |
|
|
1430 | } |
|
|
1431 | while (ext & 0x80); |
|
|
1432 | } |
|
|
1433 | else |
|
|
1434 | cell->darkness = *data++ + 1; |
|
|
1435 | } |
1280 | |
1436 | |
1281 | if (flags & 4) |
1437 | if (flags & 4) |
1282 | { |
1438 | { |
1283 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1439 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1284 | } |
1440 | } |
… | |
… | |
1292 | { |
1448 | { |
1293 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1449 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1294 | } |
1450 | } |
1295 | } |
1451 | } |
1296 | else |
1452 | else |
1297 | cell->darkness = -1; |
1453 | cell->darkness = 0; |
1298 | } |
1454 | } |
1299 | } |
1455 | } |
1300 | |
1456 | |
1301 | SV * |
1457 | SV * |
1302 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
1458 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1303 | CODE: |
1459 | CODE: |
1304 | { |
1460 | { |
1305 | int x1, x; |
1461 | int x1, x; |
1306 | int y1, y; |
1462 | int y1, y; |
1307 | int z; |
1463 | int z; |
… | |
… | |
1357 | } |
1513 | } |
1358 | OUTPUT: |
1514 | OUTPUT: |
1359 | RETVAL |
1515 | RETVAL |
1360 | |
1516 | |
1361 | void |
1517 | void |
1362 | draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1518 | draw (CFPlus::Map self, int mx, int my, int sw, int sh) |
1363 | CODE: |
1519 | CODE: |
1364 | { |
1520 | { |
1365 | int vx, vy; |
|
|
1366 | int x, y, z; |
1521 | int x, y, z; |
1367 | int last_name; |
1522 | int last_name; |
1368 | mapface face; |
1523 | mapface face; |
1369 | |
|
|
1370 | vx = self->x + self->w / 2 - sw / 2 - shift_x; |
|
|
1371 | vy = self->y + self->h / 2 - sh / 2 - shift_y; |
|
|
1372 | |
|
|
1373 | /* |
|
|
1374 | int vx = self->vx = self->w >= sw |
|
|
1375 | ? self->x + (self->w - sw) / 2 |
|
|
1376 | : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); |
|
|
1377 | |
|
|
1378 | int vy = self->vy = self->h >= sh |
|
|
1379 | ? self->y + (self->h - sh) / 2 |
|
|
1380 | : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); |
|
|
1381 | */ |
|
|
1382 | |
1524 | |
1383 | glColor4ub (255, 255, 255, 255); |
1525 | glColor4ub (255, 255, 255, 255); |
1384 | |
1526 | |
1385 | glEnable (GL_BLEND); |
1527 | glEnable (GL_BLEND); |
1386 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1528 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
… | |
… | |
1389 | |
1531 | |
1390 | glBegin (GL_QUADS); |
1532 | glBegin (GL_QUADS); |
1391 | |
1533 | |
1392 | last_name = 0; |
1534 | last_name = 0; |
1393 | |
1535 | |
|
|
1536 | mx += self->x; |
|
|
1537 | my += self->y; |
|
|
1538 | |
1394 | for (z = 0; z < 3; z++) |
1539 | for (z = 0; z < 3; z++) |
1395 | for (y = 0; y < sh; y++) |
1540 | for (y = 0; y < sh; y++) |
1396 | if (0 <= y + vy && y + vy < self->rows) |
1541 | if (0 <= y + my && y + my < self->rows) |
1397 | { |
1542 | { |
1398 | maprow *row = self->row + (y + vy); |
1543 | maprow *row = self->row + (y + my); |
1399 | |
1544 | |
1400 | for (x = 0; x < sw; x++) |
1545 | for (x = 0; x < sw; x++) |
1401 | if (row->c0 <= x + vx && x + vx < row->c1) |
1546 | if (row->c0 <= x + mx && x + mx < row->c1) |
1402 | { |
1547 | { |
1403 | mapcell *cell = row->col + (x + vx - row->c0); |
1548 | mapcell *cell = row->col + (x + mx - row->c0); |
1404 | |
1549 | |
1405 | face = cell->face [z]; |
1550 | face = cell->face [z]; |
1406 | |
1551 | |
1407 | if (face) |
1552 | if (face && face < self->texs) |
1408 | { |
1553 | { |
1409 | maptex tex = self->tex [face]; |
1554 | maptex tex = self->tex [face]; |
1410 | |
|
|
1411 | int px = (x + 1) * 32 - tex.w; |
1555 | int px = (x + 1) * 32 - tex.w; |
1412 | int py = (y + 1) * 32 - tex.h; |
1556 | int py = (y + 1) * 32 - tex.h; |
1413 | |
1557 | |
1414 | if (last_name != tex.name) |
1558 | if (last_name != tex.name) |
1415 | { |
1559 | { |
1416 | glEnd (); |
1560 | glEnd (); |
1417 | last_name = tex.name; |
|
|
1418 | glBindTexture (GL_TEXTURE_2D, last_name); |
1561 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1419 | glBegin (GL_QUADS); |
1562 | glBegin (GL_QUADS); |
1420 | } |
1563 | } |
1421 | |
1564 | |
1422 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1565 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1423 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
1566 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
1424 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
1567 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
1425 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
1568 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
1426 | } |
1569 | } |
|
|
1570 | |
|
|
1571 | if (cell->flags && z == 2) |
|
|
1572 | { |
|
|
1573 | if (cell->flags & 1) |
|
|
1574 | { |
|
|
1575 | maptex tex = self->tex [1]; |
|
|
1576 | int px = (x + 1) * 32 - tex.w + 2; |
|
|
1577 | int py = (y + 1) * 32 - tex.h - 6; |
|
|
1578 | |
|
|
1579 | glEnd (); |
|
|
1580 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
|
|
1581 | glBegin (GL_QUADS); |
|
|
1582 | |
|
|
1583 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
|
|
1584 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
|
|
1585 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
|
|
1586 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
|
|
1587 | } |
|
|
1588 | } |
1427 | } |
1589 | } |
1428 | } |
1590 | } |
1429 | |
1591 | |
1430 | glEnd (); |
1592 | glEnd (); |
1431 | |
1593 | |
1432 | glDisable (GL_TEXTURE_2D); |
1594 | glDisable (GL_TEXTURE_2D); |
1433 | glDisable (GL_BLEND); |
1595 | glDisable (GL_BLEND); |
1434 | } |
|
|
1435 | |
1596 | |
|
|
1597 | // top layer: overlays such as the health bar |
|
|
1598 | for (y = 0; y < sh; y++) |
|
|
1599 | if (0 <= y + my && y + my < self->rows) |
|
|
1600 | { |
|
|
1601 | maprow *row = self->row + (y + my); |
|
|
1602 | |
|
|
1603 | for (x = 0; x < sw; x++) |
|
|
1604 | if (row->c0 <= x + mx && x + mx < row->c1) |
|
|
1605 | { |
|
|
1606 | mapcell *cell = row->col + (x + mx - row->c0); |
|
|
1607 | |
|
|
1608 | int px = x * 32; |
|
|
1609 | int py = y * 32; |
|
|
1610 | |
|
|
1611 | if (cell->stat_hp) |
|
|
1612 | { |
|
|
1613 | int width = cell->stat_width * 32; |
|
|
1614 | int thick = sh / 28 + 1 + cell->stat_width; |
|
|
1615 | |
|
|
1616 | glColor3ub (0, 0, 0); |
|
|
1617 | glRectf (px + 1, py - thick - 2, |
|
|
1618 | px + width - 1, py); |
|
|
1619 | |
|
|
1620 | glColor3ub (cell->stat_hp, 255 - cell->stat_hp, 0); |
|
|
1621 | glRectf (px + 2, |
|
|
1622 | py - thick - 1, |
|
|
1623 | px + width - 2 - cell->stat_hp * (width - 4) / 255, py - 1); |
|
|
1624 | } |
|
|
1625 | } |
|
|
1626 | } |
|
|
1627 | } |
|
|
1628 | |
1436 | void |
1629 | void |
1437 | draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1630 | draw_magicmap (CFPlus::Map self, int dx, int dy, int w, int h, unsigned char *data) |
1438 | CODE: |
1631 | CODE: |
1439 | { |
1632 | { |
1440 | static float color[16][3] = { |
1633 | static float color[16][3] = { |
1441 | { 0.00F, 0.00F, 0.00F }, |
1634 | { 0.00F, 0.00F, 0.00F }, |
1442 | { 1.00F, 1.00F, 1.00F }, |
1635 | { 1.00F, 1.00F, 1.00F }, |
… | |
… | |
1492 | glDisable (GL_BLEND); |
1685 | glDisable (GL_BLEND); |
1493 | glDisable (GL_TEXTURE_2D); |
1686 | glDisable (GL_TEXTURE_2D); |
1494 | } |
1687 | } |
1495 | |
1688 | |
1496 | void |
1689 | void |
1497 | fow_texture (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
1690 | fow_texture (CFPlus::Map self, int mx, int my, int sw, int sh) |
1498 | PPCODE: |
1691 | PPCODE: |
1499 | { |
1692 | { |
1500 | int vx, vy; |
|
|
1501 | int x, y; |
1693 | int x, y; |
1502 | int sw4 = (sw + 3) & ~3; |
1694 | int sw4 = (sw + 3) & ~3; |
1503 | SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); |
1695 | SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); |
1504 | uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv); |
1696 | uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv); |
1505 | |
1697 | |
1506 | memset (darkness, 255, sw4 * sh); |
1698 | memset (darkness, 255, sw4 * sh); |
1507 | SvPOK_only (darkness_sv); |
1699 | SvPOK_only (darkness_sv); |
1508 | SvCUR_set (darkness_sv, sw4 * sh); |
1700 | SvCUR_set (darkness_sv, sw4 * sh); |
1509 | |
1701 | |
1510 | vx = self->x + (self->w - sw + 1) / 2 - shift_x; |
1702 | mx += self->x; |
1511 | vy = self->y + (self->h - sh + 1) / 2 - shift_y; |
1703 | my += self->y; |
1512 | |
1704 | |
1513 | for (y = 0; y < sh; y++) |
1705 | for (y = 0; y < sh; y++) |
1514 | if (0 <= y + vy && y + vy < self->rows) |
1706 | if (0 <= y + my && y + my < self->rows) |
1515 | { |
1707 | { |
1516 | maprow *row = self->row + (y + vy); |
1708 | maprow *row = self->row + (y + my); |
1517 | |
1709 | |
1518 | for (x = 0; x < sw; x++) |
1710 | for (x = 0; x < sw; x++) |
1519 | if (row->c0 <= x + vx && x + vx < row->c1) |
1711 | if (row->c0 <= x + mx && x + mx < row->c1) |
1520 | { |
1712 | { |
1521 | mapcell *cell = row->col + (x + vx - row->c0); |
1713 | mapcell *cell = row->col + (x + mx - row->c0); |
1522 | |
1714 | |
1523 | darkness[y * sw4 + x] = cell->darkness < 0 |
1715 | darkness[y * sw4 + x] = cell->darkness |
|
|
1716 | ? 255 - (cell->darkness - 1) |
1524 | ? 255 - FOW_DARKNESS |
1717 | : 255 - FOW_DARKNESS; |
1525 | : 255 - cell->darkness; |
|
|
1526 | } |
1718 | } |
1527 | } |
1719 | } |
1528 | |
1720 | |
1529 | EXTEND (SP, 3); |
1721 | EXTEND (SP, 3); |
1530 | PUSHs (sv_2mortal (newSViv (sw4))); |
1722 | PUSHs (sv_2mortal (newSViv (sw4))); |
1531 | PUSHs (sv_2mortal (newSViv (sh))); |
1723 | PUSHs (sv_2mortal (newSViv (sh))); |
1532 | PUSHs (darkness_sv); |
1724 | PUSHs (darkness_sv); |
1533 | } |
1725 | } |
1534 | |
1726 | |
1535 | SV * |
1727 | SV * |
1536 | get_rect (CFClient::Map self, int x0, int y0, int w, int h) |
1728 | get_rect (CFPlus::Map self, int x0, int y0, int w, int h) |
1537 | CODE: |
1729 | CODE: |
1538 | { |
1730 | { |
1539 | int x, y, x1, y1; |
1731 | int x, y, x1, y1; |
1540 | SV *data_sv = newSV (w * h * 7 + 5); |
1732 | SV *data_sv = newSV (w * h * 7 + 5); |
1541 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
1733 | uint8_t *data = (uint8_t *)SvPVX (data_sv); |
… | |
… | |
1603 | } |
1795 | } |
1604 | OUTPUT: |
1796 | OUTPUT: |
1605 | RETVAL |
1797 | RETVAL |
1606 | |
1798 | |
1607 | void |
1799 | void |
1608 | set_rect (CFClient::Map self, int x0, int y0, uint8_t *data) |
1800 | set_rect (CFPlus::Map self, int x0, int y0, uint8_t *data) |
1609 | PPCODE: |
1801 | PPCODE: |
1610 | { |
1802 | { |
1611 | int x, y, z; |
1803 | int x, y, z; |
1612 | int w, h; |
1804 | int w, h; |
1613 | int x1, y1; |
1805 | int x1, y1; |
… | |
… | |
1645 | |
1837 | |
1646 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1838 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1647 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1839 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1648 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1840 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1649 | |
1841 | |
1650 | if (cell->darkness <= 0) |
1842 | if (cell->darkness == 0) |
1651 | { |
1843 | { |
1652 | cell->darkness = -1; |
1844 | cell->darkness = 0; |
1653 | |
1845 | |
1654 | for (z = 0; z <= 2; z++) |
1846 | for (z = 0; z <= 2; z++) |
1655 | { |
1847 | { |
1656 | cell->face[z] = face[z]; |
1848 | cell->face[z] = face[z]; |
1657 | |
1849 | |
… | |
… | |
1662 | } |
1854 | } |
1663 | } |
1855 | } |
1664 | } |
1856 | } |
1665 | } |
1857 | } |
1666 | |
1858 | |
1667 | MODULE = CFClient PACKAGE = CFClient::MixChunk |
1859 | MODULE = CFPlus PACKAGE = CFPlus::MixChunk |
1668 | |
1860 | |
1669 | CFClient::MixChunk |
1861 | CFPlus::MixChunk |
1670 | new_from_file (SV *class, char *path) |
1862 | new_from_file (SV *class, char *path) |
1671 | CODE: |
1863 | CODE: |
1672 | RETVAL = Mix_LoadWAV (path); |
1864 | RETVAL = Mix_LoadWAV (path); |
1673 | OUTPUT: |
1865 | OUTPUT: |
1674 | RETVAL |
1866 | RETVAL |
1675 | |
1867 | |
1676 | void |
1868 | void |
1677 | DESTROY (CFClient::MixChunk self) |
1869 | DESTROY (CFPlus::MixChunk self) |
1678 | CODE: |
1870 | CODE: |
1679 | Mix_FreeChunk (self); |
1871 | Mix_FreeChunk (self); |
1680 | |
1872 | |
1681 | int |
1873 | int |
1682 | volume (CFClient::MixChunk self, int volume = -1) |
1874 | volume (CFPlus::MixChunk self, int volume = -1) |
1683 | CODE: |
1875 | CODE: |
1684 | RETVAL = Mix_VolumeChunk (self, volume); |
1876 | RETVAL = Mix_VolumeChunk (self, volume); |
1685 | OUTPUT: |
1877 | OUTPUT: |
1686 | RETVAL |
1878 | RETVAL |
1687 | |
1879 | |
1688 | int |
1880 | int |
1689 | play (CFClient::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1881 | play (CFPlus::MixChunk self, int channel = -1, int loops = 0, int ticks = -1) |
1690 | CODE: |
1882 | CODE: |
1691 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1883 | RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); |
1692 | OUTPUT: |
1884 | OUTPUT: |
1693 | RETVAL |
1885 | RETVAL |
1694 | |
1886 | |
1695 | MODULE = CFClient PACKAGE = CFClient::MixMusic |
1887 | MODULE = CFPlus PACKAGE = CFPlus::MixMusic |
1696 | |
1888 | |
1697 | int |
1889 | int |
1698 | volume (int volume = -1) |
1890 | volume (int volume = -1) |
1699 | CODE: |
1891 | CODE: |
1700 | RETVAL = Mix_VolumeMusic (volume); |
1892 | RETVAL = Mix_VolumeMusic (volume); |
1701 | OUTPUT: |
1893 | OUTPUT: |
1702 | RETVAL |
1894 | RETVAL |
1703 | |
1895 | |
1704 | CFClient::MixMusic |
1896 | CFPlus::MixMusic |
1705 | new_from_file (SV *class, char *path) |
1897 | new_from_file (SV *class, char *path) |
1706 | CODE: |
1898 | CODE: |
1707 | RETVAL = Mix_LoadMUS (path); |
1899 | RETVAL = Mix_LoadMUS (path); |
1708 | OUTPUT: |
1900 | OUTPUT: |
1709 | RETVAL |
1901 | RETVAL |
1710 | |
1902 | |
1711 | void |
1903 | void |
1712 | DESTROY (CFClient::MixMusic self) |
1904 | DESTROY (CFPlus::MixMusic self) |
1713 | CODE: |
1905 | CODE: |
1714 | Mix_FreeMusic (self); |
1906 | Mix_FreeMusic (self); |
1715 | |
1907 | |
1716 | int |
1908 | int |
1717 | play (CFClient::MixMusic self, int loops = -1) |
1909 | play (CFPlus::MixMusic self, int loops = -1) |
1718 | CODE: |
1910 | CODE: |
1719 | RETVAL = Mix_PlayMusic (self, loops); |
1911 | RETVAL = Mix_PlayMusic (self, loops); |
1720 | OUTPUT: |
1912 | OUTPUT: |
1721 | RETVAL |
1913 | RETVAL |
1722 | |
1914 | |
1723 | MODULE = CFClient PACKAGE = CFClient::OpenGL |
1915 | MODULE = CFPlus PACKAGE = CFPlus::OpenGL |
1724 | |
1916 | |
1725 | BOOT: |
1917 | BOOT: |
1726 | { |
1918 | { |
1727 | HV *stash = gv_stashpv ("CFClient::OpenGL", 1); |
1919 | HV *stash = gv_stashpv ("CFPlus::OpenGL", 1); |
1728 | static const struct { |
1920 | static const struct { |
1729 | const char *name; |
1921 | const char *name; |
1730 | IV iv; |
1922 | IV iv; |
1731 | } *civ, const_iv[] = { |
1923 | } *civ, const_iv[] = { |
1732 | # define const_iv(name) { # name, (IV)name } |
1924 | # define const_iv(name) { # name, (IV)name } |
… | |
… | |
1795 | const_iv (GL_SEPARABLE_2D), |
1987 | const_iv (GL_SEPARABLE_2D), |
1796 | const_iv (GL_CONVOLUTION_2D), |
1988 | const_iv (GL_CONVOLUTION_2D), |
1797 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1989 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1798 | const_iv (GL_CONSTANT_BORDER), |
1990 | const_iv (GL_CONSTANT_BORDER), |
1799 | const_iv (GL_LINES), |
1991 | const_iv (GL_LINES), |
|
|
1992 | const_iv (GL_LINE_STRIP), |
1800 | const_iv (GL_LINE_LOOP), |
1993 | const_iv (GL_LINE_LOOP), |
1801 | const_iv (GL_QUADS), |
1994 | const_iv (GL_QUADS), |
1802 | const_iv (GL_QUAD_STRIP), |
1995 | const_iv (GL_QUAD_STRIP), |
1803 | const_iv (GL_TRIANGLES), |
1996 | const_iv (GL_TRIANGLES), |
1804 | const_iv (GL_TRIANGLE_STRIP), |
1997 | const_iv (GL_TRIANGLE_STRIP), |
… | |
… | |
2001 | |
2194 | |
2002 | void glEndList () |
2195 | void glEndList () |
2003 | |
2196 | |
2004 | void glCallList (int list) |
2197 | void glCallList (int list) |
2005 | |
2198 | |
2006 | |
|
|