MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ProcessShootSwitch

Function ProcessShootSwitch

TombEngine/Objects/Generic/Switches/switch.cpp:20–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18// NOTE: we need to decompile/inspect if these functions are still needed
19
20void ProcessShootSwitch(ItemInfo* item)
21{
22 if (item->Flags & IFLAG_SWITCH_ONESHOT)
23 return;
24
25 if (item->ObjectNumber == ID_SHOOT_SWITCH1 || item->ObjectNumber == ID_SHOOT_SWITCH2)
26 ExplodeItemNode(item, Objects[item->ObjectNumber].nmeshes - 1, 0, 64);
27
28 if (item->ObjectNumber == ID_SHOOT_SWITCH2 && item->TriggerFlags == 444)
29 {
30 auto pos = GetJointPosition(item, 0);
31 TestTriggers(pos.x, pos.y, pos.z, item->RoomNumber, true);
32 item->MeshBits |= 1 << ((Objects[item->ObjectNumber].nmeshes & 0xFF) - 2);
33 }
34 else
35 {
36 if (item->Flags & IFLAG_ACTIVATION_MASK && (item->Flags & IFLAG_ACTIVATION_MASK) != IFLAG_ACTIVATION_MASK)
37 {
38 TestTriggers(item->Pose.Position.x, item->Pose.Position.y - 256, item->Pose.Position.z, item->RoomNumber, true, item->Flags & IFLAG_ACTIVATION_MASK);
39 }
40 else
41 {
42 short triggerItems[8];
43 for (int count = GetSwitchTrigger(item, triggerItems, 1); count > 0; --count)
44 {
45 AddActiveItem(triggerItems[count - 1]);
46 g_Level.Items[triggerItems[count - 1]].Status = ITEM_ACTIVE;
47 g_Level.Items[triggerItems[count - 1]].Flags |= IFLAG_ACTIVATION_MASK;
48 }
49 }
50 }
51
52 if (item->Status != ITEM_DEACTIVATED)
53 {
54 AddActiveItem(item->Index);
55 item->Status = ITEM_ACTIVE;
56 item->Flags |= IFLAG_ACTIVATION_MASK | IFLAG_SWITCH_ONESHOT;
57 }
58}
59
60void InitializeShootSwitch(short itemNumber)
61{

Callers 2

GetTargetOnLOSFunction · 0.85
HandleProjectileFunction · 0.85

Calls 5

ExplodeItemNodeFunction · 0.85
GetJointPositionFunction · 0.85
TestTriggersFunction · 0.85
GetSwitchTriggerFunction · 0.85
AddActiveItemFunction · 0.85

Tested by

no test coverage detected