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

alxpnv a04198622 at gmail.com
Wed Sep 8 12:45:13 UTC 2021


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

Summary:
7914b4acb1 ASYLUM: (MorgueDoor puzzle) minor fixes
d4fe0dd11d ASYLUM: add initial support for alternate demo


Commit: 7914b4acb15ed29474923cb4eb0c4b6a497ca4c8
    https://github.com/scummvm/scummvm/commit/7914b4acb15ed29474923cb4eb0c4b6a497ca4c8
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-08T15:46:37+03:00

Commit Message:
ASYLUM: (MorgueDoor puzzle) minor fixes

Changed paths:
    engines/asylum/puzzles/morguedoor.cpp


diff --git a/engines/asylum/puzzles/morguedoor.cpp b/engines/asylum/puzzles/morguedoor.cpp
index 0468b49735..228fa59dcd 100644
--- a/engines/asylum/puzzles/morguedoor.cpp
+++ b/engines/asylum/puzzles/morguedoor.cpp
@@ -366,7 +366,7 @@ void PuzzleMorgueDoor::updateState() {
 					++_data_45A9D8;
 
 				if (_data_45A9D8 == 3 && _flag6)
-					--_frameIndexes[kTopLever];
+					_frameIndexes[kTopLever] = _frameCounts[kTopLever] - 1;
 			} else {
 				if (_frameIndexes[kBottomLever] < 15)
 					_frameIndexes[kBottomLever] += 5;
@@ -375,7 +375,7 @@ void PuzzleMorgueDoor::updateState() {
 					++_data_45A9DC;
 
 				if (_data_45A9DC == 3 && _flag7)
-					--_frameIndexes[kBottomLever];
+					_frameIndexes[kBottomLever] = _frameCounts[kBottomLever] - 1;
 			}
 		}
 	}
@@ -400,7 +400,7 @@ void PuzzleMorgueDoor::updateState() {
 				if (_data_45A9D8 < 3)
 					getSound()->playSound(getWorld()->soundResourceIds[7], false, Config.sfxVolume, getWorld()->reverseStereo ? 2000 : -2000);
 
-				getSound()->playSound(getWorld()->soundResourceIds[7], false, Config.sfxVolume - 100, getWorld()->reverseStereo ? -3000 : 3000);
+				getSound()->playSound(getWorld()->soundResourceIds[5], false, Config.sfxVolume - 100, getWorld()->reverseStereo ? -3000 : 3000);
 				_flag5 = true;
 			}
 		}
@@ -413,10 +413,10 @@ void PuzzleMorgueDoor::updateState() {
 				_data_4572A8 = false;
 
 				if (_frameIndexes[kRightGear] == 14) {
-					if (_data_45A9DC < 3)
+					if (_data_45A9D8 < 3)
 						getSound()->playSound(getWorld()->soundResourceIds[7], false, Config.sfxVolume, getWorld()->reverseStereo ? 2000 : -2000);
 
-					getSound()->playSound(getWorld()->soundResourceIds[7], false, Config.sfxVolume - 100, getWorld()->reverseStereo ? -3000 : 3000);
+					getSound()->playSound(getWorld()->soundResourceIds[5], false, Config.sfxVolume - 100, getWorld()->reverseStereo ? -3000 : 3000);
 					_flag5 = true;
 				}
 			}
