[Scummvm-git-logs] scummvm master -> 203d82a1a0382684884da0d6c285444605153802

antoniou79 antoniou at cti.gr
Mon May 20 12:13:49 CEST 2019


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ea3a9f211d BLADERUNNER: Cleanup of police AI and fix for rat ai
5b2e6f6dfb BLADERUNNER: Cleanup and fix for NR03 dancer
203d82a1a0 BLADERUNNER: Officers and combat bugfixes part 1


Commit: ea3a9f211da74ffd3aa35328147566160a73d680
    https://github.com/scummvm/scummvm/commit/ea3a9f211da74ffd3aa35328147566160a73d680
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-19T14:34:01+03:00

Commit Message:
BLADERUNNER: Cleanup of police AI and fix for rat ai

Changed paths:
    engines/bladerunner/game_constants.h
    engines/bladerunner/script/ai/free_slot_a.cpp
    engines/bladerunner/script/ai/free_slot_b.cpp
    engines/bladerunner/script/ai/moraji.cpp
    engines/bladerunner/script/ai/officer_grayford.cpp
    engines/bladerunner/script/ai/officer_leary.cpp
    engines/bladerunner/script/init_script.cpp
    engines/bladerunner/script/scene/ct12.cpp
    engines/bladerunner/script/scene/dr04.cpp
    engines/bladerunner/script/scene/hf05.cpp
    engines/bladerunner/script/scene/hf06.cpp
    engines/bladerunner/script/scene/ma04.cpp
    engines/bladerunner/script/scene/tb03.cpp
    engines/bladerunner/script/scene/ug05.cpp
    engines/bladerunner/script/scene/ug07.cpp


diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index c1163a8..4f91989 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -2378,11 +2378,61 @@ enum GoalOfficerLeary {
 	kGoalOfficerLearyDefault = 0,
 	kGoalOfficerLearyRC01WalkToCrowd = 1,
 #if BLADERUNNER_ORIGINAL_BUGS
-	kGoalOfficerLearyRC01CrowdInterrogation = 2
+	kGoalOfficerLearyRC01CrowdInterrogation = 2,
 #else
 	kGoalOfficerLearyRC01CrowdInterrogation = 2,
-	kGoalOfficerLearyRC01ResumeWalkToCrowd = 4
+	kGoalOfficerLearyRC01ResumeWalkToCrowd = 4, // added OfficerLeary goal
 #endif // BLADERUNNER_ORIGINAL_BUGS
+	kGoalOfficerLearyPoliceDoneFromRC01 = 3,
+	kGoalOfficerLearyEndOfAct1 = 99,
+	kGoalOfficerLearyVisitsBulletBob = 102, // un-triggered
+	kGoalOfficerLearyStartOfAct4 = 300,
+	kGoalOfficerLearyHuntingAroundAct4 = 305,
+	kGoalOfficerLearyPrepareToHuntAroundAct4 = 306,
+	kGoalOfficerLearyBlockingUG07 = 307,
+	// 308 - 309 un-triggered?
+	kGoalOfficerLearyAttackMcCoyAct4 = 310,
+	kGoalOfficerLearyStartOfAct5 = 400,
+	kGoalOfficerLearyDummyGoalAct5 = 410,
+	kGoalOfficerLearyPoliceWait120SecondsToAttackHF05 = 420,
+	kGoalOfficerLearyPoliceWait60SecondsToAttackHF05 = 425,
+	kGoalOfficerLearyPoliceAboutToAttackHF05 = 430,
+	kGoalOfficerLearyDead = 599
+};
+
+
+enum GoalOfficerGrayford {
+	kGoalOfficerGrayfordDefault = 0,
+	kGoalOfficerGrayfordWalksInPS03a = 1,
+	kGoalOfficerGrayfordWalksInPS03b = 2,
+	kGoalOfficerGrayfordWalksInPS03c = 3,
+	kGoalOfficerGrayfordWalksInPS03d = 4,
+	kGoalOfficerGrayfordWalksInFreeSlotC = 5,
+	kGoalOfficerGrayfordWalksInPS09a = 6,
+	kGoalOfficerGrayfordWalksInPS09b = 7,
+	kGoalOfficerGrayfordWalksInPS09c = 8,
+	kGoalOfficerGrayfordWalksInPS03e = 9,
+	kGoalOfficerGrayfordPrepareToRestartWalkAround = 10,
+	kGoalOfficerGrayfordStopAndTalk1 = 99, // this is used temporarily to make him stop and talk
+	kGoalOfficerGrayfordArrivesToDR04 = 101,
+	kGoalOfficerGrayfordArrivedAtDR04 = 102,
+	kGoalOfficerGrayfordTalkToMcCoyAndReportAtDR04 = 103,
+	kGoalOfficerGrayfordPatrolsAtDR04a = 104,
+	kGoalOfficerGrayfordPatrolsAtDR04b = 105,
+	kGoalOfficerGrayfordStopPatrolToTalkToMcCoyAtDR04 = 106,
+	kGoalOfficerGrayfordLeavesWithMorajiCorpseDR04 = 110,
+	kGoalOfficerGrayfordArrestMcCoyInTB03Act4 = 399, // TB02_TB03
+	kGoalOfficerGrayfordStopAndTalkDR04 = 199, // this is used temporarily to make him stop and talk while at UG04 (Moraji's death scene)
+	kGoalOfficerGrayfordStartOfAct4 = 300,
+	kGoalOfficerGrayfordHuntingAroundAct4 = 305,
+	kGoalOfficerGrayfordPrepareToHuntAroundAct4 = 306,
+	kGoalOfficerGrayfordBlockingUG07 = 307,
+	kGoalOfficerGrayfordArrestsMcCoyAct4CT12 = 308,
+	kGoalOfficerGrayfordAttackMcCoyAct4 = 310,
+	kGoalOfficerGrayfordStartOfAct5 = 400,
+	kGoalOfficerGrayfordDummyGoalAct5 = 410,
+	kGoalOfficerGrayfordPoliceAboutToAttackHF05 = 430,
+	kGoalOfficerGrayfordDead = 599
 };
 
 enum GoalHanoi {
diff --git a/engines/bladerunner/script/ai/free_slot_a.cpp b/engines/bladerunner/script/ai/free_slot_a.cpp
index 9281e3a..83ae547 100644
--- a/engines/bladerunner/script/ai/free_slot_a.cpp
+++ b/engines/bladerunner/script/ai/free_slot_a.cpp
@@ -659,7 +659,7 @@ void AIScriptFreeSlotA::goToRandomUGxx() {
 		// replacing with something more normal
 		World_Waypoint_Set(463, kSetUG09, 91.0f, 156.94f, -498.0f);
 		World_Waypoint_Set(464, kSetUG09, -29.60f, 156.94f, -498.0f);
-		AI_Movement_Track_Append(kActorFreeSlotA, 463, 4);
+		AI_Movement_Track_Append(kActorFreeSlotA, 463, 1);
 		AI_Movement_Track_Append(kActorFreeSlotA, 464, 1);
 		AI_Movement_Track_Append(kActorFreeSlotA, 463, 1);
 #endif
diff --git a/engines/bladerunner/script/ai/free_slot_b.cpp b/engines/bladerunner/script/ai/free_slot_b.cpp
index 79eeea3..c3a87bf 100644
--- a/engines/bladerunner/script/ai/free_slot_b.cpp
+++ b/engines/bladerunner/script/ai/free_slot_b.cpp
@@ -534,10 +534,10 @@ void AIScriptFreeSlotB::processGoal301() {
 		AI_Movement_Track_Append(kActorFreeSlotB, 466, 1);
 #else
 		// replacing with something more normal
-		World_Waypoint_Set(466, kSetUG09, -152.51f, 156.94f, -498.0f);
+		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, 4);
-		AI_Movement_Track_Append(kActorFreeSlotB, 547, 1);
+		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;
diff --git a/engines/bladerunner/script/ai/moraji.cpp b/engines/bladerunner/script/ai/moraji.cpp
index 7d5fe1d..63998aa 100644
--- a/engines/bladerunner/script/ai/moraji.cpp
+++ b/engines/bladerunner/script/ai/moraji.cpp
@@ -122,7 +122,7 @@ bool AIScriptMoraji::ShotAtAndHit() {
 		if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiLayDown) {
 			Game_Flag_Set(kFlagDR04McCoyShotMoraji);
 			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDie);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 101);
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrivesToDR04);
 			return true;
 		} else {
 			return false;
diff --git a/engines/bladerunner/script/ai/officer_grayford.cpp b/engines/bladerunner/script/ai/officer_grayford.cpp
index 3c54790..af0bc3c 100644
--- a/engines/bladerunner/script/ai/officer_grayford.cpp
+++ b/engines/bladerunner/script/ai/officer_grayford.cpp
@@ -40,47 +40,47 @@ void AIScriptOfficerGrayford::Initialize() {
 	_var3 = 0;
 
 	Actor_Put_In_Set(kActorOfficerGrayford, kSetFreeSlotG);
-	Actor_Set_At_Waypoint(kActorOfficerGrayford, 39, 0);
-	Actor_Set_Goal_Number(kActorOfficerGrayford, 0);
+	Actor_Set_At_Waypoint(kActorOfficerGrayford, 39, 0); // kSetFreeSlotG
+	Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordDefault);
 }
 
 bool AIScriptOfficerGrayford::Update() {
 	if (Global_Variable_Query(kVariableChapter) == 4
-	 && Actor_Query_Goal_Number(kActorOfficerGrayford) < 300) {
+	 && Actor_Query_Goal_Number(kActorOfficerGrayford) < kGoalOfficerGrayfordStartOfAct4) {
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 300);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStartOfAct4);
 		return false;
 	}
 
 	if (Global_Variable_Query(kVariableChapter) == 5
-	 && Actor_Query_Goal_Number(kActorOfficerGrayford) < 400
+	 && Actor_Query_Goal_Number(kActorOfficerGrayford) < kGoalOfficerGrayfordStartOfAct5
 	) {
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 400);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStartOfAct5);
 		return false;
 	}
 
 	if (!Game_Flag_Query(kFlagMcCoyInDNARow)
-	 &&  Actor_Query_Goal_Number(kActorOfficerGrayford) > 102
-	 &&  Actor_Query_Goal_Number(kActorOfficerGrayford) < 110
+	 &&  Actor_Query_Goal_Number(kActorOfficerGrayford) > kGoalOfficerGrayfordArrivedAtDR04
+	 &&  Actor_Query_Goal_Number(kActorOfficerGrayford) < kGoalOfficerGrayfordLeavesWithMorajiCorpseDR04
 	) {
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 110);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordLeavesWithMorajiCorpseDR04);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 0) {
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 1);
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordDefault) {
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03a);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 10) {
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordPrepareToRestartWalkAround) {
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 0);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordDefault);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 102) {
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 103);
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordArrivedAtDR04) {
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordTalkToMcCoyAndReportAtDR04);
 		return false;
 	}
 
@@ -91,106 +91,110 @@ bool AIScriptOfficerGrayford::Update() {
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 310
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordAttackMcCoyAct4
 	 && Actor_Query_Which_Set_In(kActorOfficerGrayford) != Player_Query_Current_Set()
 	) {
 		Non_Player_Actor_Combat_Mode_Off(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 599
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordDead
 	 && Actor_Query_Which_Set_In(kActorOfficerGrayford) != Player_Query_Current_Set()
 	) {
+		// dead officer gets revived and re-used
 		Actor_Set_Health(kActorOfficerGrayford, 50, 50);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 305) {
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordHuntingAroundAct4) {
 		switch (Actor_Query_Which_Set_In(kActorOfficerGrayford)) {
 		case kSetRC03:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 18, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetUG01:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 11, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetUG04:
+			// fall through
 		case kSetUG05:
+			// fall through
 		case kSetUG06:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 10, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
-
+// asdf UG07 whould be a type 10 combat, 12 flee?
 		case kSetUG08:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 13, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
+// asdf UG09 whould be a type ?? //
 
 		case kSetUG10:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 14, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetUG12:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 16, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetUG14:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 17, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetMA07:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 7, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetNR01:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 3, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetDR01_DR02_DR04:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 0, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetBB01:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 1, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 
 		case kSetCT11:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 310);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 5, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
@@ -204,73 +208,75 @@ bool AIScriptOfficerGrayford::Update() {
 void AIScriptOfficerGrayford::TimerExpired(int timer) {
 	if (timer == kActorTimerAIScriptCustomTask2) {
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
-		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 104) {
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 105);
-		} else if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 105) {
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 104);
+		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordPatrolsAtDR04a) {
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04b);
+		} else if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordPatrolsAtDR04b) {
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04a);
 		}
 	}
 }
 
 void AIScriptOfficerGrayford::CompletedMovementTrack() {
 	switch (Actor_Query_Goal_Number(kActorOfficerGrayford)) {
-	case 1:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 2);
+	case kGoalOfficerGrayfordWalksInPS03a:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03b);
 		break;
 
-	case 2:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 3);
+	case kGoalOfficerGrayfordWalksInPS03b:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03c);
 		break;
 
-	case 3:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 4);
+	case kGoalOfficerGrayfordWalksInPS03c:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03d);
 		break;
 
-	case 4:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 5);
+	case kGoalOfficerGrayfordWalksInPS03d:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInFreeSlotC);
 		break;
 
-	case 5:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 6);
+	case kGoalOfficerGrayfordWalksInFreeSlotC:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS09a);
 		break;
 
-	case 6:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 7);
+	case kGoalOfficerGrayfordWalksInPS09a:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS09b);
 		break;
 
-	case 7:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 8);
+	case kGoalOfficerGrayfordWalksInPS09b:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS09c);
 		break;
 
-	case 8:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 9);
+	case kGoalOfficerGrayfordWalksInPS09c:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03e);
 		break;
 
-	case 9:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 10);
+	case kGoalOfficerGrayfordWalksInPS03e:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPrepareToRestartWalkAround);
 		break;
 
-	case 104:
-	case 105:
+	case kGoalOfficerGrayfordPatrolsAtDR04a:
+		// fall through
+	case kGoalOfficerGrayfordPatrolsAtDR04b:
 		if (Random_Query(0, 2)) {
 			Actor_Change_Animation_Mode(kActorOfficerGrayford, 43);
 		} else {
 			AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 			AI_Countdown_Timer_Start(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2, Random_Query(6, 12));
 		}
-		Actor_Face_Waypoint(kActorOfficerGrayford, 97, true);
+		Actor_Face_Waypoint(kActorOfficerGrayford, 97, true); // kSetDR01_DR02_DR04
 		// return false;
 		break;
 
-	case 305:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 306);
+	case kGoalOfficerGrayfordHuntingAroundAct4:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPrepareToHuntAroundAct4);
 		break;
 
-	case 307:
+	case kGoalOfficerGrayfordBlockingUG07:
+		// UG07 before McCoy visits his apartment in Act 4
 		Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 12, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, -1, -1, 15, 300, false);
 		break;
 
-	case 308:
+	case kGoalOfficerGrayfordArrestsMcCoyAct4CT12:
 		Actor_Change_Animation_Mode(kActorOfficerGrayford, kAnimationModeCombatIdle);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		break;
@@ -288,7 +294,7 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 	switch (Actor_Query_Goal_Number(kActorOfficerGrayford)) {
 	case 1:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		if (Random_Query(1, 2) == 1) {
@@ -302,7 +308,7 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 
 	case 2:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		if (Random_Query(1, 2) == 1) {
@@ -316,7 +322,7 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 
 	case 3:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		if (Random_Query(1, 2) == 1) {
@@ -329,7 +335,7 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 
 	case 4:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		if (Random_Query(1, 2) == 1) {
@@ -344,7 +350,7 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 
 	case 7:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Says(kActorMcCoy, 4515, 14);
 		Actor_Says(kActorOfficerGrayford, 330, 13);
@@ -353,17 +359,17 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 
 	case 8:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 99);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		Actor_Says(kActorMcCoy, 5075, 13);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, 8);
 		break;
 
-	case 104:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 199);
+	case kGoalOfficerGrayfordPatrolsAtDR04a:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalkDR04);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
-		Actor_Says(kActorMcCoy, 1005, kAnimationModeTalk);
+		Actor_Says(kActorMcCoy, 1005, kAnimationModeTalk); // Don't miss anything.
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 		if (_animationState == 35 || _animationState == 34) {
@@ -372,13 +378,13 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 		}
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		Actor_Says(kActorOfficerGrayford, 190, 19);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 104);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04a);
 		break;
 
