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 | |
… | |
… | |
154 | |
155 | |
155 | *w = rect.width; |
156 | *w = rect.width; |
156 | *h = rect.height; |
157 | *h = rect.height; |
157 | } |
158 | } |
158 | |
159 | |
|
|
160 | typedef uint16_t tileid; |
159 | typedef uint16_t mapface; |
161 | typedef uint16_t faceid; |
160 | |
162 | |
161 | typedef struct { |
163 | typedef struct { |
162 | GLint name; |
164 | int name; |
163 | int w, h; |
165 | int w, h; |
164 | float s, t; |
166 | float s, t; |
165 | uint8_t r, g, b, a; |
167 | uint8_t r, g, b, a; |
166 | } maptex; |
168 | } maptex; |
167 | |
169 | |
168 | typedef struct { |
170 | typedef struct { |
169 | uint32_t player; |
171 | uint32_t player; |
170 | mapface face[3]; |
172 | tileid tile[3]; |
171 | uint16_t darkness; |
173 | uint16_t darkness; |
172 | uint8_t stat_width, stat_hp, flags; |
174 | uint8_t stat_width, stat_hp, flags; |
173 | } mapcell; |
175 | } mapcell; |
174 | |
176 | |
175 | typedef struct { |
177 | typedef struct { |
… | |
… | |
178 | } maprow; |
180 | } maprow; |
179 | |
181 | |
180 | typedef struct map { |
182 | typedef struct map { |
181 | int x, y, w, h; |
183 | int x, y, w, h; |
182 | int ox, oy; /* offset to virtual global coordinate system */ |
184 | int ox, oy; /* offset to virtual global coordinate system */ |
183 | int faces; |
185 | int faces; tileid *face2tile; // [faceid] |
184 | mapface *face; |
186 | int texs; maptex *tex; // [tileid] |
185 | |
|
|
186 | int texs; |
|
|
187 | maptex *tex; |
|
|
188 | |
187 | |
189 | int32_t rows; |
188 | int32_t rows; |
190 | maprow *row; |
189 | maprow *row; |
191 | } *CFPlus__Map; |
190 | } *CFPlus__Map; |
192 | |
191 | |
… | |
… | |
212 | return ptr; |
211 | return ptr; |
213 | } |
212 | } |
214 | |
213 | |
215 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
214 | #define Append(type,ptr,sze,inc) (ptr) = (type *)append ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
216 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
215 | #define Prepend(type,ptr,sze,inc) (ptr) = (type *)prepend ((char *)ptr, (sze) * sizeof (type), (inc) * sizeof (type)) |
|
|
216 | |
|
|
217 | static void |
|
|
218 | need_facenum (struct map *self, faceid face) |
|
|
219 | { |
|
|
220 | while (self->faces <= face) |
|
|
221 | { |
|
|
222 | Append (tileid, self->face2tile, self->faces, self->faces); |
|
|
223 | self->faces *= 2; |
|
|
224 | } |
|
|
225 | } |
|
|
226 | |
|
|
227 | static void |
|
|
228 | need_texid (struct map *self, int texid) |
|
|
229 | { |
|
|
230 | while (self->texs <= texid) |
|
|
231 | { |
|
|
232 | Append (maptex, self->tex, self->texs, self->texs); |
|
|
233 | self->texs *= 2; |
|
|
234 | } |
|
|
235 | } |
217 | |
236 | |
218 | static maprow * |
237 | static maprow * |
219 | map_get_row (CFPlus__Map self, int y) |
238 | map_get_row (CFPlus__Map self, int y) |
220 | { |
239 | { |
221 | if (0 > y) |
240 | if (0 > y) |
… | |
… | |
492 | |
511 | |
493 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
512 | assert (SDLK_MODIFIER_MIN == SDLK_NUMLOCK); |
494 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
513 | assert (SDLK_MODIFIER_MAX == SDLK_COMPOSE); |
495 | } |
514 | } |
496 | |
515 | |
|
|
516 | void |
|
|
517 | weaken (SV *rv) |
|
|
518 | PROTOTYPE: $ |
|
|
519 | CODE: |
|
|
520 | sv_rvweaken (rv); |
|
|
521 | |
497 | int |
522 | int |
498 | in_destruct () |
523 | in_destruct () |
499 | CODE: |
524 | CODE: |
500 | RETVAL = PL_main_cv == Nullcv; |
525 | RETVAL = PL_main_cv == Nullcv; |
501 | OUTPUT: |
526 | OUTPUT: |
… | |
… | |
1233 | RETVAL->y = 0; |
1258 | RETVAL->y = 0; |
1234 | RETVAL->w = 0; |
1259 | RETVAL->w = 0; |
1235 | RETVAL->h = 0; |
1260 | RETVAL->h = 0; |
1236 | RETVAL->ox = 0; |
1261 | RETVAL->ox = 0; |
1237 | RETVAL->oy = 0; |
1262 | RETVAL->oy = 0; |
1238 | RETVAL->faces = 8192; |
1263 | RETVAL->faces = 8192; Newz (0, RETVAL->face2tile, RETVAL->faces, tileid); |
1239 | Newz (0, RETVAL->face, RETVAL->faces, mapface); |
1264 | RETVAL->texs = 8192; Newz (0, RETVAL->tex , RETVAL->texs , maptex); |
1240 | RETVAL->texs = 8192; |
|
|
1241 | Newz (0, RETVAL->tex, RETVAL->texs, maptex); |
|
|
1242 | RETVAL->rows = 0; |
1265 | RETVAL->rows = 0; |
1243 | RETVAL->row = 0; |
1266 | RETVAL->row = 0; |
1244 | OUTPUT: |
1267 | OUTPUT: |
1245 | RETVAL |
1268 | RETVAL |
1246 | |
1269 | |
1247 | void |
1270 | void |
1248 | DESTROY (CFPlus::Map self) |
1271 | DESTROY (CFPlus::Map self) |
1249 | CODE: |
1272 | CODE: |
1250 | { |
1273 | { |
1251 | map_clear (self); |
1274 | map_clear (self); |
1252 | Safefree (self->face); |
1275 | Safefree (self->face2tile); |
1253 | Safefree (self->tex); |
1276 | Safefree (self->tex); |
1254 | Safefree (self); |
1277 | Safefree (self); |
1255 | } |
1278 | } |
1256 | |
1279 | |
1257 | void |
1280 | void |
… | |
… | |
1264 | clear (CFPlus::Map self) |
1287 | clear (CFPlus::Map self) |
1265 | CODE: |
1288 | CODE: |
1266 | map_clear (self); |
1289 | map_clear (self); |
1267 | |
1290 | |
1268 | void |
1291 | void |
1269 | set_face (CFPlus::Map self, int face, int texid) |
1292 | set_tileid (CFPlus::Map self, int face, int tile) |
1270 | CODE: |
1293 | CODE: |
1271 | { |
1294 | { |
1272 | while (self->faces <= face) |
1295 | need_facenum (self, face); self->face2tile [face] = tile; |
1273 | { |
1296 | need_texid (self, tile); |
1274 | Append (mapface, self->face, self->faces, self->faces); |
|
|
1275 | self->faces *= 2; |
|
|
1276 | } |
|
|
1277 | |
|
|
1278 | self->face [face] = texid; |
|
|
1279 | } |
1297 | } |
1280 | |
1298 | |
1281 | void |
1299 | void |
1282 | set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1300 | set_texture (CFPlus::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) |
1283 | CODE: |
1301 | CODE: |
1284 | { |
1302 | { |
1285 | while (self->texs <= texid) |
1303 | need_texid (self, texid); |
1286 | { |
|
|
1287 | Append (maptex, self->tex, self->texs, self->texs); |
|
|
1288 | self->texs *= 2; |
|
|
1289 | } |
|
|
1290 | |
1304 | |
1291 | { |
1305 | { |
1292 | maptex *tex = self->tex + texid; |
1306 | maptex *tex = self->tex + texid; |
1293 | |
1307 | |
1294 | tex->name = name; |
1308 | tex->name = name; |
… | |
… | |
1405 | cell->stat_width = 1; |
1419 | cell->stat_width = 1; |
1406 | cell->stat_hp = *data++; |
1420 | cell->stat_hp = *data++; |
1407 | } |
1421 | } |
1408 | else if (cmd == 6) // monster width |
1422 | else if (cmd == 6) // monster width |
1409 | cell->stat_width = *data++ + 1; |
1423 | cell->stat_width = *data++ + 1; |
1410 | else if (cmd == 0x47) // monster width |
1424 | else if (cmd == 0x47) |
1411 | { |
1425 | { |
1412 | if (*data == 4) |
1426 | if (*data == 8) |
1413 | ; // decode player tag |
1427 | ; // decode player uuid |
1414 | |
1428 | |
1415 | data += *data + 1; |
1429 | data += *data + 1; |
1416 | } |
1430 | } |
1417 | else if (cmd == 8) // cell flags |
1431 | else if (cmd == 8) // cell flags |
1418 | cell->flags = *data++; |
1432 | cell->flags = *data++; |
… | |
… | |
1427 | cell->darkness = *data++ + 1; |
1441 | cell->darkness = *data++ + 1; |
1428 | } |
1442 | } |
1429 | |
1443 | |
1430 | if (flags & 4) |
1444 | if (flags & 4) |
1431 | { |
1445 | { |
1432 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1446 | faceid face = (data [0] << 8) + data [1]; data += 2; |
|
|
1447 | need_facenum (self, face); |
|
|
1448 | cell->tile [0] = self->face2tile [face]; |
1433 | } |
1449 | } |
1434 | |
1450 | |
1435 | if (flags & 2) |
1451 | if (flags & 2) |
1436 | { |
1452 | { |
1437 | cell->face [1] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1453 | faceid face = (data [0] << 8) + data [1]; data += 2; |
|
|
1454 | need_facenum (self, face); |
|
|
1455 | cell->tile [1] = self->face2tile [face]; |
1438 | } |
1456 | } |
1439 | |
1457 | |
1440 | if (flags & 1) |
1458 | if (flags & 1) |
1441 | { |
1459 | { |
1442 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1460 | faceid face = (data [0] << 8) + data [1]; data += 2; |
|
|
1461 | need_facenum (self, face); |
|
|
1462 | cell->tile [2] = self->face2tile [face]; |
1443 | } |
1463 | } |
1444 | } |
1464 | } |
1445 | else |
1465 | else |
1446 | cell->darkness = 0; |
1466 | cell->darkness = 0; |
1447 | } |
1467 | } |
… | |
… | |
1477 | { |
1497 | { |
1478 | mapcell *cell = row->col + (x - row->c0); |
1498 | mapcell *cell = row->col + (x - row->c0); |
1479 | |
1499 | |
1480 | for (z = 0; z <= 0; z++) |
1500 | for (z = 0; z <= 0; z++) |
1481 | { |
1501 | { |
1482 | mapface face = cell->face [z]; |
|
|
1483 | |
|
|
1484 | if (face) |
|
|
1485 | { |
|
|
1486 | maptex tex = self->tex [face]; |
1502 | maptex tex = self->tex [cell->tile [z]]; |
1487 | int a0 = 255 - tex.a; |
1503 | int a0 = 255 - tex.a; |
1488 | int a1 = tex.a; |
1504 | int a1 = tex.a; |
1489 | |
1505 | |
1490 | r = (r * a0 + tex.r * a1) / 255; |
1506 | r = (r * a0 + tex.r * a1) / 255; |
1491 | g = (g * a0 + tex.g * a1) / 255; |
1507 | g = (g * a0 + tex.g * a1) / 255; |
1492 | b = (b * a0 + tex.b * a1) / 255; |
1508 | b = (b * a0 + tex.b * a1) / 255; |
1493 | a = (a * a0 + tex.a * a1) / 255; |
1509 | a = (a * a0 + tex.a * a1) / 255; |
1494 | } |
|
|
1495 | } |
1510 | } |
1496 | } |
1511 | } |
1497 | |
1512 | |
1498 | *map++ = (r ) |
1513 | *map++ = (r ) |
1499 | | (g << 8) |
1514 | | (g << 8) |
… | |
… | |
1506 | } |
1521 | } |
1507 | OUTPUT: |
1522 | OUTPUT: |
1508 | RETVAL |
1523 | RETVAL |
1509 | |
1524 | |
1510 | void |
1525 | void |
1511 | draw (CFPlus::Map self, int mx, int my, int sw, int sh) |
1526 | draw (CFPlus::Map self, int mx, int my, int sw, int sh, int T) |
1512 | CODE: |
1527 | CODE: |
1513 | { |
1528 | { |
1514 | int x, y, z; |
1529 | int x, y, z; |
1515 | int last_name; |
1530 | int last_name; |
1516 | mapface face; |
|
|
1517 | |
1531 | |
1518 | glColor4ub (255, 255, 255, 255); |
1532 | glColor4ub (255, 255, 255, 255); |
1519 | |
1533 | |
1520 | glEnable (GL_BLEND); |
1534 | glEnable (GL_BLEND); |
1521 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
1535 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
… | |
… | |
1537 | |
1551 | |
1538 | for (x = 0; x < sw; x++) |
1552 | for (x = 0; x < sw; x++) |
1539 | if (row->c0 <= x + mx && x + mx < row->c1) |
1553 | if (row->c0 <= x + mx && x + mx < row->c1) |
1540 | { |
1554 | { |
1541 | mapcell *cell = row->col + (x + mx - row->c0); |
1555 | mapcell *cell = row->col + (x + mx - row->c0); |
1542 | |
|
|
1543 | face = cell->face [z]; |
1556 | tileid tile = cell->tile [z]; |
1544 | |
1557 | |
1545 | if (face && face < self->texs) |
1558 | if (tile) |
1546 | { |
1559 | { |
1547 | maptex tex = self->tex [face]; |
1560 | maptex tex = self->tex [tile]; |
1548 | int px = (x + 1) * 32 - tex.w; |
1561 | int px = (x + 1) * T - tex.w; |
1549 | int py = (y + 1) * 32 - tex.h; |
1562 | int py = (y + 1) * T - tex.h; |
1550 | |
1563 | |
1551 | if (last_name != tex.name) |
1564 | if (last_name != tex.name) |
1552 | { |
1565 | { |
|
|
1566 | if (!tex.name) |
|
|
1567 | tex = self->tex [2]; /* missing, replace by noface */ |
|
|
1568 | |
1553 | glEnd (); |
1569 | glEnd (); |
1554 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1570 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1555 | glBegin (GL_QUADS); |
1571 | glBegin (GL_QUADS); |
1556 | } |
1572 | } |
1557 | |
1573 | |
1558 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1574 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1559 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
1575 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
1560 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
1576 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
1561 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
1577 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
1562 | } |
|
|
1563 | |
1578 | |
1564 | if (cell->flags && z == 2) |
1579 | if (cell->flags && z == 2) |
1565 | { |
|
|
1566 | if (cell->flags & 1) |
|
|
1567 | { |
1580 | { |
|
|
1581 | if (cell->flags & 1) |
|
|
1582 | { |
1568 | maptex tex = self->tex [1]; |
1583 | maptex tex = self->tex [1]; |
1569 | int px = (x + 1) * 32 - tex.w + 2; |
1584 | int px = x * T + T * 2 / 32; |
1570 | int py = (y + 1) * 32 - tex.h - 6; |
1585 | int py = y * T - T * 6 / 32; |
1571 | |
1586 | |
1572 | glEnd (); |
1587 | glEnd (); |
1573 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1588 | glBindTexture (GL_TEXTURE_2D, last_name = tex.name); |
1574 | glBegin (GL_QUADS); |
1589 | glBegin (GL_QUADS); |
1575 | |
1590 | |
1576 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1591 | glTexCoord2f (0 , 0 ); glVertex2f (px , py ); |
1577 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + tex.h); |
1592 | glTexCoord2f (0 , tex.t); glVertex2f (px , py + T); |
1578 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + tex.w, py + tex.h); |
1593 | glTexCoord2f (tex.s, tex.t); glVertex2f (px + T, py + T); |
1579 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + tex.w, py ); |
1594 | glTexCoord2f (tex.s, 0 ); glVertex2f (px + T, py ); |
|
|
1595 | } |
1580 | } |
1596 | } |
1581 | } |
1597 | } |
1582 | } |
1598 | } |
1583 | } |
1599 | } |
1584 | |
1600 | |
… | |
… | |
1596 | for (x = 0; x < sw; x++) |
1612 | for (x = 0; x < sw; x++) |
1597 | if (row->c0 <= x + mx && x + mx < row->c1) |
1613 | if (row->c0 <= x + mx && x + mx < row->c1) |
1598 | { |
1614 | { |
1599 | mapcell *cell = row->col + (x + mx - row->c0); |
1615 | mapcell *cell = row->col + (x + mx - row->c0); |
1600 | |
1616 | |
1601 | int px = x * 32; |
1617 | int px = x * T; |
1602 | int py = y * 32; |
1618 | int py = y * T; |
1603 | |
1619 | |
1604 | if (cell->stat_hp) |
1620 | if (cell->stat_hp) |
1605 | { |
1621 | { |
1606 | int width = cell->stat_width * 32; |
1622 | int width = cell->stat_width * T; |
1607 | int thick = sh / 28 + 1 + cell->stat_width; |
1623 | int thick = (sh * T / 32 + 27) / 28 + 1 + cell->stat_width; |
1608 | |
1624 | |
1609 | glColor3ub (0, 0, 0); |
1625 | glColor3ub (0, 0, 0); |
1610 | glRectf (px + 1, py - thick - 2, |
1626 | glRectf (px + 1, py - thick - 2, |
1611 | px + width - 1, py); |
1627 | px + width - 1, py); |
1612 | |
1628 | |
… | |
… | |
1751 | if (row && row->c0 <= x && x < row->c1) |
1767 | if (row && row->c0 <= x && x < row->c1) |
1752 | { |
1768 | { |
1753 | mapcell *cell = row->col + (x - row->c0); |
1769 | mapcell *cell = row->col + (x - row->c0); |
1754 | uint8_t flags = 0; |
1770 | uint8_t flags = 0; |
1755 | |
1771 | |
1756 | if (cell->face [0]) flags |= 1; |
1772 | if (cell->tile [0]) flags |= 1; |
1757 | if (cell->face [1]) flags |= 2; |
1773 | if (cell->tile [1]) flags |= 2; |
1758 | if (cell->face [2]) flags |= 4; |
1774 | if (cell->tile [2]) flags |= 4; |
1759 | |
1775 | |
1760 | *data++ = flags; |
1776 | *data++ = flags; |
1761 | |
1777 | |
1762 | if (flags & 1) |
1778 | if (flags & 1) |
1763 | { |
1779 | { |
|
|
1780 | tileid tile = cell->tile [0]; |
1764 | *data++ = cell->face [0] >> 8; |
1781 | *data++ = tile >> 8; |
1765 | *data++ = cell->face [0]; |
1782 | *data++ = tile; |
1766 | } |
1783 | } |
1767 | |
1784 | |
1768 | if (flags & 2) |
1785 | if (flags & 2) |
1769 | { |
1786 | { |
|
|
1787 | tileid tile = cell->tile [1]; |
1770 | *data++ = cell->face [1] >> 8; |
1788 | *data++ = tile >> 8; |
1771 | *data++ = cell->face [1]; |
1789 | *data++ = tile; |
1772 | } |
1790 | } |
1773 | |
1791 | |
1774 | if (flags & 4) |
1792 | if (flags & 4) |
1775 | { |
1793 | { |
|
|
1794 | tileid tile = cell->tile [2]; |
1776 | *data++ = cell->face [2] >> 8; |
1795 | *data++ = tile >> 8; |
1777 | *data++ = cell->face [2]; |
1796 | *data++ = tile; |
1778 | } |
1797 | } |
1779 | } |
1798 | } |
1780 | else |
1799 | else |
1781 | *data++ = 0; |
1800 | *data++ = 0; |
1782 | } |
1801 | } |
… | |
… | |
1822 | { |
1841 | { |
1823 | uint8_t flags = *data++; |
1842 | uint8_t flags = *data++; |
1824 | |
1843 | |
1825 | if (flags) |
1844 | if (flags) |
1826 | { |
1845 | { |
1827 | mapface face[3] = { 0, 0, 0 }; |
|
|
1828 | |
|
|
1829 | mapcell *cell = row_get_cell (row, x); |
1846 | mapcell *cell = row_get_cell (row, x); |
|
|
1847 | tileid tile[3] = { 0, 0, 0 }; |
1830 | |
1848 | |
1831 | if (flags & 1) { face[0] = *data++ << 8; face[0] |= *data++; } |
1849 | if (flags & 1) { tile[0] = *data++ << 8; tile[0] |= *data++; } |
1832 | if (flags & 2) { face[1] = *data++ << 8; face[1] |= *data++; } |
1850 | if (flags & 2) { tile[1] = *data++ << 8; tile[1] |= *data++; } |
1833 | if (flags & 4) { face[2] = *data++ << 8; face[2] |= *data++; } |
1851 | if (flags & 4) { tile[2] = *data++ << 8; tile[2] |= *data++; } |
1834 | |
1852 | |
1835 | if (cell->darkness == 0) |
1853 | if (cell->darkness == 0) |
1836 | { |
1854 | { |
1837 | cell->darkness = 0; |
1855 | cell->darkness = 0; |
1838 | |
1856 | |
1839 | for (z = 0; z <= 2; z++) |
1857 | for (z = 0; z <= 2; z++) |
1840 | { |
1858 | { |
1841 | cell->face[z] = face[z]; |
1859 | tileid t = tile [z]; |
1842 | |
1860 | |
1843 | if (face[z] && (face[z] >= self->texs || !self->tex[face [z]].name)) |
1861 | if (t >= self->texs || !self->tex [t].name) |
|
|
1862 | { |
1844 | XPUSHs (sv_2mortal (newSViv (face[z]))); |
1863 | XPUSHs (sv_2mortal (newSViv (t))); |
|
|
1864 | need_texid (self, t); |
|
|
1865 | } |
|
|
1866 | |
|
|
1867 | cell->tile [z] = t; |
1845 | } |
1868 | } |
1846 | } |
1869 | } |
1847 | } |
1870 | } |
1848 | } |
1871 | } |
1849 | } |
1872 | } |