… | |
… | |
41 | #include <SDL_opengl.h> |
41 | #include <SDL_opengl.h> |
42 | |
42 | |
43 | /* work around os x broken headers */ |
43 | /* work around os x broken headers */ |
44 | #ifdef __MACOSX__ |
44 | #ifdef __MACOSX__ |
45 | typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
45 | typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
|
|
46 | typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); |
|
|
47 | typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); |
46 | #endif |
48 | #endif |
47 | |
49 | |
48 | #define PANGO_ENABLE_BACKEND |
50 | #define PANGO_ENABLE_BACKEND |
49 | #define G_DISABLE_CAST_CHECKS |
51 | #define G_DISABLE_CAST_CHECKS |
50 | |
52 | |
… | |
… | |
97 | |
99 | |
98 | #define KMOD_LRAM 0x10000 // our extension |
100 | #define KMOD_LRAM 0x10000 // our extension |
99 | |
101 | |
100 | #define TEXID_SPEECH 1 |
102 | #define TEXID_SPEECH 1 |
101 | #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 | } |
102 | |
123 | |
103 | static AV *texture_av; |
124 | static AV *texture_av; |
104 | |
125 | |
105 | static struct |
126 | static struct |
106 | { |
127 | { |
… | |
… | |
461 | |
482 | |
462 | SDL_PushEvent ((SDL_Event *)&ev); |
483 | SDL_PushEvent ((SDL_Event *)&ev); |
463 | } |
484 | } |
464 | |
485 | |
465 | 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 |
466 | minpot (unsigned int n) |
493 | minpot (unsigned int n) |
467 | { |
494 | { |
468 | if (!n) |
495 | if (!n) |
469 | return 0; |
496 | return 0; |
470 | |
497 | |
… | |
… | |
553 | |
580 | |
554 | static void |
581 | static void |
555 | deliantra_main () |
582 | deliantra_main () |
556 | { |
583 | { |
557 | char *argv[] = { 0 }; |
584 | char *argv[] = { 0 }; |
558 | call_argv ("::main", G_DISCARD | G_VOID, argv); |
585 | call_argv ("DC::Main::main", G_DISCARD | G_VOID, argv); |
559 | } |
586 | } |
560 | |
587 | |
561 | #ifdef __MACOSX__ |
588 | #ifdef __MACOSX__ |
562 | /* to due surprising braindamage on the side of SDL design, we |
589 | /* to due surprising braindamage on the side of SDL design, we |
563 | * do some mind-boggling hack here: SDL requires a custom main() |
590 | * do some mind-boggling hack here: SDL requires a custom main() |
564 | * 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, |
565 | * 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, |
566 | * and which calls our main (== SDL_main) back. |
593 | * and which calls our main (== SDL_main) back. |
567 | */ |
594 | */ |
568 | extern C_LINKAGE int |
595 | extern C_LINKAGE int |
569 | main (int argc, char *argv[]) |
596 | main (int argc, char *argv[]) |
570 | { |
597 | { |
… | |
… | |
794 | |
821 | |
795 | const_iv (FOW_DARKNESS) |
822 | const_iv (FOW_DARKNESS) |
796 | # undef const_iv |
823 | # undef const_iv |
797 | }; |
824 | }; |
798 | |
825 | |
799 | 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--) |
800 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
827 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
801 | |
828 | |
802 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
829 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
803 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
830 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
804 | } |
831 | } |
805 | |
832 | |
… | |
… | |
923 | ); |
950 | ); |
924 | |
951 | |
925 | if (RETVAL) |
952 | if (RETVAL) |
926 | { |
953 | { |
927 | av_clear (texture_av); |
954 | av_clear (texture_av); |
928 | |
|
|
929 | SDL_WM_SetCaption ("Deliantra MORPG Client " VERSION, "Deliantra"); |
|
|
930 | #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); |
931 | #include "glfunc.h" |
956 | #include "glfunc.h" |
932 | #undef GL_FUNC |
957 | #undef GL_FUNC |
|
|
958 | if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB; |
|
|
959 | if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB; |
933 | } |
960 | } |
934 | } |
961 | } |
935 | OUTPUT: |
962 | OUTPUT: |
936 | RETVAL |
963 | RETVAL |
937 | |
964 | |
938 | void |
965 | void |
|
|
966 | SDL_WM_SetCaption (const char *title, const char *icon) |
|
|
967 | |
|
|
968 | void |
939 | SDL_GL_SwapBuffers () |
969 | SDL_GL_SwapBuffers () |
940 | |
970 | |
941 | char * |
971 | char * |
942 | SDL_GetKeyName (int sym) |
972 | SDL_GetKeyName (int sym) |
943 | |
973 | |
… | |
… | |
945 | SDL_GetAppState () |
975 | SDL_GetAppState () |
946 | |
976 | |
947 | int |
977 | int |
948 | SDL_GetModState () |
978 | SDL_GetModState () |
949 | |
979 | |
|
|
980 | int |
|
|
981 | SDL_WaitEvent () |
|
|
982 | C_ARGS: 0 |
|
|
983 | |
950 | void |
984 | void |
|
|
985 | SDL_PumpEvents () |
|
|
986 | |
|
|
987 | void |
951 | poll_events () |
988 | peep_events () |
952 | PPCODE: |
989 | PPCODE: |
953 | { |
990 | { |
954 | SDL_Event ev; |
991 | SDL_Event ev; |
955 | |
992 | |
956 | SDL_PumpEvents (); |
993 | SDL_PumpEvents (); |
… | |
… | |
1022 | |
1059 | |
1023 | 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)))); |
1024 | } |
1061 | } |
1025 | } |
1062 | } |
1026 | |
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 | |
1027 | int |
1077 | int |
1028 | 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) |
1029 | POSTCALL: |
1079 | POSTCALL: |
1030 | Mix_HookMusicFinished (music_finished); |
1080 | Mix_HookMusicFinished (music_finished); |
1031 | Mix_ChannelFinished (channel_finished); |
1081 | Mix_ChannelFinished (channel_finished); |
… | |
… | |
1093 | add_font (char *file) |
1143 | add_font (char *file) |
1094 | CODE: |
1144 | CODE: |
1095 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1145 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1096 | OUTPUT: |
1146 | OUTPUT: |
1097 | 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) |
1098 | |
1155 | |
1099 | void |
1156 | void |
1100 | load_image_inline (SV *image_) |
1157 | load_image_inline (SV *image_) |
1101 | ALIAS: |
1158 | ALIAS: |
1102 | load_image_file = 1 |
1159 | load_image_file = 1 |
… | |
… | |
1670 | void |
1727 | void |
1671 | 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) |
1672 | PROTOTYPE: @ |
1729 | PROTOTYPE: @ |
1673 | CODE: |
1730 | CODE: |
1674 | { |
1731 | { |
|
|
1732 | glEnable (GL_BLEND); |
|
|
1733 | glBlendFunc (intensity ? GL_SRC_ALPHA : GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
1675 | glEnable (GL_TEXTURE_2D); |
1734 | glEnable (GL_TEXTURE_2D); |
1676 | glEnable (GL_BLEND); |
|
|
1677 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
|
|
1678 | glBindTexture (GL_TEXTURE_2D, name1); |
1735 | glBindTexture (GL_TEXTURE_2D, name1); |
1679 | |
1736 | |
1680 | glColor3f (intensity, intensity, intensity); |
1737 | glColor3f (intensity, intensity, intensity); |
1681 | glPushMatrix (); |
1738 | glPushMatrix (); |
1682 | glScalef (1./3, 1./3, 1.); |
1739 | glScalef (1./3, 1./3, 1.); |
… | |
… | |
1697 | glBindTexture (GL_TEXTURE_2D, name2); |
1754 | glBindTexture (GL_TEXTURE_2D, name2); |
1698 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1755 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
1699 | |
1756 | |
1700 | /* rgb == rgb(glcolor) */ |
1757 | /* rgb == rgb(glcolor) */ |
1701 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1758 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
1702 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT); |
1759 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PRIMARY_COLOR); |
1703 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1760 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
1704 | |
1761 | |
1705 | /* alpha = interpolate t0, t1 by env_alpha */ |
1762 | /* alpha = interpolate t0, t1 by env_alpha */ |
1706 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1763 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
1707 | |
1764 | |
… | |
… | |
2094 | ? self->row + y |
2151 | ? self->row + y |
2095 | : 0; |
2152 | : 0; |
2096 | |
2153 | |
2097 | for (x = x0; x < x1; x++) |
2154 | for (x = x0; x < x1; x++) |
2098 | { |
2155 | { |
2099 | int r = 32, g = 32, b = 32, a = 192; |
2156 | unsigned int r = 32, g = 32, b = 32, a = 192; |
2100 | |
2157 | |
2101 | if (row && row->c0 <= x && x < row->c1) |
2158 | if (row && row->c0 <= x && x < row->c1) |
2102 | { |
2159 | { |
2103 | mapcell *cell = row->col + (x - row->c0); |
2160 | mapcell *cell = row->col + (x - row->c0); |
2104 | |
2161 | |
… | |
… | |
2106 | { |
2163 | { |
2107 | maptex tex = self->tex [cell->tile [z]]; |
2164 | maptex tex = self->tex [cell->tile [z]]; |
2108 | int a0 = 255 - tex.a; |
2165 | int a0 = 255 - tex.a; |
2109 | int a1 = tex.a; |
2166 | int a1 = tex.a; |
2110 | |
2167 | |
2111 | r = (r * a0 + tex.r * a1) / 255; |
2168 | r = div255 (r * a0 + tex.r * a1); |
2112 | g = (g * a0 + tex.g * a1) / 255; |
2169 | g = div255 (g * a0 + tex.g * a1); |
2113 | b = (b * a0 + tex.b * a1) / 255; |
2170 | b = div255 (b * a0 + tex.b * a1); |
2114 | a = (a * a0 + tex.a * a1) / 255; |
2171 | a = div255 (a * a0 + tex.a * a1); |
2115 | } |
2172 | } |
2116 | } |
2173 | } |
2117 | |
2174 | |
2118 | *map++ = (r ) |
2175 | *map++ = (r ) |
2119 | | (g << 8) |
2176 | | (g << 8) |
… | |
… | |
2126 | } |
2183 | } |
2127 | OUTPUT: |
2184 | OUTPUT: |
2128 | RETVAL |
2185 | RETVAL |
2129 | |
2186 | |
2130 | void |
2187 | void |
2131 | 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) |
2132 | CODE: |
2189 | CODE: |
2133 | { |
2190 | { |
2134 | int x, y, z; |
2191 | int x, y, z; |
2135 | |
2192 | |
2136 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
2193 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
… | |
… | |
2220 | |
2277 | |
2221 | key.texname = tex.name; |
2278 | key.texname = tex.name; |
2222 | arr = rc_array (rc, &key); |
2279 | arr = rc_array (rc, &key); |
2223 | } |
2280 | } |
2224 | |
2281 | |
2225 | px = (x + 1) * T - tex.w; |
2282 | px = (x + 1) * Th - tex.w; |
2226 | py = (y + 1) * T - tex.h; |
2283 | py = (y + 1) * Tw - tex.h; |
2227 | |
2284 | |
2228 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2285 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2229 | { |
2286 | { |
2230 | pl_x = px; |
2287 | pl_x = px; |
2231 | pl_y = py; |
2288 | pl_y = py; |
… | |
… | |
2284 | if (cell->flags & 1) |
2341 | if (cell->flags & 1) |
2285 | { |
2342 | { |
2286 | rc_key_t key_ov = key; |
2343 | rc_key_t key_ov = key; |
2287 | maptex tex = self->tex [TEXID_SPEECH]; |
2344 | maptex tex = self->tex [TEXID_SPEECH]; |
2288 | rc_array_t *arr; |
2345 | rc_array_t *arr; |
2289 | int px = x * T + T * 2 / 32; |
2346 | int px = x * Tw + Tw * 2 / 32; |
2290 | int py = y * T - T * 6 / 32; |
2347 | int py = y * Th - Th * 6 / 32; |
2291 | |
2348 | |
2292 | key_ov.texname = tex.name; |
2349 | key_ov.texname = tex.name; |
2293 | arr = rc_array (rc_ov, &key_ov); |
2350 | arr = rc_array (rc_ov, &key_ov); |
2294 | |
2351 | |
2295 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2352 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2296 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
2353 | rc_t2f_v3f (arr, 0 , tex.t, px , py + Th, 0); |
2297 | 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); |
2298 | rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); |
2355 | rc_t2f_v3f (arr, tex.s, 0 , px + Tw, py , 0); |
2299 | } |
2356 | } |
2300 | } |
2357 | } |
2301 | } |
2358 | } |
2302 | } |
2359 | } |
2303 | |
2360 | |
… | |
… | |
2330 | if (!(bits & 0x1000) |
2387 | if (!(bits & 0x1000) |
2331 | && skey->level == level |
2388 | && skey->level == level |
2332 | && level > smooth_max [skey->x][skey->y]) |
2389 | && level > smooth_max [skey->x][skey->y]) |
2333 | { |
2390 | { |
2334 | maptex tex = self->tex [skey->tile]; |
2391 | maptex tex = self->tex [skey->tile]; |
2335 | int px = (((int)skey->x) - 1) * T; |
2392 | int px = (((int)skey->x) - 1) * Tw; |
2336 | int py = (((int)skey->y) - 1) * T; |
2393 | int py = (((int)skey->y) - 1) * Th; |
2337 | int border = bits & 15; |
2394 | int border = bits & 15; |
2338 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2395 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2339 | float dx = tex.s * .0625f; // 16 images/row |
2396 | float dx = tex.s * .0625f; // 16 images/row |
2340 | float dy = tex.t * .5f ; // 2 images/column |
2397 | float dy = tex.t * .5f ; // 2 images/column |
2341 | |
2398 | |
… | |
… | |
2354 | |
2411 | |
2355 | if (border) |
2412 | if (border) |
2356 | { |
2413 | { |
2357 | float ox = border * dx; |
2414 | float ox = border * dx; |
2358 | |
2415 | |
2359 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2416 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2360 | glTexCoord2f (ox , dy ); glVertex2i (px , py + T); |
2417 | glTexCoord2f (ox , dy ); glVertex2i (px , py + Th); |
2361 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py + T); |
2418 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th); |
2362 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + T, py ); |
2419 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py ); |
2363 | } |
2420 | } |
2364 | |
2421 | |
2365 | if (corner) |
2422 | if (corner) |
2366 | { |
2423 | { |
2367 | float ox = corner * dx; |
2424 | float ox = corner * dx; |
2368 | |
2425 | |
2369 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2426 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2370 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + T); |
2427 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th); |
2371 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + T, py + T); |
2428 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th); |
2372 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py ); |
2429 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py ); |
2373 | } |
2430 | } |
2374 | } |
2431 | } |
2375 | } |
2432 | } |
2376 | } |
2433 | } |
2377 | } |
2434 | } |
… | |
… | |
2418 | for (x = 0; x < sw; x++) |
2475 | for (x = 0; x < sw; x++) |
2419 | if (row->c0 <= x + mx && x + mx < row->c1) |
2476 | if (row->c0 <= x + mx && x + mx < row->c1) |
2420 | { |
2477 | { |
2421 | mapcell *cell = row->col + (x + mx - row->c0); |
2478 | mapcell *cell = row->col + (x + mx - row->c0); |
2422 | |
2479 | |
2423 | int px = x * T; |
2480 | int px = x * Tw; |
2424 | int py = y * T; |
2481 | int py = y * Th; |
2425 | |
2482 | |
2426 | if (expect_false (cell->player == player)) |
2483 | if (expect_false (cell->player == player)) |
2427 | { |
2484 | { |
2428 | px += sdx; |
2485 | px += sdx; |
2429 | py += sdy; |
2486 | py += sdy; |
2430 | } |
2487 | } |
2431 | |
2488 | |
2432 | if (cell->stat_hp) |
2489 | if (cell->stat_hp) |
2433 | { |
2490 | { |
2434 | int width = cell->stat_width * T; |
2491 | int width = cell->stat_width * Tw; |
2435 | int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; |
2492 | int thick = (sh * Th / 32 + 27) / 28 + 1 + cell->stat_width; |
2436 | |
2493 | |
2437 | glColor3ub (0, 0, 0); |
2494 | glColor3ub (0, 0, 0); |
2438 | glRectf (px + 1, py - thick - 2, |
2495 | glRectf (px + 1, py - thick - 2, |
2439 | px + width - 1, py); |
2496 | px + width - 1, py); |
2440 | |
2497 | |
… | |
… | |
2520 | int x, y; |
2577 | int x, y; |
2521 | int sw1 = sw + 2; |
2578 | int sw1 = sw + 2; |
2522 | int sh1 = sh + 2; |
2579 | int sh1 = sh + 2; |
2523 | int sh3 = sh * 3; |
2580 | int sh3 = sh * 3; |
2524 | int sw3 = sw * 3; |
2581 | int sw3 = sw * 3; |
2525 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2526 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2582 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2527 | 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); |
2528 | |
2586 | |
2529 | SvPOK_only (darkness3_sv); |
2587 | SvPOK_only (darkness3_sv); |
2530 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2588 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2531 | |
2589 | |
2532 | mx += self->x - 1; |
2590 | mx += self->x - 1; |
… | |
… | |
2793 | if (RETVAL < 0) |
2851 | if (RETVAL < 0) |
2794 | { |
2852 | { |
2795 | RETVAL = Mix_GroupOldest (-1); |
2853 | RETVAL = Mix_GroupOldest (-1); |
2796 | |
2854 | |
2797 | 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) |
2798 | XSRETURN_UNDEF; |
2861 | XSRETURN_UNDEF; |
2799 | |
2862 | } |
|
|
2863 | else |
2800 | Mix_HaltChannel (RETVAL); |
2864 | Mix_HaltChannel (RETVAL); |
2801 | } |
2865 | } |
2802 | |
2866 | |
2803 | Mix_UnregisterAllEffects (RETVAL); |
2867 | Mix_UnregisterAllEffects (RETVAL); |
2804 | Mix_Volume (RETVAL, 128); |
2868 | Mix_Volume (RETVAL, 128); |
2805 | } |
2869 | } |
… | |
… | |
2864 | Mix_SetReverseStereo (self, flip); |
2928 | Mix_SetReverseStereo (self, flip); |
2865 | |
2929 | |
2866 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2930 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2867 | |
2931 | |
2868 | 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 |
2869 | |
2945 | |
2870 | DC::MixChunk |
2946 | DC::MixChunk |
2871 | new (SV *class, DC::RW rwops) |
2947 | new (SV *class, DC::RW rwops) |
2872 | CODE: |
2948 | CODE: |
2873 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2949 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
… | |
… | |
2906 | OUTPUT: |
2982 | OUTPUT: |
2907 | RETVAL |
2983 | RETVAL |
2908 | |
2984 | |
2909 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2985 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2910 | |
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 | |
2911 | int |
2999 | int |
2912 | volume (int volume = -1) |
3000 | volume (int volume = -1) |
2913 | PROTOTYPE: ;$ |
3001 | PROTOTYPE: ;$ |
2914 | CODE: |
3002 | CODE: |
2915 | if (items > 0) |
3003 | if (items > 0) |
… | |
… | |
2925 | |
3013 | |
2926 | void |
3014 | void |
2927 | halt () |
3015 | halt () |
2928 | CODE: |
3016 | CODE: |
2929 | Mix_HaltMusic (); |
3017 | Mix_HaltMusic (); |
|
|
3018 | |
|
|
3019 | int |
|
|
3020 | playing () |
|
|
3021 | CODE: |
|
|
3022 | RETVAL = Mix_PlayingMusic (); |
|
|
3023 | OUTPUT: |
|
|
3024 | RETVAL |
2930 | |
3025 | |
2931 | DC::MixMusic |
3026 | DC::MixMusic |
2932 | new (SV *class, DC::RW rwops) |
3027 | new (SV *class, DC::RW rwops) |
2933 | CODE: |
3028 | CODE: |
2934 | RETVAL = Mix_LoadMUS_RW (rwops); |
3029 | RETVAL = Mix_LoadMUS_RW (rwops); |
… | |
… | |
3074 | const_iv (GL_FUNC_SUBTRACT), |
3169 | const_iv (GL_FUNC_SUBTRACT), |
3075 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3170 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3076 | # undef const_iv |
3171 | # undef const_iv |
3077 | }; |
3172 | }; |
3078 | |
3173 | |
3079 | 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--) |
3080 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
3175 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
3081 | |
3176 | |
3082 | texture_av = newAV (); |
3177 | texture_av = newAV (); |
3083 | AvREAL_off (texture_av); |
3178 | AvREAL_off (texture_av); |
3084 | } |
3179 | } |
3085 | |
3180 | |
… | |
… | |
3128 | RETVAL |
3223 | RETVAL |
3129 | |
3224 | |
3130 | int glGetError () |
3225 | int glGetError () |
3131 | |
3226 | |
3132 | void glFinish () |
3227 | void glFinish () |
|
|
3228 | |
|
|
3229 | void glFlush () |
3133 | |
3230 | |
3134 | void glClear (int mask) |
3231 | void glClear (int mask) |
3135 | |
3232 | |
3136 | 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) |
3137 | PROTOTYPE: @ |
3234 | PROTOTYPE: @ |