-	case 105:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 199);
+	case kGoalOfficerGrayfordPatrolsAtDR04b:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalkDR04);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
-		Actor_Says(kActorMcCoy, 1005, kAnimationModeTalk);
+		Actor_Says(kActorMcCoy, 1005, kAnimationModeTalk); // Don't miss anything.
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 		if (_animationState == 35 || _animationState == 34) {
@@ -387,12 +393,12 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 		}
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		Actor_Says(kActorOfficerGrayford, 190, 19);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 105);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04b);
 		break;
 
 	default:
 		return; //false;
-		break;
+//		break; // redundant
 	}
 
 	return; //true;
@@ -419,14 +425,15 @@ void AIScriptOfficerGrayford::ShotAtAndMissed() {
 }
 
 bool AIScriptOfficerGrayford::ShotAtAndHit() {
-	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 307)
+	// Grayford is invincible while blocking the UG07 (before McCoy visits his apartment in Act 4)
+	if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordBlockingUG07) {
 		Actor_Set_Health(kActorOfficerGrayford, 50, 50);
-
+	}
 	return false;
 }
 
 void AIScriptOfficerGrayford::Retired(int byActorId) {
-	Actor_Set_Goal_Number(kActorOfficerGrayford, 599);
+	Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordDead);
 	Game_Flag_Set(kFlagMcCoyRetiredHuman);
 }
 
@@ -436,61 +443,71 @@ int AIScriptOfficerGrayford::GetFriendlinessModifierIfGetsClue(int otherActorId,
 
 bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 	switch (newGoalNumber) {
-	case 1:
+	case kGoalOfficerGrayfordWalksInPS03a:
+		// kSetPS03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 82, Random_Query(5, 20));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 2:
+	case kGoalOfficerGrayfordWalksInPS03b:
+		// kSetPS03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 76, Random_Query(10, 20));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 3:
+	case kGoalOfficerGrayfordWalksInPS03c:
+		// kSetPS03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 77, Random_Query(5, 15));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 4:
+	case kGoalOfficerGrayfordWalksInPS03d:
+		// kSetPS03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 78, Random_Query(5, 15));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 5:
+	case kGoalOfficerGrayfordWalksInFreeSlotC:
+		// kSetFreeSlotC
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+		AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 6:
+	case kGoalOfficerGrayfordWalksInPS09a:
+		// kSetPS09
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 79, Random_Query(5, 15));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 7:
+	case kGoalOfficerGrayfordWalksInPS09b:
+		// kSetPS09
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 80, 1);
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 8:
+	case kGoalOfficerGrayfordWalksInPS09c:
+		// kSetPS09
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 81, Random_Query(5, 15));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 9:
+	case kGoalOfficerGrayfordWalksInPS03e:
+		// kSetPS03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 82, Random_Query(5, 15));
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 101:
+	case kGoalOfficerGrayfordArrivesToDR04:
+		// kSetDR01_DR02_DR04
 		Player_Loses_Control();
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Put_In_Set(kActorOfficerGrayford, kSetDR01_DR02_DR04);
@@ -513,13 +530,14 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 		}
 		return true;
 
-	case 102:
+	case kGoalOfficerGrayfordArrivedAtDR04:
 		return true;
 
-	case 103:
+	case kGoalOfficerGrayfordTalkToMcCoyAndReportAtDR04:
+		// kSetDR01_DR02_DR04
 		Actor_Says(kActorOfficerGrayford, 120, 19);
-		Actor_Says_With_Pause(kActorMcCoy, 970, 0.2f, 13);
-		Actor_Says(kActorMcCoy, 975, 12);
+		Actor_Says_With_Pause(kActorMcCoy, 970, 0.2f, 13); // Got a dead man here. Victim of an explosion.
+		Actor_Says(kActorMcCoy, 975, 12); // TODO - a bug? McCoy may not know Moraji's name here(?)
 
 		if (Actor_Clue_Query(kActorMcCoy, kClueMorajiInterview) == 1) {
 			Actor_Says(kActorMcCoy, 980, 16);
@@ -537,33 +555,35 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 		if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiDead) {
 			Actor_Face_Actor(kActorOfficerGrayford, kActorMoraji, true);
 		} else {
-			Actor_Face_Waypoint(kActorOfficerGrayford, 97, 1);
+			Actor_Face_Waypoint(kActorOfficerGrayford, 97, true);
 		}
 
 		Actor_Change_Animation_Mode(kActorOfficerGrayford, 43);
 
 		if (Player_Query_Current_Scene() == kSceneDR04) {
-			Actor_Says(kActorOfficerGrayford, 170, kAnimationModeTalk);
+			Actor_Says(kActorOfficerGrayford, 170, kAnimationModeTalk); // This is 32, Sector 3. Reporting a homicide. Possible act of terrorism.
 		}
 		return true;
 
-	case 104:
+	case kGoalOfficerGrayfordPatrolsAtDR04a:
+		// kSetDR01_DR02_DR04
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 112, 0);
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 105:
+	case kGoalOfficerGrayfordPatrolsAtDR04b:
+		// kSetDR01_DR02_DR04
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append(kActorOfficerGrayford, 113, 0);
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 106:
+	case kGoalOfficerGrayfordStopPatrolToTalkToMcCoyAtDR04:
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
-		Actor_Says(kActorMcCoy, 1000, 14);
+		Actor_Says(kActorMcCoy, 1000, 14); // You got a sheet or something...?
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Countdown_Timer_Reset(kActorOfficerGrayford, kActorTimerAIScriptCustomTask2);
 
@@ -579,23 +599,25 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 		Actor_Set_Goal_Number(kActorOfficerGrayford, currentGoalNumber);
 		return true; // possible bugfix: was break;
 
-	case 110:
+	case kGoalOfficerGrayfordLeavesWithMorajiCorpseDR04:
+		// kSetFreeSlotC
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		AI_Movement_Track_Append(kActorOfficerGrayford, 35, 0);
+		AI_Movement_Track_Append(kActorOfficerGrayford, 35, 0); // kSetFreeSlotC
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		AI_Movement_Track_Flush(kActorMoraji);
-		AI_Movement_Track_Append(kActorMoraji, 41, 0);
+		AI_Movement_Track_Append(kActorMoraji, 41, 0); // kSetFreeSlotI
 		AI_Movement_Track_Repeat(kActorMoraji);
 		return true;
 
-	case 300:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+	case kGoalOfficerGrayfordStartOfAct4:
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4);
 		return true;
 
-	case 305:
+	case kGoalOfficerGrayfordHuntingAroundAct4:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		switch (Random_Query(1, 10)) {
 		case 1:
+			// kSetNR01
 			AI_Movement_Track_Append(kActorOfficerGrayford, 398, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 399, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 400, 0);
@@ -604,54 +626,59 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 			AI_Movement_Track_Append(kActorOfficerGrayford, 403, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 404, 15);
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 		case 2:
+			// kSetCT11
 			AI_Movement_Track_Append(kActorOfficerGrayford, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 386, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 387, 15);
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 		case 3:
+			// kSetDR01_DR02_DR04
 			AI_Movement_Track_Append(kActorOfficerGrayford, 390, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 391, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 392, 5);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 345, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 393, 15);
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 		case 4:
+			// kSetRC03 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerGrayford, 381, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 382, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 383, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 382, 3);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 384, 0);
-			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 		case 5:
+			// kSetBB01 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerGrayford, 388, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 389, 10);
-			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 		case 6:
+			// kSetCT11 - identical to case 2
 			AI_Movement_Track_Append(kActorOfficerGrayford, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 386, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 387, 15);
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 
 #if BLADERUNNER_ORIGINAL_BUGS
@@ -659,6 +686,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 		// When the police officer is there as well he will kill McCoy because player cannot control him.
 
 		case 7:
+			// kSetMA07 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerGrayford, 394, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 395, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 396, 0);
@@ -666,141 +694,165 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 			AI_Movement_Track_Append(kActorOfficerGrayford, 396, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 395, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 430, 15);
-			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+			//Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4); // redundant
 			return true;
 #else
 		case 7:
-			// fall through
-#endif
+			// just put him away for a few seconds
+			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
+			AI_Movement_Track_Repeat(kActorOfficerGrayford);
+			return true;
+#endif // BLADERUNNER_ORIGINAL_BUGS
 
 		case 8:
 			switch (Random_Query(1, 7)) {
 			case 1:
+				// kSetUG10 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 302, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 407, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 408, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 2:
+				// kSetUG14
 				AI_Movement_Track_Append(kActorOfficerGrayford, 536, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 537, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 538, 5);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 537, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 536, 0);
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 3:
+				// kSetUG04 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 296, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 409, 2);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 296, 10);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 4:
+				// kSetUG05 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 411, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 412, 5);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 411, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 5:
+				// kSetUG06 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 413, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 414, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 431, 0, 1017);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 432, 10);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 6:
+				// kSetUG07 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 415, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 416, 0, 620);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 417, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 418, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				break; // and go to case 9 below
+				break;
 
 			case 7:
+				// kSetUG01 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 405, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 406, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
 				return false;
 
 			}
+#if BLADERUNNER_ORIGINAL_BUGS
 			// fall through
-			// TODO bug in the game? there should be nothing track related after AI_Movement_Track_Repeat
-
+			// bug in the game - there should be nothing track related after AI_Movement_Track_Repeat
+#else
+			return false; // does it matter if false or true? case 9 and 10 return false
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		case 9:
 			if (Random_Query(0, 1)) {
+				// kSetUG09 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 433, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 434, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 435, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
 			} else {
+				// kSetUG08 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerGrayford, 420, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 422, 2);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 421, 1);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 422, 4, 182);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 420, 10);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
-				// TODO bug in the game? Same code bellow looks like a case 10 and are from set 84 whereas upper one are from set 81
+#if BLADERUNNER_ORIGINAL_BUGS
+				// bug in the game? Same code bellow looks like a case 10 and are from set 84 whereas upper one are from set 81
 				AI_Movement_Track_Append(kActorOfficerGrayford, 310, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 307, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 309, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 310, 0);
-				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
+#endif
 			}
 			return false;
 
 		case 10:
+			// kSetUG12 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerGrayford, 310, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 307, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 309, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 310, 0);
-			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
 			return false;
 
 		}
 		return false;
 
-	case 306:
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 305);
+	case kGoalOfficerGrayfordPrepareToHuntAroundAct4:
+		// aux goal in order to immediately switch back to kGoalOfficerGrayfordHuntingAroundAct4 goal
+		// and run GoalChanged() for kGoalOfficerGrayfordHuntingAroundAct4 again
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4);
 		return true;
 
-	case 307:
+	case kGoalOfficerGrayfordBlockingUG07:
+		// kSetUG07
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 419, 0, 512);
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 308:
+	case kGoalOfficerGrayfordArrestsMcCoyAct4CT12:
+		// kSetCT01_CT12
+		// never triggered in original game
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		AI_Movement_Track_Append_Run(kActorOfficerGrayford, 440, 0);
 		AI_Movement_Track_Append_Run(kActorOfficerGrayford, 441, 0);
 		AI_Movement_Track_Repeat(kActorOfficerGrayford);
 		return true;
 
-	case 399:
+	case kGoalOfficerGrayfordArrestMcCoyInTB03Act4:
+		// kSetTB02_TB03
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Put_In_Set(kActorOfficerGrayford, kSetTB02_TB03);
 		Actor_Set_At_XYZ(kActorOfficerGrayford, -173.89f, 0.0f, 2084.22f, 859);
 		Actor_Change_Animation_Mode(kActorOfficerGrayford, kAnimationModeCombatIdle);
 		return true;
 
-	case 599:
+	case kGoalOfficerGrayfordDead:
 		_animationState = 32;
 		_animationFrame = Slice_Animation_Query_Number_Of_Frames(624) - 1;
 		return true;
@@ -988,8 +1040,8 @@ bool AIScriptOfficerGrayford::UpdateAnimation(int *animation, int *frame) {
 			_animationFrame = 0;
 			_animationState = 0;
 			_var1 = 0;
-			if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 101) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 102);
+			if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordArrivesToDR04) {
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrivedAtDR04);
 			}
 		}
 		break;
@@ -1156,13 +1208,14 @@ bool AIScriptOfficerGrayford::UpdateAnimation(int *animation, int *frame) {
 			_animationFrame = 0;
 
 			switch (Actor_Query_Goal_Number(kActorOfficerGrayford)) {
-			case 103:
-			case 104:
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 105);
+			case kGoalOfficerGrayfordTalkToMcCoyAndReportAtDR04:
+				// fall through
+			case kGoalOfficerGrayfordPatrolsAtDR04a:
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04b);
 				break;
 
-			case 105:
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 104);
+			case kGoalOfficerGrayfordPatrolsAtDR04b:
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPatrolsAtDR04a);
 				break;
 			}
 		}
@@ -1223,7 +1276,7 @@ bool AIScriptOfficerGrayford::ChangeAnimationMode(int mode) {
 		break;
 
 	case kAnimationModeWalk:
-		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 101) {
+		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordArrivesToDR04) {
 			_animationState = 6;
 			_animationFrame = 0;
 		} else if (_animationState != 1) {
@@ -1233,7 +1286,7 @@ bool AIScriptOfficerGrayford::ChangeAnimationMode(int mode) {
 		break;
 
 	case kAnimationModeRun:
-		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 101) {
+		if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordArrivesToDR04) {
 			_animationState = 5;
 			_animationFrame = 0;
 		} else if (_animationState != 2) {
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index 9b9fa3f..d803b06 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -45,18 +45,18 @@ void AIScriptOfficerLeary::Initialize() {
 
 bool AIScriptOfficerLeary::Update() {
 	if (Global_Variable_Query(kVariableChapter) == 4
-	 && Actor_Query_Goal_Number(kActorOfficerLeary) < 300
+	 && Actor_Query_Goal_Number(kActorOfficerLeary) < kGoalOfficerLearyStartOfAct4
 	) {
 		AI_Movement_Track_Flush(kActorOfficerLeary);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 300);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyStartOfAct4);
 		return false;
 	}
 
 	if (Global_Variable_Query(kVariableChapter) == 5
-	 && Actor_Query_Goal_Number(kActorOfficerLeary) < 400
+	 && Actor_Query_Goal_Number(kActorOfficerLeary) < kGoalOfficerLearyStartOfAct5
 	) {
 		AI_Movement_Track_Flush(kActorOfficerLeary);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 400);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyStartOfAct5);
 		return false;
 	}
 
@@ -68,7 +68,7 @@ bool AIScriptOfficerLeary::Update() {
 	 &&  Global_Variable_Query(kVariableChapter) < 3
 	) {
 		Game_Flag_Set(kFlagRC01PoliceDone);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 3);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPoliceDoneFromRC01);
 		return false;
 	}
 
@@ -96,67 +96,68 @@ bool AIScriptOfficerLeary::Update() {
 	 && !Game_Flag_Query(kFlagUG07PoliceLeave)
 	) {
 		Game_Flag_Set(kFlagUG07PoliceLeave);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 305);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerLeary) == 310
+	if (Actor_Query_Goal_Number(kActorOfficerLeary) == kGoalOfficerLearyAttackMcCoyAct4
 	 && Actor_Query_Which_Set_In(kActorOfficerLeary) != Player_Query_Current_Set()
 	) {
 		Non_Player_Actor_Combat_Mode_Off(kActorOfficerLeary);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 305);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerLeary) == 599
+	if (Actor_Query_Goal_Number(kActorOfficerLeary) == kGoalOfficerLearyDead
 	 && Actor_Query_Which_Set_In(kActorOfficerLeary) != Player_Query_Current_Set()
 	) {
+		// dead officer gets revived and re-used
 		Actor_Set_Health(kActorOfficerLeary, 40, 40);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 305);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return false;
 	}
 
-	if (Actor_Query_Goal_Number(kActorOfficerLeary) == 305) {
+	if (Actor_Query_Goal_Number(kActorOfficerLeary) == kGoalOfficerLearyHuntingAroundAct4) {
 		switch (Actor_Query_Which_Set_In(kActorOfficerLeary)) {
 		case kSetDR01_DR02_DR04:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 0, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetBB01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 1, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetCT11:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 5, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetMA07:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 7, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetNR01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 3, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetRC03:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 18, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetUG01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 11, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
@@ -164,31 +165,31 @@ bool AIScriptOfficerLeary::Update() {
 		case kSetUG05:
 		case kSetUG06:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 10, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetUG08:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 13, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetUG10:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 14, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetUG12:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 16, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
 		case kSetUG14:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
-				Actor_Set_Goal_Number(kActorOfficerLeary, 310);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 17, 4, 7, 8, -1, -1, -1, 10, 300, 0);
 			}
 			break;
@@ -201,8 +202,8 @@ void AIScriptOfficerLeary::TimerExpired(int timer) {
 	if (timer == kActorTimerAIScriptCustomTask1) {
 		AI_Countdown_Timer_Reset(kActorOfficerLeary, kActorTimerAIScriptCustomTask1);
 		if (Actor_Query_In_Set(kActorMcCoy, kSetHF05)) {
-			Actor_Set_Goal_Number(kActorOfficerLeary, 430);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 430);
+			Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPoliceAboutToAttackHF05);
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPoliceAboutToAttackHF05);
 		} else {
 			Game_Flag_Set(kFlagHF05PoliceAttacked);
 		}
@@ -231,14 +232,16 @@ void AIScriptOfficerLeary::CompletedMovementTrack() {
 	if (goal > 308) {
 		return;
 	}
-	if (goal == 305) {
-		Actor_Set_Goal_Number(kActorOfficerLeary, 306);
+	if (goal == kGoalOfficerLearyHuntingAroundAct4) {
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPrepareToHuntAroundAct4);
 		return;
 	}
-	if (goal == 307) {
+	if (goal == kGoalOfficerLearyBlockingUG07) {
+		// UG07 before McCoy visits his apartment in Act 4
 		Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 12, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, -1, -1, 15, 300, 0);
 	}
 	if (goal == 308) {
+		// goal 308 (and 309) are never triggered in the original code
 		Actor_Change_Animation_Mode(kActorOfficerLeary, 4);
 		Actor_Face_Actor(kActorOfficerLeary, kActorMcCoy, true);
 		Actor_Set_Goal_Number(kActorOfficerLeary, 309);
@@ -246,10 +249,10 @@ void AIScriptOfficerLeary::CompletedMovementTrack() {
 }
 
 void AIScriptOfficerLeary::ReceivedClue(int clueId, int fromActorId) {
-	if (clueId == 222) {
+	if (clueId == kClueMcCoyRetiredZuben) {
 		Actor_Modify_Friendliness_To_Other(kActorOfficerLeary, kActorMcCoy, 5);
 	}
-	if (clueId == 215) {
+	if (clueId == kClueMcCoyLetZubenEscape) {
 		Actor_Modify_Friendliness_To_Other(kActorOfficerLeary, kActorMcCoy, -4);
 	}
 }
@@ -267,14 +270,15 @@ void AIScriptOfficerLeary::OtherAgentEnteredCombatMode(int otherActorId, int com
 void AIScriptOfficerLeary::ShotAtAndMissed() {}
 
 bool AIScriptOfficerLeary::ShotAtAndHit() {
-	if (Actor_Query_Goal_Number(kActorOfficerLeary) == 307) {
+	// Leary is invincible while blocking the UG07 (before McCoy visits his apartment in Act 4)
+	if (Actor_Query_Goal_Number(kActorOfficerLeary) == kGoalOfficerLearyBlockingUG07) {
 		Actor_Set_Health(kActorOfficerLeary, 50, 50);
 	}
 	return false;
 }
 
 void AIScriptOfficerLeary::Retired(int byActorId) {
-	Actor_Set_Goal_Number(kActorOfficerLeary, 599);
+	Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDead);
 	Game_Flag_Set(kFlagMcCoyRetiredHuman);
 }
 
@@ -283,27 +287,27 @@ int AIScriptOfficerLeary::GetFriendlinessModifierIfGetsClue(int otherActorId, in
 		return 0;
 	}
 	switch (clueId) {
-	case 242:
+	case kClueMcCoyIsInsane:
 		return -6;
-	case 240:
+	case kClueMcCoyIsAnnoying:
 		return -2;
-	case 239:
+	case kClueMcCoyIsStupid:
 		return -5;
-	case 228:
+	case kClueMcCoyRetiredLutherLance:
 		return 2;
-	case 227:
+	case kClueMcCoyShotZubenInTheBack:
 		return 4;
-	case 226:
+	case kClueMcCoyRetiredSadik:
 		return 4;
-	case 225:
+	case kClueMcCoyRetiredGordo:
 		return 3;
-	case 224:
+	case kClueMcCoyRetiredDektora:
 		return 3;
-	case 223:
+	case kClueMcCoyRetiredLucy:
 		return 2;
-	case 222:
+	case kClueMcCoyRetiredZuben:
 		return 3;
-	case 215:
+	case kClueMcCoyLetZubenEscape:
 		return -5;
 	}
 	return 0;
@@ -312,6 +316,7 @@ int AIScriptOfficerLeary::GetFriendlinessModifierIfGetsClue(int otherActorId, in
 bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 	switch (newGoalNumber) {
 	case kGoalOfficerLearyRC01WalkToCrowd:
+		// kSetRC01
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		if (Random_Query(1, 2) == 1) {
 			AI_Movement_Track_Append(kActorOfficerLeary, 57, 7);
@@ -344,10 +349,11 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDefault);
 		}
 		return true;
-	case 3:
+	case kGoalOfficerLearyPoliceDoneFromRC01:
+		// kSetFreeSlotG -> kSetFreeSlotC
 		AI_Movement_Track_Flush(kActorOfficerLeary);
-		AI_Movement_Track_Append(kActorOfficerLeary, 39, Random_Query(120, 240));
-		AI_Movement_Track_Append(kActorOfficerLeary, 35, 0);
+		AI_Movement_Track_Append(kActorOfficerLeary, 39, Random_Query(120, 240)); // kSetFreeSlotG
+		AI_Movement_Track_Append(kActorOfficerLeary, 35, 0); // kSetFreeSlotC
 		AI_Movement_Track_Repeat(kActorOfficerLeary);
 		return true;
 #if BLADERUNNER_ORIGINAL_BUGS
@@ -357,22 +363,25 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 		AI_Countdown_Timer_Start(kActorOfficerLeary, kActorTimerAIScriptCustomTask0, 4); // wait a few seconds before starting taking notes again
 		return true;
 #endif // BLADERUNNER_ORIGINAL_BUGS
-	case 99:
+	case kGoalOfficerLearyEndOfAct1:
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		return false;
-	case 102:
+	case kGoalOfficerLearyVisitsBulletBob:
+		// kSetRC04
+		// Leary visits Bullet Bob shop - un-triggered
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		AI_Movement_Track_Append(kActorOfficerLeary, 107, 0);
 		AI_Movement_Track_Append(kActorOfficerLeary, 108, 0);
 		AI_Movement_Track_Repeat(kActorOfficerLeary);
 		return true;
-	case 300:
-		Actor_Set_Goal_Number(kActorOfficerLeary, 305);
+	case kGoalOfficerLearyStartOfAct4:
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return true;
-	case 305:
+	case kGoalOfficerLearyHuntingAroundAct4:
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		switch (Random_Query(1, 10)) {
 		case 1:
+			// kSetNR01
 			AI_Movement_Track_Append(kActorOfficerLeary, 398, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 399, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 400, 0);
@@ -383,6 +392,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 		case 2:
+			// kSetCT11
 			AI_Movement_Track_Append(kActorOfficerLeary, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 386, 2);
@@ -390,6 +400,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 		case 3:
+			// kSetDR01_DR02_DR04
 			AI_Movement_Track_Append(kActorOfficerLeary, 390, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 391, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 392, 5);
@@ -398,21 +409,24 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 		case 4:
+			// kSetRC03 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerLeary, 381, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 382, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 383, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 382, 3);
 			AI_Movement_Track_Append(kActorOfficerLeary, 384, 0);
-			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 		case 5:
+			// kSetBB01 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerLeary, 388, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 389, 10);
-			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 		case 6:
+			// kSetCT11 - identical to case 2
 			AI_Movement_Track_Append(kActorOfficerLeary, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 386, 2);
@@ -424,6 +438,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 		// When the police officer is there as well he will kill McCoy because player cannot control him.
 
 		case 7:
+			// kSetMA07 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerLeary, 394, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 395, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 396, 0);
@@ -431,23 +446,29 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			AI_Movement_Track_Append(kActorOfficerLeary, 396, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 395, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 430, 15);
-			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 #else
 		case 7:
-			// fall through
-#endif
+			// kSetFreeSlotC
+			// just put him away for a few seconds
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
+			AI_Movement_Track_Repeat(kActorOfficerLeary);
+			break;
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		case 8:
 			switch (Random_Query(1, 7)) {
 			case 1:
+				// kSetUG10 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 302, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 407, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 408, 0);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 2:
+				// kSetUG14
 				AI_Movement_Track_Append(kActorOfficerLeary, 536, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 537, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 538, 1);
@@ -456,110 +477,134 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 3:
+				// kSetUG04 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 296, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 409, 2);
 				AI_Movement_Track_Append(kActorOfficerLeary, 296, 10);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 4:
+				// kSetUG05 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 411, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 412, 5);
 				AI_Movement_Track_Append(kActorOfficerLeary, 411, 0);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 5:
+				// kSetUG06 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 413, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 414, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 431, 0, 1017);
 				AI_Movement_Track_Append(kActorOfficerLeary, 432, 10);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 6:
+				// kSetUG07 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 415, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 416, 0, 620);
 				AI_Movement_Track_Append(kActorOfficerLeary, 417, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 418, 0);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				break;
 			case 7:
+				// kSetUG01 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 405, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 406, 0);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				return false;
 			default:
 				return false;
 			}
-			// is falling through here - a bug in original game?
-			// fall through
+#if BLADERUNNER_ORIGINAL_BUGS
+			// fall through - a bug in original game
+#else
+			break;
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		case 9:
-			if (Random_Query(1, 2) - 1 == 1) {
+			if (Random_Query(1, 2) == 2) {
+				// kSetUG09 -> kSetFreeSlotC
 				AI_Movement_Track_Append(kActorOfficerLeary, 433, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 434, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 435, 0);
-				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 				AI_Movement_Track_Repeat(kActorOfficerLeary);
 				return false;
 			}
+			// kSetUG08 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerLeary, 420, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 422, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 421, 1);
 			AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 422, 4, 182);
 			AI_Movement_Track_Append(kActorOfficerLeary, 420, 10);
-			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
-			// is falling through here - a bug in original game?
-			// fall through
+#if BLADERUNNER_ORIGINAL_BUGS
+			// fall through - a bug in original game
+#else
+			return false;
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		case 10:
+			// kSetUG12 -> kSetFreeSlotC
 			AI_Movement_Track_Append(kActorOfficerLeary, 310, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 307, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 309, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 310, 0);
-			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30);
+			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			return false;
 		default:
 			return false;
 		}
-		// fall through
-	case 306:
-		Actor_Set_Goal_Number(kActorOfficerLeary, 305);
+#if BLADERUNNER_ORIGINAL_BUGS
+		// fall through - a bug in original game
+#else
+		return false;
+#endif // BLADERUNNER_ORIGINAL_BUGS
+	case kGoalOfficerLearyPrepareToHuntAroundAct4:
+		// aux goal in order to immediately switch back to kGoalOfficerLearyHuntingAroundAct4 goal
+		// and run GoalChanged() for kGoalOfficerLearyHuntingAroundAct4 again
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return true;
-	case 307:
+	case kGoalOfficerLearyBlockingUG07:
+		// kSetUG07
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 416, 0, 556);
 		Actor_Change_Animation_Mode(kActorOfficerLeary, 4);
 		AI_Movement_Track_Repeat(kActorOfficerLeary);
 		return true;
 	case 308:
+		// kSetCT01_CT12
+		// never triggered - TODO a bug? Could be related to cut McCoy's arrest from Grayford
 		AI_Movement_Track_Flush(kActorOfficerLeary);
 		AI_Movement_Track_Append_Run_With_Facing(kActorOfficerLeary, 440, 2, 355);
 		AI_Movement_Track_Append_Run_With_Facing(kActorOfficerLeary, 441, 0, 825);
 		AI_Movement_Track_Repeat(kActorOfficerLeary);
 		return true;
-	case 400:
+	case kGoalOfficerLearyStartOfAct5:
+		// kSetFreeSlotC
 		AI_Movement_Track_Flush(kActorOfficerLeary);
-		AI_Movement_Track_Append(kActorOfficerLeary, 35, 0);
+		AI_Movement_Track_Append(kActorOfficerLeary, 35, 0); // kSetFreeSlotC
 		AI_Movement_Track_Repeat(kActorOfficerLeary);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 410);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDummyGoalAct5);
 		return true;
-	case 420:
+	case kGoalOfficerLearyPoliceWait120SecondsToAttackHF05:
 		AI_Countdown_Timer_Reset(kActorOfficerLeary, kActorTimerAIScriptCustomTask1);
 		AI_Countdown_Timer_Start(kActorOfficerLeary, kActorTimerAIScriptCustomTask1, 120);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 410);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDummyGoalAct5);
 		return true;
-	case 425:
+	case kGoalOfficerLearyPoliceWait60SecondsToAttackHF05:
 		AI_Countdown_Timer_Reset(kActorOfficerLeary, kActorTimerAIScriptCustomTask1);
 		AI_Countdown_Timer_Start(kActorOfficerLeary, kActorTimerAIScriptCustomTask1, 60);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 410);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDummyGoalAct5);
 		return true;
-	case 430:
-		Actor_Set_Goal_Number(kActorOfficerLeary, 410);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 410);
+	case kGoalOfficerLearyPoliceAboutToAttackHF05:
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyDummyGoalAct5);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordDummyGoalAct5);
 		return false;
 	default:
 		return false;
