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

Function CyborgControl

TombEngine/Objects/TR5/Entity/tr5_cyborg.cpp:129–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127 }
128
129 void CyborgControl(short itemNumber)
130 {
131 if (!CreatureActive(itemNumber))
132 return;
133
134 auto& item = g_Level.Items[itemNumber];
135 auto& creature = *GetCreatureInfo(&item);
136
137 short headingAngle = 0;
138 short joint0 = 0;
139 short joint1 = 0;
140 short joint2 = 0;
141
142 int x = item.Pose.Position.x;
143 int z = item.Pose.Position.z;
144
145 int dx = 808 * phd_sin(item.Pose.Orientation.y);
146 int dz = 808 * phd_cos(item.Pose.Orientation.y);
147
148 x += dx;
149 z += dz;
150 int height1 = GetPointCollision(Vector3i(x, item.Pose.Position.y, z), item.RoomNumber).GetFloorHeight();
151
152 x += dx;
153 z += dz;
154 int height2 = GetPointCollision(Vector3i(x, item.Pose.Position.y, z), item.RoomNumber).GetFloorHeight();
155
156 x += dx;
157 z += dz;
158 auto pointColl = GetPointCollision(Vector3i(x, item.Pose.Position.y, z), item.RoomNumber);
159 int roomNumber = pointColl.GetRoomNumber();
160 int height3 = pointColl.GetFloorHeight();
161
162 bool canJump1block = true;
163 if (item.BoxNumber == LaraItem->BoxNumber ||
164 item.Pose.Position.y >= (height1 - CLICK(1.5f)) ||
165 item.Pose.Position.y >= (height2 + CLICK(2)) ||
166 item.Pose.Position.y <= (height2 - CLICK(2)))
167 {
168 canJump1block = false;
169 }
170
171 bool canJump2blocks = true;
172 if (item.BoxNumber == LaraItem->BoxNumber ||
173 item.Pose.Position.y >= (height1 - CLICK(1.5f)) ||
174 item.Pose.Position.y >= (height2 - CLICK(1.5f)) ||
175 item.Pose.Position.y >= (height3 + CLICK(2)) ||
176 item.Pose.Position.y <= (height3 - CLICK(2)))
177 {
178 canJump2blocks = false;
179 }
180
181 if (creature.MuzzleFlash[0].Delay != 0)
182 creature.MuzzleFlash[0].Delay--;
183
184 if (item.AIBits)
185 GetAITarget(&creature);
186 else

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
CreatureAIInfoFunction · 0.85
TestProbabilityFunction · 0.85
TestEnvironmentFunction · 0.85
GenerateIntFunction · 0.85
GetJointPositionFunction · 0.85
SpawnElectricityGlowFunction · 0.85

Tested by

no test coverage detected