From 0e4e3354bddf9a73a87b908d23351cb2ff01b4a9 Mon Sep 17 00:00:00 2001 From: antoniou79 Date: Fri, 4 Sep 2020 23:33:43 +0300 Subject: [PATCH] BLADERUNNER: Fix Hanoi throwing McCoy out Addresses most of the issues in bug #11293 Does not address the "Hanoi is not facing McCoy when speaking to him" bullet, which only occurs on specific banter talk --- engines/bladerunner/script/ai/dektora.cpp | 5 ++- engines/bladerunner/script/ai/hanoi.cpp | 10 +++++ engines/bladerunner/script/scene/nr01.cpp | 11 ++++- engines/bladerunner/script/scene/nr03.cpp | 49 ++++++++++++++++------- engines/bladerunner/script/scene/nr05.cpp | 8 +--- 5 files changed, 59 insertions(+), 24 deletions(-) diff --git a/engines/bladerunner/script/ai/dektora.cpp b/engines/bladerunner/script/ai/dektora.cpp index b2cf124fc45..3c290fe118c 100644 --- a/engines/bladerunner/script/ai/dektora.cpp +++ b/engines/bladerunner/script/ai/dektora.cpp @@ -219,7 +219,6 @@ void AIScriptDektora::ClickedByPlayer() { if (Actor_Query_Goal_Number(kActorDektora) == kGoalDektoraGone) { Actor_Face_Actor(0, kActorDektora, true); Actor_Says(kActorMcCoy, 8630, 12); // What a waste - return; //true; } @@ -232,9 +231,11 @@ void AIScriptDektora::ClickedByPlayer() { Game_Flag_Set(kFlagNR08TouchedDektora); AI_Movement_Track_Flush(kActorHanoi); Actor_Force_Stop_Walking(kActorMcCoy); +#if BLADERUNNER_ORIGINAL_BUGS + // this is a redundant call Player_Loses_Control(); +#endif Actor_Set_Goal_Number(kActorHanoi, kGoalHanoiThrowOutMcCoy); - return; //true; } diff --git a/engines/bladerunner/script/ai/hanoi.cpp b/engines/bladerunner/script/ai/hanoi.cpp index 31ca209a71b..6199a0647ca 100644 --- a/engines/bladerunner/script/ai/hanoi.cpp +++ b/engines/bladerunner/script/ai/hanoi.cpp @@ -185,7 +185,10 @@ void AIScriptHanoi::OtherAgentEnteredCombatMode(int otherActorId, int combatMode && combatMode ) { Player_Set_Combat_Mode(false); +#if BLADERUNNER_ORIGINAL_BUGS + // redundant call to lose control here Player_Loses_Control(); +#endif Actor_Set_Goal_Number(kActorHanoi, kGoalHanoiThrowOutMcCoy); return; //true; } @@ -290,7 +293,14 @@ bool AIScriptHanoi::GoalChanged(int currentGoalNumber, int newGoalNumber) { case kGoalHanoiThrowOutMcCoy: Game_Flag_Set(kFlagNR03McCoyThrownOut); AI_Countdown_Timer_Reset(kActorHanoi, kActorTimerAIScriptCustomTask0); +#if BLADERUNNER_ORIGINAL_BUGS Player_Loses_Control(); +#else + // Lose control only if not already lost control (like in the case of Dektora's dressing room NR07 time-out) + if (Player_Has_Control()) { + Player_Loses_Control(); + } +#endif Player_Set_Combat_Mode(false); // this is missing in ITA and ESP versions of the game Actor_Force_Stop_Walking(kActorMcCoy); Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeDie); diff --git a/engines/bladerunner/script/scene/nr01.cpp b/engines/bladerunner/script/scene/nr01.cpp index 08d62d76ae4..db861223790 100644 --- a/engines/bladerunner/script/scene/nr01.cpp +++ b/engines/bladerunner/script/scene/nr01.cpp @@ -47,6 +47,7 @@ void SceneScriptNR01::InitializeScene() { } else if (Game_Flag_Query(kFlagNotUsed545)) { Setup_Scene_Information( -170.0f, 24.0f, -574.0f, 768); } else { + // eg. when thrown out Setup_Scene_Information( 76.0f, 23.88f, -109.0f, 966); } @@ -88,8 +89,8 @@ void SceneScriptNR01::InitializeScene() { && !Game_Flag_Query(kFlagArrivedFromSpinner1) ) { if ((!Game_Flag_Query(kFlagNR01VisitedFirstTimeWithSpinner) && Global_Variable_Query(kVariableChapter) == 3) - || Random_Query(1, 3) == 1) - { + || Random_Query(1, 3) == 1 + ) { // enhancement: don't always play after first visit Scene_Loop_Start_Special(kSceneLoopModeLoseControl, kNR01LoopInshot, false); } @@ -330,7 +331,13 @@ void SceneScriptNR01::PlayerWalkedIn() { Game_Flag_Reset(kFlagNR08TouchedDektora); } Game_Flag_Reset(kFlagNR03McCoyThrownOut); +#if BLADERUNNER_ORIGINAL_BUGS + // This is an extra call Player_Gains_Control() (McCoy should gain control by his AI script - goal kGoalMcCoyNR01GetUp) + // or when he's drugged the goal kGoalMcCoyNR01LayDrugged ensures gaining control + // It causes buggy behavior since it enables control, and by clicking fast the player can skip McCoy's AI script handling + // of his goal change to kGoalMcCoyNR01ThrownOut, and he can stay invisible, and also spawn at the bottom right of the scene Player_Gains_Control(); +#endif //return true; return; } diff --git a/engines/bladerunner/script/scene/nr03.cpp b/engines/bladerunner/script/scene/nr03.cpp index a8a93e20016..e56aeeeaef7 100644 --- a/engines/bladerunner/script/scene/nr03.cpp +++ b/engines/bladerunner/script/scene/nr03.cpp @@ -157,18 +157,31 @@ bool SceneScriptNR03::ClickedOnExit(int exitId) { AI_Movement_Track_Pause(kActorHanoi); Actor_Face_Actor(kActorHanoi, kActorMcCoy, true); Actor_Face_Actor(kActorMcCoy, kActorHanoi, true); - int warnings = Global_Variable_Query(kVariableHanoiNR04Warnings); - if (warnings == 0) { + switch (Global_Variable_Query(kVariableHanoiNR04Warnings)) { + case 0: Actor_Says(kActorHanoi, 50, 13); AI_Movement_Track_Unpause(kActorHanoi); - } else if (warnings == 1) { + break; + case 1: Actor_Says(kActorHanoi, 210, 15); AI_Movement_Track_Unpause(kActorHanoi); - } else if (warnings == 2) { + break; + case 2: + // fall through + default: +#if !BLADERUNNER_ORIGINAL_BUGS + // Needed delay, otherwise McCoy's animation of being thrown out won't play + Delay(150); +#endif Actor_Set_Goal_Number(kActorHanoi, kGoalHanoiThrowOutMcCoy); + break; } - // game bug? after reentering this does nothing as variable is never reset or checked for > 2 Global_Variable_Increment(kVariableHanoiNR04Warnings, 1); +#if !BLADERUNNER_ORIGINAL_BUGS + if (Global_Variable_Query(kVariableHanoiNR04Warnings) > 2) { + Global_Variable_Set(kVariableHanoiNR04Warnings, 1); + } +#endif } else { Ambient_Sounds_Remove_All_Non_Looping_Sounds(true); Ambient_Sounds_Remove_All_Looping_Sounds(1); @@ -191,23 +204,31 @@ bool SceneScriptNR03::ClickedOnExit(int exitId) { Actor_Change_Animation_Mode(kActorMcCoy, kAnimationModeIdle); AI_Movement_Track_Pause(kActorHanoi); Actor_Face_Actor(kActorHanoi, kActorMcCoy, true); - - int warnings = Global_Variable_Query(kVariableHanoiNR05Warnings); - if (warnings == 0) { + switch (Global_Variable_Query(kVariableHanoiNR05Warnings)) { + case 0: Actor_Says(kActorHanoi, 0, 15); Actor_Face_Actor(kActorMcCoy, kActorHanoi, true); Actor_Says(kActorMcCoy, 3335, 13); Actor_Says(kActorHanoi, 10, 16); AI_Movement_Track_Unpause(kActorHanoi); - } else if (warnings == 1) { + break; + case 1: Actor_Face_Actor(kActorMcCoy, kActorHanoi, true); Actor_Says(kActorHanoi, 210, 12); AI_Movement_Track_Unpause(kActorHanoi); - } else if (warnings == 2) { + break; + case 2: + // fall through + default: Actor_Set_Goal_Number(kActorHanoi, kGoalHanoiThrowOutMcCoy); + break; } - // game bug? after reentering this does nothing as variable is never reset or checked for > 2 Global_Variable_Increment(kVariableHanoiNR05Warnings, 1); +#if !BLADERUNNER_ORIGINAL_BUGS + if (Global_Variable_Query(kVariableHanoiNR05Warnings) > 2) { + Global_Variable_Set(kVariableHanoiNR05Warnings, 1); + } +#endif } else { Player_Loses_Control(); Player_Set_Combat_Mode(false); @@ -287,9 +308,7 @@ void SceneScriptNR03::SceneFrameAdvanced(int frame) { Sound_Play(kSfxMAGMOVE2, 62, -70, -70, 50); } - if (frame > 70 - && frame < 110 - ) { + if (frame > 70 && frame < 110) { rotateActorOnTable(frame); } else if (frame == 110) { if (Actor_Query_Goal_Number(kActorGuzza) == kGoalGuzzaSitAtNR03) { @@ -320,6 +339,8 @@ void SceneScriptNR03::PlayerWalkedIn() { Game_Flag_Reset(kFlagNR01toNR03); } + // This seems redundant since we set the combat mode to false at start of WalkedIn() method + // Probably a last minute original behavior fix to be more user friendly (not being tossed off the bar immediately upon entering) if (Player_Query_Combat_Mode()) { Actor_Set_Goal_Number(kActorHanoi, kGoalHanoiThrowOutMcCoy); } diff --git a/engines/bladerunner/script/scene/nr05.cpp b/engines/bladerunner/script/scene/nr05.cpp index eccdfe9d64e..9ff1a5b5fb0 100644 --- a/engines/bladerunner/script/scene/nr05.cpp +++ b/engines/bladerunner/script/scene/nr05.cpp @@ -189,13 +189,9 @@ void SceneScriptNR05::SceneFrameAdvanced(int frame) { } } - if (frame > 77 - && frame <= 134 - ) { + if (frame > 77 && frame <= 134) { rotateActorOnTable(frame - 13); - if ( frame == 134 - && !Game_Flag_Query(kFlagNR05toNR03) - ) { + if ( frame == 134 && !Game_Flag_Query(kFlagNR05toNR03)) { Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyNRxxSitAtTable); } //return true;