@@ -1252,6 +1297,7 @@ void AIScriptOfficerLeary::SetAnimationState(int animationState, int animationFr
 
 bool AIScriptOfficerLeary::ReachedMovementTrackWaypoint(int waypointId) {
 	if (waypointId == 57 || waypointId == 58) {
+		// Interrogating crowd in kSetRC01
 		Game_Flag_Set(kFlagOfficerLearyTakingNotes);
 		AI_Countdown_Timer_Reset(kActorOfficerLeary, kActorTimerAIScriptCustomTask2);
 		AI_Countdown_Timer_Start(kActorOfficerLeary, kActorTimerAIScriptCustomTask2, 6);
@@ -1260,7 +1306,7 @@ bool AIScriptOfficerLeary::ReachedMovementTrackWaypoint(int waypointId) {
 }
 
 void AIScriptOfficerLeary::FledCombat() {
-	Actor_Set_Goal_Number(kActorOfficerLeary, 300);
+	Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyStartOfAct4);
 }
 
 } // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/init_script.cpp b/engines/bladerunner/script/init_script.cpp
index aa16a3b..32ad965 100644
--- a/engines/bladerunner/script/init_script.cpp
+++ b/engines/bladerunner/script/init_script.cpp
@@ -2978,123 +2978,123 @@ void InitScript::Init_Actor_Health() {
 }
 
 void InitScript::Init_Combat_Cover_Waypoints() {
-	Combat_Cover_Waypoint_Set_Data(0, 0, 7, 25, -603.0f, 0.0f, 32.0f);
-	Combat_Cover_Waypoint_Set_Data(1, 0, 7, 25, -670.0f, 0.0f, -24.0f);
-	Combat_Cover_Waypoint_Set_Data(2, 0, 7, 25, -604.0f, 0.0f, -96.0f);
-	Combat_Cover_Waypoint_Set_Data(3, 0, 7, 25, -490.0f, 0.0f, -20.0f);
-	Combat_Cover_Waypoint_Set_Data(4, 0, 7, 25, -667.0f, 0.0f, -164.0f);
-	Combat_Cover_Waypoint_Set_Data(5, 0, 7, 25, -606.0f, 0.0f, -222.0f);
-	Combat_Cover_Waypoint_Set_Data(6, 0, 7, 25, -534.0f, 0.0f, -170.0f);
-	Combat_Cover_Waypoint_Set_Data(7, 3, 54, 54, 76.06f, 23.83f, -1058.49f);
-	Combat_Cover_Waypoint_Set_Data(8, 3, 54, 54, -335.94f, 31.55f, -1406.49f);
-	Combat_Cover_Waypoint_Set_Data(9, 15, 42, 39, 286.0f, 367.93f, 330.0f);
-	Combat_Cover_Waypoint_Set_Data(10, 15, 42, 39, -58.0f, 367.93f, 294.0f);
-	Combat_Cover_Waypoint_Set_Data(11, 4, 37, 34, -30.0f, 8.0f, -759.0f);
-	Combat_Cover_Waypoint_Set_Data(12, 4, 37, 34, -93.0f, 8.0f, -693.0f);
-	Combat_Cover_Waypoint_Set_Data(13, 4, 37, 34, -6.0f, 8.0f, -607.0f);
-	Combat_Cover_Waypoint_Set_Data(14, 4, 37, 34, 78.0f, 8.0f, -687.0f);
-	Combat_Cover_Waypoint_Set_Data(15, 4, 37, 34, 262.0f, 8.0f, -683.0f);
-	Combat_Cover_Waypoint_Set_Data(16, 4, 37, 34, 334.0f, 8.0f, -607.0f);
-	Combat_Cover_Waypoint_Set_Data(17, 4, 37, 34, 426.0f, 8.0f, -679.0f);
-	Combat_Cover_Waypoint_Set_Data(18, 5, 4, 24, -318.0f, -6.5f, 1117.0f);
-	Combat_Cover_Waypoint_Set_Data(19, 5, 4, 24, -330.0f, -6.5f, 981.0f);
-	Combat_Cover_Waypoint_Set_Data(20, 5, 4, 24, -294.0f, -6.5f, 725.0f);
-	Combat_Cover_Waypoint_Set_Data(21, 16, 84, 96, 380.0f, -126.21f, 198.0f);
-	Combat_Cover_Waypoint_Set_Data(22, 16, 84, 96, 364.0f, -126.21f, -66.0f);
-	Combat_Cover_Waypoint_Set_Data(23, 18, 70, 80, 8.0f, 1.72f, 8.0f);
-	Combat_Cover_Waypoint_Set_Data(24, 18, 70, 80, 188.0f, 1.72f, 92.0f);
-	Combat_Cover_Waypoint_Set_Data(25, 18, 70, 80, 216.0f, -4.01f, 196.0f);
-	Combat_Cover_Waypoint_Set_Data(26, 18, 70, 80, -420.0f, 1.72f, 100.0f);
-	Combat_Cover_Waypoint_Set_Data(27, 18, 70, 80, -672.0f, 1.72f, -44.0f);
-	Combat_Cover_Waypoint_Set_Data(28, 10, 78, 90, -128.77f, -5.21f, -435.0f);
-	Combat_Cover_Waypoint_Set_Data(29, 10, 78, 90, -20.77f, 0.81f, -199.0f);
-	Combat_Cover_Waypoint_Set_Data(30, 10, 77, 89, -216.0f, 39.15f, -819.0f);
-	Combat_Cover_Waypoint_Set_Data(31, 10, 77, 89, 144.0f, -1.74f, -1015.0f);
-	Combat_Cover_Waypoint_Set_Data(32, 10, 77, 89, 152.0f, 4.14f, -811.0f);
-	Combat_Cover_Waypoint_Set_Data(33, 10, 79, 91, -121.0f, 0.0f, -39.0f);
-	Combat_Cover_Waypoint_Set_Data(34, 10, 80, 92, 86.0f, -12.21f, -278.0f);
-	Combat_Cover_Waypoint_Set_Data(35, 20, 41, 38, 407.82f, 40.63f, 95.25f);
-	Combat_Cover_Waypoint_Set_Data(36, 20, 41, 38, 357.81f, 40.63f, 387.9f);
+	Combat_Cover_Waypoint_Set_Data( 0,  0, kSetDR01_DR02_DR04, kSceneDR01, -603.0f,    0.0f,     32.0f);
+	Combat_Cover_Waypoint_Set_Data( 1,  0, kSetDR01_DR02_DR04, kSceneDR01, -670.0f,    0.0f,    -24.0f);
+	Combat_Cover_Waypoint_Set_Data( 2,  0, kSetDR01_DR02_DR04, kSceneDR01, -604.0f,    0.0f,    -96.0f);
+	Combat_Cover_Waypoint_Set_Data( 3,  0, kSetDR01_DR02_DR04, kSceneDR01, -490.0f,    0.0f,    -20.0f);
+	Combat_Cover_Waypoint_Set_Data( 4,  0, kSetDR01_DR02_DR04, kSceneDR01, -667.0f,    0.0f,   -164.0f);
+	Combat_Cover_Waypoint_Set_Data( 5,  0, kSetDR01_DR02_DR04, kSceneDR01, -606.0f,    0.0f,   -222.0f);
+	Combat_Cover_Waypoint_Set_Data( 6,  0, kSetDR01_DR02_DR04, kSceneDR01, -534.0f,    0.0f,   -170.0f);
+	Combat_Cover_Waypoint_Set_Data( 7,  3, kSetNR01,           kSceneNR01,   76.06f,  23.83f, -1058.49f);
+	Combat_Cover_Waypoint_Set_Data( 8,  3, kSetNR01,           kSceneNR01, -335.94f,  31.55f, -1406.49f);
+	Combat_Cover_Waypoint_Set_Data( 9, 15, kSetHF06,           kSceneHF06,  286.0f,  367.93f,   330.0f);
+	Combat_Cover_Waypoint_Set_Data(10, 15, kSetHF06,           kSceneHF06,  -58.0f,  367.93f,   294.0f);
+	Combat_Cover_Waypoint_Set_Data(11,  4, kSetHF01,           kSceneHF01,  -30.0f,    8.0f,   -759.0f);
+	Combat_Cover_Waypoint_Set_Data(12,  4, kSetHF01,           kSceneHF01,  -93.0f,    8.0f,   -693.0f);
+	Combat_Cover_Waypoint_Set_Data(13,  4, kSetHF01,           kSceneHF01,   -6.0f,    8.0f,   -607.0f);
+	Combat_Cover_Waypoint_Set_Data(14,  4, kSetHF01,           kSceneHF01,   78.0f,    8.0f,   -687.0f);
+	Combat_Cover_Waypoint_Set_Data(15,  4, kSetHF01,           kSceneHF01,  262.0f,    8.0f,   -683.0f);
+	Combat_Cover_Waypoint_Set_Data(16,  4, kSetHF01,           kSceneHF01,  334.0f,    8.0f,   -607.0f);
+	Combat_Cover_Waypoint_Set_Data(17,  4, kSetHF01,           kSceneHF01,  426.0f,    8.0f,   -679.0f);
+	Combat_Cover_Waypoint_Set_Data(18,  5, kSetCT01_CT12,      kSceneCT12, -318.0f,   -6.5f,   1117.0f);
+	Combat_Cover_Waypoint_Set_Data(19,  5, kSetCT01_CT12,      kSceneCT12, -330.0f,   -6.5f,    981.0f);
+	Combat_Cover_Waypoint_Set_Data(20,  5, kSetCT01_CT12,      kSceneCT12, -294.0f,   -6.5f,    725.0f);
+	Combat_Cover_Waypoint_Set_Data(21, 16, kSetUG12,           kSceneUG12,  380.0f, -126.21f,   198.0f);
+	Combat_Cover_Waypoint_Set_Data(22, 16, kSetUG12,           kSceneUG12,  364.0f, -126.21f,   -66.0f);
+	Combat_Cover_Waypoint_Set_Data(23, 18, kSetRC03,           kSceneRC03,    8.0f,    1.72f,     8.0f);
+	Combat_Cover_Waypoint_Set_Data(24, 18, kSetRC03,           kSceneRC03,  188.0f,    1.72f,    92.0f);
+	Combat_Cover_Waypoint_Set_Data(25, 18, kSetRC03,           kSceneRC03,  216.0f,   -4.01f,   196.0f);
+	Combat_Cover_Waypoint_Set_Data(26, 18, kSetRC03,           kSceneRC03, -420.0f,    1.72f,   100.0f);
+	Combat_Cover_Waypoint_Set_Data(27, 18, kSetRC03,           kSceneRC03, -672.0f,    1.72f,   -44.0f);
+	Combat_Cover_Waypoint_Set_Data(28, 10, kSetUG05,           kSceneUG05, -128.77f,  -5.21f,  -435.0f);
+	Combat_Cover_Waypoint_Set_Data(29, 10, kSetUG05,           kSceneUG05,  -20.77f,   0.81f,  -199.0f);
+	Combat_Cover_Waypoint_Set_Data(30, 10, kSetUG04,           kSceneUG04, -216.0f,   39.15f,  -819.0f);
+	Combat_Cover_Waypoint_Set_Data(31, 10, kSetUG04,           kSceneUG04,  144.0f,   -1.74f, -1015.0f);
+	Combat_Cover_Waypoint_Set_Data(32, 10, kSetUG04,           kSceneUG04,  152.0f,    4.14f,  -811.0f);
+	Combat_Cover_Waypoint_Set_Data(33, 10, kSetUG06,           kSceneUG06, -121.0f,    0.0f,    -39.0f);
+	Combat_Cover_Waypoint_Set_Data(34, 10, kSetUG07,           kSceneUG07,   86.0f,  -12.21f,  -278.0f);
+	Combat_Cover_Waypoint_Set_Data(35, 20, kSetHF05,           kSceneHF05,  407.82f,  40.63f,    95.25f);
+	Combat_Cover_Waypoint_Set_Data(36, 20, kSetHF05,           kSceneHF05,  357.81f,  40.63f,   387.9f);
 }
 
 void InitScript::Init_Combat_Flee_Waypoints() {
-	Combat_Flee_Waypoint_Set_Data(0, 4, 37, 34, 187.0f, 8.0f, -197.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(1, 4, 37, 34, 454.0f, 8.0f, -717.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(2, 4, 38, 35, -10.87f, 47.76f, -141.32f, -1);
-	Combat_Flee_Waypoint_Set_Data(3, 4, 38, 35, 466.0f, 47.76f, -532.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(4, 4, 39, 36, 199.0f, 47.76f, -880.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(5, 4, 39, 36, 594.0f, 47.76f, -1141.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(6, 4, 39, 36, 912.0f, 47.76f, -447.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(7, 4, 39, 36, 492.0f, 47.76f, -459.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(8, 1, 20, 2, 271.0f, 0.0f, 1038.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(9, 1, 20, 2, -175.0f, 9.04f, 8.59f, -1);
-	Combat_Flee_Waypoint_Set_Data(10, 1, 20, 2, -343.05f, 9.04f, 260.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(11, 0, 7, 25, -443.0f, -0.04f, -180.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(12, 0, 7, 26, -1485.0f, 6.98f, -393.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(13, 0, 7, 28, -652.0f, 7.18f, 354.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(14, 6, 49, 48, 25.0f, 0.0f, -314.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(15, 6, 49, 48, 980.0f, 0.0f, 189.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(16, 6, 49, 48, 601.0f, 0.0f, -1641.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(17, 12, 80, 92, 218.0f, -12.21f, -290.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(18, 12, 80, 92, -150.0f, -12.21f, -962.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(19, 13, 81, 93, -524.0f, 0.0f, -172.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(20, 13, 81, 93, -427.0f, 0.0f, 199.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(21, 13, 81, 93, -121.0f, 0.0f, -145.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(22, 14, 83, 95, 2.0f, 1.15f, 412.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(23, 14, 83, 95, -327.0f, 1.15f, -384.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(24, 14, 83, 95, -253.0f, 81.33f, -620.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(25, 5, 28, 17, -518.52f, -109.91f, 312.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(26, 5, 28, 17, 141.0f, -109.91f, 452.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(27, 5, 33, 23, 516.0f, 0.56f, 779.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(28, 5, 33, 23, 388.0f, 9.68f, 190.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(29, 5, 33, 23, -429.0f, 9.68f, -115.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(30, 7, 68, 77, -997.0f, 508.14f, -630.84f, -1);
-	Combat_Flee_Waypoint_Set_Data(31, 7, 68, 77, -416.27f, 508.14f, -574.84f, -1);
-	Combat_Flee_Waypoint_Set_Data(32, 7, 68, 77, -416.0f, 508.14f, -906.84f, -1);
-	Combat_Flee_Waypoint_Set_Data(33, 7, 68, 77, -1168.0f, 508.14f, -1666.84f, -1);
-	Combat_Flee_Waypoint_Set_Data(34, 10, 79, 91, 75.0f, 153.0f, -485.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(35, 10, 79, 91, -18.0f, 0.0f, 321.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(36, 11, 74, 86, -190.0f, -50.13f, -298.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(37, 11, 74, 86, 126.0f, -50.13f, -150.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(38, 11, 74, 86, 187.78f, -50.13f, -1262.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(39, 11, 74, 86, -20.22f, -30.13f, -2338.3f, -1);
-	Combat_Flee_Waypoint_Set_Data(40, 3, 54, 54, -416.0f, 31.55f, -829.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(41, 3, 54, 54, -412.0f, 31.55f, -1357.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(42, 3, 54, 54, -208.0f, 23.0f, -1693.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(43, 3, 54, 54, -64.0f, 23.83f, -2097.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(44, 3, 54, 54, 320.0f, 23.83f, -1058.49f, -1);
-	Combat_Flee_Waypoint_Set_Data(45, 3, 54, 54, 252.0f, 31.65f, -674.49f, -1);
-	Combat_Flee_Waypoint_Set_Data(46, 8, 45, 42, -803.0f, -615.49f, 2619.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(47, 8, 45, 42, -1027.0f, -614.49f, 3151.24f, -1);
-	Combat_Flee_Waypoint_Set_Data(48, 9, 9, 45, -1190.0f, 0.0f, 876.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(49, 9, 9, 45, -687.0f, 0.0f, 910.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(50, 9, 9, 46, -455.0f, 8.26f, -453.26f, -1);
-	Combat_Flee_Waypoint_Set_Data(51, 9, 9, 46, -1127.0f, 8.26f, -705.26f, -1);
-	Combat_Flee_Waypoint_Set_Data(52, 9, 9, 46, -1143.0f, 8.26f, -261.26f, -1);
-	Combat_Flee_Waypoint_Set_Data(53, 9, 9, 46, -703.0f, 8.26f, -157.26f, -1);
-	Combat_Flee_Waypoint_Set_Data(54, 10, 77, 89, 166.0f, 11.87f, -250.8f, -1);
-	Combat_Flee_Waypoint_Set_Data(55, 10, 77, 89, 158.0f, 4.14f, -10.8f, -1);
-	Combat_Flee_Waypoint_Set_Data(56, 10, 77, 89, -310.0f, 39.15f, -822.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(57, 10, 77, 89, -302.0f, -1.74f, -5847.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(58, 10, 78, 90, 4.0f, 1.37f, -3684.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(59, 10, 78, 90, 146.28f, -6.05f, -135.93f, -1);
-	Combat_Flee_Waypoint_Set_Data(60, 7, 53, 53, 212.0f, -162.8f, -108.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(61, 7, 53, 53, -28.0f, -162.8f, -104.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(62, 7, 53, 53, 504.0f, -162.8f, 224.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(63, 7, 53, 53, -301.0f, -162.8f, 275.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(64, 15, 42, 39, 98.0f, 367.93f, -10.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(65, 15, 42, 39, -206.0f, 367.69f, 386.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(66, 5, 4, 24, -190.0f, -6.5f, 789.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(67, 5, 4, 24, 123.0f, -6.5f, 1002.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(68, 5, 4, 24, -573.0f, -6.5f, 1202.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(69, 16, 84, 96, 120.0f, -126.21f, -350.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(70, 16, 84, 96, 524.0f, -126.21f, 158.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(71, 16, 84, 96, 276.0f, -126.21f, 537.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(72, 17, 86, 98, -334.7f, 12.97f, -332.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(73, 18, 70, 80, -672.0f, 1.72f, -96.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(74, 18, 70, 80, -552.0f, -4.01f, 268.0f, -1);
-	Combat_Flee_Waypoint_Set_Data(75, 18, 70, 80, 293.06f, 1.72f, 112.25f, -1);
-	Combat_Flee_Waypoint_Set_Data(76, 20, 41, 38, 435.13f, 37.18f, -292.34f, -1);
+	Combat_Flee_Waypoint_Set_Data( 0,  4, kSetHF01,           kSceneHF01,   187.0f,     8.0f,   -197.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 1,  4, kSetHF01,           kSceneHF01,   454.0f,     8.0f,   -717.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 2,  4, kSetHF02,           kSceneHF02,   -10.87f,   47.76f,  -141.32f, -1);
+	Combat_Flee_Waypoint_Set_Data( 3,  4, kSetHF02,           kSceneHF02,   466.0f,    47.76f,  -532.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 4,  4, kSetHF03,           kSceneHF03,   199.0f,    47.76f,  -880.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 5,  4, kSetHF03,           kSceneHF03,   594.0f,    47.76f, -1141.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 6,  4, kSetHF03,           kSceneHF03,   912.0f,    47.76f,  -447.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 7,  4, kSetHF03,           kSceneHF03,   492.0f,    47.76f,  -459.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 8,  1, kSetBB01,           kSceneBB01,   271.0f,     0.0f,   1038.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data( 9,  1, kSetBB01,           kSceneBB01,  -175.0f,     9.04f,     8.59f, -1);
+	Combat_Flee_Waypoint_Set_Data(10,  1, kSetBB01,           kSceneBB01,  -343.05f,    9.04f,   260.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(11,  0, kSetDR01_DR02_DR04, kSceneDR01,  -443.0f,    -0.04f,  -180.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(12,  0, kSetDR01_DR02_DR04, kSceneDR02, -1485.0f,     6.98f,  -393.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(13,  0, kSetDR01_DR02_DR04, kSceneDR04,  -652.0f,     7.18f,   354.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(14,  6, kSetMA01,           kSceneMA01,    25.0f,     0.0f,   -314.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(15,  6, kSetMA01,           kSceneMA01,   980.0f,     0.0f,    189.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(16,  6, kSetMA01,           kSceneMA01,   601.0f,     0.0f,  -1641.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(17, 12, kSetUG07,           kSceneUG07,   218.0f,   -12.21f,  -290.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(18, 12, kSetUG07,           kSceneUG07,  -150.0f,   -12.21f,  -962.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(19, 13, kSetUG08,           kSceneUG08,  -524.0f,     0.0f,   -172.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(20, 13, kSetUG08,           kSceneUG08,  -427.0f,     0.0f,    199.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(21, 13, kSetUG08,           kSceneUG08,  -121.0f,     0.0f,   -145.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(22, 14, kSetUG10,           kSceneUG10,     2.0f,     1.15f,   412.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(23, 14, kSetUG10,           kSceneUG10,  -327.0f,     1.15f,  -384.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(24, 14, kSetUG10,           kSceneUG10,  -253.0f,    81.33f,  -620.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(25,  5, kSetCT05,           kSceneCT05,  -518.52f, -109.91f,   312.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(26,  5, kSetCT05,           kSceneCT05,   141.0f,  -109.91f,   452.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(27,  5, kSetCT11,           kSceneCT11,   516.0f,     0.56f,   779.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(28,  5, kSetCT11,           kSceneCT11,   388.0f,     9.68f,   190.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(29,  5, kSetCT11,           kSceneCT11,  -429.0f,     9.68f,  -115.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(30,  7, kSetPS14,           kScenePS14,  -997.0f,   508.14f,  -630.84f, -1);
+	Combat_Flee_Waypoint_Set_Data(31,  7, kSetPS14,           kScenePS14,  -416.27f,  508.14f,  -574.84f, -1);
+	Combat_Flee_Waypoint_Set_Data(32,  7, kSetPS14,           kScenePS14,  -416.0f,   508.14f,  -906.84f, -1);
+	Combat_Flee_Waypoint_Set_Data(33,  7, kSetPS14,           kScenePS14, -1168.0f,   508.14f, -1666.84f, -1);
+	Combat_Flee_Waypoint_Set_Data(34, 10, kSetUG06,           kSceneUG06,    75.0f,   153.0f,   -485.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(35, 10, kSetUG06,           kSceneUG06,   -18.0f,     0.0f,    321.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(36, 11, kSetUG01,           kSceneUG01,  -190.0f,   -50.13f,  -298.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(37, 11, kSetUG01,           kSceneUG01,   126.0f,   -50.13f,  -150.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(38, 11, kSetUG01,           kSceneUG01,   187.78f,  -50.13f, -1262.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(39, 11, kSetUG01,           kSceneUG01,   -20.22f,  -30.13f, -2338.3f,  -1);
+	Combat_Flee_Waypoint_Set_Data(40,  3, kSetNR01,           kSceneNR01,  -416.0f,    31.55f,  -829.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(41,  3, kSetNR01,           kSceneNR01,  -412.0f,    31.55f, -1357.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(42,  3, kSetNR01,           kSceneNR01,  -208.0f,    23.0f,  -1693.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(43,  3, kSetNR01,           kSceneNR01,   -64.0f,    23.83f, -2097.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(44,  3, kSetNR01,           kSceneNR01,   320.0f,    23.83f, -1058.49f, -1);
+	Combat_Flee_Waypoint_Set_Data(45,  3, kSetNR01,           kSceneNR01,   252.0f,    31.65f,  -674.49f, -1);
+	Combat_Flee_Waypoint_Set_Data(46,  8, kSetKP02,           kSceneKP02,  -803.0f,  -615.49f,  2619.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(47,  8, kSetKP02,           kSceneKP02, -1027.0f,  -614.49f,  3151.24f, -1);
+	Combat_Flee_Waypoint_Set_Data(48,  9, kSetKP05_KP06,      kSceneKP05, -1190.0f,     0.0f,    876.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(49,  9, kSetKP05_KP06,      kSceneKP05,  -687.0f,     0.0f,    910.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(50,  9, kSetKP05_KP06,      kSceneKP06,  -455.0f,     8.26f,  -453.26f, -1);
+	Combat_Flee_Waypoint_Set_Data(51,  9, kSetKP05_KP06,      kSceneKP06, -1127.0f,     8.26f,  -705.26f, -1);
+	Combat_Flee_Waypoint_Set_Data(52,  9, kSetKP05_KP06,      kSceneKP06, -1143.0f,     8.26f,  -261.26f, -1);
+	Combat_Flee_Waypoint_Set_Data(53,  9, kSetKP05_KP06,      kSceneKP06,  -703.0f,     8.26f,  -157.26f, -1);
+	Combat_Flee_Waypoint_Set_Data(54, 10, kSetUG04,           kSceneUG04,   166.0f,    11.87f,  -250.8f,  -1);
+	Combat_Flee_Waypoint_Set_Data(55, 10, kSetUG04,           kSceneUG04,   158.0f,     4.14f,   -10.8f,  -1);
+	Combat_Flee_Waypoint_Set_Data(56, 10, kSetUG04,           kSceneUG04,  -310.0f,    39.15f,  -822.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(57, 10, kSetUG04,           kSceneUG04,  -302.0f,    -1.74f, -5847.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(58, 10, kSetUG05,           kSceneUG05,     4.0f,     1.37f, -3684.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(59, 10, kSetUG05,           kSceneUG05,   146.28f,   -6.05f,  -135.93f, -1);
+	Combat_Flee_Waypoint_Set_Data(60,  7, kSetMA07,           kSceneMA07,   212.0f,  -162.8f,   -108.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(61,  7, kSetMA07,           kSceneMA07,   -28.0f,  -162.8f,   -104.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(62,  7, kSetMA07,           kSceneMA07,   504.0f,  -162.8f,    224.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(63,  7, kSetMA07,           kSceneMA07,  -301.0f,  -162.8f,    275.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(64, 15, kSetHF06,           kSceneHF06,    98.0f,   367.93f,   -10.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(65, 15, kSetHF06,           kSceneHF06,  -206.0f,   367.69f,   386.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(66,  5, kSetCT01_CT12,      kSceneCT12,  -190.0f,    -6.5f,    789.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(67,  5, kSetCT01_CT12,      kSceneCT12,   123.0f,    -6.5f,   1002.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(68,  5, kSetCT01_CT12,      kSceneCT12,  -573.0f,    -6.5f,   1202.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(69, 16, kSetUG12,           kSceneUG12,   120.0f,  -126.21f,  -350.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(70, 16, kSetUG12,           kSceneUG12,   524.0f,  -126.21f,   158.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(71, 16, kSetUG12,           kSceneUG12,   276.0f,  -126.21f,   537.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(72, 17, kSetUG14,           kSceneUG14,  -334.7f,    12.97f,  -332.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(73, 18, kSetRC03,           kSceneRC03,  -672.0f,     1.72f,   -96.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(74, 18, kSetRC03,           kSceneRC03,  -552.0f,    -4.01f,   268.0f,  -1);
+	Combat_Flee_Waypoint_Set_Data(75, 18, kSetRC03,           kSceneRC03,   293.06f,    1.72f,   112.25f, -1);
+	Combat_Flee_Waypoint_Set_Data(76, 20, kSetHF05,           kSceneHF05,   435.13f,   37.18f,  -292.34f, -1);
 }
 
 void InitScript::Init_Shadows() {
diff --git a/engines/bladerunner/script/scene/ct12.cpp b/engines/bladerunner/script/scene/ct12.cpp
index 27995a8..7c69762 100644
--- a/engines/bladerunner/script/scene/ct12.cpp
+++ b/engines/bladerunner/script/scene/ct12.cpp
@@ -145,7 +145,7 @@ bool SceneScriptCT12::ClickedOnActor(int actorId) {
 	) {
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
-		Actor_Says(kActorMcCoy, 710, kAnimationModeTalk);
+		Actor_Says(kActorMcCoy, 710, kAnimationModeTalk); // Hold it! I'm not a Replicant, I got proof!
 		Actor_Says(kActorOfficerGrayford, 20, kAnimationModeTalk);
 		Actor_Says(kActorMcCoy, 715, kAnimationModeTalk);
 		Actor_Says(kActorOfficerGrayford, 30, kAnimationModeTalk);
@@ -156,9 +156,9 @@ bool SceneScriptCT12::ClickedOnActor(int actorId) {
 		Actor_Says(kActorMcCoy, 725, kAnimationModeTalk);
 		Actor_Says(kActorOfficerGrayford, 70, kAnimationModeTalk);
 		Actor_Says(kActorOfficerGrayford, 80, kAnimationModeTalk);
-		Actor_Says(kActorOfficerGrayford, 90, kAnimationModeTalk);
-		Actor_Says(kActorOfficerGrayford, 100, kAnimationModeTalk);
-		Actor_Says(kActorOfficerGrayford, 110, kAnimationModeTalk);
+		Actor_Says(kActorOfficerGrayford, 90, kAnimationModeTalk); // if you are lying...
+		Actor_Says(kActorOfficerGrayford, 100, kAnimationModeTalk); // you gonna wish...
+		Actor_Says(kActorOfficerGrayford, 110, kAnimationModeTalk); // Take him in!
 		Game_Flag_Set(kFlagUnpauseGenWalkers);
 		Game_Flag_Set(kFlagMcCoyFreedOfAccusations);
 		Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyStartChapter5);
diff --git a/engines/bladerunner/script/scene/dr04.cpp b/engines/bladerunner/script/scene/dr04.cpp
index a832ea0..2c6c632 100644
--- a/engines/bladerunner/script/scene/dr04.cpp
+++ b/engines/bladerunner/script/scene/dr04.cpp
@@ -120,7 +120,7 @@ bool SceneScriptDR04::ClickedOnActor(int actorId) {
 				Actor_Says(kActorMoraji, 50, kAnimationModeTalk);
 				Actor_Clue_Acquire(kActorMcCoy, kClueMorajiInterview, true, kActorMoraji);
 				Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDie);
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 101); // Grayford arrives at scene of Moraji corpse
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrivesToDR04); // Grayford arrives at scene of Moraji corpse
 				return true;
 			}
 		}
@@ -128,16 +128,16 @@ bool SceneScriptDR04::ClickedOnActor(int actorId) {
 		if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiDead) {
 			if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorMoraji, 36, true, false)) {
 #if BLADERUNNER_ORIGINAL_BUGS
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 106);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopPatrolToTalkToMcCoyAtDR04);
 #else
 				// bugfix: original code would result in this conversation repeating multiple times if:
-				// Officer Grayford is at 103 goal (asking "What do you know about this?"...
+				// Officer Grayford is at 103 (kGoalOfficerGrayfordTalkToMcCoyAndReportAtDR04) goal (asking "What do you know about this?"...
 				// and the player skips the conversation fast.
-				// So ask about a sheet (goal 106) for Moraji only when Grayford starts patrolling (104, 105 goals)
-				if (Actor_Query_Goal_Number(kActorOfficerGrayford) == 104
-				 || Actor_Query_Goal_Number(kActorOfficerGrayford) == 105
+				// So ask about a sheet (goal 106 (kGoalOfficerGrayfordStopPatrolToTalkToMcCoyAtDR04)) for Moraji only when Grayford starts patrolling (104, 105 goals)
+				if (Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordPatrolsAtDR04a
+				 || Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordPatrolsAtDR04b
 				) {
-					Actor_Set_Goal_Number(kActorOfficerGrayford, 106); // This goal reverts to the previous one after finishing up
+					Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopPatrolToTalkToMcCoyAtDR04); // This goal reverts to the previous goal after finishing up
 				}
 #endif // BLADERUNNER_ORIGINAL_BUGS
 				return true;
@@ -155,7 +155,7 @@ bool SceneScriptDR04::ClickedOnExit(int exitId) {
 	if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiLayDown) {
 		Actor_Force_Stop_Walking(kActorMcCoy);
 		Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDie);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 101);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrivesToDR04);
 		return true;
 	}
 
@@ -248,7 +248,7 @@ void SceneScriptDR04::SceneFrameAdvanced(int frame) {
 			 && Actor_Query_Goal_Number(kActorMoraji) != kGoalMorajiLayDown
 			 && Actor_Query_Goal_Number(kActorMoraji) != kGoalMorajiPerished
 			) {
-				Actor_Set_Goal_Number(kActorOfficerGrayford, 101);
+				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrivesToDR04);
 			}
 			Scene_Exits_Enable();
 			break;
diff --git a/engines/bladerunner/script/scene/hf05.cpp b/engines/bladerunner/script/scene/hf05.cpp
index a724a5b..49e37b2 100644
--- a/engines/bladerunner/script/scene/hf05.cpp
+++ b/engines/bladerunner/script/scene/hf05.cpp
@@ -97,7 +97,7 @@ bool SceneScriptHF05::ClickedOn3DObject(const char *objectName, bool a2) {
 			}
 
 			Player_Loses_Control();
-			Actor_Set_Goal_Number(kActorOfficerLeary, 425);
+			Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPoliceWait60SecondsToAttackHF05);
 			Game_Flag_Set(kFlagHF05Hole);
 			Game_Flag_Set(kFlagHF07Hole);
 			Obstacle_Object("OBSTACLE_HOLE", true);
@@ -285,7 +285,7 @@ void SceneScriptHF05::SceneFrameAdvanced(int frame) {
 
 void SceneScriptHF05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
 	if (actorId == kActorOfficerLeary
-	 && newGoal == 430
+	 && newGoal == kGoalOfficerLearyPoliceAboutToAttackHF05
 	) {
 		Game_Flag_Set(kFlagHF05PoliceAttacked);
 		policeAttack();
@@ -325,7 +325,7 @@ void SceneScriptHF05::PlayerWalkedIn() {
 				Music_Play(kMusicBatl226M, 40, 0, 2, -1, 0, 0);
 				Actor_Says(kActorOfficerGrayford, 200, kAnimationModeTalk);
 				Actor_Says(kActorOfficerGrayford, 210, kAnimationModeTalk);
-				Actor_Set_Goal_Number(kActorOfficerLeary, 420);
+				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPoliceWait120SecondsToAttackHF05);
 				if (getCompanionActor() ==  kActorDektora) {
 					talkWithDektora();
 				} else if (getCompanionActor() == kActorLucy) {
diff --git a/engines/bladerunner/script/scene/hf06.cpp b/engines/bladerunner/script/scene/hf06.cpp
index 7afb3d8..9a62e39 100644
--- a/engines/bladerunner/script/scene/hf06.cpp
+++ b/engines/bladerunner/script/scene/hf06.cpp
@@ -160,8 +160,8 @@ void SceneScriptHF06::SceneFrameAdvanced(int frame) {
 
 void SceneScriptHF06::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
 	if (actorId == kActorSteele
-	 && oldGoal != 599
-	 && newGoal == 599
+	 && oldGoal != kGoalSteeleGone
+	 && newGoal == kGoalSteeleGone
 	) {
 		Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorSteele, 24, false, false);
 		Actor_Says(kActorSteele, 250, -1);
diff --git a/engines/bladerunner/script/scene/ma04.cpp b/engines/bladerunner/script/scene/ma04.cpp
index b196972..7af2275 100644
--- a/engines/bladerunner/script/scene/ma04.cpp
+++ b/engines/bladerunner/script/scene/ma04.cpp
@@ -294,9 +294,9 @@ void SceneScriptMA04::PlayerWalkedIn() {
 				Game_Flag_Set(kFlagRC01ChromeDebrisTaken);
 				Item_Remove_From_World(kItemChromeDebris);
 			}
-			Actor_Set_Goal_Number(kActorOfficerLeary, 99);
+			Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyEndOfAct1);
 			Actor_Put_In_Set(kActorOfficerLeary, kSetFreeSlotC);
-			Actor_Set_At_Waypoint(kActorOfficerLeary, 35, 0);
+			Actor_Set_At_Waypoint(kActorOfficerLeary, 35, 0); // kSetFreeSlotC
 			Autosave_Game(0);
 		}
 		//return false;
diff --git a/engines/bladerunner/script/scene/tb03.cpp b/engines/bladerunner/script/scene/tb03.cpp
index dfb4061..cb19643 100644
--- a/engines/bladerunner/script/scene/tb03.cpp
+++ b/engines/bladerunner/script/scene/tb03.cpp
@@ -64,7 +64,7 @@ void SceneScriptTB03::InitializeScene() {
 		int goal = Actor_Query_Goal_Number(kActorTyrellGuard);
 		if (goal == kGoalTyrellGuardWait) {
 			Actor_Change_Animation_Mode(kActorTyrellGuard, kAnimationModeIdle);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 399);
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordArrestMcCoyInTB03Act4);
 		} else if (goal != kGoalTyrellGuardWakeUp) {
 			Actor_Set_Goal_Number(kActorTyrellGuard, kGoalTyrellGuardSleeping);
 		}
diff --git a/engines/bladerunner/script/scene/ug05.cpp b/engines/bladerunner/script/scene/ug05.cpp
index d582717..19bfb00 100644
--- a/engines/bladerunner/script/scene/ug05.cpp
+++ b/engines/bladerunner/script/scene/ug05.cpp
@@ -192,7 +192,7 @@ void SceneScriptUG05::PlayerWalkedIn() {
 
 			Actor_Put_In_Set(kActorOfficerGrayford, kSetUG05);
 			Actor_Set_At_XYZ(kActorOfficerGrayford, 4.22f, -1.37f, -925.0f, 750);
-			Actor_Set_Goal_Number(kActorOfficerGrayford, 599);
+			Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordDead);
 			Actor_Retired_Here(kActorOfficerGrayford, 70, 36, true, -1);
 
 			int affectionTowardsActor = getAffectionTowardsActor();
diff --git a/engines/bladerunner/script/scene/ug07.cpp b/engines/bladerunner/script/scene/ug07.cpp
index d210400..e504413 100644
--- a/engines/bladerunner/script/scene/ug07.cpp
+++ b/engines/bladerunner/script/scene/ug07.cpp
@@ -178,8 +178,8 @@ void SceneScriptUG07::PlayerWalkedIn() {
 	if ( Global_Variable_Query(kVariableChapter) == 4
 	 && !Game_Flag_Query(kFlagUG07Empty)
 	) {
-		Actor_Set_Goal_Number(kActorOfficerLeary, 307);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 307);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyBlockingUG07);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordBlockingUG07);
 	}
 
 	if (Game_Flag_Query(kFlagUG08toUG07)) {
@@ -190,14 +190,14 @@ void SceneScriptUG07::PlayerWalkedIn() {
 
 void SceneScriptUG07::PlayerWalkedOut() {
 	if (Global_Variable_Query(kVariableChapter) == 4
-	 && (Actor_Query_Goal_Number(kActorOfficerLeary) == 307
-	  || Actor_Query_Goal_Number(kActorOfficerGrayford) == 307
+	 && (Actor_Query_Goal_Number(kActorOfficerLeary) == kGoalOfficerLearyBlockingUG07
+	  || Actor_Query_Goal_Number(kActorOfficerGrayford) == kGoalOfficerGrayfordBlockingUG07
 	 )
 	) {
 		Non_Player_Actor_Combat_Mode_Off(kActorOfficerLeary);
 		Non_Player_Actor_Combat_Mode_Off(kActorOfficerGrayford);
-		Actor_Set_Goal_Number(kActorOfficerLeary, 306);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 306);
+		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPrepareToHuntAroundAct4);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPrepareToHuntAroundAct4);
 	}
 
 	if (Actor_Query_In_Set(kActorClovis, kSetUG07)) {


Commit: 5b2e6f6dfb1dba88dccc06e0e5269cd0df509569
    https://github.com/scummvm/scummvm/commit/5b2e6f6dfb1dba88dccc06e0e5269cd0df509569
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-19T21:25:26+03:00

Commit Message:
BLADERUNNER: Cleanup and fix for NR03 dancer

Changed paths:
    engines/bladerunner/game_constants.h
    engines/bladerunner/script/ai/free_slot_a.cpp
    engines/bladerunner/script/ai/free_slot_b.cpp
    engines/bladerunner/script/ai/hysteria_patron1.cpp
    engines/bladerunner/script/ai/hysteria_patron2.cpp
    engines/bladerunner/script/ai/officer_grayford.cpp
    engines/bladerunner/script/ai/officer_leary.cpp
    engines/bladerunner/script/scene/nr03.cpp


diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index 4f91989..71d21d8 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -1765,6 +1765,23 @@ enum GameModelAnimations {
 	kModelAnimationRachaelTalkHandOnChest          = 831,
 	kModelAnimationRachaelTalkHandWaveToRight      = 832,
 
+	kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp = 877,
+	kModelAnimationHysteriaPatron1DanceStandingUpLeftMotion   = 878,
+	kModelAnimationHysteriaPatron1DanceStandingUpStowingMoney = 879, // original unused
+	kModelAnimationHysteriaPatron1DanceSplitsDuckAndDown      = 880,
+	kModelAnimationHysteriaPatron1DanceSplitsSemiUpAndDown    = 881,
+	kModelAnimationHysteriaPatron1DanceSplitsBackAndForth     = 882,
+	kModelAnimationHysteriaPatron1DanceStandingUpToSplits     = 883,
+	kModelAnimationHysteriaPatron1DanceSplitsToStandingUp     = 884,
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion       = 885, // most used
+	kModelAnimationHysteriaPatron2DanceHandsUpLeftMotion      = 886,
+	kModelAnimationHysteriaPatron2DanceHandsUpSitAndUp        = 887,
+	kModelAnimationHysteriaPatron2DanceHandsDownHipsSwirl     = 888,
+	kModelAnimationHysteriaPatron2DanceHandsDownLegSwirl      = 889,
+	kModelAnimationHysteriaPatron2DanceHandsDownLeanBackForth = 890,
+	kModelAnimationHysteriaPatron2DanceHandsUpToHandsDown     = 891,
+	kModelAnimationHysteriaPatron2DanceHandsDownToHandsUp     = 892,
+
 	kModelAnimationBadge                       = 931,
 	kModelAnimationBomb                        = 932,
 	kModelAnimationCandy                       = 933,
diff --git a/engines/bladerunner/script/ai/free_slot_a.cpp b/engines/bladerunner/script/ai/free_slot_a.cpp
index 83ae547..37e7783 100644
--- a/engines/bladerunner/script/ai/free_slot_a.cpp
+++ b/engines/bladerunner/script/ai/free_slot_a.cpp
@@ -159,7 +159,7 @@ void AIScriptFreeSlotA::CompletedMovementTrack() {
 		break;
 
 	case 406:
-		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotA, 0, 0, 0, 8, 4, 7, 8, 0, 0, 100, 5, 300, 0);
+		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotA, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, 0, 100, 5, 300, false);
 		break;
 
 	default:
@@ -286,7 +286,7 @@ bool AIScriptFreeSlotA::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 
 	case kGoalFreeSlotAAttackMcCoy:
 		Actor_Set_Targetable(kActorFreeSlotA, true);
-		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotA, 0, 0, 0, 8, 4, 7, 8, 25, 0, 75, 5, 300, 0);
+		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotA, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 25, 0, 75, 5, 300, false);
 		break;
 
 	case kGoalFreeSlotAUG15Fall:
diff --git a/engines/bladerunner/script/ai/free_slot_b.cpp b/engines/bladerunner/script/ai/free_slot_b.cpp
index c3a87bf..dd4ce55 100644
--- a/engines/bladerunner/script/ai/free_slot_b.cpp
+++ b/engines/bladerunner/script/ai/free_slot_b.cpp
@@ -121,7 +121,7 @@ void AIScriptFreeSlotB::CompletedMovementTrack() {
 		break;
 
 	case 406:
-		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, 0, 0, 0, 8, 4, 7, 8, 0, 0, 100, 5, 300, 0);
+		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, 0, 100, 5, 300, false);
 		break;
 
 	default:
@@ -195,7 +195,7 @@ bool AIScriptFreeSlotB::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 
 	case 302:
 		Actor_Set_Targetable(kActorFreeSlotB, true);
-		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, 0, 0, 0, 8, 4, 7, 8, 25, 0, 75, 5, 300, 0);
+		Non_Player_Actor_Combat_Mode_On(kActorFreeSlotB, kActorCombatStateIdle, false, kActorMcCoy, 8, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 25, 0, 75, 5, 300, false);
 		break;
 
 	case 400:
diff --git a/engines/bladerunner/script/ai/hysteria_patron1.cpp b/engines/bladerunner/script/ai/hysteria_patron1.cpp
index 6eadd74..9a13208 100644
--- a/engines/bladerunner/script/ai/hysteria_patron1.cpp
+++ b/engines/bladerunner/script/ai/hysteria_patron1.cpp
@@ -93,22 +93,46 @@ bool AIScriptHysteriaPatron1::GoalChanged(int currentGoalNumber, int newGoalNumb
 	return false;
 }
 
-const int animationList[27] = {
-	877, 878, 877, 883, 880, 881, 882, 884, 878, 877,
-	883, 881, 880, 884, 877, 877, 878, 883, 882, 884,
-	878, 877, 883, 882, 880, 881, 884
+const int kAnimationsCount = 27;
+const int animationList[kAnimationsCount] = {
+	kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp, kModelAnimationHysteriaPatron1DanceStandingUpLeftMotion, kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp,
+	kModelAnimationHysteriaPatron1DanceStandingUpToSplits,     kModelAnimationHysteriaPatron1DanceSplitsDuckAndDown,    kModelAnimationHysteriaPatron1DanceSplitsSemiUpAndDown,
+	kModelAnimationHysteriaPatron1DanceSplitsBackAndForth,     kModelAnimationHysteriaPatron1DanceSplitsToStandingUp,   kModelAnimationHysteriaPatron1DanceStandingUpLeftMotion,
+	kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp, kModelAnimationHysteriaPatron1DanceStandingUpToSplits,   kModelAnimationHysteriaPatron1DanceSplitsSemiUpAndDown,
+	kModelAnimationHysteriaPatron1DanceSplitsDuckAndDown,      kModelAnimationHysteriaPatron1DanceSplitsToStandingUp,   kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp,
+	kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp, kModelAnimationHysteriaPatron1DanceStandingUpLeftMotion, kModelAnimationHysteriaPatron1DanceStandingUpToSplits,
+	kModelAnimationHysteriaPatron1DanceSplitsBackAndForth,     kModelAnimationHysteriaPatron1DanceSplitsToStandingUp,   kModelAnimationHysteriaPatron1DanceStandingUpLeftMotion,
+	kModelAnimationHysteriaPatron1DanceStandingUpSemiSitAndUp, kModelAnimationHysteriaPatron1DanceStandingUpToSplits,   kModelAnimationHysteriaPatron1DanceSplitsBackAndForth,
+	kModelAnimationHysteriaPatron1DanceSplitsDuckAndDown,      kModelAnimationHysteriaPatron1DanceSplitsSemiUpAndDown,  kModelAnimationHysteriaPatron1DanceSplitsToStandingUp
 };
 
 bool AIScriptHysteriaPatron1::UpdateAnimation(int *animation, int *frame) {
-	*animation = animationList[_animationState];
+	if (_vm->_cutContent
+	    && (_animationState == 2 || _animationState == 16 || _animationState == 21)
+	) {
+		// replace a few of the repeated "standing up" animations
+		// with the cut animation kModelAnimationHysteriaPatron1DanceStandingUpStowingMoney
+		*animation = kModelAnimationHysteriaPatron1DanceStandingUpStowingMoney;
+	} else {
+		*animation = animationList[_animationState];
+	}
 
 	if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
 		_animationFrame = 0;
 
-		if (++_animationState >= 27)
+		if (++_animationState >= kAnimationsCount) {
 			_animationState = 0;
-
-		*animation = animationList[_animationState];
+		}
+
+		if (_vm->_cutContent
+		    && (_animationState == 2 || _animationState == 16 || _animationState == 21)
+		) {
+			// replace a few of the repeated "standing up" animations
+			// with the cut animation kModelAnimationHysteriaPatron1DanceStandingUpStowingMoney
+			*animation = kModelAnimationHysteriaPatron1DanceStandingUpStowingMoney;
+		} else {
+			*animation = animationList[_animationState];
+		}
 	}
 
 	*frame = _animationFrame;
diff --git a/engines/bladerunner/script/ai/hysteria_patron2.cpp b/engines/bladerunner/script/ai/hysteria_patron2.cpp
index 6a284bd..6fe72ec 100644
--- a/engines/bladerunner/script/ai/hysteria_patron2.cpp
+++ b/engines/bladerunner/script/ai/hysteria_patron2.cpp
@@ -94,10 +94,18 @@ bool AIScriptHysteriaPatron2::GoalChanged(int currentGoalNumber, int newGoalNumb
 	return false;
 }
 
-const int animationList[30] = {
-	885, 886, 887, 891, 888, 889, 890, 892, 886, 885,
-	885, 885, 885, 886, 891, 889, 888, 890, 892, 887,
-	885, 885, 885, 885, 885, 891, 888, 888, 890, 892
+const int kAnimationsCount = 30;
+const int animationList[kAnimationsCount] = {
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsUpLeftMotion,      kModelAnimationHysteriaPatron2DanceHandsUpSitAndUp,
+	kModelAnimationHysteriaPatron2DanceHandsUpToHandsDown,     kModelAnimationHysteriaPatron2DanceHandsDownHipsSwirl,     kModelAnimationHysteriaPatron2DanceHandsDownLegSwirl,
+	kModelAnimationHysteriaPatron2DanceHandsDownLeanBackForth, kModelAnimationHysteriaPatron2DanceHandsDownToHandsUp,     kModelAnimationHysteriaPatron2DanceHandsUpLeftMotion,
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsBellyMotion,
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsUpLeftMotion,      kModelAnimationHysteriaPatron2DanceHandsUpToHandsDown,
+	kModelAnimationHysteriaPatron2DanceHandsDownLegSwirl,      kModelAnimationHysteriaPatron2DanceHandsDownHipsSwirl,     kModelAnimationHysteriaPatron2DanceHandsDownLeanBackForth,
+	kModelAnimationHysteriaPatron2DanceHandsDownToHandsUp,     kModelAnimationHysteriaPatron2DanceHandsUpSitAndUp,        kModelAnimationHysteriaPatron2DanceHandsBellyMotion,
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsBellyMotion,
+	kModelAnimationHysteriaPatron2DanceHandsBellyMotion,       kModelAnimationHysteriaPatron2DanceHandsUpToHandsDown,     kModelAnimationHysteriaPatron2DanceHandsDownHipsSwirl,
+	kModelAnimationHysteriaPatron2DanceHandsDownHipsSwirl,     kModelAnimationHysteriaPatron2DanceHandsDownLeanBackForth, kModelAnimationHysteriaPatron2DanceHandsDownToHandsUp
 };
 
 bool AIScriptHysteriaPatron2::UpdateAnimation(int *animation, int *frame) {
@@ -106,7 +114,7 @@ bool AIScriptHysteriaPatron2::UpdateAnimation(int *animation, int *frame) {
 	if (++_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
 		_animationFrame = 0;
 
-		if (++_animationState >= 30)
+		if (++_animationState >= kAnimationsCount)
 			_animationState = 0;
 
 		*animation = animationList[_animationState];
diff --git a/engines/bladerunner/script/ai/officer_grayford.cpp b/engines/bladerunner/script/ai/officer_grayford.cpp
index af0bc3c..82ae1b5 100644
--- a/engines/bladerunner/script/ai/officer_grayford.cpp
+++ b/engines/bladerunner/script/ai/officer_grayford.cpp
@@ -292,7 +292,7 @@ void AIScriptOfficerGrayford::ReceivedClue(int clueId, int fromActorId) {
 
 void AIScriptOfficerGrayford::ClickedByPlayer() {
 	switch (Actor_Query_Goal_Number(kActorOfficerGrayford)) {
-	case 1:
+	case kGoalOfficerGrayfordWalksInPS03a:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
@@ -303,10 +303,10 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 			Actor_Says(kActorMcCoy, 4515, 13);
 			Actor_Says(kActorOfficerGrayford, 230, 13);
 		}
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 1);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03a);
 		break;
 
-	case 2:
+	case kGoalOfficerGrayfordWalksInPS03b:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
@@ -317,10 +317,10 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 			Actor_Says(kActorMcCoy, 4515, 13);
 			Actor_Says(kActorOfficerGrayford, 330, 13);
 		}
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 2);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03b);
 		break;
 
-	case 3:
+	case kGoalOfficerGrayfordWalksInPS03c:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
@@ -330,10 +330,10 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 		} else {
 			Actor_Says(kActorMcCoy, 5075, 14); // bug in the original? Matches the above statement
 		}
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 3);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03c);
 		break;
 
-	case 4:
+	case kGoalOfficerGrayfordWalksInPS03d:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
@@ -345,25 +345,25 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 			Actor_Says(kActorMcCoy, 4515, 13);
 			Actor_Says(kActorOfficerGrayford, 330, 13);
 		}
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 4);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03d);
 		break;
 
-	case 7:
+	case kGoalOfficerGrayfordWalksInPS09b:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Says(kActorMcCoy, 4515, 14);
 		Actor_Says(kActorOfficerGrayford, 330, 13);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 7);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS09b);
 		break;
-
-	case 8:
+// asdf goals 6 and 9?
+	case kGoalOfficerGrayfordWalksInPS09c:
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordStopAndTalk1);
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		Actor_Says(kActorMcCoy, 5075, 13);
-		Actor_Set_Goal_Number(kActorOfficerGrayford, 8);
+		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS09c);
 		break;
 
 	case kGoalOfficerGrayfordPatrolsAtDR04a:
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index d803b06..11c3b7c 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -122,43 +122,43 @@ bool AIScriptOfficerLeary::Update() {
 		case kSetDR01_DR02_DR04:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 0, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 0, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetBB01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 1, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 1, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetCT11:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 5, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 5, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetMA07:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 7, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 7, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetNR01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 3, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 3, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetRC03:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 18, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 18, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG01:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 11, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 11, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG04:
@@ -166,31 +166,31 @@ bool AIScriptOfficerLeary::Update() {
 		case kSetUG06:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 10, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 10, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG08:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 13, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 13, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG10:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 14, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 14, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG12:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 16, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 16, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		case kSetUG14:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
-				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 17, 4, 7, 8, -1, -1, -1, 10, 300, 0);
+				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 17, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
 		}
@@ -238,7 +238,7 @@ void AIScriptOfficerLeary::CompletedMovementTrack() {
 	}
 	if (goal == kGoalOfficerLearyBlockingUG07) {
 		// UG07 before McCoy visits his apartment in Act 4
-		Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, 0, 1, kActorMcCoy, 12, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, -1, -1, 15, 300, 0);
+		Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 12, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, -1, -1, 15, 300, false);
 	}
 	if (goal == 308) {
 		// goal 308 (and 309) are never triggered in the original code
diff --git a/engines/bladerunner/script/scene/nr03.cpp b/engines/bladerunner/script/scene/nr03.cpp
index b83d2ca..534e64f 100644
--- a/engines/bladerunner/script/scene/nr03.cpp
+++ b/engines/bladerunner/script/scene/nr03.cpp
@@ -230,15 +230,43 @@ bool SceneScriptNR03::ClickedOn2DRegion(int region) {
 	if (region == 0) {
 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 79.2f, -70.19f, -984.0f, 12, true, false, false)) {
 			Actor_Face_Actor(kActorMcCoy, kActorHysteriaPatron1, true);
-			int rnd = Random_Query(0, 4);
-			if (rnd == 0) {
+			switch(Random_Query(0, 4)) {
+			case 0:
 				Actor_Says(kActorMcCoy, 1055, kAnimationModeTalk);
-			} else if (rnd == 1) {
+				break;
+			case 1:
 				Actor_Says(kActorMcCoy, 8590, kAnimationModeTalk);
-			} else if (rnd == 2) {
+				break;
+			case 2:
 				Actor_Says(kActorMcCoy, 8930, kAnimationModeTalk);
-			} else if (rnd == 3) {
+				break;
+			case 3:
 				Actor_Says(kActorMcCoy, 7465, kAnimationModeTalk);
+				break;
+#if BLADERUNNER_ORIGINAL_BUGS
+			default:
+				break;
+#else
+			case 4:
+				if(_vm->_cutContent) {
+					switch(Random_Query(1, 10)) {
+					case 1:
+						// fall through
+					case 2:
+						// make this rare
+						Actor_Says(kActorMcCoy, 8518, kAnimationModeTalk); // Hey, can I lick...
+						break;
+					default:
+						Actor_Says(kActorMcCoy, 8700, kAnimationModeTalk); // Never seen anything like that before.
+						break;
+					}
+				} else {
+					// just say the same as in case 0
+					Actor_Says(kActorMcCoy, 1055, kAnimationModeTalk);
+				}
+			default:
+				break;
+#endif // BLADERUNNER_ORIGINAL_BUGS
 			}
 		}
 		return true;


Commit: 203d82a1a0382684884da0d6c285444605153802
    https://github.com/scummvm/scummvm/commit/203d82a1a0382684884da0d6c285444605153802
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-20T13:12:06+03:00

Commit Message:
BLADERUNNER: Officers and combat bugfixes part 1

The debug messages and comments will all be removed after this series of fixes

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/actor_combat.cpp
    engines/bladerunner/actor_walk.cpp
    engines/bladerunner/debugger.cpp
    engines/bladerunner/scene_objects.cpp
    engines/bladerunner/script/ai/officer_grayford.cpp
    engines/bladerunner/script/ai/officer_leary.cpp
    engines/bladerunner/script/scene/ct11.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index b00b870..1c87d8e 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -871,7 +871,7 @@ void Actor::stopWalking(bool value) {
 	}
 
 	if (isWalking()) {
-		_walkInfo->stop(_id, true, _animationModeCombatIdle, 0);
+		_walkInfo->stop(_id, true, _animationModeCombatIdle, kAnimationModeIdle);
 	} else if (inCombat()) {
 		changeAnimationMode(_animationModeCombatIdle, false);
 	} else {
diff --git a/engines/bladerunner/actor_combat.cpp b/engines/bladerunner/actor_combat.cpp
index 400e3e7..869ccdf 100644
--- a/engines/bladerunner/actor_combat.cpp
+++ b/engines/bladerunner/actor_combat.cpp
@@ -686,7 +686,7 @@ bool ActorCombat::findClosestPositionToEnemy(Vector3 &output) const {
 		Vector3 test = _enemyPosition + offsets[i];
 		float dist = distance(_actorPosition, test);
 		if ( min == -1.0f || dist < min) {
-			if (!_vm->_sceneObjects->existsOnXZ(_actorId, test.x, test.z, true, true) && _vm->_scene->_set->findWalkbox(test.x, test.z) >= 0) {
+			if (!_vm->_sceneObjects->existsOnXZ(_actorId + kSceneObjectOffsetActors, test.x, test.z, true, true) && _vm->_scene->_set->findWalkbox(test.x, test.z) >= 0) {
 				output = test;
 				min = dist;
 			}
diff --git a/engines/bladerunner/actor_walk.cpp b/engines/bladerunner/actor_walk.cpp
index daa28b6..1c91ce0 100644
--- a/engines/bladerunner/actor_walk.cpp
+++ b/engines/bladerunner/actor_walk.cpp
@@ -73,12 +73,14 @@ bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vect
 		} else {
 			stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle);
 		}
+//		debug("actor id: %d, arrived: %d - false setup 01", actorId, (*arrived)? 1:0);
 		return false;
 	}
 
 	if (r == -1) {
 		stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle);
 		*arrived = true;
+//		debug("actor id: %d, arrived: %d - false setup 02", actorId, (*arrived)? 1:0);
 		return false;
 	}
 
@@ -107,6 +109,7 @@ bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vect
 	if (next.x == _current.x && next.z == _current.z) {
 		stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle);
 		*arrived = true;
+//		debug("actor id: %d, arrived: %d - false setup 03", actorId, (*arrived)? 1:0);
 		return false;
 	}
 
@@ -115,6 +118,7 @@ bool ActorWalk::setup(int actorId, bool runFlag, const Vector3 &from, const Vect
 	_running = runFlag;
 	_status = 2;
 
+//	debug("actor id: %d, arrived: %d - true setup 01", actorId, (*arrived)? 1:0);
 	return true;
 }
 
@@ -201,6 +205,9 @@ bool ActorWalk::tick(int actorId, float stepDistance, bool mustReachWalkDestinat
 			if (nextIsCloseEnough) {
 				return false;
 			}
+		} else {
+			stop(actorId, true, kAnimationModeCombatIdle, kAnimationModeIdle); // too close
+			return true;
 		}
 	}
 
@@ -419,6 +426,7 @@ int ActorWalk::nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, V
 	next = from;
 
 	if (distance(from, to) < 6.0) {
+//		debug("Id: %d Distance: %f::Result -1", actorId, distance(from, to));
 		return -1;
 	}
 
@@ -427,9 +435,11 @@ int ActorWalk::nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, V
 		return 1;
 	}
 	if (_vm->_scene->_set->findWalkbox(to.x, to.z) == -1) {
+//		debug("Id: %d No walkbox::Result 0", actorId);
 		return 0;
 	}
 	if (_vm->_sceneObjects->existsOnXZ(actorId + kSceneObjectOffsetActors, to.x, to.z, false, false)) {
+//		debug("Actor Id: %d existsOnXZ::Result 0", actorId);
 		return 0;
 	}
 	Vector3 next1;
@@ -437,6 +447,7 @@ int ActorWalk::nextOnPath(int actorId, const Vector3 &from, const Vector3 &to, V
 		next = next1;
 		return 1;
 	}
+//	debug("Id: %d DEFAULTED::Result 0", actorId);
 	return 0;
 }
 
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index d19e221..354e899 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -1580,7 +1580,7 @@ bool Debugger::cmdList(int argc, const char **argv) {
 									 actor->getAnimationId(),
 									 actor->getPosition().x,
 									 actor->getPosition().y,
-									 _vm->_actors[sceneObject->id - kSceneObjectOffsetActors]->getPosition().z);
+									 actor->getPosition().z);
 						++count;
 					}
 				}
diff --git a/engines/bladerunner/scene_objects.cpp b/engines/bladerunner/scene_objects.cpp
index 5eace21..12e4e59 100644
--- a/engines/bladerunner/scene_objects.cpp
+++ b/engines/bladerunner/scene_objects.cpp
@@ -27,6 +27,8 @@
 #include "bladerunner/obstacles.h"
 #include "bladerunner/savefile.h"
 #include "bladerunner/view.h"
+//#include "bladerunner/scene.h"          // asdf to REMOVE
+//#include "bladerunner/game_constants.h" // asdf to REMOVE
 
 namespace BladeRunner {
 
@@ -144,9 +146,9 @@ bool SceneObjects::existsOnXZ(int exceptSceneObjectId, float x, float z, bool mo
 				if (sceneObject->isRetired) {
 					isObstacle = false;
 				} else if (sceneObject->isMoving) {
-					isObstacle = movingActorIsObstacle != 0;
+					isObstacle = movingActorIsObstacle;
 				} else {
-					isObstacle = standingActorIsObstacle != 0;
+					isObstacle = standingActorIsObstacle;
 				}
 			} else {
 				isObstacle = sceneObject->isObstacle;
@@ -156,6 +158,21 @@ bool SceneObjects::existsOnXZ(int exceptSceneObjectId, float x, float z, bool mo
 				float x1, y1, z1, x2, y2, z2;
 				sceneObject->boundingBox.getXYZ(&x1, &y1, &z1, &x2, &y2, &z2);
 				if (z1 <= zMax && z2 >= zMin && x1 <= xMax && x2 >= xMin) {
+//					if (sceneObject->type == kSceneObjectTypeObject) {
+//						Vector3 a(x1,y1,z1);
+//						Vector3 b(x2,y2,z2);
+//						Vector3 pos = _vm->_view->calculateScreenPosition(0.5 * (a + b));
+//						debug("%d: %s (Clk: %s, Trg: %s, Prs: %s, Obs: %s, Mvg: %s), Pos(%02.2f,%02.2f,%02.2f)\n     Bbox(%02.2f,%02.2f,%02.2f) ~ (%02.2f,%02.2f,%02.2f)\n",
+//								 sceneObject->id - kSceneObjectOffsetObjects,
+//								 _vm->_scene->objectGetName(sceneObject->id - kSceneObjectOffsetObjects).c_str(),
+//								 sceneObject->isClickable? "T" : "F",
+//								 sceneObject->isTarget?    "T" : "F",
+//								 sceneObject->isPresent?   "T" : "F",
+//								 sceneObject->isObstacle?  "T" : "F",
+//								 sceneObject->isMoving?    "T" : "F",
+//								 pos.x, pos.y, pos.z,
+//								 a.x, a.y, a.z, b.x, b.y, b.z);
+//					}
 					return true;
 				}
 			}
diff --git a/engines/bladerunner/script/ai/officer_grayford.cpp b/engines/bladerunner/script/ai/officer_grayford.cpp
index 82ae1b5..1dcbf72 100644
--- a/engines/bladerunner/script/ai/officer_grayford.cpp
+++ b/engines/bladerunner/script/ai/officer_grayford.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "bladerunner/script/ai_script.h"
+//#include "common/debug.h"
 namespace BladeRunner {
 
 AIScriptOfficerGrayford::AIScriptOfficerGrayford(BladeRunnerEngine *vm) : AIScriptBase(vm) {
@@ -112,6 +113,7 @@ bool AIScriptOfficerGrayford::Update() {
 		switch (Actor_Query_Which_Set_In(kActorOfficerGrayford)) {
 		case kSetRC03:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
+//				asdf restore
 				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 18, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
@@ -134,14 +136,14 @@ bool AIScriptOfficerGrayford::Update() {
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 10, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
-// asdf UG07 whould be a type 10 combat, 12 flee?
+// asdf missing UG07 case - would be a type 10 combat, 12 flee?
 		case kSetUG08:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerGrayford, kActorCombatStateIdle, true, kActorMcCoy, 13, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
-// asdf UG09 whould be a type ?? //
+// asdf missing UG09 case - would be a type ?? //
 
 		case kSetUG10:
 			if (Actor_Query_Which_Set_In(kActorOfficerGrayford) == Player_Query_Current_Set()) {
@@ -268,6 +270,7 @@ void AIScriptOfficerGrayford::CompletedMovementTrack() {
 		break;
 
 	case kGoalOfficerGrayfordHuntingAroundAct4:
+//		debug("Grayford completed Movement");
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordPrepareToHuntAroundAct4);
 		break;
 
@@ -326,9 +329,9 @@ void AIScriptOfficerGrayford::ClickedByPlayer() {
 		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true);
 		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);
 		if (Random_Query(1, 2) == 1) {
-			Actor_Says(kActorMcCoy, 5075, 14);
+			Actor_Says(kActorMcCoy, 5075, 14); // Hey, pal.
 		} else {
-			Actor_Says(kActorMcCoy, 5075, 14); // bug in the original? Matches the above statement
+			Actor_Says(kActorMcCoy, 5075, 14); // Hey, pal. TODO asdf bug in the original? Matches the above statement
 		}
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordWalksInPS03c);
 		break;
@@ -614,10 +617,13 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 		return true;
 
 	case kGoalOfficerGrayfordHuntingAroundAct4:
+//		debug("Flushing Grayford movement track");
 		AI_Movement_Track_Flush(kActorOfficerGrayford);
-		switch (Random_Query(1, 10)) {
+		switch (Random_Query(1, 10)) { // asdf restore
+//		switch (1) {
 		case 1:
 			// kSetNR01
+//			debug("gray 1 kSetNR01");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 398, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 399, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 400, 0);
@@ -631,6 +637,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 2:
 			// kSetCT11
+//			debug("gray 2 kSetCT11");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 386, 2);
@@ -641,6 +648,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 3:
 			// kSetDR01_DR02_DR04
+//			debug("gray 3 kSetDR01_DR02_DR04");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 390, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 391, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 392, 5);
@@ -652,6 +660,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 4:
 			// kSetRC03 -> kSetFreeSlotC
+//			debug("gray 4 kSetRC03 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 381, 15);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 382, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 383, 15);
@@ -664,6 +673,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 5:
 			// kSetBB01 -> kSetFreeSlotC
+//			debug("gray 5 kSetBB01 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 388, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 389, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
@@ -673,6 +683,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 6:
 			// kSetCT11 - identical to case 2
+//			debug("gray 6 kSetCT11");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 386, 2);
@@ -700,6 +711,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 			return true;
 #else
 		case 7:
+//			debug("gray 7 MA07 changed to kSetFreeSlotC");
 			// just put him away for a few seconds
 			AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerGrayford);
@@ -707,9 +719,11 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 #endif // BLADERUNNER_ORIGINAL_BUGS
 
 		case 8:
-			switch (Random_Query(1, 7)) {
+			switch (Random_Query(1, 7)) { // asdf restore
+//			switch (1) {
 			case 1:
 				// kSetUG10 -> kSetFreeSlotC
+//				debug("gray 8-1 kSetUG10 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 302, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 407, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 408, 0);
@@ -719,6 +733,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 2:
 				// kSetUG14
+//				debug("gray 8-2 kSetUG14");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 536, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 537, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 538, 5);
@@ -729,6 +744,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 3:
 				// kSetUG04 -> kSetFreeSlotC
+//				debug("gray 8-3  kSetUG04 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 296, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 409, 2);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 296, 10);
@@ -738,6 +754,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 4:
 				// kSetUG05 -> kSetFreeSlotC
+//				debug("gray 8-4 kSetUG05 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 411, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 412, 5);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 411, 0);
@@ -747,6 +764,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 5:
 				// kSetUG06 -> kSetFreeSlotC
+//				debug("gray 8-5 kSetUG06 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 413, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 414, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 431, 0, 1017);
@@ -757,6 +775,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 6:
 				// kSetUG07 -> kSetFreeSlotC
+//				debug("gray 8-6 kSetUG07 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 415, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerGrayford, 416, 0, 620);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 417, 0);
@@ -767,6 +786,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 			case 7:
 				// kSetUG01 -> kSetFreeSlotC
+//				debug("gray 8-7 kSetUG01 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 405, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 406, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 35, 30); // kSetFreeSlotC
@@ -781,8 +801,10 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 			return false; // does it matter if false or true? case 9 and 10 return false
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		case 9:
-			if (Random_Query(0, 1)) {
+			if (Random_Query(0, 1)) { // asdf restore
+//			if (1) {
 				// kSetUG09 -> kSetFreeSlotC
+//				debug("gray 9-1 kSetUG09 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 433, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 434, 0);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 435, 0);
@@ -790,6 +812,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 				AI_Movement_Track_Repeat(kActorOfficerGrayford);
 			} else {
 				// kSetUG08 -> kSetFreeSlotC
+//				debug("gray 9-0 kSetUG08 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerGrayford, 420, 10);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 422, 2);
 				AI_Movement_Track_Append(kActorOfficerGrayford, 421, 1);
@@ -811,6 +834,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 
 		case 10:
 			// kSetUG12 -> kSetFreeSlotC
+//			debug("gray 10 kSetUG12 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerGrayford, 310, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 307, 0);
 			AI_Movement_Track_Append(kActorOfficerGrayford, 309, 0);
@@ -825,6 +849,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb
 	case kGoalOfficerGrayfordPrepareToHuntAroundAct4:
 		// aux goal in order to immediately switch back to kGoalOfficerGrayfordHuntingAroundAct4 goal
 		// and run GoalChanged() for kGoalOfficerGrayfordHuntingAroundAct4 again
+//		debug("Setting Grayford goal to kGoalOfficerGrayfordHuntingAroundAct4");
 		Actor_Set_Goal_Number(kActorOfficerGrayford, kGoalOfficerGrayfordHuntingAroundAct4);
 		return true;
 
@@ -1508,6 +1533,7 @@ void AIScriptOfficerGrayford::SetAnimationState(int animationState, int animatio
 }
 
 bool AIScriptOfficerGrayford::ReachedMovementTrackWaypoint(int waypointId) {
+//	debug("Grayford reached waypoint: %d", waypointId);
 	return true;
 }
 
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index 11c3b7c..169e5b4 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "bladerunner/script/ai_script.h"
+//#include "common/debug.h"
 
 namespace BladeRunner {
 
@@ -121,6 +122,7 @@ bool AIScriptOfficerLeary::Update() {
 		switch (Actor_Query_Which_Set_In(kActorOfficerLeary)) {
 		case kSetDR01_DR02_DR04:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
+//				asdf restore
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 0, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
@@ -169,12 +171,14 @@ bool AIScriptOfficerLeary::Update() {
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 10, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
+// asdf Missing UG07 case -  would be a type 10 combat, 12 flee?
 		case kSetUG08:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
 				Non_Player_Actor_Combat_Mode_On(kActorOfficerLeary, kActorCombatStateIdle, true, kActorMcCoy, 13, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, -1, -1, -1, 10, 300, false);
 			}
 			break;
+// asdf Missing UG09 case -  would be a type ?? //
 		case kSetUG10:
 			if (Actor_Query_Which_Set_In(kActorOfficerLeary) == Player_Query_Current_Set()) {
 				Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyAttackMcCoyAct4);
@@ -233,6 +237,7 @@ void AIScriptOfficerLeary::CompletedMovementTrack() {
 		return;
 	}
 	if (goal == kGoalOfficerLearyHuntingAroundAct4) {
+//		debug("Leary completed Movement");
 		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyPrepareToHuntAroundAct4);
 		return;
 	}
@@ -378,10 +383,13 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return true;
 	case kGoalOfficerLearyHuntingAroundAct4:
+//		debug("Flushing Leary movement track");
 		AI_Movement_Track_Flush(kActorOfficerLeary);
-		switch (Random_Query(1, 10)) {
+		switch (Random_Query(1, 10)) { // asdf restore
+//		switch (1) {
 		case 1:
 			// kSetNR01
+//			debug("leary 1 kSetNR01");
 			AI_Movement_Track_Append(kActorOfficerLeary, 398, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 399, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 400, 0);
@@ -393,6 +401,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 		case 2:
 			// kSetCT11
+//			debug("leary 2 kSetCT11");
 			AI_Movement_Track_Append(kActorOfficerLeary, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 386, 2);
@@ -401,6 +410,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 		case 3:
 			// kSetDR01_DR02_DR04
+//			debug("leary 3 kSetDR01_DR02_DR04");
 			AI_Movement_Track_Append(kActorOfficerLeary, 390, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 391, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 392, 5);
@@ -410,6 +420,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 		case 4:
 			// kSetRC03 -> kSetFreeSlotC
+//			debug("leary 4 kSetRC03 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerLeary, 381, 15);
 			AI_Movement_Track_Append(kActorOfficerLeary, 382, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 383, 15);
@@ -420,6 +431,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 		case 5:
 			// kSetBB01 -> kSetFreeSlotC
+//			debug("leary 5 kSetBB01 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerLeary, 388, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 389, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
@@ -427,6 +439,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 		case 6:
 			// kSetCT11 - identical to case 2
+//			debug("leary 6 kSetCT11 - identical to case 2");
 			AI_Movement_Track_Append(kActorOfficerLeary, 385, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 242, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 386, 2);
@@ -452,15 +465,18 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 #else
 		case 7:
 			// kSetFreeSlotC
+//			debug("leary 7 MA07 changed to kSetFreeSlotC");
 			// just put him away for a few seconds
 			AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
 			AI_Movement_Track_Repeat(kActorOfficerLeary);
 			break;
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		case 8:
-			switch (Random_Query(1, 7)) {
+			switch (Random_Query(1, 7)) { // asdf restore
+//			switch (1) {
 			case 1:
 				// kSetUG10 -> kSetFreeSlotC
+//				debug("leary 8-1  kSetUG10 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 302, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 407, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 408, 0);
@@ -469,6 +485,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 2:
 				// kSetUG14
+//				debug("leary 8-2 kSetUG14");
 				AI_Movement_Track_Append(kActorOfficerLeary, 536, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 537, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 538, 1);
@@ -478,6 +495,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 3:
 				// kSetUG04 -> kSetFreeSlotC
+//				debug("leary 8-3 kSetUG04 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 296, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 409, 2);
 				AI_Movement_Track_Append(kActorOfficerLeary, 296, 10);
@@ -486,6 +504,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 4:
 				// kSetUG05 -> kSetFreeSlotC
+//				debug("leary 8-4 kSetUG05 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 411, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 412, 5);
 				AI_Movement_Track_Append(kActorOfficerLeary, 411, 0);
@@ -494,6 +513,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 5:
 				// kSetUG06 -> kSetFreeSlotC
+//				debug("leary 8-5 kSetUG06 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 413, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 414, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 431, 0, 1017);
@@ -503,6 +523,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 6:
 				// kSetUG07 -> kSetFreeSlotC
+//				debug("leary 8-6 kSetUG07 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 415, 0);
 				AI_Movement_Track_Append_With_Facing(kActorOfficerLeary, 416, 0, 620);
 				AI_Movement_Track_Append(kActorOfficerLeary, 417, 0);
@@ -512,6 +533,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				break;
 			case 7:
 				// kSetUG01 -> kSetFreeSlotC
+//				debug("leary 8-7 kSetUG01 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 405, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 406, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 35, 30); // kSetFreeSlotC
@@ -526,8 +548,10 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 			break;
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		case 9:
-			if (Random_Query(1, 2) == 2) {
+			if (Random_Query(1, 2) == 2) { // asdf restore
+//			if (1) {
 				// kSetUG09 -> kSetFreeSlotC
+//				debug("leary 9-2 kSetUG09 -> kSetFreeSlotC");
 				AI_Movement_Track_Append(kActorOfficerLeary, 433, 10);
 				AI_Movement_Track_Append(kActorOfficerLeary, 434, 0);
 				AI_Movement_Track_Append(kActorOfficerLeary, 435, 0);
@@ -536,6 +560,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 				return false;
 			}
 			// kSetUG08 -> kSetFreeSlotC
+//			debug("leary 9-1 kSetUG08 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerLeary, 420, 10);
 			AI_Movement_Track_Append(kActorOfficerLeary, 422, 2);
 			AI_Movement_Track_Append(kActorOfficerLeary, 421, 1);
@@ -550,6 +575,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		case 10:
 			// kSetUG12 -> kSetFreeSlotC
+//			debug("leary 10 kSetUG12 -> kSetFreeSlotC");
 			AI_Movement_Track_Append(kActorOfficerLeary, 310, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 307, 0);
 			AI_Movement_Track_Append(kActorOfficerLeary, 309, 0);
@@ -568,6 +594,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)
 	case kGoalOfficerLearyPrepareToHuntAroundAct4:
 		// aux goal in order to immediately switch back to kGoalOfficerLearyHuntingAroundAct4 goal
 		// and run GoalChanged() for kGoalOfficerLearyHuntingAroundAct4 again
+//		debug("Setting Leary goal to kGoalOfficerLearyHuntingAroundAct4");
 		Actor_Set_Goal_Number(kActorOfficerLeary, kGoalOfficerLearyHuntingAroundAct4);
 		return true;
 	case kGoalOfficerLearyBlockingUG07:
@@ -1296,6 +1323,7 @@ void AIScriptOfficerLeary::SetAnimationState(int animationState, int animationFr
 }
 
 bool AIScriptOfficerLeary::ReachedMovementTrackWaypoint(int waypointId) {
+//	debug("Leary reached waypoint: %d", waypointId);
 	if (waypointId == 57 || waypointId == 58) {
 		// Interrogating crowd in kSetRC01
 		Game_Flag_Set(kFlagOfficerLearyTakingNotes);
diff --git a/engines/bladerunner/script/scene/ct11.cpp b/engines/bladerunner/script/scene/ct11.cpp
index 2ea639f..8910e92 100644
--- a/engines/bladerunner/script/scene/ct11.cpp
+++ b/engines/bladerunner/script/scene/ct11.cpp
@@ -85,6 +85,11 @@ void SceneScriptCT11::SceneLoaded() {
 		Unobstacle_Object("RIM RF", true);
 		Unobstacle_Object("DOOR RIGHT", true);
 		Unobstacle_Object("BUMPER REAR", true);
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+		// this street sign blocks police officers from moving to waypoint 386 after they reach waypoint 242
+		Unobstacle_Object("STREET SIGN", true);
+#endif // BLADERUNNER_ORIGINAL_BUGS
 	}
 	Unclickable_Object("TRASH CAN");
 }





More information about the Scummvm-git-logs mailing list