2020-05-30 15:55:23 +02:00
|
|
|
#include "framework.h"
|
|
|
|
#include "tr4_sarcophagus.h"
|
|
|
|
#include "level.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "lara.h"
|
|
|
|
#include "items.h"
|
|
|
|
#include "pickup.h"
|
|
|
|
#include "setup.h"
|
|
|
|
|
2020-07-25 18:02:35 +02:00
|
|
|
OBJECT_COLLISION_BOUNDS SarcophagusBounds =
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
0xFE00, 512, 0xFF9C, 100, 0xFE00, 0,
|
|
|
|
0xF8E4, 1820, 0xEAAC, 5460, 0, 0
|
|
|
|
};
|
|
|
|
static PHD_VECTOR SarcophagusPosition(0, 0, -300);
|
|
|
|
|
|
|
|
void InitialiseSarcophagus(short itemNum)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void SarcophagusCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
|
|
|
{
|
2020-07-21 09:56:47 +02:00
|
|
|
ITEM_INFO* item = &g_Level.Items[itemNum];
|
2020-05-30 15:55:23 +02:00
|
|
|
|
|
|
|
if (TrInput & IN_ACTION &&
|
|
|
|
item->status != ITEM_ACTIVE &&
|
2020-08-04 20:32:07 +10:00
|
|
|
l->currentAnimState == LS_STOP &&
|
|
|
|
l->animNumber == LA_STAND_IDLE &&
|
2020-05-30 15:55:23 +02:00
|
|
|
Lara.gunStatus == LG_NO_ARMS ||
|
|
|
|
Lara.isMoving && (short)Lara.generalPtr == itemNum)
|
|
|
|
{
|
2020-07-25 18:02:35 +02:00
|
|
|
if (TestLaraPosition(&SarcophagusBounds, item, l))
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
if (MoveLaraPosition(&SarcophagusPosition, item, l))
|
|
|
|
{
|
2020-08-04 20:32:07 +10:00
|
|
|
l->animNumber = LA_PICKUP_SARCOPHAGUS;
|
|
|
|
l->currentAnimState = LS_MISC_CONTROL;
|
2020-07-21 09:56:47 +02:00
|
|
|
l->frameNumber = g_Level.Anims[l->animNumber].frameBase;
|
2020-05-30 15:55:23 +02:00
|
|
|
item->flags |= IFLAG_ACTIVATION_MASK;
|
|
|
|
|
|
|
|
AddActiveItem(itemNum);
|
|
|
|
item->status = ITEM_ACTIVE;
|
|
|
|
|
|
|
|
Lara.isMoving = false;
|
|
|
|
Lara.headYrot = 0;
|
|
|
|
Lara.headXrot = 0;
|
|
|
|
Lara.torsoYrot = 0;
|
|
|
|
Lara.torsoXrot = 0;
|
|
|
|
Lara.gunStatus = LG_HANDS_BUSY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.generalPtr = (void*)itemNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Lara.isMoving)
|
|
|
|
{
|
|
|
|
if ((short)Lara.generalPtr == itemNum)
|
|
|
|
{
|
|
|
|
Lara.isMoving = false;
|
|
|
|
Lara.gunStatus = LG_NO_ARMS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 20:32:07 +10:00
|
|
|
else if (l->animNumber != LA_PICKUP_SARCOPHAGUS || l->frameNumber != g_Level.Anims[LA_PICKUP_SARCOPHAGUS].frameBase + 113)
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
ObjectCollision(itemNum, l, coll);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
short linknum;
|
2020-07-21 09:56:47 +02:00
|
|
|
for (linknum = g_Level.Items[g_Level.Rooms[item->roomNumber].itemNumber].nextItem; linknum != NO_ITEM; linknum = g_Level.Items[linknum].nextItem)
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
2020-07-21 09:56:47 +02:00
|
|
|
ITEM_INFO* currentItem = &g_Level.Items[linknum];
|
2020-05-30 15:55:23 +02:00
|
|
|
|
|
|
|
if (linknum != itemNum && currentItem->pos.xPos == item->pos.xPos && currentItem->pos.zPos == item->pos.zPos)
|
|
|
|
{
|
|
|
|
if (Objects[currentItem->objectNumber].isPickup)
|
|
|
|
{
|
|
|
|
PickedUpObject(currentItem->objectNumber);
|
|
|
|
currentItem->status = ITEM_ACTIVE;
|
|
|
|
currentItem->itemFlags[3] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|