@@ -488,8 +488,8 @@ void PuzzleMorgueDoor::updateState() {
 
 		if ((!_flag6 && _frameIndexes[kTopLever] >= 15)
 		 || (!_flag7 && _frameIndexes[kBottomLever] >= 15)) {
-			 _frameIndexes[kCenterValve] = 0;
-			 getSound()->stop(getWorld()->soundResourceIds[0]);
+			_frameIndexes[kCenterValve] = 0;
+			getSound()->stop(getWorld()->soundResourceIds[0]);
 		} else {
 			--_frameIndexes[kCenterValve];
 
@@ -568,7 +568,7 @@ updateIndices:
 			_frameIndexes[kTopSmallLever] = 0;
 
 			if (_data_45A9D8 > 0) {
-				getSound()->playSound(getWorld()->graphicResourceIds[8], false, Config.sfxVolume - 10);
+				getSound()->playSound(getWorld()->soundResourceIds[8], false, Config.sfxVolume - 10);
 				_moveTopGear = true;
 			}
 
@@ -584,7 +584,7 @@ updateIndices:
 			_frameIndexes[kBottomSmallLever] = 0;
 
 			if (_data_45A9DC > 0) {
-				getSound()->playSound(getWorld()->graphicResourceIds[8], false, Config.sfxVolume - 10);
+				getSound()->playSound(getWorld()->soundResourceIds[8], false, Config.sfxVolume - 10);
 				_moveBottomGear = true;
 			}
 		}


Commit: d4fe0dd11d775bbd1c0f7fddcbb77dda1c801f89
    https://github.com/scummvm/scummvm/commit/d4fe0dd11d775bbd1c0f7fddcbb77dda1c801f89
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-08T15:46:37+03:00

Commit Message:
ASYLUM: add initial support for alternate demo

Changed paths:
    engines/asylum/asylum.cpp
    engines/asylum/asylum.h
    engines/asylum/console.cpp
    engines/asylum/resources/encounters.cpp
    engines/asylum/resources/script.cpp
    engines/asylum/system/speech.cpp
    engines/asylum/views/video.cpp


diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index 95254fe44f..785c4b570d 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -83,6 +83,9 @@ AsylumEngine::AsylumEngine(OSystem *system, const ADGameDescription *gd) : Engin
 	SearchMan.addSubDirectoryMatching(gamePath, dataDir + "vids");
 	SearchMan.addSubDirectoryMatching(gamePath, dataDir + "music");
 
+	if (checkGameVersion("Steam") || isAltDemo())
+		ConfMan.setInt("scale_factor", 1);
+
 	// Initialize random number source
 	_rnd = new Common::RandomSource("asylum");
 }
