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.267 by root, Sun Jul 20 02:55:36 2008 UTC vs.
Revision 1.273 by root, Wed Aug 20 13:30:02 2008 UTC

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__
46typedef 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>
369 self->rows = 0; 374 self->rows = 0;
370} 375}
371 376
372#define CELL_CLEAR(cell) \ 377#define CELL_CLEAR(cell) \
373 do { \ 378 do { \
379 if ((cell)->player) \
380 (cell)->tile [2] = 0; \
374 (cell)->darkness = 0; \ 381 (cell)->darkness = 0; \
375 (cell)->stat_hp = 0; \ 382 (cell)->stat_hp = 0; \
376 (cell)->flags = 0; \ 383 (cell)->flags = 0; \
377 (cell)->player = 0; \ 384 (cell)->player = 0; \
378 } while (0) 385 } while (0)
519 if (!svp || !SvTRUE (*svp)) 526 if (!svp || !SvTRUE (*svp))
520 return 0; 527 return 0;
521 528
522 return 1; 529 return 1;
523} 530}
531
532static void
533deliantra_main ()
534{
535 char *argv[] = { 0 };
536 call_argv ("::main", G_DISCARD | G_VOID, argv);
537 dSP;
538}
539
540#ifdef __MACOSX__
541 /* to due surprising braindamage on the side of SDL design, we
542 * do some mind-boggling hack here: SDL requires a custom main()
543 * on OS X, so... we provide one and call the original main(), which,
544 * due to share dlibrary magic, calls -lSDLmain's main, not perl's main,
545 * and which calls our main (== SDL_main) back.
546 */
547 extern C_LINKAGE int
548 main (int argc, char *argv[])
549 {
550 deliantra_main ();
551 }
552
553 #undef main
554
555 extern C_LINKAGE int main (int argc, char *argv[]);
556
557 static void
558 SDL_braino (void)
559 {
560 char *argv[] = { "deliantra client", 0 };
561 (main) (1, argv);
562 }
563#else
564 static void
565 SDL_braino (void)
566 {
567 deliantra_main ();
568 }
569#endif
524 570
525MODULE = Deliantra::Client PACKAGE = DC 571MODULE = Deliantra::Client PACKAGE = DC
526 572
527PROTOTYPES: ENABLE 573PROTOTYPES: ENABLE
528 574
669 const_iv (SDL_GL_ACCUM_ALPHA_SIZE), 715 const_iv (SDL_GL_ACCUM_ALPHA_SIZE),
670 const_iv (SDL_GL_STEREO), 716 const_iv (SDL_GL_STEREO),
671 const_iv (SDL_GL_MULTISAMPLEBUFFERS), 717 const_iv (SDL_GL_MULTISAMPLEBUFFERS),
672 const_iv (SDL_GL_MULTISAMPLESAMPLES), 718 const_iv (SDL_GL_MULTISAMPLESAMPLES),
673 const_iv (SDL_GL_ACCELERATED_VISUAL), 719 const_iv (SDL_GL_ACCELERATED_VISUAL),
674 const_iv (SDL_GL_SWAP_CONTROL) 720 const_iv (SDL_GL_SWAP_CONTROL),
721
722 const_iv (FOW_DARKNESS)
675# undef const_iv 723# undef const_iv
676 }; 724 };
677 725
678 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 726 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
679 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 727 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
716 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/ 764 /*pango_context_set_base_dir (opengl_context, PANGO_DIRECTION_WEAK_LTR);*/
717#endif 765#endif
718} 766}
719 767
720char *SDL_GetError () 768char *SDL_GetError ()
769
770void SDL_braino ()
721 771
722int SDL_Init (U32 flags) 772int SDL_Init (U32 flags)
723 773
724int SDL_InitSubSystem (U32 flags) 774int SDL_InitSubSystem (U32 flags)
725 775
2232 SvCUR_set (darkness3_sv, sw34 * sh3); 2282 SvCUR_set (darkness3_sv, sw34 * sh3);
2233 2283
2234 mx += self->x - 1; 2284 mx += self->x - 1;
2235 my += self->y - 1; 2285 my += self->y - 1;
2236 2286
2237 memset (darkness1, 255, sw1 * sh1); 2287 memset (darkness1, 255 - FOW_DARKNESS, sw1 * sh1);
2238 2288
2239 for (y = 0; y < sh1; y++) 2289 for (y = 0; y < sh1; y++)
2240 if (0 <= y + my && y + my < self->rows) 2290 if (0 <= y + my && y + my < self->rows)
2241 { 2291 {
2242 maprow *row = self->row + (y + my); 2292 maprow *row = self->row + (y + my);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines