[Scummvm-git-logs] scummvm master -> 991eb05d2b7d6ecda57e0836135186155d38f2cc

elasota noreply at scummvm.org
Thu May 11 04:26:35 UTC 2023


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:
67a15841d9 VCRUISE: Add heroOut opcode behavior.
991eb05d2b VCRUISE: Don't report subtitles loaded OK if they failed


Commit: 67a15841d9b08d7f9a5a53f536e4577cb3f47d90
    https://github.com/scummvm/scummvm/commit/67a15841d9b08d7f9a5a53f536e4577cb3f47d90
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-11T00:25:19-04:00

Commit Message:
VCRUISE: Add heroOut opcode behavior.

Changed paths:
    engines/vcruise/runtime.cpp
    engines/vcruise/runtime.h


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 54573e15f6d..faa52e6d8b0 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -710,7 +710,8 @@ SaveGameSwappableState::SaveGameSwappableState() : roomNumber(0), screenNumber(0
 												   animVolume(100), loadedAnimation(0), animDisplayingFrame(0) {
 }
 
-SaveGameSnapshot::SaveGameSnapshot() : hero(0), escOn(false), numStates(1), listenerX(0), listenerY(0), listenerAngle(0) {
+SaveGameSnapshot::SaveGameSnapshot() : hero(0), swapOutRoom(0), swapOutScreen(0), swapOutDirection(0),
+	escOn(false), numStates(1), listenerX(0), listenerY(0), listenerAngle(0) {
 }
 
 void SaveGameSnapshot::write(Common::WriteStream *stream) const {
@@ -726,6 +727,9 @@ void SaveGameSnapshot::write(Common::WriteStream *stream) const {
 	}
 
 	stream->writeUint32BE(hero);
+	stream->writeUint32BE(swapOutRoom);
+	stream->writeUint32BE(swapOutScreen);
+	stream->writeUint32BE(swapOutDirection);
 
 	stream->writeByte(escOn ? 1 : 0);
 
@@ -827,10 +831,17 @@ LoadGameOutcome SaveGameSnapshot::read(Common::ReadStream *stream) {
 		states[sti]->direction = stream->readUint32BE();
 	}
 
-	if (saveVersion >= 6)
+	if (saveVersion >= 6) {
 		hero = stream->readUint32BE();
-	else
+		swapOutScreen = stream->readUint32BE();
+		swapOutRoom = stream->readUint32BE();
+		swapOutDirection = stream->readUint32BE();
+	} else {
 		hero = 0;
+		swapOutScreen = 0;
+		swapOutRoom = 0;
+		swapOutDirection = 0;
+	}
 
 	escOn = (stream->readByte() != 0);
 
@@ -963,7 +974,8 @@ FontCacheItem::FontCacheItem() : font(nullptr), size(0) {
 }
 
 Runtime::Runtime(OSystem *system, Audio::Mixer *mixer, const Common::FSNode &rootFSNode, VCruiseGameID gameID, Common::Language defaultLanguage)
-	: _system(system), _mixer(mixer), _roomNumber(1), _screenNumber(0), _direction(0), _hero(0), _haveHorizPanAnimations(false), _loadedRoomNumber(0), _activeScreenNumber(0),
+	: _system(system), _mixer(mixer), _roomNumber(1), _screenNumber(0), _direction(0), _hero(0), _swapOutRoom(0), _swapOutScreen(0), _swapOutDirection(0),
+	  _haveHorizPanAnimations(false), _loadedRoomNumber(0), _activeScreenNumber(0),
 	  _gameState(kGameStateBoot), _gameID(gameID), _havePendingScreenChange(false), _forceScreenChange(false), _havePendingReturnToIdleState(false), _havePendingCompletionCheck(false),
 	  _havePendingPlayAmbientSounds(false), _ambientSoundFinishTime(0), _escOn(false), _debugMode(false), _fastAnimationMode(false),
 	  _musicTrack(0), _musicActive(true), _scoreSectionEndTime(0), _musicVolume(getDefaultSoundVolume()), _musicVolumeRampStartTime(0), _musicVolumeRampStartVolume(0), _musicVolumeRampRatePerMSec(0), _musicVolumeRampEnd(0),
@@ -2656,6 +2668,10 @@ void Runtime::changeToScreen(uint roomNumber, uint screenNumber) {
 	if (changedScreen) {
 		_gyros.reset();
 
+		_swapOutDirection = 0;
+		_swapOutRoom = 0;
+		_swapOutScreen = 0;
+
 		if (_scriptSet) {
 			RoomScriptSetMap_t::const_iterator roomScriptIt = _scriptSet->roomScripts.find(_roomNumber);
 			if (roomScriptIt != _scriptSet->roomScripts.end()) {
@@ -4723,6 +4739,9 @@ void Runtime::restoreSaveGameSnapshot() {
 	_screenNumber = mainState->screenNumber;
 	_direction = mainState->direction;
 	_hero = _saveGame->hero;
+	_swapOutRoom = _saveGame->swapOutRoom;
+	_swapOutScreen = _saveGame->swapOutScreen;
+	_swapOutDirection = _saveGame->swapOutDirection;
 
 	_pendingStaticAnimParams = _saveGame->pendingStaticAnimParams;
 
@@ -6417,7 +6436,9 @@ void Runtime::scriptOpRandomInclusive(ScriptArg_t arg) {
 void Runtime::scriptOpHeroOut(ScriptArg_t arg) {
 	TAKE_STACK_INT(3);
 
-	error("HeroOut not implemented");
+	_swapOutRoom = stackArgs[0];
+	_swapOutScreen = stackArgs[1];
+	_swapOutDirection = stackArgs[2];
 }
 
 OPCODE_STUB(HeroGetPos)
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 6a827870f0d..274350bfbf1 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -440,6 +440,9 @@ struct SaveGameSnapshot {
 	static void writeString(Common::WriteStream *stream, const Common::String &str);
 
 	uint hero;
+	uint swapOutRoom;
+	uint swapOutScreen;
+	uint swapOutDirection;
 
 	uint numStates;
 	Common::SharedPtr<SaveGameSwappableState> states[kMaxStates];
@@ -1065,6 +1068,10 @@ private:
 	uint _direction;
 	uint _hero;
 
+	uint _swapOutRoom;
+	uint _swapOutScreen;
+	uint _swapOutDirection;
+
 	GyroState _gyros;
 
 	AnimationDef _panLeftAnimationDef;


Commit: 991eb05d2b7d6ecda57e0836135186155d38f2cc
    https://github.com/scummvm/scummvm/commit/991eb05d2b7d6ecda57e0836135186155d38f2cc
Author: elasota (ejlasota at gmail.com)
Date: 2023-05-11T00:25:19-04:00

Commit Message:
VCRUISE: Don't report subtitles loaded OK if they failed

Changed paths:
    engines/vcruise/runtime.cpp
    engines/vcruise/runtime.h


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index faa52e6d8b0..5d3bd8c268d 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -1273,8 +1273,9 @@ bool Runtime::bootGame(bool newGame) {
 	else if (lang == Common::EL_GRC)
 		codePage = Common::CodePage::kWindows1253;
 
-	loadSubtitles(codePage);
-	debug(1, "Subtitles loaded OK");
+	if (loadSubtitles(codePage)) {
+		debug(1, "Subtitles loaded OK");
+	}
 
 	_uiGraphics.resize(24);
 	for (uint i = 0; i < _uiGraphics.size(); i++) {
@@ -4196,7 +4197,7 @@ Common::SharedPtr<Graphics::Surface> Runtime::loadGraphic(const Common::String &
 	return surf;
 }
 
-void Runtime::loadSubtitles(Common::CodePage codePage) {
+bool Runtime::loadSubtitles(Common::CodePage codePage) {
 	Common::String filePath = Common::String::format("Log/Speech%02u.txt", _languageIndex);
 
 	Common::INIFile ini;
@@ -4205,7 +4206,7 @@ void Runtime::loadSubtitles(Common::CodePage codePage) {
 
 	if (!ini.loadFromFile(filePath)) {
 		warning("Couldn't load subtitle data");
-		return;
+		return false;
 	}
 
 	for (const Common::INIFile::Section &section : ini.getSections()) {
@@ -4359,6 +4360,8 @@ void Runtime::loadSubtitles(Common::CodePage codePage) {
 			}
 		}
 	}
+
+	return true;
 }
 
 void Runtime::changeToMenuPage(MenuPage *menuPage) {
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 274350bfbf1..2313f20fb2f 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -852,7 +852,7 @@ private:
 	Common::String getFileNameForItemGraphic(uint itemID) const;
 	Common::SharedPtr<Graphics::Surface> loadGraphic(const Common::String &graphicName, bool required);
 
-	void loadSubtitles(Common::CodePage codePage);
+	bool loadSubtitles(Common::CodePage codePage);
 
 	void changeToMenuPage(MenuPage *menuPage);
 




More information about the Scummvm-git-logs mailing list