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.265 by root, Fri Jul 18 22:56:11 2008 UTC vs.
Revision 1.270 by root, Sun Jul 20 15:05:13 2008 UTC

367 self->oy = 0; 367 self->oy = 0;
368 self->row = 0; 368 self->row = 0;
369 self->rows = 0; 369 self->rows = 0;
370} 370}
371 371
372#define CELL_CLEAR(cell) \
373 do { \
374 if ((cell)->player) \
375 (cell)->tile [2] = 0; \
376 (cell)->darkness = 0; \
377 (cell)->stat_hp = 0; \
378 (cell)->flags = 0; \
379 (cell)->player = 0; \
380 } while (0)
381
372static void 382static void
373map_blank (DC__Map self, int x0, int y0, int w, int h) 383map_blank (DC__Map self, int x0, int y0, int w, int h)
374{ 384{
375 int x, y; 385 int x, y;
376 maprow *row; 386 maprow *row;
390 if (x >= row->c1) 400 if (x >= row->c1)
391 break; 401 break;
392 402
393 cell = row->col + x - row->c0; 403 cell = row->col + x - row->c0;
394 404
395 cell->darkness = 0; 405 CELL_CLEAR (cell);
396 cell->stat_hp = 0;
397 cell->flags = 0;
398 cell->player = 0;
399 } 406 }
400 } 407 }
401} 408}
402 409
403typedef struct { 410typedef struct {
664 const_iv (SDL_GL_ACCUM_ALPHA_SIZE), 671 const_iv (SDL_GL_ACCUM_ALPHA_SIZE),
665 const_iv (SDL_GL_STEREO), 672 const_iv (SDL_GL_STEREO),
666 const_iv (SDL_GL_MULTISAMPLEBUFFERS), 673 const_iv (SDL_GL_MULTISAMPLEBUFFERS),
667 const_iv (SDL_GL_MULTISAMPLESAMPLES), 674 const_iv (SDL_GL_MULTISAMPLESAMPLES),
668 const_iv (SDL_GL_ACCELERATED_VISUAL), 675 const_iv (SDL_GL_ACCELERATED_VISUAL),
669 const_iv (SDL_GL_SWAP_CONTROL) 676 const_iv (SDL_GL_SWAP_CONTROL),
677
678 const_iv (FOW_DARKNESS)
670# undef const_iv 679# undef const_iv
671 }; 680 };
672 681
673 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 682 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
674 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 683 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
691 RETVAL 700 RETVAL
692 701
693NV floor (NV x) 702NV floor (NV x)
694 703
695NV ceil (NV x) 704NV ceil (NV x)
705
706NV ceilabs (NV x)
707 CODE:
708 RETVAL = x < 0. ? - ceil (-x) : ceil (x);
709 OUTPUT:
710 RETVAL
696 711
697IV minpot (UV n) 712IV minpot (UV n)
698 713
699IV popcount (UV n) 714IV popcount (UV n)
700 715
1780 } 1795 }
1781 } 1796 }
1782 } 1797 }
1783 } 1798 }
1784 else 1799 else
1785 cell->darkness = 0; 1800 CELL_CLEAR (cell);
1786 } 1801 }
1787} 1802}
1788 OUTPUT: 1803 OUTPUT:
1789 RETVAL 1804 RETVAL
1790 1805
1842} 1857}
1843 OUTPUT: 1858 OUTPUT:
1844 RETVAL 1859 RETVAL
1845 1860
1846void 1861void
1847draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int pdx = 0, int pdy = 0) 1862draw (DC::Map self, int mx, int my, int sw, int sh, int T, U32 player = 0xffffffff, int sdx = 0, int sdy = 0)
1848 CODE: 1863 CODE:
1849{ 1864{
1850 int x, y, z; 1865 int x, y, z;
1851 1866
1852 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ()); 1867 HV *smooth = (HV *)sv_2mortal ((SV *)newHV ());
2099 } 2114 }
2100 2115
2101 if (pl_tex.name) 2116 if (pl_tex.name)
2102 { 2117 {
2103 maptex tex = pl_tex; 2118 maptex tex = pl_tex;
2104 int px = pl_x + pdx; 2119 int px = pl_x + sdx;
2105 int py = pl_y + pdy; 2120 int py = pl_y + sdy;
2106 2121
2107 key.texname = tex.name; 2122 key.texname = tex.name;
2108 arr = rc_array (rc, &key); 2123 arr = rc_array (rc, &key);
2109 2124
2110 rc_t2f_v3f (arr, 0 , 0 , px , py , 0); 2125 rc_t2f_v3f (arr, 0 , 0 , px , py , 0);
2227 SvCUR_set (darkness3_sv, sw34 * sh3); 2242 SvCUR_set (darkness3_sv, sw34 * sh3);
2228 2243
2229 mx += self->x - 1; 2244 mx += self->x - 1;
2230 my += self->y - 1; 2245 my += self->y - 1;
2231 2246
2232 memset (darkness1, 255, sw1 * sh1); 2247 memset (darkness1, 255 - FOW_DARKNESS, sw1 * sh1);
2233 2248
2234 for (y = 0; y < sh1; y++) 2249 for (y = 0; y < sh1; y++)
2235 if (0 <= y + my && y + my < self->rows) 2250 if (0 <= y + my && y + my < self->rows)
2236 { 2251 {
2237 maprow *row = self->row + (y + my); 2252 maprow *row = self->row + (y + my);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines