… | |
… | |
48 | #endif |
48 | #endif |
49 | |
49 | |
50 | #define PANGO_ENABLE_BACKEND |
50 | #define PANGO_ENABLE_BACKEND |
51 | #define G_DISABLE_CAST_CHECKS |
51 | #define G_DISABLE_CAST_CHECKS |
52 | |
52 | |
53 | #include <glib/gmacros.h> |
53 | #include <glib.h> |
54 | |
54 | |
55 | #include <pango/pango.h> |
55 | #include <pango/pango.h> |
56 | |
56 | |
57 | #ifndef PANGO_VERSION_CHECK |
57 | #ifndef PANGO_VERSION_CHECK |
58 | # define PANGO_VERSION_CHECK(a,b,c) 0 |
58 | # define PANGO_VERSION_CHECK(a,b,c) 0 |
… | |
… | |
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 | |
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 | } |
|
|
123 | |
105 | static AV *texture_av; |
124 | static AV *texture_av; |
106 | |
125 | |
107 | static struct |
126 | static struct |
108 | { |
127 | { |
109 | #define GL_FUNC(ptr,name) ptr name; |
128 | #define GL_FUNC(ptr,name) ptr name; |
… | |
… | |
165 | { |
184 | { |
166 | GSList *attrs = run->item->analysis.extra_attrs; |
185 | GSList *attrs = run->item->analysis.extra_attrs; |
167 | |
186 | |
168 | while (attrs) |
187 | while (attrs) |
169 | { |
188 | { |
170 | PangoAttribute *attr = attrs->data; |
189 | PangoAttribute *attr = (PangoAttribute *)attrs->data; |
171 | |
190 | |
172 | if (attr->klass->type == PANGO_ATTR_SHAPE) |
191 | if (attr->klass->type == PANGO_ATTR_SHAPE) |
173 | return 1; |
192 | return 1; |
174 | |
193 | |
175 | attrs = attrs->next; |
194 | attrs = attrs->next; |
… | |
… | |
193 | static void |
212 | static void |
194 | substitute_func (FcPattern *pattern, gpointer data) |
213 | substitute_func (FcPattern *pattern, gpointer data) |
195 | { |
214 | { |
196 | FcPatternAddBool (pattern, FC_HINTING, 1); |
215 | FcPatternAddBool (pattern, FC_HINTING, 1); |
197 | #ifdef FC_HINT_STYLE |
216 | #ifdef FC_HINT_STYLE |
198 | FcPatternAddBool (pattern, FC_HINT_STYLE, FC_HINT_FULL); |
217 | FcPatternAddInteger (pattern, FC_HINT_STYLE, FC_HINT_FULL); |
199 | #endif |
218 | #endif |
200 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
219 | FcPatternAddBool (pattern, FC_AUTOHINT, 0); |
201 | } |
220 | } |
202 | |
221 | |
203 | static void |
222 | static void |
… | |
… | |
462 | ev.data2 = 0; |
481 | ev.data2 = 0; |
463 | |
482 | |
464 | SDL_PushEvent ((SDL_Event *)&ev); |
483 | SDL_PushEvent ((SDL_Event *)&ev); |
465 | } |
484 | } |
466 | |
485 | |
|
|
486 | // approximately divide by 255 |
|
|
487 | static unsigned int |
|
|
488 | div255 (unsigned int n) |
|
|
489 | { |
|
|
490 | return (n + (n >> 8)) >> 8; |
|
|
491 | } |
|
|
492 | |
467 | static unsigned int |
493 | static unsigned int |
468 | minpot (unsigned int n) |
494 | minpot (unsigned int n) |
469 | { |
495 | { |
470 | if (!n) |
496 | if (!n) |
471 | return 0; |
497 | return 0; |
… | |
… | |
552 | |
578 | |
553 | return mod; |
579 | return mod; |
554 | } |
580 | } |
555 | |
581 | |
556 | static void |
582 | static void |
557 | deliantra_main () |
583 | deliantra_main (SV *real_main) |
558 | { |
584 | { |
559 | char *argv[] = { 0 }; |
585 | dSP; |
560 | call_argv ("::main", G_DISCARD | G_VOID, argv); |
586 | |
|
|
587 | PUSHMARK (SP); |
|
|
588 | call_sv (real_main, G_DISCARD | G_VOID); |
561 | } |
589 | } |
562 | |
590 | |
563 | #ifdef __MACOSX__ |
591 | #ifdef __MACOSX__ |
|
|
592 | static SV *real_main; |
|
|
593 | |
564 | /* to due surprising braindamage on the side of SDL design, we |
594 | /* to due surprising braindamage on the side of SDL design, we |
565 | * do some mind-boggling hack here: SDL requires a custom main() |
595 | * 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, |
596 | * 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, |
597 | * due to shared library magic, calls -lSDLmain's main, not perl's main, |
568 | * and which calls our main (== SDL_main) back. |
598 | * and which calls our main (== SDL_main) back. |
569 | */ |
599 | */ |
570 | extern C_LINKAGE int |
600 | extern C_LINKAGE int |
571 | main (int argc, char *argv[]) |
601 | main (int argc, char *argv[]) |
572 | { |
602 | { |
573 | deliantra_main (); |
603 | deliantra_main (real_main); |
574 | } |
604 | } |
575 | |
605 | |
576 | #undef main |
606 | #undef main |
577 | |
607 | |
578 | extern C_LINKAGE int main (int argc, char *argv[]); |
608 | extern C_LINKAGE int main (int argc, char *argv[]); |
579 | |
609 | |
580 | static void |
610 | static void |
581 | SDL_braino (void) |
611 | SDL_main_hack (SV *real_main_) |
582 | { |
612 | { |
|
|
613 | real_main = real_main_; |
|
|
614 | |
583 | char *argv[] = { "deliantra client", 0 }; |
615 | char *argv[] = { "deliantra client", 0 }; |
584 | (main) (1, argv); |
616 | (main) (1, argv); |
585 | } |
617 | } |
586 | #else |
618 | #else |
587 | static void |
619 | static void |
588 | SDL_braino (void) |
620 | SDL_main_hack (SV *real_main) |
589 | { |
621 | { |
590 | deliantra_main (); |
622 | deliantra_main (real_main); |
591 | } |
623 | } |
592 | #endif |
624 | #endif |
593 | |
625 | |
594 | MODULE = Deliantra::Client PACKAGE = DC |
626 | MODULE = Deliantra::Client PACKAGE = DC |
595 | |
627 | |
… | |
… | |
796 | |
828 | |
797 | const_iv (FOW_DARKNESS) |
829 | const_iv (FOW_DARKNESS) |
798 | # undef const_iv |
830 | # undef const_iv |
799 | }; |
831 | }; |
800 | |
832 | |
801 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
833 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
802 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
834 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
803 | |
835 | |
804 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
836 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
805 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
837 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
806 | } |
838 | } |
807 | |
839 | |
… | |
… | |
846 | #endif |
878 | #endif |
847 | } |
879 | } |
848 | |
880 | |
849 | char *SDL_GetError () |
881 | char *SDL_GetError () |
850 | |
882 | |
851 | void SDL_braino () |
883 | void SDL_main_hack (SV *real_main) |
|
|
884 | PROTOTYPE: & |
852 | |
885 | |
853 | int SDL_Init (U32 flags) |
886 | int SDL_Init (U32 flags) |
854 | |
887 | |
855 | int SDL_InitSubSystem (U32 flags) |
888 | int SDL_InitSubSystem (U32 flags) |
856 | |
889 | |
857 | void SDL_QuitSubSystem (U32 flags) |
890 | void SDL_QuitSubSystem (U32 flags) |
858 | |
891 | |
859 | void SDL_Quit () |
892 | void SDL_Quit () |
860 | |
893 | |
861 | int SDL_GL_SetAttribute (int attr, int value) |
894 | int SDL_GL_SetAttribute (int attr, int value) |
|
|
895 | C_ARGS: (SDL_GLattr)attr, value |
862 | |
896 | |
863 | int SDL_GL_GetAttribute (int attr) |
897 | int SDL_GL_GetAttribute (int attr) |
864 | CODE: |
898 | CODE: |
865 | if (SDL_GL_GetAttribute (attr, &RETVAL)) |
899 | if (SDL_GL_GetAttribute ((SDL_GLattr)attr, &RETVAL)) |
866 | XSRETURN_UNDEF; |
900 | XSRETURN_UNDEF; |
867 | OUTPUT: |
901 | OUTPUT: |
868 | RETVAL |
902 | RETVAL |
869 | |
903 | |
870 | void |
904 | void |
… | |
… | |
925 | ); |
959 | ); |
926 | |
960 | |
927 | if (RETVAL) |
961 | if (RETVAL) |
928 | { |
962 | { |
929 | av_clear (texture_av); |
963 | 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); |
964 | #define GL_FUNC(ptr,name) gl.name = (ptr)SDL_GL_GetProcAddress ("gl" # name); |
933 | #include "glfunc.h" |
965 | #include "glfunc.h" |
934 | #undef GL_FUNC |
966 | #undef GL_FUNC |
935 | |
|
|
936 | if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB; |
967 | if (!gl.ActiveTexture ) gl.ActiveTexture = gl.ActiveTextureARB; |
937 | if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB; |
968 | if (!gl.MultiTexCoord2f) gl.MultiTexCoord2f = gl.MultiTexCoord2fARB; |
938 | } |
969 | } |
939 | } |
970 | } |
940 | OUTPUT: |
971 | OUTPUT: |
941 | RETVAL |
972 | RETVAL |
942 | |
973 | |
943 | void |
974 | void |
|
|
975 | SDL_WM_SetCaption (const char *title, const char *icon) |
|
|
976 | |
|
|
977 | void |
944 | SDL_GL_SwapBuffers () |
978 | SDL_GL_SwapBuffers () |
945 | |
979 | |
946 | char * |
980 | char * |
947 | SDL_GetKeyName (int sym) |
981 | SDL_GetKeyName (int sym) |
|
|
982 | C_ARGS: (SDLKey)sym |
948 | |
983 | |
949 | int |
984 | int |
950 | SDL_GetAppState () |
985 | SDL_GetAppState () |
951 | |
986 | |
952 | int |
987 | int |
953 | SDL_GetModState () |
988 | SDL_GetModState () |
954 | |
989 | |
|
|
990 | int |
|
|
991 | SDL_WaitEvent () |
|
|
992 | C_ARGS: 0 |
|
|
993 | |
955 | void |
994 | void |
|
|
995 | SDL_PumpEvents () |
|
|
996 | |
|
|
997 | void |
956 | poll_events () |
998 | peep_events () |
957 | PPCODE: |
999 | PPCODE: |
958 | { |
1000 | { |
959 | SDL_Event ev; |
1001 | SDL_Event ev; |
960 | |
1002 | |
961 | SDL_PumpEvents (); |
1003 | SDL_PumpEvents (); |
… | |
… | |
1027 | |
1069 | |
1028 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1070 | XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); |
1029 | } |
1071 | } |
1030 | } |
1072 | } |
1031 | |
1073 | |
|
|
1074 | char * |
|
|
1075 | SDL_AudioDriverName () |
|
|
1076 | CODE: |
|
|
1077 | { |
|
|
1078 | char buf [256]; |
|
|
1079 | if (!SDL_AudioDriverName (buf, sizeof (buf))) |
|
|
1080 | XSRETURN_UNDEF; |
|
|
1081 | |
|
|
1082 | RETVAL = buf; |
|
|
1083 | } |
|
|
1084 | OUTPUT: |
|
|
1085 | RETVAL |
|
|
1086 | |
1032 | int |
1087 | int |
1033 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1088 | Mix_OpenAudio (int frequency = 44100, int format = MIX_DEFAULT_FORMAT, int channels = 2, int chunksize = 4096) |
1034 | POSTCALL: |
1089 | POSTCALL: |
1035 | Mix_HookMusicFinished (music_finished); |
1090 | Mix_HookMusicFinished (music_finished); |
1036 | Mix_ChannelFinished (channel_finished); |
1091 | Mix_ChannelFinished (channel_finished); |
1037 | |
1092 | |
1038 | void |
1093 | void |
1039 | Mix_QuerySpec () |
1094 | Mix_QuerySpec () |
… | |
… | |
1098 | add_font (char *file) |
1153 | add_font (char *file) |
1099 | CODE: |
1154 | CODE: |
1100 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1155 | RETVAL = FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
1101 | OUTPUT: |
1156 | OUTPUT: |
1102 | RETVAL |
1157 | RETVAL |
|
|
1158 | |
|
|
1159 | void |
|
|
1160 | IMG_Init (int flags = IMG_INIT_JPG | IMG_INIT_PNG) |
|
|
1161 | |
|
|
1162 | # MIX_INIT_MP3 gives smpeg + libstdc++ + libgcc_s |
|
|
1163 | void |
|
|
1164 | Mix_Init (int flags = MIX_INIT_MOD | MIX_INIT_OGG) |
1103 | |
1165 | |
1104 | void |
1166 | void |
1105 | load_image_inline (SV *image_) |
1167 | load_image_inline (SV *image_) |
1106 | ALIAS: |
1168 | ALIAS: |
1107 | load_image_file = 1 |
1169 | load_image_file = 1 |
… | |
… | |
1153 | |
1215 | |
1154 | SDL_LockSurface (surface2); |
1216 | SDL_LockSurface (surface2); |
1155 | EXTEND (SP, 6); |
1217 | EXTEND (SP, 6); |
1156 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
1218 | PUSHs (sv_2mortal (newSViv (surface2->w))); |
1157 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
1219 | PUSHs (sv_2mortal (newSViv (surface2->h))); |
1158 | PUSHs (sv_2mortal (newSVpvn (surface2->pixels, surface2->h * surface2->pitch))); |
1220 | PUSHs (sv_2mortal (newSVpvn ((const char *)surface2->pixels, surface2->h * surface2->pitch))); |
1159 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
1221 | PUSHs (sv_2mortal (newSViv (surface->flags & (SDL_SRCCOLORKEY | SDL_SRCALPHA) ? GL_RGBA : GL_RGB))); |
1160 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
1222 | PUSHs (sv_2mortal (newSViv (GL_RGBA))); |
1161 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
1223 | PUSHs (sv_2mortal (newSViv (GL_UNSIGNED_BYTE))); |
1162 | SDL_UnlockSurface (surface2); |
1224 | SDL_UnlockSurface (surface2); |
1163 | |
1225 | |
… | |
… | |
1235 | MODULE = Deliantra::Client PACKAGE = DC::Font |
1297 | MODULE = Deliantra::Client PACKAGE = DC::Font |
1236 | |
1298 | |
1237 | PROTOTYPES: DISABLE |
1299 | PROTOTYPES: DISABLE |
1238 | |
1300 | |
1239 | DC::Font |
1301 | DC::Font |
1240 | new_from_file (SV *class, char *path, int id = 0) |
1302 | new_from_file (SV *klass, char *path, int id = 0) |
1241 | CODE: |
1303 | CODE: |
1242 | { |
1304 | { |
1243 | int count; |
1305 | int count; |
1244 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
1306 | FcPattern *pattern = FcFreeTypeQuery ((const FcChar8 *)path, id, 0, &count); |
1245 | RETVAL = pango_fc_font_description_from_pattern (pattern, 0); |
1307 | RETVAL = pango_fc_font_description_from_pattern (pattern, 0); |
… | |
… | |
1274 | PROTOTYPE: |
1336 | PROTOTYPE: |
1275 | CODE: |
1337 | CODE: |
1276 | tc_restore (); |
1338 | tc_restore (); |
1277 | |
1339 | |
1278 | DC::Layout |
1340 | DC::Layout |
1279 | new (SV *class) |
1341 | new (SV *klass) |
1280 | CODE: |
1342 | CODE: |
1281 | New (0, RETVAL, 1, struct cf_layout); |
1343 | New (0, RETVAL, 1, struct cf_layout); |
1282 | |
1344 | |
1283 | RETVAL->pl = pango_layout_new (opengl_context); |
1345 | RETVAL->pl = pango_layout_new (opengl_context); |
1284 | RETVAL->r = 1.; |
1346 | RETVAL->r = 1.; |
… | |
… | |
1433 | |
1495 | |
1434 | void |
1496 | void |
1435 | set_height (DC::Layout self, int base_height) |
1497 | set_height (DC::Layout self, int base_height) |
1436 | CODE: |
1498 | CODE: |
1437 | if (self->base_height != base_height) |
1499 | if (self->base_height != base_height) |
1438 | { |
1500 | { |
1439 | self->base_height = base_height; |
1501 | self->base_height = base_height; |
1440 | layout_update_font (self); |
1502 | layout_update_font (self); |
1441 | } |
1503 | } |
1442 | |
1504 | |
1443 | void |
1505 | void |
… | |
… | |
1807 | MODULE = Deliantra::Client PACKAGE = DC::Map |
1869 | MODULE = Deliantra::Client PACKAGE = DC::Map |
1808 | |
1870 | |
1809 | PROTOTYPES: DISABLE |
1871 | PROTOTYPES: DISABLE |
1810 | |
1872 | |
1811 | DC::Map |
1873 | DC::Map |
1812 | new (SV *class) |
1874 | new (SV *klass) |
1813 | CODE: |
1875 | CODE: |
1814 | New (0, RETVAL, 1, struct map); |
1876 | New (0, RETVAL, 1, struct map); |
1815 | RETVAL->x = 0; |
1877 | RETVAL->x = 0; |
1816 | RETVAL->y = 0; |
1878 | RETVAL->y = 0; |
1817 | RETVAL->w = 0; |
1879 | RETVAL->w = 0; |
… | |
… | |
1856 | |
1918 | |
1857 | void |
1919 | void |
1858 | set_smooth (DC::Map self, int face, int smooth, int level) |
1920 | set_smooth (DC::Map self, int face, int smooth, int level) |
1859 | CODE: |
1921 | CODE: |
1860 | { |
1922 | { |
1861 | tileid texid; |
1923 | tileid texid; |
1862 | maptex *tex; |
1924 | maptex *tex; |
1863 | |
1925 | |
1864 | if (face < 0 || face >= self->faces) |
1926 | if (face < 0 || face >= self->faces) |
1865 | return; |
1927 | return; |
1866 | |
1928 | |
1867 | if (smooth < 0 || smooth >= self->faces) |
1929 | if (smooth < 0 || smooth >= self->faces) |
1868 | return; |
1930 | return; |
1869 | |
1931 | |
1870 | texid = self->face2tile [face]; |
1932 | texid = self->face2tile [face]; |
1871 | |
1933 | |
1872 | if (!texid) |
1934 | if (!texid) |
1873 | return; |
1935 | return; |
1874 | |
1936 | |
1875 | tex = self->tex + texid; |
1937 | tex = self->tex + texid; |
… | |
… | |
1908 | } |
1970 | } |
1909 | |
1971 | |
1910 | void |
1972 | void |
1911 | expire_textures (DC::Map self, int texid, int count) |
1973 | expire_textures (DC::Map self, int texid, int count) |
1912 | PPCODE: |
1974 | PPCODE: |
1913 | for (; texid < self->texs && count; ++texid, --count) |
1975 | for (; texid < self->texs && count; ++texid, --count) |
1914 | { |
1976 | { |
1915 | maptex *tex = self->tex + texid; |
1977 | maptex *tex = self->tex + texid; |
1916 | |
1978 | |
1917 | if (tex->name) |
1979 | if (tex->name) |
1918 | { |
1980 | { |
… | |
… | |
1973 | self->y += MAP_EXTEND_Y; |
2035 | self->y += MAP_EXTEND_Y; |
1974 | } |
2036 | } |
1975 | } |
2037 | } |
1976 | |
2038 | |
1977 | SV * |
2039 | SV * |
1978 | map1a_update (DC::Map self, SV *data_, int extmap) |
2040 | map1a_update (DC::Map self, SV *data_) |
1979 | CODE: |
2041 | CODE: |
1980 | { |
2042 | { |
1981 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
2043 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
1982 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
2044 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
1983 | mapcell *cell; |
2045 | mapcell *cell; |
… | |
… | |
2004 | |
2066 | |
2005 | //TODO: don't trust server data to be in-range(!) |
2067 | //TODO: don't trust server data to be in-range(!) |
2006 | |
2068 | |
2007 | if (flags & 8) |
2069 | if (flags & 8) |
2008 | { |
2070 | { |
|
|
2071 | uint8_t ext, cmd; |
|
|
2072 | |
2009 | if (extmap) |
2073 | do |
2010 | { |
2074 | { |
2011 | uint8_t ext, cmd; |
2075 | ext = *data++; |
|
|
2076 | cmd = ext & 0x7f; |
2012 | |
2077 | |
2013 | do |
2078 | if (cmd < 4) |
|
|
2079 | cell->darkness = 255 - ext * 64 + 1; /* make sure this doesn't collide with FOW_DARKNESS */ |
|
|
2080 | else if (cmd == 5) // health |
2014 | { |
2081 | { |
2015 | ext = *data++; |
|
|
2016 | cmd = ext & 0x7f; |
|
|
2017 | |
|
|
2018 | if (cmd < 4) |
|
|
2019 | cell->darkness = 255 - ext * 64 + 1; /* make sure this doesn't collide with FOW_DARKNESS */ |
|
|
2020 | else if (cmd == 5) // health |
|
|
2021 | { |
|
|
2022 | cell->stat_width = 1; |
2082 | cell->stat_width = 1; |
2023 | cell->stat_hp = *data++; |
2083 | cell->stat_hp = *data++; |
2024 | } |
|
|
2025 | else if (cmd == 6) // monster width |
|
|
2026 | cell->stat_width = *data++ + 1; |
|
|
2027 | else if (cmd == 0x47) |
|
|
2028 | { |
|
|
2029 | if (*data == 1) cell->player = data [1]; |
|
|
2030 | else if (*data == 2) cell->player = data [2] + (data [1] << 8); |
|
|
2031 | else if (*data == 3) cell->player = data [3] + (data [2] << 8) + (data [1] << 16); |
|
|
2032 | else if (*data == 4) cell->player = data [4] + (data [3] << 8) + (data [2] << 16) + (data [1] << 24); |
|
|
2033 | |
|
|
2034 | data += *data + 1; |
|
|
2035 | } |
|
|
2036 | else if (cmd == 8) // cell flags |
|
|
2037 | cell->flags = *data++; |
|
|
2038 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
2039 | data += *data + 1; |
|
|
2040 | else |
|
|
2041 | data++; |
|
|
2042 | } |
2084 | } |
2043 | while (ext & 0x80); |
2085 | else if (cmd == 6) // monster width |
|
|
2086 | cell->stat_width = *data++ + 1; |
|
|
2087 | else if (cmd == 0x47) |
|
|
2088 | { |
|
|
2089 | if (*data == 1) cell->player = data [1]; |
|
|
2090 | else if (*data == 2) cell->player = data [2] + (data [1] << 8); |
|
|
2091 | else if (*data == 3) cell->player = data [3] + (data [2] << 8) + (data [1] << 16); |
|
|
2092 | else if (*data == 4) cell->player = data [4] + (data [3] << 8) + (data [2] << 16) + (data [1] << 24); |
|
|
2093 | |
|
|
2094 | data += *data + 1; |
|
|
2095 | } |
|
|
2096 | else if (cmd == 8) // cell flags |
|
|
2097 | cell->flags = *data++; |
|
|
2098 | else if (ext & 0x40) // unknown, multibyte => skip |
|
|
2099 | data += *data + 1; |
|
|
2100 | else |
|
|
2101 | data++; |
2044 | } |
2102 | } |
2045 | else |
2103 | while (ext & 0x80); |
2046 | cell->darkness = *data++ + 1; |
|
|
2047 | } |
2104 | } |
2048 | |
2105 | |
2049 | for (z = 0; z <= 2; ++z) |
2106 | for (z = 0; z <= 2; ++z) |
2050 | if (flags & (4 >> z)) |
2107 | if (flags & (4 >> z)) |
2051 | { |
2108 | { |
… | |
… | |
2099 | ? self->row + y |
2156 | ? self->row + y |
2100 | : 0; |
2157 | : 0; |
2101 | |
2158 | |
2102 | for (x = x0; x < x1; x++) |
2159 | for (x = x0; x < x1; x++) |
2103 | { |
2160 | { |
2104 | int r = 32, g = 32, b = 32, a = 192; |
2161 | unsigned int r = 32, g = 32, b = 32, a = 192; |
2105 | |
2162 | |
2106 | if (row && row->c0 <= x && x < row->c1) |
2163 | if (row && row->c0 <= x && x < row->c1) |
2107 | { |
2164 | { |
2108 | mapcell *cell = row->col + (x - row->c0); |
2165 | mapcell *cell = row->col + (x - row->c0); |
2109 | |
2166 | |
… | |
… | |
2111 | { |
2168 | { |
2112 | maptex tex = self->tex [cell->tile [z]]; |
2169 | maptex tex = self->tex [cell->tile [z]]; |
2113 | int a0 = 255 - tex.a; |
2170 | int a0 = 255 - tex.a; |
2114 | int a1 = tex.a; |
2171 | int a1 = tex.a; |
2115 | |
2172 | |
2116 | r = (r * a0 + tex.r * a1) / 255; |
2173 | r = div255 (r * a0 + tex.r * a1); |
2117 | g = (g * a0 + tex.g * a1) / 255; |
2174 | g = div255 (g * a0 + tex.g * a1); |
2118 | b = (b * a0 + tex.b * a1) / 255; |
2175 | b = div255 (b * a0 + tex.b * a1); |
2119 | a = (a * a0 + tex.a * a1) / 255; |
2176 | a = div255 (a * a0 + tex.a * a1); |
2120 | } |
2177 | } |
2121 | } |
2178 | } |
2122 | |
2179 | |
2123 | *map++ = (r ) |
2180 | *map++ = (r ) |
2124 | | (g << 8) |
2181 | | (g << 8) |
2125 | | (b << 16) |
2182 | | (b << 16) |
2126 | | (a << 24); |
2183 | | (a << 24); |
2127 | } |
2184 | } |
2128 | } |
2185 | } |
2129 | |
2186 | |
2130 | RETVAL = map_sv; |
2187 | RETVAL = map_sv; |
2131 | } |
2188 | } |
2132 | OUTPUT: |
2189 | OUTPUT: |
2133 | RETVAL |
2190 | RETVAL |
2134 | |
2191 | |
2135 | void |
2192 | void |
2136 | draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int sdx = 0, int sdy = 0) |
2193 | 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) |
2137 | CODE: |
2194 | CODE: |
2138 | { |
2195 | { |
2139 | int x, y, z; |
2196 | int x, y, z; |
2140 | |
2197 | |
2141 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
2198 | HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); |
2142 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2199 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2143 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2200 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2144 | smooth_key skey; |
2201 | smooth_key skey; |
2145 | int pl_x, pl_y; |
2202 | int pl_x, pl_y; |
2146 | maptex pl_tex; |
2203 | maptex pl_tex; |
… | |
… | |
2225 | |
2282 | |
2226 | key.texname = tex.name; |
2283 | key.texname = tex.name; |
2227 | arr = rc_array (rc, &key); |
2284 | arr = rc_array (rc, &key); |
2228 | } |
2285 | } |
2229 | |
2286 | |
2230 | px = (x + 1) * T - tex.w; |
2287 | px = (x + 1) * Th - tex.w; |
2231 | py = (y + 1) * T - tex.h; |
2288 | py = (y + 1) * Tw - tex.h; |
2232 | |
2289 | |
2233 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2290 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2234 | { |
2291 | { |
2235 | pl_x = px; |
2292 | pl_x = px; |
2236 | pl_y = py; |
2293 | pl_y = py; |
… | |
… | |
2289 | if (cell->flags & 1) |
2346 | if (cell->flags & 1) |
2290 | { |
2347 | { |
2291 | rc_key_t key_ov = key; |
2348 | rc_key_t key_ov = key; |
2292 | maptex tex = self->tex [TEXID_SPEECH]; |
2349 | maptex tex = self->tex [TEXID_SPEECH]; |
2293 | rc_array_t *arr; |
2350 | rc_array_t *arr; |
2294 | int px = x * T + T * 2 / 32; |
2351 | int px = x * Tw + Tw * 2 / 32; |
2295 | int py = y * T - T * 6 / 32; |
2352 | int py = y * Th - Th * 6 / 32; |
2296 | |
2353 | |
2297 | key_ov.texname = tex.name; |
2354 | key_ov.texname = tex.name; |
2298 | arr = rc_array (rc_ov, &key_ov); |
2355 | arr = rc_array (rc_ov, &key_ov); |
2299 | |
2356 | |
2300 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2357 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2301 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
2358 | rc_t2f_v3f (arr, 0 , tex.t, px , py + Th, 0); |
2302 | rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); |
2359 | rc_t2f_v3f (arr, tex.s, tex.t, px + Tw, py + Th, 0); |
2303 | rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); |
2360 | rc_t2f_v3f (arr, tex.s, 0 , px + Tw, py , 0); |
2304 | } |
2361 | } |
2305 | } |
2362 | } |
2306 | } |
2363 | } |
2307 | } |
2364 | } |
2308 | |
2365 | |
… | |
… | |
2335 | if (!(bits & 0x1000) |
2392 | if (!(bits & 0x1000) |
2336 | && skey->level == level |
2393 | && skey->level == level |
2337 | && level > smooth_max [skey->x][skey->y]) |
2394 | && level > smooth_max [skey->x][skey->y]) |
2338 | { |
2395 | { |
2339 | maptex tex = self->tex [skey->tile]; |
2396 | maptex tex = self->tex [skey->tile]; |
2340 | int px = (((int)skey->x) - 1) * T; |
2397 | int px = (((int)skey->x) - 1) * Tw; |
2341 | int py = (((int)skey->y) - 1) * T; |
2398 | int py = (((int)skey->y) - 1) * Th; |
2342 | int border = bits & 15; |
2399 | int border = bits & 15; |
2343 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2400 | int corner = (bits >> 8) & ~(bits >> 4) & 15; |
2344 | float dx = tex.s * .0625f; // 16 images/row |
2401 | float dx = tex.s * .0625f; // 16 images/row |
2345 | float dy = tex.t * .5f ; // 2 images/column |
2402 | float dy = tex.t * .5f ; // 2 images/column |
2346 | |
2403 | |
… | |
… | |
2359 | |
2416 | |
2360 | if (border) |
2417 | if (border) |
2361 | { |
2418 | { |
2362 | float ox = border * dx; |
2419 | float ox = border * dx; |
2363 | |
2420 | |
2364 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2421 | glTexCoord2f (ox , 0.f ); glVertex2i (px , py ); |
2365 | glTexCoord2f (ox , dy ); glVertex2i (px , py + T); |
2422 | glTexCoord2f (ox , dy ); glVertex2i (px , py + Th); |
2366 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py + T); |
2423 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py + Th); |
2367 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + T, py ); |
2424 | glTexCoord2f (ox + dx, 0.f ); glVertex2i (px + Tw, py ); |
2368 | } |
2425 | } |
2369 | |
2426 | |
2370 | if (corner) |
2427 | if (corner) |
2371 | { |
2428 | { |
2372 | float ox = corner * dx; |
2429 | float ox = corner * dx; |
2373 | |
2430 | |
2374 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2431 | glTexCoord2f (ox , dy ); glVertex2i (px , py ); |
2375 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + T); |
2432 | glTexCoord2f (ox , dy * 2.f); glVertex2i (px , py + Th); |
2376 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + T, py + T); |
2433 | glTexCoord2f (ox + dx, dy * 2.f); glVertex2i (px + Tw, py + Th); |
2377 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + T, py ); |
2434 | glTexCoord2f (ox + dx, dy ); glVertex2i (px + Tw, py ); |
2378 | } |
2435 | } |
2379 | } |
2436 | } |
2380 | } |
2437 | } |
2381 | } |
2438 | } |
2382 | } |
2439 | } |
… | |
… | |
2423 | for (x = 0; x < sw; x++) |
2480 | for (x = 0; x < sw; x++) |
2424 | if (row->c0 <= x + mx && x + mx < row->c1) |
2481 | if (row->c0 <= x + mx && x + mx < row->c1) |
2425 | { |
2482 | { |
2426 | mapcell *cell = row->col + (x + mx - row->c0); |
2483 | mapcell *cell = row->col + (x + mx - row->c0); |
2427 | |
2484 | |
2428 | int px = x * T; |
2485 | int px = x * Tw; |
2429 | int py = y * T; |
2486 | int py = y * Th; |
2430 | |
2487 | |
2431 | if (expect_false (cell->player == player)) |
2488 | if (expect_false (cell->player == player)) |
2432 | { |
2489 | { |
2433 | px += sdx; |
2490 | px += sdx; |
2434 | py += sdy; |
2491 | py += sdy; |
2435 | } |
2492 | } |
2436 | |
2493 | |
2437 | if (cell->stat_hp) |
2494 | if (cell->stat_hp) |
2438 | { |
2495 | { |
2439 | int width = cell->stat_width * T; |
2496 | int width = cell->stat_width * Tw; |
2440 | int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; |
2497 | int thick = (sh * Th / 32 + 27) / 28 + 1 + cell->stat_width; |
2441 | |
2498 | |
2442 | glColor3ub (0, 0, 0); |
2499 | glColor3ub (0, 0, 0); |
2443 | glRectf (px + 1, py - thick - 2, |
2500 | glRectf (px + 1, py - thick - 2, |
2444 | px + width - 1, py); |
2501 | px + width - 1, py); |
2445 | |
2502 | |
… | |
… | |
2525 | int x, y; |
2582 | int x, y; |
2526 | int sw1 = sw + 2; |
2583 | int sw1 = sw + 2; |
2527 | int sh1 = sh + 2; |
2584 | int sh1 = sh + 2; |
2528 | int sh3 = sh * 3; |
2585 | int sh3 = sh * 3; |
2529 | int sw3 = sw * 3; |
2586 | int sw3 = sw * 3; |
2530 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2531 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2587 | SV *darkness3_sv = sv_2mortal (newSV (sw3 * sh3)); |
2532 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
2588 | uint8_t *darkness3 = (uint8_t *)SvPVX (darkness3_sv); |
|
|
2589 | uint8_t *darkness1 = (uint8_t *)malloc (sw1 * sh1); |
|
|
2590 | memset (darkness1, 0, sw1*sh1); |
2533 | |
2591 | |
2534 | SvPOK_only (darkness3_sv); |
2592 | SvPOK_only (darkness3_sv); |
2535 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2593 | SvCUR_set (darkness3_sv, sw3 * sh3); |
2536 | |
2594 | |
2537 | mx += self->x - 1; |
2595 | mx += self->x - 1; |
… | |
… | |
2663 | else |
2721 | else |
2664 | *data++ = 0; |
2722 | *data++ = 0; |
2665 | } |
2723 | } |
2666 | } |
2724 | } |
2667 | |
2725 | |
2668 | /* if size is w*h + 5 then no data has been found */ |
2726 | /* if size is w*h + 5 then no data has been found */ |
2669 | if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5) |
2727 | if (data - (uint8_t *)SvPVX (data_sv) != w * h + 5) |
2670 | { |
2728 | { |
2671 | SvPOK_only (data_sv); |
2729 | SvPOK_only (data_sv); |
2672 | SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); |
2730 | SvCUR_set (data_sv, data - (uint8_t *)SvPVX (data_sv)); |
2673 | } |
2731 | } |
2674 | |
2732 | |
2675 | RETVAL = data_sv; |
2733 | RETVAL = data_sv; |
2676 | } |
2734 | } |
2677 | OUTPUT: |
2735 | OUTPUT: |
2678 | RETVAL |
2736 | RETVAL |
2679 | |
2737 | |
2680 | void |
2738 | void |
… | |
… | |
2687 | STRLEN len; |
2745 | STRLEN len; |
2688 | uint8_t *data, *end; |
2746 | uint8_t *data, *end; |
2689 | |
2747 | |
2690 | len = SvLEN (data_sv); |
2748 | len = SvLEN (data_sv); |
2691 | SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more |
2749 | SvGROW (data_sv, len + 8); // reserve at least 7+ bytes more |
2692 | data = SvPVbyte_nolen (data_sv); |
2750 | data = (uint8_t *)SvPVbyte_nolen (data_sv); |
2693 | end = data + len + 8; |
2751 | end = data + len + 8; |
2694 | |
2752 | |
2695 | if (len < 5) |
2753 | if (len < 5) |
2696 | XSRETURN_EMPTY; |
2754 | XSRETURN_EMPTY; |
2697 | |
2755 | |
… | |
… | |
2758 | } |
2816 | } |
2759 | |
2817 | |
2760 | MODULE = Deliantra::Client PACKAGE = DC::RW |
2818 | MODULE = Deliantra::Client PACKAGE = DC::RW |
2761 | |
2819 | |
2762 | DC::RW |
2820 | DC::RW |
2763 | new (SV *class, SV *data_sv) |
2821 | new (SV *klass, SV *data_sv) |
2764 | CODE: |
2822 | CODE: |
2765 | { |
2823 | { |
2766 | STRLEN datalen; |
2824 | STRLEN datalen; |
2767 | char *data = SvPVbyte (data_sv, datalen); |
2825 | char *data = SvPVbyte (data_sv, datalen); |
2768 | |
2826 | |
… | |
… | |
2770 | } |
2828 | } |
2771 | OUTPUT: |
2829 | OUTPUT: |
2772 | RETVAL |
2830 | RETVAL |
2773 | |
2831 | |
2774 | DC::RW |
2832 | DC::RW |
2775 | new_from_file (SV *class, const char *path, const char *mode = "rb") |
2833 | new_from_file (SV *klass, const char *path, const char *mode = "rb") |
2776 | CODE: |
2834 | CODE: |
2777 | RETVAL = SDL_RWFromFile (path, mode); |
2835 | RETVAL = SDL_RWFromFile (path, mode); |
2778 | OUTPUT: |
2836 | OUTPUT: |
2779 | RETVAL |
2837 | RETVAL |
2780 | |
2838 | |
… | |
… | |
2798 | if (RETVAL < 0) |
2856 | if (RETVAL < 0) |
2799 | { |
2857 | { |
2800 | RETVAL = Mix_GroupOldest (-1); |
2858 | RETVAL = Mix_GroupOldest (-1); |
2801 | |
2859 | |
2802 | if (RETVAL < 0) |
2860 | if (RETVAL < 0) |
|
|
2861 | { |
|
|
2862 | // happens sometimes, maybe it just stopped playing(?) |
|
|
2863 | RETVAL = Mix_GroupAvailable (-1); |
|
|
2864 | |
|
|
2865 | if (RETVAL < 0) |
2803 | XSRETURN_UNDEF; |
2866 | XSRETURN_UNDEF; |
2804 | |
2867 | } |
|
|
2868 | else |
2805 | Mix_HaltChannel (RETVAL); |
2869 | Mix_HaltChannel (RETVAL); |
2806 | } |
2870 | } |
2807 | |
2871 | |
2808 | Mix_UnregisterAllEffects (RETVAL); |
2872 | Mix_UnregisterAllEffects (RETVAL); |
2809 | Mix_Volume (RETVAL, 128); |
2873 | Mix_Volume (RETVAL, 128); |
2810 | } |
2874 | } |
… | |
… | |
2870 | |
2934 | |
2871 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2935 | MODULE = Deliantra::Client PACKAGE = DC::MixChunk |
2872 | |
2936 | |
2873 | PROTOTYPES: DISABLE |
2937 | PROTOTYPES: DISABLE |
2874 | |
2938 | |
|
|
2939 | void |
|
|
2940 | decoders () |
|
|
2941 | PPCODE: |
|
|
2942 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
2943 | int i, num = Mix_GetNumChunkDecoders (); |
|
|
2944 | EXTEND (SP, num); |
|
|
2945 | for (i = 0; i < num; ++i) |
|
|
2946 | PUSHs (sv_2mortal (newSVpv (Mix_GetChunkDecoder (i), 0))); |
|
|
2947 | #else |
|
|
2948 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
2949 | #endif |
|
|
2950 | |
2875 | DC::MixChunk |
2951 | DC::MixChunk |
2876 | new (SV *class, DC::RW rwops) |
2952 | new (SV *klass, DC::RW rwops) |
2877 | CODE: |
2953 | CODE: |
2878 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2954 | RETVAL = Mix_LoadWAV_RW (rwops, 1); |
2879 | OUTPUT: |
2955 | OUTPUT: |
2880 | RETVAL |
2956 | RETVAL |
2881 | |
2957 | |
… | |
… | |
2911 | OUTPUT: |
2987 | OUTPUT: |
2912 | RETVAL |
2988 | RETVAL |
2913 | |
2989 | |
2914 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2990 | MODULE = Deliantra::Client PACKAGE = DC::MixMusic |
2915 | |
2991 | |
|
|
2992 | void |
|
|
2993 | decoders () |
|
|
2994 | PPCODE: |
|
|
2995 | #if SDL_MIXER_MAJOR_VERSION > 1 || SDL_MIXER_MINOR_VERSION > 2 || SDL_MIXER_PATCHLEVEL >= 10 |
|
|
2996 | int i, num = Mix_GetNumMusicDecoders (); |
|
|
2997 | EXTEND (SP, num); |
|
|
2998 | for (i = 0; i < num; ++i) |
|
|
2999 | PUSHs (sv_2mortal (newSVpv (Mix_GetMusicDecoder (i), 0))); |
|
|
3000 | #else |
|
|
3001 | XPUSHs (sv_2mortal (newSVpv ("(sdl mixer too old)", 0))); |
|
|
3002 | #endif |
|
|
3003 | |
2916 | int |
3004 | int |
2917 | volume (int volume = -1) |
3005 | volume (int volume = -1) |
2918 | PROTOTYPE: ;$ |
3006 | PROTOTYPE: ;$ |
2919 | CODE: |
3007 | CODE: |
2920 | if (items > 0) |
3008 | if (items > 0) |
… | |
… | |
2931 | void |
3019 | void |
2932 | halt () |
3020 | halt () |
2933 | CODE: |
3021 | CODE: |
2934 | Mix_HaltMusic (); |
3022 | Mix_HaltMusic (); |
2935 | |
3023 | |
|
|
3024 | int |
|
|
3025 | playing () |
|
|
3026 | CODE: |
|
|
3027 | RETVAL = Mix_PlayingMusic (); |
|
|
3028 | OUTPUT: |
|
|
3029 | RETVAL |
|
|
3030 | |
2936 | DC::MixMusic |
3031 | DC::MixMusic |
2937 | new (SV *class, DC::RW rwops) |
3032 | new (SV *klass, DC::RW rwops) |
2938 | CODE: |
3033 | CODE: |
2939 | RETVAL = Mix_LoadMUS_RW (rwops); |
3034 | RETVAL = Mix_LoadMUS_RW (rwops); |
2940 | OUTPUT: |
3035 | OUTPUT: |
2941 | RETVAL |
3036 | RETVAL |
2942 | |
3037 | |
… | |
… | |
3079 | const_iv (GL_FUNC_SUBTRACT), |
3174 | const_iv (GL_FUNC_SUBTRACT), |
3080 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3175 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
3081 | # undef const_iv |
3176 | # undef const_iv |
3082 | }; |
3177 | }; |
3083 | |
3178 | |
3084 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
3179 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
3085 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
3180 | newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
3086 | |
3181 | |
3087 | texture_av = newAV (); |
3182 | texture_av = newAV (); |
3088 | AvREAL_off (texture_av); |
3183 | AvREAL_off (texture_av); |
3089 | } |
3184 | } |
3090 | |
3185 | |
… | |
… | |
3095 | gl.BlendFuncSeparateEXT = 0; |
3190 | gl.BlendFuncSeparateEXT = 0; |
3096 | |
3191 | |
3097 | void |
3192 | void |
3098 | apple_nvidia_bug (int enable) |
3193 | apple_nvidia_bug (int enable) |
3099 | |
3194 | |
3100 | char * |
3195 | const char * |
3101 | gl_vendor () |
3196 | gl_vendor () |
3102 | CODE: |
3197 | CODE: |
3103 | RETVAL = (char *)glGetString (GL_VENDOR); |
3198 | RETVAL = (const char *)glGetString (GL_VENDOR); |
3104 | OUTPUT: |
3199 | OUTPUT: |
3105 | RETVAL |
3200 | RETVAL |
3106 | |
3201 | |
3107 | char * |
3202 | const char * |
3108 | gl_version () |
3203 | gl_version () |
3109 | CODE: |
3204 | CODE: |
3110 | RETVAL = (char *)glGetString (GL_VERSION); |
3205 | RETVAL = (const char *)glGetString (GL_VERSION); |
3111 | OUTPUT: |
3206 | OUTPUT: |
3112 | RETVAL |
3207 | RETVAL |
3113 | |
3208 | |
3114 | char * |
3209 | const char * |
3115 | gl_extensions () |
3210 | gl_extensions () |
3116 | CODE: |
3211 | CODE: |
3117 | RETVAL = (char *)glGetString (GL_EXTENSIONS); |
3212 | RETVAL = (const char *)glGetString (GL_EXTENSIONS); |
3118 | OUTPUT: |
3213 | OUTPUT: |
3119 | RETVAL |
3214 | RETVAL |
3120 | |
3215 | |
3121 | const char *glGetString (GLenum pname) |
3216 | const char *glGetString (GLenum pname) |
|
|
3217 | CODE: |
|
|
3218 | RETVAL = (const char *)glGetString (pname); |
|
|
3219 | OUTPUT: |
|
|
3220 | RETVAL |
3122 | |
3221 | |
3123 | GLint glGetInteger (GLenum pname) |
3222 | GLint glGetInteger (GLenum pname) |
3124 | CODE: |
3223 | CODE: |
3125 | glGetIntegerv (pname, &RETVAL); |
3224 | glGetIntegerv (pname, &RETVAL); |
3126 | OUTPUT: |
3225 | OUTPUT: |
… | |
… | |
3133 | RETVAL |
3232 | RETVAL |
3134 | |
3233 | |
3135 | int glGetError () |
3234 | int glGetError () |
3136 | |
3235 | |
3137 | void glFinish () |
3236 | void glFinish () |
|
|
3237 | |
|
|
3238 | void glFlush () |
3138 | |
3239 | |
3139 | void glClear (int mask) |
3240 | void glClear (int mask) |
3140 | |
3241 | |
3141 | void glClearColor (float r, float g, float b, float a = 1.0) |
3242 | void glClearColor (float r, float g, float b, float a = 1.0) |
3142 | PROTOTYPE: @ |
3243 | PROTOTYPE: @ |
… | |
… | |
3327 | |
3428 | |
3328 | void |
3429 | void |
3329 | find_widget (SV *self, NV x, NV y) |
3430 | find_widget (SV *self, NV x, NV y) |
3330 | PPCODE: |
3431 | PPCODE: |
3331 | { |
3432 | { |
3332 | if (within_widget (self, x, y)) |
3433 | if (within_widget (self, x, y)) |
3333 | XPUSHs (self); |
3434 | XPUSHs (self); |
3334 | } |
3435 | } |
3335 | |
3436 | |
3336 | BOOT: |
3437 | BOOT: |
3337 | { |
3438 | { |
… | |
… | |
3345 | |
3446 | |
3346 | void |
3447 | void |
3347 | draw (SV *self) |
3448 | draw (SV *self) |
3348 | CODE: |
3449 | CODE: |
3349 | { |
3450 | { |
3350 | HV *hv; |
3451 | HV *hv; |
3351 | SV **svp; |
3452 | SV **svp; |
3352 | NV x, y, w, h; |
3453 | NV x, y, w, h; |
3353 | SV *draw_x_sv = GvSV (draw_x_gv); |
3454 | SV *draw_x_sv = GvSV (draw_x_gv); |
3354 | SV *draw_y_sv = GvSV (draw_y_gv); |
3455 | SV *draw_y_sv = GvSV (draw_y_gv); |
3355 | SV *draw_w_sv = GvSV (draw_w_gv); |
3456 | SV *draw_w_sv = GvSV (draw_w_gv); |
3356 | SV *draw_h_sv = GvSV (draw_h_gv); |
3457 | SV *draw_h_sv = GvSV (draw_h_gv); |