… | |
… | |
1351 | * look like. |
1351 | * look like. |
1352 | */ |
1352 | */ |
1353 | void |
1353 | void |
1354 | draw_client_map1 (object *pl) |
1354 | draw_client_map1 (object *pl) |
1355 | { |
1355 | { |
1356 | int x, y, ax, ay, d, startlen, max_x, max_y, oldlen; |
1356 | int x, y, ax, ay, startlen, max_x, max_y, oldlen; |
1357 | sint16 nx, ny; |
1357 | sint16 nx, ny; |
1358 | int estartlen, eoldlen; |
1358 | int estartlen, eoldlen; |
1359 | uint16 mask, emask; |
|
|
1360 | uint8 eentrysize; |
1359 | uint8 eentrysize; |
1361 | uint16 ewhatstart, ewhatflag; |
1360 | uint16 ewhatstart, ewhatflag; |
1362 | uint8 extendedinfos; |
1361 | uint8 extendedinfos; |
1363 | maptile *m; |
1362 | maptile *m; |
1364 | |
1363 | |
… | |
… | |
1415 | for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++) |
1414 | for (y = pl->y - socket.mapy / 2; y < max_y; y++, ay++) |
1416 | { |
1415 | { |
1417 | ax = 0; |
1416 | ax = 0; |
1418 | for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++) |
1417 | for (x = pl->x - socket.mapx / 2; x < max_x; x++, ax++) |
1419 | { |
1418 | { |
|
|
1419 | int emask, mask; |
1420 | emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
1420 | emask = mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
1421 | |
1421 | |
1422 | MapCell &lastcell = socket.lastmap.cells[ax][ay]; |
1422 | MapCell &lastcell = socket.lastmap.cells[ax][ay]; |
1423 | |
|
|
1424 | d = pl->contr->blocked_los[ax][ay]; |
|
|
1425 | |
1423 | |
1426 | /* If the coordinates are not valid, or it is too dark to see, |
1424 | /* If the coordinates are not valid, or it is too dark to see, |
1427 | * we tell the client as such |
1425 | * we tell the client as such |
1428 | */ |
1426 | */ |
1429 | nx = x; |
1427 | nx = x; |
… | |
… | |
1439 | if (lastcell.count != -1) |
1437 | if (lastcell.count != -1) |
1440 | { |
1438 | { |
1441 | sl << uint16 (mask); |
1439 | sl << uint16 (mask); |
1442 | map_clearcell (&lastcell, -1); |
1440 | map_clearcell (&lastcell, -1); |
1443 | } |
1441 | } |
|
|
1442 | |
|
|
1443 | continue; |
1444 | } |
1444 | } |
|
|
1445 | |
|
|
1446 | m->touch (); |
|
|
1447 | |
|
|
1448 | int d = pl->contr->blocked_los[ax][ay]; |
|
|
1449 | |
1445 | else if (d > 3) |
1450 | if (d > 3) |
1446 | { |
1451 | { |
1447 | m->touch (); |
|
|
1448 | |
1452 | |
1449 | int need_send = 0, count; |
1453 | int need_send = 0, count; |
1450 | |
1454 | |
1451 | /* This block deals with spaces that are not visible for whatever |
1455 | /* This block deals with spaces that are not visible for whatever |
1452 | * reason. Still may need to send the head for this space. |
1456 | * reason. Still may need to send the head for this space. |
… | |
… | |
1460 | need_send = 1; |
1464 | need_send = 1; |
1461 | |
1465 | |
1462 | count = -1; |
1466 | count = -1; |
1463 | |
1467 | |
1464 | /* properly clear a previously sent big face */ |
1468 | /* properly clear a previously sent big face */ |
1465 | if (lastcell.faces[0] != 0 || lastcell.faces[1] != 0 || lastcell.faces[2] != 0 |
1469 | if (lastcell.faces[0] || lastcell.faces[1] || lastcell.faces[2] |
1466 | || lastcell.stat_hp || lastcell.flags || lastcell.player) |
1470 | || lastcell.stat_hp || lastcell.flags || lastcell.player) |
1467 | need_send = 1; |
1471 | need_send = 1; |
1468 | |
1472 | |
1469 | map_clearcell (&lastcell, count); |
1473 | map_clearcell (&lastcell, count); |
1470 | |
1474 | |
… | |
… | |
1473 | else |
1477 | else |
1474 | sl.reset (oldlen); |
1478 | sl.reset (oldlen); |
1475 | } |
1479 | } |
1476 | else |
1480 | else |
1477 | { |
1481 | { |
1478 | m->touch (); |
|
|
1479 | |
|
|
1480 | /* In this block, the space is visible. |
1482 | /* In this block, the space is visible. |
1481 | */ |
1483 | */ |
1482 | |
1484 | |
1483 | /* Rather than try to figure out what everything that we might |
1485 | /* Rather than try to figure out what everything that we might |
1484 | * need to send is, then form the packet after that, |
1486 | * need to send is, then form the packet after that, |
… | |
… | |
1488 | * is done. |
1490 | * is done. |
1489 | * I think this is simpler than doing a bunch of checks to see |
1491 | * I think this is simpler than doing a bunch of checks to see |
1490 | * what if anything we need to send, setting the bits, then |
1492 | * what if anything we need to send, setting the bits, then |
1491 | * doing those checks again to add the real data. |
1493 | * doing those checks again to add the real data. |
1492 | */ |
1494 | */ |
1493 | oldlen = sl.length (); |
1495 | oldlen = sl.length (); |
1494 | mask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
|
|
1495 | eoldlen = esl.length (); |
1496 | eoldlen = esl.length (); |
1496 | emask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4; |
1497 | |
1497 | sl << uint16 (mask); |
1498 | sl << uint16 (mask); |
1498 | |
1499 | |
1499 | if (socket.ext_mapinfos) |
1500 | if (socket.ext_mapinfos) |
1500 | esl << uint16 (emask); |
1501 | esl << uint16 (emask); |
1501 | |
1502 | |
… | |
… | |
1654 | if (!(sl.length () > startlen || socket.sent_scroll)) |
1655 | if (!(sl.length () > startlen || socket.sent_scroll)) |
1655 | { |
1656 | { |
1656 | /* No map data will follow, so don't say the client |
1657 | /* No map data will follow, so don't say the client |
1657 | * it doesn't need draw! |
1658 | * it doesn't need draw! |
1658 | */ |
1659 | */ |
1659 | ewhatflag &= (~EMI_NOREDRAW); |
1660 | ewhatflag &= ~EMI_NOREDRAW; |
1660 | esl[ewhatstart + 1] = ewhatflag & 0xff; |
1661 | esl[ewhatstart + 1] = ewhatflag & 0xff; |
1661 | } |
1662 | } |
1662 | |
1663 | |
1663 | if (esl.length () > estartlen) |
1664 | if (esl.length () > estartlen) |
1664 | socket.send_packet (esl); |
1665 | socket.send_packet (esl); |