From f70251819aa2e5e9715a25bf8c4ed26394a164cf Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Thu, 21 Feb 2019 20:37:23 +0100 Subject: BLADERUNNER: Fixed CppCheck warnings Rat interaction at UG15 is now working exactly as in the original game. Before the bridge didn't break if player shot the rat on it. --- engines/bladerunner/script/ai/free_slot_a.cpp | 16 +++++++--------- engines/bladerunner/script/ai/officer_leary.cpp | 7 +------ engines/bladerunner/script/ai_script.h | 2 +- engines/bladerunner/script/scene/ar01.cpp | 2 +- engines/bladerunner/script/scene/nr07.cpp | 2 +- engines/bladerunner/script/script.cpp | 2 -- 6 files changed, 11 insertions(+), 20 deletions(-) (limited to 'engines/bladerunner/script') diff --git a/engines/bladerunner/script/ai/free_slot_a.cpp b/engines/bladerunner/script/ai/free_slot_a.cpp index f31fbaa550..c80b4da778 100644 --- a/engines/bladerunner/script/ai/free_slot_a.cpp +++ b/engines/bladerunner/script/ai/free_slot_a.cpp @@ -202,13 +202,14 @@ void AIScriptFreeSlotA::OtherAgentEnteredCombatMode(int otherActorId, int combat } void AIScriptFreeSlotA::ShotAtAndMissed() { - if (Actor_Query_In_Set(kActorFreeSlotA, kSetUG15)) - calcHit(); + if (Actor_Query_In_Set(kActorFreeSlotA, kSetUG15)) { + checkIfOnBridge(); + } } bool AIScriptFreeSlotA::ShotAtAndHit() { if (Actor_Query_In_Set(kActorFreeSlotA, kSetUG15)) { - calcHit(); + checkIfOnBridge(); Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Die); return true; } @@ -539,14 +540,11 @@ void AIScriptFreeSlotA::FledCombat() { // return false; } -void AIScriptFreeSlotA::calcHit() { +void AIScriptFreeSlotA::checkIfOnBridge() { float x, y, z; - Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z); - - if (x >= -30.0f - && x < -150.0f - ) { + // bug? this should probably check if McCoy is close enough because bridge will break long after rat died and player tries to walk through + if (-150.0 <= x && x < -30.0f) { Game_Flag_Set(kFlagUG15BridgeWillBreak); } } diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp index 69ec583a6a..d1e7eea4d7 100644 --- a/engines/bladerunner/script/ai/officer_leary.cpp +++ b/engines/bladerunner/script/ai/officer_leary.cpp @@ -539,9 +539,6 @@ bool AIScriptOfficerLeary::GoalChanged(int currentGoalNumber, int newGoalNumber) } bool AIScriptOfficerLeary::UpdateAnimation(int *animation, int *frame) { - int v57; - int a1; - switch (_animationState) { case 32: *animation = 603; @@ -872,10 +869,8 @@ bool AIScriptOfficerLeary::UpdateAnimation(int *animation, int *frame) { *animation = 591; } if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(*animation) / 2) { - a1 = *animation; _animationFrame += 3; - v57 = _animationFrame; - if (v57 > Slice_Animation_Query_Number_Of_Frames(a1) - 1) { + if (_animationFrame > Slice_Animation_Query_Number_Of_Frames(*animation) - 1) { _animationFrame = 0; _animationState = _animationStateNext; *animation = _animationNext; diff --git a/engines/bladerunner/script/ai_script.h b/engines/bladerunner/script/ai_script.h index 5c5a77457d..6c857da43c 100644 --- a/engines/bladerunner/script/ai_script.h +++ b/engines/bladerunner/script/ai_script.h @@ -462,7 +462,7 @@ DECLARE_SCRIPT(FreeSlotA) float _fallHeightCurrent; float _fallHeightTarget; - void calcHit(); + void checkIfOnBridge(); void goToRandomUGxx(); END_SCRIPT diff --git a/engines/bladerunner/script/scene/ar01.cpp b/engines/bladerunner/script/scene/ar01.cpp index 1213f47814..6c6067d1d5 100644 --- a/engines/bladerunner/script/scene/ar01.cpp +++ b/engines/bladerunner/script/scene/ar01.cpp @@ -111,7 +111,7 @@ void SceneScriptAR01::InitializeScene() { && Game_Flag_Query(kFlagHC01toAR01) ) { Scene_Loop_Set_Default(kAR01LoopMainLoopNoSpinner); - } else { + } else { // bug? branch content is equal to previous branch Scene_Loop_Set_Default(kAR01LoopMainLoopNoSpinner); } } diff --git a/engines/bladerunner/script/scene/nr07.cpp b/engines/bladerunner/script/scene/nr07.cpp index 6fbebd22ff..02224d0b09 100644 --- a/engines/bladerunner/script/scene/nr07.cpp +++ b/engines/bladerunner/script/scene/nr07.cpp @@ -241,7 +241,7 @@ void SceneScriptNR07::clickedOnVase() { int friendliness = Actor_Query_Friendliness_To_Other(kActorDektora, kActorMcCoy); if (friendliness > 50) { Actor_Modify_Friendliness_To_Other(kActorDektora, kActorMcCoy, 2); - } else if (friendliness <= 50) { + } else { Actor_Modify_Friendliness_To_Other(kActorDektora, kActorMcCoy, -2); } Actor_Says(kActorMcCoy, 3600, 19); diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 9e2097b2d9..e38477d03f 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -96,8 +96,6 @@ bool ScriptBase::Region_Check(int left, int top, int right, int down) { && _vm->_sceneScript->_mouseY >= top && _vm->_sceneScript->_mouseX <= right && _vm->_sceneScript->_mouseY <= down; - - return false; } bool ScriptBase::Object_Query_Click(const char *objectName1, const char *objectName2) { -- cgit v1.2.3