1 | #ifdef _WIN32 |
1 | #ifdef _WIN32 |
2 | # define WIN32_LEAN_AND_MEAN |
2 | # define WIN32_LEAN_AND_MEAN |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
4 | # include <malloc.h> |
4 | # include <malloc.h> |
5 | # include <windows.h> |
5 | # include <windows.h> |
|
|
6 | # include <wininet.h> |
6 | # pragma warning(disable:4244) |
7 | # pragma warning(disable:4244) |
7 | #endif |
8 | #endif |
8 | |
9 | |
9 | #include "EXTERN.h" |
10 | #include "EXTERN.h" |
10 | #include "perl.h" |
11 | #include "perl.h" |
… | |
… | |
315 | |
316 | |
316 | cell = row->col + x - row->c0; |
317 | cell = row->col + x - row->c0; |
317 | |
318 | |
318 | cell->darkness = 0; |
319 | cell->darkness = 0; |
319 | cell->stat_hp = 0; |
320 | cell->stat_hp = 0; |
|
|
321 | cell->flags = 0; |
|
|
322 | cell->player = 0; |
320 | } |
323 | } |
321 | } |
324 | } |
322 | } |
325 | } |
323 | |
326 | |
324 | static void |
327 | static void |
… | |
… | |
649 | #ifndef _WIN32 |
652 | #ifndef _WIN32 |
650 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
653 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
651 | #endif |
654 | #endif |
652 | |
655 | |
653 | void |
656 | void |
|
|
657 | win32_proxy_info () |
|
|
658 | PPCODE: |
|
|
659 | { |
|
|
660 | #ifdef _WIN32 |
|
|
661 | char buffer[2048]; |
|
|
662 | DWORD buflen; |
|
|
663 | |
|
|
664 | EXTEND (SP, 3); |
|
|
665 | |
|
|
666 | buflen = sizeof (buffer); |
|
|
667 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY, (void *)buffer, &buflen)) |
|
|
668 | if (((INTERNET_PROXY_INFO *)buffer)->dwAccessType == INTERNET_OPEN_TYPE_PROXY) |
|
|
669 | { |
|
|
670 | PUSHs (newSVpv (((INTERNET_PROXY_INFO *)buffer)->lpszProxy, 0)); |
|
|
671 | |
|
|
672 | buflen = sizeof (buffer); |
|
|
673 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_USERNAME, (void *)buffer, &buflen)) |
|
|
674 | { |
|
|
675 | PUSHs (newSVpv (buffer, 0)); |
|
|
676 | |
|
|
677 | buflen = sizeof (buffer); |
|
|
678 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_PASSWORD, (void *)buffer, &buflen)) |
|
|
679 | PUSHs (newSVpv (buffer, 0)); |
|
|
680 | } |
|
|
681 | } |
|
|
682 | #endif |
|
|
683 | } |
|
|
684 | |
|
|
685 | void |
654 | add_font (char *file) |
686 | add_font (char *file) |
655 | CODE: |
687 | CODE: |
656 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
688 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
657 | |
689 | |
658 | void |
690 | void |
… | |
… | |
760 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
792 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
761 | #endif |
793 | #endif |
762 | _exit (1); |
794 | _exit (1); |
763 | |
795 | |
764 | void |
796 | void |
765 | _exit (int retval) |
797 | _exit (int retval = 0) |
766 | CODE: |
798 | CODE: |
|
|
799 | #ifdef WIN32 |
|
|
800 | ExitThread (retval); // unclean, please beam me up |
|
|
801 | #else |
767 | _exit (retval); |
802 | _exit (retval); |
|
|
803 | #endif |
768 | |
804 | |
769 | MODULE = CFPlus PACKAGE = CFPlus::Font |
805 | MODULE = CFPlus PACKAGE = CFPlus::Font |
770 | |
806 | |
771 | CFPlus::Font |
807 | CFPlus::Font |
772 | new_from_file (SV *class, char *path, int id = 0) |
808 | new_from_file (SV *class, char *path, int id = 0) |
… | |
… | |
1244 | void |
1280 | void |
1245 | scroll (CFPlus::Map self, int dx, int dy) |
1281 | scroll (CFPlus::Map self, int dx, int dy) |
1246 | CODE: |
1282 | CODE: |
1247 | { |
1283 | { |
1248 | if (dx > 0) |
1284 | if (dx > 0) |
1249 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1285 | map_blank (self, self->x, self->y, dx, self->h); |
1250 | else if (dx < 0) |
1286 | else if (dx < 0) |
1251 | map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); |
1287 | map_blank (self, self->x + self->w + dx + 1, self->y, -dx, self->h); |
1252 | |
1288 | |
1253 | if (dy > 0) |
1289 | if (dy > 0) |
1254 | map_blank (self, self->x, self->y, self->w, dy - 1); |
1290 | map_blank (self, self->x, self->y, self->w, dy); |
1255 | else if (dy < 0) |
1291 | else if (dy < 0) |
1256 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); |
1292 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, -dy); |
1257 | |
1293 | |
1258 | self->ox += dx; self->x += dx; |
1294 | self->ox += dx; self->x += dx; |
1259 | self->oy += dy; self->y += dy; |
1295 | self->oy += dy; self->y += dy; |
1260 | |
1296 | |
1261 | while (self->y < 0) |
1297 | while (self->y < 0) |
… | |
… | |
1287 | |
1323 | |
1288 | if (flags & 15) |
1324 | if (flags & 15) |
1289 | { |
1325 | { |
1290 | if (!cell->darkness) |
1326 | if (!cell->darkness) |
1291 | { |
1327 | { |
|
|
1328 | memset (cell, 0, sizeof (*cell)); |
1292 | cell->darkness = 256; |
1329 | cell->darkness = 256; |
1293 | cell->face [0] = 0; |
|
|
1294 | cell->face [1] = 0; |
|
|
1295 | cell->face [2] = 0; |
|
|
1296 | } |
1330 | } |
1297 | |
1331 | |
1298 | //TODO: don't trust server data to be in-range(!) |
1332 | //TODO: don't trust server data to be in-range(!) |
1299 | |
1333 | |
1300 | if (flags & 8) |
1334 | if (flags & 8) |
… | |
… | |
1351 | { |
1385 | { |
1352 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1386 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1353 | } |
1387 | } |
1354 | } |
1388 | } |
1355 | else |
1389 | else |
1356 | { |
|
|
1357 | cell->darkness = 0; |
1390 | cell->darkness = 0; |
1358 | cell->stat_hp = 0; |
|
|
1359 | } |
|
|
1360 | } |
1391 | } |
1361 | } |
1392 | } |
1362 | |
1393 | |
1363 | SV * |
1394 | SV * |
1364 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1395 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |