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

Function ControlTeleporter

TombEngine/Objects/TR5/Object/tr5_teleporter.cpp:16–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace TEN::Effects::Environment;
15
16void ControlTeleporter(short itemNumber)
17{
18 ItemInfo* item = &g_Level.Items[itemNumber];
19
20 if (!TriggerActive(item))
21 return;
22
23 Lara.Control.IsLocked = false;
24
25 if (item->TriggerFlags == 666)
26 {
27 if (item->ItemFlags[0] == 70)
28 {
29 SoundEffect(SFX_TR5_LIFT_HIT_FLOOR1, nullptr);
30 SoundEffect(SFX_TR5_LIFT_HIT_FLOOR2, nullptr);
31 }
32
33 SetAnimation(LaraItem, LA_ELEVATOR_RECOVER);
34
35 item->ItemFlags[0]++;
36 if (item->ItemFlags[0] >= 150)
37 KillItem(itemNumber);
38 }
39 else
40 {
41 Camera.fixedCamera = true;
42 LaraItem->DisableInterpolation = true;
43 LaraItem->Pose.Position.x = item->Pose.Position.x;
44 LaraItem->Pose.Position.z = item->Pose.Position.z;
45 LaraItem->Pose.Orientation.y = item->Pose.Orientation.y - ANGLE(180.0f);
46
47 auto& pointColl = GetPointCollision(*item);
48 LaraItem->Pose.Position.y = pointColl.GetPosition().y;
49
50 if (LaraItem->RoomNumber != pointColl.GetRoomNumber())
51 {
52 ItemNewRoom(LaraItem->Index, pointColl.GetRoomNumber());
53 LaraItem->Location.RoomNumber = pointColl.GetRoomNumber();
54 }
55
56 if (item->Flags & IFLAG_INVISIBLE)
57 {
58 KillItem(itemNumber);
59 }
60 else if (item->TriggerFlags != 512)
61 {
62 RemoveActiveItem(itemNumber);
63 item->Flags &= 0xC1FFu;
64 }
65 }
66}

Callers

nothing calls this directly

Calls 10

TriggerActiveFunction · 0.85
SoundEffectFunction · 0.85
SetAnimationFunction · 0.85
KillItemFunction · 0.85
ANGLEFunction · 0.85
GetPointCollisionFunction · 0.85
ItemNewRoomFunction · 0.85
RemoveActiveItemFunction · 0.85
GetPositionMethod · 0.45
GetRoomNumberMethod · 0.45

Tested by

no test coverage detected