TombEngine/TR5Main/Objects/Generic/Switches/switch.cpp

42 lines
1.2 KiB
C++
Raw Normal View History

#include "framework.h"
2021-12-24 03:32:19 +03:00
#include "Objects/Generic/Switches/switch.h"
2021-12-22 16:23:57 +03:00
#include "Game/items.h"
#include "Game/control/lot.h"
#include "Objects/Generic/Object/objects.h"
2021-12-22 16:23:57 +03:00
#include "Game/Lara/lara.h"
#include "Game/animation.h"
#include "Game/collision/sphere.h"
#include "Game/camera.h"
#include "Specific/setup.h"
#include "Specific/level.h"
#include "Specific/input.h"
#include "Sound/sound.h"
2021-08-28 06:37:22 +02:00
// NOTE: we need to decompile/inspect if these functions are still needed
void ProcessExplodingSwitchType8(ITEM_INFO* item)
{
2022-02-24 14:22:30 +11:00
PHD_VECTOR pos = { 0, 0, 0 };
GetJointAbsPosition(item, &pos, 0);
2022-02-24 14:22:30 +11:00
TestTriggers(pos.x, pos.y, pos.z, item->RoomNumber, true);
ExplodeItemNode(item, Objects[item->ObjectNumber].nmeshes - 1, 0, 64);
item->MeshBits |= 1 << ((Objects[item->ObjectNumber].nmeshes & 0xFF) - 2);
}
void InitialiseShootSwitch(short itemNumber)
{
2022-02-24 14:22:30 +11:00
auto* switchItem = &g_Level.Items[itemNumber];
if (switchItem->TriggerFlags == 444)
switchItem->MeshBits &= ~(1 << (Objects[switchItem->ObjectNumber].nmeshes - 2));
}
2022-02-24 14:22:30 +11:00
void ShootSwitchCollision(short itemNumber, ITEM_INFO* laraItem, COLL_INFO* coll)
2020-01-11 12:58:12 -03:00
{
2022-02-24 14:22:30 +11:00
auto* switchItem = &g_Level.Items[itemNumber];
2020-01-11 12:58:12 -03:00
2022-02-24 14:22:30 +11:00
if (switchItem->ObjectNumber == ID_SHOOT_SWITCH1 && !(switchItem->MeshBits & 1))
switchItem->Status = ITEM_INVISIBLE;
2020-01-11 12:58:12 -03:00
}