… | |
… | |
38 | #include <SDL_thread.h> |
38 | #include <SDL_thread.h> |
39 | #include <SDL_endian.h> |
39 | #include <SDL_endian.h> |
40 | #include <SDL_image.h> |
40 | #include <SDL_image.h> |
41 | #include <SDL_mixer.h> |
41 | #include <SDL_mixer.h> |
42 | #include <SDL_opengl.h> |
42 | #include <SDL_opengl.h> |
|
|
43 | |
|
|
44 | /* work around os x broken headers */ |
|
|
45 | #ifdef __MACOSX__ |
|
|
46 | typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); |
|
|
47 | #endif |
43 | |
48 | |
44 | #define PANGO_ENABLE_BACKEND |
49 | #define PANGO_ENABLE_BACKEND |
45 | #define G_DISABLE_CAST_CHECKS |
50 | #define G_DISABLE_CAST_CHECKS |
46 | |
51 | |
47 | #include <glib/gmacros.h> |
52 | #include <glib/gmacros.h> |
… | |
… | |
521 | if (!svp || !SvTRUE (*svp)) |
526 | if (!svp || !SvTRUE (*svp)) |
522 | return 0; |
527 | return 0; |
523 | |
528 | |
524 | return 1; |
529 | return 1; |
525 | } |
530 | } |
|
|
531 | |
|
|
532 | static void |
|
|
533 | deliantra_main () |
|
|
534 | { |
|
|
535 | char *argv[] = { 0 }; |
|
|
536 | call_argv ("::main", G_DISCARD | G_VOID, argv); |
|
|
537 | } |
|
|
538 | |
|
|
539 | #ifdef __MACOSX__ |
|
|
540 | /* to due surprising braindamage on the side of SDL design, we |
|
|
541 | * do some mind-boggling hack here: SDL requires a custom main() |
|
|
542 | * on OS X, so... we provide one and call the original main(), which, |
|
|
543 | * due to share dlibrary magic, calls -lSDLmain's main, not perl's main, |
|
|
544 | * and which calls our main (== SDL_main) back. |
|
|
545 | */ |
|
|
546 | extern C_LINKAGE int |
|
|
547 | main (int argc, char *argv[]) |
|
|
548 | { |
|
|
549 | deliantra_main (); |
|
|
550 | } |
|
|
551 | |
|
|
552 | #undef main |
|
|
553 | |
|
|
554 | extern C_LINKAGE int main (int argc, char *argv[]); |
|
|
555 | |
|
|
556 | static void |
|
|
557 | SDL_braino (void) |
|
|
558 | { |
|
|
559 | char *argv[] = { "deliantra client", 0 }; |
|
|
560 | (main) (1, argv); |
|
|
561 | } |
|
|
562 | #else |
|
|
563 | static void |
|
|
564 | SDL_braino (void) |
|
|
565 | { |
|
|
566 | deliantra_main (); |
|
|
567 | } |
|
|
568 | #endif |
526 | |
569 | |
527 | MODULE = Deliantra::Client PACKAGE = DC |
570 | MODULE = Deliantra::Client PACKAGE = DC |
528 | |
571 | |
529 | PROTOTYPES: ENABLE |
572 | PROTOTYPES: ENABLE |
530 | |
573 | |
… | |
… | |
559 | const_iv (SDL_USEREVENT), |
602 | const_iv (SDL_USEREVENT), |
560 | |
603 | |
561 | const_iv (SDL_APPINPUTFOCUS), |
604 | const_iv (SDL_APPINPUTFOCUS), |
562 | const_iv (SDL_APPMOUSEFOCUS), |
605 | const_iv (SDL_APPMOUSEFOCUS), |
563 | const_iv (SDL_APPACTIVE), |
606 | const_iv (SDL_APPACTIVE), |
|
|
607 | |
|
|
608 | |
|
|
609 | const_iv (SDLK_UNKNOWN), |
|
|
610 | const_iv (SDLK_FIRST), |
|
|
611 | const_iv (SDLK_BACKSPACE), |
|
|
612 | const_iv (SDLK_TAB), |
|
|
613 | const_iv (SDLK_CLEAR), |
|
|
614 | const_iv (SDLK_RETURN), |
|
|
615 | const_iv (SDLK_PAUSE), |
|
|
616 | const_iv (SDLK_ESCAPE), |
|
|
617 | const_iv (SDLK_SPACE), |
|
|
618 | const_iv (SDLK_EXCLAIM), |
|
|
619 | const_iv (SDLK_QUOTEDBL), |
|
|
620 | const_iv (SDLK_HASH), |
|
|
621 | const_iv (SDLK_DOLLAR), |
|
|
622 | const_iv (SDLK_AMPERSAND), |
|
|
623 | const_iv (SDLK_QUOTE), |
|
|
624 | const_iv (SDLK_LEFTPAREN), |
|
|
625 | const_iv (SDLK_RIGHTPAREN), |
|
|
626 | const_iv (SDLK_ASTERISK), |
|
|
627 | const_iv (SDLK_PLUS), |
|
|
628 | const_iv (SDLK_COMMA), |
|
|
629 | const_iv (SDLK_MINUS), |
|
|
630 | const_iv (SDLK_PERIOD), |
|
|
631 | const_iv (SDLK_SLASH), |
|
|
632 | const_iv (SDLK_0), |
|
|
633 | const_iv (SDLK_1), |
|
|
634 | const_iv (SDLK_2), |
|
|
635 | const_iv (SDLK_3), |
|
|
636 | const_iv (SDLK_4), |
|
|
637 | const_iv (SDLK_5), |
|
|
638 | const_iv (SDLK_6), |
|
|
639 | const_iv (SDLK_7), |
|
|
640 | const_iv (SDLK_8), |
|
|
641 | const_iv (SDLK_9), |
|
|
642 | const_iv (SDLK_COLON), |
|
|
643 | const_iv (SDLK_SEMICOLON), |
|
|
644 | const_iv (SDLK_LESS), |
|
|
645 | const_iv (SDLK_EQUALS), |
|
|
646 | const_iv (SDLK_GREATER), |
|
|
647 | const_iv (SDLK_QUESTION), |
|
|
648 | const_iv (SDLK_AT), |
|
|
649 | |
|
|
650 | const_iv (SDLK_LEFTBRACKET), |
|
|
651 | const_iv (SDLK_BACKSLASH), |
|
|
652 | const_iv (SDLK_RIGHTBRACKET), |
|
|
653 | const_iv (SDLK_CARET), |
|
|
654 | const_iv (SDLK_UNDERSCORE), |
|
|
655 | const_iv (SDLK_BACKQUOTE), |
|
|
656 | const_iv (SDLK_DELETE), |
564 | |
657 | |
565 | const_iv (SDLK_FIRST), |
658 | const_iv (SDLK_FIRST), |
566 | const_iv (SDLK_LAST), |
659 | const_iv (SDLK_LAST), |
567 | const_iv (SDLK_KP0), |
660 | const_iv (SDLK_KP0), |
568 | const_iv (SDLK_KP1), |
661 | const_iv (SDLK_KP1), |
… | |
… | |
671 | const_iv (SDL_GL_ACCUM_ALPHA_SIZE), |
764 | const_iv (SDL_GL_ACCUM_ALPHA_SIZE), |
672 | const_iv (SDL_GL_STEREO), |
765 | const_iv (SDL_GL_STEREO), |
673 | const_iv (SDL_GL_MULTISAMPLEBUFFERS), |
766 | const_iv (SDL_GL_MULTISAMPLEBUFFERS), |
674 | const_iv (SDL_GL_MULTISAMPLESAMPLES), |
767 | const_iv (SDL_GL_MULTISAMPLESAMPLES), |
675 | const_iv (SDL_GL_ACCELERATED_VISUAL), |
768 | const_iv (SDL_GL_ACCELERATED_VISUAL), |
676 | const_iv (SDL_GL_SWAP_CONTROL) |
769 | const_iv (SDL_GL_SWAP_CONTROL), |
|
|
770 | |
|
|
771 | const_iv (FOW_DARKNESS) |
677 | # undef const_iv |
772 | # undef const_iv |
678 | }; |
773 | }; |
679 | |
774 | |
680 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
775 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
681 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
776 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
… | |
… | |
718 | /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/ |
813 | /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/ |
719 | #endif |
814 | #endif |
720 | } |
815 | } |
721 | |
816 | |
722 | char *SDL_GetError () |
817 | char *SDL_GetError () |
|
|
818 | |
|
|
819 | void SDL_braino () |
723 | |
820 | |
724 | int SDL_Init (U32 flags) |
821 | int SDL_Init (U32 flags) |
725 | |
822 | |
726 | int SDL_InitSubSystem (U32 flags) |
823 | int SDL_InitSubSystem (U32 flags) |
727 | |
824 | |
… | |
… | |
2234 | SvCUR_set (darkness3_sv, sw34 * sh3); |
2331 | SvCUR_set (darkness3_sv, sw34 * sh3); |
2235 | |
2332 | |
2236 | mx += self->x - 1; |
2333 | mx += self->x - 1; |
2237 | my += self->y - 1; |
2334 | my += self->y - 1; |
2238 | |
2335 | |
2239 | memset (darkness1, 255, sw1 * sh1); |
2336 | memset (darkness1, 255 - FOW_DARKNESS, sw1 * sh1); |
2240 | |
2337 | |
2241 | for (y = 0; y < sh1; y++) |
2338 | for (y = 0; y < sh1; y++) |
2242 | if (0 <= y + my && y + my < self->rows) |
2339 | if (0 <= y + my && y + my < self->rows) |
2243 | { |
2340 | { |
2244 | maprow *row = self->row + (y + my); |
2341 | maprow *row = self->row + (y + my); |