2021-09-05 05:52:50 +02:00
|
|
|
#include "framework.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Objects/Generic/Doors/generic_doors.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/level.h"
|
|
|
|
#include "Game/control/control.h"
|
|
|
|
#include "Game/control/box.h"
|
|
|
|
#include "Game/items.h"
|
|
|
|
#include "Game/control/lot.h"
|
|
|
|
#include "Game/gui.h"
|
|
|
|
#include "Specific/input.h"
|
|
|
|
#include "Game/pickup/pickup.h"
|
|
|
|
#include "Sound/sound.h"
|
|
|
|
#include "Game/animation.h"
|
|
|
|
#include "Game/collision/sphere.h"
|
|
|
|
#include "Game/Lara/lara.h"
|
2022-02-08 20:45:21 +11:00
|
|
|
#include "Game/Lara/lara_helpers.h"
|
|
|
|
#include "Game/Lara/lara_struct.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Specific/trmath.h"
|
|
|
|
#include "Game/misc.h"
|
2021-12-24 11:08:16 +03:00
|
|
|
#include "Objects/Generic/Doors/double_doors.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/collision/collide_item.h"
|
2021-09-05 05:52:50 +02:00
|
|
|
|
|
|
|
namespace TEN::Entities::Doors
|
|
|
|
{
|
|
|
|
PHD_VECTOR DoubleDoorPos(0, 0, 220);
|
|
|
|
|
|
|
|
OBJECT_COLLISION_BOUNDS DoubleDoorBounds =
|
|
|
|
{
|
|
|
|
-384, 384,
|
|
|
|
0, 0,
|
|
|
|
-1024, 512,
|
2022-02-24 14:22:30 +11:00
|
|
|
-ANGLE(10.0f), ANGLE(10.0f),
|
|
|
|
-ANGLE(30.0f), ANGLE(30.0f),
|
|
|
|
-ANGLE(10.0f), ANGLE(10.0f),
|
2021-09-05 05:52:50 +02:00
|
|
|
};
|
|
|
|
|
2022-03-14 01:20:51 +11:00
|
|
|
void DoubleDoorCollision(short itemNumber, ITEM_INFO* laraItem, CollisionInfo* coll)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
auto* laraInfo = GetLaraInfo(laraItem);
|
|
|
|
auto* doorItem = &g_Level.Items[itemNumber];
|
2021-09-05 05:52:50 +02:00
|
|
|
|
2022-02-24 14:22:30 +11:00
|
|
|
if (TrInput & IN_ACTION &&
|
2022-03-13 02:04:24 +11:00
|
|
|
laraItem->Animation.ActiveState == LS_IDLE &&
|
|
|
|
laraItem->Animation.AnimNumber == LA_STAND_IDLE &&
|
2022-02-24 14:22:30 +11:00
|
|
|
!laraItem->HitStatus &&
|
2022-03-13 02:04:24 +11:00
|
|
|
!(doorItem->Status && doorItem->Animation.Airborne) &&
|
2022-02-24 14:22:30 +11:00
|
|
|
laraInfo->Control.HandStatus == HandStatus::Free ||
|
2022-03-08 18:22:14 +11:00
|
|
|
laraInfo->Control.IsMoving && laraInfo->InteractedItem == itemNumber)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
doorItem->Position.yRot ^= ANGLE(180.0f);
|
|
|
|
|
|
|
|
if (TestLaraPosition(&DoubleDoorBounds, doorItem, laraItem))
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
if (MoveLaraPosition(&DoubleDoorPos, doorItem, laraItem))
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
SetAnimation(laraItem, LA_DOUBLEDOOR_OPEN_PUSH);
|
2021-09-05 05:52:50 +02:00
|
|
|
|
2022-02-24 14:22:30 +11:00
|
|
|
AddActiveItem(itemNumber);
|
2021-09-05 05:52:50 +02:00
|
|
|
|
2022-02-24 14:22:30 +11:00
|
|
|
ResetLaraFlex(laraItem);
|
|
|
|
laraInfo->Control.IsMoving = false;
|
|
|
|
laraInfo->Control.HandStatus = HandStatus::Busy;
|
|
|
|
doorItem->Status = ITEM_ACTIVE;
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
else
|
2022-03-08 18:22:14 +11:00
|
|
|
laraInfo->InteractedItem = itemNumber;
|
2022-02-24 14:22:30 +11:00
|
|
|
|
|
|
|
doorItem->Position.yRot ^= ANGLE(180.0f);
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
if (laraInfo->Control.IsMoving &&
|
2022-03-08 18:22:14 +11:00
|
|
|
laraInfo->InteractedItem == itemNumber)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
laraInfo->Control.IsMoving = false;
|
|
|
|
laraInfo->Control.HandStatus = HandStatus::Free;
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
2022-02-24 14:22:30 +11:00
|
|
|
|
|
|
|
doorItem->Position.yRot ^= ANGLE(180.0f);
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-02-24 14:22:30 +11:00
|
|
|
}
|