ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.262 by root, Wed Jul 16 20:12:27 2008 UTC vs.
Revision 1.267 by root, Sun Jul 20 02:55:36 2008 UTC

85 85
86#define MIN_FONT_HEIGHT 10 86#define MIN_FONT_HEIGHT 10
87 87
88/* mask out modifiers we are not interested in */ 88/* mask out modifiers we are not interested in */
89#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META) 89#define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META)
90
91#if 1
92# define PARACHUTE SDL_INIT_NOPARACHUTE
93#else
94# define PARACHUTE 0
95#endif
96 90
97static AV *texture_av; 91static AV *texture_av;
98 92
99static struct 93static struct
100{ 94{
373 self->oy = 0; 367 self->oy = 0;
374 self->row = 0; 368 self->row = 0;
375 self->rows = 0; 369 self->rows = 0;
376} 370}
377 371
372#define CELL_CLEAR(cell) \
373 do { \
374 (cell)->darkness = 0; \
375 (cell)->stat_hp = 0; \
376 (cell)->flags = 0; \
377 (cell)->player = 0; \
378 } while (0)
379
378static void 380static void
379map_blank (DC__Map self, int x0, int y0, int w, int h) 381map_blank (DC__Map self, int x0, int y0, int w, int h)
380{ 382{
381 int x, y; 383 int x, y;
382 maprow *row; 384 maprow *row;
396 if (x >= row->c1) 398 if (x >= row->c1)
397 break; 399 break;
398 400
399 cell = row->col + x - row->c0; 401 cell = row->col + x - row->c0;
400 402
401 cell->darkness = 0; 403 CELL_CLEAR (cell);
402 cell->stat_hp = 0;
403 cell->flags = 0;
404 cell->player = 0;
405 } 404 }
406 } 405 }
407} 406}
408 407
409typedef struct { 408typedef struct {
644 const_iv (KMOD_NUM), 643 const_iv (KMOD_NUM),
645 const_iv (KMOD_CAPS), 644 const_iv (KMOD_CAPS),
646 const_iv (KMOD_MODE), 645 const_iv (KMOD_MODE),
647 646
648 const_iv (MIX_DEFAULT_FORMAT), 647 const_iv (MIX_DEFAULT_FORMAT),
648
649 const_iv (SDL_INIT_TIMER),
650 const_iv (SDL_INIT_AUDIO),
651 const_iv (SDL_INIT_VIDEO),
652 const_iv (SDL_INIT_CDROM),
653 const_iv (SDL_INIT_JOYSTICK),
654 const_iv (SDL_INIT_EVERYTHING),
655 const_iv (SDL_INIT_NOPARACHUTE),
656 const_iv (SDL_INIT_EVENTTHREAD),
657
658 const_iv (SDL_GL_RED_SIZE),
659 const_iv (SDL_GL_GREEN_SIZE),
660 const_iv (SDL_GL_BLUE_SIZE),
661 const_iv (SDL_GL_ALPHA_SIZE),
662 const_iv (SDL_GL_DOUBLEBUFFER),
663 const_iv (SDL_GL_BUFFER_SIZE),
664 const_iv (SDL_GL_DEPTH_SIZE),
665 const_iv (SDL_GL_STENCIL_SIZE),
666 const_iv (SDL_GL_ACCUM_RED_SIZE),
667 const_iv (SDL_GL_ACCUM_GREEN_SIZE),
668 const_iv (SDL_GL_ACCUM_BLUE_SIZE),
669 const_iv (SDL_GL_ACCUM_ALPHA_SIZE),
670 const_iv (SDL_GL_STEREO),
671 const_iv (SDL_GL_MULTISAMPLEBUFFERS),
672 const_iv (SDL_GL_MULTISAMPLESAMPLES),
673 const_iv (SDL_GL_ACCELERATED_VISUAL),
674 const_iv (SDL_GL_SWAP_CONTROL)
649# undef const_iv 675# undef const_iv
650 }; 676 };
651 677
652 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 678 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
653 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 679 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
689 pango_context_set_language (opengl_context, pango_language_from_string ("en")); 715 pango_context_set_language (opengl_context, pango_language_from_string ("en"));
690 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/ 716 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/
691#endif 717#endif
692} 718}
693 719
694char *
695SDL_GetError () 720char *SDL_GetError ()
696 721
697int 722int SDL_Init (U32 flags)
698SDL_Init (U32 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | PARACHUTE)
699 723
700void 724int SDL_InitSubSystem (U32 flags)
725
726void SDL_QuitSubSystem (U32 flags)
727
701SDL_Quit () 728void SDL_Quit ()
729
730int SDL_GL_SetAttribute (int attr, int value)
731
732int SDL_GL_GetAttribute (int attr)
733 CODE:
734 if (SDL_GL_GetAttribute (attr, &RETVAL))
735 XSRETURN_UNDEF;
736 OUTPUT:
737 RETVAL
702 738
703void 739void
704SDL_ListModes (int rgb, int alpha) 740SDL_ListModes (int rgb, int alpha)
705 PPCODE: 741 PPCODE:
706{ 742{
718 SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0); 754 SDL_GL_SetAttribute (SDL_GL_ACCUM_GREEN_SIZE, 0);
719 SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE , 0); 755 SDL_GL_SetAttribute (SDL_GL_ACCUM_BLUE_SIZE , 0);
720 SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0); 756 SDL_GL_SetAttribute (SDL_GL_ACCUM_ALPHA_SIZE, 0);
721 757
722 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); 758 SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
723#if SDL_VERSION_ATLEAST(1,2,10)
724 SDL_GL_SetAttribute (SDL_GL_ACCELERATED_VISUAL, 1);
725 SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1); 759 SDL_GL_SetAttribute (SDL_GL_SWAP_CONTROL, 1);
726#endif
727 760
728 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); 761 m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL);
729 762
730 if (m && m != (SDL_Rect **)-1) 763 if (m && m != (SDL_Rect **)-1)
731 while (*m) 764 while (*m)
732 { 765 {
733 if ((*m)->w >= 800 && (*m)->h >= 480) 766 if ((*m)->w >= 400 && (*m)->h >= 300)
734 { 767 {
735 AV *av = newAV (); 768 AV *av = newAV ();
736 av_push (av, newSViv ((*m)->w)); 769 av_push (av, newSViv ((*m)->w));
737 av_push (av, newSViv ((*m)->h)); 770 av_push (av, newSViv ((*m)->h));
738 av_push (av, newSViv (rgb)); 771 av_push (av, newSViv (rgb));
1752 } 1785 }
1753 } 1786 }
1754 } 1787 }
1755 } 1788 }
1756 else 1789 else
1757 cell->darkness = 0; 1790 CELL_CLEAR (cell);
1758 } 1791 }
1759} 1792}
1760 OUTPUT: 1793 OUTPUT:
1761 RETVAL 1794 RETVAL
1762 1795
1814} 1847}
1815 OUTPUT: 1848 OUTPUT:
1816 RETVAL 1849 RETVAL
1817 1850
1818void 1851void
1819draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int pdx = 0, int pdy = 0) 1852draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int sdx = 0, int sdy = 0)
1820 CODE: 1853 CODE:
1821{ 1854{
1822 int x, y, z; 1855 int x, y, z;
1823 1856
1824 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); 1857 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
2071 } 2104 }
2072 2105
2073 if (pl_tex.name) 2106 if (pl_tex.name)
2074 { 2107 {
2075 maptex tex = pl_tex; 2108 maptex tex = pl_tex;
2076 int px = pl_x + pdx; 2109 int px = pl_x + sdx;
2077 int py = pl_y + pdy; 2110 int py = pl_y + sdy;
2078 2111
2079 key.texname = tex.name; 2112 key.texname = tex.name;
2080 arr = rc_array (rc, &key); 2113 arr = rc_array (rc, &key);
2081 2114
2082 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2115 rc_t2f_v3f (arr, 0 , 0 , px , py , 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines