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) |
… | |
… | |
1412 | cell->stat_width = 1; |
1412 | cell->stat_width = 1; |
1413 | cell->stat_hp = *data++; |
1413 | cell->stat_hp = *data++; |
1414 | } |
1414 | } |
1415 | else if (cmd == 6) // monster width |
1415 | else if (cmd == 6) // monster width |
1416 | cell->stat_width = *data++ + 1; |
1416 | cell->stat_width = *data++ + 1; |
1417 | else if (cmd == 0x47) // monster width |
1417 | else if (cmd == 0x47) |
1418 | { |
1418 | { |
1419 | if (*data == 4) |
1419 | if (*data == 8) |
1420 | ; // decode player tag |
1420 | ; // decode player uuid |
1421 | |
1421 | |
1422 | data += *data + 1; |
1422 | data += *data + 1; |
1423 | } |
1423 | } |
1424 | else if (cmd == 8) // cell flags |
1424 | else if (cmd == 8) // cell flags |
1425 | cell->flags = *data++; |
1425 | cell->flags = *data++; |
… | |
… | |
1513 | } |
1513 | } |
1514 | OUTPUT: |
1514 | OUTPUT: |
1515 | RETVAL |
1515 | RETVAL |
1516 | |
1516 | |
1517 | void |
1517 | void |
1518 | 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) |
1519 | CODE: |
1519 | CODE: |
1520 | { |
1520 | { |
1521 | int x, y, z; |
1521 | int x, y, z; |
1522 | int last_name; |
1522 | int last_name; |
1523 | mapface face; |
1523 | mapface face; |
… | |
… | |
1550 | face = cell->face [z]; |
1550 | face = cell->face [z]; |
1551 | |
1551 | |
1552 | if (face && face < self->texs) |
1552 | if (face && face < self->texs) |
1553 | { |
1553 | { |
1554 | maptex tex = self->tex [face]; |
1554 | maptex tex = self->tex [face]; |
1555 | int px = (x + 1) * 32 - tex.w; |
1555 | int px = (x + 1) * T - tex.w; |
1556 | int py = (y + 1) * 32 - tex.h; |
1556 | int py = (y + 1) * T - tex.h; |
1557 | |
1557 | |
1558 | if (last_name != tex.name) |
1558 | if (last_name != tex.name) |
1559 | { |
1559 | { |
1560 | glEnd (); |
1560 | glEnd (); |
1561 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1561 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
… | |
… | |
1571 | if (cell->flags && z == 2) |
1571 | if (cell->flags && z == 2) |
1572 | { |
1572 | { |
1573 | if (cell->flags & 1) |
1573 | if (cell->flags & 1) |
1574 | { |
1574 | { |
1575 | maptex tex = self->tex [1]; |
1575 | maptex tex = self->tex [1]; |
1576 | int px = (x + 1) * 32 - tex.w + 2; |
1576 | int px = (x + 1) * T - tex.w + 2; |
1577 | int py = (y + 1) * 32 - tex.h - 6; |
1577 | int py = (y + 1) * T - tex.h - 6; |
1578 | |
1578 | |
1579 | glEnd (); |
1579 | glEnd (); |
1580 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1580 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1581 | glBegin (GL_QUADS); |
1581 | glBegin (GL_QUADS); |
1582 | |
1582 | |
… | |
… | |
1603 | for (x = 0; x < sw; x++) |
1603 | for (x = 0; x < sw; x++) |
1604 | if (row->c0 <= x + mx && x + mx < row->c1) |
1604 | if (row->c0 <= x + mx && x + mx < row->c1) |
1605 | { |
1605 | { |
1606 | mapcell *cell = row->col + (x + mx - row->c0); |
1606 | mapcell *cell = row->col + (x + mx - row->c0); |
1607 | |
1607 | |
1608 | int px = x * 32; |
1608 | int px = x * T; |
1609 | int py = y * 32; |
1609 | int py = y * T; |
1610 | |
1610 | |
1611 | if (cell->stat_hp) |
1611 | if (cell->stat_hp) |
1612 | { |
1612 | { |
1613 | int width = cell->stat_width * 32; |
1613 | int width = cell->stat_width * T; |
1614 | int thick = sh / 28 + 1 + cell->stat_width; |
1614 | int thick = sh / 28 + 1 + cell->stat_width; |
1615 | |
1615 | |
1616 | glColor3ub (0, 0, 0); |
1616 | glColor3ub (0, 0, 0); |
1617 | glRectf (px + 1, py - thick - 2, |
1617 | glRectf (px + 1, py - thick - 2, |
1618 | px + width - 1, py); |
1618 | px + width - 1, py); |