1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "bladerunner/script/ai_script.h"
24 
25 namespace BladeRunner {
26 
AIScriptSteele(BladeRunnerEngine * vm)27 AIScriptSteele::AIScriptSteele(BladeRunnerEngine *vm) : AIScriptBase(vm) {
28 	_resumeIdleAfterFramesetCompletesFlag = false;
29 	// _varChooseIdleAnimation can have valid values: 0, 1, 3 (value 2 is skipped)
30 	_varChooseIdleAnimation = 0;
31 	_varNumOfTimesToHoldCurrentFrame = 0;
32 }
33 
Initialize()34 void AIScriptSteele::Initialize() {
35 	_animationFrame = 0;
36 	_animationState = 0;
37 	_animationStateNext = 0;
38 	_animationNext = 0;
39 
40 	_resumeIdleAfterFramesetCompletesFlag = false;
41 	_varChooseIdleAnimation = 0;
42 	_varNumOfTimesToHoldCurrentFrame = 0;
43 
44 	Actor_Put_In_Set(kActorSteele, kSetFreeSlotG);
45 	Actor_Set_At_Waypoint(kActorSteele, 39, 0);
46 	Actor_Set_Goal_Number(kActorSteele, kGoalSteeleDefault);
47 	Actor_Clue_Acquire(kActorSteele, kClueCrimeSceneNotes, true, -1);
48 }
49 
Update()50 bool AIScriptSteele::Update() {
51 	if ( Global_Variable_Query(kVariableMcCoyEvidenceMissed) > 5
52 	 && !Actor_Clue_Query(kActorSteele, kClueMcCoyIsStupid)
53 	) {
54 		Actor_Clue_Acquire(kActorSteele, kClueMcCoyIsStupid, true, -1);
55 		return true;
56 	}
57 
58 	switch (Global_Variable_Query(kVariableChapter)) {
59 	case 1:
60 		if (Game_Flag_Query(kFlagMcCoyInRunciters)
61 		 && Game_Flag_Query(kFlagSteeleInRunciters)
62 		) {
63 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotC1);
64 			return true;
65 		}
66 
67 		if (Game_Flag_Query(kFlagMcCoyInChinaTown)
68 		 && Game_Flag_Query(kFlagSteeleInChinaTown)
69 		) {
70 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotC2);
71 			return true;
72 		}
73 
74 		if (Game_Flag_Query(kFlagMcCoyInPoliceStation)
75 		 && Game_Flag_Query(kFlagSteeleInPoliceStation)
76 		) {
77 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotG3);
78 			return true;
79 		}
80 
81 		if ( Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleDefault
82 		 && !Game_Flag_Query(kFlagMcCoyInRunciters)
83 		 &&  Player_Query_Current_Scene() != kSceneRC01
84 		) {
85 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToRC01);
86 			Game_Flag_Set(kFlagSteeleInRunciters);
87 			return true;
88 		}
89 
90 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleInterviewGrigorian) {
91 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleDefault);
92 			return true;
93 		}
94 
95 		break;
96 
97 	case 2:
98 		if ( Game_Flag_Query(kFlagTB05Entered)
99 		 && !Game_Flag_Query(kFlagTB02SteeleEnter)
100 		) {
101 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToTB02);
102 			Game_Flag_Set(kFlagTB02SteeleEnter);
103 			return true;
104 		}
105 
106 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGoToTB02
107 		 && Game_Flag_Query(kFlagTB02SteeleTalk)) {
108 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleLeaveTB02);
109 			return true;
110 		 }
111 
112 		if (!Game_Flag_Query(kFlagSteeleWalkingAround)
113 		 && Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGoToPoliceStation
114 		) {
115 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleWalkAround);
116 			Game_Flag_Set(kFlagSteeleWalkingAround);
117 			return true;
118 		}
119 
120 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleWalkAroundRestart) {
121 			Game_Flag_Reset(kFlagSteeleWalkingAround);
122 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToPoliceStation);
123 			return true;
124 		}
125 
126 		break;
127 
128 	case 3:
129 		if (Global_Variable_Query(kVariableChapter) != 3) { // why is this here? double check?
130 			break;
131 		}
132 
133 		if (Actor_Query_Goal_Number(kActorSteele) < kGoalSteeleStartChapter3) {
134 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleStartChapter3);
135 		}
136 
137 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR01TalkToGordo
138 		 && Player_Query_Current_Scene() == kSceneNR01
139 		 && Actor_Query_In_Between_Two_Actors(kActorMcCoy, kActorSteele, kActorGordo)
140 		) {
141 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01ShootMcCoy);
142 		}
143 
144 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR11Entered) {
145 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR11Decide);
146 			return true;
147 		}
148 
149 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR01PrepareTalkAboutShotGun) {
150 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01TalkAboutShotGun);
151 			return true;
152 		}
153 
154 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR01PrepareShotByMcCoy) {
155 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01ShotByMcCoy);
156 			return true;
157 		}
158 
159 		break;
160 
161 	case 4:
162 		if (Actor_Query_Goal_Number(kActorSteele) < kGoalSteeleStartChapter4) {
163 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleStartChapter4);
164 		}
165 
166 		break;
167 
168 	case 5:
169 		if (Game_Flag_Query(kFlagMcCoyIsHelpingReplicants)
170 		 && Actor_Query_Goal_Number(kActorSteele) < kGoalSteeleStartChapter5
171 		) {
172 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleStartChapter5);
173 			return true;
174 		}
175 
176 		break;
177 
178 	default:
179 		break;
180 	}
181 
182 	if ( Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGone
183 		&& !Actor_Query_In_Set(kActorSteele, kSetFreeSlotI)
184 	) {
185 		if (Actor_Query_Which_Set_In(kActorMcCoy) != Actor_Query_Which_Set_In(kActorSteele)) {
186 			AI_Movement_Track_Flush(kActorSteele);
187 			AI_Movement_Track_Append(kActorSteele, 41, 100);
188 			AI_Movement_Track_Repeat(kActorSteele);
189 		}
190 	}
191 	return false;
192 
193 }
194 
TimerExpired(int timer)195 void AIScriptSteele::TimerExpired(int timer) {
196 	if (timer == kActorTimerAIScriptCustomTask0
197 	 && Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR11StartWaiting
198 	) {
199 		if (Player_Query_Current_Scene() == kSceneNR11) {
200 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR11Enter);
201 		} else {
202 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR11StopWaiting);
203 		}
204 		return; // true;
205 	}
206 
207 	if (timer == kActorTimerAIScriptCustomTask1) {
208 		int goal = Actor_Query_Goal_Number(kActorSteele);
209 
210 		AI_Countdown_Timer_Reset(kActorSteele, kActorTimerAIScriptCustomTask1);
211 
212 		if (goal == kGoalSteeleKP03Exploded) {
213 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP03Dying);
214 		} else if (goal == kGoalSteeleKP03Dying) {
215 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP03Dead);
216 		}
217 	}
218 	return; // false;
219 }
220 
CompletedMovementTrack()221 void AIScriptSteele::CompletedMovementTrack() {
222 	switch (Actor_Query_Goal_Number(kActorSteele)) {
223 	case kGoalSteeleGoToRC01:
224 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToRC02);
225 		break;
226 
227 	case kGoalSteeleGoToRC02:
228 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotC1);
229 		break;
230 
231 	case kGoalSteeleGoToFreeSlotC1:
232 		if (Random_Query(1, 3) == 1) {
233 			Actor_Clues_Transfer_New_To_Mainframe(kActorSteele);
234 			Actor_Clues_Transfer_New_From_Mainframe(kActorSteele);
235 		}
236 
237 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele)
238 		 && Query_Score(kActorMcCoy) < 75
239 		) {
240 			Set_Score(kActorSteele, Random_Query(2, 5) + Query_Score(kActorMcCoy));
241 		}
242 
243 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotG1);
244 		break;
245 
246 	case kGoalSteeleGoToFreeSlotG1:
247 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToCT01);
248 		break;
249 
250 	case kGoalSteeleGoToCT01:
251 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotC2);
252 		break;
253 
254 	case kGoalSteeleGoToFreeSlotC2:
255 		if (Random_Query(1, 3) == 1) {
256 			Actor_Clues_Transfer_New_To_Mainframe(kActorSteele);
257 			Actor_Clues_Transfer_New_From_Mainframe(kActorSteele);
258 		}
259 
260 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele)
261 		 && Query_Score(kActorMcCoy) < 75
262 		) {
263 			Set_Score(kActorSteele, Random_Query(2, 5) + Query_Score(kActorMcCoy));
264 		}
265 
266 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotG2);
267 		break;
268 
269 	case kGoalSteeleGoToFreeSlotG2:
270 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToPoliceShootingRange);
271 		break;
272 
273 	case kGoalSteeleGoToPoliceShootingRange:
274 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToPS02);
275 		break;
276 
277 	case kGoalSteeleGoToPS02:
278 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToFreeSlotG3);
279 		break;
280 
281 	case kGoalSteeleGoToFreeSlotG3:
282 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleInterviewGrigorian);
283 		break;
284 
285 	case kGoalSteeleApprehendIzo:
286 		if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleApprehendIzo) { //why is this here? double check?
287 			Player_Set_Combat_Mode(false);
288 
289 			if (Actor_Query_Goal_Number(kActorIzo) != kGoalIzoDie) {
290 				if (Actor_Query_In_Between_Two_Actors(kActorMcCoy, kActorSteele, kActorIzo)) {
291 					Actor_Set_Goal_Number(kActorSteele, kGoalSteeleIzoBlockedByMcCoy);
292 				} else if (Game_Flag_Query(kFlagIzoIsReplicant)) {
293 					Actor_Set_Goal_Number(kActorSteele, kGoalSteeleShootIzo);
294 				} else {
295 					Actor_Set_Goal_Number(kActorSteele, kGoalSteeleArrestIzo);
296 				}
297 			}
298 		}
299 		break;
300 
301 	case kGoalSteeleLeaveTB02:
302 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToPoliceStation);
303 		break;
304 
305 	case kGoalSteeleWalkAround:
306 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleWalkAroundRestart);
307 		break;
308 
309 	case kGoalSteeleHF02ShootLucy:
310 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHF02LucyShotBySteele);
311 		break;
312 
313 	case kGoalSteeleKP01Leave:
314 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP01Left);
315 		break;
316 
317 	case kGoalSteeleKP06Enter:
318 		Player_Set_Combat_Mode(false);
319 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
320 		Actor_Says(kActorMcCoy, 2265, 11);
321 		Actor_Says(kActorSteele, 640, 58);
322 		Actor_Says(kActorMcCoy, 2270, 12);
323 		Actor_Says(kActorSteele, 650, 59);
324 		Actor_Says(kActorMcCoy, 2275, 16);
325 		Actor_Says(kActorMcCoy, 2280, 15);
326 		Actor_Says(kActorSteele, 660, 60);
327 		Actor_Says(kActorSteele, 670, 59);
328 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP06Leave);
329 		Player_Set_Combat_Mode(true);
330 		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -731.0f, 8.26f, -657.0f, 0, false, false, false);
331 		Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
332 		Ambient_Sounds_Remove_All_Looping_Sounds(1u);
333 		Game_Flag_Set(kFlagKP06toKP07);
334 		Set_Enter(kSetKP07, kSceneKP07);
335 		break;
336 	}
337 	return; //true;
338 }
339 
ReceivedClue(int clueId,int fromActorId)340 void AIScriptSteele::ReceivedClue(int clueId, int fromActorId) {
341 	//return false;
342 }
343 
ClickedByPlayer()344 void AIScriptSteele::ClickedByPlayer() {
345 	int goal = Actor_Query_Goal_Number(kActorSteele);
346 
347 	if (goal == kGoalSteeleGone) {
348 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
349 		Actor_Says(kActorMcCoy, 8630, 14);
350 		return; //true;
351 	}
352 
353 	if (goal > 399
354 	 || Global_Variable_Query(kVariableChapter) > 2
355 	) {
356 		return; //true;
357 	}
358 
359 	if (goal == kGoalSteeleHF02ShootLucy) {
360 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHF02LucyShotBySteele);
361 		return; //true;
362 	}
363 
364 	if (goal == kGoalSteeleNR01ConfrontGordo) {
365 		return; //true;
366 	}
367 
368 #if BLADERUNNER_ORIGINAL_BUGS
369 #else
370 	if (goal == kGoalSteeleApprehendIzo
371 	    || goal == kGoalSteeleArrestIzo
372 	    || goal == kGoalSteeleShootIzo
373 	) {
374 		// don't interrupt Steele before she apprehends Izo
375 		return; //true;
376 	}
377 #endif // BLADERUNNER_ORIGINAL_BUGS
378 
379 	AI_Movement_Track_Pause(kActorSteele);
380 	Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
381 	Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
382 
383 	switch (Random_Query(1, 3)) {
384 	case 1:
385 		Actor_Says(kActorMcCoy, 3970, 15);
386 		Actor_Says(kActorSteele, 2700, 15);
387 		break;
388 
389 	case 2:
390 		Actor_Says(kActorMcCoy, 3970, 15);
391 		Actor_Says(kActorSteele, 2060, 15);
392 		break;
393 
394 	case 3:
395 		Actor_Says(kActorMcCoy, 3970, 15);
396 		Actor_Says(kActorSteele, 1750, 15);
397 		break;
398 	}
399 	AI_Movement_Track_Unpause(kActorSteele);
400 
401 	return; //false;
402 }
403 
EnteredSet(int setId)404 void AIScriptSteele::EnteredSet(int setId) {
405 #if BLADERUNNER_ORIGINAL_BUGS
406 #else
407 	if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGoToRC01) {
408 		if (!Actor_Clue_Query(kActorMcCoy, kClueOfficersStatement))
409 		{
410 			// no random factor here, Steele will definitely get this clue in this case
411 			// McCoy can still get this clue on his own (directly from the officer, if the officer is still at Runciters) -- even if McCoy got it from the mainframe via Steele
412 			Actor_Clue_Acquire(kActorSteele, kClueOfficersStatement, true, kActorOfficerLeary); // Steele will upload this to the mainframe when she heads to the Police Station
413 			Global_Variable_Increment(kVariableMcCoyEvidenceMissed, 1); // unused? but consistent with missing the other clues
414 			return;  //true;
415 		}
416 	}
417 #endif // BLADERUNNER_ORIGINAL_BUGS
418 
419 	if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGoToRC02) {
420 		if (!Game_Flag_Query(kFlagRC51ChopstickWrapperTaken)
421 		 &&  Random_Query(1, 3) == 1
422 		) {
423 			Actor_Clue_Acquire(kActorSteele, kClueChopstickWrapper, true, -1);
424 			Game_Flag_Set(kFlagRC51ChopstickWrapperTaken);
425 
426 			if (Game_Flag_Query(kFlagRC51Discovered)) {
427 				Item_Remove_From_World(kItemChopstickWrapper);
428 			}
429 
430 			Global_Variable_Increment(kVariableMcCoyEvidenceMissed, 1);
431 			return;  //true;
432 		}
433 
434 		if (!Game_Flag_Query(kFlagRC51CandyTaken)
435 		 &&  Random_Query(1, 3) == 1
436 		) {
437 			Actor_Clue_Acquire(kActorSteele, kClueCandy, true, -1);
438 			Game_Flag_Set(kFlagRC51CandyTaken);
439 
440 			if (Game_Flag_Query(kFlagRC51Discovered)) {
441 				Item_Remove_From_World(kItemCandy);
442 			}
443 			return; //true;
444 		}
445 
446 		if (!Game_Flag_Query(kFlagRC51ToyDogTaken)
447 		 &&  Random_Query(1, 20) == 1
448 		) {
449 			Actor_Clue_Acquire(kActorSteele, kClueToyDog, true, -1);
450 			Game_Flag_Set(kFlagRC51ToyDogTaken);
451 
452 			if (Game_Flag_Query(kFlagRC51Discovered)) {
453 				Item_Remove_From_World(kItemToyDog);
454 			}
455 			return; //true;
456 		}
457 	}
458 
459 	if ( Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleGoToCT01
460 	 &&  Actor_Query_In_Set(kActorSteele, kSetCT03_CT04)
461 	 &&  Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)
462 	 && !Game_Flag_Query(kFlagCT04HomelessBodyInDumpster)
463 #if BLADERUNNER_ORIGINAL_BUGS
464 #else
465 	 && !Game_Flag_Query(kFlagCT04HomelessBodyThrownAway)
466 #endif // BLADERUNNER_ORIGINAL_BUGS
467 	 && !Game_Flag_Query(kFlagCT04HomelessBodyFound)
468 	) {
469 		Game_Flag_Set(kFlagCT04HomelessBodyFound);
470 		return; //true;
471 	}
472 
473 	return; //false;
474 }
475 
OtherAgentEnteredThisSet(int otherActorId)476 void AIScriptSteele::OtherAgentEnteredThisSet(int otherActorId) {
477 	// return false;
478 }
479 
OtherAgentExitedThisSet(int otherActorId)480 void AIScriptSteele::OtherAgentExitedThisSet(int otherActorId) {
481 	// return false;
482 }
483 
OtherAgentEnteredCombatMode(int otherActorId,int combatMode)484 void AIScriptSteele::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
485 	if (otherActorId == kActorMcCoy
486 	 && Actor_Query_Goal_Number(kActorSteele) == 410
487 	)
488 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP03ShootMcCoy);
489 }
490 
ShotAtAndMissed()491 void AIScriptSteele::ShotAtAndMissed() {
492 	// return false;
493 }
494 
ShotAtAndHit()495 bool AIScriptSteele::ShotAtAndHit() {
496 	if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR01TalkToGordo) {
497 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01PrepareShotByMcCoy);
498 	}
499 
500 	if (/* !a1 && */ Actor_Query_In_Set(kActorSteele, kSetHF06))
501 		Non_Player_Actor_Combat_Mode_On(kActorSteele, kActorCombatStateUncover, true, kActorMcCoy, 15, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, 0, 100, 25, 300, false);
502 
503 	return false;
504 }
505 
Retired(int byActorId)506 void AIScriptSteele::Retired(int byActorId) {
507 	Game_Flag_Set(kFlagSteeleDead);
508 
509 	if (Actor_Query_Goal_Number(kActorSteele) == 450) {
510 		Scene_Exits_Enable();
511 		Game_Flag_Set(kFlagKP03BombDisarmed);
512 	}
513 
514 	if (Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleGone) {
515 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatDie);
516 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGone);
517 	}
518 }
519 
GetFriendlinessModifierIfGetsClue(int otherActorId,int clueId)520 int AIScriptSteele::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
521 	if (otherActorId != kActorMcCoy) {
522 		return 0;
523 	}
524 
525 	switch (clueId) {
526 	case kClueMcCoyRecoveredHoldensBadge:
527 		// fall through
528 	case kClueMcCoyRetiredLucy:
529 		// fall through
530 	case kClueMcCoyRetiredDektora:
531 		// fall through
532 	case kClueMcCoyRetiredSadik:
533 		// fall through
534 	case kClueMcCoyShotZubenInTheBack:
535 		// fall through
536 	case kClueMcCoyRetiredLutherLance:
537 		// fall through
538 	case kClueClovisOrdersMcCoysDeath:
539 		// fall through
540 	case kClueMcCoyIsKind:
541 		// fall through
542 	case kClueMcCoyIsInsane:
543 		return 5;
544 
545 	case kClueMcCoyKilledRunciter1:
546 		// fall through
547 	case kClueMcCoyShotGuzza:
548 		// fall through
549 	case kClueMcCoyKilledRunciter2:
550 		return 0; // TODO shouldn't this be a negative number?
551 
552 	case kClueMcCoyLetZubenEscape:
553 		return -4;
554 
555 	case kClueMcCoyWarnedIzo:
556 		// fall through
557 	case kClueMcCoyHelpedIzoIzoIsAReplicant:
558 		// fall through
559 	case kClueMcCoyHelpedDektora:
560 		// fall through
561 	case kClueMcCoyHelpedLucy:
562 		// fall through
563 	case kClueMcCoyHelpedGordo:
564 		return -5;
565 
566 	case kClueMcCoyRetiredZuben:
567 		return 4;
568 
569 	case kClueMcCoyIsStupid:
570 		return -3;
571 
572 	case kClueMcCoyIsAnnoying:
573 		return -2;
574 	}
575 
576 	return 0;
577 }
578 
comp_distance(int actorId,float a5,float a6,int a1,float a2,float a3,float a4)579 double AIScriptSteele::comp_distance(int actorId, float a5, float a6, int a1, float a2, float a3, float a4) {
580 	float actorZ;
581 	float actorX;
582 	float actorY;
583 
584 	Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);
585 	return sqrt((a4 - actorZ) * (a4 - actorZ) + (a2 - actorX) * (a2 - actorX) + (a3 - actorY) * (a3 - actorY));
586 }
587 
GoalChanged(int currentGoalNumber,int newGoalNumber)588 bool AIScriptSteele::GoalChanged(int currentGoalNumber, int newGoalNumber) {
589 	if (currentGoalNumber == kGoalSteeleGone) {
590 		return false;
591 	}
592 
593 	switch (newGoalNumber) {
594 	// Chapter 1
595 
596 	case kGoalSteeleGoToRC01:
597 		AI_Movement_Track_Flush(kActorSteele);
598 		AI_Movement_Track_Append(kActorSteele, 12, 5);
599 		AI_Movement_Track_Repeat(kActorSteele);
600 		return true;
601 
602 	case kGoalSteeleGoToRC02:
603 		AI_Movement_Track_Flush(kActorSteele);
604 		AI_Movement_Track_Append(kActorSteele, 61, 30);
605 		AI_Movement_Track_Repeat(kActorSteele);
606 		return true;
607 
608 	case kGoalSteeleGoToFreeSlotC1:
609 		AI_Movement_Track_Flush(kActorSteele);
610 		AI_Movement_Track_Append(kActorSteele, 35, 45);
611 		AI_Movement_Track_Repeat(kActorSteele);
612 		return true;
613 
614 	case kGoalSteeleGoToFreeSlotG1:
615 		AI_Movement_Track_Flush(kActorSteele);
616 		Game_Flag_Set(kFlagSteeleInChinaTown);
617 		Game_Flag_Reset(kFlagSteeleInRunciters);
618 		AI_Movement_Track_Append(kActorSteele, 39, 45);
619 		AI_Movement_Track_Repeat(kActorSteele);
620 		return true;
621 
622 	case kGoalSteeleGoToCT01:
623 		AI_Movement_Track_Flush(kActorSteele);
624 		if (Random_Query(1, 10) == 1) {
625 			AI_Movement_Track_Append(kActorSteele, 63, 20);
626 		} else {
627 			AI_Movement_Track_Append(kActorSteele, 64, 10);
628 		}
629 		AI_Movement_Track_Repeat(kActorSteele);
630 		return true;
631 
632 	case kGoalSteeleGoToFreeSlotC2:
633 		AI_Movement_Track_Flush(kActorSteele);
634 		AI_Movement_Track_Append(kActorSteele, 35, 45);
635 		AI_Movement_Track_Repeat(kActorSteele);
636 		return true;
637 
638 	case kGoalSteeleGoToFreeSlotG2:
639 		AI_Movement_Track_Flush(kActorSteele);
640 		Game_Flag_Set(kFlagSteeleInPoliceStation);
641 		Game_Flag_Reset(kFlagSteeleInChinaTown);
642 		AI_Movement_Track_Append(kActorSteele, 39, 45);
643 		AI_Movement_Track_Repeat(kActorSteele);
644 		return true;
645 
646 	case kGoalSteeleGoToPoliceShootingRange:
647 		AI_Movement_Track_Flush(kActorSteele);
648 		if (Random_Query(1, 2) == 1) {
649 			AI_Movement_Track_Append(kActorSteele, 19, 10);
650 		} else {
651 			AI_Movement_Track_Append(kActorSteele, 35, 30);
652 		}
653 		AI_Movement_Track_Repeat(kActorSteele);
654 		return true;
655 
656 	case kGoalSteeleGoToPS02:
657 		AI_Movement_Track_Flush(kActorSteele);
658 		AI_Movement_Track_Append(kActorSteele, 62, 1);
659 		AI_Movement_Track_Repeat(kActorSteele);
660 		return true;
661 
662 	case kGoalSteeleGoToFreeSlotG3:
663 		AI_Movement_Track_Flush(kActorSteele);
664 		Game_Flag_Reset(kFlagSteeleInPoliceStation);
665 		AI_Movement_Track_Append(kActorSteele, 39, 30);
666 		AI_Movement_Track_Repeat(kActorSteele);
667 		return true;
668 
669 	case kGoalSteeleInterviewGrigorian:
670 		Actor_Clue_Acquire(kActorSteele, kClueGrigorianInterviewA, true, kActorGrigorian);
671 		if (Game_Flag_Query(kFlagIzoIsReplicant)) {
672 			Actor_Clue_Acquire(kActorSteele, kClueGrigorianInterviewB1, true, kActorGrigorian);
673 		} else {
674 			Actor_Clue_Acquire(kActorSteele, kClueGrigorianInterviewB2, true, kActorGrigorian);
675 		}
676 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleDefault);
677 		return true;
678 
679 	// Chapter 2
680 
681 	case kGoalSteeleApprehendIzo:
682 		AI_Movement_Track_Flush(kActorSteele);
683 		if (Game_Flag_Query(kFlagIzoIsReplicant)) {
684 			AI_Movement_Track_Append_Run(kActorSteele, 202, 0);
685 			AI_Movement_Track_Append_Run(kActorSteele, 203, 0);
686 		} else {
687 			AI_Movement_Track_Append(kActorSteele, 174, 0);
688 			AI_Movement_Track_Append_Run(kActorSteele, 175, 0);
689 		}
690 		AI_Movement_Track_Repeat(kActorSteele);
691 		return true;
692 
693 	case kGoalSteeleGoToTB02:
694 		AI_Movement_Track_Flush(kActorSteele);
695 		AI_Movement_Track_Append(kActorSteele, 192, 0);
696 		AI_Movement_Track_Repeat(kActorSteele);
697 		return true;
698 
699 	case kGoalSteeleLeaveTB02:
700 		Loop_Actor_Walk_To_XYZ(kActorSteele, -187.82f, 0.08f, 1460.74f, 0, false, false, false);
701 		Actor_Face_Heading(kActorSteele, 802, false);
702 		Loop_Actor_Travel_Stairs(kActorSteele, 10, false, kAnimationModeIdle);
703 		AI_Movement_Track_Flush(kActorSteele);
704 		AI_Movement_Track_Append(kActorSteele, 35, 0);
705 		AI_Movement_Track_Repeat(kActorSteele);
706 		return true;
707 
708 	case kGoalSteeleGoToPoliceStation:
709 		if (Random_Query(1, 2) == 1) {
710 			Actor_Clues_Transfer_New_To_Mainframe(kActorSteele);
711 			Actor_Clues_Transfer_New_From_Mainframe(kActorSteele);
712 		}
713 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele)
714 		 && Query_Score(kActorMcCoy) < 75
715 		) {
716 			Set_Score(kActorSteele, Random_Query(2, 5) + Query_Score(kActorMcCoy));
717 		}
718 		AI_Movement_Track_Flush(kActorSteele);
719 		AI_Movement_Track_Append(kActorSteele, 35, Random_Query(45, 120));
720 		AI_Movement_Track_Repeat(kActorSteele);
721 		return true;
722 
723 	case kGoalSteeleWalkAround:
724 		AI_Movement_Track_Flush(kActorSteele);
725 		if (Random_Query(1, 5) == 1) { // Animoid row & Bradbury building
726 			AI_Movement_Track_Append(kActorSteele, 222, 0);
727 			AI_Movement_Track_Append_With_Facing(kActorSteele, 223, 3, 973);
728 			AI_Movement_Track_Append(kActorSteele, 224, 5);
729 			AI_Movement_Track_Append(kActorSteele, 216, 5);
730 			AI_Movement_Track_Append(kActorSteele, 217, 0);
731 			AI_Movement_Track_Append(kActorSteele, 218, 0);
732 			AI_Movement_Track_Append(kActorSteele, 210, 0);
733 			AI_Movement_Track_Append(kActorSteele, 211, 0);
734 			AI_Movement_Track_Append(kActorSteele, 204, 0);
735 			AI_Movement_Track_Append(kActorSteele, 205, 0);
736 			AI_Movement_Track_Append(kActorSteele, 206, 0);
737 			AI_Movement_Track_Append(kActorSteele, 39, 20);
738 			AI_Movement_Track_Append(kActorSteele, 35, 60);
739 			AI_Movement_Track_Append(kActorSteele, 39, 20);
740 			AI_Movement_Track_Append(kActorSteele, 228, 0);
741 			AI_Movement_Track_Append(kActorSteele, 229, 10);
742 			AI_Movement_Track_Repeat(kActorSteele);
743 		} else if (Random_Query(1, 3) == 1) { // Chinatown & DNA row
744 			AI_Movement_Track_Append(kActorSteele, 232, 0);
745 			AI_Movement_Track_Append(kActorSteele, 233, 0);
746 			AI_Movement_Track_Append(kActorSteele, 234, 3);
747 			AI_Movement_Track_Append(kActorSteele, 237, 0);
748 			AI_Movement_Track_Append(kActorSteele, 238, 0);
749 			AI_Movement_Track_Append(kActorSteele, 239, 0);
750 			AI_Movement_Track_Append(kActorSteele, 240, 10);
751 			AI_Movement_Track_Append(kActorSteele, 39, 120);
752 			AI_Movement_Track_Append(kActorSteele, 243, 0);
753 			AI_Movement_Track_Append(kActorSteele, 244, 10);
754 			AI_Movement_Track_Repeat(kActorSteele);
755 		} else { // Police station
756 			AI_Movement_Track_Append(kActorSteele, 248, 0);
757 			AI_Movement_Track_Append(kActorSteele, 249, 0);
758 			AI_Movement_Track_Append(kActorSteele, 250, 10);
759 			AI_Movement_Track_Append(kActorSteele, 253, 0);
760 			AI_Movement_Track_Append_With_Facing(kActorSteele, 254, 3, 1015);
761 			AI_Movement_Track_Append_With_Facing(kActorSteele, 255, 2, 1015);
762 			AI_Movement_Track_Append_With_Facing(kActorSteele, 256, 3, 1015);
763 			AI_Movement_Track_Append(kActorSteele, 257, 0);
764 			AI_Movement_Track_Append(kActorSteele, 39, 30);
765 			AI_Movement_Track_Append(kActorSteele, 35, 120);
766 			AI_Movement_Track_Append(kActorSteele, 39, 30);
767 			AI_Movement_Track_Repeat(kActorSteele);
768 		}
769 		return true;
770 
771 	case kGoalSteeleShootIzo:
772 		Actor_Force_Stop_Walking(kActorMcCoy);
773 		Sound_Play(kSfxSMCAL3, 100, 0, 0, 50);
774 		// Scene_Exits_Enable() is done in Izo's kGoalIzoDie - CompletedMovementTrack() case
775 		Actor_Set_Goal_Number(kActorIzo, kGoalIzoDie);
776 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeIdle);
777 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
778 		Loop_Actor_Walk_To_Actor(kActorSteele, 0, 48, false, true);
779 		Actor_Says(kActorSteele, 1860, kAnimationModeTalk);
780 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
781 		Actor_Says(kActorMcCoy, 4825, 18);
782 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
783 		Actor_Says(kActorSteele, 1870, kAnimationModeTalk);
784 		Actor_Says(kActorSteele, 1880, kAnimationModeTalk);
785 		Actor_Says(kActorMcCoy, 4830, 13);
786 		Actor_Says(kActorSteele, 1890, kAnimationModeTalk);
787 		Actor_Says(kActorSteele, 1900, kAnimationModeTalk);
788 		Actor_Face_Actor(kActorSteele, kActorIzo, true);
789 		Actor_Says(kActorSteele, 1910, kAnimationModeTalk);
790 		Actor_Says(kActorSteele, 1920, kAnimationModeTalk);
791 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
792 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
793 		Actor_Says(kActorSteele, 1930, kAnimationModeTalk);
794 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleLeaveRC03);
795 #if BLADERUNNER_ORIGINAL_BUGS
796 		Player_Gains_Control(); // redundant - causes "WARNING: Unbalanced call to BladeRunnerEngine::playerGainsControl"
797 #endif // BLADERUNNER_ORIGINAL_BUGS
798 		return true;
799 
800 	case kGoalSteeleArrestIzo:
801 		Actor_Force_Stop_Walking(kActorMcCoy);
802 		Actor_Face_Actor(kActorSteele, kActorIzo, true);
803 		Actor_Change_Animation_Mode(kActorIzo, kAnimationModeIdle);
804 		Actor_Face_Actor(kActorIzo, kActorSteele, true);
805 		Actor_Says_With_Pause(kActorSteele, 2010, 0.0f, kAnimationModeCombatIdle);
806 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
807 		Loop_Actor_Walk_To_Actor(kActorSteele, kActorIzo, 60, false, false);
808 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
809 		_animationState = 23;
810 		_animationFrame = 0;
811 		Actor_Says(kActorIzo, 660, kAnimationModeTalk);
812 		Actor_Says_With_Pause(kActorSteele, 2020, 0.0f, kAnimationModeCombatIdle);
813 		Actor_Says_With_Pause(kActorSteele, 2030, 0.0f, kAnimationModeCombatIdle);
814 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
815 		Actor_Says(kActorIzo, 670, kAnimationModeTalk);
816 		Actor_Says(kActorSteele, 2040, kAnimationModeCombatIdle);
817 		Actor_Says(kActorIzo, 680, kAnimationModeTalk);
818 		Actor_Says(kActorSteele, 2050, kAnimationModeTalk);
819 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
820 		Actor_Says(kActorSteele, 2060, kAnimationModeTalk);
821 		Actor_Says(kActorMcCoy, 4845, kAnimationModeTalk);
822 		Actor_Says(kActorSteele, 2070, kAnimationModeTalk);
823 		Actor_Says(kActorSteele, 2080, kAnimationModeTalk);
824 		Actor_Face_Actor(kActorSteele, kActorIzo, true);
825 		Actor_Says(kActorSteele, 2090, kAnimationModeTalk);
826 		Actor_Says_With_Pause(kActorSteele, 2100, 1.0f, kAnimationModeTalk);
827 		Actor_Says(kActorIzo, 690, kAnimationModeTalk);
828 		Actor_Says(kActorSteele, 2110, kAnimationModeTalk);
829 		Actor_Says(kActorSteele, 2120, kAnimationModeTalk);
830 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
831 		Actor_Says(kActorSteele, 2140, kAnimationModeTalk);
832 		Actor_Says(kActorMcCoy, 4850, kAnimationModeTalk);
833 		Actor_Says(kActorSteele, 2150, kAnimationModeTalk);
834 		// Scene_Exits_Enable() is done in Izo's kGoalIzoGetArrested - CompletedMovementTrack() case
835 		Actor_Set_Goal_Number(kActorIzo, kGoalIzoGetArrested);
836 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleLeaveRC03);
837 #if BLADERUNNER_ORIGINAL_BUGS
838 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleDefault); // TODO - a bug? why set to default here?
839 #endif // BLADERUNNER_ORIGINAL_BUGS
840 		return true;
841 
842 	case kGoalSteeleIzoBlockedByMcCoy:
843 		Actor_Force_Stop_Walking(kActorMcCoy);
844 		Actor_Set_Goal_Number(kActorIzo, kGoalIzoRC03RunAway);
845 		Actor_Says(kActorSteele, 1940, kAnimationModeTalk);
846 		Loop_Actor_Walk_To_Actor(kActorSteele, kActorMcCoy, 60, false, true);
847 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
848 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
849 		Actor_Says(kActorSteele, 1950, kAnimationModeTalk);
850 		Actor_Says(kActorMcCoy, 4835, 14);
851 		Actor_Says(kActorSteele, 1980, kAnimationModeTalk);
852 		Actor_Says(kActorMcCoy, 4840, 15);
853 		Actor_Says(kActorSteele, 1990, kAnimationModeTalk);
854 		Actor_Says(kActorSteele, 2000, kAnimationModeTalk);
855 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleLeaveRC03);
856 		Scene_Exits_Enable();
857 		return true;
858 
859 	case 126: // not used anywhere
860 		return true;
861 
862 	case kGoalSteeleLeaveRC03:
863 		AI_Movement_Track_Flush(kActorSteele);
864 		AI_Movement_Track_Append(kActorSteele, 174, 0);
865 		AI_Movement_Track_Append(kActorSteele, 35, 0);
866 		AI_Movement_Track_Repeat(kActorSteele);
867 		return true;
868 
869 	// Chapter 3
870 
871 	case 200:
872 		AI_Movement_Track_Flush(kActorSteele);
873 		return true;
874 
875 	case kGoalSteeleStartChapter3:
876 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele)
877 		 && Query_Score(kActorMcCoy) < 75
878 		) {
879 			Set_Score(kActorSteele, Random_Query(2, 5) + Query_Score(kActorMcCoy));
880 		}
881 
882 		if (Game_Flag_Query(kFlagBulletBobDead)) {
883 			Game_Flag_Set(kFlagSteeleKnowsBulletBobIsDead);
884 		}
885 
886 		AI_Movement_Track_Flush(kActorSteele);
887 		Actor_Put_In_Set(kActorSteele, kSetFreeSlotC);
888 		Actor_Set_At_Waypoint(kActorSteele, 35, 0);
889 		return true;
890 
891 	case kGoalSteeleNR11StartWaiting:
892 		AI_Countdown_Timer_Reset(kActorSteele, kActorTimerAIScriptCustomTask0);
893 		AI_Countdown_Timer_Start(kActorSteele, kActorTimerAIScriptCustomTask0, 15);
894 		return true;
895 
896 	case kGoalSteeleNR11StopWaiting:
897 		AI_Countdown_Timer_Reset(kActorSteele, kActorTimerAIScriptCustomTask0);
898 		return true;
899 
900 	case kGoalSteeleNR11Enter:
901 		if (comp_distance(kActorMcCoy, -4.0, 0.33f, 0.0f, 100.0f, 0.33f, -4.0f) < 48.0f) {
902 			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 32.0f, 0.33f, 17.0f, 0, false, false, false);
903 		}
904 		AI_Countdown_Timer_Reset(kActorSteele, kActorTimerAIScriptCustomTask0);
905 		Player_Loses_Control();
906 		if (Actor_Query_Goal_Number(kActorDektora) == kGoalSteeleNR01ConfrontGordo) {
907 			Async_Actor_Walk_To_XYZ(kActorMcCoy, -15.53f, 0.33f, 73.49f, 0, false);
908 		}
909 		Actor_Put_In_Set(kActorSteele, kSetNR11);
910 		Actor_Set_At_XYZ(kActorSteele, 100.0f, -51.56f, 0.0, 0);
911 		_animationState = 10;
912 		_animationFrame = 0;
913 		return true;
914 
915 	case kGoalSteeleNR11Entered:
916 		// fall through
917 	case 216:
918 		// fall through
919 	case kGoalSteeleNR01PrepareShotByMcCoy:
920 		return true;
921 
922 	case kGoalSteeleNR11Decide:
923 		Player_Gains_Control();
924 		switch (Actor_Query_Goal_Number(kActorDektora)) {
925 		case kGoalDektoraNR11Hiding:
926 			Actor_Face_Heading(kActorMcCoy, 954, false);
927 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
928 			Delay(2000);
929 			Actor_Says(kActorSteele, 1700, 58);
930 			Actor_Says(kActorMcCoy, 3800, 3);
931 			Actor_Says(kActorSteele, 1710, 59);
932 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR11Shoot);
933 			break;
934 
935 		case kGoalDektoraNR11WalkAway:
936 			Actor_Face_Actor(kActorSteele, kActorDektora, true);
937 			Actor_Says(kActorSteele, 1790, 3);
938 			Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
939 			Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
940 			Actor_Says(kActorMcCoy, 3830, 17);
941 			Actor_Says(kActorSteele, 1800, 17);
942 			Actor_Says(kActorMcCoy, 3835, 18);
943 			Actor_Says(kActorSteele, 1810, 16);
944 			Game_Flag_Set(kFlagDektoraRanAway);
945 			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraGone);
946 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNRxxGoToSpinner);
947 			break;
948 
949 		case kGoalDektoraNR11FallThroughWindow:
950 			Actor_Modify_Friendliness_To_Other(kActorSteele, kActorMcCoy, 6);
951 			Actor_Says(kActorSteele, 1750, 12);
952 			Actor_Says(kActorMcCoy, 3815, 19);
953 			Actor_Says(kActorSteele, 1760, 13);
954 			Actor_Says(kActorMcCoy, 3820, 18);
955 			Actor_Says(kActorSteele, 1770, 14);
956 			Actor_Says(kActorSteele, 1780, 15);
957 			Actor_Says(kActorMcCoy, 3825, 14);
958 			Game_Flag_Set(kFlagDektoraRanAway);
959 			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraGone);
960 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNRxxGoToSpinner);
961 		}
962 		return true;
963 
964 	case kGoalSteeleNR11Shoot:
965 		Game_Flag_Set(kFlagNR11SteeleShoot);
966 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
967 		Scene_Exits_Disable();
968 		return true;
969 
970 	case kGoalSteeleNR01WaitForMcCoy:
971 		AI_Movement_Track_Flush(kActorSteele);
972 		Actor_Put_In_Set(kActorSteele, kSetNR01);
973 		Actor_Set_At_XYZ(kActorSteele, 94.03f, 23.88f, -794.46f, 685);
974 		return true;
975 
976 	case kGoalSteeleNR01GoToNR08:
977 		AI_Movement_Track_Flush(kActorSteele);
978 		Actor_Put_In_Set(kActorSteele, kSetNR05_NR08);
979 		Actor_Set_At_XYZ(kActorSteele, -1034.09f, 0.32f, 224.77f, 440);
980 		Game_Flag_Set(kFlagChapter4Starting);
981 		Set_Enter(kSetNR05_NR08, kSceneNR08);
982 		return true;
983 
984 	case kGoalSteeleNR01GoToNR02:
985 		Game_Flag_Set(kFlagNR01toNR02);
986 		Set_Enter(kSetNR02, kSceneNR02);
987 		return true;
988 
989 	case kGoalSteeleNR01GoToHF03:
990 		Game_Flag_Set(kFlagHF01toHF03);
991 		Game_Flag_Reset(kFlagMcCoyInNightclubRow);
992 		Game_Flag_Set(kFlagMcCoyInHysteriaHall);
993 		Actor_Put_In_Set(kActorSteele, kSetHF03);
994 		Actor_Set_At_XYZ(kActorSteele, 291.0f, 47.76f, -892.0f, 453);
995 		Set_Enter(kSetHF03, kSceneHF03);
996 		return true;
997 
998 	case kGoalSteeleHF03McCoyChasingLucy:
999 		AI_Movement_Track_Flush(kActorSteele);
1000 		AI_Movement_Track_Append_Run(kActorSteele, 372, 0);
1001 		AI_Movement_Track_Append(kActorSteele, 35, 0);
1002 		AI_Movement_Track_Repeat(kActorSteele);
1003 		return true;
1004 
1005 	case kGoalSteeleNR08WalkOut:
1006 		AI_Movement_Track_Flush(kActorSteele);
1007 		AI_Movement_Track_Append_Run(kActorSteele, 467, 0);
1008 		AI_Movement_Track_Append(kActorSteele, 35, 0);
1009 		AI_Movement_Track_Repeat(kActorSteele);
1010 		return true;
1011 
1012 	case kGoalSteeleNR10Wait:
1013 		Actor_Put_In_Set(kActorSteele, kSetNR10);
1014 		Actor_Set_At_XYZ(kActorSteele, -118.13f, 2.84f, -197.90f, 305);
1015 		return true;
1016 
1017 	case kGoalSteeleHF02ConfrontLucy:
1018 		AI_Movement_Track_Flush(kActorSteele);
1019 		AI_Movement_Track_Flush(kActorLucy);
1020 		Actor_Put_In_Set(kActorSteele, kSetHF02);
1021 		Actor_Set_At_XYZ(kActorSteele, 254.94f, 47.76f, -262.58f, 210);
1022 		Actor_Put_In_Set(kActorLucy, kSetHF02);
1023 		Actor_Set_At_XYZ(kActorLucy, 596.49f, 47.76f, -260.04f, 731);
1024 		return true;
1025 
1026 	case kGoalSteeleHF02ShootLucy:
1027 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
1028 		Delay(500);
1029 		Actor_Change_Animation_Mode(kActorLucy, kAnimationModeDie);
1030 		Actor_Set_Targetable(kActorLucy, false);
1031 		Actor_Retired_Here(kActorLucy, 36, 18, true, -1);
1032 		Delay(1000);
1033 		AI_Movement_Track_Flush(kActorSteele);
1034 		AI_Movement_Track_Append_Run(kActorSteele, 380, 0);
1035 		AI_Movement_Track_Repeat(kActorSteele);
1036 		Delay(500);
1037 		ADQ_Add(kActorLucy, 340, kAnimationModeDie);
1038 		return true;
1039 
1040 	case kGoalSteeleHF02LucyShotBySteele:
1041 		AI_Movement_Track_Flush(kActorSteele);
1042 		Player_Loses_Control();
1043 		Delay(500);
1044 		Actor_Says(kActorSteele, 0, 14);
1045 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1046 		Actor_Says(kActorMcCoy, 1540, 16);
1047 		Actor_Says(kActorSteele, 10, 13);
1048 		Actor_Says(kActorSteele, 20, 18);
1049 		Actor_Says(kActorMcCoy, 1545, 13);
1050 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1051 		Actor_Says(kActorSteele, 30, 18);
1052 		Actor_Says(kActorSteele, 40, 18);
1053 		Actor_Says(kActorMcCoy, 1550, 13);
1054 		Actor_Face_Actor(kActorSteele, kActorLucy, true);
1055 		Actor_Says(kActorSteele, 50, 12);
1056 		Actor_Says(kActorMcCoy, 1555, 13);
1057 		Actor_Says(kActorSteele, 60, 12);
1058 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1059 		Actor_Says(kActorSteele, 80, 16);
1060 		Actor_Says(kActorMcCoy, 1560, 13);
1061 
1062 		Delay(500);
1063 		Game_Flag_Set(kFlagSpinnerMissing);
1064 		Player_Gains_Control();
1065 		if (Game_Flag_Query(kFlagSpinnerAtNR01)) {
1066 			Actor_Put_In_Set(kActorSteele, kSetNR01);
1067 			Actor_Set_At_XYZ(kActorSteele, 12.17f, 23.88f, -533.37f, 674);
1068 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1069 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1070 			Set_Enter(kSetNR01, kSceneNR01);
1071 		} else {
1072 			Actor_Put_In_Set(kActorSteele, kSetHF01);
1073 			Actor_Set_At_XYZ(kActorSteele, 324.32f, 8.0f, -465.87f, 674);
1074 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1075 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1076 			Set_Enter(kSetHF01, kSceneHF04);
1077 		}
1078 		return true;
1079 
1080 	case kGoalSteeleHF02LucyRanAway:
1081 		Player_Loses_Control();
1082 		Delay(500);
1083 		Actor_Put_In_Set(kActorSteele, kSetHF02);
1084 		Actor_Set_At_XYZ(kActorSteele, 254.94f, 47.76f, -262.58f, 210);
1085 		return true;
1086 
1087 	case kGoalSteeleHF02LucyShotByMcCoy:
1088 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1089 		Actor_Says(kActorMcCoy, 1560, 14);
1090 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1091 		Actor_Says(kActorSteele, 100, 13);
1092 		Actor_Says(kActorMcCoy, 1575, 13);
1093 		Actor_Says(kActorSteele, 120, 15);
1094 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHFxxGoToSpinner);
1095 		return true;
1096 
1097 	case kGoalSteeleHF02LucyLostByMcCoy:
1098 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1099 		Actor_Says(kActorSteele, 150, 13);
1100 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1101 		Actor_Says(kActorMcCoy, 1580, 13);
1102 		Actor_Says(kActorSteele, 160, 14);
1103 		Actor_Says(kActorMcCoy, 1585, 16);
1104 		Actor_Says(kActorSteele, 170, 16);
1105 		Actor_Says(kActorSteele, 180, 17);
1106 		Actor_Says(kActorMcCoy, 1590, 17);
1107 		Actor_Says(kActorSteele, 200, 15);
1108 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHFxxGoToSpinner);
1109 		return true;
1110 
1111 	case kGoalSteeleHFxxGoToSpinner:
1112 		Actor_Says(kActorSteele, 130, 13);
1113 		Actor_Says(kActorSteele, 140, 13);
1114 
1115 		Delay(500);
1116 		Game_Flag_Set(kFlagSpinnerMissing);
1117 		Player_Gains_Control();
1118 		if (Game_Flag_Query(kFlagSpinnerAtNR01)) {
1119 			Actor_Put_In_Set(kActorSteele, kSetNR01);
1120 			Actor_Set_At_XYZ(kActorSteele, 12.17f, 23.88f, -533.37f, 674);
1121 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1122 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1123 			Set_Enter(kSetNR01, kSceneNR01);
1124 		} else {
1125 			Actor_Put_In_Set(kActorSteele, kSetHF01);
1126 			Actor_Set_At_XYZ(kActorSteele, 324.32f, 8.0f, -465.87f, 674);
1127 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1128 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1129 			Set_Enter(kSetHF01, kSceneHF01);
1130 		}
1131 		return true;
1132 
1133 	case kGoalSteeleNR01ConfrontGordo:
1134 		AI_Movement_Track_Flush(kActorSteele);
1135 		Actor_Put_In_Set(kActorSteele, kSetNR01);
1136 		Actor_Set_At_XYZ(kActorSteele, 94.03f, 23.88f, -794.46f, 685);
1137 		if (Game_Flag_Query(kFlagSpinnerAtNR01)) {
1138 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1139 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1140 		}
1141 		Game_Flag_Set(kFlagSteeleAimingAtGordo);
1142 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1143 		_varChooseIdleAnimation = 3;
1144 		return true;
1145 
1146 	case kGoalSteeleNR01TalkToGordo:
1147 		Actor_Set_Targetable(kActorSteele, true);
1148 		return true;
1149 
1150 	case kGoalSteeleNR01ShootGordo:
1151 		Player_Loses_Control();
1152 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
1153 		Sound_Play(kSfxSMCAL3, 100, 0, 0, 50);
1154 		Game_Flag_Reset(kFlagSteeleAimingAtGordo);
1155 		Actor_Set_Targetable(kActorSteele, false);
1156 		Actor_Set_Goal_Number(kActorGordo, kGoalGordoNR01Die);
1157 		Delay(1500);
1158 		Player_Set_Combat_Mode(false);
1159 		Actor_Says(kActorSteele, 1070, 14);
1160 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1161 		Actor_Says(kActorSteele, 1260, 16);
1162 		Actor_Says(kActorSteele, 1270, 13);
1163 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1164 		Actor_Says(kActorMcCoy, 3065, 18);
1165 		Actor_Says(kActorSteele, 1280, 13);
1166 		Actor_Says(kActorSteele, 1290, 13);
1167 		Game_Flag_Set(kFlagGordoRanAway);
1168 		Player_Gains_Control();
1169 		if (Game_Flag_Query(kFlagSpinnerAtHF01)) {
1170 			Actor_Put_In_Set(kActorSteele, kSetHF01);
1171 			Actor_Set_At_XYZ(kActorSteele, 324.32f, 8.0f, -465.87f, 674);
1172 			Game_Flag_Set(kFlagSpinnerMissing);
1173 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1174 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1175 			Set_Enter(kSetHF01, kSceneHF01);
1176 		} else {
1177 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleTalkAboutMissingSpinner);
1178 		}
1179 		return true;
1180 
1181 	case kGoalSteeleNR01ShootMcCoy:
1182 		ADQ_Flush();
1183 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
1184 		Sound_Play(kSfxSMCAL3, 100, 0, 0, 50);
1185 		Actor_Force_Stop_Walking(kActorMcCoy);
1186 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie);
1187 		Actor_Retired_Here(kActorMcCoy, 12, 12, true, -1);
1188 		Actor_Set_Goal_Number(kActorGordo, kGoalGordoNR01ReleaseHostage);
1189 		Actor_Says(kActorSteele, 1250, kAnimationModeTalk);
1190 		return true;
1191 
1192 	case kGoalSteeleNR01McCoyShotGordo:
1193 		Game_Flag_Reset(kFlagSteeleAimingAtGordo);
1194 		ADQ_Flush();
1195 		Game_Flag_Set(kFlagGordoRanAway);
1196 		Actor_Set_Targetable(kActorSteele, false);
1197 		Delay(1000);
1198 		Player_Set_Combat_Mode(false);
1199 		Player_Loses_Control();
1200 		_animationState = 40;
1201 		_animationFrame = 0;
1202 		Delay(2000);
1203 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1204 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeIdle);
1205 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1206 		Actor_Says(kActorSteele, 1080, 17);
1207 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1208 		Actor_Says(kActorMcCoy, 3025, 14);
1209 		Actor_Says(kActorSteele, 1090, 16);
1210 		Actor_Face_Actor(kActorSteele, kActorGordo, true);
1211 		Actor_Says(kActorSteele, 1100, 13);
1212 		Actor_Says(kActorSteele, 1110, 17);
1213 		Actor_Says(kActorMcCoy, 3030, 19);
1214 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1215 		Actor_Says(kActorSteele, 1130, 15);
1216 		Actor_Says(kActorSteele, 1140, 12);
1217 		Player_Gains_Control();
1218 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleTalkAboutMissingSpinner);
1219 		return true;
1220 
1221 	case kGoalSteeleNR01McCoyShotGun:
1222 		ADQ_Flush();
1223 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeCombatAttack);
1224 		Sound_Play(kSfxSMCAL3, 100, 0, 0, 50);
1225 		_animationState = 38;
1226 		_animationFrame = 0;
1227 		Actor_Set_Goal_Number(kActorGordo, kGoalGordoNR01ReleaseHostage);
1228 		Game_Flag_Reset(kFlagSteeleAimingAtGordo);
1229 		Game_Flag_Set(kFlagGordoRanAway);
1230 		Actor_Set_Targetable(kActorSteele, false);
1231 		Player_Loses_Control();
1232 		return true;
1233 
1234 	case kGoalSteeleNR01TalkAboutShotGun:
1235 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1236 		Actor_Says(kActorSteele, 1160, 15);
1237 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1238 		Actor_Says(kActorMcCoy, 3035, 14);
1239 		Actor_Says(kActorSteele, 1170, 16);
1240 		Actor_Says(kActorMcCoy, 3040, 15);
1241 		Actor_Says(kActorSteele, 1180, 16);
1242 		Actor_Says(kActorMcCoy, 3045, 15);
1243 		Actor_Says(kActorMcCoy, 3055, 15);
1244 		Actor_Says(kActorSteele, 1190, 16);
1245 		Actor_Says(kActorMcCoy, 3060, 15);
1246 		Actor_Says(kActorSteele, 1200, 16);
1247 		Actor_Says(kActorSteele, 1210, 14);
1248 		Actor_Modify_Friendliness_To_Other(kActorSteele, kActorMcCoy, -5);
1249 		Actor_Modify_Friendliness_To_Other(kActorClovis, kActorMcCoy, 2);
1250 		Player_Set_Combat_Mode(false);
1251 		Music_Stop(2u);
1252 		Player_Gains_Control();
1253 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleTalkAboutMissingSpinner);
1254 		return true;
1255 
1256 	case kGoalSteeleNR01ShotByMcCoy:
1257 		ADQ_Flush();
1258 		Player_Loses_Control();
1259 		Game_Flag_Reset(kFlagSteeleAimingAtGordo);
1260 		Actor_Set_Targetable(kActorSteele, false);
1261 		Actor_Set_Goal_Number(kActorGordo, kGoalGordoNR01ReleaseHostage);
1262 		Actor_Start_Speech_Sample(kActorSteele, 1150);
1263 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatDie);
1264 		Delay(5000);
1265 		Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyArrested);
1266 		return true;
1267 
1268 	case kGoalSteeleNRxxGoToSpinner:
1269 		Delay(500);
1270 		Game_Flag_Set(kFlagSpinnerMissing);
1271 		Player_Gains_Control();
1272 		if (Game_Flag_Query(kFlagSpinnerAtNR01)) {
1273 			Actor_Put_In_Set(kActorSteele, kSetNR01);
1274 			Actor_Set_At_XYZ(kActorSteele, 12.17f, 23.88f, -533.37f, 674);
1275 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1276 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1277 			Set_Enter(kSetNR01, kSceneNR01);
1278 		} else {
1279 			Actor_Put_In_Set(kActorSteele, kSetHF01);
1280 			Actor_Set_At_XYZ(kActorSteele, 324.32f, 8.0f, -465.87f, 674);
1281 			Game_Flag_Reset(kFlagSpinnerAtNR01);
1282 			Game_Flag_Reset(kFlagSpinnerAtHF01);
1283 			Set_Enter(kSetHF01, kSceneHF01);
1284 		}
1285 		return true;
1286 
1287 	case kGoalSteeleTalkAboutMissingSpinner:
1288 		Actor_Says(kActorMcCoy, 2970, 15);
1289 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1290 		Actor_Says(kActorSteele, 840, 16);
1291 		Actor_Says(kActorMcCoy, 2975, 15);
1292 		Actor_Says(kActorSteele, 850, 16);
1293 		Actor_Says(kActorDispatcher, 0, kAnimationModeTalk);
1294 		Actor_Says(kActorDispatcher, 10, kAnimationModeTalk);
1295 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1296 		Actor_Says(kActorMcCoy, 2980, 12);
1297 		Actor_Says(kActorSteele, 860, 14);
1298 		Actor_Says(kActorMcCoy, 2985, 13);
1299 		Actor_Says(kActorSteele, 870, 15);
1300 		Actor_Says(kActorMcCoy, 2990, 16);
1301 		Actor_Says(kActorSteele, 880, 17);
1302 		Actor_Says(kActorSteele, 890, 18);
1303 		Actor_Says(kActorMcCoy, 2995, 12);
1304 		Actor_Says(kActorSteele, 900, 13);
1305 		Actor_Says(kActorMcCoy, 3000, 13);
1306 		Actor_Says(kActorSteele, 920, 12);
1307 		Actor_Says(kActorDispatcher, 30, kAnimationModeTalk);
1308 		Actor_Says(kActorMcCoy, 3005, 14);
1309 		Actor_Says(kActorSteele, 930, 16);
1310 		Actor_Says(kActorSteele, 950, 13);
1311 		Actor_Says(kActorMcCoy, 3010, 15);
1312 		Actor_Says(kActorSteele, 960, 15);
1313 		Actor_Says(kActorSteele, 970, 13);
1314 		Actor_Says(kActorMcCoy, 3015, 12);
1315 		Actor_Says(kActorSteele, 980, 17);
1316 		if (Player_Query_Current_Scene() == kSceneNR01) {
1317 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01StartChapter4);
1318 		} else {
1319 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleHF01StartChapter4);
1320 		}
1321 		return true;
1322 
1323 	case kGoalSteeleImmediatelyStartChapter4:
1324 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01StartChapter4);
1325 		return true;
1326 
1327 	case kGoalSteeleNR01StartChapter4:
1328 		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -281.0f, 31.93f, -1061.0f, 0, false, true, false);
1329 		Actor_Face_Heading(kActorMcCoy, 45, false);
1330 		Loop_Actor_Travel_Stairs(kActorMcCoy, 3, false, kAnimationModeIdle);
1331 		Global_Variable_Set(kVariableChapter, 4);
1332 		Scene_Exits_Enable();
1333 		Actor_Set_Health(kActorMcCoy, 50, 50);
1334 		Game_Flag_Set(kFlagMutantsActive);
1335 		Game_Flag_Set(kFlagNR01toUG06);
1336 		Game_Flag_Set(kFlagChapter4Intro);
1337 		Chapter_Enter(4, kSetUG06, kSceneUG06);
1338 		return true;
1339 
1340 	case kGoalSteeleHF01StartChapter4:
1341 		Game_Flag_Set(kFlagChapter4Starting);
1342 		Global_Variable_Set(kVariableChapter, 4);
1343 		Scene_Exits_Enable();
1344 		Game_Flag_Set(kFlagMutantsActive);
1345 		Game_Flag_Set(kFlagChapter4Intro);
1346 		Chapter_Enter(4, kSetUG06, kSceneUG06);
1347 		return true;
1348 
1349 	case kGoalSteeleStartChapter4:
1350 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele) && Query_Score(kActorMcCoy) < 75) {
1351 			Set_Score(kActorSteele, Random_Query(2, 5) + Query_Score(kActorMcCoy));
1352 		}
1353 		if (Query_Score(kActorMcCoy) > Query_Score(kActorSteele) && Query_Score(kActorMcCoy) > 74) {
1354 			Actor_Modify_Friendliness_To_Other(kActorSteele, kActorMcCoy, 3);
1355 		}
1356 		Actor_Set_Goal_Number(kActorSteele, 305);
1357 		return true;
1358 
1359 	case 305:
1360 		Actor_Put_In_Set(kActorSteele, kSetFreeSlotC);
1361 		Actor_Set_At_Waypoint(kActorSteele, 35, 0);
1362 		return true;
1363 
1364 	case kGoalSteeleStartChapter5:
1365 		// fall through
1366 	case 401:
1367 		// fall through
1368 	case kGoalSteeleKP01Left:
1369 		return true;
1370 
1371 	case 410:
1372 		Actor_Set_Targetable(kActorSteele, true);
1373 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1374 		Actor_Start_Speech_Sample(kActorSteele, 2510);
1375 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1376 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1377 		Delay(3000);
1378 		Async_Actor_Walk_To_XYZ(kActorSteele, -109.0f, -36.55f, 26.0f, 0, false);
1379 		return true;
1380 
1381 	case kGoalSteeleKP03Walk:
1382 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1383 		Actor_Says(kActorSteele, 430, 14);
1384 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1385 		Delay(4000);
1386 		Async_Actor_Walk_To_XYZ(kActorSteele, -109.0f, -36.55f, 26.0f, 0, false);
1387 		return true;
1388 
1389 	case kGoalSteeleKP03StopWalking:
1390 		Actor_Force_Stop_Walking(kActorSteele);
1391 		return true;
1392 
1393 	case kGoalSteeleKP03Leave:
1394 		Async_Actor_Walk_To_XYZ(kActorSteele, 1.0, -36.55f, 111.0f, 0, false);
1395 		return true;
1396 
1397 	case kGoalSteeleKP03Exploded:
1398 		Actor_Force_Stop_Walking(kActorSteele);
1399 		Actor_Change_Animation_Mode(kActorSteele, 51);
1400 		AI_Countdown_Timer_Start(kActorSteele, kActorTimerAIScriptCustomTask1, 2);
1401 		return true;
1402 
1403 	case kGoalSteeleKP03Dying:
1404 		Actor_Set_At_XYZ(kActorSteele, -48.83f, -36.55f, 69.98f, 280);
1405 		Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorSteele, 36, false, true);
1406 		Actor_Face_Actor(kActorMcCoy, kActorSteele, true);
1407 		if (Game_Flag_Query(kFlagMcCoyIsHelpingReplicants)) {
1408 			Actor_Says(kActorSteele, 400, 3);
1409 			Actor_Says(kActorMcCoy, 2165, 14);
1410 			Actor_Says(kActorSteele, 410, 3);
1411 			Actor_Says(kActorMcCoy, 2170, 14);
1412 			Actor_Says(kActorSteele, 420, 3);
1413 		} else {
1414 			Actor_Says(kActorSteele, 440, 3);
1415 			Actor_Says(kActorMcCoy, 2175, 14);
1416 			Actor_Says(kActorSteele, 450, 3);
1417 			Actor_Says(kActorSteele, 460, 3);
1418 			Actor_Says(kActorSteele, 470, 3);
1419 		}
1420 		AI_Countdown_Timer_Start(kActorSteele, kActorTimerAIScriptCustomTask1, 3);
1421 		return true;
1422 
1423 	case kGoalSteeleKP03ShootMcCoy:
1424 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1425 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
1426 		Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie);
1427 		Actor_Retired_Here(kActorMcCoy, 72, 18, true, -1);
1428 		return true;
1429 
1430 	case kGoalSteeleKP03Dead:
1431 		Actor_Set_Targetable(kActorSteele, false);
1432 		Game_Flag_Set(kFlagSteeleDead);
1433 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGone);
1434 		Actor_Retired_Here(kActorSteele, 60, 12, true, -1);
1435 		return true;
1436 
1437 	case kGoalSteeleKP01Wait:
1438 		Actor_Put_In_Set(kActorSteele, kSetKP01);
1439 		Actor_Set_At_XYZ(kActorSteele, 20.0f, -12.2f, -97.0f, 907);
1440 		Actor_Change_Animation_Mode(kActorSteele, 43);
1441 		return true;
1442 
1443 	case kGoalSteeleKP01TalkToMcCoy:
1444 		Game_Flag_Reset(kFlagSteeleSmoking);
1445 		Delay(2000);
1446 		Actor_Face_Actor(kActorSteele, kActorMcCoy, true);
1447 		Actor_Says(kActorSteele, 360, -1);
1448 		Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorSteele, 48, false, false);
1449 		Actor_Says(kActorMcCoy, 2150, 14);
1450 		Actor_Says(kActorSteele, 370, 15);
1451 		Actor_Says(kActorMcCoy, 2155, 12);
1452 		Actor_Says(kActorSteele, 380, 16);
1453 		Actor_Says(kActorMcCoy, 2160, 18);
1454 		Actor_Says(kActorSteele, 390, 13);
1455 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleKP01Leave);
1456 		return true;
1457 
1458 	case kGoalSteeleKP01Leave:
1459 		AI_Movement_Track_Flush(kActorSteele);
1460 		AI_Movement_Track_Append(kActorSteele, 530, 0);
1461 		AI_Movement_Track_Repeat(kActorSteele);
1462 		return true;
1463 
1464 	case kGoalSteeleKP05Enter:
1465 		Actor_Put_In_Set(kActorSteele, kSetKP05_KP06);
1466 		Actor_Set_At_XYZ(kActorSteele, -1110.0f, 0.0f, 952.0f, 155);
1467 		Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1468 		return true;
1469 
1470 	case kGoalSteeleKP05Leave:
1471 		AI_Movement_Track_Flush(kActorSteele);
1472 		AI_Movement_Track_Append_Run(kActorSteele, 541, 0);
1473 		AI_Movement_Track_Repeat(kActorSteele);
1474 		return true;
1475 
1476 	case kGoalSteeleKP06Enter:
1477 		Actor_Set_At_Waypoint(kActorSteele, 542, 0);
1478 		AI_Movement_Track_Flush(kActorSteele);
1479 		AI_Movement_Track_Append_Run(kActorSteele, 543, 0);
1480 		AI_Movement_Track_Repeat(kActorSteele);
1481 		return true;
1482 
1483 	case kGoalSteeleKP06Leave:
1484 		AI_Movement_Track_Flush(kActorSteele);
1485 		AI_Movement_Track_Append_Run(kActorSteele, 542, 0);
1486 		AI_Movement_Track_Repeat(kActorSteele);
1487 		return true;
1488 
1489 	case 450:
1490 		Actor_Put_In_Set(kActorSteele, kSetKP05_KP06);
1491 		Actor_Set_At_XYZ(kActorSteele, -947.39f, 0.0f, 728.89f, 0);
1492 		return true;
1493 
1494 	case 499:
1495 		AI_Movement_Track_Flush(kActorSteele);
1496 		Actor_Put_In_Set(kActorSteele, kSetKP05_KP06);
1497 		Actor_Set_At_XYZ(kActorSteele, -782.15f, 8.26f, -263.64f, 52);
1498 		return true;
1499 
1500 	default:
1501 		return false;
1502 	}
1503 }
1504 
UpdateAnimation(int * animation,int * frame)1505 bool AIScriptSteele::UpdateAnimation(int *animation, int *frame) {
1506 	switch (_animationState) {
1507 	case 0:
1508 		switch (_varChooseIdleAnimation) {
1509 		case 0:
1510 			*animation = kModelAnimationSteeleIdle;
1511 			++_animationFrame;
1512 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSteeleIdle)) {
1513 				_animationFrame = 0;
1514 				if (Game_Flag_Query(kFlagSteeleSmoking)) {
1515 					_animationState = 41;
1516 					_varChooseIdleAnimation = 1;
1517 					_varNumOfTimesToHoldCurrentFrame = 0;
1518 				}
1519 			}
1520 			break;
1521 
1522 		case 1:
1523 			Game_Flag_Set(kFlagSteeleSmoking);
1524 			_animationState = 41;
1525 			_varChooseIdleAnimation = 1;
1526 			_varNumOfTimesToHoldCurrentFrame = 0;
1527 			break;
1528 
1529 		case 3:
1530 			*animation = kModelAnimationSteeleWithGunAimingToRightIdle;
1531 			++_animationFrame;
1532 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSteeleWithGunAimingToRightIdle)) {
1533 				_animationFrame = 0;
1534 			}
1535 			break;
1536 		}
1537 		break;
1538 
1539 	case 1:
1540 		_animationFrame = 0;
1541 		*animation = _animationNext;
1542 		_animationState = _animationStateNext;
1543 		break;
1544 
1545 	case 2:
1546 		*animation = kModelAnimationSteeleWalking;
1547 		++_animationFrame;
1548 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1549 			_animationFrame = 0;
1550 		}
1551 		break;
1552 
1553 	case 3:
1554 		*animation = kModelAnimationSteeleRunning;
1555 		++_animationFrame;
1556 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1557 			_animationFrame = 0;
1558 		}
1559 		break;
1560 
1561 	case 4:
1562 		*animation = kModelAnimationSteeleWithGunWalking;
1563 		++_animationFrame;
1564 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1565 			_animationFrame = 0;
1566 		}
1567 		break;
1568 
1569 	case 5:
1570 		*animation = kModelAnimationSteeleWithGunRunning;
1571 		++_animationFrame;
1572 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1573 			_animationFrame = 0;
1574 		}
1575 		break;
1576 
1577 	case 6:
1578 		*animation = kModelAnimationSteeleClimbStairsUp;
1579 		++_animationFrame;
1580 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1581 			_animationFrame = 0;
1582 		}
1583 		break;
1584 
1585 	case 7:
1586 		*animation = kModelAnimationSteeleClimbStairsDown;
1587 		++_animationFrame;
1588 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1589 			_animationFrame = 0;
1590 		}
1591 		break;
1592 
1593 	case 8:
1594 		*animation = kModelAnimationSteeleWithGunClimbStairsUp;
1595 		++_animationFrame;
1596 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1597 			_animationFrame = 0;
1598 		}
1599 		break;
1600 
1601 	case 9:
1602 		*animation = kModelAnimationSteeleWithGunClimbStairsDown;
1603 		++_animationFrame;
1604 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1605 			_animationFrame = 0;
1606 		}
1607 		break;
1608 
1609 	case 10:
1610 		*animation = kModelAnimationSteeleClimbUpTrapDoor;
1611 		++_animationFrame;
1612 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1613 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1614 			*animation = kModelAnimationSteeleIdle;
1615 			_animationFrame = 0;
1616 			_animationState = 0;
1617 			if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR11Enter) {
1618 				Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR11Entered);
1619 			}
1620 		}
1621 		break;
1622 
1623 	case 11:
1624 		*animation = kModelAnimationSteeleClimbLadderUp;
1625 		++_animationFrame;
1626 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1627 			_animationFrame = 0;
1628 		}
1629 		break;
1630 
1631 	case 12:
1632 		*animation = kModelAnimationSteeleClimbLadderDown;
1633 		++_animationFrame;
1634 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1635 			_animationFrame = 0;
1636 		}
1637 		break;
1638 
1639 	case 13:
1640 		*animation = kModelAnimationSteeleHopOffLadderDown;
1641 		++_animationFrame;
1642 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1643 			_animationFrame = 0;
1644 			_animationState = 0;
1645 		}
1646 		break;
1647 
1648 	case 14:
1649 		*animation = kModelAnimationSteeleATalk;
1650 		if (_animationFrame == 0 && _resumeIdleAfterFramesetCompletesFlag
1651 		) {
1652 			*animation = kModelAnimationSteeleIdle;
1653 			_animationFrame = 0;
1654 			_animationState = 0;
1655 			_resumeIdleAfterFramesetCompletesFlag = false;
1656 		} else {
1657 			++_animationFrame;
1658 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1659 				_animationFrame = 0;
1660 			}
1661 		}
1662 		break;
1663 
1664 	case 15:
1665 		*animation = kModelAnimationSteeleBTalk;
1666 		++_animationFrame;
1667 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1668 			_animationFrame = 0;
1669 			_animationState = 14;
1670 			*animation = kModelAnimationSteeleATalk;
1671 		}
1672 		break;
1673 
1674 	case 16:
1675 		*animation = kModelAnimationSteeleSmallLeftHandMoveTalk;
1676 		++_animationFrame;
1677 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1678 			_animationFrame = 0;
1679 			_animationState = 14;
1680 			*animation = kModelAnimationSteeleATalk;
1681 		}
1682 		break;
1683 
1684 	case 17:
1685 		*animation = kModelAnimationSteeleProtestTalk;
1686 		++_animationFrame;
1687 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1688 			_animationFrame = 0;
1689 			_animationState = 14;
1690 			*animation = kModelAnimationSteeleATalk;
1691 		}
1692 		break;
1693 
1694 	case 18:
1695 		*animation = kModelAnimationSteeleDismissTalk;
1696 		++_animationFrame;
1697 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1698 			_animationFrame = 0;
1699 			_animationState = 14;
1700 			*animation = kModelAnimationSteeleATalk;
1701 		}
1702 		break;
1703 
1704 	case 19:
1705 		*animation = kModelAnimationSteeleDismissTalk;
1706 		++_animationFrame;
1707 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1708 			_animationFrame = 0;
1709 			_animationState = 14;
1710 			*animation = kModelAnimationSteeleATalk;
1711 		}
1712 		break;
1713 
1714 	case 20:
1715 		*animation = kModelAnimationSteeleWithGunAimingTalk;
1716 		if (_animationFrame == 0 && _resumeIdleAfterFramesetCompletesFlag
1717 		) {
1718 			_animationFrame = 0;
1719 			_animationState = 23;
1720 			*animation = kModelAnimationSteeleWithGunShooting;
1721 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1722 			_resumeIdleAfterFramesetCompletesFlag = false;
1723 		} else {
1724 			++_animationFrame;
1725 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1726 				_animationFrame = 0;
1727 			}
1728 		}
1729 		break;
1730 
1731 	case 21:
1732 		*animation = kModelAnimationSteeleWithGunAimingTalk;
1733 		++_animationFrame;
1734 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1735 			_animationFrame = 0;
1736 			_animationState = 20;
1737 			*animation = kModelAnimationSteeleWithGunAimingTalk;
1738 		}
1739 		break;
1740 
1741 	case 22:
1742 		*animation = kModelAnimationSteeleWithGunAimingTalk;
1743 		++_animationFrame;
1744 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1745 			_animationFrame = 0;
1746 			_animationState = 20;
1747 			*animation = kModelAnimationSteeleWithGunAimingTalk;
1748 		}
1749 		break;
1750 
1751 	case 23:
1752 		*animation = kModelAnimationSteeleWithGunIdle;
1753 		++_animationFrame;
1754 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1755 			_animationFrame = 0;
1756 		}
1757 		break;
1758 
1759 	case 24:
1760 		*animation = kModelAnimationSteeleWithGunHolsterGun;
1761 		++_animationFrame;
1762 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1763 			*animation = kModelAnimationSteeleIdle;
1764 			_animationFrame = 0;
1765 			_animationState = 0;
1766 		}
1767 		break;
1768 
1769 	case 25:
1770 		*animation = kModelAnimationSteeleWithGunUnholsterGun;
1771 		++_animationFrame;
1772 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1773 			_animationFrame = 0;
1774 			_animationState = 23;
1775 			*animation = kModelAnimationSteeleWithGunIdle;
1776 		}
1777 		break;
1778 
1779 	case 26:
1780 		*animation = kModelAnimationSteeleWithGunShooting;
1781 		++_animationFrame;
1782 		if (_animationFrame == 3) {
1783 			int snd;
1784 			if (Random_Query(1, 2) == 1) {
1785 				snd = 9010;
1786 			} else {
1787 				snd = 9015;
1788 			}
1789 			Sound_Play_Speech_Line(kActorSteele, snd, 75, 0, 99);
1790 		}
1791 
1792 		if (_animationFrame == 4) {
1793 			Actor_Combat_AI_Hit_Attempt(kActorSteele);
1794 		}
1795 
1796 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1797 			_animationFrame = 0;
1798 			_animationState = 23;
1799 			*animation = kModelAnimationSteeleWithGunIdle;
1800 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1801 			if (Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleNR11Shoot) {
1802 				Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatAttack);
1803 				_animationState = 26;
1804 				_animationFrame = 0;
1805 				*animation = kModelAnimationSteeleWithGunShooting;
1806 			}
1807 		}
1808 		break;
1809 
1810 	case 27:
1811 		*animation = kModelAnimationSteeleWithGunStrafeFast;
1812 		++_animationFrame;
1813 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1814 			_animationFrame = 0;
1815 			_animationState = 23;
1816 			*animation = kModelAnimationSteeleWithGunIdle;
1817 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1818 		}
1819 		break;
1820 
1821 	case 28:
1822 		*animation = kModelAnimationSteeleWithGunStrafeSlow;
1823 		++_animationFrame;
1824 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1825 			_animationFrame = 0;
1826 			_animationState = 23;
1827 			*animation = kModelAnimationSteeleWithGunIdle;
1828 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1829 		}
1830 		break;
1831 
1832 	case 29:
1833 		*animation = kModelAnimationSteeleWithGunGotHitRight;
1834 		++_animationFrame;
1835 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1836 			_animationFrame = 0;
1837 			_animationState = 23;
1838 			*animation = kModelAnimationSteeleWithGunIdle;
1839 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1840 		}
1841 		break;
1842 
1843 	case 30:
1844 		*animation = kModelAnimationSteeleWithGunGotHitLeft;
1845 		++_animationFrame;
1846 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1847 			_animationFrame = 0;
1848 			_animationState = 23;
1849 			*animation = kModelAnimationSteeleWithGunIdle;
1850 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeCombatIdle);
1851 		}
1852 		break;
1853 
1854 	case 31:
1855 		*animation = kModelAnimationSteeleGotHitRight;
1856 		++_animationFrame;
1857 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1858 			*animation = kModelAnimationSteeleIdle;
1859 			_animationFrame = 0;
1860 			_animationState = 0;
1861 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1862 		}
1863 		break;
1864 
1865 	case 32:
1866 		*animation = kModelAnimationSteeleGotHitLeft;
1867 		++_animationFrame;
1868 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1869 			*animation = kModelAnimationSteeleIdle;
1870 			_animationFrame = 0;
1871 			_animationState = 0;
1872 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1873 		}
1874 		break;
1875 
1876 	case 33:
1877 		*animation = kModelAnimationSteeleWithGunShotDead;
1878 		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation) - 1)
1879 			++_animationFrame;
1880 		break;
1881 
1882 	case 34:
1883 		*animation = kModelAnimationSteeleShotDead;
1884 		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation) - 1)
1885 			++_animationFrame;
1886 		break;
1887 
1888 	case 35:
1889 		*animation = kModelAnimationSteeleWithGunShotDead;
1890 		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation) - 1)
1891 			++_animationFrame;
1892 		break;
1893 
1894 	case 36:
1895 		*animation = kModelAnimationSteeleWithGunAimingToRightIdle;
1896 		++_animationFrame;
1897 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1898 			_animationFrame = 0;
1899 		}
1900 		break;
1901 
1902 	case 37:
1903 		if (_animationFrame == 0 && _resumeIdleAfterFramesetCompletesFlag
1904 		) {
1905 			_animationFrame = 0;
1906 			_animationState = 0;
1907 			_varChooseIdleAnimation = 3;
1908 			_resumeIdleAfterFramesetCompletesFlag = false;
1909 			*animation = kModelAnimationSteeleWithGunAimingToRightTalk;
1910 		} else {
1911 			*animation = kModelAnimationSteeleWithGunAimingToRightTalk;
1912 			++_animationFrame;
1913 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1914 				_animationFrame = 0;
1915 			}
1916 		}
1917 		break;
1918 
1919 	case 38:
1920 		*animation = kModelAnimationSteeleWithGunAimingToRightHandHit;
1921 		++_animationFrame;
1922 		if (_animationFrame > 5) {
1923 			Actor_Change_Animation_Mode(kActorSteele, kAnimationModeIdle);
1924 			_animationState = 0;
1925 			_animationFrame = 0;
1926 			*animation = kModelAnimationSteeleIdle;
1927 			Actor_Set_Goal_Number(kActorSteele, kGoalSteeleNR01PrepareTalkAboutShotGun);
1928 		}
1929 		break;
1930 
1931 	case 39:
1932 		*animation = kModelAnimationSteeleWithGunAimingToRightShoot;
1933 		++_animationFrame;
1934 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1935 			_animationFrame = 0;
1936 			_animationState = 36;
1937 			*animation = kModelAnimationSteeleWithGunAimingToRightIdle;
1938 		}
1939 		break;
1940 
1941 	case 40:
1942 		*animation = kModelAnimationSteeleWithGunAimingToRightHolster;
1943 		++_animationFrame;
1944 		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1945 			*animation = kModelAnimationSteeleIdle;
1946 			_animationFrame = 0;
1947 			_animationState = 0;
1948 			_varChooseIdleAnimation = 0;
1949 		}
1950 		break;
1951 
1952 	case 41:
1953 		switch (_varChooseIdleAnimation) {
1954 		case 0:
1955 			*animation = kModelAnimationSteeleIdle;
1956 			++_animationFrame;
1957 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(kModelAnimationSteeleIdle)) {
1958 				_animationFrame = 0;
1959 				if (!Game_Flag_Query(kFlagSteeleSmoking)) {
1960 					_varChooseIdleAnimation = 3;
1961 				} else if (Random_Query(1, 3) == 1) {
1962 					_varChooseIdleAnimation = 1;
1963 				}
1964 			}
1965 			break;
1966 
1967 		case 1:
1968 			*animation = kModelAnimationSteeleTakeCigPuff;
1969 			if (_varNumOfTimesToHoldCurrentFrame != 0) {
1970 				--_varNumOfTimesToHoldCurrentFrame;
1971 			} else {
1972 				++_animationFrame;
1973 				if (_animationFrame >= 6
1974 				 && _animationFrame <= 9
1975 				) {
1976 					_varNumOfTimesToHoldCurrentFrame = Random_Query(1, 3);
1977 					break;
1978 				}
1979 
1980 				if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
1981 					_animationFrame = 0;
1982 					if (Game_Flag_Query(kFlagSteeleSmoking)) {
1983 						_varChooseIdleAnimation = 0;
1984 					} else {
1985 						_varChooseIdleAnimation = 3;
1986 					}
1987 				}
1988 			}
1989 			break;
1990 
1991 		case 3:
1992 			*animation = kModelAnimationSteeleThrowCigAndStepOnIt;
1993 			++_animationFrame;
1994 			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation) - 1) {
1995 				_animationState = 0;
1996 				_animationFrame = 0;
1997 				_varChooseIdleAnimation = 0;
1998 				Game_Flag_Reset(kFlagSteeleSmoking);
1999 			}
2000 			break;
2001 		}
2002 
2003 		break;
2004 
2005 	default:
2006 		// Dummy placeholder, kModelAnimationZubenIdle (406) is a Zuben animation
2007 		*animation = kModelAnimationZubenIdle;
2008 		_animationFrame = 0;
2009 		break;
2010 	}
2011 	*frame = _animationFrame;
2012 
2013 	return true;
2014 }
2015 
ChangeAnimationMode(int mode)2016 bool AIScriptSteele::ChangeAnimationMode(int mode) {
2017 	switch (mode) {
2018 	case kAnimationModeIdle:
2019 		if (Game_Flag_Query(kFlagSteeleAimingAtGordo)) {
2020 			_varChooseIdleAnimation = 3;
2021 		} else {
2022 			_varChooseIdleAnimation = 0;
2023 		}
2024 
2025 		switch (_animationState) {
2026 		case 0:
2027 			// fall through
2028 		case 24:
2029 			// fall through
2030 		case 34:
2031 			// fall through
2032 		case 35:
2033 			// fall through
2034 		case 41:
2035 			return true;
2036 
2037 		case 4:
2038 			_animationState = 23;
2039 			_animationFrame = 0;
2040 			break;
2041 
2042 		case 14:
2043 			// fall through
2044 		case 15:
2045 			// fall through
2046 		case 16:
2047 			// fall through
2048 		case 17:
2049 			// fall through
2050 		case 18:
2051 			// fall through
2052 		case 19:
2053 			_resumeIdleAfterFramesetCompletesFlag = true;
2054 			break;
2055 
2056 		case 20:
2057 			// fall through
2058 		case 21:
2059 			// fall through
2060 		case 22:
2061 			// fall through
2062 		case 37:
2063 			_resumeIdleAfterFramesetCompletesFlag = true;
2064 			_animationState = 23;
2065 			_animationFrame = 0;
2066 			break;
2067 
2068 		case 23:
2069 			// fall through
2070 		case 26:
2071 			_animationState = 24;
2072 			_animationFrame = 0;
2073 			break;
2074 
2075 		default:
2076 			_animationFrame = 0;
2077 			if (Game_Flag_Query(kFlagSteeleSmoking)) {
2078 				_animationState = 41;
2079 				_varChooseIdleAnimation = 1;
2080 			} else {
2081 				_animationState = 0;
2082 			}
2083 			break;
2084 		}
2085 		break;
2086 
2087 	case kAnimationModeWalk:
2088 		if ((_animationState != 4
2089 		  && _animationState != 23
2090 		  && _animationState != 25
2091 		  && _animationState != 26
2092 		 )
2093 		 || _animationState > 26
2094 		) {
2095 			if (Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleApprehendIzo
2096 			 && Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleArrestIzo
2097 			) {
2098 				_animationState = 2;
2099 				_animationFrame = 0;
2100 			} else {
2101 				_animationState = 4;
2102 				_animationFrame = 0;
2103 			}
2104 		} else {
2105 			_animationState = 4;
2106 			_animationFrame = 0;
2107 		}
2108 		break;
2109 
2110 	case kAnimationModeRun:
2111 		if (Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleApprehendIzo
2112 		 && Actor_Query_Goal_Number(kActorSteele) != kGoalSteeleArrestIzo
2113 		 && _animationState != 23
2114 		) {
2115 			_animationState = 3;
2116 			_animationFrame = 0;
2117 		} else {
2118 			_animationState = 5;
2119 			_animationFrame = 0;
2120 		}
2121 		break;
2122 
2123 	case kAnimationModeTalk:
2124 		if (_animationState != 35) {
2125 			if (Game_Flag_Query(kFlagSteeleAimingAtGordo)) {
2126 				_animationState = 37;
2127 				_animationFrame = 0;
2128 				_resumeIdleAfterFramesetCompletesFlag = false;
2129 			} else {
2130 				if (_animationState > 0) {
2131 					_animationState = 14;
2132 					_animationFrame = 0;
2133 				} else {
2134 					_animationState = 1;
2135 					_animationFrame = 0;
2136 					_animationStateNext = 14;
2137 					_animationNext = kModelAnimationSteeleATalk;
2138 				}
2139 				_resumeIdleAfterFramesetCompletesFlag = false;
2140 			}
2141 		}
2142 		break;
2143 
2144 	case kAnimationModeCombatIdle:
2145 		if (_animationState > 0) {
2146 			if (_animationState > 25
2147 			 || (_animationState != 23
2148 			  && _animationState != 25)
2149 			) {
2150 				_animationState = 23;
2151 				_animationFrame = 0;
2152 			}
2153 		} else {
2154 			_animationState = 25;
2155 			_animationFrame = 0;
2156 		}
2157 		break;
2158 
2159 	case kAnimationModeCombatAttack:
2160 		if (Game_Flag_Query(kFlagSteeleAimingAtGordo)) {
2161 			_animationState = 39;
2162 		} else {
2163 			_animationState = 26;
2164 		}
2165 		_animationFrame = 0;
2166 		break;
2167 
2168 	case kAnimationModeCombatWalk:
2169 		_animationState = 4;
2170 		_animationFrame = 0;
2171 		break;
2172 
2173 	case kAnimationModeCombatRun:
2174 		_animationState = 5;
2175 		_animationFrame = 0;
2176 		break;
2177 
2178 	case 12:
2179 		if (_animationState > 0) {
2180 			_animationState = 15;
2181 			_animationFrame = 0;
2182 		} else {
2183 			_animationState = 1;
2184 			_animationFrame = 0;
2185 			_animationStateNext = 15;
2186 			_animationNext = kModelAnimationSteeleBTalk;
2187 		}
2188 		_resumeIdleAfterFramesetCompletesFlag = false;
2189 		break;
2190 
2191 	case 13:
2192 		if (_animationState > 0) {
2193 			_animationState = 16;
2194 			_animationFrame = 0;
2195 		} else {
2196 			_animationState = 1;
2197 			_animationFrame = 0;
2198 			_animationStateNext = 16;
2199 			_animationNext = kModelAnimationSteeleSmallLeftHandMoveTalk;
2200 		}
2201 		_resumeIdleAfterFramesetCompletesFlag = false;
2202 		break;
2203 
2204 	case 14:
2205 		if (_animationState > 0) {
2206 			_animationState = 17;
2207 			_animationFrame = 0;
2208 		} else {
2209 			_animationState = 1;
2210 			_animationFrame = 0;
2211 			_animationStateNext = 17;
2212 			_animationNext = kModelAnimationSteeleProtestTalk;
2213 		}
2214 		_resumeIdleAfterFramesetCompletesFlag = false;
2215 		break;
2216 
2217 	case 15:
2218 		if (_animationState > 0) {
2219 			_animationState = 18;
2220 			_animationFrame = 0;
2221 		} else {
2222 			_animationState = 1;
2223 			_animationFrame = 0;
2224 			_animationStateNext = 18;
2225 			_animationNext = kModelAnimationSteeleDismissTalk;
2226 		}
2227 		_resumeIdleAfterFramesetCompletesFlag = false;
2228 		break;
2229 
2230 	case 16:
2231 		if (_animationState > 0) {
2232 			_animationState = 19;
2233 			_animationFrame = 0;
2234 		} else {
2235 			_animationState = 1;
2236 			_animationFrame = 0;
2237 			_animationStateNext = 19;
2238 			_animationNext = kModelAnimationSteeleDismissTalk;
2239 		}
2240 		_resumeIdleAfterFramesetCompletesFlag = false;
2241 		break;
2242 
2243 	case kAnimationModeHit:
2244 		if (_animationState > 28) {
2245 			if (Random_Query(0, 1)) {
2246 				_animationState = 31;
2247 			} else {
2248 				_animationState = 32;
2249 			}
2250 		} else if (Random_Query(0, 1)) {
2251 			_animationState = 29;
2252 		} else {
2253 			_animationState = 30;
2254 		}
2255 		_animationFrame = 0;
2256 		break;
2257 
2258 	case kAnimationModeCombatHit:
2259 		if (Random_Query(0, 1)) {
2260 			_animationState = 29;
2261 		} else {
2262 			_animationState = 30;
2263 		}
2264 		_animationFrame = 0;
2265 		break;
2266 
2267 	case 43:
2268 		Game_Flag_Set(kFlagSteeleSmoking);
2269 		_animationState = 41;
2270 		_animationFrame = 0;
2271 		_varNumOfTimesToHoldCurrentFrame = 0;
2272 		_varChooseIdleAnimation = 1;
2273 		break;
2274 
2275 	case kAnimationModeWalkUp:
2276 		_animationState = 6;
2277 		_animationFrame = 0;
2278 		break;
2279 
2280 	case kAnimationModeWalkDown:
2281 		_animationState = 7;
2282 		_animationFrame = 0;
2283 		break;
2284 
2285 	case kAnimationModeCombatWalkUp:
2286 		_animationState = 8;
2287 		_animationFrame = 0;
2288 		break;
2289 
2290 	case kAnimationModeCombatWalkDown:
2291 		_animationState = 9;
2292 		_animationFrame = 0;
2293 		break;
2294 
2295 	case kAnimationModeDie:
2296 		if (_animationState != 33
2297 		 && _animationState != 34
2298 		) {
2299 			if (_animationState > 26
2300 			 || (_animationState != 23
2301 			  && _animationState != 25
2302 			  && _animationState != 26
2303 			 )
2304 			) {
2305 				_animationState = 34;
2306 				_animationFrame = 0;
2307 			} else {
2308 				_animationState = 33;
2309 				_animationFrame = 0;
2310 			}
2311 		}
2312 		break;
2313 
2314 	case kAnimationModeCombatDie:
2315 		if (_animationState != 33) {
2316 			_animationState = 33;
2317 			_animationFrame = 0;
2318 		}
2319 		break;
2320 
2321 	case 51:
2322 		_animationState = 35;
2323 		_animationFrame = 0;
2324 		break;
2325 
2326 	case 58:
2327 		_animationState = 20;
2328 		_animationFrame = 0;
2329 		_resumeIdleAfterFramesetCompletesFlag = false;
2330 		break;
2331 
2332 	case 59:
2333 		_animationState = 21;
2334 		_animationFrame = 0;
2335 		_resumeIdleAfterFramesetCompletesFlag = false;
2336 		break;
2337 
2338 	case 60:
2339 		_animationState = 22;
2340 		_animationFrame = 0;
2341 		_resumeIdleAfterFramesetCompletesFlag = false;
2342 		break;
2343 
2344 	case 86:
2345 		_animationState = 10;
2346 		_animationFrame = 0;
2347 		break;
2348 	}
2349 
2350 	return true;
2351 }
2352 
QueryAnimationState(int * animationState,int * animationFrame,int * animationStateNext,int * animationNext)2353 void AIScriptSteele::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) {
2354 	*animationState     = _animationState;
2355 	*animationFrame     = _animationFrame;
2356 	*animationStateNext = _animationStateNext;
2357 	*animationNext      = _animationNext;
2358 }
2359 
SetAnimationState(int animationState,int animationFrame,int animationStateNext,int animationNext)2360 void AIScriptSteele::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) {
2361 	_animationState     = animationState;
2362 	_animationFrame     = animationFrame;
2363 	_animationStateNext = animationStateNext;
2364 	_animationNext      = animationNext;
2365 }
2366 
ReachedMovementTrackWaypoint(int waypointId)2367 bool AIScriptSteele::ReachedMovementTrackWaypoint(int waypointId) {
2368 	if (waypointId == 174
2369 	 && Actor_Query_Goal_Number(kActorSteele) == kGoalSteeleLeaveRC03
2370 	) {
2371 		Actor_Set_Goal_Number(kActorSteele, kGoalSteeleGoToPoliceStation);
2372 	}
2373 	return true;
2374 }
2375 
FledCombat()2376 void AIScriptSteele::FledCombat() {
2377 	// return false;
2378 }
2379 
2380 } // End of namespace BladeRunner
2381