… | |
… | |
99 | |
99 | |
100 | #define KMOD_LRAM 0x10000 // our extension |
100 | #define KMOD_LRAM 0x10000 // our extension |
101 | |
101 | |
102 | #define TEXID_SPEECH 1 |
102 | #define TEXID_SPEECH 1 |
103 | #define TEXID_NOFACE 2 |
103 | #define TEXID_NOFACE 2 |
|
|
104 | |
|
|
105 | static char * |
|
|
106 | fast_sv_grow (SV *sv, STRLEN need) |
|
|
107 | { |
|
|
108 | STRLEN len = SvLEN (sv); |
|
|
109 | STRLEN want = SvCUR (sv) + need; |
|
|
110 | |
|
|
111 | if (expect_false (len < want)) |
|
|
112 | { |
|
|
113 | do |
|
|
114 | len *= 2; |
|
|
115 | while (len < want); |
|
|
116 | |
|
|
117 | sv_grow (sv, len); |
|
|
118 | } |
|
|
119 | |
|
|
120 | SvCUR_set (sv, want); |
|
|
121 | return SvEND (sv) - need; |
|
|
122 | } |
104 | |
123 | |
105 | static AV *texture_av; |
124 | static AV *texture_av; |
106 | |
125 | |
107 | static struct |
126 | static struct |
108 | { |
127 | { |
… | |
… | |
463 | |
482 | |
464 | SDL_PushEvent ((SDL_Event *)&ev); |
483 | SDL_PushEvent ((SDL_Event *)&ev); |
465 | } |
484 | } |
466 | |
485 | |
467 | static unsigned int |
486 | static unsigned int |
|
|
487 | div255 (unsigned int n) |
|
|
488 | { |
|
|
489 | return (n + (n >> 8)) >> 8; |
|
|
490 | } |
|
|
491 | |
|
|
492 | static unsigned int |
468 | minpot (unsigned int n) |
493 | minpot (unsigned int n) |
469 | { |
494 | { |
470 | if (!n) |
495 | if (!n) |
471 | return 0; |
496 | return 0; |
472 | |
497 | |
… | |
… | |
555 | |
580 | |
556 | static void |
581 | static void |
557 | deliantra_main () |
582 | deliantra_main () |
558 | { |
583 | { |
559 | char *argv[] = { 0 }; |
584 | char *argv[] = { 0 }; |
560 | call_argv ("::main", G_DISCARD | G_VOID, argv); |
585 | call_argv ("DC::Main::main", G_DISCARD | G_VOID, argv); |
561 | } |
586 | } |
562 | |
587 | |
563 | #ifdef __MACOSX__ |
588 | #ifdef __MACOSX__ |
564 | /* to due surprising braindamage on the side of SDL design, we |
589 | /* to due surprising braindamage on the side of SDL design, we |
565 | * do some mind-boggling hack here: SDL requires a custom main() |
590 | * 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, |
591 | * 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, |
592 | * due to shared library magic, calls -lSDLmain's main, not perl's main, |
568 | * and which calls our main (== SDL_main) back. |
593 | * and which calls our main (== SDL_main) back. |
569 | */ |
594 | */ |
570 | extern C_LINKAGE int |
595 | extern C_LINKAGE int |
571 | main (int argc, char *argv[]) |
596 | main (int argc, char *argv[]) |
572 | { |
597 | { |
… | |
… | |
796 | |
821 | |
797 | const_iv (FOW_DARKNESS) |
822 | const_iv (FOW_DARKNESS) |
798 | # undef const_iv |
823 | # undef const_iv |
799 | }; |
824 | }; |
800 | |
825 | |
801 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
826 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
802 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
827 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
803 | |
828 | |
804 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
829 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
805 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
830 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
806 | } |
831 | } |
807 | |
832 | |
… | |
… | |
925 | ); |
950 | ); |
926 | |
951 | |
927 | if (RETVAL) |
952 | if (RETVAL) |
928 | { |
953 | { |
929 | av_clear (texture_av); |
954 | 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); |
955 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
933 | #include "glfunc.h" |
956 | #include "glfunc.h" |
934 | #undef GL_FUNC |
957 | #undef GL_FUNC |
|
|
958 | if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB; |
|
|
959 | if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB; |
935 | } |
960 | } |
936 | } |
961 | } |
937 | OUTPUT: |
962 | OUTPUT: |
938 | RETVAL |
963 | RETVAL |
939 | |
964 | |
940 | void |
965 | void |
|
|
966 | SDL_WM_SetCaption (const char *title, const char *icon) |
|
|
967 | |
|
|
968 | void |
941 | SDL_GL_SwapBuffers () |
969 | SDL_GL_SwapBuffers () |
942 | |
970 | |
943 | char * |
971 | char * |
944 | SDL_GetKeyName (int sym) |
972 | SDL_GetKeyName (int sym) |
945 | |
973 | |
… | |
… | |
947 | SDL_GetAppState () |
975 | SDL_GetAppState () |
948 | |
976 | |
949 | int |
977 | int |
950 | SDL_GetModState () |
978 | SDL_GetModState () |
951 | |
979 | |
|
|
980 | int |
|
|
981 | SDL_WaitEvent () |
|
|
982 | C_ARGS: 0 |
|
|
983 | |
952 | void |
984 | void |
|
|
985 | SDL_PumpEvents () |
|
|
986 | |
|
|
987 | void |
953 | poll_events () |
988 | peep_events () |
954 | PPCODE: |
989 | PPCODE: |
955 | { |
990 | { |
956 | SDL_Event ev; |
991 | SDL_Event ev; |
957 | |
992 | |
958 | SDL_PumpEvents (); |
993 | SDL_PumpEvents (); |
… | |
… | |
1024 | |
1059 | |
1025 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1060 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1026 | } |
1061 | } |
1027 | } |
1062 | } |
1028 | |
1063 | |
|
|
1064 | char * |
|
|
1065 | SDL_AudioDriverName () |
|
|
1066 | CODE: |
|
|
1067 | { |
|
|
1068 | char buf [256]; |
|
|
1069 | if (!SDL_AudioDriverName (buf, sizeof (buf))) |
|
|
1070 | XSRETURN_UNDEF; |
|
|
1071 | |
|
|
1072 | RETVAL = buf; |
|
|
1073 | } |
|
|
1074 | OUTPUT: |
|
|
1075 | RETVAL |
|
|
1076 | |
1029 | int |
1077 | int |
1030 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1078 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1031 | POSTCALL: |
1079 | POSTCALL: |
1032 | Mix_HookMusicFinished (music_finished); |
1080 | Mix_HookMusicFinished (music_finished); |
1033 | Mix_ChannelFinished (channel_finished); |
1081 | Mix_ChannelFinished (channel_finished); |
… | |
… | |
1095 | add_font (char *file) |
1143 | add_font (char *file) |
1096 | CODE: |
1144 | CODE: |
1097 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1145 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1098 | OUTPUT: |
1146 | OUTPUT: |
1099 | RETVAL |
1147 | RETVAL |
|
|
1148 | |
|
|
1149 | void |
|
|
1150 | IMG_Init (int flags = IMG_INIT_JPG | IMG_INIT_PNG) |
|
|
1151 | |
|
|
1152 | # MIX_INIT_MP3 gives smpeg + libstdc++ + libgcc_s |
|
|
1153 | void |
|
|
1154 | Mix_Init (int flags = MIX_INIT_MOD | MIX_INIT_OGG) |
1100 | |
1155 | |
1101 | void |
1156 | void |
1102 | load_image_inline (SV *image_) |
1157 | load_image_inline (SV *image_) |
1103 | ALIAS: |
1158 | ALIAS: |
1104 | load_image_file = 1 |
1159 | load_image_file = 1 |
… | |
… | |
1672 | void |
1727 | 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) |
1728 | 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: @ |
1729 | PROTOTYPE: @ |
1675 | CODE: |
1730 | CODE: |
1676 | { |
1731 | { |
|
|
1732 | glEnable (GL_BLEND); |
|
|
1733 | glBlendFunc (intensity ? GL_SRC_ALPHA : GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1677 | glEnable (GL_TEXTURE_2D); |
1734 | glEnable (GL_TEXTURE_2D); |
1678 | glEnable (GL_BLEND); |
|
|
1679 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
|
|
1680 | glBindTexture (GL_TEXTURE_2D, name1); |
1735 | glBindTexture (GL_TEXTURE_2D, name1); |
1681 | |
1736 | |
1682 | glColor3f (intensity, intensity, intensity); |
1737 | glColor3f (intensity, intensity, intensity); |
1683 | glPushMatrix (); |
1738 | glPushMatrix (); |
1684 | glScalef (1./3, 1./3, 1.); |
1739 | glScalef (1./3, 1./3, 1.); |
… | |
… | |
1699 | glBindTexture (GL_TEXTURE_2D, name2); |
1754 | glBindTexture (GL_TEXTURE_2D, name2); |
1700 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1755 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1701 | |
1756 | |
1702 | /* rgb == rgb(glcolor) */ |
1757 | /* rgb == rgb(glcolor) */ |
1703 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1758 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1704 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT); |
1759 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR); |
1705 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1760 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1706 | |
1761 | |
1707 | /* alpha = interpolate t0, t1 by env_alpha */ |
1762 | /* alpha = interpolate t0, t1 by env_alpha */ |
1708 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1763 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1709 | |
1764 | |
… | |
… | |
2096 | ? self->row + y |
2151 | ? self->row + y |
2097 | : 0; |
2152 | : 0; |
2098 | |
2153 | |
2099 | for (x = x0; x < x1; x++) |
2154 | for (x = x0; x < x1; x++) |
2100 | { |
2155 | { |
2101 | int r = 32, g = 32, b = 32, a = 192; |
2156 | unsigned int r = 32, g = 32, b = 32, a = 192; |
2102 | |
2157 | |
2103 | if (row && row->c0 <= x && x < row->c1) |
2158 | if (row && row->c0 <= x && x < row->c1) |
2104 | { |
2159 | { |
2105 | mapcell *cell = row->col + (x - row->c0); |
2160 | mapcell *cell = row->col + (x - row->c0); |
2106 | |
2161 | |
… | |
… | |
2108 | { |
2163 | { |
2109 | maptex tex = self->tex [cell->tile [z]]; |
2164 | maptex tex = self->tex [cell->tile [z]]; |
2110 | int a0 = 255 - tex.a; |
2165 | int a0 = 255 - tex.a; |
2111 | int a1 = tex.a; |
2166 | int a1 = tex.a; |
2112 | |
2167 | |
2113 | r = (r * a0 + tex.r * a1) / 255; |
2168 | r = div255 (r * a0 + tex.r * a1); |
2114 | g = (g * a0 + tex.g * a1) / 255; |
2169 | g = div255 (g * a0 + tex.g * a1); |
2115 | b = (b * a0 + tex.b * a1) / 255; |
2170 | b = div255 (b * a0 + tex.b * a1); |
2116 | a = (a * a0 + tex.a * a1) / 255; |
2171 | a = div255 (a * a0 + tex.a * a1); |
2117 | } |
2172 | } |
2118 | } |
2173 | } |
2119 | |
2174 | |
2120 | *map++ = (r ) |
2175 | *map++ = (r ) |
2121 | | (g << 8) |
2176 | | (g << 8) |
… | |
… | |
2128 | } |
2183 | } |
2129 | OUTPUT: |
2184 | OUTPUT: |
2130 | RETVAL |
2185 | RETVAL |
2131 | |
2186 | |
2132 | void |
2187 | 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) |
2188 | 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: |
2189 | CODE: |
2135 | { |
2190 | { |
2136 | int x, y, z; |
2191 | int x, y, z; |
2137 | |
2192 | |
2138 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
2193 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
… | |
… | |
2222 | |
2277 | |
2223 | key.texname = tex.name; |
2278 | key.texname = tex.name; |
2224 | arr = rc_array (rc, &key); |
2279 | arr = rc_array (rc, &key); |
2225 | } |
2280 | } |
2226 | |
2281 | |
2227 | px = (x + 1) * T - tex.w; |
2282 | px = (x + 1) * Th - tex.w; |
2228 | py = (y + 1) * T - tex.h; |
2283 | py = (y + 1) * Tw - tex.h; |
2229 | |
2284 | |
2230 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2285 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2231 | { |
2286 | { |
2232 | pl_x = px; |
2287 | pl_x = px; |
2233 | pl_y = py; |
2288 | pl_y = py; |
… | |
… | |
2286 | if (cell->flags & 1) |
2341 | if (cell->flags & 1) |
2287 | { |
2342 | { |
2288 | rc_key_t key_ov = key; |
2343 | rc_key_t key_ov = key; |
2289 | maptex tex = self->tex [TEXID_SPEECH]; |
2344 | maptex tex = self->tex [TEXID_SPEECH]; |
2290 | rc_array_t *arr; |
2345 | rc_array_t *arr; |
2291 | int px = x * T + T * 2 / 32; |
2346 | int px = x * Tw + Tw * 2 / 32; |
2292 | int py = y * T - T * 6 / 32; |
2347 | int py = y * Th - Th * 6 / 32; |
2293 | |
2348 | |
2294 | key_ov.texname = tex.name; |
2349 | key_ov.texname = tex.name; |
2295 | arr = rc_array (rc_ov, &key_ov); |
2350 | arr = rc_array (rc_ov, &key_ov); |
2296 | |
2351 | |
2297 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2352 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2298 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
2353 | 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); |
2354 | 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); |
2355 | rc_t2f_v3f (arr, tex.s, 0 , px + Tw, py , 0); |
2301 | } |
2356 | } |
2302 | } |
2357 | } |
2303 | } |
2358 | } |
2304 | } |
2359 | } |
2305 | |
2360 | |
… | |
… | |
2332 | if (!(bits & 0x1000) |
2387 | if (!(bits & 0x1000) |
2333 | && skey->level == level |
2388 | && skey->level == level |
2334 | && level > smooth_max [skey->x][skey->y]) |
2389 | && level > smooth_max [skey->x][skey->y]) |
2335 | { |
2390 | { |
2336 | maptex tex = self->tex [skey->tile]; |
2391 | maptex tex = self->tex [skey->tile]; |
2337 | int px = (((int)skey->x) - 1) * T; |
2392 | int px = (((int)skey->x) - 1) * Tw; |
2338 | int py = (((int)skey->y) - 1) * T; |
2393 | int py = (((int)skey->y) - 1) * Th; |
2339 | int border = bits & 15; |
2394 | int border = bits & 15; |
2340 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2395 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2341 | float dx = tex.s * .0625f; // 16 images/row |
2396 | float dx = tex.s * .0625f; // 16 images/row |
2342 | float dy = tex.t * .5f ; // 2 images/column |
2397 | float dy = tex.t * .5f ; // 2 images/column |
2343 | |
2398 | |
… | |
… | |
2356 | |
2411 | |
2357 | if (border) |
2412 | if (border) |
2358 | { |
2413 | { |
2359 | float ox = border * dx; |
2414 | float ox = border * dx; |
2360 | |
2415 | |
2361 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2416 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2362 | glTexCoord2f (ox , dy ); glVertex2i (px , py + T); |
2417 | glTexCoord2f (ox , dy ); glVertex2i (px , py + Th); |
2363 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py + T); |
2418 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th); |
2364 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + T, py ); |
2419 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py ); |
2365 | } |
2420 | } |
2366 | |
2421 | |
2367 | if (corner) |
2422 | if (corner) |
2368 | { |
2423 | { |
2369 | float ox = corner * dx; |
2424 | float ox = corner * dx; |
2370 | |
2425 | |
2371 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2426 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2372 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + T); |
2427 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th); |
2373 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + T, py + T); |
2428 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th); |
2374 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py ); |
2429 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py ); |
2375 | } |
2430 | } |
2376 | } |
2431 | } |
2377 | } |
2432 | } |
2378 | } |
2433 | } |
2379 | } |
2434 | } |
… | |
… | |
2420 | for (x = 0; x < sw; x++) |
2475 | for (x = 0; x < sw; x++) |
2421 | if (row->c0 <= x + mx && x + mx < row->c1) |
2476 | if (row->c0 <= x + mx && x + mx < row->c1) |
2422 | { |
2477 | { |
2423 | mapcell *cell = row->col + (x + mx - row->c0); |
2478 | mapcell *cell = row->col + (x + mx - row->c0); |
2424 | |
2479 | |
2425 | int px = x * T; |
2480 | int px = x * Tw; |
2426 | int py = y * T; |
2481 | int py = y * Th; |
2427 | |
2482 | |
2428 | if (expect_false (cell->player == player)) |
2483 | if (expect_false (cell->player == player)) |
2429 | { |
2484 | { |
2430 | px += sdx; |
2485 | px += sdx; |
2431 | py += sdy; |
2486 | py += sdy; |
2432 | } |
2487 | } |
2433 | |
2488 | |
2434 | if (cell->stat_hp) |
2489 | if (cell->stat_hp) |
2435 | { |
2490 | { |
2436 | int width = cell->stat_width * T; |
2491 | int width = cell->stat_width * Tw; |
2437 | int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; |
2492 | int thick = (sh * Th / 32 + 27) / 28 + 1 + cell->stat_width; |
2438 | |
2493 | |
2439 | glColor3ub (0, 0, 0); |
2494 | glColor3ub (0, 0, 0); |
2440 | glRectf (px + 1, py - thick - 2, |
2495 | glRectf (px + 1, py - thick - 2, |
2441 | px + width - 1, py); |
2496 | px + width - 1, py); |
2442 | |
2497 | |
… | |
… | |
2522 | int x, y; |
2577 | int x, y; |
2523 | int sw1 = sw + 2; |
2578 | int sw1 = sw + 2; |
2524 | int sh1 = sh + 2; |
2579 | int sh1 = sh + 2; |
2525 | int sh3 = sh * 3; |
2580 | int sh3 = sh * 3; |
2526 | int sw3 = sw * 3; |
2581 | int sw3 = sw * 3; |
2527 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2528 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2582 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2529 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
2583 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
|
|
2584 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2585 | memset (darkness1, 0, sw1*sh1); |
2530 | |
2586 | |
2531 | SvPOK_only (darkness3_sv); |
2587 | SvPOK_only (darkness3_sv); |
2532 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2588 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2533 | |
2589 | |
2534 | mx += self->x - 1; |
2590 | mx += self->x - 1; |
… | |
… | |
2795 | if (RETVAL < 0) |
2851 | if (RETVAL < 0) |
2796 | { |
2852 | { |
2797 | RETVAL = Mix_GroupOldest (-1); |
2853 | RETVAL = Mix_GroupOldest (-1); |
2798 | |
2854 | |
2799 | if (RETVAL < 0) |
2855 | if (RETVAL < 0) |
|
|
2856 | { |
|
|
2857 | // happens sometimes, maybe it just stopped playing(?) |
|
|
2858 | RETVAL = Mix_GroupAvailable (-1); |
|
|
2859 | |
|
|
2860 | if (RETVAL < 0) |
2800 | XSRETURN_UNDEF; |
2861 | XSRETURN_UNDEF; |
2801 | |
2862 | } |
|
|
2863 | else |
2802 | Mix_HaltChannel (RETVAL); |
2864 | Mix_HaltChannel (RETVAL); |
2803 | } |
2865 | } |
2804 | |
2866 | |
2805 | Mix_UnregisterAllEffects (RETVAL); |
2867 | Mix_UnregisterAllEffects (RETVAL); |
2806 | Mix_Volume (RETVAL, 128); |
2868 | Mix_Volume (RETVAL, 128); |
2807 | } |
2869 | } |
… | |
… | |
2866 | Mix_SetReverseStereo (self, flip); |
2928 | Mix_SetReverseStereo (self, flip); |
2867 | |
2929 | |
2868 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2930 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2869 | |
2931 | |
2870 | PROTOTYPES: DISABLE |
2932 | PROTOTYPES: DISABLE |
|
|
2933 | |
|
|
2934 | void |
|
|
2935 | decoders () |
|
|
2936 | PPCODE: |
|
|
2937 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
2938 | int i, num = Mix_GetNumChunkDecoders (); |
|
|
2939 | EXTEND (SP, num); |
|
|
2940 | for (i = 0; i < num; ++i) |
|
|
2941 | PUSHs (sv_2mortal (newSVpv (Mix_GetChunkDecoder (i), 0))); |
|
|
2942 | #else |
|
|
2943 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
2944 | #endif |
2871 | |
2945 | |
2872 | DC::MixChunk |
2946 | DC::MixChunk |
2873 | new (SV *class, DC::RW rwops) |
2947 | new (SV *class, DC::RW rwops) |
2874 | CODE: |
2948 | CODE: |
2875 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2949 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
… | |
… | |
2908 | OUTPUT: |
2982 | OUTPUT: |
2909 | RETVAL |
2983 | RETVAL |
2910 | |
2984 | |
2911 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2985 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2912 | |
2986 | |
|
|
2987 | void |
|
|
2988 | decoders () |
|
|
2989 | PPCODE: |
|
|
2990 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
2991 | int i, num = Mix_GetNumMusicDecoders (); |
|
|
2992 | EXTEND (SP, num); |
|
|
2993 | for (i = 0; i < num; ++i) |
|
|
2994 | PUSHs (sv_2mortal (newSVpv (Mix_GetMusicDecoder (i), 0))); |
|
|
2995 | #else |
|
|
2996 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
2997 | #endif |
|
|
2998 | |
2913 | int |
2999 | int |
2914 | volume (int volume = -1) |
3000 | volume (int volume = -1) |
2915 | PROTOTYPE: ;$ |
3001 | PROTOTYPE: ;$ |
2916 | CODE: |
3002 | CODE: |
2917 | if (items > 0) |
3003 | if (items > 0) |
… | |
… | |
2927 | |
3013 | |
2928 | void |
3014 | void |
2929 | halt () |
3015 | halt () |
2930 | CODE: |
3016 | CODE: |
2931 | Mix_HaltMusic (); |
3017 | Mix_HaltMusic (); |
|
|
3018 | |
|
|
3019 | int |
|
|
3020 | playing () |
|
|
3021 | CODE: |
|
|
3022 | RETVAL = Mix_PlayingMusic (); |
|
|
3023 | OUTPUT: |
|
|
3024 | RETVAL |
2932 | |
3025 | |
2933 | DC::MixMusic |
3026 | DC::MixMusic |
2934 | new (SV *class, DC::RW rwops) |
3027 | new (SV *class, DC::RW rwops) |
2935 | CODE: |
3028 | CODE: |
2936 | RETVAL = Mix_LoadMUS_RW (rwops); |
3029 | RETVAL = Mix_LoadMUS_RW (rwops); |
… | |
… | |
3076 | const_iv (GL_FUNC_SUBTRACT), |
3169 | const_iv (GL_FUNC_SUBTRACT), |
3077 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3170 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3078 | # undef const_iv |
3171 | # undef const_iv |
3079 | }; |
3172 | }; |
3080 | |
3173 | |
3081 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
3174 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
3082 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
3175 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
3083 | |
3176 | |
3084 | texture_av = newAV (); |
3177 | texture_av = newAV (); |
3085 | AvREAL_off (texture_av); |
3178 | AvREAL_off (texture_av); |
3086 | } |
3179 | } |
3087 | |
3180 | |
… | |
… | |
3130 | RETVAL |
3223 | RETVAL |
3131 | |
3224 | |
3132 | int glGetError () |
3225 | int glGetError () |
3133 | |
3226 | |
3134 | void glFinish () |
3227 | void glFinish () |
|
|
3228 | |
|
|
3229 | void glFlush () |
3135 | |
3230 | |
3136 | void glClear (int mask) |
3231 | void glClear (int mask) |
3137 | |
3232 | |
3138 | void glClearColor (float r, float g, float b, float a = 1.0) |
3233 | void glClearColor (float r, float g, float b, float a = 1.0) |
3139 | PROTOTYPE: @ |
3234 | PROTOTYPE: @ |