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"
|
2021-09-11 10:13:04 +03:00
|
|
|
#include "pickup.h"
|
2020-05-30 15:55:23 +02:00
|
|
|
#include "setup.h"
|
2021-05-30 13:18:39 -05:00
|
|
|
#include "health.h"
|
2020-05-30 15:55:23 +02:00
|
|
|
|
|
|
|
static PHD_VECTOR SarcophagusPosition(0, 0, -300);
|
2021-10-27 19:00:30 +03:00
|
|
|
OBJECT_COLLISION_BOUNDS SarcophagusBounds =
|
|
|
|
{ -512, 512, -100, 100, -512, 0, ANGLE(-10), ANGLE(10), ANGLE(-30), ANGLE(30), 0, 0 };
|
2020-05-30 15:55:23 +02:00
|
|
|
|
|
|
|
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 ||
|
2021-09-05 11:18:37 +02:00
|
|
|
Lara.isMoving && Lara.interactedItem == itemNum)
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
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
|
|
|
|
{
|
2021-09-05 11:18:37 +02:00
|
|
|
Lara.interactedItem = itemNum;
|
2020-05-30 15:55:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Lara.isMoving)
|
|
|
|
{
|
2021-09-05 11:18:37 +02:00
|
|
|
if (Lara.interactedItem == itemNum)
|
2020-05-30 15:55:23 +02:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2021-07-10 17:46:45 +01:00
|
|
|
PickedUpObject(static_cast<GAME_OBJECT_ID>(currentItem->objectNumber), 0);
|
2020-05-30 15:55:23 +02:00
|
|
|
currentItem->status = ITEM_ACTIVE;
|
|
|
|
currentItem->itemFlags[3] = 1;
|
2021-05-30 13:18:39 -05:00
|
|
|
AddDisplayPickup(currentItem->objectNumber);
|
2020-05-30 15:55:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|