[Scummvm-git-logs] scummvm branch-2-2 -> b2f5b47e5809f04e82297948a1c67037b08b2994

antoniou79 a.antoniou79 at gmail.com
Fri Sep 4 20:42:02 UTC 2020


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a2ae48194d BLADERUNNER: Easier get up when McCoy is drugged
7f0585f9c8 BLADERUNNER: Use float suffix specifier in Vector init
a3f55d39e5 BLADERUNNER: Add script function Player_Has_Control()
8980dbf5be BLADERUNNER: Clean up and synch screenRectangle and bbox
b2f5b47e58 BLADERUNNER: Fix Hanoi throwing McCoy out


Commit: a2ae48194d045b1969999e34d7aa87afce6f06bc
    https://github.com/scummvm/scummvm/commit/a2ae48194d045b1969999e34d7aa87afce6f06bc
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2020-09-04T23:41:19+03:00

Commit Message:
BLADERUNNER: Easier get up when McCoy is drugged

It was impossible when max frame limit option was enabled

Changed paths:
    engines/bladerunner/script/ai/mccoy.cpp


diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp
index 6153adc8b6..b014fcba58 100644
--- a/engines/bladerunner/script/ai/mccoy.cpp
+++ b/engines/bladerunner/script/ai/mccoy.cpp
@@ -93,9 +93,29 @@ bool AIScriptMcCoy::Update() {
 	case kGoalMcCoyNR01LayDrugged:
 		if (Global_Variable_Query(kVariableNR01GetUpCounter) >= 13) {
 			Global_Variable_Set(kVariableNR01GetUpCounter, 500);
-		} if (Global_Variable_Query(kVariableNR01GetUpCounter) > 0) {
+		}
+#if BLADERUNNER_ORIGINAL_BUGS
+		if (Global_Variable_Query(kVariableNR01GetUpCounter) > 0) {
 			Global_Variable_Decrement(kVariableNR01GetUpCounter, 1);
 		}
+#else
+		// Make it easier for McCoy to get up
+		// and possible at all for (our) high fps setting
+		if (Global_Variable_Query(kVariableNR01GetUpCounter) > 0) {
+			uint maxRandBound = 1;
+			if (Global_Variable_Query(kVariableNR01GetUpCounter) < 13) {
+				if (_vm->_framesPerSecondMax) {
+					maxRandBound = 4;
+				} else {
+					maxRandBound = 2;
+				}
+			}
+
+			if ((Random_Query(1, maxRandBound)) == 1) {
+				Global_Variable_Decrement(kVariableNR01GetUpCounter, 1);
+			}
+		}
+#endif
 		break;
 
 	case kGoalMcCoyNR04PassOut:
@@ -343,7 +363,6 @@ int AIScriptMcCoy::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueI
 
 bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 	unsigned int affectionTowards;
-
 	switch (newGoalNumber) {
 	case kGoalMcCoyDefault:
 		return true;
@@ -386,6 +405,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
 		} else {
 			_animationState = 53;
 			_animationFrame = Slice_Animation_Query_Number_Of_Frames(18) - 1;
+			// redundant?
 			Actor_Set_Invisible(kActorMcCoy, false);
 		}
 		return true;
@@ -1576,6 +1596,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
 		break;
 
 	case 9:
+		// fall through
 	case 12:
 		if (_animationState < 3 || _animationState > 12) {
 			_animationState = 13;
@@ -1589,6 +1610,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
 		break;
 
 	case 10:
+		// fall through
 	case 13:
 		if (_animationState < 3 || _animationState > 12) {
 			_animationState = 13;
@@ -1602,6 +1624,7 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
 		break;
 
 	case 11:
+		// fall through
 	case 14:
 		if (_animationState < 3 || _animationState > 12) {
 			_animationState = 13;
@@ -1820,11 +1843,13 @@ bool AIScriptMcCoy::ChangeAnimationMode(int mode) {
 		}
 		break;
 	case kAnimationModeClimbUp:
+		// fall through
 	case kAnimationModeCombatClimbUp:
 		_animationState = 42;
 		_animationFrame = 0;
 		break;
 	case kAnimationModeClimbDown:
+		// fall through
 	case kAnimationModeCombatClimbDown:
 		_animationState = 43;
 		_animationFrame = 0;
@@ -1881,24 +1906,19 @@ void AIScriptMcCoy::fallDown() {
 }
 
 void AIScriptMcCoy::UG15fall() {
-	if ( Actor_Query_Which_Set_In(kActorMcCoy) == kSetUG15
-	 &&  Actor_Query_Goal_Number(kActorMcCoy) != kGoalMcCoyUG15Fall
+	if (Actor_Query_Which_Set_In(kActorMcCoy) == kSetUG15
+	 && Actor_Query_Goal_Number(kActorMcCoy) != kGoalMcCoyUG15Fall
 	 && !Game_Flag_Query(kFlagUG15BridgeBroken)
 	) {
 		float x, y, z;
 		Actor_Query_XYZ(kActorMcCoy, &x, &y, &z);
-		if ( 220.0f > z
-		 && -210.0f < x
-		 &&  -70.0f > x
-		) {
+		if (z < 220.0f && -210.0f < x && x < -70.0f) {
 			Game_Flag_Set(kFlagUG15BridgeBroken);
 			Scene_Loop_Set_Default(3); // kUG15LoopMainLoopBridgeBroken
 			Scene_Loop_Start_Special(kSceneLoopModeOnce, 2, true); // kUG15LoopBridgeBreaks
 			Actor_Set_Goal_Number(kActorMcCoy, kGoalMcCoyUG15Fall);
 			Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
-			if (-200.0 < x
-			 && -62.0f > x
-			) {
+			if (-200.0 < x && x < -62.0f) {
 				Actor_Set_Goal_Number(kActorFreeSlotA, kGoalFreeSlotAUG15Fall);
 			}
 		} else {


Commit: 7f0585f9c87cdbdc898a36c82289e1cdcb07d349
    https://github.com/scummvm/scummvm/commit/7f0585f9c87cdbdc898a36c82289e1cdcb07d349
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2020-09-04T23:41:25+03:00

Commit Message:
BLADERUNNER: Use float suffix specifier in Vector init

Changed paths:
    engines/bladerunner/vector.h


diff --git a/engines/bladerunner/vector.h b/engines/bladerunner/vector.h
index 52883cb587..d6fb12d9d8 100644
--- a/engines/bladerunner/vector.h
+++ b/engines/bladerunner/vector.h
@@ -51,7 +51,7 @@ public:
 	float y;
 	float z;
 
-	Vector3() : x(0.0), y(0.0), z(0.0) {}
+	Vector3() : x(0.0f), y(0.0f), z(0.0f) {}
 
 	Vector3(float ax, float ay, float az) : x(ax), y(ay), z(az) {}
 


Commit: a3f55d39e5fbd081d7ca2edc70cee878a1d5f916
    https://github.com/scummvm/scummvm/commit/a3f55d39e5fbd081d7ca2edc70cee878a1d5f916
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2020-09-04T23:41:31+03:00

Commit Message:
BLADERUNNER: Add script function Player_Has_Control()

Changed paths:
    engines/bladerunner/script/ai/gordo.cpp
    engines/bladerunner/script/script.cpp
    engines/bladerunner/script/script.h


diff --git a/engines/bladerunner/script/ai/gordo.cpp b/engines/bladerunner/script/ai/gordo.cpp
index 3d552a1737..5fbefc31c9 100644
--- a/engines/bladerunner/script/ai/gordo.cpp
+++ b/engines/bladerunner/script/ai/gordo.cpp
@@ -124,7 +124,7 @@ void AIScriptGordo::CompletedMovementTrack() {
 #if !BLADERUNNER_ORIGINAL_BUGS
 		    // prevent this dialogue scene if McCoy is climbing the stairs up-again
 		    // to avoid a game freeze bug
-		    && _vm->playerHasControl()
+		    && Player_Has_Control()
 #endif
 		) {
 			Actor_Force_Stop_Walking(kActorMcCoy);
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 85298edb5f..de9ceb8180 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -350,7 +350,6 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause,
 	if (pause > 0.0f && !_vm->_actorSpeakStopIsRequested) {
 		Delay(pause * 1000u);
 	}
-
 	Player_Gains_Control();
 }
 
@@ -967,6 +966,11 @@ void ScriptBase::Delay(uint32 miliseconds) {
 	Player_Gains_Control();
 }
 
+bool ScriptBase::Player_Has_Control() {
+	debugC(kDebugScript, "Player_Has_Control()");
+	return _vm->playerHasControl();
+}
+
 void ScriptBase::Player_Loses_Control() {
 	debugC(kDebugScript, "Player_Loses_Control()");
 	_vm->playerLosesControl();
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index eb8d49ebf9..d1578de69d 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -142,6 +142,7 @@ protected:
 	int Animation_Stop();
 	int Animation_Skip_To_Frame();
 	void Delay(uint32 miliseconds);
+	bool Player_Has_Control();
 	void Player_Loses_Control();
 	void Player_Gains_Control();
 	void Player_Set_Combat_Mode(bool activate);


Commit: 8980dbf5be9268c460b686ba0bb1c9d3098eabdd
    https://github.com/scummvm/scummvm/commit/8980dbf5be9268c460b686ba0bb1c9d3098eabdd
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2020-09-04T23:41:36+03:00

Commit Message:
BLADERUNNER: Clean up and synch screenRectangle and bbox

For actors and their corresponding screenObjects

This should fix the issue with Sadik's remnant hitbox in the middle of the bridge at UG18

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/actor.h
    engines/bladerunner/debugger.cpp
    engines/bladerunner/scene.cpp
    engines/bladerunner/scene_objects.cpp
    engines/bladerunner/scene_objects.h


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 3eb5d6f95f..4b9dad1c3d 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -809,6 +809,37 @@ bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
 		}
 	}
 
+#if !BLADERUNNER_ORIGINAL_BUGS
+	// For consistency we need to init the screen rectangle and bbox for the actor's *scene object*
+	// in a new scene (since we also reset the screen rectangle at Scene::open())
+	// for the case of the actor not moving
+	if (_vm->_scene->getSetId() == _setId
+	    && !_isInvisible
+	    && _vm->_sceneObjects->findById(_id + kSceneObjectOffsetActors) != -1
+	    && (_vm->_sceneObjects->isEmptyScreenRectangle(_id + kSceneObjectOffsetActors)
+	        || _vm->_sceneObjects->compareScreenRectangle(_id + kSceneObjectOffsetActors, _screenRectangle) != 0)
+	) {
+		if (isVisible) {
+			Vector3 pos = getPosition();
+			int facing = getFacing();
+			setAtXYZ(pos, facing, false, _isMoving, false);
+		} else {
+			resetScreenRectangleAndBbox();
+			_vm->_sceneObjects->resetScreenRectangleAndBbox(_id + kSceneObjectOffsetActors);
+		}
+	}
+
+	if ((_vm->_scene->getSetId() != _setId || _isInvisible || !isVisible)
+	    && !_screenRectangle.isEmpty()
+	) {
+		resetScreenRectangleAndBbox();
+		if (_vm->_sceneObjects->findById(_id + kSceneObjectOffsetActors) != -1
+		    && !_vm->_sceneObjects->isEmptyScreenRectangle(_id + kSceneObjectOffsetActors)) {
+			_vm->_sceneObjects->resetScreenRectangleAndBbox(_id + kSceneObjectOffsetActors);
+		}
+	}
+#endif
+
 	if (needsUpdate) {
 		// timeLeft is supposed to be negative or 0 here in the original!
 		int32 nextFrameTime = timeLeft + _frameMs;
@@ -953,6 +984,14 @@ void Actor::setBoundingBox(const Vector3 &position, bool retired) {
 	}
 }
 
+void Actor::resetScreenRectangleAndBbox() {
+	_screenRectangle.left   = -1;
+	_screenRectangle.top    = -1;
+	_screenRectangle.right  = -1;
+	_screenRectangle.bottom = -1;
+	_bbox.setXYZ(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+}
+
 float Actor::distanceFromView(View *view) const{
 	float xDist = _position.x - view->_cameraPosition.x;
 	float zDist = _position.z + view->_cameraPosition.y; // y<->z is intentional, not a bug
diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h
index bb1e4d3fb4..1e7169dccf 100644
--- a/engines/bladerunner/actor.h
+++ b/engines/bladerunner/actor.h
@@ -169,6 +169,8 @@ public:
 	void tickCombat();
 	bool draw(Common::Rect *screenRect);
 
+	void resetScreenRectangleAndBbox();
+
 	int getSetId()  const;
 	void setSetId(int setId);
 	const BoundingBox &getBoundingBox() const { return _bbox; }
diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index 733379783d..aabd2cbd60 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -2288,8 +2288,11 @@ void Debugger::drawSceneObjects() {
 				) {
 					color = _vm->_surfaceFront.format.RGBToColor(255, 0, 0);
 					drawBBox(a, b, _vm->_view, &_vm->_surfaceFront, color);
+					Actor *actor = _vm->_actors[sceneObject->id - kSceneObjectOffsetActors];
+					//const Common::Rect &screenRect = actor->getScreenRectangle();
+					//_vm->_surfaceFront.frameRect(screenRect, color);
 					_vm->_surfaceFront.frameRect(sceneObject->screenRectangle, color);
-					_vm->_mainFont->drawString(&_vm->_surfaceFront, _vm->_textActorNames->getText(sceneObject->id - kSceneObjectOffsetActors), pos.x, pos.y, _vm->_surfaceFront.w, color);
+					_vm->_mainFont->drawString(&_vm->_surfaceFront, _vm->_textActorNames->getText(actor->getId()), pos.x, pos.y, _vm->_surfaceFront.w, color);
 				}
 				break;
 			case kSceneObjectTypeItem:
diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp
index d137964f46..16dad7ef88 100644
--- a/engines/bladerunner/scene.cpp
+++ b/engines/bladerunner/scene.cpp
@@ -179,6 +179,11 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) {
 	for (int i = 0; i != actorCount; ++i) {
 		Actor *actor = _vm->_actors[i];
 		if (actor->getSetId() == setId) {
+			//debug("Actor added: %d", i);
+#if !BLADERUNNER_ORIGINAL_BUGS
+			// ensure that actors' "hotspot" areas from previous scene are cleared up
+			actor->resetScreenRectangleAndBbox();
+#endif
 			_vm->_sceneObjects->addActor(
 				i + kSceneObjectOffsetActors,
 				actor->getBoundingBox(),
diff --git a/engines/bladerunner/scene_objects.cpp b/engines/bladerunner/scene_objects.cpp
index 1babf0376d..6f091c21d2 100644
--- a/engines/bladerunner/scene_objects.cpp
+++ b/engines/bladerunner/scene_objects.cpp
@@ -341,6 +341,38 @@ void SceneObjects::updateObstacles() {
 	_vm->_obstacles->backup();
 }
 
+bool SceneObjects::isEmptyScreenRectangle(int sceneObjectId) {
+	int index = findById(sceneObjectId);
+	if (index != -1) {
+		const SceneObject *sceneObject = &_sceneObjects[index];
+		return sceneObject->screenRectangle.isEmpty();
+	}
+	return true;
+}
+
+int SceneObjects::compareScreenRectangle(int sceneObjectId, const Common::Rect &rectangle) {
+	int index = findById(sceneObjectId);
+	if (index != -1) {
+		const SceneObject *sceneObject = &_sceneObjects[index];
+		if (sceneObject->screenRectangle == rectangle) {
+			return 0;
+		}
+	}
+	return -1;
+}
+
+void SceneObjects::resetScreenRectangleAndBbox(int sceneObjectId) {
+	int index = findById(sceneObjectId);
+	if (index != -1) {
+		SceneObject *sceneObject = &_sceneObjects[index];
+		sceneObject->screenRectangle.left   = -1;
+		sceneObject->screenRectangle.top    = -1;
+		sceneObject->screenRectangle.right  = -1;
+		sceneObject->screenRectangle.bottom = -1;
+		sceneObject->boundingBox.setXYZ(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
+	}
+}
+
 void SceneObjects::save(SaveFileWriteStream &f) {
 	f.writeInt(_count);
 	for (int i = 0; i < kSceneObjectCount; ++i) {
diff --git a/engines/bladerunner/scene_objects.h b/engines/bladerunner/scene_objects.h
index a6d552017c..a4471162e7 100644
--- a/engines/bladerunner/scene_objects.h
+++ b/engines/bladerunner/scene_objects.h
@@ -87,12 +87,17 @@ public:
 	void setIsObstacle(int sceneObjectId, bool isObstacle);
 	void setIsTarget(int sceneObjectId, bool isTarget);
 	void updateObstacles();
+	int getCount() { return _count; }
+
+	int findById(int sceneObjectId) const;
+	bool isEmptyScreenRectangle(int sceneObjectId);
+	int compareScreenRectangle(int sceneObjectId, const Common::Rect &rectangle);
+	void resetScreenRectangleAndBbox(int sceneObjectId);
 
 	void save(SaveFileWriteStream &f);
 	void load(SaveFileReadStream &f);
 
 private:
-	int findById(int sceneObjectId) const;
 	bool addSceneObject(int sceneObjectId, SceneObjectType sceneObjectType, const BoundingBox &boundingBox, const Common::Rect &screenRectangle, bool isClickable, bool isObstacle, uint8 unknown1, bool isTarget, bool isMoving, bool isRetired);
 	int findEmpty() const;
 };


Commit: b2f5b47e5809f04e82297948a1c67037b08b2994
    https://github.com/scummvm/scummvm/commit/b2f5b47e5809f04e82297948a1c67037b08b2994
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2020-09-04T23:41:43+03:00

Commit Message:
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

Changed paths:
    engines/bladerunner/script/ai/dektora.cpp
    engines/bladerunner/script/ai/hanoi.cpp
    engines/bladerunner/script/scene/nr01.cpp
    engines/bladerunner/script/scene/nr03.cpp
    engines/bladerunner/script/scene/nr05.cpp


diff --git a/engines/bladerunner/script/ai/dektora.cpp b/engines/bladerunner/script/ai/dektora.cpp
index b2cf124fc4..3c290fe118 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 31ca209a71..6199a0647c 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 08d62d76ae..db86122379 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 a8a93e2001..e56aeeeaef 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 eccdfe9d64..9ff1a5b5fb 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;




More information about the Scummvm-git-logs mailing list