aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script/ai/free_slot_b.cpp
blob: e6cb0e2dc31295036d3d94d57b26f17dec30d5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#include "bladerunner/script/ai_script.h"
//#include "common/debug.h"

namespace BladeRunner {

AIScriptFreeSlotB::AIScriptFreeSlotB(BladeRunnerEngine *vm) : AIScriptBase(vm) {
	_var1 = 0;
	_var2 = 1;
}

void AIScriptFreeSlotB::Initialize() {
	_animationFrame = 0;
	_animationState = 0;
	_animationStateNext = 0;
	_animationNext = 0;

	_var1 = 0;
	_var2 = 1;

	World_Waypoint_Set(527, kSetKP02,  -468.46f, -616.58f, 2840.60f);
	// TODO: A bug? world waypoints 528, 529 are unused
	World_Waypoint_Set(528, kSetKP02, -1024.46f, -615.49f, 2928.60f);
	World_Waypoint_Set(529, kSetKP02, -1024.46f, -615.49f, 2788.60f);
}

bool AIScriptFreeSlotB::Update() {
	if (Global_Variable_Query(kVariableChapter) > 5) {
		return false;
	}

	if (Global_Variable_Query(kVariableChapter) == 4) {
		switch (Actor_Query_Goal_Number(kActorFreeSlotB)) {
		case kGoalFreeSlotBAct4Default:
			Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4WalkAround);
			Actor_Set_Targetable(kActorFreeSlotB, true);
			break;

		case kGoalFreeSlotBAct4WalkAround:
#if BLADERUNNER_ORIGINAL_BUGS
			if (Actor_Query_Which_Set_In(kActorFreeSlotB) == Player_Query_Current_Set()
			    && Actor_Query_Inch_Distance_From_Actor(kActorFreeSlotB, kActorMcCoy) <= 48
			) {
				Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4AttackMcCoy);
			}
#else
			if (Actor_Query_Which_Set_In(kActorFreeSlotB) == Player_Query_Current_Set()
			    && Actor_Query_Inch_Distance_From_Actor(kActorFreeSlotB, kActorMcCoy) <= 54
			) {
				Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4AttackMcCoy);
			}
#endif // BLADERUNNER_ORIGINAL_BUGS
			break;

		case kGoalFreeSlotBAct4AttackMcCoy:
			if (Actor_Query_Which_Set_In(kActorFreeSlotB) != Player_Query_Current_Set()) {
				Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4WalkAround);
			}
			break;

		case kGoalFreeSlotBGone:
			if (Actor_Query_Which_Set_In(kActorFreeSlotB) != Player_Query_Current_Set()) {
				Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4Default);
			}
			break;

		default:
			Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4Default);
			break;
		}

		return false;
	}
	// if in Act 5
	if (Actor_Query_Goal_Number(kActorFreeSlotB) < kGoalFreeSlotBAct5Default) {
		AI_Movement_Track_Flush(kActorFreeSlotB);
		Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct5Default);
		return true;
	} else {
		if (Actor_Query_Goal_Number(kActorFreeSlotB) != kGoalFreeSlotBAct5Prepare
		    || Actor_Query_Which_Set_In(kActorMcCoy) != kSetKP02
		) {
			if (Actor_Query_Goal_Number(kActorFreeSlotB) == kGoalFreeSlotBGone) {
				if (Actor_Query_Which_Set_In(kActorFreeSlotB) != Player_Query_Current_Set()) {
					Non_Player_Actor_Combat_Mode_Off(kActorFreeSlotB);
					Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct5Default);
					return true;
				}
			}
			return false;
		}
		Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct5KP02Attack);
		Actor_Set_Targetable(kActorFreeSlotB, true);
		return true;
	}
}

void AIScriptFreeSlotB::TimerExpired(int timer) {
	//return false;
}

void AIScriptFreeSlotB::CompletedMovementTrack() {
//	debug("Rat B completed move with Goal: %d", Actor_Query_Goal_Number(kActorFreeSlotB));
	switch (Actor_Query_Goal_Number(kActorFreeSlotB)) {
	case kGoalFreeSlotBAct4Default:
		Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4WalkAround);
		break;

	case kGoalFreeSlotBAct4WalkAround:
		Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4Default);
		break;

	case kGoalFreeSlotBAct5Default:
		Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct5Prepare);
		break;

	case kGoalFreeSlotBAct5KP02Attack:
		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, 0, 100, 5, 300, false);
		break;

	default:
		return; //false;
	}

	return; //true;
}

