diff options
| author | Peter Kohaut | 2019-01-26 14:31:04 +0100 | 
|---|---|---|
| committer | Peter Kohaut | 2019-01-26 14:31:04 +0100 | 
| commit | 71c262f88183720a0710a7627b4db324e8d3f66c (patch) | |
| tree | f2eb290108426fa6879e60b5a0229e09f800d929 | |
| parent | bff136ca0c3974525ade5c42b2f3975299c03695 (diff) | |
| download | scummvm-rg350-71c262f88183720a0710a7627b4db324e8d3f66c.tar.gz scummvm-rg350-71c262f88183720a0710a7627b4db324e8d3f66c.tar.bz2 scummvm-rg350-71c262f88183720a0710a7627b4db324e8d3f66c.zip | |
BLADERUNNER: Analysed Leon scene at Yukon Hotel
| -rw-r--r-- | engines/bladerunner/game_constants.h | 26 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai/desk_clerk.cpp | 166 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai/leon.cpp | 344 | ||||
| -rw-r--r-- | engines/bladerunner/script/ai_script.h | 14 | ||||
| -rw-r--r-- | engines/bladerunner/script/scene/ct09.cpp | 98 | 
5 files changed, 347 insertions, 301 deletions
| diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index bcaa6733ed..996635964b 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -893,6 +893,9 @@ enum Flags {  	kFlagTB06DogCollarTaken = 519,  	kFlagTB06KitchenBoxTaken = 520,  	kFlagCT11toDR01 = 531, +	kFlagCT09Entered = 538, +	kFlagCT09LeonInterrupted = 539, +	kFlagCT09DeskClerkTalk = 540,  	kFlagGordoTalk1 = 543,  	kFlagGordoTalk2 = 544,  	kFlagDR06MannequinHeadOpen = 548, @@ -1065,8 +1068,8 @@ enum Scenes {  	kSceneCT03 = 15, // Chinatown - Back alley - Restaurant  	kSceneCT04 = 16, // Chinatown - Back alley - Dumpster  	kSceneCT05 = 17, // Chinatown - Warehouse - Inside -	kSceneCT06 = 18, // Chinatown - Passage from front -	kSceneCT07 = 19, // Chinatown - Passage form back +	kSceneCT06 = 18, // Chinatown - Passage - front +	kSceneCT07 = 19, // Chinatown - Passage - back  	kSceneCT08 = 20, // Chinatown - Yukon Hotel - Backroom  	kSceneCT09 = 21, // Chinatown - Yukon Hotel - Lobby  	kSceneCT10 = 22, // Chinatown - Yukon Hotel - Room @@ -1607,6 +1610,13 @@ enum GoalOfficerLeary {  	kGoalOfficerLearyRC01CrowdInterrogation = 2  }; +enum GoalDeskClerk { +	kGoalDeskClerkDefault = 0, +	kGoalDeskClerkKnockedOut = 1, +	kGoalDeskClerkRecovered = 2, +	kGoalDeskClerkGone = 400 +}; +  enum GoalMoraji {  	kGoalMorajiDefault = 0,  	kGoalMorajiShot = 5, @@ -1622,6 +1632,18 @@ enum GoalMoraji {  	kGoalMorajiPerished = 99  }; +enum GoalLeon { +	kGoalLeonDefault = 0, +	kGoalLeonHoldingDeskClerk = 1, +	kGoalLeonReleaseDeskClerk = 2, +	kGoalLeonPrepareTalkToMcCoy = 3, +	kGoalLeonTalkToMcCoy = 4, +	kGoalLeonApproachMcCoy = 5, // there is no way how to trigger this path in the game +	kGoalLeonPunchMcCoy = 6, // there is no way how to trigger this path in the game +	kGoalLeonLeave = 7, +	kGoalLeonGone = 8 +}; +  } // End of namespace BladeRunner  #endif diff --git a/engines/bladerunner/script/ai/desk_clerk.cpp b/engines/bladerunner/script/ai/desk_clerk.cpp index 6af7d5d4ca..f723b3335b 100644 --- a/engines/bladerunner/script/ai/desk_clerk.cpp +++ b/engines/bladerunner/script/ai/desk_clerk.cpp @@ -25,8 +25,8 @@  namespace BladeRunner {  AIScriptDeskClerk::AIScriptDeskClerk(BladeRunnerEngine *vm) : AIScriptBase(vm) { -	_var1 = 0; -	_var2 = 0; +	_flag1 = false; +	_flag2 = false;  	_var3 = 75;  } @@ -36,29 +36,32 @@ void AIScriptDeskClerk::Initialize() {  	_animationStateNext = 0;  	_animationNext = 0; -	_var1 = 0; -	_var2 = 0; +	_flag1 = false; +	_flag2 = false;  	_var3 = 75; -	Actor_Set_Goal_Number(kActorDeskClerk, 0); +	Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkDefault);  }  bool AIScriptDeskClerk::Update() { -	if (Actor_Query_Goal_Number(kActorDeskClerk) == 1 -			&& Player_Query_Current_Set() != kSetCT01_CT12 -			&& Player_Query_Current_Set() != kSetCT03_CT04 -			&& Player_Query_Current_Set() != kSetCT08_CT51_UG12 -			&& Player_Query_Current_Set() != kSetCT02 -			&& Player_Query_Current_Set() != kSetCT05 -			&& Player_Query_Current_Set() != kSetCT06 -			&& Player_Query_Current_Set() != kSetCT07 -			&& Player_Query_Current_Set() != kSetCT09 -			&& Player_Query_Current_Set() != kSetCT10 -			&& Player_Query_Current_Set() != kSetCT11) { -		Actor_Set_Goal_Number(kActorDeskClerk, 2); +	if (Actor_Query_Goal_Number(kActorDeskClerk) == kGoalDeskClerkKnockedOut +	 && Player_Query_Current_Set() != kSetCT01_CT12 +	 && Player_Query_Current_Set() != kSetCT03_CT04 +	 && Player_Query_Current_Set() != kSetCT08_CT51_UG12 +	 && Player_Query_Current_Set() != kSetCT02 +	 && Player_Query_Current_Set() != kSetCT05 +	 && Player_Query_Current_Set() != kSetCT06 +	 && Player_Query_Current_Set() != kSetCT07 +	 && Player_Query_Current_Set() != kSetCT09 +	 && Player_Query_Current_Set() != kSetCT10 +	 && Player_Query_Current_Set() != kSetCT11 +	) { +		Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkRecovered);  	} -	if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_Goal_Number(kActorDeskClerk) < 400) { -		Actor_Set_Goal_Number(kActorDeskClerk, 400); +	if (Global_Variable_Query(kVariableChapter) == 5 +	 && Actor_Query_Goal_Number(kActorDeskClerk) < kGoalDeskClerkGone +	) { +		Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkGone);  	}  	return false; @@ -114,13 +117,13 @@ int AIScriptDeskClerk::GetFriendlinessModifierIfGetsClue(int otherActorId, int c  bool AIScriptDeskClerk::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	switch (newGoalNumber) { -	case 0: -	case 2: +	case kGoalDeskClerkDefault: +	case kGoalDeskClerkRecovered:  		Actor_Put_In_Set(kActorDeskClerk, kSetCT09);  		Actor_Set_At_XYZ(kActorDeskClerk, 282.0f, 360.52f, 743.0f, 513);  		break; -	case 1: -	case 400: +	case kGoalDeskClerkKnockedOut: +	case kGoalDeskClerkGone:  		Actor_Put_In_Set(kActorDeskClerk, kSetFreeSlotH);  		Actor_Set_At_Waypoint(kActorDeskClerk, 40, 0);  		break; @@ -129,61 +132,49 @@ bool AIScriptDeskClerk::GoalChanged(int currentGoalNumber, int newGoalNumber) {  }  bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) { -	int frameRes;  	switch (_animationState) {  	case 0: -		if (_var1 > 1) { -			frameRes = _animationFrame; -		} else if (_var1) { +		if (_flag1) {  			*animation = 662;  			_animationFrame++; -  			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(662)) {  				_animationFrame = 0; -				_var1 = 0; +				_flag1 = false;  				*animation = 661;  				_var3 = Random_Query(50, 100);  			} -			frameRes = _animationFrame;  		} else { -			if (_var3) +			if (_var3 != 0) {  				--_var3; +			}  			*animation = 661;  			_animationFrame++; - -			if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(661)) { -				frameRes = _animationFrame; -			} else { +			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(661)) {  				_animationFrame = 0; -				if (!_var3) { +				if (_var3 == 0) {  					*animation = 662; -					_var1 = 1; +					_flag1 = true;  				} - -				frameRes = _animationFrame;  			}  		}  		break;  	case 1: -		frameRes = _animationFrame;  		*animation = 663; -		if (!frameRes && _var2) { +		if (_animationFrame == 0 +		 && _flag2 +		) {  			*animation = 661;  			_animationState = 0; -			_var1 = 0; +			_flag1 = false;  		} else {  			_animationFrame++; - -			if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation)) { -				frameRes = _animationFrame; -			} else { +			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {  				_animationFrame = 0; -				frameRes = 0;  			}  		}  		break; @@ -191,12 +182,8 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 2:  		*animation = 664;  		_animationFrame++; - -		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(664)) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(664)) {  			_animationFrame = 0; -			frameRes = 0;  			_animationState = 1;  			*animation = 663;  		} @@ -205,12 +192,8 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 3:  		*animation = 665;  		_animationFrame++; - -		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(665)) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(665)) {  			_animationFrame = 0; -			frameRes = 0;  			_animationState = 1;  			*animation = 663;  		} @@ -219,12 +202,8 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 4:  		*animation = 666;  		_animationFrame++; - -		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(666)) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(666)) {  			_animationFrame = 0; -			frameRes = 0;  			_animationState = 1;  			*animation = 663;  		} @@ -233,12 +212,8 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 5:  		*animation = 667;  		_animationFrame++; - -		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(667)) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(667)) {  			_animationFrame = 0; -			frameRes = 0;  			_animationState = 1;  			*animation = 663;  		} @@ -247,31 +222,24 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 6:  		*animation = 668;  		_animationFrame++; - -		if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(668)) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(668)) {  			_animationFrame = 0; -			frameRes = 0;  		}  		break;  	case 7:  		*animation = 669; -		if (!_animationFrame && _var2) { +		if (_animationFrame == 0 +		 && _flag2 +		) {  			Actor_Change_Animation_Mode(kActorDeskClerk, 72);  			*animation = 668;  			_animationState = 6; -			frameRes = _animationFrame;  		} else {  			_animationFrame++; - -			if (_animationFrame < Slice_Animation_Query_Number_Of_Frames(*animation)) { -				frameRes = _animationFrame; -			} else { +			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {  				_animationFrame = 0; -				frameRes = 0;  			}  		}  		break; @@ -279,33 +247,24 @@ bool AIScriptDeskClerk::UpdateAnimation(int *animation, int *frame) {  	case 8:  		*animation = 670;  		_animationFrame++; - -		if (_animationFrame <= Slice_Animation_Query_Number_Of_Frames(670) - 2) { -			frameRes = _animationFrame; -		} else { +		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(670) - 2) {  			Ambient_Sounds_Play_Sound(206, 40, 30, 30, 99); -			Actor_Set_Goal_Number(kActorDeskClerk, 1); -			Actor_Change_Animation_Mode(kActorDeskClerk, 0); +			Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkKnockedOut); +			Actor_Change_Animation_Mode(kActorDeskClerk, kAnimationModeIdle);  			*animation = 661;  			_animationFrame = 0; -			frameRes = 0;  			_animationState = 0;  		}  		break; - -	default: -		frameRes = _animationFrame; -		break;  	} -	*frame = frameRes; - +	*frame = _animationFrame;  	return true;  }  bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {  	switch (mode) { -	case 0: +	case kAnimationModeIdle:  		switch (_animationState) {  		case 0:  			_animationState = 8; @@ -317,7 +276,7 @@ bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {  		case 3:  		case 4:  		case 5: -			_var2 = 1; +			_flag2 = true;  			break;  		case 6: @@ -327,40 +286,40 @@ bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {  		default:  			_animationState = 0;  			_animationFrame = 0; -			_var1 = 0; +			_flag1 = false;  			_var3 = Random_Query(70, 140);  			break;  		}  		break; -	case 3: +	case kAnimationModeTalk:  		_animationState = 1;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 12:  		_animationState = 2;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 13:  		_animationState = 3;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 14:  		_animationState = 4;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 15:  		_animationState = 5;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 26: @@ -371,7 +330,7 @@ bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {  	case 58:  		_animationState = 7;  		_animationFrame = 0; -		_var2 = 0; +		_flag2 = false;  		break;  	case 72: @@ -380,9 +339,6 @@ bool AIScriptDeskClerk::ChangeAnimationMode(int mode) {  			_animationFrame = 0;  		}  		break; - -	default: -		break;  	}  	return true; diff --git a/engines/bladerunner/script/ai/leon.cpp b/engines/bladerunner/script/ai/leon.cpp index bbb940eea9..0e1a1156ce 100644 --- a/engines/bladerunner/script/ai/leon.cpp +++ b/engines/bladerunner/script/ai/leon.cpp @@ -25,17 +25,17 @@  namespace BladeRunner {  AIScriptLeon::AIScriptLeon(BladeRunnerEngine *vm) : AIScriptBase(vm) { -	var_45EDA0_z = 0.0f; -	var_45EDA4_y = 0.0f; -	var_45EDA8_x = 0.0f; -	var_45EDAC = 0; +	_mcCoyPositionX = 0.0f; +	_mcCoyPositionY = 0.0f; +	_mcCoyPositionZ = 0.0f; +	_flag = false;  }  void AIScriptLeon::Initialize() { -	var_45EDA0_z = 0.0f; -	var_45EDA4_y = 0.0f; -	var_45EDA8_x = 0.0f; -	var_45EDAC = 0; +	_mcCoyPositionX = 0.0f; +	_mcCoyPositionY = 0.0f; +	_mcCoyPositionZ = 0.0f; +	_flag = false;  	_animationStateNext = 0;  	_animationNext = 0;  	_animationFrame = 0; @@ -44,22 +44,28 @@ void AIScriptLeon::Initialize() {  bool AIScriptLeon::Update() {  	int goalNumber = Actor_Query_Goal_Number(kActorLeon); -	if (goalNumber == 3) { -		Actor_Set_Goal_Number(kActorLeon, 4); + +	if (goalNumber == kGoalLeonPrepareTalkToMcCoy) { +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonTalkToMcCoy);  		return true;  	} -	if (goalNumber == 5) { -		if (Player_Query_Combat_Mode() == 1) { -			Actor_Set_Goal_Number(kActorLeon, 7); + +	if (goalNumber == kGoalLeonApproachMcCoy) { +		if (Player_Query_Combat_Mode()) { +			Actor_Set_Goal_Number(kActorLeon, kGoalLeonLeave);  			return true;  		} -		if (Actor_Query_Inch_Distance_From_Actor(kActorLeon, 0) <= 36 && !Player_Query_Combat_Mode()) { -			Actor_Set_Goal_Number(kActorLeon, 6); + +		if ( Actor_Query_Inch_Distance_From_Actor(kActorLeon, kActorMcCoy) <= 36 +		 && !Player_Query_Combat_Mode() +		) { +			Actor_Set_Goal_Number(kActorLeon, kGoalLeonPunchMcCoy);  			return true;  		} -		if (sub_446700(kActorLeon, var_45EDA8_x, var_45EDA4_y, var_45EDA0_z) > 12.0f) { -			Actor_Query_XYZ(kActorMcCoy, &var_45EDA8_x, &var_45EDA4_y, &var_45EDA0_z); -			Async_Actor_Walk_To_XYZ(kActorLeon, var_45EDA8_x, var_45EDA4_y, var_45EDA0_z, 24, false); + +		if (distanceTo(kActorLeon, _mcCoyPositionX, _mcCoyPositionY, _mcCoyPositionZ) > 12.0f) { +			Actor_Query_XYZ(kActorMcCoy, &_mcCoyPositionX, &_mcCoyPositionY, &_mcCoyPositionZ); +			Async_Actor_Walk_To_XYZ(kActorLeon, _mcCoyPositionX, _mcCoyPositionY, _mcCoyPositionZ, 24, false);  		}  		return true;  	} @@ -67,14 +73,16 @@ bool AIScriptLeon::Update() {  }  void AIScriptLeon::TimerExpired(int timer) { -	if (timer == 0 && Actor_Query_Goal_Number(kActorLeon) == 7) { +	if (timer == 0 +	 && Actor_Query_Goal_Number(kActorLeon) == kGoalLeonLeave +	) {  		AI_Countdown_Timer_Reset(kActorLeon, 0); -		Actor_Set_Goal_Number(kActorLeon, 8); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonGone);  	}  }  void AIScriptLeon::CompletedMovementTrack() { -	if (Actor_Query_Goal_Number(kActorLeon) == 7) { +	if (Actor_Query_Goal_Number(kActorLeon) == kGoalLeonLeave) {  		AI_Countdown_Timer_Reset(kActorLeon, 0);  		AI_Countdown_Timer_Start(kActorLeon, 0, 8);  		//return true; @@ -85,13 +93,13 @@ void AIScriptLeon::CompletedMovementTrack() {  void AIScriptLeon::ReceivedClue(int clueId, int fromActorId) {}  void AIScriptLeon::ClickedByPlayer() { -	if (Actor_Query_Goal_Number(kActorLeon) == 1) { -		Game_Flag_Set(539); +	if (Actor_Query_Goal_Number(kActorLeon) == kGoalLeonHoldingDeskClerk) { +		Game_Flag_Set(kFlagCT09LeonInterrupted);  		Player_Loses_Control();  		Actor_Face_Actor(kActorMcCoy, kActorLeon, true);  		ADQ_Flush(); -		Actor_Says(kActorMcCoy, 495, 3); -		Actor_Set_Goal_Number(kActorLeon, 2); +		Actor_Says(kActorMcCoy, 495, kAnimationModeTalk); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonReleaseDeskClerk);  		//return true;  	}  	//return false; @@ -100,7 +108,9 @@ void AIScriptLeon::ClickedByPlayer() {  void AIScriptLeon::EnteredScene(int sceneId) {}  void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) { -	if (otherActorId == kActorMcCoy && Actor_Query_Goal_Number(kActorLeon) == 7) { +	if (otherActorId == kActorMcCoy +	 && Actor_Query_Goal_Number(kActorLeon) == kGoalLeonLeave +	) {  		AI_Countdown_Timer_Reset(kActorLeon, 0);  		AI_Movement_Track_Flush(kActorLeon);  		AI_Movement_Track_Append(kActorLeon, 353, 0); @@ -111,23 +121,28 @@ void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) {  }  void AIScriptLeon::OtherAgentExitedThisScene(int otherActorId) { -	if (otherActorId == kActorMcCoy && Actor_Query_Which_Set_In(kActorLeon) == 33) { +	if (otherActorId == kActorMcCoy +	 && Actor_Query_Which_Set_In(kActorLeon) == kSetCT11 +	) {  		AI_Movement_Track_Flush(kActorLeon);  		ADQ_Flush(); -		Actor_Set_Goal_Number(kActorLeon, 8); -		Actor_Set_Goal_Number(kActorDeskClerk, 1); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonGone); +		Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkKnockedOut);  		//return true;  	}  	///return false;  }  void AIScriptLeon::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) { -	if (otherActorId == kActorMcCoy && combatMode == 1 && Actor_Query_Goal_Number(kActorLeon) == 1) { -		Game_Flag_Set(539); +	if (otherActorId == kActorMcCoy +	 && combatMode == 1 +	 && Actor_Query_Goal_Number(kActorLeon) == kGoalLeonHoldingDeskClerk +	) { +		Game_Flag_Set(kFlagCT09LeonInterrupted);  		Player_Loses_Control();  		Actor_Face_Actor(kActorMcCoy, kActorLeon, true); -		Actor_Says(kActorMcCoy, 500, 5); -		Actor_Set_Goal_Number(kActorLeon, 2); +		Actor_Says(kActorMcCoy, 500, kAnimationModeCombatAim); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonReleaseDeskClerk);  		//return true;  	}  	//return false; @@ -136,8 +151,8 @@ void AIScriptLeon::OtherAgentEnteredCombatMode(int otherActorId, int combatMode)  void AIScriptLeon::ShotAtAndMissed() {}  bool AIScriptLeon::ShotAtAndHit() { -	if (Actor_Query_Goal_Number(kActorLeon) != 7) { -		Actor_Set_Goal_Number(kActorLeon, 7); +	if (Actor_Query_Goal_Number(kActorLeon) != kGoalLeonLeave) { +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonLeave);  	}  	return false;  } @@ -150,94 +165,101 @@ int AIScriptLeon::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId  bool AIScriptLeon::GoalChanged(int currentGoalNumber, int newGoalNumber) {  	switch (newGoalNumber) { -	case 8: +	case kGoalLeonDefault:  		Actor_Put_In_Set(kActorLeon, kSetFreeSlotA); -		AI_Movement_Track_Flush(kActorLeon); +		Actor_Change_Animation_Mode(kActorLeon, kAnimationModeIdle);  		return true; -	case 7: -		Actor_Force_Stop_Walking(kActorLeon); -		AI_Movement_Track_Flush(kActorLeon); -		AI_Movement_Track_Append(kActorLeon, 351, 0); -		AI_Movement_Track_Append(kActorLeon, 352, 0); -		AI_Movement_Track_Repeat(kActorLeon); + +	case kGoalLeonHoldingDeskClerk: +		Actor_Change_Animation_Mode(kActorDeskClerk, 72); +		Actor_Change_Animation_Mode(kActorLeon, 72); +		Actor_Put_In_Set(kActorLeon, kSetCT09); +		Actor_Set_At_XYZ(kActorLeon, 264.0f, 348.52f, 827.0f, 0); +		Actor_Face_Actor(kActorDeskClerk, kActorLeon, true); +		ADQ_Add(kActorLeon, 0, 16); +		ADQ_Add(kActorDeskClerk, 0, 58); +		ADQ_Add(kActorLeon, 10, 15); +		ADQ_Add(kActorDeskClerk, 10, 58); +		ADQ_Add(kActorLeon, 20, 16);  		return true; -	case 6: -		Player_Loses_Control(); -		Actor_Says(kActorLeon, 40, 3); -		Actor_Says(kActorMcCoy, 510, 3); -		Actor_Says(kActorLeon, 50, 3); -		Actor_Change_Animation_Mode(kActorLeon, 6); -		return false; -	case 5: + +	case kGoalLeonReleaseDeskClerk: +		Actor_Change_Animation_Mode(kActorLeon, 26); +		Actor_Change_Animation_Mode(kActorDeskClerk, 26);  		return true; -	case 4: + +	case kGoalLeonTalkToMcCoy:  		Actor_Face_Actor(kActorLeon, kActorMcCoy, true);  		Player_Set_Combat_Mode(false);  		Actor_Says(kActorLeon, 30, 12);  		Actor_Face_Actor(kActorMcCoy, kActorLeon, true); -		if (Player_Query_Combat_Mode() == 1) { +		if (Player_Query_Combat_Mode()) {  			Player_Set_Combat_Mode(false);  		}  		Actor_Says(kActorMcCoy, 505, 23);  		Actor_Says(kActorLeon, 60, 13);  		Player_Gains_Control(); -		Loop_Actor_Walk_To_XYZ(kActorLeon, 233.0f, 349.0f, 849.0f, 0, 0, false, 0); -		Actor_Face_Actor(kActorLeon, 0, true); +		Loop_Actor_Walk_To_XYZ(kActorLeon, 233.0f, 349.0f, 849.0f, 0, false, false, 0); +		Actor_Face_Actor(kActorLeon, kActorMcCoy, true);  		Actor_Face_Actor(kActorMcCoy, kActorLeon, true);  		Actor_Says(kActorMcCoy, 515, 18);  		Actor_Says_With_Pause(kActorLeon, 70, 0.3f, 12);  		Actor_Says(kActorMcCoy, 520, 15);  		Actor_Says(kActorLeon, 80, 12); -		Loop_Actor_Walk_To_XYZ(kActorLeon, 198.0f, 349.0f, 865.0f, 0, 0, false, 0); -		Actor_Face_Actor(kActorLeon, 0, true); +		Loop_Actor_Walk_To_XYZ(kActorLeon, 198.0f, 349.0f, 865.0f, 0, false, false, 0); +		Actor_Face_Actor(kActorLeon, kActorMcCoy, true);  		Actor_Face_Actor(kActorMcCoy, kActorLeon, true); -		if (Actor_Clue_Query(kActorMcCoy, kClueWantedPoster)) { +		if (Actor_Clue_Query(kActorMcCoy, kClueWantedPoster)) { // there is no way how to obtain this poster  			Actor_Says_With_Pause(kActorMcCoy, 525, 0.2f, 14);  			Actor_Says(kActorLeon, 90, 13);  			Actor_Says(kActorMcCoy, 530, 16); -			Actor_Set_Goal_Number(kActorLeon, 5); +			Actor_Set_Goal_Number(kActorLeon, kGoalLeonApproachMcCoy);  		} else {  			Actor_Says_With_Pause(kActorMcCoy, 535, 0.8f, 17);  			Actor_Says(kActorLeon, 100, 13);  			Actor_Says_With_Pause(kActorMcCoy, 540, 0.0f, 19); -			Actor_Says(kActorLeon, 110, 3); +			Actor_Says(kActorLeon, 110, kAnimationModeTalk);  			Actor_Says(kActorMcCoy, 550, 17);  			Actor_Says(kActorMcCoy, 555, 18);  			Actor_Says(kActorLeon, 120, 13); -			Actor_Says(kActorMcCoy, 560, 3); -			Actor_Says_With_Pause(kActorLeon, 130, 0.8f, 3); +			Actor_Says(kActorMcCoy, 560, kAnimationModeTalk); +			Actor_Says_With_Pause(kActorLeon, 130, 0.8f, kAnimationModeTalk);  			Actor_Face_Current_Camera(kActorMcCoy, true);  			Actor_Says(kActorMcCoy, 565, 18);  			Actor_Face_Actor(kActorMcCoy, kActorLeon, true);  			Actor_Says(kActorLeon, 140, 12);  			Actor_Says_With_Pause(kActorMcCoy, 570, 0.0f, 17);  			Actor_Says_With_Pause(kActorMcCoy, 575, 1.2f, 13); -			Actor_Says(kActorLeon, 150, 3); -			Actor_Says(kActorMcCoy, 580, 3); +			Actor_Says(kActorLeon, 150, kAnimationModeTalk); +			Actor_Says(kActorMcCoy, 580, kAnimationModeTalk);  			Actor_Says(kActorLeon, 160, 13);  			Actor_Says(kActorLeon, 170, 12); -			Actor_Set_Goal_Number(kActorLeon, 7); +			Actor_Set_Goal_Number(kActorLeon, kGoalLeonLeave);  		}  		return true; -	case 2: -		Actor_Change_Animation_Mode(kActorLeon, 26); -		Actor_Change_Animation_Mode(kActorDeskClerk, 26); + +	case kGoalLeonApproachMcCoy:  		return true; -	case 1: -		Actor_Change_Animation_Mode(kActorDeskClerk, 72); -		Actor_Change_Animation_Mode(kActorLeon, 72); -		Actor_Put_In_Set(kActorLeon, kSetCT09); -		Actor_Set_At_XYZ(kActorLeon, 264.0f, 348.52f, 827.0f, 0); -		Actor_Face_Actor(kActorDeskClerk, kActorLeon, true); -		ADQ_Add(kActorLeon, 0, 16); -		ADQ_Add(kActorDeskClerk, 0, 58); -		ADQ_Add(kActorLeon, 10, 15); -		ADQ_Add(kActorDeskClerk, 10, 58); -		ADQ_Add(kActorLeon, 20, 16); + +	case kGoalLeonPunchMcCoy: +		Player_Loses_Control(); +		Actor_Says(kActorLeon, 40, kAnimationModeTalk); +		Actor_Says(kActorMcCoy, 510, kAnimationModeTalk); +		Actor_Says(kActorLeon, 50, kAnimationModeTalk); +		Actor_Change_Animation_Mode(kActorLeon, kAnimationModeCombatAttack); +		return false; + +	case kGoalLeonLeave: +		Actor_Force_Stop_Walking(kActorLeon); +		AI_Movement_Track_Flush(kActorLeon); +		AI_Movement_Track_Append(kActorLeon, 351, 0); +		AI_Movement_Track_Append(kActorLeon, 352, 0); +		AI_Movement_Track_Repeat(kActorLeon);  		return true; -	case 0: + +	case kGoalLeonGone:  		Actor_Put_In_Set(kActorLeon, kSetFreeSlotA); -		Actor_Change_Animation_Mode(kActorLeon, 0); +		AI_Movement_Track_Flush(kActorLeon);  		return true;  	}  	return false; @@ -245,110 +267,126 @@ bool AIScriptLeon::GoalChanged(int currentGoalNumber, int newGoalNumber) {  bool AIScriptLeon::UpdateAnimation(int *animation, int *frame) {  	switch (_animationState) { -	case 10: -		*animation = 856; -		if (_animationFrame++ == 7) { -			Actor_Change_Animation_Mode(kActorMcCoy, 48); -			Actor_Retired_Here(kActorMcCoy, 12, 12, 1, -1); -		} -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(*animation) - 1) { -			*animation = 847; -			_animationFrame = 0; -			Actor_Change_Animation_Mode(kActorLeon, 0); -		} -		break; -	case 9: -		*animation = 849; -		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(849) - 1) { -			Actor_Change_Animation_Mode(kActorLeon, 0); -			*animation = 847; -			_animationFrame = 0; -			_animationState = 0; -			if (Actor_Query_Goal_Number(kActorLeon) == 2) { -				Actor_Set_Goal_Number(kActorLeon, 3); -			} -		} -		break; -	case 8: -		*animation = 854; +	case 0: +		*animation = 847;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(854) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(847)) {  			_animationFrame = 0;  		}  		break; -	case 7: -		*animation = 855; + +	case 1: +		*animation = 846;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(855) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(846)) {  			_animationFrame = 0; -			_animationState = 6; -			*animation = 854;  		}  		break; -	case 6: -		if (_animationFrame == 0 && var_45EDAC != 0) { -			Actor_Change_Animation_Mode(kActorLeon, 72); -			*animation = 848; + +	case 2: +		if (_animationFrame == 0 +		 && _flag +		) { +			*animation = 847; +			_animationState = 0;  		} else { -			*animation = 854; +			*animation = 850;  			_animationFrame++; -			if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(854) - 1) { +			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(850)) {  				_animationFrame = 0;  			}  		}  		break; -	case 5: -		*animation = 853; + +	case 3: +		*animation = 851;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(853) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(851)) {  			_animationFrame = 0;  			_animationState = 2;  			*animation = 850;  		}  		break; +  	case 4:  		*animation = 852;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(852) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(852)) {  			_animationFrame = 0;  			_animationState = 2;  			*animation = 850;  		}  		break; -	case 3: -		*animation = 851; + +	case 5: +		*animation = 853;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(851) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(853)) {  			_animationFrame = 0;  			_animationState = 2;  			*animation = 850;  		}  		break; -	case 2: -		if (!_animationFrame && var_45EDAC) { -			*animation = 847; -			_animationState = 0; + +	case 6: +		if (_animationFrame == 0 +		 && _flag +		) { +			Actor_Change_Animation_Mode(kActorLeon, 72); +			*animation = 848;  		} else { -			*animation = 850; +			*animation = 854;  			_animationFrame++; -			if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(850) - 1) { +			if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(854)) {  				_animationFrame = 0;  			}  		}  		break; -	case 1: -		*animation = 846; + +	case 7: +		*animation = 855;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(846) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(855)) {  			_animationFrame = 0; +			_animationState = 6; +			*animation = 854;  		}  		break; -	case 0: -		*animation = 847; + +	case 8: +		*animation = 854; +		_animationFrame++; +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(854)) { +			_animationFrame = 0; +		} +		break; + +	case 9: +		*animation = 849;  		_animationFrame++; -		if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(847) - 1) { +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(849)) { +			Actor_Change_Animation_Mode(kActorLeon, kAnimationModeIdle); +			*animation = 847;  			_animationFrame = 0; +			_animationState = 0; +			if (Actor_Query_Goal_Number(kActorLeon) == kGoalLeonReleaseDeskClerk) { +				Actor_Set_Goal_Number(kActorLeon, kGoalLeonPrepareTalkToMcCoy); +			} +		} +		break; + +	case 10: +		*animation = 856; +		_animationFrame++; +		if (_animationFrame == 6) { +			Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie); +			Actor_Retired_Here(kActorMcCoy, 12, 12, true, -1); +		} + +		if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { +			*animation = 847; +			_animationFrame = 0; +			Actor_Change_Animation_Mode(kActorLeon, kAnimationModeIdle);  		}  		break;  	} @@ -366,7 +404,7 @@ bool AIScriptLeon::ChangeAnimationMode(int mode) {  		case 5:  		case 6:  		case 7: -			var_45EDAC = 1; +			_flag = true;  			break;  		case 8:  			Actor_Change_Animation_Mode(kActorLeon, 72); @@ -377,48 +415,58 @@ bool AIScriptLeon::ChangeAnimationMode(int mode) {  			break;  		}  		break; +  	case kAnimationModeWalk:  		_animationState = 1;  		_animationFrame = 0;  		break; +  	case kAnimationModeTalk:  		_animationState = 2;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case kAnimationModeCombatAttack:  		_animationState = 10;  		_animationFrame = 0;  		break; +  	case 12:  		_animationState = 3;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case 13:  		_animationState = 4;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case 14:  		_animationState = 5;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case 15:  		_animationState = 6;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case 16:  		_animationState = 7;  		_animationFrame = 0; -		var_45EDAC = 0; +		_flag = false;  		break; +  	case 26:  		_animationState = 9;  		_animationFrame = 0;  		break; +  	case 72:  		if (_animationState != 8) {  			_animationState = 8; @@ -445,14 +493,14 @@ void AIScriptLeon::SetAnimationState(int animationState, int animationFrame, int  bool AIScriptLeon::ReachedMovementTrackWaypoint(int waypointId) {  	if (waypointId == 353) { -		Actor_Set_Goal_Number(kActorLeon, 8); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonGone);  	}  	return true;  }  void AIScriptLeon::FledCombat() {} -float AIScriptLeon::sub_446700(int actorId, float x, float y, float z) { +float AIScriptLeon::distanceTo(int actorId, float x, float y, float z) {  	float actorX, actorY, actorZ;  	Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);  	return sqrt(static_cast<float>((z - actorZ) * (z - actorZ) + (y - actorY) * (y - actorY) + (x - actorX) * (x - actorX))); diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h index 9252db3709..691a9cf978 100644 --- a/engines/bladerunner/script/ai_script.h +++ b/engines/bladerunner/script/ai_script.h @@ -299,8 +299,8 @@ DECLARE_SCRIPT(Baker)  END_SCRIPT  DECLARE_SCRIPT(DeskClerk) -	int _var1; -	int _var2; +	bool _flag1; +	bool _flag2;  	int _var3;  END_SCRIPT @@ -445,12 +445,12 @@ DECLARE_SCRIPT(Newscaster)  END_SCRIPT  DECLARE_SCRIPT(Leon) -	int var_45EDAC; -	float var_45EDA0_z; -	float var_45EDA4_y; -	float var_45EDA8_x; +	bool _flag; +	float _mcCoyPositionX; +	float _mcCoyPositionY; +	float _mcCoyPositionZ; -	float sub_446700(int actorId, float x, float y, float z); +	float distanceTo(int actorId, float x, float y, float z);  END_SCRIPT  DECLARE_SCRIPT(MaleAnnouncer) diff --git a/engines/bladerunner/script/scene/ct09.cpp b/engines/bladerunner/script/scene/ct09.cpp index c9506d54c5..4211ae015e 100644 --- a/engines/bladerunner/script/scene/ct09.cpp +++ b/engines/bladerunner/script/scene/ct09.cpp @@ -25,16 +25,18 @@  namespace BladeRunner {  void SceneScriptCT09::InitializeScene() { -	if (Game_Flag_Query(85)) { -		Setup_Scene_Information(160.0f, 349.0f, 587.0f, 490); +	if (Game_Flag_Query(kFlagCT10toCT09)) { +		Setup_Scene_Information(160.0f,   349.0f, 587.0f, 490);  	} else if (Game_Flag_Query(kFlagCT08toCT09)) {  		Setup_Scene_Information(235.0f, 3348.52f, 599.0f, 800);  	} else { -		Setup_Scene_Information(107.0f, 348.52f, 927.0f, 200); +		Setup_Scene_Information(107.0f,  348.52f, 927.0f, 200);  	} +  	Scene_Exit_Add_2D_Exit(0, 321, 164, 345, 309, 1); -	Scene_Exit_Add_2D_Exit(1, 0, 0, 15, 479, 3); +	Scene_Exit_Add_2D_Exit(1,   0,   0,  15, 479, 3);  	Scene_Exit_Add_2D_Exit(2, 198, 177, 263, 311, 0); +  	Ambient_Sounds_Add_Looping_Sound(336, 28, 0, 1);  	Ambient_Sounds_Add_Sound(375, 6, 180, 33, 33, 0, 0, -101, -101, 0, 0);  	Ambient_Sounds_Add_Sound(376, 5, 180, 33, 33, 0, 0, -101, -101, 0, 0); @@ -54,12 +56,12 @@ bool SceneScriptCT09::MouseClick(int x, int y) {  bool SceneScriptCT09::ClickedOn3DObject(const char *objectName, bool a2) {  	if (Object_Query_Click("BELL", objectName)) { -		if (Actor_Query_Which_Set_In(kActorLeon) != 31) { -			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 229.0f, 348.52f, 851.0f, 36, 1, false, 0)) { +		if (Actor_Query_Which_Set_In(kActorLeon) != kSetCT09) { +			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 229.0f, 348.52f, 851.0f, 36, true, false, 0)) {  				Actor_Face_Object(kActorMcCoy, "BELL", true);  				Sound_Play(337, 100, 0, 0, 50);  				if (!Actor_Query_Goal_Number(kActorDeskClerk)) { -					Actor_Says(kActorDeskClerk, 160, 3); +					Actor_Says(kActorDeskClerk, 160, kAnimationModeTalk);  				}  			}  		} @@ -70,28 +72,30 @@ bool SceneScriptCT09::ClickedOn3DObject(const char *objectName, bool a2) {  bool SceneScriptCT09::ClickedOnActor(int actorId) {  	if (actorId == kActorDeskClerk) { -		if (!Actor_Query_Goal_Number(kActorDeskClerk) && Actor_Query_Which_Set_In(kActorLeon) != 31) { -			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 270.0f, 348.52f, 846.0f, 12, 1, false, 0)) { +		if (Actor_Query_Goal_Number(kActorDeskClerk) == kGoalDeskClerkDefault +		 && Actor_Query_Which_Set_In(kActorLeon) != kSetCT09 +		) { +			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 270.0f, 348.52f, 846.0f, 12, true, false, 0)) {  				Player_Loses_Control();  				Actor_Face_Actor(kActorMcCoy, kActorDeskClerk, true); -				if (Global_Variable_Query(kVariableChapter) < 3) { -					Actor_Says(kActorMcCoy, 650, 3); +				if (Global_Variable_Query(kVariableChapter) < 3) { // it is impossible to get here before chapter 3 +					Actor_Says(kActorMcCoy, 650, kAnimationModeTalk);  					Actor_Says(kActorDeskClerk, 250, 12);  					Actor_Says(kActorMcCoy, 665, 18); -				} else if (Game_Flag_Query(540)) { -					Actor_Says(kActorMcCoy, 650, 18); -					Actor_Says(kActorDeskClerk, 220, 15); -				} else { -					Game_Flag_Set(540); +				} else if (!Game_Flag_Query(kFlagCT09DeskClerkTalk)) { +					Game_Flag_Set(kFlagCT09DeskClerkTalk);  					Actor_Says(kActorDeskClerk, 170, 13);  					Actor_Says(kActorMcCoy, 630, 12);  					Actor_Says(kActorDeskClerk, 180, 14); -					Actor_Says(kActorMcCoy, 635, 3); +					Actor_Says(kActorMcCoy, 635, kAnimationModeTalk);  					Actor_Says(kActorDeskClerk, 190, 15);  					Actor_Says(kActorMcCoy, 640, 12); -					Actor_Says(kActorMcCoy, 645, 3); +					Actor_Says(kActorMcCoy, 645, kAnimationModeTalk);  					Actor_Says(kActorDeskClerk, 200, 13);  					Actor_Says(kActorDeskClerk, 210, 14); +				} else { +					Actor_Says(kActorMcCoy, 650, 18); +					Actor_Says(kActorDeskClerk, 220, 15);  				}  				Player_Gains_Control();  			} @@ -107,8 +111,8 @@ bool SceneScriptCT09::ClickedOnItem(int itemId, bool a2) {  bool SceneScriptCT09::ClickedOnExit(int exitId) {  	if (exitId == 0) { -		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.0f, 348.52f, 599.0f, 0, 1, false, 0)) { -			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 235.0f, 348.52f, 599.0f, 0, 0, false, 0); +		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.0f, 348.52f, 599.0f, 0, true, false, 0)) { +			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 235.0f, 348.52f, 599.0f, 0, false, false, 0);  			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);  			Ambient_Sounds_Remove_All_Looping_Sounds(1);  			Game_Flag_Set(kFlagCT09toCT08); @@ -116,8 +120,9 @@ bool SceneScriptCT09::ClickedOnExit(int exitId) {  		}  		return true;  	} +  	if (exitId == 1) { -		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 107.0f, 348.52f, 927.0f, 0, 1, false, 0)) { +		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 107.0f, 348.52f, 927.0f, 0, true, false, 0)) {  			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);  			Ambient_Sounds_Remove_All_Looping_Sounds(1);  			Game_Flag_Set(kFlagCT09toCT11); @@ -125,8 +130,9 @@ bool SceneScriptCT09::ClickedOnExit(int exitId) {  		}  		return true;  	} +  	if (exitId == 2) { -		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 159.0f, 349.0f, 570.0f, 0, 1, false, 0)) { +		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 159.0f, 349.0f, 570.0f, 0, true, false, 0)) {  			Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);  			Ambient_Sounds_Remove_All_Looping_Sounds(1);  			Game_Flag_Set(kFlagCT09toCT10); @@ -142,7 +148,13 @@ bool SceneScriptCT09::ClickedOn2DRegion(int region) {  }  void SceneScriptCT09::SceneFrameAdvanced(int frame) { -	if (frame == 6 || frame == 12 || frame == 19 || frame == 25 || frame == 46 || frame == 59) { +	if (frame == 6 +	 || frame == 12 +	 || frame == 19 +	 || frame == 25 +	 || frame == 46 +	 || frame == 59 +	) {  		Sound_Play(97, Random_Query(47, 47), 70, 70, 50);  	}  } @@ -151,31 +163,36 @@ void SceneScriptCT09::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo  }  void SceneScriptCT09::PlayerWalkedIn() { -	bool v0 = false; -	if (Global_Variable_Query(kVariableChapter) == 3 && !Game_Flag_Query(538)) { -		Game_Flag_Set(538); -		Actor_Set_Goal_Number(kActorLeon, 1); -		v0 = true; +	bool leonScene = false; + +	if ( Global_Variable_Query(kVariableChapter) == 3 +	 && !Game_Flag_Query(kFlagCT09Entered) +	) { +		Game_Flag_Set(kFlagCT09Entered); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonHoldingDeskClerk); +		leonScene = true;  	} +  	if (Game_Flag_Query(kFlagCT10toCT09)) {  		Game_Flag_Reset(kFlagCT10toCT09);  	} else if (Game_Flag_Query(kFlagCT08toCT09)) { -		if (v0) { +		if (leonScene) {  			Async_Actor_Walk_To_XYZ(kActorMcCoy, 206.0f, 348.52f, 599.0f, 0, false);  		} else { -			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.0f, 348.52f, 599.0f, 0, 0, false, 0); +			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 206.0f, 348.52f, 599.0f, 0, false, false, 0);  		}  		Game_Flag_Reset(kFlagCT08toCT09);  	} else { -		if (v0) { +		if (leonScene) {  			Async_Actor_Walk_To_XYZ(kActorMcCoy, 124.0f, 348.52f, 886.0f, 0, false);  		} else { -			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 124.0f, 348.52f, 886.0f, 0, 0, false, 0); +			Loop_Actor_Walk_To_XYZ(kActorMcCoy, 124.0f, 348.52f, 886.0f, 0, false, false, 0);  		}  		Game_Flag_Reset(kFlagCT11toCT09);  	} -	if (Actor_Query_Goal_Number(kActorDeskClerk) == 2) { -		if (Game_Flag_Query(539)) { + +	if (Actor_Query_Goal_Number(kActorDeskClerk) == kGoalDeskClerkRecovered) { +		if (Game_Flag_Query(kFlagCT09LeonInterrupted)) {  			Actor_Says(kActorDeskClerk, 70, 13);  			Actor_Face_Actor(kActorMcCoy, kActorDeskClerk, true);  			Actor_Says(kActorMcCoy, 600, 17); @@ -193,7 +210,7 @@ void SceneScriptCT09::PlayerWalkedIn() {  			Actor_Says(kActorDeskClerk, 60, 13);  			Actor_Modify_Friendliness_To_Other(kActorDeskClerk, kActorMcCoy, -1);  		} -		Actor_Set_Goal_Number(kActorDeskClerk, 0); +		Actor_Set_Goal_Number(kActorDeskClerk, kGoalDeskClerkDefault);  	}  } @@ -202,13 +219,16 @@ void SceneScriptCT09::PlayerWalkedOut() {  void SceneScriptCT09::DialogueQueueFlushed(int a1) {  	Actor_Force_Stop_Walking(kActorMcCoy); -	if (Actor_Query_Goal_Number(kActorLeon) == 1 && !Game_Flag_Query(539)) { + +	if ( Actor_Query_Goal_Number(kActorLeon) == kGoalLeonHoldingDeskClerk +	 && !Game_Flag_Query(kFlagCT09LeonInterrupted) +	) {  		Player_Loses_Control(); -		Actor_Set_Goal_Number(kActorLeon, 2); +		Actor_Set_Goal_Number(kActorLeon, kGoalLeonReleaseDeskClerk);  		//return true; -	} else { -		//return false;  	} + +	//return false;  }  } // End of namespace BladeRunner | 
