| 30 | } |
| 31 | |
| 32 | void SmashObject(short itemNumber) |
| 33 | { |
| 34 | auto* item = &g_Level.Items[itemNumber]; |
| 35 | auto* room = &g_Level.Rooms[item->RoomNumber]; |
| 36 | |
| 37 | int sectorX = (item->Pose.Position.x - room->Position.x) / BLOCK(1); |
| 38 | int sectorZ = (item->Pose.Position.z - room->Position.z) / BLOCK(1); |
| 39 | |
| 40 | if (sectorX >= 0 && sectorX < room->XSize && sectorZ >= 0 && sectorZ < room->ZSize) |
| 41 | { |
| 42 | int sectorIndex = sectorZ + room->ZSize * sectorX; |
| 43 | |
| 44 | if (room->Sectors[sectorIndex].PathfindingBoxID != NO_VALUE) |
| 45 | { |
| 46 | auto* box = &g_Level.PathfindingBoxes[room->Sectors[sectorIndex].PathfindingBoxID]; |
| 47 | if (box->flags & BLOCKABLE) |
| 48 | box->flags &= ~BLOCKED; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | SoundEffect(SFX_TR5_SMASH_GLASS, &item->Pose); |
| 53 | |
| 54 | item->Collidable = false; |
| 55 | item->MeshBits = 0xFFFE; |
| 56 | |
| 57 | ExplodingDeath(itemNumber, BODY_DO_EXPLOSION | BODY_NO_BOUNCE); |
| 58 | |
| 59 | item->Flags |= IFLAG_INVISIBLE; |
| 60 | |
| 61 | if (item->Status == ITEM_ACTIVE) |
| 62 | RemoveActiveItem(itemNumber); |
| 63 | |
| 64 | item->Status = ITEM_DEACTIVATED; |
| 65 | } |
| 66 | |
| 67 | void SmashObjectControl(short itemNumber) |
| 68 | { |
no test coverage detected