void AIScriptFreeSlotB::ReceivedClue(int clueId, int fromActorId) {
	//return false;
}

void AIScriptFreeSlotB::ClickedByPlayer() {
	if (Actor_Query_Goal_Number(kActorFreeSlotB) != kGoalFreeSlotBGone)
		return; //false;

	Actor_Face_Actor(kActorMcCoy, kActorFreeSlotB, true);
	if (_vm->_cutContent && !Game_Flag_Query(kFlagMcCoyCommentsOnHoodooRats)) {
		Game_Flag_Set(kFlagMcCoyCommentsOnHoodooRats);
		Actor_Voice_Over(1060, kActorVoiceOver);  // Hoodoo rats
		Actor_Voice_Over(1080, kActorVoiceOver);
		Actor_Voice_Over(1090, kActorVoiceOver);
	} else {
		if (Random_Query(1, 2) == 1) {
			Actor_Says(kActorMcCoy, 8655, 16);
		} else {
			Actor_Says(kActorMcCoy, 8665, 16);
		}
	}
}

void AIScriptFreeSlotB::EnteredScene(int sceneId) {
	// return false;
}

void AIScriptFreeSlotB::OtherAgentEnteredThisScene(int otherActorId) {
	// return false;
}

void AIScriptFreeSlotB::OtherAgentExitedThisScene(int otherActorId) {
#if !BLADERUNNER_ORIGINAL_BUGS
	if (otherActorId == kActorMcCoy && Actor_Query_Goal_Number(kActorFreeSlotB) == kGoalFreeSlotBGone) {
		if (Global_Variable_Query(kVariableChapter) == 4) {
			Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct4Default);
		} else if (Global_Variable_Query(kVariableChapter) == 5) {
			Non_Player_Actor_Combat_Mode_Off(kActorFreeSlotB);
			Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBAct5Default);
		}
	}

#endif // BLADERUNNER_ORIGINAL_BUGS
	// return false;
}

void AIScriptFreeSlotB::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
	// return false;
}

void AIScriptFreeSlotB::ShotAtAndMissed() {
	// return false;
}

bool AIScriptFreeSlotB::ShotAtAndHit() {
	return false;
}

void AIScriptFreeSlotB::Retired(int byActorId) {
	Actor_Set_Goal_Number(kActorFreeSlotB, kGoalFreeSlotBGone);
}

int AIScriptFreeSlotB::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
	return 0;
}

bool AIScriptFreeSlotB::GoalChanged(int currentGoalNumber, int newGoalNumber) {
//	debug("Rat B goal changed from %d to: %d", currentGoalNumber, newGoalNumber);
	switch (newGoalNumber) {
	case kGoalFreeSlotBAct4Default:
		// kSetFreeSlotG
		AI_Movement_Track_Flush(kActorFreeSlotB);
		AI_Movement_Track_Append(kActorFreeSlotB, 39, 2);
		AI_Movement_Track_Repeat(kActorFreeSlotB);
		break;

	case kGoalFreeSlotBAct4WalkAround:
		AI_Movement_Track_Flush(kActorFreeSlotB);
		goToRandomUGxx();
		AI_Movement_Track_Repeat(kActorFreeSlotB);
		break;

	case kGoalFreeSlotBAct4AttackMcCoy:
		Actor_Set_Targetable(kActorFreeSlotB, true);
		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 25, 0, 75, 5, 300, false);
		break;

	case kGoalFreeSlotBAct5Default:
		// kSetFreeSlotG
		AI_Movement_Track_Append(kActorFreeSlotB, 39, 0);
		AI_Movement_Track_Repeat(kActorFreeSlotB);
		break;

	case kGoalFreeSlotBAct5KP02Attack:
		// kSetKP02
		AI_Movement_Track_Flush(kActorFreeSlotB);
		AI_Movement_Track_Append(kActorFreeSlotB, 527, 0);
		AI_Movement_Track_Repeat(kActorFreeSlotB);
		break;

	case kGoalFreeSlotBGone:
		Actor_Set_Health(kActorFreeSlotB, 20, 20);
		break;

	default:
		return false;
	}

	return true;
}

bool AIScriptFreeSlotB::UpdateAnimation(int *animation, int *frame) {
	switch (_animationState) {
	case 0:
		*animation = 861;
		_animationFrame++;
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(861)) {
			_animationFrame = 0;
		}
		break;

	case 1:
		*animation = 862;
		if (_var1) {
			_var1--;
		} else {
			_animationFrame += _var2;
			if (_animationFrame < 8) {
				_var2 = 1;
			} else {
				if (_animationFrame > 8) {
					_var2 = -1;
				} else if (Random_Query(0, 4)) {
					_var2 = -_var2;
				}
			}
			if (_animationFrame >= 7 && _animationFrame <= 9) {
				_var1 = Random_Query(0, 1);
			}
		}
		break;

	case 2:
		*animation = 862;
		_animationFrame++;
		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(862) - 1) {
			*animation = 861;
			_animationFrame = 0;
			_animationState = 0;
		}
		break;

	case 3:
		*animation = 858;
		_animationFrame++;
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(858)) {
			_animationFrame = 0;
		}
		break;

	case 4:
		*animation = 857;
		_animationFrame++;
		if (_animationFrame == 3) {
			int snd;
			if (Random_Query(1, 2) == 1) {
				snd = 9010;
			} else {
				snd = 9015;
			}
			Sound_Play_Speech_Line(kActorFreeSlotB, snd, 75, 0, 99);
		}
		if (_animationFrame == 3) {
			Actor_Combat_AI_Hit_Attempt(kActorFreeSlotB);
		}
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
			*animation = 861;
			_animationFrame = 0;
			_animationState = 0;
		}
		break;

	case 5:
		// This is an animation for Maggie (exploding) but is also used for generic death states (rats, generic walkers)
		// probably for debug purposes
		*animation = 874;
		_animationFrame++;
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(874) - 1) {
			_animationState = 8;
			_animationFrame = Slice_Animation_Query_Number_Of_Frames(874) - 1;
		}
		break;

	case 6:
		if (_animationFrame == 1) {
			Ambient_Sounds_Play_Sound(kSfxRATTY3, 99, 0, 0, 20);
		}
		*animation = 860;
		_animationFrame++;
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(860)) {
			_animationFrame = 0;
			_animationState = 0;
			Actor_Change_Animation_Mode(kActorFreeSlotB, kAnimationModeIdle);
		}
		break;

	case 7:
		*animation = 859;
		_animationFrame++;
		if (_animationFrame == 1) {
			Ambient_Sounds_Play_Sound(kSfxRATTY5, 99, 0, 0, 25);
		}
#if BLADERUNNER_ORIGINAL_BUGS
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(859) - 1) {
			_animationFrame = Slice_Animation_Query_Number_Of_Frames(859) - 1;
		}
		_animationState = 8;
#else
		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(859) - 1) {
			_animationFrame = Slice_Animation_Query_Number_Of_Frames(859) - 1;
			_animationState = 8;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		break;

	case 8:
		*animation = 859;
		_animationFrame = Slice_Animation_Query_Number_Of_Frames(859) - 1;
		break;

	default:
		break;
	}
	*frame = _animationFrame;
	return true;
}

bool AIScriptFreeSlotB::ChangeAnimationMode(int mode) {
	switch (mode) {
	case 0:
		if ((unsigned int)(_animationState - 1) > 1) {
			_animationState = 0;
			_animationFrame = 0;
		} else if (_animationState == 1) {
			_animationState = 2;
		}
		break;

	case 1:
		_animationState = 3;
		_animationFrame = 0;
		break;

	case 4:
		if ((unsigned int)(_animationState - 1) > 1) {
			_animationState = 0;
			_animationFrame = 0;
		} else if (_animationState == 1) {
			_animationState = 2;
		}
		break;

	case 6:
		_animationState = 4;
		_animationFrame = 0;
		break;

	case 7:
		_animationState = 3;
		_animationFrame = 0;
		break;

	case 8:
		_animationState = 3;
		_animationFrame = 0;
		break;

	case 21:
		_animationState = 6;
		_animationFrame = 0;
		break;

	case 43:
		_animationState = 1;
		_animationFrame = 0;
		break;

	case kAnimationModeDie:
		_animationState = 7;
		_animationFrame = 0;
		break;
	}

	return true;
}

void AIScriptFreeSlotB::QueryAnimationState(int *animationState, int *animationFrame, int *animationStateNext, int *animationNext) {
	*animationState     = _animationState;
	*animationFrame     = _animationFrame;
	*animationStateNext = _animationStateNext;
	*animationNext      = _animationNext;
}

