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.178 by root, Tue Apr 10 11:12:53 2007 UTC vs.
Revision 1.182 by root, Wed Apr 18 09:39:49 2007 UTC

345} smooth_key; 345} smooth_key;
346 346
347static void 347static void
348smooth_or_bits (HV *hv, smooth_key *key, IV bits) 348smooth_or_bits (HV *hv, smooth_key *key, IV bits)
349{ 349{
350 SV **sv = hv_fetch (hv, (char *)key, sizeof (key), 1); 350 SV **sv = hv_fetch (hv, (char *)key, sizeof (*key), 1);
351 351
352 if (SvIOK (*sv)) 352 if (SvIOK (*sv))
353 SvIV_set (*sv, SvIVX (*sv) | bits); 353 SvIV_set (*sv, SvIVX (*sv) | bits);
354 else 354 else
355 sv_setiv (*sv, bits); 355 sv_setiv (*sv, bits);
701Mix_AllocateChannels (int numchans = -1) 701Mix_AllocateChannels (int numchans = -1)
702 702
703void 703void
704lowdelay (int fd, int val = 1) 704lowdelay (int fd, int val = 1)
705 CODE: 705 CODE:
706#ifndef _WIN32
707 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); 706 setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (void *)&val, sizeof (val));
708#endif
709 707
710void 708void
711win32_proxy_info () 709win32_proxy_info ()
712 PPCODE: 710 PPCODE:
713{ 711{
1462 } 1460 }
1463 else if (cmd == 6) // monster width 1461 else if (cmd == 6) // monster width
1464 cell->stat_width = *data++ + 1; 1462 cell->stat_width = *data++ + 1;
1465 else if (cmd == 0x47) 1463 else if (cmd == 0x47)
1466 { 1464 {
1467 if (*data == 8) 1465 if (*data == 4)
1468 ; // decode player uuid 1466 ; // decode player count
1469 1467
1470 data += *data + 1; 1468 data += *data + 1;
1471 } 1469 }
1472 else if (cmd == 8) // cell flags 1470 else if (cmd == 8) // cell flags
1473 cell->flags = *data++; 1471 cell->flags = *data++;
1683 smooth_level [tex.smoothlevel >> 5] |= ((uint32_t)1) << (tex.smoothlevel & 31); 1681 smooth_level [tex.smoothlevel >> 5] |= ((uint32_t)1) << (tex.smoothlevel & 31);
1684 1682
1685 // add bits to current tile and all neighbours. skey.x|y is 1683 // add bits to current tile and all neighbours. skey.x|y is
1686 // shifted +1|+1 so we always stay positive. 1684 // shifted +1|+1 so we always stay positive.
1687 1685
1686 // bits is ___n cccc CCCC bbbb
1687 // n do not draw borders&corners
1688 // c draw these corners, but...
1689 // C ... not these
1690 // b draw these borders
1691
1692 // borders: 1 ┃· 2 ━━ 4 ·┃ 8 ··
1693 // ┃· ·· ·┃ ━━
1694
1695 // corners: 1 ┛· 2 ·┗ 4 ·· 8 ··
1696 // ·· ·· ·┏ ┓·
1697
1688 // full tile 1698 // full tile
1689 skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x1000); 1699 skey.x = x + 1; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x1000);
1690 1700
1691 // borders 1701 // borders
1692 skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0031); 1702 skey.x = x + 2; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0091);
1693 skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0092); 1703 skey.x = x + 1; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0032);
1694 skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0064); 1704 skey.x = x ; skey.y = y + 1; smooth_or_bits (smooth, &skey, 0x0064);
1695 skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, &skey, 0x00c8); 1705 skey.x = x + 1; skey.y = y ; smooth_or_bits (smooth, &skey, 0x00c8);
1696 1706
1697 // corners 1707 // corners
1698 skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100); 1708 skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100);
1702 } 1712 }
1703 } 1713 }
1704 } 1714 }
1705 } 1715 }
1706 1716
1707 // go through all smoothlevels, lowest to highest, then draw 1717 // go through all smoothlevels, lowest to highest, then draw.
1708 // this is basically counting sort 1718 // this is basically counting sort
1709 { 1719 {
1710 int w, b; 1720 int w, b;
1711 1721
1712 for (w = 0; w < 256 / 32; ++w) 1722 for (w = 0; w < 256 / 32; ++w)
1722 hv_iterinit (smooth); 1732 hv_iterinit (smooth);
1723 while ((he = hv_iternext (smooth))) 1733 while ((he = hv_iternext (smooth)))
1724 { 1734 {
1725 smooth_key *skey = (smooth_key *)HeKEY (he); 1735 smooth_key *skey = (smooth_key *)HeKEY (he);
1726 IV bits = SvIVX (HeVAL (he)); 1736 IV bits = SvIVX (HeVAL (he));
1727
1728 // bits is ___n cccc CCCC bbbb
1729 // n do not draw borders&corners
1730 // c draw these corners, but...
1731 // C ... not these
1732 // b draw these borders
1733 1737
1734 if (!(bits & 0x1000) 1738 if (!(bits & 0x1000)
1735 && skey->level == level 1739 && skey->level == level
1736 && level >= smooth_max [skey->x][skey->y]) 1740 && level >= smooth_max [skey->x][skey->y])
1737 { 1741 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines