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 NTDDI_VERSION NTDDI_WIN2K // 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 | # include <wininet.h> |
7 | # pragma warning(disable:4244) |
7 | # pragma warning(disable:4244) |
8 | # pragma warning(disable:4761) |
8 | # pragma warning(disable:4761) |
… | |
… | |
14 | |
14 | |
15 | #ifdef _WIN32 |
15 | #ifdef _WIN32 |
16 | # undef pipe |
16 | # undef pipe |
17 | #endif |
17 | #endif |
18 | |
18 | |
|
|
19 | #include <assert.h> |
19 | #include <math.h> |
20 | #include <math.h> |
20 | #include <string.h> |
21 | #include <string.h> |
21 | #include <stdio.h> |
22 | #include <stdio.h> |
22 | #include <stdlib.h> |
23 | #include <stdlib.h> |
23 | |
24 | |
… | |
… | |
492 | |
493 | |
493 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
494 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
494 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
495 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
495 | } |
496 | } |
496 | |
497 | |
|
|
498 | void |
|
|
499 | weaken (SV *rv) |
|
|
500 | PROTOTYPE: $ |
|
|
501 | CODE: |
|
|
502 | sv_rvweaken (rv); |
|
|
503 | |
497 | int |
504 | int |
498 | in_destruct () |
505 | in_destruct () |
499 | CODE: |
506 | CODE: |
500 | RETVAL = PL_main_cv == Nullcv; |
507 | RETVAL = PL_main_cv == Nullcv; |
501 | OUTPUT: |
508 | OUTPUT: |
… | |
… | |
1405 | cell->stat_width = 1; |
1412 | cell->stat_width = 1; |
1406 | cell->stat_hp = *data++; |
1413 | cell->stat_hp = *data++; |
1407 | } |
1414 | } |
1408 | else if (cmd == 6) // monster width |
1415 | else if (cmd == 6) // monster width |
1409 | cell->stat_width = *data++ + 1; |
1416 | cell->stat_width = *data++ + 1; |
1410 | else if (cmd == 0x47) // monster width |
1417 | else if (cmd == 0x47) |
1411 | { |
1418 | { |
1412 | if (*data == 4) |
1419 | if (*data == 8) |
1413 | ; // decode player tag |
1420 | ; // decode player uuid |
1414 | |
1421 | |
1415 | data += *data + 1; |
1422 | data += *data + 1; |
1416 | } |
1423 | } |
1417 | else if (cmd == 8) // cell flags |
1424 | else if (cmd == 8) // cell flags |
1418 | cell->flags = *data++; |
1425 | cell->flags = *data++; |
… | |
… | |
1479 | |
1486 | |
1480 | for (z = 0; z <= 0; z++) |
1487 | for (z = 0; z <= 0; z++) |
1481 | { |
1488 | { |
1482 | mapface face = cell->face [z]; |
1489 | mapface face = cell->face [z]; |
1483 | |
1490 | |
1484 | if (face) |
1491 | if (face > 0 && face < self->texs) |
1485 | { |
1492 | { |
1486 | maptex tex = self->tex [face]; |
1493 | maptex tex = self->tex [face]; |
1487 | int a0 = 255 - tex.a; |
1494 | int a0 = 255 - tex.a; |
1488 | int a1 = tex.a; |
1495 | int a1 = tex.a; |
1489 | |
1496 | |
… | |
… | |
1506 | } |
1513 | } |
1507 | OUTPUT: |
1514 | OUTPUT: |
1508 | RETVAL |
1515 | RETVAL |
1509 | |
1516 | |
1510 | void |
1517 | void |
1511 | draw (CFPlus::Map self, int mx, int my, int sw, int sh) |
1518 | draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) |
1512 | CODE: |
1519 | CODE: |
1513 | { |
1520 | { |
1514 | int x, y, z; |
1521 | int x, y, z; |
1515 | int last_name; |
1522 | int last_name; |
1516 | mapface face; |
1523 | mapface face; |
… | |
… | |
1540 | { |
1547 | { |
1541 | mapcell *cell = row->col + (x + mx - row->c0); |
1548 | mapcell *cell = row->col + (x + mx - row->c0); |
1542 | |
1549 | |
1543 | face = cell->face [z]; |
1550 | face = cell->face [z]; |
1544 | |
1551 | |
1545 | if (face && face < self->texs) |
1552 | if (face > 0 && face < self->texs) |
1546 | { |
1553 | { |
1547 | maptex tex = self->tex [face]; |
1554 | maptex tex = self->tex [face]; |
1548 | int px = (x + 1) * 32 - tex.w; |
1555 | int px = (x + 1) * T - tex.w; |
1549 | int py = (y + 1) * 32 - tex.h; |
1556 | int py = (y + 1) * T - tex.h; |
1550 | |
1557 | |
1551 | if (last_name != tex.name) |
1558 | if (last_name != tex.name) |
1552 | { |
1559 | { |
1553 | glEnd (); |
1560 | glEnd (); |
1554 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1561 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
… | |
… | |
1564 | if (cell->flags && z == 2) |
1571 | if (cell->flags && z == 2) |
1565 | { |
1572 | { |
1566 | if (cell->flags & 1) |
1573 | if (cell->flags & 1) |
1567 | { |
1574 | { |
1568 | maptex tex = self->tex [1]; |
1575 | maptex tex = self->tex [1]; |
1569 | int px = (x + 1) * 32 - tex.w + 2; |
1576 | int px = (x + 1) * T - tex.w + 2; |
1570 | int py = (y + 1) * 32 - tex.h - 6; |
1577 | int py = (y + 1) * T - tex.h - 6; |
1571 | |
1578 | |
1572 | glEnd (); |
1579 | glEnd (); |
1573 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1580 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1574 | glBegin (GL_QUADS); |
1581 | glBegin (GL_QUADS); |
1575 | |
1582 | |
… | |
… | |
1596 | for (x = 0; x < sw; x++) |
1603 | for (x = 0; x < sw; x++) |
1597 | if (row->c0 <= x + mx && x + mx < row->c1) |
1604 | if (row->c0 <= x + mx && x + mx < row->c1) |
1598 | { |
1605 | { |
1599 | mapcell *cell = row->col + (x + mx - row->c0); |
1606 | mapcell *cell = row->col + (x + mx - row->c0); |
1600 | |
1607 | |
1601 | int px = x * 32; |
1608 | int px = x * T; |
1602 | int py = y * 32; |
1609 | int py = y * T; |
1603 | |
1610 | |
1604 | if (cell->stat_hp) |
1611 | if (cell->stat_hp) |
1605 | { |
1612 | { |
1606 | int width = cell->stat_width * 32; |
1613 | int width = cell->stat_width * T; |
1607 | int thick = sh / 28 + 1 + cell->stat_width; |
1614 | int thick = sh / 28 + 1 + cell->stat_width; |
1608 | |
1615 | |
1609 | glColor3ub (0, 0, 0); |
1616 | glColor3ub (0, 0, 0); |
1610 | glRectf (px + 1, py - thick - 2, |
1617 | glRectf (px + 1, py - thick - 2, |
1611 | px + width - 1, py); |
1618 | px + width - 1, py); |