mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-06 19:01:06 +03:00

- Fixed AIObject not being initialized ! - Fixed ITEM_DEACTIVATED (cause im french and ITEM_DESACTIVATED is more appropriate)
50 lines
No EOL
1.2 KiB
C++
50 lines
No EOL
1.2 KiB
C++
#include "framework.h"
|
|
#include "tr5_smashobject.h"
|
|
#include "level.h"
|
|
#include "box.h"
|
|
#include "sound.h"
|
|
#include "tomb4fx.h"
|
|
#include "items.h"
|
|
#include "trmath.h"
|
|
|
|
void InitialiseSmashObject(short itemNumber)
|
|
{
|
|
ITEM_INFO* item = &Items[itemNumber];
|
|
item->flags = 0;
|
|
item->meshBits = 1;
|
|
|
|
ROOM_INFO* r = &Rooms[item->roomNumber];
|
|
FLOOR_INFO* floor = &XZ_GET_SECTOR(r, item->pos.xPos - r->x, item->pos.zPos - r->z);
|
|
BOX_INFO* box = &Boxes[floor->box];
|
|
if (box->overlapIndex & END_BIT)
|
|
box->overlapIndex |= BLOCKED;
|
|
}
|
|
|
|
void SmashObject(short itemNumber)
|
|
{
|
|
ITEM_INFO* item = &Items[itemNumber];
|
|
ROOM_INFO* r = &Rooms[item->roomNumber];
|
|
int sector = ((item->pos.zPos - r->z) >> 10) + r->xSize * ((item->pos.xPos - r->x) >> 10);
|
|
|
|
BOX_INFO* box = &Boxes[r->floor[sector].box];
|
|
if (box->overlapIndex & BOX_LAST)
|
|
box->overlapIndex &= ~BOX_BLOCKED;
|
|
|
|
SoundEffect(SFX_SMASH_GLASS, &item->pos, 0);
|
|
|
|
item->collidable = 0;
|
|
item->meshBits = 0xFFFE;
|
|
|
|
ExplodingDeath(itemNumber, -1, 257);
|
|
|
|
item->flags |= IFLAG_INVISIBLE;
|
|
|
|
if (item->status == ITEM_ACTIVE)
|
|
RemoveActiveItem(itemNumber);
|
|
item->status = ITEM_DEACTIVATED;
|
|
}
|
|
|
|
void SmashObjectControl(short itemNumber)
|
|
{
|
|
SmashObject(itemNumber << 16);
|
|
} |