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

Function VonCroyControl

TombEngine/Objects/TR4/Entity/tr4_von_croy.cpp:150–935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 void VonCroyControl(short itemNumber)
151 {
152 auto* item = &g_Level.Items[itemNumber];
153
154 if (!CreatureActive(itemNumber))
155 return;
156
157 auto* creature = GetCreatureInfo(item);
158
159 short angle = 0;
160 short tilt = 0;
161 short joint0 = 0;
162 short joint1 = 0;
163 short joint2 = 0;
164 short joint3 = 0;
165
166 // Check whether Von Croy can jump 1 or 2 blocks.
167
168 int x = item->Pose.Position.x;
169 int z = item->Pose.Position.z;
170
171 int dx = 808 * phd_sin(item->Pose.Orientation.y);
172 int dz = 808 * phd_cos(item->Pose.Orientation.y);
173
174 x += dx;
175 z += dz;
176 int height1 = GetPointCollision(Vector3i(x, item->Pose.Position.y, z), item->RoomNumber).GetFloorHeight();
177
178 x += dx;
179 z += dz;
180 int height2 = GetPointCollision(Vector3i(x, item->Pose.Position.y, z), item->RoomNumber).GetFloorHeight();
181
182 x += dx;
183 z += dz;
184 int height3 = GetPointCollision(Vector3i(x, item->Pose.Position.y, z), item->RoomNumber).GetFloorHeight();
185
186 x += dx;
187 z += dz;
188 auto probe = GetPointCollision(Vector3i(x, item->Pose.Position.y, z), item->RoomNumber);
189 int height4 = probe.GetFloorHeight();
190
191 bool canJump1block = true;
192 if (item->BoxNumber == LaraItem->BoxNumber ||
193 item->Pose.Position.y >= height1 - CLICK(1.5f) ||
194 item->Pose.Position.y >= height2 + CLICK(1) ||
195 item->Pose.Position.y <= height2 - CLICK(1))
196 {
197 canJump1block = false;
198 }
199
200 bool canJump2blocks = true;
201 if (item->BoxNumber == LaraItem->BoxNumber ||
202 item->Pose.Position.y >= height1 - CLICK(1.5f) ||
203 item->Pose.Position.y >= height2 - CLICK(1.5f) ||
204 item->Pose.Position.y >= height3 + CLICK(1) ||
205 item->Pose.Position.y <= height3 - CLICK(1))
206 {
207 canJump2blocks = false;

Callers

nothing calls this directly

Calls 15

CreatureActiveFunction · 0.85
GetCreatureInfoFunction · 0.85
phd_sinFunction · 0.85
phd_cosFunction · 0.85
GetPointCollisionFunction · 0.85
GetAITargetFunction · 0.85
GetFloorFunction · 0.85
CreateZoneFunction · 0.85
CreatureAIInfoFunction · 0.85
GetCreatureMoodFunction · 0.85
CreatureMoodFunction · 0.85
phd_atanFunction · 0.85

Tested by

no test coverage detected