[Scummvm-git-logs] scummvm master -> 03521f7ab9f077423f1f80930e682afb6cad9b89

antoniou79 a.antoniou79 at gmail.com
Tue Feb 4 15:58:43 UTC 2020


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

Summary:
52ab36f799 BLADERUNNER: Fix buggy smoke overlay for DR04
b96479c58b BLADERUNNER: Added bbox and screenRectangle info for list actors
8c771b4883 BLADERUNNER: Fix barrel flame glitch in loops from DR04 to DR01
8791a89554 BLADERUNNER: Some clarification comments for methods
be9557d698 BLADERUNNER: Attempt to fix the glitch in InShot to MA05
03521f7ab9 BLADERUNNER: Fix bug and inconsitency with weapons forms


Commit: 52ab36f799af82d819a0ef3c36d0c1bab8d5262b
    https://github.com/scummvm/scummvm/commit/52ab36f799af82d819a0ef3c36d0c1bab8d5262b
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:27+02:00

Commit Message:
BLADERUNNER: Fix buggy smoke overlay for DR04

Smoke after Dermo labs explosion - original game bug

Changed paths:
    engines/bladerunner/vqa_player.cpp


diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index 4925ca7..bdcba7b 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -48,6 +48,10 @@ bool VQAPlayer::open() {
 	// TB05 has wrong end of a loop and this will load empty zbuffer from next loop, which will lead to broken pathfinding
 	if (_name.equals("TB05_2.VQA")) {
 		_decoder._loopInfo.loops[1].end = 60;
+	} else if (_name.equals("DR04OVER.VQA")) {
+		// smoke (overlay) after explosion of Dermo Labs in DR04
+		// This has still frames in the end that so it looked as if the smoke was "frozen"
+		_decoder._loopInfo.loops[0].end  = 58; // 59 up to 74 are still frames
 	}
 #endif
 


Commit: b96479c58b0f38b7688a4f29d4724493702f1d1f
    https://github.com/scummvm/scummvm/commit/b96479c58b0f38b7688a4f29d4724493702f1d1f
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:27+02:00

Commit Message:
BLADERUNNER: Added bbox and screenRectangle info for list actors

Also fixed the width / height reversed order in item list id command

Changed paths:
    engines/bladerunner/debugger.cpp


diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index 566c4eb..2151917 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -1572,7 +1572,7 @@ bool Debugger::cmdItem(int argc, const char **argv) {
 					            _vm->_items->isTarget(itemId)?  "T" : "F",
 					            _vm->_items->isVisible(itemId)? "T" : "F",
 					            xpos_curr, ypos_curr, zpos_curr,
-					            facing_curr, currWidth, currHeight, itemAnimationId,
+					            facing_curr, currHeight, currWidth, itemAnimationId,
 					            screenRect.top, screenRect.left, screenRect.bottom, screenRect.right,
 					            x0_curr, y0_curr, z0_curr, x1_curr, y1_curr, z1_curr);
 				} else if (modeName == "remove") {
@@ -1938,24 +1938,36 @@ bool Debugger::cmdList(int argc, const char **argv) {
 					SceneObjects::SceneObject *sceneObject = &_vm->_sceneObjects->_sceneObjects[_vm->_sceneObjects->_sceneObjectsSortedByDistance[i]];
 
 					if (sceneObject->type == kSceneObjectTypeActor) {
+
 						Actor *actor = _vm->_actors[sceneObject->id - kSceneObjectOffsetActors];
-						debugPrintf("%d: %s (Clk: %s, Trg: %s, Prs: %s, Obs: %s, Mvg: %s)\n    Goal: %d, Set: %d, Anim mode: %d id:%d showDmg: %s inCombat: %s\n    Pos(%02.2f,%02.2f,%02.2f)\n",
-									 sceneObject->id - kSceneObjectOffsetActors,
-									 _vm->_textActorNames->getText(sceneObject->id - kSceneObjectOffsetActors),
-									 sceneObject->isClickable? "T" : "F",
-									 sceneObject->isTarget?    "T" : "F",
-									 sceneObject->isPresent?   "T" : "F",
-									 sceneObject->isObstacle?  "T" : "F",
-									 sceneObject->isMoving?    "T" : "F",
-									 actor->getGoal(),
-									 actor->getSetId(),
-									 actor->getAnimationMode(),
-									 actor->getAnimationId(),
-									 actor->getFlagDamageAnimIfMoving()? "T" : "F",
-									 actor->inCombat()? "T" : "F",
-									 actor->getPosition().x,
-									 actor->getPosition().y,
-									 actor->getPosition().z);
+						const Common::Rect &screenRect = actor->getScreenRectangle();
+						const BoundingBox &bbox = actor->getBoundingBox();
+						Vector3 a, b;
+						bbox.getXYZ(&a.x, &a.y, &a.z, &b.x, &b.y, &b.z);
+
+						debugPrintf("%d: %s (Clk: %s, Trg: %s, Prs: %s, Obs: %s, Mvg: %s)\n",
+						             sceneObject->id - kSceneObjectOffsetActors,
+						             _vm->_textActorNames->getText(sceneObject->id - kSceneObjectOffsetActors),
+						             sceneObject->isClickable? "T" : "F",
+						             sceneObject->isTarget?    "T" : "F",
+						             sceneObject->isPresent?   "T" : "F",
+						             sceneObject->isObstacle?  "T" : "F",
+						             sceneObject->isMoving?    "T" : "F");
+						debugPrintf("    Goal: %d, Set: %d, Anim mode: %d id:%d showDmg: %s inCombat: %s\n",
+						             actor->getGoal(),
+						             actor->getSetId(),
+						             actor->getAnimationMode(),
+						             actor->getAnimationId(),
+						             actor->getFlagDamageAnimIfMoving()? "T" : "F",
+						             actor->inCombat()? "T" : "F");
+						debugPrintf("    Pos(%02.2f,%02.2f,%02.2f)\n",
+						             actor->getPosition().x,
+						             actor->getPosition().y,
+						             actor->getPosition().z);
+						debugPrintf("    ScreenRect(%03d,%03d,%03d,%03d)\n",
+						             screenRect.top, screenRect.left, screenRect.bottom, screenRect.right);
+						debugPrintf("    Bbox(%02.2f,%02.2f,%02.2f) ~ (%02.2f,%02.2f,%02.2f)\n",
+						             a.x, a.y, a.z, b.x, b.y, b.z);
 						++count;
 					}
 				}


Commit: 8c771b488398f2157e1dc7beb39472162e126ec2
    https://github.com/scummvm/scummvm/commit/8c771b488398f2157e1dc7beb39472162e126ec2
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:27+02:00

Commit Message:
BLADERUNNER: Fix barrel flame glitch in loops from DR04 to DR01

Also add explicit set density for fog in UG01 when steam is enabled

Changed paths:
    engines/bladerunner/scene.cpp
    engines/bladerunner/script/scene/dr01.cpp
    engines/bladerunner/script/scene/dr04.cpp
    engines/bladerunner/script/scene/dr05.cpp
    engines/bladerunner/script/scene/ug01.cpp
    engines/bladerunner/script/script.cpp
    engines/bladerunner/script/script.h


diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp
index 7b828ed..7ee784f 100644
--- a/engines/bladerunner/scene.cpp
+++ b/engines/bladerunner/scene.cpp
@@ -157,7 +157,13 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) {
 	if (_specialLoopMode == kSceneLoopModeNone) {
 		startDefaultLoop();
 	}
+
+#if BLADERUNNER_ORIGINAL_BUGS
+	// TODO Is this advanced frame (frame skip) required here?
+	// For a little testing without it, it seems to be redundant (or even unwanted)
+	// and it is contributing to the barrel flame glitch in pan from DR04 to DR01
 	advanceFrame();
+#endif // BLADERUNNER_ORIGINAL_BUGS
 
 	_vm->_playerActor->setAtXYZ(_actorStartPosition, _actorStartFacing);
 	_vm->_playerActor->setSetId(setId);
diff --git a/engines/bladerunner/script/scene/dr01.cpp b/engines/bladerunner/script/scene/dr01.cpp
index ad6f441..6a0ac2d 100644
--- a/engines/bladerunner/script/scene/dr01.cpp
+++ b/engines/bladerunner/script/scene/dr01.cpp
@@ -25,11 +25,11 @@
 namespace BladeRunner {
 
 enum kDR01Loops {
-	kDR01LoopBikerInshot          = 0,
-	kDR01LoopPanFromDR02          = 1,
-	kDR01LoopPanFromDR04Pre       = 2,
-	kDR01LoopPanFromDR04Post      = 3,
-	kDR01LoopMainLoop             = 4
+	kDR01LoopBikerInshot          = 0, //   0 -  74
+	kDR01LoopPanFromDR02          = 1, //  75 -  88
+	kDR01LoopPanFromDR04Pre       = 2, //  89 - 116
+	kDR01LoopPanFromDR04Post      = 3, // 117 - 144
+	kDR01LoopMainLoop             = 4  // 145 - 205
 };
 
 void SceneScriptDR01::InitializeScene() {
@@ -273,13 +273,27 @@ bool SceneScriptDR01::ClickedOn2DRegion(int region) {
 
 void SceneScriptDR01::SceneFrameAdvanced(int frame) {
 	if (frame < 75) {
+		// TODO This keeps setting McCoy as invisible while in this frame range
+		//      However the performance impact is negligible from this call
 		Actor_Set_Invisible(kActorMcCoy, true);
 	} else {
+		// TODO This keeps setting McCoy as visible while in this frame range
+		//      However the performance impact is negligible from this call
 		Actor_Set_Invisible(kActorMcCoy, false);
 	}
 	if (frame == 2) {
 		Ambient_Sounds_Play_Sound(kSfxBIKEMIX4, 40, -40, 100, 99);
 	}
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+	// Disable rogue barrel flame effect during the pan from DR04 to DR01
+	if (frame == 89 || frame == 117 ){
+		Screen_Effect_Skip(0, false);
+	}
+	if (frame == 116 || frame == 144) {
+		Screen_Effect_Restore_All(false);
+	}
+#endif
 }
 
 void SceneScriptDR01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
diff --git a/engines/bladerunner/script/scene/dr04.cpp b/engines/bladerunner/script/scene/dr04.cpp
index 8664589..7b9f355 100644
--- a/engines/bladerunner/script/scene/dr04.cpp
+++ b/engines/bladerunner/script/scene/dr04.cpp
@@ -25,11 +25,11 @@
 namespace BladeRunner {
 
 enum kDR04Loops {
-	kDR04LoopPanFromDR01PostExplosion = 0,
-	kDR04LoopMainPostExplosion        = 1,
-	kDR04LoopPanFromDR01PreExplosion  = 3,
-	kDR04LoopMainPreExplosion         = 4,
-	kDR04LoopDR04Explosion            = 6
+	kDR04LoopPanFromDR01PostExplosion = 0, //   0 -  27
+	kDR04LoopMainPostExplosion        = 1, //  28 -  88
+	kDR04LoopPanFromDR01PreExplosion  = 3, //  89 - 116
+	kDR04LoopMainPreExplosion         = 4, // 117 - 177
+	kDR04LoopDR04Explosion            = 6  // 178 - 237
 };
 
 void SceneScriptDR04::InitializeScene() {
diff --git a/engines/bladerunner/script/scene/dr05.cpp b/engines/bladerunner/script/scene/dr05.cpp
index 0ae0f28..7d9bd2f 100644
--- a/engines/bladerunner/script/scene/dr05.cpp
+++ b/engines/bladerunner/script/scene/dr05.cpp
@@ -25,8 +25,8 @@
 namespace BladeRunner {
 
 enum kDR05Loops {
-	kDR05LoopMainLoop      = 0,
-	kDR05LoopMainDestroyed = 2
+	kDR05LoopMainLoop      = 0, //  0 -  60
+	kDR05LoopMainDestroyed = 2  // 61 - 121
 };
 
 void SceneScriptDR05::InitializeScene() {
diff --git a/engines/bladerunner/script/scene/ug01.cpp b/engines/bladerunner/script/scene/ug01.cpp
index b2fbc51..4da6e7b 100644
--- a/engines/bladerunner/script/scene/ug01.cpp
+++ b/engines/bladerunner/script/scene/ug01.cpp
@@ -86,7 +86,23 @@ void SceneScriptUG01::SceneLoaded() {
 #if BLADERUNNER_ORIGINAL_BUGS
 #else
 	if (Game_Flag_Query(kFlagUG01SteamOff)) {
-		Screen_Effect_Skip(0);
+		Screen_Effect_Skip(0, true);
+	}
+
+	// TODO: Is there a possibility that the fog boxes
+	//       start with this density by default,
+	//       so we don't have to set it explicitly?
+	if (!Game_Flag_Query(kFlagUG01SteamOff)) {
+		float density = 60.0f / 29500.0f;
+		Set_Fog_Density("BoxFog01", density);
+		Set_Fog_Density("BoxFog02", density);
+		Set_Fog_Density("BoxFog03", density);
+		Set_Fog_Density("BoxFog04", density);
+	} else {
+		Set_Fog_Density("BoxFog01", 0.0f);
+		Set_Fog_Density("BoxFog02", 0.0f);
+		Set_Fog_Density("BoxFog03", 0.0f);
+		Set_Fog_Density("BoxFog04", 0.0f);
 	}
 #endif // BLADERUNNER_ORIGINAL_BUGS
 }
@@ -98,7 +114,7 @@ bool SceneScriptUG01::MouseClick(int x, int y) {
 bool SceneScriptUG01::ClickedOn3DObject(const char *objectName, bool a2) {
 	if (Object_Query_Click("PIPES_FG_LFT", objectName)) {
 		if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -9.0f, -50.13f, -148.0f, 0, true, false, false)
-		 && !Game_Flag_Query(kFlagUG01SteamOff)
+		    && !Game_Flag_Query(kFlagUG01SteamOff)
 		) {
 #if BLADERUNNER_ORIGINAL_BUGS
 			Actor_Says(kActorMcCoy, 8525, 13);
@@ -106,7 +122,7 @@ bool SceneScriptUG01::ClickedOn3DObject(const char *objectName, bool a2) {
 			Scene_Loop_Start_Special(kSceneLoopModeOnce, kUG01LoopSteamDissapating, true);
 #else
 			Sound_Play(kSfxSQUEAK1,  40, 0, 0, 50);
-			Screen_Effect_Skip(0);
+			Screen_Effect_Skip(0, true);
 			Scene_Loop_Set_Default(kUG01LoopMainLoopNoSteam);
 			Scene_Loop_Start_Special(kSceneLoopModeOnce, kUG01LoopSteamDissapating, false);
 			Sound_Play(kSfxSTEAM6A,  40, 0, 0, 50);
@@ -164,15 +180,17 @@ bool SceneScriptUG01::ClickedOn2DRegion(int region) {
 }
 
 void SceneScriptUG01::SceneFrameAdvanced(int frame) {
-	if (frame >= 61
-	 && frame <= 120
-	) {
-		float density = (120 - frame) / 29500.0f; // why is this so big?
+	if (frame >= 61 && frame <= 120) {
+		// fog dispersing
+		// Divide with a large number because otherwise, thick fog appears too white
+		float density = (120.0f - frame) / 29500.0f;
 		Set_Fog_Density("BoxFog01", density);
 		Set_Fog_Density("BoxFog02", density);
 		Set_Fog_Density("BoxFog03", density);
 		Set_Fog_Density("BoxFog04", density);
 	} else if (frame > 120) {
+		// fog dispersed
+		// TODO does it have to constantly be set?
 		Set_Fog_Density("BoxFog01", 0.0f);
 		Set_Fog_Density("BoxFog02", 0.0f);
 		Set_Fog_Density("BoxFog03", 0.0f);
@@ -209,7 +227,7 @@ void SceneScriptUG01::PlayerWalkedOut() {
 	Ambient_Sounds_Remove_All_Looping_Sounds(1);
 #if BLADERUNNER_ORIGINAL_BUGS
 #else
-	Screen_Effect_Restore_All();
+	Screen_Effect_Restore_All(false);
 #endif // BLADERUNNER_ORIGINAL_BUGS
 }
 
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index e09c5f7..e6a5a25 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -897,22 +897,37 @@ void ScriptBase::Set_Subtitle_Text_On_Screen(Common::String displayText) {
 
 #if BLADERUNNER_ORIGINAL_BUGS
 #else
-void ScriptBase::Screen_Effect_Skip(int effectInc) {
+/**
+* USE WITH CAUTION
+* Methods to remove a rogue effect from a scene
+*
+* In UG01 we need a forced frame skip to make the effect disappear properly (without delay)
+* However other times we might not need this extra frame skip (eg. in transition pan from DR04 to DR01)
+* -- especially in scenes where events, effects, sounds etc are triggered at specific frames
+* TODO: Is there a better way to update the effect state without force skipping a frame?
+*/
+void ScriptBase::Screen_Effect_Skip(int effectInc, bool forceExtraFrameSkip) {
 	debugC(kDebugScript, "Screen_Effect_Skip(%d)", effectInc);
 	_vm->_screenEffects->toggleEntry(effectInc, true);
-	_vm->_scene->advanceFrame(false);
+	if (forceExtraFrameSkip) {
+		_vm->_scene->advanceFrame(false);
+	}
 }
 
-void ScriptBase::Screen_Effect_Restore(int effectInc) {
+void ScriptBase::Screen_Effect_Restore(int effectInc, bool forceExtraFrameSkip) {
 	debugC(kDebugScript, "Screen_Effect_Restore(%d)", effectInc);
 	_vm->_screenEffects->toggleEntry(effectInc, false);
-	_vm->_scene->advanceFrame(false);
+	if (forceExtraFrameSkip) {
+		_vm->_scene->advanceFrame(false);
+	}
 }
 
-void ScriptBase::Screen_Effect_Restore_All() {
+void ScriptBase::Screen_Effect_Restore_All(bool forceExtraFrameSkip) {
 	debugC(kDebugScript, "Screen_Effect_Restore_All()");
 	_vm->_screenEffects->toggleEntry(-1, false);
-	_vm->_scene->advanceFrame(false);
+	if (forceExtraFrameSkip) {
+		_vm->_scene->advanceFrame(false);
+	}
 }
 #endif // BLADERUNNER_ORIGINAL_BUGS
 
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index 832c22e..828a736 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -132,9 +132,9 @@ protected:
 	void Set_Subtitle_Text_On_Screen(Common::String displayText);
 #if BLADERUNNER_ORIGINAL_BUGS
 #else
-	void Screen_Effect_Skip(int effectInc);
-	void Screen_Effect_Restore(int effectInc);
-	void Screen_Effect_Restore_All();
+	void Screen_Effect_Skip(int effectInc, bool forceExtraSceneFrameSkip);
+	void Screen_Effect_Restore(int effectInc, bool forceExtraSceneFrameSkip);
+	void Screen_Effect_Restore_All(bool forceExtraSceneFrameSkip);
 #endif // BLADERUNNER_ORIGINAL_BUGS
 	int Animation_Open();
 	int Animation_Close();


Commit: 8791a89554ca29af4e6c3a165d1f23a882aa6e88
    https://github.com/scummvm/scummvm/commit/8791a89554ca29af4e6c3a165d1f23a882aa6e88
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:27+02:00

Commit Message:
BLADERUNNER: Some clarification comments for methods

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/aud_stream.cpp
    engines/bladerunner/set_effects.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index b4f30eb..5b29a97 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -807,6 +807,7 @@ void Actor::setSetId(int setId) {
 
 	int i;
 
+	// leaving _setId for setId
 	if (_setId > 0) {
 		for (i = 0; i < (int)_vm->_gameInfo->getActorCount(); i++) {
 			if (_vm->_actors[i]->_id != _id && _vm->_actors[i]->_setId == _setId) {
@@ -814,6 +815,7 @@ void Actor::setSetId(int setId) {
 			}
 		}
 	}
+	// _setId updated to new (arrived in) setId
 	_setId = setId;
 	_vm->_aiScripts->enteredScene(_id, _setId);
 	if (_setId > 0) {
diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp
index 7396cbf..ff2f9d2 100644
--- a/engines/bladerunner/aud_stream.cpp
+++ b/engines/bladerunner/aud_stream.cpp
@@ -126,6 +126,9 @@ bool AudStream::rewind() {
 	return true;
 }
 
+/**
+* Returns audio length in milliseconds
+*/
 int AudStream::getLength() const {
 	int bytesPerSecond = _overrideFrequency > 0 ? _overrideFrequency : _frequency;
 	if (_flags & 1) { // 16 bit
diff --git a/engines/bladerunner/set_effects.cpp b/engines/bladerunner/set_effects.cpp
index 72809f9..9b7239d 100644
--- a/engines/bladerunner/set_effects.cpp
+++ b/engines/bladerunner/set_effects.cpp
@@ -107,6 +107,10 @@ void SetEffects::setFadeDensity(float density) {
 	_fadeDensity = density;
 }
 
+/**
+* Set fog color for fog effect named fogName.
+* RGB arguments are percentages of red, green and blue
+*/
 void SetEffects::setFogColor(const Common::String &fogName, float r, float g, float b) {
 	Fog *fog = findFog(fogName);
 	if (fog == nullptr) {


Commit: be9557d698c17fb6538dbf1a42a6cccb371423c9
    https://github.com/scummvm/scummvm/commit/be9557d698c17fb6538dbf1a42a6cccb371423c9
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:27+02:00

Commit Message:
BLADERUNNER: Attempt to fix the glitch in InShot to MA05

This is a failed attempt, however I'm keeping the code for future reference and possible improvement on it

Changed paths:
    engines/bladerunner/vqa_player.cpp


diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index bdcba7b..cd965c5 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -53,6 +53,15 @@ bool VQAPlayer::open() {
 		// This has still frames in the end that so it looked as if the smoke was "frozen"
 		_decoder._loopInfo.loops[0].end  = 58; // 59 up to 74 are still frames
 	}
+//	else if (_name.equals("MA05_3.VQA")) {
+//		// loops[1] 60 up to 90 (it will be followed by loops[2] which will play from 30 to 90
+//		// this is to address the issue of non-aligned headlight rotation in the
+//		// InShot transition in Act 5. However, this is still glitchy
+//		// and results in bad z-buffer for the duration of the truncated loop 1
+//		// TODO is there a way to get and use the z-buffering info from start frame without displaying it?
+//		_decoder._loopInfo.loops[1].begin = 60;
+//		_decoder._loopInfo.loops[2].begin = 30;
+//	}
 #endif
 
 	_hasAudio = _decoder.hasAudio();


Commit: 03521f7ab9f077423f1f80930e682afb6cad9b89
    https://github.com/scummvm/scummvm/commit/03521f7ab9f077423f1f80930e682afb6cad9b89
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2020-02-04T17:55:28+02:00

Commit Message:
BLADERUNNER: Fix bug and inconsitency with weapons forms

Changed paths:
    engines/bladerunner/game_constants.h
    engines/bladerunner/script/scene/ct11.cpp
    engines/bladerunner/script/scene/ps04.cpp
    engines/bladerunner/script/scene/ps15.cpp
    engines/bladerunner/script/scene/ug13.cpp


diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h
index d641eb5..44fd062 100644
--- a/engines/bladerunner/game_constants.h
+++ b/engines/bladerunner/game_constants.h
@@ -222,7 +222,7 @@ enum Clues {
 	kClueCrazylegsInterview1               = 116,
 	kClueCrazylegsInterview2               = 117,
 	kClueLichenDogWrapper                  = 118,
-	kClueRequisitionForm                   = 119,
+	kClueRequisitionForm                   = 119, // original: Never acquired
 	kClueScaryChair                        = 120,
 	kClueIzosStashRaided                   = 121,
 	kClueHomelessManInterview1             = 122,
@@ -230,7 +230,7 @@ enum Clues {
 	kClueHomelessManKid                    = 124,
 	kClueFolder                            = 125,
 	kClueGuzzaFramedMcCoy                  = 126,
-	kClueOriginalShippingForm              = 127,
+	kClueOriginalShippingForm              = 127, // original: Never acquired
 	kClueOriginalRequisitionForm           = 128,
 	kClueCandyWrapper                      = 129,
 	kClueGordoBlabs                        = 130,
@@ -1107,7 +1107,7 @@ enum Flags {
 	kFlagUG19Available                        = 665,
 	kFlagMcCoyFreedOfAccusations              = 666,
 	// 667 is never used
-	// 668 is never used
+	kFlagUG13OriginalRequisitionFormPlaced    = 668, // Re-purposed. Original: 668 is never used
 	kFlagKP02DispatchOnToxicKipple            = 669, // Re-purposed. Original: 669 is never used
 	kFlagCallWithGuzza                        = 670,
 	kFlagUG18GuzzaScene                       = 671,
@@ -1928,7 +1928,7 @@ enum GameModelAnimations {
 	kModelAnimationMaggieBracelet              = 956,
 	kModelAnimationGrigoriansNote              = 957,
 	kModelAnimationOriginalRequisitionForm     = 958,
-	kModelAnimationOriginalShippingForm        = 959,
+	kModelAnimationOriginalShippingForm        = 959, // original: Never placed in game world
 	kModelAnimationPowerSource                 = 960,
 	kModelAnimationCollectionReceipt           = 961,
 	kModelAnimationRequisitionForm             = 962,
diff --git a/engines/bladerunner/script/scene/ct11.cpp b/engines/bladerunner/script/scene/ct11.cpp
index 8910e92..3ae3613 100644
--- a/engines/bladerunner/script/scene/ct11.cpp
+++ b/engines/bladerunner/script/scene/ct11.cpp
@@ -62,7 +62,7 @@ void SceneScriptCT11::SceneLoaded() {
 	Unobstacle_Object("BOX SOUTH 1", true);
 	if (Global_Variable_Query(kVariableChapter) < 4) {
 		if (!Game_Flag_Query(kFlagCT11DogWrapperTaken)) {
-			Item_Add_To_World(kItemDogWrapper, kModelAnimationLichenDogWrapper, 33, 640.21f, 30.0f, 470.0f, 512, 12, 12, false, true, false, true);
+			Item_Add_To_World(kItemDogWrapper, kModelAnimationLichenDogWrapper, kSetCT11, 640.21f, 30.0f, 470.0f, 512, 12, 12, false, true, false, true);
 			Scene_2D_Region_Add(0, 505, 316, 513, 321);
 			Game_Flag_Set(kFlagCT11DogWrapperAvailable);
 		}
diff --git a/engines/bladerunner/script/scene/ps04.cpp b/engines/bladerunner/script/scene/ps04.cpp
index 2d679d9..6a2fd8a 100644
--- a/engines/bladerunner/script/scene/ps04.cpp
+++ b/engines/bladerunner/script/scene/ps04.cpp
@@ -101,6 +101,7 @@ bool SceneScriptPS04::ClickedOnActor(int actorId) {
 }
 
 bool SceneScriptPS04::ClickedOnItem(int itemId, bool a2) {
+#if BLADERUNNER_ORIGINAL_BUGS
 	if (itemId == kItemWeaponsOrderForm
 	 && Actor_Query_Is_In_Current_Set(kActorGuzza)
 	) {
@@ -109,12 +110,21 @@ bool SceneScriptPS04::ClickedOnItem(int itemId, bool a2) {
 		Item_Remove_From_World(kItemWeaponsOrderForm);
 		Item_Pickup_Spin_Effect(kModelAnimationOriginalRequisitionForm, 464, 362);
 		Actor_Says(kActorMcCoy, 4485, kAnimationModeTalk);
-#if BLADERUNNER_ORIGINAL_BUGS
-		Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm, true, kActorMcCoy); // A bug? Shouldn't the last argument be -1 here?
+		Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm, true, kActorMcCoy);
+	}
 #else
-		Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm, true, -1);
-#endif // BLADERUNNER_ORIGINAL_BUGS
+	// bugfix: correct code, this is only for clicking on the kItemWeaponsOrderForm
+	if (itemId == kItemWeaponsOrderForm) {
+		if (Actor_Query_Is_In_Current_Set(kActorGuzza)) {
+			Actor_Says(kActorGuzza, 560, 30);
+		} else if (!Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)) {
+			Item_Remove_From_World(kItemWeaponsOrderForm);
+			Item_Pickup_Spin_Effect(kModelAnimationOriginalRequisitionForm, 464, 362);
+			Actor_Says(kActorMcCoy, 4485, kAnimationModeTalk);
+			Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm, true, kActorMcCoy);
+		}
 	}
+#endif // BLADERUNNER_ORIGINAL_BUGS
 	return false;
 }
 
@@ -244,8 +254,8 @@ void SceneScriptPS04::dialogueWithGuzza() {
 		break;
 
 	case 130: // REPORT IN
-		if ( Game_Flag_Query(kFlagZubenRetired)
-		 && !Game_Flag_Query(kFlagPS04GuzzaTalkZubenRetired)
+		if (Game_Flag_Query(kFlagZubenRetired)
+		    && !Game_Flag_Query(kFlagPS04GuzzaTalkZubenRetired)
 		) {
 			Actor_Says(kActorMcCoy, 3920, 13);
 			Actor_Says(kActorGuzza, 140, 30);
@@ -294,8 +304,8 @@ void SceneScriptPS04::dialogueWithGuzza() {
 				Game_Flag_Set(kFlagZubenBountyPaid); // not a proper bug, but was missing from original code, so the flag would remain in non-consistent state in this case
 			}
 #endif // BLADERUNNER_ORIGINAL_BUGS
-		} else if ( Game_Flag_Query(kFlagZubenSpared)
-		        && !Game_Flag_Query(kFlagPS04GuzzaTalkZubenEscaped)
+		} else if (Game_Flag_Query(kFlagZubenSpared)
+		           && !Game_Flag_Query(kFlagPS04GuzzaTalkZubenEscaped)
 		) {
 			Actor_Says(kActorMcCoy, 3955, 13);
 			Actor_Says(kActorGuzza, 280, 30);
@@ -316,13 +326,11 @@ void SceneScriptPS04::dialogueWithGuzza() {
 			}
 #endif // BLADERUNNER_ORIGINAL_BUGS
 			Game_Flag_Set(kFlagPS04GuzzaTalkZubenEscaped);
-		} else if (
-		 (   Actor_Clue_Query(kActorMcCoy, kClueChopstickWrapper)
-		  || Actor_Clue_Query(kActorMcCoy, kClueSushiMenu)
-		 )
-		 &&  Actor_Clue_Query(kActorMcCoy, kClueRunciterInterviewA)
-		 &&  Actor_Query_Friendliness_To_Other(kActorGuzza, kActorMcCoy) < 50
-		 && !Game_Flag_Query(kFlagPS04GuzzaTalk1)
+		} else if ((Actor_Clue_Query(kActorMcCoy, kClueChopstickWrapper)
+		            || Actor_Clue_Query(kActorMcCoy, kClueSushiMenu))
+		           &&  Actor_Clue_Query(kActorMcCoy, kClueRunciterInterviewA)
+		           &&  Actor_Query_Friendliness_To_Other(kActorGuzza, kActorMcCoy) < 50
+		           && !Game_Flag_Query(kFlagPS04GuzzaTalk1)
 		) {
 			Actor_Says(kActorMcCoy, 3970, 18);
 			Actor_Says(kActorGuzza, 330, 30);
@@ -338,12 +346,10 @@ void SceneScriptPS04::dialogueWithGuzza() {
 			Actor_Says(kActorGuzza, 400, 34);
 			Actor_Says(kActorGuzza, 410, 31);
 			Game_Flag_Set(kFlagPS04GuzzaTalk1);
-		} else if (
-		 (   Actor_Clue_Query(kActorMcCoy, kClueChopstickWrapper)
-		  || Actor_Clue_Query(kActorMcCoy, kClueSushiMenu)
-		 )
-		 &&  Actor_Clue_Query(kActorMcCoy, kClueRunciterInterviewA)
-		 && !Game_Flag_Query(kFlagPS04GuzzaTalk2)
+		} else if ((Actor_Clue_Query(kActorMcCoy, kClueChopstickWrapper)
+		            || Actor_Clue_Query(kActorMcCoy, kClueSushiMenu))
+		           &&  Actor_Clue_Query(kActorMcCoy, kClueRunciterInterviewA)
+		           && !Game_Flag_Query(kFlagPS04GuzzaTalk2)
 		) {
 			Actor_Says(kActorMcCoy, 3920, 13);
 			Actor_Says(kActorGuzza, 570, 32);
diff --git a/engines/bladerunner/script/scene/ps15.cpp b/engines/bladerunner/script/scene/ps15.cpp
index d86f5cb..df00cee 100644
--- a/engines/bladerunner/script/scene/ps15.cpp
+++ b/engines/bladerunner/script/scene/ps15.cpp
@@ -43,7 +43,7 @@ void SceneScriptPS15::InitializeScene() {
 void SceneScriptPS15::SceneLoaded() {
 	Obstacle_Object("E.ARCH", true);
 	if (Global_Variable_Query(kVariableChapter) == 2) {
-		Item_Add_To_World(kItemWeaponsCrate, kModelAnimationWeaponsCrate, 101, -208.0f, -113.43f, 30.28f, 750, 16, 12, false, true, false, true);
+		Item_Add_To_World(kItemWeaponsCrate, kModelAnimationWeaponsCrate, kSetPS15, -208.0f, -113.43f, 30.28f, 750, 16, 12, false, true, false, true);
 	}
 }
 
@@ -57,10 +57,16 @@ bool SceneScriptPS15::ClickedOn3DObject(const char *objectName, bool a2) {
 
 bool SceneScriptPS15::ClickedOnActor(int actorId) {
 	if (actorId == kActorSergeantWalls) {
-		if ((Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
-		  || Actor_Clue_Query(kActorMcCoy, kCluePoliceIssueWeapons)
-		 )
-		 && !Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
+		if (
+#if BLADERUNNER_ORIGINAL_BUGS
+		    (Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
+		     || Actor_Clue_Query(kActorMcCoy, kCluePoliceIssueWeapons))
+		    && !Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
+#else
+		    (Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
+		     || Actor_Clue_Query(kActorMcCoy, kCluePoliceIssueWeapons))
+		    && !Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		) {
 			if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -256.0f, -113.43f, 43.51f, 0, true, false, false)) {
 				Actor_Face_Actor(kActorMcCoy, kActorSergeantWalls, true);
@@ -72,10 +78,25 @@ bool SceneScriptPS15::ClickedOnActor(int actorId) {
 				Actor_Says(kActorSergeantWalls, 140, 16);
 				Item_Pickup_Spin_Effect(kModelAnimationWeaponsOrderForm, 211, 239);
 				Actor_Says(kActorSergeantWalls, 150, 14);
+#if BLADERUNNER_ORIGINAL_BUGS
+				// This code makes no sense (why remove the order form from the world,
+				// when it's not added (it only gets added when kFlagPS04WeaponsOrderForm is set)
+				// Also, why remove the kItemWeaponsOrderForm when McCoy acquires the kClueShippingForm from Walls?
 				Actor_Clue_Acquire(kActorMcCoy, kClueShippingForm, true, kActorSergeantWalls);
 				if (!Game_Flag_Query(kFlagPS04WeaponsOrderForm)) {
 					Item_Remove_From_World(kItemWeaponsOrderForm);
 				}
+#else
+				// BugFix: McCoy here gets the kClueWeaponsOrderForm form from Sgt Walls
+				//         (not the shipping form)
+				//         and if the order form was added to Guzza's office (PS04),
+				//         then the kFlagPS04WeaponsOrderForm would be set
+				//         so in that case we remove the item from the game world (ie. from PS04)
+				Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm, true, kActorSergeantWalls);
+				if (Game_Flag_Query(kFlagPS04WeaponsOrderForm)) {
+					Item_Remove_From_World(kItemWeaponsOrderForm);
+				}
+#endif // BLADERUNNER_ORIGINAL_BUGS
 			}
 		} else {
 			Actor_Face_Actor(kActorMcCoy, kActorSergeantWalls, true);
@@ -100,11 +121,31 @@ bool SceneScriptPS15::ClickedOnActor(int actorId) {
 
 bool SceneScriptPS15::ClickedOnItem(int itemId, bool a2) {
 	if (itemId == kItemWeaponsCrate) {
-		if (Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
-		 && Actor_Clue_Query(kActorMcCoy, kCluePoliceIssueWeapons)
+
+		if (
+#if BLADERUNNER_ORIGINAL_BUGS
+			// the check here ideally should be about kClueShippingForm
+			// although it suffices that we also check for kCluePoliceIssueWeapons (logic AND)
+			// and the additional check for kClueWeaponsOrderForm does not affect anything
+		    Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
+#else
+		    Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
+#endif // BLADERUNNER_ORIGINAL_BUGS
+		    && Actor_Clue_Query(kActorMcCoy, kCluePoliceIssueWeapons)
 		) {
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+			// McCoy should face the crate when saying "I've got all I can from that."
+			Actor_Face_Item(kActorMcCoy, kItemWeaponsCrate, true);
+#endif // BLADERUNNER_ORIGINAL_BUGS
 			Actor_Says(kActorMcCoy, 8570, 14);
 		} else {
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+			// A form is added to McCoy's KIA from examining the crate
+			// but no item pickup effect was playing in the original
+			Item_Pickup_Spin_Effect(kModelAnimationWeaponsOrderForm, 411, 333);
+#endif // BLADERUNNER_ORIGINAL_BUGS
 			Actor_Face_Actor(kActorMcCoy, kActorSergeantWalls, true);
 			Actor_Face_Actor(kActorSergeantWalls, kActorMcCoy, true);
 			Actor_Says(kActorMcCoy, 4485, 17);
@@ -112,10 +153,18 @@ bool SceneScriptPS15::ClickedOnItem(int itemId, bool a2) {
 			Actor_Says(kActorMcCoy, 4490, 12);
 			Actor_Says(kActorSergeantWalls, 170, 13);
 #if BLADERUNNER_ORIGINAL_BUGS
-			Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm,   true, kActorMcCoy); // A bug? Shouldn't the last argument be -1 or kActorSergeantWalls here?
-			Actor_Clue_Acquire(kActorMcCoy, kCluePoliceIssueWeapons, true, kActorMcCoy); // A bug? Shouldn't the last argument be -1 or kActorSergeantWalls here?
+			// if the player did not get the weapons order form from Guzza's office, they get it here
+			Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm,   true, kActorMcCoy);
+			// A bug? Shouldn't the last argument be -1 or kActorSergeantWalls here?
+			Actor_Clue_Acquire(kActorMcCoy, kCluePoliceIssueWeapons, true, kActorMcCoy);
 #else
-			Actor_Clue_Acquire(kActorMcCoy, kClueWeaponsOrderForm,   true, kActorSergeantWalls);
+			// Bugfix: Shipping form makes more sense to be attached to the box of weapons
+			//         Order form is now acquired from Walls or from Guzza's office
+			if (!Actor_Clue_Query(kActorMcCoy, kClueShippingForm)) {
+				// (McCoy apparently finds it attached to the weapon's shipment crate)
+				// It's not given by Sgt Walls, so McCoy is credited for the clue find
+				Actor_Clue_Acquire(kActorMcCoy, kClueShippingForm, true, kActorMcCoy);
+			}
 			Actor_Clue_Acquire(kActorMcCoy, kCluePoliceIssueWeapons, true, kActorSergeantWalls);
 #endif // BLADERUNNER_ORIGINAL_BUGS
 		}
diff --git a/engines/bladerunner/script/scene/ug13.cpp b/engines/bladerunner/script/scene/ug13.cpp
index 239c32d..c8e61b0 100644
--- a/engines/bladerunner/script/scene/ug13.cpp
+++ b/engines/bladerunner/script/scene/ug13.cpp
@@ -94,14 +94,18 @@ void SceneScriptUG13::SceneLoaded() {
 	Clickable_Object("BOLLARD");
 	Unclickable_Object("BASKET");
 
-	if ( Global_Variable_Query(kVariableChapter) >= 3
-	 && !Actor_Clue_Query(kActorMcCoy, kClueOriginalRequisitionForm)
-	 &&  Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)
-	 &&  (Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
-	  ||  Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm)
-	 )
+	if (Global_Variable_Query(kVariableChapter) >= 3
+	    && !Actor_Clue_Query(kActorMcCoy, kClueOriginalRequisitionForm)
+	    && Game_Flag_Query(kFlagCT04HomelessKilledByMcCoy)
+	    && (Actor_Clue_Query(kActorMcCoy, kClueShippingForm)
+	        || Actor_Clue_Query(kActorMcCoy, kClueWeaponsOrderForm))
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
+	    && !Game_Flag_Query(kFlagUG13OriginalRequisitionFormPlaced)
+#endif // BLADERUNNER_ORIGINAL_BUGS
 	) {
-		Item_Add_To_World(kItemWeaponsOrderForm, kModelAnimationOriginalRequisitionForm, 85, -209.01f, 70.76f, -351.79f, 0, 16, 12, false, true, false, true);
+		Game_Flag_Set(kFlagUG13OriginalRequisitionFormPlaced);
+		Item_Add_To_World(kItemWeaponsOrderForm, kModelAnimationOriginalRequisitionForm, kSetUG13, -209.01f, 70.76f, -351.79f, 0, 16, 12, false, true, false, true);
 	}
 }
 




More information about the Scummvm-git-logs mailing list