MCPcopy Create free account
hub / github.com/SimHacker/micropolis / explodeSprite

Method explodeSprite

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:1649–1690  ·  view source on GitHub ↗

* Handle explosion of sprite (mostly due to collision?). * @param sprite that should explode. * @todo Add a 'bus crashed' message to #MessageNumber. */

Source from the content-addressed store, hash-verified

1647 * @todo Add a 'bus crashed' message to #MessageNumber.
1648 */
1649void Micropolis::explodeSprite(SimSprite *sprite)
1650{
1651 int x, y;
1652
1653 sprite->frame = 0;
1654
1655 x = sprite->x + sprite->xHot;
1656 y = sprite->y + sprite->yHot;
1657 makeExplosionAt(x, y);
1658
1659 x = (x >>4);
1660 y = (y >>4);
1661
1662 switch (sprite->type) {
1663
1664 case SPRITE_AIRPLANE:
1665 sendMessage(MESSAGE_PLANE_CRASHED, x, y, true);
1666 break;
1667
1668 case SPRITE_SHIP:
1669 sendMessage(MESSAGE_SHIP_CRASHED, x, y, true);
1670 break;
1671
1672 case SPRITE_TRAIN:
1673 sendMessage(MESSAGE_TRAIN_CRASHED, x, y, true);
1674 break;
1675
1676 case SPRITE_HELICOPTER:
1677 sendMessage(MESSAGE_HELICOPTER_CRASHED, x, y, true);
1678 break;
1679
1680 case SPRITE_BUS:
1681 sendMessage(MESSAGE_TRAIN_CRASHED, x, y, true); /* XXX for now */
1682 break;
1683
1684 }
1685
1686 // Convert sprite coordinates to tile coordinates.
1687 makeSound("city", "ExplosionHigh", x, y); /* explosion */
1688
1689 return;
1690}
1691
1692
1693bool Micropolis::checkWet(int x)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected