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

Function ScalesControl

TombEngine/Objects/TR4/Object/tr4_scales.cpp:35–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33};
34
35void ScalesControl(short itemNumber)
36{
37 auto* item = &g_Level.Items[itemNumber];
38
39 if (!TestLastFrame(*item))
40 {
41 AnimateItem(item);
42 return;
43 }
44
45 if (item->Animation.ActiveState == 1 || item->ItemFlags[1])
46 {
47 if (item->Animation.AnimNumber == 0)
48 {
49 RemoveActiveItem(itemNumber);
50 item->Status = ITEM_NOT_ACTIVE;
51 item->ItemFlags[1] = 0;
52
53 AnimateItem(item);
54 return;
55 }
56
57 if (RespawnAhmet(Lara.Context.InteractedItem))
58 {
59 short itemNos[8];
60 int sw = GetSwitchTrigger(item, itemNos, 0);
61
62 if (sw > 0)
63 {
64 while (g_Level.Items[itemNos[sw]].ObjectNumber == ID_FLAME_EMITTER2)
65 {
66 if (--sw <= 0)
67 break;
68 }
69
70 g_Level.Items[itemNos[sw]].Flags = 1024;
71 }
72
73 item->Animation.TargetState = 1;
74 }
75
76 AnimateItem(item);
77 }
78
79 int flags = 0;
80
81 if (item->Animation.ActiveState == 2)
82 {
83 flags = -512;
84 RemoveActiveItem(itemNumber);
85 item->Status = ITEM_NOT_ACTIVE;
86 }
87 else
88 {
89 flags = -1024;
90 item->ItemFlags[1] = 1;
91 }
92

Callers

nothing calls this directly

Calls 6

TestLastFrameFunction · 0.85
AnimateItemFunction · 0.85
RemoveActiveItemFunction · 0.85
RespawnAhmetFunction · 0.85
GetSwitchTriggerFunction · 0.85
TestTriggersFunction · 0.85

Tested by

no test coverage detected