2021-09-30 05:10:30 +02:00
|
|
|
#include "framework.h"
|
|
|
|
#include "Specific/level.h"
|
|
|
|
#include "Game/control/control.h"
|
|
|
|
#include "Game/control/box.h"
|
|
|
|
#include "Game/items.h"
|
|
|
|
#include "Game/control/lot.h"
|
|
|
|
#include "Specific/input.h"
|
|
|
|
#include "Game/Lara/lara_struct.h"
|
2021-12-09 12:48:54 +03:00
|
|
|
#include "Game/Lara/lara_tests.h"
|
2021-09-30 05:10:30 +02:00
|
|
|
#include "Game/Lara/lara.h"
|
|
|
|
#include "Specific/trmath.h"
|
|
|
|
#include "Game/collide.h"
|
|
|
|
#include "Game/sphere.h"
|
|
|
|
|
2021-09-30 12:03:39 +02:00
|
|
|
namespace TEN::Entities::Generic
|
2021-09-30 05:10:30 +02:00
|
|
|
{
|
|
|
|
PHD_VECTOR PolePos = { 0, 0, -208 };
|
|
|
|
PHD_VECTOR PolePosR = { 0, 0, 0 };
|
|
|
|
|
|
|
|
OBJECT_COLLISION_BOUNDS PoleBounds =
|
|
|
|
{
|
|
|
|
-256, 256,
|
|
|
|
0, 0,
|
|
|
|
-512, 512,
|
|
|
|
-ANGLE(10), ANGLE(10),
|
|
|
|
-ANGLE(30), ANGLE(30),
|
|
|
|
-ANGLE(10), ANGLE(10)
|
|
|
|
};
|
|
|
|
|
|
|
|
void PoleCollision(short itemNumber, ITEM_INFO* l, COLL_INFO* coll)
|
|
|
|
{
|
2021-12-09 12:48:54 +03:00
|
|
|
auto item = &g_Level.Items[itemNumber];
|
|
|
|
auto isLara = (!item->data.is<LaraInfo*>());
|
2021-09-30 05:10:30 +02:00
|
|
|
|
2021-12-09 12:48:54 +03:00
|
|
|
if (isLara &&
|
2021-12-09 21:41:28 +11:00
|
|
|
TrInput & IN_ACTION &&
|
2021-12-09 12:48:54 +03:00
|
|
|
!Lara.gunStatus &&
|
2021-12-09 21:41:28 +11:00
|
|
|
l->currentAnimState == LS_IDLE &&
|
2021-12-09 12:48:54 +03:00
|
|
|
l->animNumber == LA_STAND_IDLE || Lara.isMoving &&
|
|
|
|
Lara.interactedItem == itemNumber)
|
2021-09-30 05:10:30 +02:00
|
|
|
{
|
|
|
|
short rot = item->pos.yRot;
|
|
|
|
item->pos.yRot = l->pos.yRot;
|
|
|
|
|
|
|
|
if (TestLaraPosition(&PoleBounds, item, l))
|
|
|
|
{
|
|
|
|
if (MoveLaraPosition(&PolePos, item, l))
|
|
|
|
{
|
|
|
|
l->animNumber = LA_STAND_TO_POLE;
|
|
|
|
l->currentAnimState = LS_POLE_IDLE;
|
|
|
|
l->frameNumber = g_Level.Anims[l->animNumber].frameBase;
|
|
|
|
Lara.isMoving = false;
|
|
|
|
Lara.gunStatus = LG_HANDS_BUSY;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Lara.interactedItem = itemNumber;
|
|
|
|
}
|
|
|
|
item->pos.yRot = rot;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (Lara.isMoving && Lara.interactedItem == itemNumber)
|
|
|
|
{
|
|
|
|
Lara.isMoving = false;
|
2021-11-25 23:38:59 +11:00
|
|
|
Lara.gunStatus = LG_HANDS_FREE;
|
2021-09-30 05:10:30 +02:00
|
|
|
}
|
|
|
|
item->pos.yRot = rot;
|
|
|
|
}
|
|
|
|
}
|
2021-12-09 12:48:54 +03:00
|
|
|
else if (isLara &&
|
|
|
|
TrInput & IN_ACTION &&
|
|
|
|
!Lara.gunStatus &&
|
|
|
|
l->gravityStatus &&
|
|
|
|
l->fallspeed > Lara.gunStatus &&
|
|
|
|
l->currentAnimState == LS_REACH || l->currentAnimState == LS_JUMP_UP)
|
2021-09-30 05:10:30 +02:00
|
|
|
{
|
2021-12-09 12:48:54 +03:00
|
|
|
if (TestBoundsCollide(item, l, 100) &&
|
|
|
|
TestLaraPoleCollision(l, coll, true, -STEP_SIZE) &&
|
|
|
|
TestLaraPoleCollision(l, coll, false))
|
2021-09-30 05:10:30 +02:00
|
|
|
{
|
|
|
|
if (TestCollision(item, l))
|
|
|
|
{
|
|
|
|
short rot = item->pos.yRot;
|
|
|
|
item->pos.yRot = l->pos.yRot;
|
|
|
|
if (l->currentAnimState == LS_REACH)
|
|
|
|
{
|
|
|
|
PolePosR.y = l->pos.yPos - item->pos.yPos + 10;
|
|
|
|
AlignLaraPosition(&PolePosR, item, l);
|
|
|
|
l->animNumber = LA_REACH_TO_POLE;
|
|
|
|
l->frameNumber = g_Level.Anims[l->animNumber].frameBase;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PolePosR.y = l->pos.yPos - item->pos.yPos + 66;
|
|
|
|
AlignLaraPosition(&PolePosR, item, l);
|
|
|
|
l->animNumber = LA_JUMP_UP_TO_POLE;
|
|
|
|
l->frameNumber = g_Level.Anims[l->animNumber].frameBase;
|
|
|
|
}
|
|
|
|
l->gravityStatus = false;
|
|
|
|
l->fallspeed = false;
|
|
|
|
l->currentAnimState = LS_POLE_IDLE;
|
|
|
|
Lara.gunStatus = LG_HANDS_BUSY;
|
|
|
|
item->pos.yRot = rot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-09 12:48:54 +03:00
|
|
|
if (!isLara ||
|
|
|
|
((l->currentAnimState < LS_POLE_IDLE || l->currentAnimState > LS_POLE_TURN_COUNTER_CLOCKWISE) && l->currentAnimState != LS_JUMP_BACK))
|
2021-09-30 05:10:30 +02:00
|
|
|
ObjectCollision(itemNumber, l, coll);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|