2021-08-25 09:42:17 +02:00
|
|
|
#include "framework.h"
|
|
|
|
#include "jump_switch.h"
|
2021-09-19 23:41:26 +03:00
|
|
|
#include "control/control.h"
|
2021-08-25 09:42:17 +02:00
|
|
|
#include "input.h"
|
|
|
|
#include "lara.h"
|
|
|
|
#include "generic_switch.h"
|
2021-08-31 17:37:15 +02:00
|
|
|
#include "level.h"
|
2021-09-11 05:38:26 +02:00
|
|
|
#include "collide.h"
|
2021-09-25 16:00:30 +03:00
|
|
|
#include "items.h"
|
2021-09-25 11:27:47 +02:00
|
|
|
|
2021-08-28 06:37:22 +02:00
|
|
|
namespace TEN::Entities::Switches
|
2021-08-25 09:42:17 +02:00
|
|
|
{
|
|
|
|
OBJECT_COLLISION_BOUNDS JumpSwitchBounds =
|
|
|
|
{
|
|
|
|
-128, 128,
|
|
|
|
-256, 256,
|
|
|
|
384, 512,
|
|
|
|
-ANGLE(10), ANGLE(10),
|
|
|
|
-ANGLE(30), ANGLE(30),
|
|
|
|
-ANGLE(10), ANGLE(10)
|
|
|
|
};
|
|
|
|
|
|
|
|
PHD_VECTOR JumpSwitchPos = { 0, -208, 256 };
|
|
|
|
|
|
|
|
void JumpSwitchCollision(short itemNum, ITEM_INFO* l, COLL_INFO* coll)
|
|
|
|
{
|
|
|
|
ITEM_INFO* item = &g_Level.Items[itemNum];
|
|
|
|
|
|
|
|
if ((TrInput & IN_ACTION)
|
|
|
|
&& !Lara.gunStatus
|
|
|
|
&& (l->currentAnimState == LS_REACH || l->currentAnimState == LS_JUMP_UP)
|
|
|
|
&& (l->status || l->gravityStatus)
|
|
|
|
&& l->fallspeed > 0
|
|
|
|
&& !item->currentAnimState)
|
|
|
|
{
|
|
|
|
if (TestLaraPosition(&JumpSwitchBounds, item, l))
|
|
|
|
{
|
|
|
|
AlignLaraPosition(&JumpSwitchPos, item, l);
|
|
|
|
|
|
|
|
l->currentAnimState = LS_SWITCH_DOWN;
|
|
|
|
l->animNumber = LA_JUMPSWITCH_PULL;
|
|
|
|
l->fallspeed = 0;
|
|
|
|
l->frameNumber = g_Level.Anims[l->animNumber].frameBase;
|
|
|
|
l->gravityStatus = false;
|
|
|
|
Lara.gunStatus = LG_HANDS_BUSY;
|
|
|
|
|
2021-08-26 05:46:10 +02:00
|
|
|
item->goalAnimState = SWITCH_ON;
|
2021-08-25 09:42:17 +02:00
|
|
|
item->status = ITEM_ACTIVE;
|
|
|
|
|
|
|
|
AddActiveItem(itemNum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|