@@ -145,7 +148,8 @@ Common::Error AsylumEngine::run() {
 	// Create main menu
 	_menu  = new Menu(this);
 	if (checkGameVersion("Demo")) {
-		_video->play(0, NULL);
+		if (!isAltDemo())
+			_video->play(0, NULL);
 		restart();
 	} else {
 		_handler = _menu;
diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h
index 81ce8b54d8..28b71c3ce9 100644
--- a/engines/asylum/asylum.h
+++ b/engines/asylum/asylum.h
@@ -23,6 +23,7 @@
 #ifndef ASYLUM_ASYLUM_H
 #define ASYLUM_ASYLUM_H
 
+#include "common/file.h"
 #include "common/language.h"
 #include "common/random.h"
 #include "common/rect.h"
@@ -199,6 +200,7 @@ public:
 	void saveLoadWithSerializer(Common::Serializer &s);
 
 	bool checkGameVersion(const char *version) { return !strcmp(_gameDescription->extra, version); }
+	bool isAltDemo() { return Common::File::exists("asylum.dat"); }
 	Common::Language getLanguage() { return _gameDescription->language; }
 
 private:
diff --git a/engines/asylum/console.cpp b/engines/asylum/console.cpp
index 65f07c4e25..b2d99fd2d8 100644
--- a/engines/asylum/console.cpp
+++ b/engines/asylum/console.cpp
@@ -524,7 +524,16 @@ bool Console::cmdPlayVideo(int argc, const char **argv) {
 
 	// Check if the video exists
 	char filename[20];
-	snprintf(filename, 20, "mov%03d.smk", index);
+	const char *extension;
+
+	if (_vm->checkGameVersion("Steam"))
+		extension = "_smk.ogv";
+	else if (_vm->isAltDemo())
+		extension = ".avi";
+	else
+		extension = ".smk";
+
+	snprintf(filename, 20, "mov%03d%s", index, extension);
 	if (!SearchMan.hasFile(filename)) {
 		debugPrintf("[Error] Movie %d does not exists\n", index);
 		return true;
diff --git a/engines/asylum/resources/encounters.cpp b/engines/asylum/resources/encounters.cpp
index a93084dacf..92d6753d28 100644
--- a/engines/asylum/resources/encounters.cpp
+++ b/engines/asylum/resources/encounters.cpp
@@ -131,7 +131,8 @@ void Encounter::load() {
 	Common::File file;
 
 	if (!file.open("sntrm.dat"))
-		error("[Encounter::load] Could not open encounter data!");
+		if (!file.open("asylum.dat"))
+			error("[Encounter::load] Could not open encounter data!");
 
 	// Load the variables
 	uint16 count = file.readUint16LE();
@@ -844,7 +845,7 @@ void Encounter::setupSpeech(ResourceId textResourceId, ResourceId fontResourceId
 	}
 
 	_data_455BE0 = true;
-	_soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, textResourceId - _speechResourceId + _vm->checkGameVersion("Demo"));
+	_soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, textResourceId - _speechResourceId + _vm->checkGameVersion("Demo") + 7 * _vm->isAltDemo());
 	//_soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId); // todo replace with speech (this is being override by the actor speechs)
 	//getSpeech()->setSoundResourceId(MAKE_RESOURCE(kResourcePackSpeech, textResourceId - _speechResourceId)); 
 }
diff --git a/engines/asylum/resources/script.cpp b/engines/asylum/resources/script.cpp
index 2e83e0468c..de35270bfe 100644
--- a/engines/asylum/resources/script.cpp
+++ b/engines/asylum/resources/script.cpp
@@ -943,6 +943,12 @@ END_OPCODE
 //////////////////////////////////////////////////////////////////////////
 // Opcode 0x2B
 IMPLEMENT_OPCODE(ChangeScene)
+	if (_vm->isAltDemo()) {
+		Engine::quitGame();
+		_done = true;
+		return;
+	}
+
 	uint32 tick = _vm->getTick();
 	getScene()->getActor(0)->changeStatus(kActorStatusDisabled);
 	resetQueue();
diff --git a/engines/asylum/system/speech.cpp b/engines/asylum/system/speech.cpp
index a4bd898875..2ec9ff8c07 100644
--- a/engines/asylum/system/speech.cpp
+++ b/engines/asylum/system/speech.cpp
@@ -188,7 +188,7 @@ ResourceId Speech::playPlayer(int32 index) {
 
 		ResourceId soundResourceId;
 		if (_vm->checkGameVersion("Demo")) {
-			soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, soundResourceIndex + 21);
+			soundResourceId = MAKE_RESOURCE(kResourcePackSharedSound, soundResourceIndex + 21 + 7 * _vm->isAltDemo());
 			return play(soundResourceId, MAKE_RESOURCE(kResourcePackText, textResourceIndex + 20));
 		} else {
 			soundResourceId = MAKE_RESOURCE(kResourcePackSpeech, soundResourceIndex);
diff --git a/engines/asylum/views/video.cpp b/engines/asylum/views/video.cpp
index b75d680e99..06f002d062 100644
--- a/engines/asylum/views/video.cpp
+++ b/engines/asylum/views/video.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "video/avi_decoder.h"
 #include "video/smk_decoder.h"
 #include "video/theora_decoder.h"
 
@@ -55,6 +56,8 @@ VideoPlayer::VideoPlayer(AsylumEngine *engine, Audio::Mixer *mixer) : _vm(engine
 #else
 		error("The Steam version of the game uses Theora videos but ScummVM has been compiled without Theora support");
 #endif
+	} else if (_vm->isAltDemo()) {
+		_decoder = new Video::AVIDecoder();
 	} else {
 		_decoder = new Video::SmackerDecoder();
 	}
@@ -151,6 +154,8 @@ void VideoPlayer::play(uint32 videoNumber, EventHandler *handler) {
 	Common::String filename;
 	if (_vm->checkGameVersion("Steam"))
 		filename = videoNumber == 0 ? "mov000_2_smk.ogv" : Common::String::format("mov%03d_smk.ogv", videoNumber);
+	else if (_vm->isAltDemo())
+		filename = Common::String::format("mov%03d.avi", videoNumber);
 	else
 		filename = Common::String::format("mov%03d.smk", videoNumber);
 	play(filename, Config.showMovieSubtitles);
@@ -184,7 +189,7 @@ void VideoPlayer::play(Common::String filename, bool showSubtitles) {
 	int32 currentSubtitle = 0;
 
 	_decoder->start();
-	if (_vm->checkGameVersion("Steam")) {
+	if (_vm->checkGameVersion("Steam") || _vm->isAltDemo()) {
 		_vm->_system->showOverlay();
 		_vm->_system->clearOverlay();
 	}
@@ -200,6 +205,11 @@ void VideoPlayer::play(Common::String filename, bool showSubtitles) {
 
 			if (_vm->checkGameVersion("Steam")) {
 				_vm->_system->copyRectToOverlay((const byte *)frame->getPixels(), frame->pitch, x, y, frame->w, frame->h);
+			} else if (_vm->isAltDemo()) {
+				Graphics::Surface *frame1 = frame->convertTo(_vm->_system->getOverlayFormat());
+				_vm->_system->copyRectToOverlay((const byte *)frame1->getPixels(), frame1->pitch, x, y, frame1->w, frame1->h);
+				frame1->free();
+				delete frame1;
 			} else {
 				if (_decoder->hasDirtyPalette())
 					setupPalette();
@@ -232,7 +242,7 @@ void VideoPlayer::play(Common::String filename, bool showSubtitles) {
 		g_system->delayMillis(10);
 	}
 
-	if (_vm->checkGameVersion("Steam"))
+	if (_vm->checkGameVersion("Steam") || _vm->isAltDemo())
 		_vm->_system->hideOverlay();
 
 	_decoder->close();




More information about the Scummvm-git-logs mailing list