void AIScriptFreeSlotB::SetAnimationState(int animationState, int animationFrame, int animationStateNext, int animationNext) {
	_animationState     = animationState;
	_animationFrame     = animationFrame;
	_animationStateNext = animationStateNext;
	_animationNext      = animationNext;
}

bool AIScriptFreeSlotB::ReachedMovementTrackWaypoint(int waypointId) {
	return true;
}

void AIScriptFreeSlotB::FledCombat() {
	// return false;
}

void AIScriptFreeSlotB::goToRandomUGxx() {
	switch (Random_Query(1, 14)) {
	case 1:
		// kSetUG01
#if BLADERUNNER_ORIGINAL_BUGS
		AI_Movement_Track_Append(kActorFreeSlotB, 450, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 451, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 450, 0);
		break;
#else
		// Don't put rats in UG01 when Lucy is also here
		if (!Actor_Query_In_Set(kActorLucy, kSetUG01)) {
			AI_Movement_Track_Append(kActorFreeSlotB, 450, 1);
			AI_Movement_Track_Append(kActorFreeSlotB, 451, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 450, 0);
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 2:
		// kSetUG01
#if BLADERUNNER_ORIGINAL_BUGS
		World_Waypoint_Set(466, kSetUG01, 144.98f, -50.13f, -175.75f);
		World_Waypoint_Set(547, kSetUG01, 105.6f,  -50.13f, -578.46f);
		World_Waypoint_Set(548, kSetUG01,  62.0f,  -50.13f, -574.0f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 548, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 5);
		break;
#else
		// Don't put rats in UG01 when Lucy is also here
		if (!Actor_Query_In_Set(kActorLucy, kSetUG01)) {
			World_Waypoint_Set(466, kSetUG01, 144.98f, -50.13f, -175.75f);
			World_Waypoint_Set(547, kSetUG01, 105.6f,  -50.13f, -578.46f);
			World_Waypoint_Set(548, kSetUG01,  62.0f,  -50.13f, -574.0f);
			AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
			AI_Movement_Track_Append(kActorFreeSlotB, 548, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 466, 5);
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 3:
		// kSetUG04
		AI_Movement_Track_Append(kActorFreeSlotB, 446, 15);
		AI_Movement_Track_Append(kActorFreeSlotB, 447,  1);
		AI_Movement_Track_Append(kActorFreeSlotB, 449,  1);
		AI_Movement_Track_Append(kActorFreeSlotB, 448,  2);
		AI_Movement_Track_Append(kActorFreeSlotB, 449,  0);
		break;

	case 4:
		// kSetUG04
		World_Waypoint_Set(466, kSetUG04, -22.70f,  6.39f,    33.12f);
		World_Waypoint_Set(547, kSetUG04,  -6.70f, -1.74f,  -362.88f);
		World_Waypoint_Set(548, kSetUG04, 164.0f,  11.87f, -1013.0f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 2);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 0);
		AI_Movement_Track_Append(kActorFreeSlotB, 548, 0);
		break;

	case 5:
		// kSetUG05
		AI_Movement_Track_Append(kActorFreeSlotB, 457, 15);
		AI_Movement_Track_Append(kActorFreeSlotB, 458,  0);
		AI_Movement_Track_Append(kActorFreeSlotB, 459, 15);
		break;

	case 6:
		// kSetUG06
		AI_Movement_Track_Append(kActorFreeSlotB, 460, 15);
		AI_Movement_Track_Append(kActorFreeSlotB, 461,  5);
		AI_Movement_Track_Append(kActorFreeSlotB, 460, 15);
		break;

	case 7:
		// kSetUG07 or kSetFreeSlotG
#if BLADERUNNER_ORIGINAL_BUGS
		if (Actor_Query_In_Set(kActorClovis, kSetUG07)) {
			// this check is not very effective since Clovis
			// will spawn in the set when McCoy goes to the downwards exit
			// at which point a rat may already be in the set and that could
			// make them collide with Clovis' path
			AI_Movement_Track_Append(kActorFreeSlotB, 39, 10);
		} else {
			World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
			World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
			World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
			AI_Movement_Track_Append(kActorFreeSlotB, 466, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
			// TODO: A bug? the waypoint 548 is created but is unused
		}
		break;
#else
		// Don't put rats in UG07 after the UG18 Guzza scene
		// since Clovis may be there too and that does not work well
		if (!Game_Flag_Query(kFlagUG18GuzzaScene)) {
			World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
			World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
			World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
			AI_Movement_Track_Append(kActorFreeSlotB, 466, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
			// TODO: A bug? the waypoint 548 is created but is unused
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 8:
		// kSetUG07
#if BLADERUNNER_ORIGINAL_BUGS
		World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
		World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
		World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		// TODO: A bug? the waypoint 548 is created but is unused
		break;
#else
		// Don't put rats in UG07 after the UG18 Guzza scene
		// since Clovis may be there too and that does not work well
		if (!Game_Flag_Query(kFlagUG18GuzzaScene)) {
			World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
			World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
			World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
			// TODO: A bug? the waypoint 548 is created but is unused
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 9:
		// kSetUG07
#if BLADERUNNER_ORIGINAL_BUGS
		World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
		World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
		World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 548, 1);
		// TODO: A bug? the waypoint 466 is created but is unused
		break;
#else
		// Don't put rats in UG07 after the UG18 Guzza scene
		// since Clovis may be there too and that does not work well
		if (!Game_Flag_Query(kFlagUG18GuzzaScene)) {
			World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
			World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
			World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 548, 1);
			// TODO: A bug? the waypoint 466 is created but is unused
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 10:
		// kSetUG07
#if BLADERUNNER_ORIGINAL_BUGS
		World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
		World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
		World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
		AI_Movement_Track_Append(kActorFreeSlotB, 548, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
		// TODO: A bug? the waypoint 466 is created but is unused
		break;
#else
		// Don't put rats in UG07 after the UG18 Guzza scene
		// since Clovis may be there too and that does not work well
		if (!Game_Flag_Query(kFlagUG18GuzzaScene)) {
			World_Waypoint_Set(466, kSetUG07,  -88.78f, -12.21f, -184.08f);
			World_Waypoint_Set(547, kSetUG07,  250.0f,  -12.21f, -342.0f);
			World_Waypoint_Set(548, kSetUG07, -164.78f, -12.21f, -832.08f);
			AI_Movement_Track_Append(kActorFreeSlotB, 548, 5);
			AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
			// TODO: A bug? the waypoint 466 is created but is unused
			break;
		}
#endif // BLADERUNNER_ORIGINAL_BUGS
		// fall through
	case 11:
		// kSetUG09
		World_Waypoint_Set(466, kSetUG09,   91.0f, 156.94f, -498.0f);
		World_Waypoint_Set(547, kSetUG09, -149.0f, 156.94f, -498.0f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
		break;

	case 12:
		// kSetUG09
		World_Waypoint_Set(466, kSetUG09,   91.0f, 156.94f, -498.0f);
		World_Waypoint_Set(547, kSetUG09, -149.0f, 156.94f, -498.0f);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 5);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		break;

	case 13:
		// kSetUG09
#if BLADERUNNER_ORIGINAL_BUGS
		// this makes the rat appear on the pipe (top left)
		// but this is buggy since it will appear floating there
		World_Waypoint_Set(466, kSetUG09, -152.51f, 277.31f, 311.98f);
		World_Waypoint_Set(547, kSetUG09, -124.51f, 275.08f, 319.98f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 8);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
#else
		// replacing with something more normal
		World_Waypoint_Set(466, kSetUG09, -149.0f,  156.94f, -498.0f);
		World_Waypoint_Set(547, kSetUG09,  -32.60f, 156.94f, -498.0f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 2);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
#endif // BLADERUNNER_ORIGINAL_BUGS
		break;

	case 14:
		// kSetUG12
		World_Waypoint_Set(466, kSetUG12, -360.67f, 21.39f,   517.55f);
		World_Waypoint_Set(547, kSetUG12, -250.67f, 21.39f,   477.55f);
		World_Waypoint_Set(548, kSetUG12, -248.67f, 21.39f, -1454.45f);
		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
		AI_Movement_Track_Append(kActorFreeSlotB, 547, 8);
		AI_Movement_Track_Append(kActorFreeSlotB, 548, 1);
		break;

	default:
		// kSetFreeSlotG
		AI_Movement_Track_Append(kActorFreeSlotB, 39, Random_Query(1, 10));
		break;
	}
}

} // End of namespace BladeRunner