[Scummvm-git-logs] scummvm master -> dbfc657a2c305946483e60d8bd68bb40575fb3a4

peterkohaut peterkohaut at users.noreply.github.com
Sun Feb 10 19:49:16 CET 2019


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

Summary:
dbfc657a2c BLADERUNNER: Added sitcom mode


Commit: dbfc657a2c305946483e60d8bd68bb40575fb3a4
    https://github.com/scummvm/scummvm/commit/dbfc657a2c305946483e60d8bd68bb40575fb3a4
Author: Peter Kohaut (peter.kohaut at gmail.com)
Date: 2019-02-10T19:47:22+01:00

Commit Message:
BLADERUNNER: Added sitcom mode

Available via ScummVM game options

Changed paths:
    engines/bladerunner/actor.cpp
    engines/bladerunner/actor.h
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h
    engines/bladerunner/detection.cpp
    engines/bladerunner/detection_tables.h
    engines/bladerunner/script/script.cpp


diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 59af72d..ef89bb8 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -140,6 +140,39 @@ void Actor::setup(int actorId) {
 	_movementTrack->flush();
 
 	_actorSpeed = Vector3();
+
+	switch (_id) {
+		case kActorMcCoy:
+			_sitcomRatio = 50;
+			break;
+
+		case kActorGordo:
+			_sitcomRatio = 0;
+			break;
+
+		case kActorGuzza:
+		case kActorChew:
+		case kActorVoiceOver:
+			_sitcomRatio = 75;
+			break;
+
+		case kActorCrazylegs:
+		case kActorBulletBob:
+		case kActorRunciter:
+		case kActorZuben:
+		case kActorLeon:
+			_sitcomRatio = 90;
+			break;
+
+		case kActorGrigorian:
+		case kActorMoraji:
+			_sitcomRatio = 100;
+			break;
+
+		default:
+			_sitcomRatio = 33;
+			break;
+	}
 }
 
 void Actor::changeAnimationMode(int animationMode, bool force) {
@@ -969,6 +1002,10 @@ bool Actor::getFlagDamageAnimIfMoving() const {
 	return _damageAnimIfMoving;
 }
 
+int Actor::getSitcomRatio() const {
+	return _sitcomRatio;
+}
+
 void Actor::retire(bool retired, int width, int height, int retiredByActorId) {
 	_isRetired = retired;
 	_retiredWidth = MAX(width, 0);
diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h
index 492db6d..62c7a28 100644
--- a/engines/bladerunner/actor.h
+++ b/engines/bladerunner/actor.h
@@ -115,6 +115,8 @@ private:
 
 	Vector3 _actorSpeed;
 
+	int _sitcomRatio;
+
 public:
 	Actor(BladeRunnerEngine *_vm, int actorId);
 	~Actor();
@@ -227,6 +229,8 @@ public:
 	void setFlagDamageAnimIfMoving(bool value);
 	bool getFlagDamageAnimIfMoving() const;
 
+	int getSitcomRatio() const;
+
 	void retire(bool isRetired, int width, int height, int retiredByActorId);
 
 	void combatModeOn(int initialState, bool rangedAttack, int enemyId, int waypointType, int animationModeCombatIdle, int animationModeCombatWalk, int animationModeCombatRun, int fleeRatio, int coverRatio, int attackRatio, int damage, int range, bool unstoppable);
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index bad251a..48cc617 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -99,9 +99,11 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
 	_windowIsActive = true;
 	_gameIsRunning  = true;
 
-	_vqaIsPlaying = false;
+	_vqaIsPlaying       = false;
 	_vqaStopIsRequested = false;
+
 	_subtitlesEnabled = false;
+	_sitcomMode       = true;
 
 	_playerLosesControlCounter = 0;
 
@@ -411,6 +413,8 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
 	// get value from the ScummVM configuration manager
 	_subtitlesEnabled = ConfMan.getBool("subtitles");
 
+	_sitcomMode = ConfMan.getBool("sitcom");
+
 	_items = new Items(this);
 
 	_audioMixer = new AudioMixer(this);
@@ -1720,7 +1724,7 @@ Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::S
 		}
 
 		// debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str());
-		
+
 		Common::SeekableReadStream *stream = _archives[i].createReadStreamForMember(name);
 		if (stream) {
 			return stream;
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 7f7883a..1122e21 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -194,6 +194,7 @@ public:
 	bool _vqaIsPlaying;
 	bool _vqaStopIsRequested;
 	bool _subtitlesEnabled; // tracks the state of whether subtitles are enabled or disabled from ScummVM GUI option or KIA checkbox (the states are synched)
+	bool _sitcomMode;
 
 	int _walkSoundId;
 	int _walkSoundVolume;
diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp
index 4d61396..d6ecf74 100644
--- a/engines/bladerunner/detection.cpp
+++ b/engines/bladerunner/detection.cpp
@@ -29,6 +29,7 @@
 #include "common/system.h"
 #include "common/savefile.h"
 #include "common/serializer.h"
+#include "common/translation.h"
 
 #include "engines/advancedDetector.h"
 
@@ -39,6 +40,20 @@ static const PlainGameDescriptor bladeRunnerGames[] = {
 	{0, 0}
 };
 
+static const ADExtraGuiOptionsMap optionsList[] = {
+	{
+		GAMEOPTION_SITCOM,
+		{
+			_s("Sitcom mode"),
+			_s("Game will add laughter after actor's line or narration"),
+			"sitcom",
+			false
+		}
+	},
+
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
 } // End of namespace BladeRunner
 
 class BladeRunnerMetaEngine : public AdvancedMetaEngine {
@@ -59,7 +74,8 @@ BladeRunnerMetaEngine::BladeRunnerMetaEngine()
 	: AdvancedMetaEngine(
 		BladeRunner::gameDescriptions,
 		sizeof(BladeRunner::gameDescriptions[0]),
-		BladeRunner::bladeRunnerGames) {}
+		BladeRunner::bladeRunnerGames,
+		BladeRunner::optionsList) {}
 
 
 const char *BladeRunnerMetaEngine::getName() const {
diff --git a/engines/bladerunner/detection_tables.h b/engines/bladerunner/detection_tables.h
index 5d1a851..12e9d68 100644
--- a/engines/bladerunner/detection_tables.h
+++ b/engines/bladerunner/detection_tables.h
@@ -25,6 +25,8 @@
 
 #include "engines/advancedDetector.h"
 
+#define GAMEOPTION_SITCOM GUIO_GAMEOPTIONS1
+
 namespace BladeRunner {
 
 static const ADGameDescription gameDescriptions[] = {
@@ -36,7 +38,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::EN_ANY,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	// BladeRunner (German)
@@ -47,7 +49,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::DE_DEU,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	// BladeRunner (French) - Bug #9722
@@ -58,7 +60,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::FR_FRA,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	// BladeRunner (Italian)
@@ -69,7 +71,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::IT_ITA,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	// BladeRunner (Russian)
@@ -80,7 +82,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::RU_RUS,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	// BladeRunner (Spanish)
@@ -91,7 +93,7 @@ static const ADGameDescription gameDescriptions[] = {
 		Common::ES_ESP,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
-		GUIO0()
+		GUIO1(GAMEOPTION_SITCOM)
 	},
 
 	AD_TABLE_END_MARKER
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 502344b..4c205d5 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -329,16 +329,12 @@ void ScriptBase::Actor_Says_With_Pause(int actorId, int sentenceId, float pause,
 		actor->changeAnimationMode(kAnimationModeIdle, false);
 	}
 
-	//TODO: sitcom
-	//if (_vm->isSitcom)
-	//{
-	//	int rnd = _vm->random(1, 100);
-	//	if (rnd <= actor::get_unknown3(actor))
-	//	{
-	//		int soundId = _vm->random(319, 327);
-	//		_vm->_audioPlayer->play(soundId, 40, 0, 0, 50);
-	//	}
-	//}
+	if (_vm->_sitcomMode) {
+		int rnd = Random_Query(1, 100);
+		if (rnd <= actor->getSitcomRatio()) {
+			Sound_Play(Random_Query(319, 327), 40, 0, 0, 50);
+		}
+	}
 	if(pause > 0.0f && !_vm->_speechSkipped) {
 		Delay(pause * 1000);
 	}





More information about the Scummvm-git-logs mailing list