diff options
| author | Peter Kohaut | 2019-01-24 22:57:41 +0100 | 
|---|---|---|
| committer | Peter Kohaut | 2019-01-24 23:05:13 +0100 | 
| commit | 2cc09b6b1097007b6eeac12882c03475e56e1be0 (patch) | |
| tree | 777e076f39c4c7dd246342cfe15b3321076b8c6b /engines/bladerunner/script/ai | |
| parent | 2fd29c5193a0b9e6d3920f0512ce3ca37b00bf7e (diff) | |
| download | scummvm-rg350-2cc09b6b1097007b6eeac12882c03475e56e1be0.tar.gz scummvm-rg350-2cc09b6b1097007b6eeac12882c03475e56e1be0.tar.bz2 scummvm-rg350-2cc09b6b1097007b6eeac12882c03475e56e1be0.zip  | |
BLADERUNNER: Fixes for game scripts & cleanup
Diffstat (limited to 'engines/bladerunner/script/ai')
23 files changed, 828 insertions, 459 deletions
diff --git a/engines/bladerunner/script/ai/clovis.cpp b/engines/bladerunner/script/ai/clovis.cpp index d5043280a1..6f4d0bfd3d 100644 --- a/engines/bladerunner/script/ai/clovis.cpp +++ b/engines/bladerunner/script/ai/clovis.cpp @@ -282,7 +282,7 @@ bool AIScriptClovis::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_Goal_Number(kActorSadik, 200);  		Actor_Clue_Acquire(kActorMcCoy, kClueAct2Ended, true, -1);  		Player_Gains_Control(); -		Chapter_Enter(3, 6, 20); +		Chapter_Enter(3, kSetCT08_CT51_UG12, kSceneCT08);  		Game_Flag_Set(550);  		Game_Flag_Set(679);  		return true; diff --git a/engines/bladerunner/script/ai/dektora.cpp b/engines/bladerunner/script/ai/dektora.cpp index e6203132e7..c7c6341b72 100644 --- a/engines/bladerunner/script/ai/dektora.cpp +++ b/engines/bladerunner/script/ai/dektora.cpp @@ -38,94 +38,94 @@ void AIScriptDektora::Initialize() {  	_flag = false;  	_x = _y = _z = 0.0f; -	Actor_Set_Goal_Number(kActorDektora, 0); +	Actor_Set_Goal_Number(kActorDektora, kGoalDektoraDefault);  }  bool AIScriptDektora::Update() { -	int chapter = Global_Variable_Query(kVariableChapter) - 2; - -	if (chapter > 2) +	int chapter = Global_Variable_Query(kVariableChapter); + +	if (chapter == 2) { +		if (!Game_Flag_Query(kFlagDektoraChapter2Started)) { +			Game_Flag_Set(kFlagDektoraChapter2Started); +			Actor_Put_In_Set(kActorDektora, kSetFreeSlotG); +			Actor_Set_At_Waypoint(kActorDektora, 39, 0); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround); +		} else { +			if ( Game_Flag_Query(kFlagAR02DektoraWillBuyScorpions) +			 && !Game_Flag_Query(kFlagAR02DektoraBoughtScorpions) +			 &&  Player_Query_Current_Scene() != kSceneAR01 +			 &&  Player_Query_Current_Scene() != kSceneAR02 +			) { +				if (Game_Flag_Query(kFlagAR02Entered)) { +					Item_Remove_From_World(kItemScrorpions); +				} +				Game_Flag_Set(kFlagAR02DektoraBoughtScorpions); +			} +		}  		return true; +	} -	if (chapter) { -		if (chapter == 1) { -			if (Actor_Query_Goal_Number(kActorDektora) < 199) { -				Actor_Set_Goal_Number(kActorDektora, 199); -			} else { -				switch (Actor_Query_Goal_Number(kActorDektora)) { -				case 269: -					Actor_Set_Goal_Number(kActorDektora, 270); -					return 1; - -				case 270: -				case 272: -				case 274: -					return 1; - -				case 271: -					if (Actor_Query_Inch_Distance_From_Actor(kActorDektora, kActorMcCoy) <= 48) { -						Actor_Set_Goal_Number(kActorDektora, 279); -						return 1; -					} - -					if (comp_distance(kActorMcCoy, _x, _y, _z) > 12.0f) { -						Actor_Query_XYZ(kActorMcCoy, &_x, &_y, &_z); -						Async_Actor_Walk_To_XYZ(kActorDektora, _x, _y, _z, 36, 0); -					} -					break; +	if (chapter == 3) { +		if (Actor_Query_Goal_Number(kActorDektora) < 199) { +			Actor_Set_Goal_Number(kActorDektora, 199); +		} else { +			switch (Actor_Query_Goal_Number(kActorDektora)) { +			case 269: +				Actor_Set_Goal_Number(kActorDektora, 270); +				break; -				case 273: -					Actor_Set_Goal_Number(kActorDektora, 274); -					return 1; +			case 271: +				if (Actor_Query_Inch_Distance_From_Actor(kActorDektora, kActorMcCoy) <= 48) { +					Actor_Set_Goal_Number(kActorDektora, 279); +					break; +				} -				case 275: -					Actor_Set_Goal_Number(kActorDektora, 276); -					return 1; +				if (comp_distance(kActorMcCoy, _x, _y, _z) > 12.0f) { +					Actor_Query_XYZ(kActorMcCoy, &_x, &_y, &_z); +					Async_Actor_Walk_To_XYZ(kActorDektora, _x, _y, _z, 36, 0);  				} +				break; + +			case 273: +				Actor_Set_Goal_Number(kActorDektora, 274); +				break; + +			case 275: +				Actor_Set_Goal_Number(kActorDektora, 276); +				break;  			} -		} else if (Actor_Query_Goal_Number(kActorDektora) < 300) { -			Actor_Set_Goal_Number(kActorDektora, 300);  		} -	} else if (Game_Flag_Query(489)) { -		if ( Game_Flag_Query(504) == 1 -		 && !Game_Flag_Query(374) -		 &&  Player_Query_Current_Scene() -		 &&  Player_Query_Current_Scene() != 1 -		) { -			if (Game_Flag_Query(kFlagAR02Entered)) { -				Item_Remove_From_World(kItemScrorpions); -			} -			Game_Flag_Set(374); +		return true; +	} + +	if (chapter == 4) { +		if (Actor_Query_Goal_Number(kActorDektora) < 300) { +			Actor_Set_Goal_Number(kActorDektora, 300);  		} -	} else { -		Game_Flag_Set(489); -		Actor_Put_In_Set(kActorDektora, kSetFreeSlotG); -		Actor_Set_At_Waypoint(kActorDektora, 39, 0); -		Actor_Set_Goal_Number(kActorDektora, 100); +		return true;  	}  	return true;  }  void AIScriptDektora::TimerExpired(int timer) { -	if (timer) -		return; //false; +	if (timer == 0) { +		if (Actor_Query_Goal_Number(kActorDektora) == 210) { +			if (Player_Query_Current_Scene() == 61) { +				AI_Countdown_Timer_Reset(kActorDektora, 0); +				AI_Countdown_Timer_Start(kActorDektora, 0, 10); +			} else { +				Actor_Set_Goal_Number(kActorDektora, 211); +				AI_Countdown_Timer_Reset(kActorDektora, 0); +			} +			return; //true; +		} -	if (Actor_Query_Goal_Number(kActorDektora) == 210) { -		if (Player_Query_Current_Scene() == 61) { -			AI_Countdown_Timer_Reset(kActorDektora, 0); -			AI_Countdown_Timer_Start(kActorDektora, 0, 10); -		} else { -			Actor_Set_Goal_Number(kActorDektora, 211); +		if (Actor_Query_Goal_Number(kActorDektora) == 270) {  			AI_Countdown_Timer_Reset(kActorDektora, 0); +			Actor_Set_Goal_Number(kActorDektora, 271); +			return; //true;  		} -		return; //true; -	} - -	if (Actor_Query_Goal_Number(kActorDektora) == 270) { -		AI_Countdown_Timer_Reset(kActorDektora, 0); -		Actor_Set_Goal_Number(kActorDektora, 271); -		return; //true;  	}  	return; //false; @@ -133,34 +133,35 @@ void AIScriptDektora::TimerExpired(int timer) {  void AIScriptDektora::CompletedMovementTrack() {  	switch (Actor_Query_Goal_Number(kActorDektora)) { -	case 100: -		if (Game_Flag_Query(47) == 1) { -			Actor_Set_Goal_Number(kActorDektora, 101); +	case kGoalDektoraStartWalkingAround: +		if (Game_Flag_Query(kFlagDektoraIsReplicant)) { +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraWalkAroundAsReplicant);  		} else { -			Actor_Set_Goal_Number(kActorDektora, 102); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraWalkAroundAsHuman);  		}  		break; - -	case 101: +	case kGoalDektoraWalkAroundAsReplicant:  		if (Random_Query(1, 7) == 1 -				&& Actor_Query_Goal_Number(kActorEarlyQ) != 1 -				&& Actor_Query_Goal_Number(kActorEarlyQ) != 101) { -			Game_Flag_Set(504); -			Actor_Set_Goal_Number(kActorDektora, 100); +		 && Actor_Query_Goal_Number(kActorEarlyQ) != 1 +		 && Actor_Query_Goal_Number(kActorEarlyQ) != 101 +		) { +			Game_Flag_Set(kFlagAR02DektoraWillBuyScorpions); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);  		} else { -			Actor_Set_Goal_Number(kActorDektora, 100); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);  		}  		break; -	case 102: +	case kGoalDektoraWalkAroundAsHuman:  		if (Random_Query(1, 5) == 1 -				&& Actor_Query_Goal_Number(kActorEarlyQ) != 1 -				&& Actor_Query_Goal_Number(kActorEarlyQ) != 101) { -			Game_Flag_Set(504); -			Actor_Set_Goal_Number(kActorDektora, 100); +		 && Actor_Query_Goal_Number(kActorEarlyQ) != 1 +		 && Actor_Query_Goal_Number(kActorEarlyQ) != 101 +		) { +			Game_Flag_Set(kFlagAR02DektoraWillBuyScorpions); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);  		} else { -			Actor_Set_Goal_Number(kActorDektora, 100); +			Actor_Set_Goal_Number(kActorDektora, kGoalDektoraStartWalkingAround);  		}  		break; @@ -191,14 +192,14 @@ void AIScriptDektora::ReceivedClue(int clueId, int fromActorId) {  void AIScriptDektora::ClickedByPlayer() {  	if (Actor_Query_Goal_Number(kActorDektora) == 599) { -		Actor_Face_Actor(0, kActorDektora, 1); +		Actor_Face_Actor(0, kActorDektora, true);  		Actor_Says(kActorMcCoy, 8630, 12);  		return; //true;  	}  	if (Actor_Query_Goal_Number(kActorDektora) < 199) { -		Actor_Face_Actor(kActorMcCoy, kActorDektora, 1); +		Actor_Face_Actor(kActorMcCoy, kActorDektora, true);  		Actor_Says(kActorMcCoy, 8590, 13);  	} @@ -220,7 +221,9 @@ void AIScriptDektora::EnteredScene(int sceneId) {  }  void AIScriptDektora::OtherAgentEnteredThisScene(int otherActorId) { -	if (!otherActorId && Actor_Query_Goal_Number(kActorDektora) == 246) { +	if (otherActorId == kActorMcCoy +	 && Actor_Query_Goal_Number(kActorDektora) == 246 +	) {  		Scene_Exits_Disable();  		Actor_Change_Animation_Mode(kActorDektora, 23);  	} @@ -243,8 +246,9 @@ void AIScriptDektora::ShotAtAndMissed() {  bool AIScriptDektora::ShotAtAndHit() {  	if (Actor_Query_Goal_Number(kActorDektora) == 270 -			|| Actor_Query_Goal_Number(kActorDektora) == 271 -			|| Actor_Query_Goal_Number(kActorDektora) == 272) { +	 || Actor_Query_Goal_Number(kActorDektora) == 271 +	 || Actor_Query_Goal_Number(kActorDektora) == 272 +	) {  		Actor_Set_Health(kActorDektora, 100, 100);  		if (Actor_Query_Goal_Number(kActorDektora) != 272) { @@ -252,6 +256,7 @@ bool AIScriptDektora::ShotAtAndHit() {  		}  		return true;  	} +  	if (Actor_Query_Goal_Number(kActorDektora) == 260) {  		AI_Movement_Track_Flush(kActorDektora);  		Actor_Set_Health(kActorDektora, 0, 100); @@ -276,11 +281,14 @@ bool AIScriptDektora::ShotAtAndHit() {  }  void AIScriptDektora::Retired(int byActorId) { -	if (!byActorId) { +	if (byActorId == kActorMcCoy) {  		Actor_Modify_Friendliness_To_Other(kActorClovis, 0, -5);  	} -	if (byActorId == kActorSteele && Actor_Query_In_Set(kActorSteele, kSetHF06) && Actor_Query_In_Set(kActorMcCoy, kSetHF06)) { +	if (byActorId == kActorSteele +	 && Actor_Query_In_Set(kActorSteele, kSetHF06) +	 && Actor_Query_In_Set(kActorMcCoy, kSetHF06) +	) {  		Non_Player_Actor_Combat_Mode_On(kActorSteele, kActorCombatStateUncover, true, kActorMcCoy, 15, kAnimationModeCombatIdle, kAnimationModeCombatWalk, kAnimationModeCombatRun, 0, 0, 100, 25, 300, false);  	} @@ -317,6 +325,83 @@ int AIScriptDektora::GetFriendlinessModifierIfGetsClue(int otherActorId, int clu  bool AIScriptDektora::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	switch (newGoalNumber) { +	case kGoalDektoraStartWalkingAround: +		AI_Movement_Track_Flush(kActorDektora); +		AI_Movement_Track_Append(kActorDektora, 39, 10); +		AI_Movement_Track_Repeat(kActorDektora); +		break; + +	case kGoalDektoraWalkAroundAsReplicant: +		AI_Movement_Track_Flush(kActorDektora); +		AI_Movement_Track_Append_With_Facing(kActorDektora, 287, 15, 278); + +		if (Game_Flag_Query(kFlagZubenRetired)) { +			AI_Movement_Track_Append(kActorDektora, 33, 240); +		} else if (Game_Flag_Query(kFlagZubenSpared)) { +			AI_Movement_Track_Append(kActorDektora, 33, 120); +		} else { +			AI_Movement_Track_Append(kActorDektora, 33, 90); +		} + +		AI_Movement_Track_Append_With_Facing(kActorDektora, 288, 35, 528); + +		if (Random_Query(1, 2) == 1 +		 && Game_Flag_Query(kFlagAR02DektoraWillBuyScorpions) +		) { +			AI_Movement_Track_Append(kActorDektora, 289, 0); +			AI_Movement_Track_Append_With_Facing(kActorDektora, 290, 2, 979); +			AI_Movement_Track_Append(kActorDektora, 289, 0); +			AI_Movement_Track_Append(kActorDektora, 39, 120); +		} else { +			AI_Movement_Track_Append(kActorDektora, 39, 180); +		} + +		AI_Movement_Track_Append(kActorDektora, 282, 0); +		AI_Movement_Track_Append(kActorDektora, 283, 0); +		AI_Movement_Track_Append(kActorDektora, 284, 0); +		AI_Movement_Track_Append(kActorDektora, 285, 0); +		AI_Movement_Track_Append_With_Facing(kActorDektora, 286, 30, 329); +		AI_Movement_Track_Repeat(kActorDektora); +		break; + +	case kGoalDektoraWalkAroundAsHuman: +		AI_Movement_Track_Flush(kActorDektora); +		AI_Movement_Track_Append_With_Facing(kActorDektora, 287, 15, 278); +		AI_Movement_Track_Append(kActorDektora, 40, 90); + +		if (Game_Flag_Query(kFlagZubenRetired) +		 && Game_Flag_Query(kFlagLucyIsReplicant) +		) { +			AI_Movement_Track_Append(kActorDektora, 33, 180); +		} else { +			AI_Movement_Track_Append(kActorDektora, 33, 160); +		} + +		AI_Movement_Track_Append_With_Facing(kActorDektora, 288, 20, 528); + +		if (Random_Query(1, 2) == 1) { +			AI_Movement_Track_Append(kActorDektora, 289, 0); +			AI_Movement_Track_Append_With_Facing(kActorDektora, 290, 3, 979); +			AI_Movement_Track_Append(kActorDektora, 289, 0); +			AI_Movement_Track_Append(kActorDektora, 39, 120); +		} else { +			AI_Movement_Track_Append(kActorDektora, 39, 180); +		} + +		AI_Movement_Track_Append(kActorDektora, 282, 0); +		AI_Movement_Track_Append(kActorDektora, 283, 0); +		AI_Movement_Track_Append(kActorDektora, 284, 0); +		AI_Movement_Track_Append(kActorDektora, 285, 0); +		AI_Movement_Track_Append_With_Facing(kActorDektora, 286, 35, 329); +		AI_Movement_Track_Repeat(kActorDektora); +		break; + +	case kGoalDektoraStopWalkingAround: +		AI_Movement_Track_Flush(kActorDektora); +		AI_Movement_Track_Append(kActorDektora, 39, 240); +		AI_Movement_Track_Repeat(kActorDektora); +		break; +  	case 199:  		AI_Movement_Track_Flush(kActorDektora);  		Actor_Set_Goal_Number(kActorDektora, 200); @@ -451,79 +536,6 @@ bool AIScriptDektora::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_At_Waypoint(kActorDektora, 33, 0);  		break; -	case 100: -		AI_Movement_Track_Flush(kActorDektora); -		AI_Movement_Track_Append(kActorDektora, 39, 10); -		AI_Movement_Track_Repeat(kActorDektora); -		break; - -	case 101: -		AI_Movement_Track_Flush(kActorDektora); -		AI_Movement_Track_Append_With_Facing(kActorDektora, 287, 15, 278); - -		if (Game_Flag_Query(40) == 1) { -			AI_Movement_Track_Append(kActorDektora, 33, 240); -		} else if (Game_Flag_Query(41) == 1) { -			AI_Movement_Track_Append(kActorDektora, 33, 120); -		} else { -			AI_Movement_Track_Append(kActorDektora, 33, 90); -		} - -		AI_Movement_Track_Append_With_Facing(kActorDektora, 288, 35, 528); - -		if (Random_Query(1, 2) == 1 && Game_Flag_Query(504)) { -			AI_Movement_Track_Append(kActorDektora, 289, 0); -			AI_Movement_Track_Append_With_Facing(kActorDektora, 290, 2, 979); -			AI_Movement_Track_Append(kActorDektora, 289, 0); -			AI_Movement_Track_Append(kActorDektora, 39, 120); -		} else { -			AI_Movement_Track_Append(kActorDektora, 39, 180); -		} - -		AI_Movement_Track_Append(kActorDektora, 282, 0); -		AI_Movement_Track_Append(kActorDektora, 283, 0); -		AI_Movement_Track_Append(kActorDektora, 284, 0); -		AI_Movement_Track_Append(kActorDektora, 285, 0); -		AI_Movement_Track_Append_With_Facing(kActorDektora, 286, 30, 329); -		AI_Movement_Track_Repeat(kActorDektora); -		break; - -	case 102: -		AI_Movement_Track_Flush(kActorDektora); -		AI_Movement_Track_Append_With_Facing(kActorDektora, 287, 15, 278); -		AI_Movement_Track_Append(kActorDektora, 40, 90); - -		if (Game_Flag_Query(40) == 1 && Game_Flag_Query(46) == 1) { -			AI_Movement_Track_Append(kActorDektora, 33, 180); -		} else { -			AI_Movement_Track_Append(kActorDektora, 33, 160); -		} - -		AI_Movement_Track_Append_With_Facing(kActorDektora, 288, 20, 528); - -		if (Random_Query(1, 2) == 1) { -			AI_Movement_Track_Append(kActorDektora, 289, 0); -			AI_Movement_Track_Append_With_Facing(kActorDektora, 290, 3, 979); -			AI_Movement_Track_Append(kActorDektora, 289, 0); -			AI_Movement_Track_Append(kActorDektora, 39, 120); -		} else { -			AI_Movement_Track_Append(kActorDektora, 39, 180); -		} - -		AI_Movement_Track_Append(kActorDektora, 282, 0); -		AI_Movement_Track_Append(kActorDektora, 283, 0); -		AI_Movement_Track_Append(kActorDektora, 284, 0); -		AI_Movement_Track_Append(kActorDektora, 285, 0); -		AI_Movement_Track_Append_With_Facing(kActorDektora, 286, 35, 329); -		AI_Movement_Track_Repeat(kActorDektora); -		break; - -	case 103: -		AI_Movement_Track_Flush(kActorDektora); -		AI_Movement_Track_Append(kActorDektora, 39, 240); -		AI_Movement_Track_Repeat(kActorDektora); -		break; -  	default:  		return false; @@ -1058,6 +1070,300 @@ bool AIScriptDektora::UpdateAnimation(int *animation, int *frame) {  }  bool AIScriptDektora::ChangeAnimationMode(int mode) { +	switch (mode) { +	case kAnimationModeIdle: +		if (Game_Flag_Query(633)) { +			_animationState = 32; +			_animationFrame = 0; +			break; +		} +		switch (_animationState) { +		case 2: +		case 3: +		case 4: +		case 5: +		case 6: +		case 7: +		case 8: +		case 27: +		case 28: +			_flag = true; +			break; +		case 9: +		case 10: +		case 12: +		case 13: +		case 14: +		case 15: +		case 16: +		case 17: +			_animationState = 11; +			_animationFrame = 0; +			break; +		case 11: +		case 18: +		case 19: +		case 20: +		case 26: +		case 29: +		case 30: +			break; +		case 25: +			_animationState = 25; +			_animationFrame = 0; +			break; +		case 31: +			_animationState = 31; +			_animationFrame = 0; +			break; +		default: +			_animationState = 0; +			_animationFrame = 0; +			break; +		} +		break; + +	case kAnimationModeWalk: +		if (!Game_Flag_Query(633)) { +			_animationFrame = 0; +			_animationState = 21; +		} else { +			_animationState = 33; +			_animationFrame = 0; +		} +		break; + +	case kAnimationModeRun: +		_animationFrame = 0; +		_animationState = 22; +		break; + +	case kAnimationModeTalk: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 2; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case kAnimationModeCombatIdle: +		switch (_animationState) { +		case 9: +		case 10: +		case 16: +		case 17: +			break; +		case 25: +		case 27: +		case 28: +			_animationState = 29; +			_animationFrame = 0; +			break; +		case 31: +			_animationState = 30; +			_animationFrame = Slice_Animation_Query_Number_Of_Frames(154) - 1; +			break; +		default: +			_animationState = 10; +			_animationFrame = 0; +			break; +		} +		break; + +	case kAnimationModeCombatAttack: +		if (_animationState == 31) { +			_animationState = 26; +		} else if (Random_Query(0, 1) == 1) { +			_animationState = 16; +		} else { +			_animationState = 17; +		} +		_animationFrame = 0; +		break; + +	case kAnimationModeCombatWalk: +		if (!Game_Flag_Query(633)) { +			_animationFrame = 0; +			_animationState = 21; +		} else { +			_animationState = 33; +			_animationFrame = 0; +		} +		break; + +	case kAnimationModeCombatRun: +		_animationFrame = 0; +		_animationState = 22; +		break; + +	case 12: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 3; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 13: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 4; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 14: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 5; +			_animationFrame = 0; +			_flag = 0; +		} +		break; + +	case 15: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 6; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 16: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 7; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 17: +		if (_animationState < 2 +		 || _animationState > 8 +		) { +			_animationState = 8; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 21: +		if (Game_Flag_Query(633)) { +			_animationState = 34; +			_animationFrame = 0; +			break; +		} +		switch (_animationState) { +		case 9: +		case 10: +		case 11: +		case 12: +		case 13: +		case 16: +		case 17: +			if (Random_Query(0, 1) == 1) { +				_animationState = 14; +			} else { +				_animationState = 15; +			} +			break; +		case 14: +		case 15: +			if (Random_Query(0, 1) == 1) { +				_animationState = 18; +			} else { +				_animationState = 19; +			} +			break; +		} +		_animationFrame = 0; +		break; + +	case 23: +		_animationState = 41; +		_animationFrame = 0; +		break; + +	case 30: +		if (_animationState != 27 +		 && _animationState != 28 +		) { +			_animationState = 27; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case 31: +		if (_animationState != 27 +		 && _animationState != 28 +		) { +			_animationState = 28; +			_animationFrame = 0; +			_flag = false; +		} +		break; + +	case kAnimationModeWalkUp: +		_animationFrame = 0; +		_animationState = 23; +		break; + +	case kAnimationModeWalkDown: +		_animationFrame = 0; +		_animationState = 24; +		break; + +	case kAnimationModeDie: +		_animationState = 20; +		_animationFrame = 0; +		break; + +	case 53: +		switch (_animationState) { +		case 26: +		case 29: +		case 30: +		case 31: +			break; +		case 27: +		case 28: +			_flag = true; +			break; +		default: +			_animationState = 25; +			_animationFrame = 0; +			break; +		} +		break; + +	case 70: +		_animationState = 17; +		_animationFrame = 0; +		break; + +	case 71: +		_animationState = 16; +		_animationFrame = 0; +		break; + +	case 79: +		_animationState = 37; +		_animationFrame = 0; +		break; +	} +  	return true;  } diff --git a/engines/bladerunner/script/ai/early_q.cpp b/engines/bladerunner/script/ai/early_q.cpp index 104ebdaf49..40cd1b2722 100644 --- a/engines/bladerunner/script/ai/early_q.cpp +++ b/engines/bladerunner/script/ai/early_q.cpp @@ -330,7 +330,7 @@ bool AIScriptEarlyQ::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		break;  	case 208: -		if (Game_Flag_Query(374) == 1) { +		if (Game_Flag_Query(kFlagAR02DektoraBoughtScorpions)) {  			Actor_Set_Goal_Number(kActorEarlyQ, 210);  		} else {  			Actor_Set_Goal_Number(kActorEarlyQ, 209); diff --git a/engines/bladerunner/script/ai/gaff.cpp b/engines/bladerunner/script/ai/gaff.cpp index 6eaa5b979e..1706062d20 100644 --- a/engines/bladerunner/script/ai/gaff.cpp +++ b/engines/bladerunner/script/ai/gaff.cpp @@ -211,7 +211,7 @@ bool AIScriptGaff::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Repeat(kActorGaff);  		return true;  	case 10: -		Game_Flag_Reset(kFlagGaffSpinnerCT12); +		Game_Flag_Reset(kFlagCT12GaffSpinner);  		Scene_Loop_Set_Default(2);  		Scene_Loop_Start_Special(2, 6, true);  		return true; diff --git a/engines/bladerunner/script/ai/gordo.cpp b/engines/bladerunner/script/ai/gordo.cpp index 2f48f90f9b..9d1754aeac 100644 --- a/engines/bladerunner/script/ai/gordo.cpp +++ b/engines/bladerunner/script/ai/gordo.cpp @@ -45,23 +45,30 @@ void AIScriptGordo::Initialize() {  	_frameDelta = 1;  	_frameMax = 0;  	_state = 0; -	Actor_Set_Goal_Number(kActorGordo, 0); +	Actor_Set_Goal_Number(kActorGordo, kGoalGordoDefault);  }  bool AIScriptGordo::Update() {  	if (Global_Variable_Query(kVariableChapter) == 1) { -		if (Actor_Query_Goal_Number(kActorGordo) == 0 && Actor_Query_Friendliness_To_Other(kActorGordo, kActorMcCoy) < 48 && Actor_Query_Is_In_Current_Set(kActorGordo) == kSetBB02_BB04_BB06_BB51) { -			Actor_Set_Goal_Number(kActorGordo, 90); +		if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoDefault +		 && Actor_Query_Friendliness_To_Other(kActorGordo, kActorMcCoy) < 48 +		 && Actor_Query_Is_In_Current_Set(kActorGordo) +		) { +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoGetUpCT01);  			return true;  		} -		if (Actor_Query_Which_Set_In(kActorMcCoy) == kSetCT03_CT04 && Actor_Query_Which_Set_In(kActorGordo) == kSetCT01_CT12) { -			Actor_Set_Goal_Number(kActorGordo, 91); +		if (Actor_Query_Which_Set_In(kActorMcCoy) == kSetCT03_CT04 +		 && Actor_Query_Which_Set_In(kActorGordo) == kSetCT01_CT12 +		) { +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoWalkOutFromCT01);  			return true;  		}  	} -	if (Global_Variable_Query(kVariableChapter) == 2 && Actor_Query_Goal_Number(kActorGordo) < 100) { -		Actor_Set_Goal_Number(kActorGordo, 100); +	if (Global_Variable_Query(kVariableChapter) == 2 +	 && Actor_Query_Goal_Number(kActorGordo) < kGoalGordoWalkAround +	) { +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoWalkAround);  	}  	if (Global_Variable_Query(kVariableChapter) == 3) { @@ -74,7 +81,9 @@ bool AIScriptGordo::Update() {  	}  	if (Global_Variable_Query(kVariableChapter) == 4) { -		if (Actor_Query_Goal_Number(kActorGordo) < 300 && Actor_Query_Goal_Number(kActorGordo) != 260) { +		if (Actor_Query_Goal_Number(kActorGordo) < 300 +		 && Actor_Query_Goal_Number(kActorGordo) != 260 +		) {  			Actor_Set_Goal_Number(kActorGordo, 300);  		} else if (Actor_Query_Goal_Number(kActorGordo) == 599) {  			Actor_Put_In_Set(kActorGordo, kSetFreeSlotI); @@ -82,7 +91,9 @@ bool AIScriptGordo::Update() {  		}  	} -	if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorGordo) < 400) { +	if (Global_Variable_Query(kVariableChapter) == 5 +	 && Actor_Query_Goal_Number(kActorGordo) < 400 +	) {  		Actor_Set_Goal_Number(kActorGordo, 400);  	} @@ -102,13 +113,14 @@ void AIScriptGordo::TimerExpired(int timer) {  }  void AIScriptGordo::CompletedMovementTrack() { -	if (Actor_Query_Goal_Number(kActorGordo) == 1 -	 || Actor_Query_Goal_Number(kActorGordo) == 91 +	if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoLeaveCT01 +	 || Actor_Query_Goal_Number(kActorGordo) == kGoalGordoWalkOutFromCT01  	) { -		Actor_Set_Goal_Number(kActorGordo, 2); +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoLeftCT01);  		return;// true;  	} -	if (Actor_Query_Goal_Number(kActorGordo) == 3) { + +	if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoWalkThroughCT05) {  		if (Player_Query_Current_Set() == kSetCT05) {  			Actor_Force_Stop_Walking(kActorMcCoy);  			Player_Loses_Control(); @@ -123,24 +135,26 @@ void AIScriptGordo::CompletedMovementTrack() {  			Player_Gains_Control();  		}  		Actor_Clue_Acquire(kActorGordo, kClueMcCoyRetiredZuben, true, -1); -		Actor_Set_Goal_Number(kActorGordo, 4); +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoLeaveCT05);  		return;// true;  	} -	if (Actor_Query_Goal_Number(kActorGordo) == 4) { -		Actor_Set_Goal_Number(kActorGordo, 5); +	if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoLeaveCT05) { +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoLeftCT05);  		return;// true;  	} -	if (Actor_Query_Goal_Number(kActorGordo) == 93) { +	if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoWalkToHowieLee) {  		Actor_Set_Immunity_To_Obstacles(kActorGordo, false);  		Player_Gains_Control(); -		Actor_Set_Goal_Number(kActorGordo, 92); +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoBidFarewellToHowieLee);  		return;// true;  	} -	if (Actor_Query_Goal_Number(kActorGordo) > 100 && Actor_Query_Goal_Number(kActorGordo) < 200) { -		Actor_Set_Goal_Number(kActorGordo, 100); +	if (Actor_Query_Goal_Number(kActorGordo) > 100 +	 && Actor_Query_Goal_Number(kActorGordo) < 200 +	) { +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoWalkAround);  		return;// true;  	} @@ -188,8 +202,10 @@ void AIScriptGordo::ReceivedClue(int clueId, int fromActorId) {  void AIScriptGordo::ClickedByPlayer() {  	int goal = Actor_Query_Goal_Number(kActorGordo); -	if (goal == 101 || goal == 102) { -		sub_40FD00(); +	if (goal == kGoalGordoGoToDNARow +	 || goal == kGoalGordoGoToChinaTown +	) { +		McCoyTalkWithGordo();  	} else if (goal == 260) {  		Actor_Face_Actor(kActorMcCoy, kActorGordo, true);  		Actor_Says(kActorMcCoy, 8600, 11); @@ -284,77 +300,80 @@ int AIScriptGordo::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueI  }  bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) { +	int rnd; +  	switch (newGoalNumber) { -	case 0: +	case kGoalGordoDefault:  		Actor_Put_In_Set(kActorGordo, kSetCT01_CT12);  		Actor_Set_At_XYZ(kActorGordo, -308.44f, -12.5f, 442.78f, 256);  		Actor_Change_Animation_Mode(kActorGordo, 53);  		break; -	case 3: +	case kGoalGordoWalkThroughCT05:  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 119, 0);  		AI_Movement_Track_Append(kActorGordo, 118, 0);  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 4: +	case kGoalGordoLeaveCT05:  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 119, 0);  		AI_Movement_Track_Append(kActorGordo, 33, 1);  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 90: -		Game_Flag_Set(kFlagCT01McCoyTalkedToGordo); +	case kGoalGordoGetUpCT01: +		Game_Flag_Set(kFlagCT01GordoTalk);  		Actor_Set_Goal_Number(kActorGordo, 99);  		Actor_Change_Animation_Mode(kActorGordo, 29);  		break; -	case 91: +	case kGoalGordoWalkOutFromCT01:  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 43, 0);  		AI_Movement_Track_Append(kActorGordo, 33, 1);  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 92: +	case kGoalGordoBidFarewellToHowieLee:  		Actor_Face_Actor(kActorGordo, kActorHowieLee, true);  		Actor_Says(kActorGordo, 0, 13);  		Actor_Says(kActorGordo, 10, 16); -		Actor_Set_Goal_Number(kActorGordo, 91); +		Actor_Set_Goal_Number(kActorGordo, kGoalGordoWalkOutFromCT01);  		Player_Gains_Control();  		break; -	case 93: +	case kGoalGordoWalkToHowieLee:  		Player_Loses_Control();  		Actor_Set_Immunity_To_Obstacles(kActorGordo, true);  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 100, 0);  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 100: { -			AI_Movement_Track_Flush(kActorGordo); -			_animationState = 0; -			_animationFrame = 0; -			_animationStateNext = 0; -			sub_41117C(); -			int rnd = Random_Query(1, 4); -			if (Actor_Clue_Query(kActorMcCoy, kClueGordoInterview1) || Actor_Clue_Query(kActorMcCoy, kClueGordoInterview2)) { -				rnd = Random_Query(4, 5); -			} -			switch (rnd) { -			case 1: -			case 2: -				Actor_Set_Goal_Number(kActorGordo, 101); -				break; -			case 3: -				Actor_Set_Goal_Number(kActorGordo, 102); -				break; -			case 4: -				Actor_Set_Goal_Number(kActorGordo, 103); -				break; -			case 5: -				Actor_Set_Goal_Number(kActorGordo, 104); -				break; -			} +	case kGoalGordoWalkAround: +		AI_Movement_Track_Flush(kActorGordo); +		_animationState = 0; +		_animationFrame = 0; +		_animationStateNext = 0; +		sub_41117C(); +		rnd = Random_Query(1, 4); +		if (Actor_Clue_Query(kActorMcCoy, kClueGordoInterview1) +		 || Actor_Clue_Query(kActorMcCoy, kClueGordoInterview2) +		) { +			rnd = Random_Query(4, 5); +		} +		switch (rnd) { +		case 1: +		case 2: +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoGoToDNARow); +			break; +		case 3: +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoGoToChinaTown); +			break; +		case 4: +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoGoToFreeSlotHAGJ); +			break; +		case 5: +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoGoToFreeSlotAH); +			break;  		}  		break; -	case 101: +	case kGoalGordoGoToDNARow:  		AI_Movement_Track_Flush(kActorGordo);  		if (Random_Query(1, 2) == 1) {  			AI_Movement_Track_Append(kActorGordo, 343, 5); @@ -378,7 +397,7 @@ bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		}  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 102: +	case kGoalGordoGoToChinaTown:  		if (Random_Query(1, 3) == 1) {  			AI_Movement_Track_Append(kActorGordo, 54, 1);  			AI_Movement_Track_Append(kActorGordo, 56, 0); @@ -391,7 +410,7 @@ bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorGordo, 40, 15);  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 103: +	case kGoalGordoGoToFreeSlotHAGJ:  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 40, Random_Query(15, 45));  		if (Game_Flag_Query(kFlagGordoIsReplicant)) { @@ -403,7 +422,7 @@ bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorGordo, 42, Random_Query(10, 20));  		AI_Movement_Track_Repeat(kActorGordo);  		break; -	case 104: +	case kGoalGordoGoToFreeSlotAH:  		AI_Movement_Track_Flush(kActorGordo);  		AI_Movement_Track_Append(kActorGordo, 33, Random_Query(15, 45));  		if (!Game_Flag_Query(kFlagGordoIsReplicant)) { @@ -413,7 +432,10 @@ bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		break;  	case 200:  		if (Global_Variable_Query(40) == 2) { -			if (Game_Flag_Query(593) && Game_Flag_Query(591) && Player_Query_Current_Scene() != kSceneNR02) { +			if (Game_Flag_Query(593) +			 && Game_Flag_Query(591) +			 && Player_Query_Current_Scene() != kSceneNR02 +			) {  				Actor_Set_Goal_Number(kActorGordo, 201);  			} else {  				Actor_Set_Goal_Number(kActorGordo, 225); @@ -571,7 +593,7 @@ bool AIScriptGordo::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Says(kActorMcCoy, 3080, 15);  		Actor_Says(kActorGordo, 200, 15);  		Actor_Says(kActorMcCoy, 3085, 15); -		sub_410590(); +		dialogueWithGordo2();  		break;  	case 243:  		AI_Movement_Track_Flush(kActorGordo); @@ -749,7 +771,7 @@ bool AIScriptGordo::UpdateAnimation(int *animation, int *frame) {  			_animationState = 0;  			_animationFrame = 0;  			Actor_Change_Animation_Mode(kActorGordo, kAnimationModeIdle); -			Actor_Set_Goal_Number(kActorGordo, 93); +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoWalkToHowieLee);  		}  		break;  	case 4: @@ -1406,66 +1428,10 @@ void AIScriptGordo::FledCombat() {  	// return false;  } -void AIScriptGordo::sub_40FD00() { +void AIScriptGordo::McCoyTalkWithGordo() {  	Player_Loses_Control();  	Actor_Face_Actor(kActorMcCoy, kActorGordo, true); -	if (Game_Flag_Query(543)) { -		if (!Game_Flag_Query(kFlagDR05BombExploded) -		 ||  Actor_Clue_Query(kActorMcCoy, kClueGordoInterview1) -		 ||  Actor_Clue_Query(kActorMcCoy, kClueGordoInterview2) -		) { -			if (Game_Flag_Query(544)) { -				switch(Random_Query(1, 4)) { -					case 1: -						Actor_Says(kActorMcCoy, 6460, 13); -						break; -					case 2: -						Actor_Says(kActorMcCoy, 6550, 14); -						break; -					case 3: -						Actor_Says(kActorMcCoy, 365, 12); -						break; -					case 4: -						Actor_Says(kActorMcCoy, 525, 12); -						break; -				} -			} else { -				Actor_Says(kActorMcCoy, 6490, 14); -				AI_Movement_Track_Pause(kActorGordo); -				Loop_Actor_Walk_To_Actor(kActorGordo, kActorMcCoy, 60, false, false); -				Actor_Face_Actor(kActorGordo, kActorMcCoy, true); -				Actor_Face_Actor(kActorMcCoy, kActorGordo, true); -				Actor_Says(kActorGordo, 990, 13); -				Actor_Says(kActorGordo, 1000, 15); -				Game_Flag_Set(544); -				AI_Movement_Track_Unpause(kActorGordo); -			} -		} else { -			Actor_Says(kActorMcCoy, 6485, 12); -			AI_Movement_Track_Pause(kActorGordo); -			Loop_Actor_Walk_To_Actor(kActorGordo, kActorMcCoy, 48, false, false); -			Actor_Face_Actor(kActorGordo, kActorMcCoy, true); -			Actor_Face_Actor(kActorMcCoy, kActorGordo, true); -			if (Game_Flag_Query(kFlagGordoIsReplicant)) { -				Actor_Says(kActorGordo, 1010, 12); -				Actor_Says(kActorMcCoy, 6495, 14); -				Actor_Says(kActorGordo, 1020, 13); -				Actor_Says(kActorMcCoy, 6500, 14); -				Actor_Says(kActorGordo, 1030, 15); -				Actor_Clue_Acquire(kActorMcCoy, kClueGordoInterview1, false, kActorGordo); -			} else { -				Actor_Says(kActorGordo, 1040, 12); -				Actor_Says(kActorGordo, 1050, 13); -				Actor_Says(kActorMcCoy, 6505, 14); -				Actor_Says(kActorGordo, 1060, 13); -				Actor_Says(kActorGordo, 1070, 14); -				Actor_Says(kActorMcCoy, 6510, 16); -				Actor_Says(kActorGordo, 1080, 15); -				Actor_Clue_Acquire(kActorMcCoy, kClueGordoInterview2, false, kActorGordo); -			} -			AI_Movement_Track_Unpause(kActorGordo); -		} -	} else { +	if (!Game_Flag_Query(kFlagGordoTalk1)) {  		Actor_Says(kActorMcCoy, 6460, 12);  		AI_Movement_Track_Pause(kActorGordo);  		Loop_Actor_Walk_To_Actor(kActorGordo, kActorMcCoy, 36, false, false); @@ -1485,8 +1451,61 @@ void AIScriptGordo::sub_40FD00() {  		Actor_Says(kActorGordo, 960, 15);  		Actor_Says(kActorGordo, 970, 12);  		AI_Movement_Track_Unpause(kActorGordo); -		Game_Flag_Set(543); +		Game_Flag_Set(kFlagGordoTalk1); +	} else if ( Game_Flag_Query(kFlagDR05BombExploded) +	       && !Actor_Clue_Query(kActorMcCoy, kClueGordoInterview1) +	       && !Actor_Clue_Query(kActorMcCoy, kClueGordoInterview2) +	) { +		Actor_Says(kActorMcCoy, 6485, 12); +		AI_Movement_Track_Pause(kActorGordo); +		Loop_Actor_Walk_To_Actor(kActorGordo, kActorMcCoy, 48, false, false); +		Actor_Face_Actor(kActorGordo, kActorMcCoy, true); +		Actor_Face_Actor(kActorMcCoy, kActorGordo, true); +		if (Game_Flag_Query(kFlagGordoIsReplicant)) { +			Actor_Says(kActorGordo, 1010, 12); +			Actor_Says(kActorMcCoy, 6495, 14); +			Actor_Says(kActorGordo, 1020, 13); +			Actor_Says(kActorMcCoy, 6500, 14); +			Actor_Says(kActorGordo, 1030, 15); +			Actor_Clue_Acquire(kActorMcCoy, kClueGordoInterview1, false, kActorGordo); +		} else { +			Actor_Says(kActorGordo, 1040, 12); +			Actor_Says(kActorGordo, 1050, 13); +			Actor_Says(kActorMcCoy, 6505, 14); +			Actor_Says(kActorGordo, 1060, 13); +			Actor_Says(kActorGordo, 1070, 14); +			Actor_Says(kActorMcCoy, 6510, 16); +			Actor_Says(kActorGordo, 1080, 15); +			Actor_Clue_Acquire(kActorMcCoy, kClueGordoInterview2, false, kActorGordo); +		} +		AI_Movement_Track_Unpause(kActorGordo); +	} else if (!Game_Flag_Query(kFlagGordoTalk2)) { +		Actor_Says(kActorMcCoy, 6490, 14); +		AI_Movement_Track_Pause(kActorGordo); +		Loop_Actor_Walk_To_Actor(kActorGordo, kActorMcCoy, 60, false, false); +		Actor_Face_Actor(kActorGordo, kActorMcCoy, true); +		Actor_Face_Actor(kActorMcCoy, kActorGordo, true); +		Actor_Says(kActorGordo, 990, 13); +		Actor_Says(kActorGordo, 1000, 15); +		Game_Flag_Set(kFlagGordoTalk2); +		AI_Movement_Track_Unpause(kActorGordo); +	} else { +		switch(Random_Query(1, 4)) { +			case 1: +				Actor_Says(kActorMcCoy, 6460, 13); +				break; +			case 2: +				Actor_Says(kActorMcCoy, 6550, 14); +				break; +			case 3: +				Actor_Says(kActorMcCoy, 365, 12); +				break; +			case 4: +				Actor_Says(kActorMcCoy, 525, 12); +				break; +		}  	} +  	return Player_Gains_Control();  } @@ -1506,21 +1525,23 @@ void AIScriptGordo::sub_4103B8() {  	Actor_Says(kActorGordo, 350, 13);  	Actor_Says(kActorMcCoy, 3225, 18);  	Player_Gains_Control(); -	sub_41090C(); +	dialogueWithGordo1();  	Player_Loses_Control();  	Game_Flag_Set(561);  	Actor_Face_Heading(kActorGordo, 506, false);  	Actor_Change_Animation_Mode(kActorGordo, 23);  } -void AIScriptGordo::sub_410590() { +void AIScriptGordo::dialogueWithGordo2() {  	Music_Stop(5);  	Dialogue_Menu_Clear_List();  	DM_Add_To_List_Never_Repeat_Once_Selected(820, -1, 5, 7);  	DM_Add_To_List_Never_Repeat_Once_Selected(830, 7, 5, -1); +  	Dialogue_Menu_Appear(320, 240);  	int answer = Dialogue_Menu_Query_Input();  	Dialogue_Menu_Disappear(); +  	if (answer == 820) {  		Actor_Says(kActorMcCoy, 3090, 16);  		Actor_Says(kActorMcCoy, 3095, 15); @@ -1535,8 +1556,8 @@ void AIScriptGordo::sub_410590() {  		Game_Flag_Set(251);  		Game_Flag_Set(592);  		Scene_Exits_Enable(); -		Game_Flag_Reset(kFlagMcCoyAtNRxx); -		Game_Flag_Set(kFlagMcCoyAtPSxx); +		Game_Flag_Reset(kFlagMcCoyInNightclubRow); +		Game_Flag_Set(kFlagMcCoyInPoliceStation);  		Set_Enter(kSetPS09, kScenePS09);  	} else if (answer == 830) {  		Actor_Says(kActorMcCoy, 3100, 16); @@ -1559,11 +1580,13 @@ void AIScriptGordo::sub_410590() {  	}  } -void AIScriptGordo::sub_41090C() { +void AIScriptGordo::dialogueWithGordo1() {  	Dialogue_Menu_Clear_List();  	DM_Add_To_List_Never_Repeat_Once_Selected(760, 2, 5, 6);  	DM_Add_To_List_Never_Repeat_Once_Selected(770, 6, 3, 1); -	if (Actor_Clue_Query(kActorMcCoy, kClueDektorasDressingRoom) || Actor_Clue_Query(kActorMcCoy, kClueWomanInAnimoidRow)) { +	if (Actor_Clue_Query(kActorMcCoy, kClueDektorasDressingRoom) +	 || Actor_Clue_Query(kActorMcCoy, kClueWomanInAnimoidRow) +	) {  		DM_Add_To_List_Never_Repeat_Once_Selected(780, 5, 5, 5);  	}  	if (Actor_Clue_Query(kActorMcCoy, kClueLucy)) { @@ -1573,9 +1596,11 @@ void AIScriptGordo::sub_41090C() {  		DM_Add_To_List_Never_Repeat_Once_Selected(800, -1, 4, 8);  	}  	Dialogue_Menu_Add_DONE_To_List(810); +  	Dialogue_Menu_Appear(320, 240);  	int answer = Dialogue_Menu_Query_Input();  	Dialogue_Menu_Disappear(); +  	switch (answer) {  	case 760:  		Actor_Says(kActorMcCoy, 3230, kAnimationModeTalk); @@ -1651,6 +1676,7 @@ void AIScriptGordo::sub_41090C() {  }  void AIScriptGordo::sub_41117C() { +	// this has no real use as _animationState is always 0  	switch (_animationState) {  	case 0:  		break; diff --git a/engines/bladerunner/script/ai/holloway.cpp b/engines/bladerunner/script/ai/holloway.cpp index ed4453ec60..dc52107c1c 100644 --- a/engines/bladerunner/script/ai/holloway.cpp +++ b/engines/bladerunner/script/ai/holloway.cpp @@ -183,7 +183,7 @@ bool AIScriptHolloway::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		if (Global_Variable_Query(40) != 1) {  			Player_Gains_Control();  		} -		Game_Flag_Set(334); +		Game_Flag_Set(kFlagUG03toUG04);  		Set_Enter(kSetUG04, kSceneUG04);  		break; diff --git a/engines/bladerunner/script/ai/howie_lee.cpp b/engines/bladerunner/script/ai/howie_lee.cpp index 2291d5ac12..93f08672db 100644 --- a/engines/bladerunner/script/ai/howie_lee.cpp +++ b/engines/bladerunner/script/ai/howie_lee.cpp @@ -55,7 +55,7 @@ bool AIScriptHowieLee::Update() {  		Actor_Set_Goal_Number(kActorHowieLee, 1);  	} -	if ( Game_Flag_Query(kFlagMcCoyAtCTxx) +	if ( Game_Flag_Query(kFlagMcCoyInChinaTown)  	 && !Actor_Query_In_Set(kActorHowieLee, kSetCT01_CT12)  	) {  		AI_Movement_Track_Flush(kActorHowieLee); @@ -64,8 +64,8 @@ bool AIScriptHowieLee::Update() {  	}  	if ( Actor_Query_Goal_Number(kActorHowieLee) == 1 -	 &&  Game_Flag_Query(kFlagBoughtHowieLeeFood) -	 && !Game_Flag_Query(kFlagMcCoyAtCTxx) +	 &&  Game_Flag_Query(kFlagCT01BoughtHowieLeeFood) +	 && !Game_Flag_Query(kFlagMcCoyInChinaTown)  	) {  		Actor_Set_Goal_Number(kActorHowieLee, 4);  		return true; @@ -124,20 +124,20 @@ void AIScriptHowieLee::EnteredScene(int sceneId) {  	if (Actor_Query_Goal_Number(kActorHowieLee) == 4  	 && Actor_Query_In_Set(kActorHowieLee, kSetCT03_CT04)  	) { -		if ( Game_Flag_Query(kFlagMcCoyKilledHomeless) -		 && !Game_Flag_Query(kFlagHomelessBodyInDumpster) -		 && !Game_Flag_Query(kFlagHomelessBodyFound) +		if ( Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy) +		 && !Game_Flag_Query(kFlagCT04HomelessBodyInDumpster) +		 && !Game_Flag_Query(kFlagCT04HomelessBodyFound)  		) { -			Game_Flag_Set(kFlagHomelessBodyFound); +			Game_Flag_Set(kFlagCT04HomelessBodyFound);  			// return false;  		} -		if (!Game_Flag_Query(kFlagMcCoyKilledHomeless) -		 &&  Game_Flag_Query(kFlagHomelessBodyInDumpster) -		 && !Game_Flag_Query(kFlagHomelessBodyFound) +		if (!Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy) +		 &&  Game_Flag_Query(kFlagCT04HomelessBodyInDumpster) +		 && !Game_Flag_Query(kFlagCT04HomelessBodyFound)  		 &&  Random_Query(1, 10) == 1  		) { -			Game_Flag_Set(kFlagHomelessBodyFound); +			Game_Flag_Set(kFlagCT04HomelessBodyFound);  			// return true;  		}  		// return false; diff --git a/engines/bladerunner/script/ai/insect_dealer.cpp b/engines/bladerunner/script/ai/insect_dealer.cpp index fb0924a066..129a8e3535 100644 --- a/engines/bladerunner/script/ai/insect_dealer.cpp +++ b/engines/bladerunner/script/ai/insect_dealer.cpp @@ -111,8 +111,8 @@ bool AIScriptInsectDealer::GoalChanged(int currentGoalNumber, int newGoalNumber)  		Actor_Put_In_Set(kActorInsectDealer, kSetFreeSlotH);  		Actor_Set_At_Waypoint(kActorInsectDealer, 40, 0); -		if (!Game_Flag_Query(374)) { -			Game_Flag_Set(374); +		if (!Game_Flag_Query(kFlagAR02DektoraBoughtScorpions)) { +			Game_Flag_Set(kFlagAR02DektoraBoughtScorpions);  			Item_Remove_From_World(kItemScrorpions);  		}  	} diff --git a/engines/bladerunner/script/ai/izo.cpp b/engines/bladerunner/script/ai/izo.cpp index 3f2715ac78..88070113cc 100644 --- a/engines/bladerunner/script/ai/izo.cpp +++ b/engines/bladerunner/script/ai/izo.cpp @@ -163,7 +163,7 @@ void AIScriptIzo::ClickedByPlayer() {  		Actor_Face_Actor(kActorIzo, kActorMcCoy, true);  		Actor_Says(kActorIzo, 700, 17);  		Actor_Says(kActorMcCoy, 5465, 14); -		someDialog(); +		dialogueWithIzo();  	}  	if (Actor_Query_Goal_Number(kActorIzo) == kGoalIzoRC03Walk) { @@ -245,7 +245,7 @@ void AIScriptIzo::Retired(int byActorId) {  		Player_Loses_Control();  		Delay(2000);  		Player_Set_Combat_Mode(0); -		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -12.0f, -41.58f, 72.0f, 0, 1, 0, 0); +		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -12.0f, -41.58f, 72.0f, 0, true, false, 0);  		Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);  		Ambient_Sounds_Remove_All_Looping_Sounds(1);  		Game_Flag_Set(579); @@ -1008,7 +1008,7 @@ void AIScriptIzo::FledCombat() {  	// return false;  } -void AIScriptIzo::someDialog() { +void AIScriptIzo::dialogueWithIzo() {  	Dialogue_Menu_Clear_List();  	DM_Add_To_List_Never_Repeat_Once_Selected(0, 7, 4, -1); // MOTIVES diff --git a/engines/bladerunner/script/ai/klein.cpp b/engines/bladerunner/script/ai/klein.cpp index 955150c581..fc2893d17d 100644 --- a/engines/bladerunner/script/ai/klein.cpp +++ b/engines/bladerunner/script/ai/klein.cpp @@ -70,11 +70,11 @@ bool AIScriptKlein::Update() {  	}  	if ( Player_Query_Current_Scene() == kScenePS07  	 &&  Actor_Query_Friendliness_To_Other(kActorKlein, kActorMcCoy) < 35 -	 && !Game_Flag_Query(kFlagKleinInsulted) +	 && !Game_Flag_Query(kFlagPS07KleinInsulted)  	) {  		AI_Countdown_Timer_Reset(kActorKlein, 2);  		AI_Countdown_Timer_Start(kActorKlein, 2, 5); -		Game_Flag_Set(kFlagKleinInsulted); +		Game_Flag_Set(kFlagPS07KleinInsulted);  		return true;  	}  	if (Actor_Query_Goal_Number(kActorKlein) == 7) { @@ -92,8 +92,8 @@ bool AIScriptKlein::Update() {  void AIScriptKlein::TimerExpired(int timer) {  	if (timer == 2) { -		if ( Game_Flag_Query(kFlagKleinInsulted) -		 && !Game_Flag_Query(kFlagKleinInsultedTalk) +		if ( Game_Flag_Query(kFlagPS07KleinInsulted) +		 && !Game_Flag_Query(kFlagPS07KleinInsultedTalk)  		 &&  Actor_Query_Is_In_Current_Set(kActorKlein)  		) {  			Actor_Face_Actor(kActorKlein, kActorMcCoy, true); @@ -101,7 +101,7 @@ void AIScriptKlein::TimerExpired(int timer) {  			Actor_Says(kActorMcCoy, 4120, kAnimationModeTalk);  			Actor_Says(kActorKlein, 20, kAnimationModeTalk);  			Actor_Says(kActorMcCoy, 4125, kAnimationModeTalk); -			Game_Flag_Set(kFlagKleinInsultedTalk); +			Game_Flag_Set(kFlagPS07KleinInsultedTalk);  			Actor_Set_Goal_Number(kActorKlein, 4);  		} else {  			Actor_Says(kActorKlein, 10, kAnimationModeTalk); diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp index 48a8e8b698..0f8843af61 100644 --- a/engines/bladerunner/script/ai/mccoy.cpp +++ b/engines/bladerunner/script/ai/mccoy.cpp @@ -750,7 +750,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {  	case 44:  		*animation = 30;  		if (_animationFrame++ == 127) { -			Game_Flag_Set(325); +			Game_Flag_Set(kFlagCT04BodyDumped);  		}  		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(30)) {  			*animation = 19; @@ -807,7 +807,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {  		} else if (_animationFrame == 4) {  			Sound_Right_Footstep_Walk(kActorMcCoy);  		} -		if (Game_Flag_Query(359)) { +		if (Game_Flag_Query(kFlagHF05toHF07)) {  			sub_4059D0(-0.2f);  		}  		break; @@ -823,7 +823,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {  		} else if (_animationFrame == 3) {  			Sound_Right_Footstep_Walk(kActorMcCoy);  		} -		if (Game_Flag_Query(358)) { +		if (Game_Flag_Query(kFlagHF07toHF05)) {  			sub_405940(0.5f);  		}  		break; @@ -839,7 +839,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {  		} else if (_animationFrame == 3) {  			Sound_Right_Footstep_Walk(kActorMcCoy);  		} -		if (Game_Flag_Query(359)) { +		if (Game_Flag_Query(kFlagHF05toHF07)) {  			sub_4059D0(-0.2f);  		}  		break; @@ -855,7 +855,7 @@ bool AIScriptMcCoy::UpdateAnimation(int *animation, int *frame) {  		} else if (_animationFrame == 4) {  			Sound_Right_Footstep_Walk(kActorMcCoy);  		} -		if (Game_Flag_Query(358)) { +		if (Game_Flag_Query(kFlagHF07toHF05)) {  			sub_405940(0.5f);  		}  		break; diff --git a/engines/bladerunner/script/ai/moraji.cpp b/engines/bladerunner/script/ai/moraji.cpp index 067b5668cd..6e650e4316 100644 --- a/engines/bladerunner/script/ai/moraji.cpp +++ b/engines/bladerunner/script/ai/moraji.cpp @@ -38,11 +38,11 @@ void AIScriptMoraji::Initialize() {  	_var1 = 1;  	_var2 = 0; -	Actor_Set_Goal_Number(kActorMoraji, 0); +	Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDefault);  }  bool AIScriptMoraji::Update() { -	if ( Actor_Query_Goal_Number(kActorMoraji) == 0 +	if ( Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiDefault  	 &&  Player_Query_Current_Scene() == kSceneDR05  	 && !Game_Flag_Query(kFlagDR05BombActivated)  	) { @@ -52,21 +52,23 @@ bool AIScriptMoraji::Update() {  		return true;  	} -	if (Actor_Query_Goal_Number(kActorMoraji) == 19) { +	if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiScream) {  		Actor_Says(kActorMoraji, 80, 13);  		_animationState = 9;  		_animationFrame = -1; -		Actor_Set_Goal_Number(kActorMoraji, 18); +		Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiGetUp);  	} +  	return false;  }  void AIScriptMoraji::TimerExpired(int timer) {  	if (timer == 2) {  		AI_Countdown_Timer_Reset(kActorMoraji, 2); -		if (Actor_Query_Goal_Number(kActorMoraji) != 20 -		 && Actor_Query_Goal_Number(kActorMoraji) != 21 -		 && Actor_Query_Goal_Number(kActorMoraji) != 99 + +		if (Actor_Query_Goal_Number(kActorMoraji) != kGoalMorajiJump +		 && Actor_Query_Goal_Number(kActorMoraji) != kGoalMorajiLayDown +		 && Actor_Query_Goal_Number(kActorMoraji) != kGoalMorajiPerished  		) {  			Game_Flag_Set(kFlagDR05BombWillExplode);  		} @@ -77,7 +79,7 @@ void AIScriptMoraji::TimerExpired(int timer) {  }  void AIScriptMoraji::CompletedMovementTrack() { -	if (Actor_Query_Goal_Number(kActorMoraji) == 11) { +	if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiRunOut) {  		AI_Countdown_Timer_Reset(kActorMoraji, 2);  		Game_Flag_Set(kFlagDR05BombWillExplode);  		_animationState = 3; @@ -117,17 +119,16 @@ void AIScriptMoraji::ShotAtAndMissed() {  bool AIScriptMoraji::ShotAtAndHit() {  	if (Actor_Query_Goal_Number(kActorMoraji)) { -		if (Actor_Query_Goal_Number(kActorMoraji) == 21) { -			Game_Flag_Set(713); -			Actor_Set_Goal_Number(kActorMoraji, 22); +		if (Actor_Query_Goal_Number(kActorMoraji) == kGoalMorajiLayDown) { +			Game_Flag_Set(kFlagDR04McCoyShotMoraji); +			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDie);  			Actor_Set_Goal_Number(kActorOfficerGrayford, 101); -  			return true;  		} else {  			return false;  		}  	} else { -		Actor_Set_Goal_Number(kActorMoraji, 5); +		Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiShot);  		return true;  	}  } @@ -142,24 +143,27 @@ int AIScriptMoraji::GetFriendlinessModifierIfGetsClue(int otherActorId, int clue  bool AIScriptMoraji::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	switch (newGoalNumber) { -	case 0: +	case kGoalMorajiDefault:  		Actor_Put_In_Set(kActorMoraji, kSetDR05);  		Actor_Set_At_XYZ(kActorMoraji, 50.0f, 0.30f, 35.0f, 414); -		Actor_Set_Targetable(kActorMoraji, 1); +		Actor_Set_Targetable(kActorMoraji, true);  		return false; -	case 5: -		Actor_Set_Targetable(kActorMoraji, 0); + +	case kGoalMorajiShot: +		Actor_Set_Targetable(kActorMoraji, false);  		Sound_Play(4, 100, 0, 0, 50);  		_animationState = 10;  		_animationFrame = 0; -		Actor_Retired_Here(kActorMoraji, 60, 16, 1, -1); +		Actor_Retired_Here(kActorMoraji, 60, 16, true, -1);  		return true; -	case 10: -		Actor_Set_Targetable(kActorMoraji, 0); + +	case kGoalMorajiFreed: +		Actor_Set_Targetable(kActorMoraji, false);  		_animationState = 8;  		_animationFrame = 1;  		return true; -	case 11: + +	case kGoalMorajiRunOut:  		_animationState = 3;  		_animationFrame = 0;  		AI_Movement_Track_Flush(kActorMoraji); @@ -169,43 +173,47 @@ bool AIScriptMoraji::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append_Run(kActorMoraji, 98, 0);  		AI_Movement_Track_Repeat(kActorMoraji);  		return true; -	case 20: + +	case kGoalMorajiJump:  		_animationState = 11;  		return true; -	case 21: + +	case kGoalMorajiLayDown:  		Actor_Retired_Here(kActorMoraji, 60, 16, 0, -1); -		Actor_Set_Targetable(kActorMoraji, 1); +		Actor_Set_Targetable(kActorMoraji, true);  		return true; -	case 22: + +	case kGoalMorajiDie:  		_animationFrame = -1;  		_animationState = 13;  		return true; -	case 23: -		Actor_Set_Targetable(kActorMoraji, 0); + +	case kGoalMorajiDead: +		Actor_Set_Targetable(kActorMoraji, false);  		_animationState = 14;  		Actor_Retired_Here(kActorMoraji, 60, 16, 1, -1);  		return true;  		break; -	case 30: + +	case kGoalMorajiChooseFate:  		if (Player_Query_Current_Scene() == kSceneDR05) { -			Game_Flag_Set(kFlagDR05BombExplosionView); +			Game_Flag_Set(kFlagDR05ViewExplosion);  			Set_Enter(kSetDR01_DR02_DR04, kSceneDR04);  		} else {  			if (Actor_Query_In_Set(kActorMoraji, kSetDR05)) { -				Actor_Set_Goal_Number(kActorMoraji, 99); +				Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiPerished);  			} else { -				Actor_Set_Goal_Number(kActorMoraji, 20); +				Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiJump);  			} -			Game_Flag_Set(kFlagMorajiExploded); +			Game_Flag_Set(kFlagDR05JustExploded);  		}  		return true; -	case 99: + +	case kGoalMorajiPerished:  		AI_Movement_Track_Flush(kActorMoraji);  		AI_Movement_Track_Append(kActorMoraji, 41, 0);  		AI_Movement_Track_Repeat(kActorMoraji);  		return true; -	default: -		break;  	}  	return false; @@ -219,7 +227,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  			_var2--;  		} else {  			_animationFrame += _var1; -			if (!Random_Query(0, 10)) { +			if (Random_Query(0, 10) == 0) {  				_var1 = -_var1;  			}  			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { @@ -291,7 +299,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  			_animationFrame = 0;  			_animationState = 0;  			*animation = 733; -			Actor_Set_Goal_Number(kActorMoraji, 19); +			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiScream);  		}  		if (_animationFrame == 6) {  			Ambient_Sounds_Play_Sound(488, 69, 0, 0, 20); @@ -305,7 +313,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  			_animationFrame = 0;  			_animationState = 3;  			*animation = 732; -			Actor_Set_Goal_Number(kActorMoraji, 11); +			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiRunOut);  		}  		break; @@ -320,7 +328,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  		*animation = 739;  		_animationFrame++;  		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(739)) { -			Actor_Set_Goal_Number(kActorMoraji, 21); +			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiLayDown);  			_animationFrame = 0;  			_animationState = 12;  			*animation = 740; @@ -351,7 +359,7 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  		_animationFrame++;  		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(741) - 1) {  			_animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; -			Actor_Set_Goal_Number(kActorMoraji, 23); +			Actor_Set_Goal_Number(kActorMoraji, kGoalMorajiDead);  		}  		break; @@ -370,67 +378,67 @@ bool AIScriptMoraji::UpdateAnimation(int *animation, int *frame) {  bool AIScriptMoraji::ChangeAnimationMode(int mode) {  	switch (mode) { -	case 0: -		if (_animationState != 12 && Actor_Query_Goal_Number(kActorMoraji) != 11) { +	case kAnimationModeIdle: +		if (_animationState != 12 +		 && Actor_Query_Goal_Number(kActorMoraji) != 11 +		) {  			_animationState = 0;  			_animationFrame = 0;  		} -		return 1; +		break; -	case 1: +	case kAnimationModeWalk:  		_animationState = 2;  		_animationFrame = 0; -		return 1; +		break; -	case 2: -		if (_animationState) { -			if (_animationState != 3 || _animationState > 3) { -				_animationState = 3; -				_animationFrame = 0; -			} -		} else { +	case kAnimationModeRun: +		if (_animationState == 0) {  			_animationState = 1;  			_animationStateNext = 3;  			_animationNext = 732; +		} else if (_animationState != 3) { +			_animationState = 3; +			_animationFrame = 0;  		}  		break;  	case 3:  		if (_animationState != 12) { -			if (_animationState) { -				_animationState = 5; -				_animationFrame = 0; -			} else { +			if (_animationState == 0) {  				_animationState = 1;  				_animationStateNext = 5;  				_animationNext = 734; +			} else { +				_animationState = 5; +				_animationFrame = 0;  			}  		}  		break;  	case 12: -		if (_animationState) { -			_animationState = 6; -			_animationFrame = 0; -		} else { +		if (_animationState == 0) {  			_animationState = 1;  			_animationStateNext = 6;  			_animationNext = 735; +		} else { +			_animationState = 6; +			_animationFrame = 0;  		}  		break;  	case 13: -		if (_animationState) { -			_animationState = 7; -			_animationFrame = 0; -		} else { +		if (_animationState == 0) {  			_animationState = 1;  			_animationStateNext = 7;  			_animationNext = 736; +		} else { +			_animationState = 7; +			_animationFrame = 0;  		}  		break; -	case 48: +	case kAnimationModeDie:  		_animationState = 13;  		_animationFrame = -1;  		break; diff --git a/engines/bladerunner/script/ai/mutant1.cpp b/engines/bladerunner/script/ai/mutant1.cpp index 8a531ed3cf..fa9b736671 100644 --- a/engines/bladerunner/script/ai/mutant1.cpp +++ b/engines/bladerunner/script/ai/mutant1.cpp @@ -178,7 +178,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorMutant1, 39, 0);  		AI_Movement_Track_Repeat(kActorMutant1); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant1, 70);  			Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20);  		} @@ -352,7 +352,7 @@ bool AIScriptMutant1::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_Intelligence(kActorMutant1, 40);  		Actor_Set_Health(kActorMutant1, 10 * Query_Difficulty_Level() + 30, 10 * Query_Difficulty_Level() + 30); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant1, 70);  			Actor_Set_Friendliness_To_Other(kActorMutant1, kActorMcCoy, 20);  		} else { diff --git a/engines/bladerunner/script/ai/mutant2.cpp b/engines/bladerunner/script/ai/mutant2.cpp index 16b2ca8592..3e837b6388 100644 --- a/engines/bladerunner/script/ai/mutant2.cpp +++ b/engines/bladerunner/script/ai/mutant2.cpp @@ -162,7 +162,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorMutant2, 39, 0);  		AI_Movement_Track_Repeat(kActorMutant2); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant2, 60);  			Actor_Set_Friendliness_To_Other(kActorMutant2, kActorMcCoy, 30);  		} @@ -334,7 +334,7 @@ bool AIScriptMutant2::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_Intelligence(kActorMutant2, 20);  		Actor_Set_Health(71, 10 * Query_Difficulty_Level() + 50, 10 * Query_Difficulty_Level() + 50); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant2, 60);  			Actor_Set_Friendliness_To_Other(kActorMutant2, kActorMcCoy, 30);  		} else { diff --git a/engines/bladerunner/script/ai/mutant3.cpp b/engines/bladerunner/script/ai/mutant3.cpp index 0a6875e560..848dd6cc62 100644 --- a/engines/bladerunner/script/ai/mutant3.cpp +++ b/engines/bladerunner/script/ai/mutant3.cpp @@ -175,7 +175,7 @@ bool AIScriptMutant3::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorMutant3, 39, 0);  		AI_Movement_Track_Repeat(kActorMutant3); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant3, 80);  			Actor_Set_Friendliness_To_Other(kActorMutant3, kActorMcCoy, 20);  		} @@ -345,7 +345,7 @@ bool AIScriptMutant3::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_Intelligence(kActorMutant3, 40);  		Actor_Set_Health(kActorMutant3, 10 * Query_Difficulty_Level() + 50, 10 * Query_Difficulty_Level() + 50); -		if (Game_Flag_Query(kFlagMcCoyKilledHomeless)) { +		if (Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)) {  			Actor_Set_Combat_Aggressiveness(kActorMutant3, 80);  			Actor_Set_Friendliness_To_Other(kActorMutant3, kActorMcCoy, 20);  		} else { diff --git a/engines/bladerunner/script/ai/officer_grayford.cpp b/engines/bladerunner/script/ai/officer_grayford.cpp index 2ed286e5a9..d55b611d75 100644 --- a/engines/bladerunner/script/ai/officer_grayford.cpp +++ b/engines/bladerunner/script/ai/officer_grayford.cpp @@ -52,7 +52,7 @@ bool AIScriptOfficerGrayford::Update() {  	} else if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorOfficerGrayford) < 400) {  		AI_Movement_Track_Flush(kActorOfficerGrayford);  		Actor_Set_Goal_Number(kActorOfficerGrayford, 400); -	} else if (!Game_Flag_Query(kFlagMcCoyAtDRxx) +	} else if (!Game_Flag_Query(kFlagMcCoyInDNARow)  			&& Actor_Query_Goal_Number(kActorOfficerGrayford) > 102  			&& Actor_Query_Goal_Number(kActorOfficerGrayford) < 110) {  		Actor_Set_Goal_Number(kActorOfficerGrayford, 110); @@ -471,7 +471,7 @@ bool AIScriptOfficerGrayford::GoalChanged(int currentGoalNumber, int newGoalNumb  		Actor_Face_Actor(kActorOfficerGrayford, kActorMcCoy, true);  		Actor_Face_Actor(kActorMcCoy, kActorOfficerGrayford, true); -		if (Game_Flag_Query(713)) { +		if (Game_Flag_Query(kFlagDR04McCoyShotMoraji)) {  			Actor_Set_Goal_Number(kActorMcCoy, 500);  		} else {  			Actor_Says(kActorMcCoy, 960, 15); diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp index 19aa6b5332..0348806508 100644 --- a/engines/bladerunner/script/ai/officer_leary.cpp +++ b/engines/bladerunner/script/ai/officer_leary.cpp @@ -60,9 +60,9 @@ bool AIScriptOfficerLeary::Update() {  		return false;  	} -	if (!Game_Flag_Query(kFlagMcCoyAtRCxx) -	 &&  Game_Flag_Query(kFlagChopstickWrapperTaken) -	 &&  Game_Flag_Query(kFlagChromeDebrisTaken) +	if (!Game_Flag_Query(kFlagMcCoyInRunciters) +	 &&  Game_Flag_Query(kFlagRC51ChopstickWrapperTaken) +	 &&  Game_Flag_Query(kFlagRC01ChromeDebrisTaken)  	 &&  Player_Query_Current_Scene() != kSceneRC01  	 &&  Global_Variable_Query(kVariableChapter) < 3  	) { @@ -321,7 +321,7 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber)  				Actor_Clue_Acquire(kActorOfficerLeary, kClueCrowdInterviewB, false, -1);  			}  		} -		if (Game_Flag_Query(kFlagMcCoyAtRCxx)) { +		if (Game_Flag_Query(kFlagMcCoyInRunciters)) {  			if (Actor_Clue_Query(kActorOfficerLeary, kClueCrowdInterviewA)  			 && Actor_Clue_Query(kActorOfficerLeary, kClueCrowdInterviewB)  			) { @@ -906,7 +906,7 @@ bool AIScriptOfficerLeary::UpdateAnimation(int *animation, int *frame) {  		return true;  	case 0:  		if ( Game_Flag_Query(kFlagOfficerLearyTakingNotes) -		 && !Game_Flag_Query(KFlagMcCoyAndOfficerLearyTalking)) { +		 && !Game_Flag_Query(kFlagRC01McCoyAndOfficerLearyTalking)) {  			_animationState = 31;  			_animationFrame = 0;  			*animation = 604; diff --git a/engines/bladerunner/script/ai/photographer.cpp b/engines/bladerunner/script/ai/photographer.cpp index 2b082e8678..65460036ca 100644 --- a/engines/bladerunner/script/ai/photographer.cpp +++ b/engines/bladerunner/script/ai/photographer.cpp @@ -43,11 +43,11 @@ void AIScriptPhotographer::Initialize() {  bool AIScriptPhotographer::Update() {  	if ( Game_Flag_Query(kFlagTB02ElevatorToTB05) -	 && !Game_Flag_Query(kFlagPhotographerToTB06) +	 && !Game_Flag_Query(kFlagTB06Photographer)  	) {  		Actor_Put_In_Set(kActorPhotographer, kSetFreeSlotC);  		Actor_Set_At_Waypoint(kActorPhotographer, 35, 0); -		Game_Flag_Set(kFlagPhotographerToTB06); +		Game_Flag_Set(kFlagTB06Photographer);  		Actor_Set_Goal_Number(kActorPhotographer, 100);  		return true; diff --git a/engines/bladerunner/script/ai/runciter.cpp b/engines/bladerunner/script/ai/runciter.cpp index e4625f1159..8087489d49 100644 --- a/engines/bladerunner/script/ai/runciter.cpp +++ b/engines/bladerunner/script/ai/runciter.cpp @@ -55,7 +55,7 @@ bool AIScriptRunciter::Update() {  	if (Actor_Query_Goal_Number(kActorRunciter) == kGoalRunciterDefault  	 && Game_Flag_Query(kFlagRC01PoliceDone)  	) { -		Actor_Set_Goal_Number(kActorRunciter, kGoalRunciterHide); +		Actor_Set_Goal_Number(kActorRunciter, kGoalRunciterGoToFreeSlotGH);  	}  	if (Global_Variable_Query(kVariableChapter) == 4  	 && Actor_Query_Goal_Number(kActorRunciter) < 300 @@ -180,7 +180,7 @@ bool AIScriptRunciter::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Actor_Set_At_Waypoint(kActorRunciter, 92, 567);  		return false;  	} -	if (newGoalNumber == kGoalRunciterWalkAround) { +	if (newGoalNumber == kGoalRunciterWalkAroundRC02) {  		AI_Movement_Track_Flush(kActorRunciter);  		if (Random_Query(0, 1) == 1) {  			if (Random_Query(0, 1) == 0) { @@ -198,7 +198,7 @@ bool AIScriptRunciter::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Repeat(kActorRunciter);  		return true;  	} -	if (newGoalNumber == kGoalRunciterHide) { +	if (newGoalNumber == kGoalRunciterGoToFreeSlotGH) {  		AI_Movement_Track_Flush(kActorRunciter);  		AI_Movement_Track_Append(kActorRunciter, 39, 120);  		AI_Movement_Track_Append(kActorRunciter, 40, 0); diff --git a/engines/bladerunner/script/ai/sadik.cpp b/engines/bladerunner/script/ai/sadik.cpp index 0684de914c..353a926eec 100644 --- a/engines/bladerunner/script/ai/sadik.cpp +++ b/engines/bladerunner/script/ai/sadik.cpp @@ -57,7 +57,7 @@ bool AIScriptSadik::Update() {  		Actor_Set_Goal_Number(kActorSadik, 101);  		Actor_Set_Targetable(kActorSadik, true);  		Game_Flag_Set(391); -		Game_Flag_Set(406); +		Game_Flag_Set(kFlagUnused406);  		return true;  	} diff --git a/engines/bladerunner/script/ai/steele.cpp b/engines/bladerunner/script/ai/steele.cpp index c5c5b0cb3c..637d3b0983 100644 --- a/engines/bladerunner/script/ai/steele.cpp +++ b/engines/bladerunner/script/ai/steele.cpp @@ -56,21 +56,21 @@ bool AIScriptSteele::Update() {  	switch (Global_Variable_Query(kVariableChapter)) {  	case 1: -		if (Game_Flag_Query(kFlagMcCoyAtRCxx) +		if (Game_Flag_Query(kFlagMcCoyInRunciters)  		 && Game_Flag_Query(183)  		) {  			Actor_Set_Goal_Number(kActorSteele, 3);  			return true;  		} -		if (Game_Flag_Query(kFlagMcCoyAtCTxx) +		if (Game_Flag_Query(kFlagMcCoyInChinaTown)  		 && Game_Flag_Query(184)  		) {  			Actor_Set_Goal_Number(kActorSteele, 6);  			return true;  		} -		if (Game_Flag_Query(kFlagMcCoyAtPSxx) +		if (Game_Flag_Query(kFlagMcCoyInPoliceStation)  		 && Game_Flag_Query(185)  		) {  			Actor_Set_Goal_Number(kActorSteele, 10); @@ -78,7 +78,7 @@ bool AIScriptSteele::Update() {  		}  		if ( Actor_Query_Goal_Number(kActorSteele) == 0 -		 && !Game_Flag_Query(kFlagMcCoyAtRCxx) +		 && !Game_Flag_Query(kFlagMcCoyInRunciters)  		 &&  Player_Query_Current_Scene() != kSceneRC01  		) {  			Actor_Set_Goal_Number(kActorSteele, 1); @@ -399,11 +399,11 @@ void AIScriptSteele::ClickedByPlayer() {  void AIScriptSteele::EnteredScene(int sceneId) {  	if (Actor_Query_Goal_Number(kActorSteele) == 2) { -		if (!Game_Flag_Query(kFlagChopstickWrapperTaken) +		if (!Game_Flag_Query(kFlagRC51ChopstickWrapperTaken)  		 &&  Random_Query(1, 3) == 1  		) {  			Actor_Clue_Acquire(kActorSteele, kClueChopstickWrapper, true, -1); -			Game_Flag_Set(kFlagChopstickWrapperTaken); +			Game_Flag_Set(kFlagRC51ChopstickWrapperTaken);  			if (Game_Flag_Query(kFlagRC51Discovered)) {  				Item_Remove_From_World(kItemChopstickWrapper); @@ -413,11 +413,11 @@ void AIScriptSteele::EnteredScene(int sceneId) {  			return;  //true;  		} -		if (!Game_Flag_Query(kFlagCandyTaken) +		if (!Game_Flag_Query(kFlagRC51CandyTaken)  		 &&  Random_Query(1, 3) == 1  		) {  			Actor_Clue_Acquire(kActorSteele, kClueCandy, true, -1); -			Game_Flag_Set(kFlagCandyTaken); +			Game_Flag_Set(kFlagRC51CandyTaken);  			if (Game_Flag_Query(kFlagRC51Discovered)) {  				Item_Remove_From_World(kItemCandy); @@ -425,11 +425,11 @@ void AIScriptSteele::EnteredScene(int sceneId) {  			return; //true;  		} -		if (!Game_Flag_Query(kFlagToyDogTaken) +		if (!Game_Flag_Query(kFlagRC51ToyDogTaken)  		 &&  Random_Query(1, 20) == 1  		) {  			Actor_Clue_Acquire(kActorSteele, kClueToyDog, true, -1); -			Game_Flag_Set(kFlagToyDogTaken); +			Game_Flag_Set(kFlagRC51ToyDogTaken);  			if (Game_Flag_Query(kFlagRC51Discovered)) {  				Item_Remove_From_World(kItemToyDog); @@ -440,11 +440,11 @@ void AIScriptSteele::EnteredScene(int sceneId) {  	if ( Actor_Query_Goal_Number(kActorSteele) == 5  	 &&  Actor_Query_In_Set(kActorSteele, kSetCT03_CT04) -	 &&  Game_Flag_Query(kFlagMcCoyKilledHomeless) -	 && !Game_Flag_Query(kFlagHomelessBodyInDumpster) -	 && !Game_Flag_Query(kFlagHomelessBodyFound) +	 &&  Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy) +	 && !Game_Flag_Query(kFlagCT04HomelessBodyInDumpster) +	 && !Game_Flag_Query(kFlagCT04HomelessBodyFound)  	) { -		Game_Flag_Set(kFlagHomelessBodyFound); +		Game_Flag_Set(kFlagCT04HomelessBodyFound);  		return; //true;  	} @@ -931,8 +931,8 @@ bool AIScriptSteele::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	case 233:  		Game_Flag_Set(kFlagHF01toHF03); -		Game_Flag_Reset(kFlagMcCoyAtNRxx); -		Game_Flag_Set(kFlagMcCoyAtHFxx); +		Game_Flag_Reset(kFlagMcCoyInNightclubRow); +		Game_Flag_Set(kFlagMcCoyInHysteriaHall);  		Actor_Put_In_Set(kActorSteele, kSetHF03);  		Actor_Set_At_XYZ(kActorSteele, 291.0f, 47.76f, -892.0f, 453);  		Set_Enter(kSetHF03, kSceneHF03); @@ -1265,25 +1265,25 @@ bool AIScriptSteele::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		return true;  	case 290: -		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -281.0f, 31.93f, -1061.0f, 0, 0, 1, 0); -		Actor_Face_Heading(kActorMcCoy, 45, 0); -		Loop_Actor_Travel_Stairs(kActorMcCoy, 3, 0, kAnimationModeIdle); +		Loop_Actor_Walk_To_XYZ(kActorMcCoy, -281.0f, 31.93f, -1061.0f, 0, false, true, 0); +		Actor_Face_Heading(kActorMcCoy, 45, false); +		Loop_Actor_Travel_Stairs(kActorMcCoy, 3, false, kAnimationModeIdle);  		Global_Variable_Set(1, 4);  		Scene_Exits_Enable();  		Actor_Set_Health(kActorMcCoy, 50, 50);  		Game_Flag_Set(523); -		Game_Flag_Set(343); +		Game_Flag_Set(kFlagNR01toUG06);  		Game_Flag_Set(680); -		Chapter_Enter(4, 79, 91); +		Chapter_Enter(4, kSetUG06, kSceneUG06);  		return true;  	case 291:  		Game_Flag_Set(722); -		Global_Variable_Set(1, 4); +		Global_Variable_Set(kVariableChapter, 4);  		Scene_Exits_Enable();  		Game_Flag_Set(523);  		Game_Flag_Set(680); -		Chapter_Enter(4, 79, 91); +		Chapter_Enter(4, kSetUG06, kSceneUG06);  		return true;  	case 300: diff --git a/engines/bladerunner/script/ai/transient.cpp b/engines/bladerunner/script/ai/transient.cpp index b5f42bdc72..62d3c02090 100644 --- a/engines/bladerunner/script/ai/transient.cpp +++ b/engines/bladerunner/script/ai/transient.cpp @@ -56,16 +56,16 @@ bool AIScriptTransient::Update() {  	}  	if ( Global_Variable_Query(kVariableChapter) == 3 -	 &&  Game_Flag_Query(kFlagMcCoyKilledHomeless) -	 &&  Game_Flag_Query(kFlagHomelessBodyInDumpster) -	 && !Game_Flag_Query(kFlagHomelessBodyFound) -	 && !Game_Flag_Query(kFlagDumpsterEmptied) +	 &&  Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy) +	 &&  Game_Flag_Query(kFlagCT04HomelessBodyInDumpster) +	 && !Game_Flag_Query(kFlagCT04HomelessBodyFound) +	 && !Game_Flag_Query(kFlagCT04HomelessBodyThrownAway)  	) { -		Game_Flag_Set(kFlagDumpsterEmptied); +		Game_Flag_Set(kFlagCT04HomelessBodyThrownAway);  	}  	if (Global_Variable_Query(kVariableChapter) < 4 -	 && Game_Flag_Query(kFlagHomelessBodyFound) +	 && Game_Flag_Query(kFlagCT04HomelessBodyFound)  	 && Actor_Query_Goal_Number(kActorTransient) != 6  	 && Actor_Query_Goal_Number(kActorTransient) != 599  	) { @@ -163,7 +163,7 @@ bool AIScriptTransient::ShotAtAndHit() {  		Actor_Set_Goal_Number(kActorTransient, 599);  	} -	Game_Flag_Set(kFlagMcCoyKilledHomeless); +	Game_Flag_Set(kFlagCT04HomelessKilledByMcCoy);  	return false;  } diff --git a/engines/bladerunner/script/ai/zuben.cpp b/engines/bladerunner/script/ai/zuben.cpp index 47e74f7158..af1d64cfd8 100644 --- a/engines/bladerunner/script/ai/zuben.cpp +++ b/engines/bladerunner/script/ai/zuben.cpp @@ -53,15 +53,17 @@ bool AIScriptZuben::Update() {  		Actor_Put_In_Set(kActorZuben, kSetFreeSlotI);  		Actor_Set_At_Waypoint(kActorZuben, 41, 0);  	} +  	if ( Actor_Query_Goal_Number(kActorZuben) == kGoalZubenDefault  	 &&  Player_Query_Current_Scene() == kSceneCT01 -	 && !Game_Flag_Query(kFlagZubenCheckOnMcCoy) +	 && !Game_Flag_Query(kFlagCT01ZubenMcCoyCheck)  	) {  		AI_Countdown_Timer_Reset(kActorZuben, 2);  		AI_Countdown_Timer_Start(kActorZuben, 2, 30); -		Game_Flag_Set(kFlagZubenCheckOnMcCoy); +		Game_Flag_Set(kFlagCT01ZubenMcCoyCheck);  		return true;  	} +  	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenDefault  	 && Actor_Query_Friendliness_To_Other(kActorZuben, kActorMcCoy) < 48  	 && Actor_Query_Is_In_Current_Set(kActorZuben) @@ -72,9 +74,10 @@ bool AIScriptZuben::Update() {  			Actor_Clue_Acquire(kActorZuben, kClueMcCoysDescription, true, -1);  		}  		Game_Flag_Set(kFlagCT01ZubenLeft); -		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT01Leave); +		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT01WalkToCT02);  		return true;  	} +  	if ( Global_Variable_Query(kVariableChapter) >= 4  	 && !Game_Flag_Query(kFlagZubenRetired)  	 &&  Actor_Query_Goal_Number(kActorZuben) < 200 @@ -83,6 +86,7 @@ bool AIScriptZuben::Update() {  		Actor_Set_Goal_Number(kActorZuben, 200);  		return true;  	} +  	if ( Global_Variable_Query(kVariableChapter) == 5  	 && !Game_Flag_Query(kFlagZubenRetired)  	 &&  Actor_Query_Goal_Number(kActorZuben) < 400 @@ -91,17 +95,19 @@ bool AIScriptZuben::Update() {  		Actor_Set_Goal_Number(kActorZuben, 400);  		return true;  	} +  	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06AttackMcCoy  	 && Player_Query_Current_Scene() == kSceneCT07  	) {  		AI_Countdown_Timer_Reset(kActorZuben, 0); -		Game_Flag_Set(kFlagWarehouseOpen); +		Game_Flag_Set(kFlagCT05WarehouseOpen);  		Actor_Set_Targetable(kActorZuben, true); -		if (Actor_Query_Goal_Number(kActorGordo) == 0) { -			Actor_Set_Goal_Number(kActorGordo, 1); +		if (Actor_Query_Goal_Number(kActorGordo) == kGoalGordoDefault) { +			Actor_Set_Goal_Number(kActorGordo, kGoalGordoLeaveCT01);  		}  		return true;  	} +  	if ( Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT02PotDodgeCheck  	 && !Game_Flag_Query(kFlagCT02ZubenFled)  	) { @@ -119,12 +125,12 @@ void AIScriptZuben::TimerExpired(int timer) {  		) {  			Actor_Modify_Friendliness_To_Other(kActorZuben, kActorMcCoy, -1);  		} -		Game_Flag_Reset(kFlagZubenCheckOnMcCoy); +		Game_Flag_Reset(kFlagCT01ZubenMcCoyCheck);  		// return true;  	} else if (timer == 1) { -		if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT02Flee) { // Zuben fleeing, after 10s +		if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT02RunToFreeSlotG) { // Zuben fleeing, after 10s  			Music_Stop(10); -			Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT06Hide); +			Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT06HideAtFreeSlotA);  			AI_Countdown_Timer_Reset(kActorZuben, 1);  			// return true;  		} @@ -140,16 +146,16 @@ void AIScriptZuben::TimerExpired(int timer) {  }  void AIScriptZuben::CompletedMovementTrack() { -	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT02Flee +	if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT02RunToFreeSlotG  	 && Game_Flag_Query(kFlagCT02McCoyFell)  	) {  		Set_Enter(kSetCT03_CT04, kSceneCT03);  	}  	if (Actor_Query_Goal_Number(kActorZuben) == 3) { // not set anywhere -		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT07Leave); +		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT07RunToFreeSlotA);  		//return true; -	} else if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06Hide +	} else if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT06HideAtFreeSlotA  	        && Game_Flag_Query(kFlagCT02McCoyFell)  	) {  		AI_Countdown_Timer_Reset(kActorZuben, 0); @@ -164,7 +170,7 @@ void AIScriptZuben::CompletedMovementTrack() {  		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT02OpenDoor);  		//return true;  	} else { -		if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT07Leave) { +		if (Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT07RunToFreeSlotA) {  			Music_Stop(2);  			Sound_Play(574, 40, 100, 100, 50);  			Delay(2000); @@ -264,7 +270,7 @@ void AIScriptZuben::ShotAtAndMissed() {  bool AIScriptZuben::ShotAtAndHit() {  	Game_Flag_Set(kFlagMcCoyShotAtZuben); -	if ( Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT07Leave +	if ( Actor_Query_Goal_Number(kActorZuben) == kGoalZubenCT07RunToFreeSlotA  	 && !Actor_Clue_Query(kActorZuben, kClueMcCoyShotZubenInTheBack)  	) {  		Actor_Clue_Acquire(kActorZuben, kClueMcCoyShotZubenInTheBack, true, -1); @@ -306,14 +312,15 @@ int AIScriptZuben::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueI  bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	switch (newGoalNumber) { -	case kGoalZubenCT01Leave: +	case kGoalZubenCT01WalkToCT02:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append(kActorZuben, 86, 0);  		AI_Movement_Track_Append(kActorZuben, 106, 0);  		AI_Movement_Track_Append_With_Facing(kActorZuben, 45, 0, 481);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; -	case kGoalZubenCT02Flee: + +	case kGoalZubenCT02RunToFreeSlotG:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 84, 0);  		AI_Movement_Track_Append_Run(kActorZuben, 85, 0); @@ -324,6 +331,7 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Countdown_Timer_Start(kActorZuben, 0, 70);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case kGoalZubenCT07Spared:  		AI_Movement_Track_Flush(kActorZuben);  		Actor_Face_Actor(kActorZuben, kActorMcCoy, true); @@ -343,14 +351,16 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  			Actor_Clue_Acquire(kActorZuben, kClueMcCoyIsABladeRunner, true, -1);  		}  		Actor_Clue_Acquire(kActorZuben, kClueMcCoyLetZubenEscape, true, -1); -		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT07Leave); +		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT07RunToFreeSlotA);  		return false; -	case kGoalZubenCT07Leave: + +	case kGoalZubenCT07RunToFreeSlotA:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 94, 0);  		AI_Movement_Track_Append_Run(kActorZuben, 33, 0);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case kGoalZubenDie:  		Game_Flag_Set(kFlagZubenRetired);  		Game_Flag_Set(kFlagCT01ZubenGone); @@ -364,20 +374,24 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		}  		Actor_Set_Goal_Number(kActorZuben, kGoalZubenDead);  		return false; +  	case kGoalZubenCT02PushPot:  		_animationFrame = 0;  		_animationState = 26;  		return false; +  	case kGoalZubenCT02RunToDoor:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 46, 0);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case kGoalZubenCT02OpenDoor:  		Actor_Face_Heading(kActorZuben, kActorMcCoy, false);  		_animationFrame = 0;  		_animationState = 27;  		return false; +  	case kGoalZubenCT06JumpDown:  		AI_Countdown_Timer_Reset(kActorZuben, 0);  		Actor_Put_In_Set(kActorZuben, kSetCT06); @@ -385,6 +399,7 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		_animationFrame = 0;  		_animationState = 28;  		return false; +  	case kGoalZubenCT06AttackMcCoy:  		Player_Loses_Control();  		if (!Player_Query_Combat_Mode()) { @@ -394,7 +409,8 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		Game_Flag_Set(kFlagNotUsed142);  		Set_Enter(kSetCT07, kSceneCT07);  		return false; -	case kGoalZubenCT06Hide: + +	case kGoalZubenCT06HideAtFreeSlotA:  		Actor_Set_Targetable(kActorZuben, true);  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 51, 0); @@ -402,6 +418,7 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		AI_Movement_Track_Append(kActorZuben, 33, 1);  // Hide Zuben  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case kGoalZubenCT02PotDodgeCheck:  		if (Actor_Query_Goal_Number(kActorMcCoy) != kGoalMcCoyDodge) {  			Player_Loses_Control(); @@ -411,29 +428,34 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  		}  		Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT02RunToDoor);  		return false; +  	case kGoalZubenMA01AttackMcCoy: -		Game_Flag_Set(kFlagWarehouseOpen); +		Game_Flag_Set(kFlagCT05WarehouseOpen);  		Actor_Set_Targetable(kActorZuben, true);  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 125, 0);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; -	case 22: + +	case 22: // is never set  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 125, 0);  		AI_Movement_Track_Append_Run(kActorZuben, 33, 0);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case 99:  		AI_Movement_Track_Flush(kActorZuben);  		Scene_Exits_Enable();  		Music_Stop(2);  		return false; +  	case 100:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 33, 3);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case 105:  		{  			int rnd1 = Random_Query(1, 3); @@ -508,11 +530,13 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	case 106:  		Actor_Set_Goal_Number(kActorZuben, 105);  		return true; +  	case 200:  		AI_Movement_Track_Flush(kActorZuben);  		AI_Movement_Track_Append_Run(kActorZuben, 33, 3);  		AI_Movement_Track_Repeat(kActorZuben);  		return false; +  	case 205:  		switch (Random_Query(1, 8)) {  		case 1: @@ -591,9 +615,11 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) {  			break;  		}  		return false; +  	case 206:  		Actor_Set_Goal_Number(kActorZuben, 205);  		return true; +  	case 400:  		AI_Movement_Track_Flush(kActorZuben);  		Actor_Put_In_Set(kActorZuben, kSetFreeSlotA); @@ -950,7 +976,7 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) {  			Actor_Set_Frame_Rate_FPS(kActorZuben, -2);  			_animationState = 0;  			_animationFrame = 0; -			Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT02Flee); +			Actor_Set_Goal_Number(kActorZuben, kGoalZubenCT02RunToFreeSlotG);  		}  		break;  	case 28: @@ -1164,6 +1190,7 @@ void AIScriptZuben::dialogue() {  		Actor_Says(kActorMcCoy, 7310, 16);  		Actor_Says(kActorZuben, 190, 15);  		break; +  	case 1500:  		Actor_Says(kActorMcCoy, 7295, 11);  		Actor_Says(kActorZuben, 200, 12); @@ -1188,6 +1215,7 @@ void AIScriptZuben::dialogue() {  			Actor_Clue_Acquire(kActorMcCoy, kClueZubenTalksAboutLucy2, false, kActorZuben);  		}  		break; +  	case 1510:  		Actor_Says(kActorMcCoy, 7300, 13);  		Actor_Says(kActorZuben, 280, 12); @@ -1202,6 +1230,7 @@ void AIScriptZuben::dialogue() {  		Actor_Says(kActorZuben, 330, 12);  		Actor_Clue_Acquire(kActorMcCoy, kClueZubensMotive, false, kActorZuben);  		break; +  	case 1520:  		Actor_Says(kActorZuben, 160, 13);  		Actor_Says(kActorMcCoy, 7305, 15);  | 
