From 5959d01a675e14452f533f5098d266c774565a0e Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Wed, 27 Mar 2019 15:11:31 +0200 Subject: BLADERUNNER: Fixes for moonbus combat --- engines/bladerunner/audio_mixer.h | 12 +++++++++--- engines/bladerunner/audio_player.h | 6 +++++- engines/bladerunner/game_constants.h | 3 ++- engines/bladerunner/script/ai/clovis.cpp | 26 ++++++++++++++++++++------ engines/bladerunner/script/ai/dektora.cpp | 5 ++--- engines/bladerunner/script/ai/gordo.cpp | 8 +++++--- engines/bladerunner/script/ai/izo.cpp | 6 +++--- engines/bladerunner/script/ai/lucy.cpp | 22 ++++++++++++++++++++++ engines/bladerunner/script/ai/luther.cpp | 20 ++++++++++++++++++++ engines/bladerunner/script/ai/sadik.cpp | 4 ++-- engines/bladerunner/script/ai/zuben.cpp | 24 +++++++++++++++++++++--- engines/bladerunner/script/scene/kp07.cpp | 22 +++++++++++++++------- 12 files changed, 126 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/bladerunner/audio_mixer.h b/engines/bladerunner/audio_mixer.h index ce7040bad6..bb43d57632 100644 --- a/engines/bladerunner/audio_mixer.h +++ b/engines/bladerunner/audio_mixer.h @@ -33,9 +33,15 @@ namespace BladeRunner { class BladeRunnerEngine; class AudioMixer { - static const int kChannels = 15; // original was 9; - static const int kUsableChannels = 14; // original was 8; - static const int kMusicChannel = 14; // original was 8; +#if BLADERUNNER_ORIGINAL_BUGS + static const int kChannels = 9; + static const int kUsableChannels = 8; + static const int kMusicChannel = 8; +#else + static const int kChannels = 15; + static const int kUsableChannels = 14; + static const int kMusicChannel = 14; +#endif // BLADERUNNER_ORIGINAL_BUGS static const int kUpdatesPerSecond = 40; struct Channel { diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h index 8fb3c48794..a1823b7ffa 100644 --- a/engines/bladerunner/audio_player.h +++ b/engines/bladerunner/audio_player.h @@ -41,7 +41,11 @@ enum AudioPlayerFlags { }; class AudioPlayer { - static const int kTracks = 12; // original was 6 +#if BLADERUNNER_ORIGINAL_BUGS + static const int kTracks = 6; +#else + static const int kTracks = 12; +#endif // BLADERUNNER_ORIGINAL_BUGS struct Track { bool isActive; diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 0d4d411543..00d424d00d 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -1209,7 +1209,7 @@ enum Variables { kVariableDNAEvidence = 48, kVariableCorruptedGuzzaEvidence = 49, kVariableTaffyLewisMusic = 50, - kVariableReplicants = 51, + kVariableReplicantsSurvivorsAtMoobus = 51, kVariableNextTvNews = 52, kVariableEarlyQFrontMusic = 53, kVariableEarlyQBackMusic = 54 @@ -2186,6 +2186,7 @@ enum GoalZuben { kGoalZubenCT02PotDodgeCheck = 14, kGoalZubenFled = 20, kGoalZubenMA01AttackMcCoy = 21, + kGoalZubenDiesInChapter1 = 99, kGoalZubenGone = 599 }; diff --git a/engines/bladerunner/script/ai/clovis.cpp b/engines/bladerunner/script/ai/clovis.cpp index a9917810fb..beb90edf15 100644 --- a/engines/bladerunner/script/ai/clovis.cpp +++ b/engines/bladerunner/script/ai/clovis.cpp @@ -188,10 +188,10 @@ bool AIScriptClovis::ShotAtAndHit() { void AIScriptClovis::Retired(int byActorId) { if (Game_Flag_Query(kFlagMcCoyIsHelpingReplicants)) { if (Actor_Query_In_Set(kActorClovis, kSetKP07)) { - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Goal_Number(kActorClovis, kGoalClovisGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); Player_Set_Combat_Mode(false); @@ -201,9 +201,11 @@ void AIScriptClovis::Retired(int byActorId) { Game_Flag_Set(kFlagKP07toKP06); Game_Flag_Reset(kFlagMcCoyIsHelpingReplicants); Set_Enter(kSetKP05_KP06, kSceneKP06); + return; //true; } } } + return; //false; } int AIScriptClovis::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { @@ -388,8 +390,8 @@ bool AIScriptClovis::GoalChanged(int currentGoalNumber, int newGoalNumber) { Actor_Put_In_Set(kActorClovis, kSetKP07); Actor_Set_Targetable(kActorClovis, true); if (Game_Flag_Query(kFlagMcCoyIsHelpingReplicants)) { - Global_Variable_Set(kVariableReplicants, 0); - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Set(kVariableReplicantsSurvivorsAtMoobus, 0); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_At_XYZ(kActorClovis, 45.0f, -41.52f, -85.0f, 750); } else { Actor_Set_At_XYZ(kActorClovis, 84.85f, -50.56f, -68.87f, 800); @@ -455,15 +457,27 @@ bool AIScriptClovis::GoalChanged(int currentGoalNumber, int newGoalNumber) { if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_In_Set(kActorLucy, kSetKP07) ) { +#if BLADERUNNER_ORIGINAL_BUGS + // Lucy's retirement on the moonbus should be handled in her ai script AIScriptLucy::Retired() + // like the others - even if she won't attack McCoy, she should be retired immediately (with this shot) Actor_Set_Goal_Number(kActorLucy, kGoalLucyGone); - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); +#else + // This is her code if she's attacked when escaping with McCoy + // will this work? + Non_Player_Actor_Combat_Mode_On(kActorLucy, kActorCombatStateIdle, false, kActorMcCoy, 4, kAnimationModeIdle, kAnimationModeWalk, kAnimationModeRun, -1, 0, 0, 10, 300, false); +#endif // BLADERUNNER_ORIGINAL_BUGS } if (Global_Variable_Query(kVariableChapter) == 5 && Actor_Query_In_Set(kActorLuther, kSetKP07) ) { +#if BLADERUNNER_ORIGINAL_BUGS + // Luther's retirement on the moonbus should be handled in her ai script AIScriptLucy::Retired() + // like the others - even if she won't attack McCoy, she should be retired immediately (with this shot) Actor_Set_Goal_Number(kActorLuther, kGoalLutherGone); - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); +#endif // BLADERUNNER_ORIGINAL_BUGS } if (Global_Variable_Query(kVariableChapter) == 5 diff --git a/engines/bladerunner/script/ai/dektora.cpp b/engines/bladerunner/script/ai/dektora.cpp index 9d721e31cc..01d769b935 100644 --- a/engines/bladerunner/script/ai/dektora.cpp +++ b/engines/bladerunner/script/ai/dektora.cpp @@ -294,10 +294,10 @@ void AIScriptDektora::Retired(int byActorId) { } if (Actor_Query_In_Set(kActorDektora, kSetKP07)) { - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Goal_Number(kActorDektora, kGoalDektoraGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); Player_Set_Combat_Mode(false); @@ -307,7 +307,6 @@ void AIScriptDektora::Retired(int byActorId) { Game_Flag_Set(kFlagKP07toKP06); Game_Flag_Reset(kFlagMcCoyIsHelpingReplicants); Set_Enter(kSetKP05_KP06, kSceneKP06); - return; //true; } } diff --git a/engines/bladerunner/script/ai/gordo.cpp b/engines/bladerunner/script/ai/gordo.cpp index bb8e62ecde..3d2dcd2a7a 100644 --- a/engines/bladerunner/script/ai/gordo.cpp +++ b/engines/bladerunner/script/ai/gordo.cpp @@ -288,20 +288,22 @@ void AIScriptGordo::Retired(int byActorId) { } if (Actor_Query_In_Set(kActorGordo, kSetKP07)) { - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Goal_Number(kActorGordo, kGoalGordoGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); Player_Set_Combat_Mode(false); +#if BLADERUNNER_ORIGINAL_BUGS Player_Gains_Control(); +#endif // BLADERUNNER_ORIGINAL_BUGS 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(kFlagKP07toKP06); Game_Flag_Reset(kFlagMcCoyIsHelpingReplicants); Set_Enter(kSetKP05_KP06, kSceneKP06); - return;// true; + return; //true; } } diff --git a/engines/bladerunner/script/ai/izo.cpp b/engines/bladerunner/script/ai/izo.cpp index ce1c15c208..92d2587328 100644 --- a/engines/bladerunner/script/ai/izo.cpp +++ b/engines/bladerunner/script/ai/izo.cpp @@ -238,13 +238,13 @@ void AIScriptIzo::Retired(int byActorId) { return; //false; } - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Goal_Number(kActorIzo, kGoalIzoGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); - Player_Set_Combat_Mode(0); + Player_Set_Combat_Mode(false); 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); diff --git a/engines/bladerunner/script/ai/lucy.cpp b/engines/bladerunner/script/ai/lucy.cpp index 3b37bd6008..928a425db1 100644 --- a/engines/bladerunner/script/ai/lucy.cpp +++ b/engines/bladerunner/script/ai/lucy.cpp @@ -249,6 +249,28 @@ void AIScriptLucy::Retired(int byActorId) { Actor_Modify_Friendliness_To_Other(kActorClovis, kActorMcCoy, -6); } +#if BLADERUNNER_ORIGINAL_BUGS +#else + if (Actor_Query_In_Set(kActorLucy, kSetKP07)) { + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); + Actor_Set_Goal_Number(kActorLucy, kGoalLucyGone); + + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { + Player_Loses_Control(); + Delay(2000); + Player_Set_Combat_Mode(false); + 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(kFlagKP07toKP06); + Game_Flag_Reset(kFlagMcCoyIsHelpingReplicants); + Set_Enter(kSetKP05_KP06, kSceneKP06); + + return; //true; + } + } +#endif // BLADERUNNER_ORIGINAL_BUGS + if ((byActorId == kActorSteele || byActorId == kActorMcCoy ) diff --git a/engines/bladerunner/script/ai/luther.cpp b/engines/bladerunner/script/ai/luther.cpp index 696bfc078d..791bb97a4d 100644 --- a/engines/bladerunner/script/ai/luther.cpp +++ b/engines/bladerunner/script/ai/luther.cpp @@ -181,6 +181,26 @@ bool AIScriptLuther::ShotAtAndHit() { void AIScriptLuther::Retired(int byActorId) { Actor_Set_Goal_Number(kActorLuther, kGoalLutherGone); +#if BLADERUNNER_ORIGINAL_BUGS +#else + if (Actor_Query_In_Set(kActorLuther, kSetKP07)) { + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); + Actor_Set_Goal_Number(kActorLuther, kGoalLutherGone); + + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { + Player_Loses_Control(); + Delay(2000); + Player_Set_Combat_Mode(false); + 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(kFlagKP07toKP06); + Game_Flag_Reset(kFlagMcCoyIsHelpingReplicants); + Set_Enter(kSetKP05_KP06, kSceneKP06); + return; //true; + } + } +#endif // BLADERUNNER_ORIGINAL_BUGS } int AIScriptLuther::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) { diff --git a/engines/bladerunner/script/ai/sadik.cpp b/engines/bladerunner/script/ai/sadik.cpp index 9bddf382d6..2b223649a1 100644 --- a/engines/bladerunner/script/ai/sadik.cpp +++ b/engines/bladerunner/script/ai/sadik.cpp @@ -234,10 +234,10 @@ void AIScriptSadik::Retired(int byActorId) { } if (Actor_Query_In_Set(kActorSadik, kSetKP07)) { - Global_Variable_Decrement(kVariableReplicants, 1); // can't Sadik still be human (Rep-sympathiser here? A bug? + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); // can't Sadik still be human (Rep-sympathiser here? A bug? Actor_Set_Goal_Number(kActorSadik, kGoalSadikGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); Player_Set_Combat_Mode(false); diff --git a/engines/bladerunner/script/ai/zuben.cpp b/engines/bladerunner/script/ai/zuben.cpp index a24a0b631c..777433fe41 100644 --- a/engines/bladerunner/script/ai/zuben.cpp +++ b/engines/bladerunner/script/ai/zuben.cpp @@ -288,12 +288,16 @@ bool AIScriptZuben::ShotAtAndHit() { void AIScriptZuben::Retired(int byActorId) { if (!Actor_Query_In_Set(kActorZuben, kSetKP07)) { +#if BLADERUNNER_ORIGINAL_BUGS +#else + Actor_Set_Goal_Number(kActorZuben, kGoalZubenDiesInChapter1); +#endif // BLADERUNNER_ORIGINAL_BUGS // return false; return; } - Global_Variable_Decrement(kVariableReplicants, 1); + Global_Variable_Decrement(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Goal_Number(kActorZuben, kGoalZubenGone); - if (Global_Variable_Query(kVariableReplicants) == 0) { + if (Global_Variable_Query(kVariableReplicantsSurvivorsAtMoobus) == 0) { Player_Loses_Control(); Delay(2000); Player_Set_Combat_Mode(false); @@ -447,10 +451,16 @@ bool AIScriptZuben::GoalChanged(int currentGoalNumber, int newGoalNumber) { AI_Movement_Track_Repeat(kActorZuben); return false; - case 99: + case kGoalZubenDiesInChapter1: +#if BLADERUNNER_ORIGINAL_BUGS AI_Movement_Track_Flush(kActorZuben); +#endif // BLADERUNNER_ORIGINAL_BUGS Scene_Exits_Enable(); Music_Stop(2); +#if BLADERUNNER_ORIGINAL_BUGS +#else + Actor_Set_Goal_Number(kActorZuben, kGoalZubenDie); +#endif // BLADERUNNER_ORIGINAL_BUGS return false; case 100: @@ -865,7 +875,9 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) { Sound_Play(207, 30, 0, 0, 50); } if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { +#if BLADERUNNER_ORIGINAL_BUGS Actor_Set_Goal_Number(kActorZuben, kGoalZubenDie); +#endif // BLADERUNNER_ORIGINAL_BUGS _animationState = 15; _animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; Actor_Set_Targetable(kActorZuben, false); @@ -879,7 +891,9 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) { Sound_Play(207, 30, 0, 0, 50); } if (_animationFrame >= Slice_Animation_Query_Number_Of_Frames(*animation)) { +#if BLADERUNNER_ORIGINAL_BUGS Actor_Set_Goal_Number(kActorZuben, kGoalZubenDie); +#endif // BLADERUNNER_ORIGINAL_BUGS _animationState = 16; _animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; Actor_Set_Targetable(kActorZuben, false); @@ -889,7 +903,11 @@ bool AIScriptZuben::UpdateAnimation(int *animation, int *frame) { case 15: *animation = 405; _animationFrame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1; +#if BLADERUNNER_ORIGINAL_BUGS + // This enables exits when it should not at the moonbus massacre + // but it was also used to enable the exits when Zuben is retired at McCoy's roof top. Scene_Exits_Enable(); +#endif // BLADERUNNER_ORIGINAL_BUGS break; case 16: diff --git a/engines/bladerunner/script/scene/kp07.cpp b/engines/bladerunner/script/scene/kp07.cpp index 3b5fd09e0a..5d6143ff59 100644 --- a/engines/bladerunner/script/scene/kp07.cpp +++ b/engines/bladerunner/script/scene/kp07.cpp @@ -36,13 +36,13 @@ void SceneScriptKP07::InitializeScene() { && Actor_Query_Goal_Number(kActorDektora) < kGoalDektoraGone ) { Actor_Set_Targetable(kActorDektora, true); - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Put_In_Set(kActorDektora, kSetKP07); Actor_Set_At_XYZ(kActorDektora, -52.0f, -41.52f, -5.0f, 289); } if (Actor_Query_Goal_Number(kActorZuben) < kGoalZubenGone) { - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Targetable(kActorZuben, true); Actor_Put_In_Set(kActorZuben, kSetKP07); Actor_Set_At_XYZ(kActorZuben, -26.0f, -41.52f, -135.0f, 0); @@ -51,7 +51,7 @@ void SceneScriptKP07::InitializeScene() { if (Game_Flag_Query(kFlagIzoIsReplicant) && Actor_Query_Goal_Number(kActorIzo) < 599 ) { - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Targetable(kActorIzo, true); Actor_Put_In_Set(kActorIzo, kSetKP07); Actor_Set_At_XYZ(kActorIzo, -38.0f, -41.52f, -175.0f, 500); @@ -60,7 +60,7 @@ void SceneScriptKP07::InitializeScene() { if (Game_Flag_Query(kFlagGordoIsReplicant) && Actor_Query_Goal_Number(kActorGordo) < kGoalGordoGone ) { - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_Targetable(kActorGordo, true); Actor_Put_In_Set(kActorGordo, kSetKP07); Actor_Set_At_XYZ(kActorGordo, 61.0f, -41.52f, -3.0f, 921); @@ -69,13 +69,13 @@ void SceneScriptKP07::InitializeScene() { if (Game_Flag_Query(kFlagLucyIsReplicant) && Actor_Query_Goal_Number(kActorLucy) < kGoalLucyGone ) { - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Put_In_Set(kActorLucy, kSetKP07); Actor_Set_At_XYZ(kActorLucy, 78.0f, -41.52f, -119.0f, 659); } if (Actor_Query_Goal_Number(kActorLuther) < kGoalLutherGone) { - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Put_In_Set(kActorLuther, kSetKP07); Actor_Set_At_XYZ(kActorLuther, -47.0f, 0.0f, 151.0f, 531); } @@ -127,9 +127,17 @@ bool SceneScriptKP07::ClickedOnActor(int actorId) { return true; } } else { +#if BLADERUNNER_ORIGINAL_BUGS Actor_Face_Actor(kActorMcCoy, actorId, true); Actor_Says(kActorMcCoy, 8590, 14); return true; +#else + if (!Player_Query_Combat_Mode()) { + Actor_Face_Actor(kActorMcCoy, actorId, true); + Actor_Says(kActorMcCoy, 8590, 14); + return true; + } +#endif // BLADERUNNER_ORIGINAL_BUGS } return false; @@ -172,7 +180,7 @@ void SceneScriptKP07::PlayerWalkedIn() { Actor_Says(kActorClovis, 1250, 3); if (Actor_Query_Goal_Number(kActorSadik) == kGoalSadikUG18NeedsReactorCoreFromMcCoy) { Actor_Put_In_Set(kActorSadik, kSetKP07); - Global_Variable_Increment(kVariableReplicants, 1); + Global_Variable_Increment(kVariableReplicantsSurvivorsAtMoobus, 1); Actor_Set_At_XYZ(kActorSadik, -12.0f, -41.58f, 72.0f, 0); Actor_Face_Actor(kActorSadik, kActorClovis, true); } -- cgit v1.2.3