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_struct.h"
|
|
|
|
#include "Game/Lara/lara.h"
|
|
|
|
#include "Specific/trmath.h"
|
|
|
|
#include "Game/misc.h"
|
2021-12-24 11:08:16 +03:00
|
|
|
#include "Objects/Generic/Doors/sequence_door.h"
|
2021-12-24 03:32:19 +03:00
|
|
|
#include "Objects/Generic/Switches/fullblock_switch.h"
|
2021-12-22 16:23:57 +03:00
|
|
|
#include "Game/itemdata/door_data.h"
|
2021-09-05 05:52:50 +02:00
|
|
|
|
|
|
|
using namespace TEN::Entities::Switches;
|
|
|
|
|
|
|
|
namespace TEN::Entities::Doors
|
|
|
|
{
|
|
|
|
void SequenceDoorControl(short itemNumber)
|
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
auto* doorItem = &g_Level.Items[itemNumber];
|
|
|
|
auto* doorData = (DOOR_DATA*)doorItem->Data;
|
2021-09-05 05:52:50 +02:00
|
|
|
|
|
|
|
if (CurrentSequence == 3)
|
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
if (SequenceResults[Sequences[0]][Sequences[1]][Sequences[2]] == doorItem->TriggerFlags)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-03-13 02:04:24 +11:00
|
|
|
if (doorItem->Animation.ActiveState == 1)
|
|
|
|
doorItem->Animation.TargetState = 1;
|
2021-09-05 05:52:50 +02:00
|
|
|
else
|
2022-03-13 02:04:24 +11:00
|
|
|
doorItem->Animation.TargetState = 0;
|
2021-09-05 05:52:50 +02:00
|
|
|
|
2022-02-24 14:22:30 +11:00
|
|
|
TestTriggers(doorItem, true);
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CurrentSequence = 4;
|
|
|
|
}
|
|
|
|
|
2022-03-13 02:04:24 +11:00
|
|
|
if (doorItem->Animation.ActiveState == doorItem->Animation.TargetState)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-03-13 02:04:24 +11:00
|
|
|
if (doorItem->Animation.ActiveState == 1)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
if (!doorData->opened)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
OpenThatDoor(&doorData->d1, doorData);
|
|
|
|
OpenThatDoor(&doorData->d2, doorData);
|
|
|
|
OpenThatDoor(&doorData->d1flip, doorData);
|
|
|
|
OpenThatDoor(&doorData->d2flip, doorData);
|
|
|
|
doorData->opened = true;
|
|
|
|
doorItem->Flags |= 0x3E;
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
if (doorData->opened)
|
2021-09-05 05:52:50 +02:00
|
|
|
{
|
2022-02-24 14:22:30 +11:00
|
|
|
ShutThatDoor(&doorData->d1, doorData);
|
|
|
|
ShutThatDoor(&doorData->d2, doorData);
|
|
|
|
ShutThatDoor(&doorData->d1flip, doorData);
|
|
|
|
ShutThatDoor(&doorData->d2flip, doorData);
|
|
|
|
doorData->opened = false;
|
|
|
|
doorItem->Flags &= 0xC1;
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-24 14:22:30 +11:00
|
|
|
AnimateItem(doorItem);
|
2021-09-05 05:52:50 +02:00
|
|
|
}
|
2022-02-24 14:22:30 +11:00
|
|
|
}
|