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

whoozle noreply at scummvm.org
Wed Feb 11 21:51:34 UTC 2026


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

Summary:
e175474e9e PHOENIXVR: implement music save/load


Commit: e175474e9e486ffdbd5f7a37749122f198fdea5c
    https://github.com/scummvm/scummvm/commit/e175474e9e486ffdbd5f7a37749122f198fdea5c
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-02-11T21:49:28Z

Commit Message:
PHOENIXVR: implement music save/load

Changed paths:
    engines/phoenixvr/commands.h
    engines/phoenixvr/phoenixvr.cpp
    engines/phoenixvr/phoenixvr.h


diff --git a/engines/phoenixvr/commands.h b/engines/phoenixvr/commands.h
index 75a20e8dbf7..e74e2735755 100644
--- a/engines/phoenixvr/commands.h
+++ b/engines/phoenixvr/commands.h
@@ -848,6 +848,11 @@ struct PlaySound : public Script::Command {
 
 struct PlayMusique : public PlaySound {
 	PlayMusique(Common::String s, int v) : PlaySound(Common::move(s), v, -1) {}
+
+	void exec(Script::ExecutionContext &ctx) const override {
+		g_engine->setCurrentMusic(sound, volume);
+		PlaySound::exec(ctx);
+	}
 };
 
 struct StopSound : public Script::Command {
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index 228e7b10ef9..c05c6517cfa 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -290,6 +290,8 @@ void PhoenixVREngine::playSound(const Common::String &sound, uint8 volume, int l
 
 void PhoenixVREngine::stopSound(const Common::String &sound) {
 	debug("stop sound %s", sound.c_str());
+	if (sound == _currentMusic)
+		_currentMusic.clear();
 	auto it = _sounds.find(sound);
 	if (it != _sounds.end()) {
 		_mixer->stopHandle(it->_value.handle);
@@ -860,8 +862,8 @@ void PhoenixVREngine::captureContext() {
 	for (uint i = 0; i != 12; ++i) {
 		writeString(_lockKey[i]);
 	}
-	writeString({});     // music
-	ms.writeUint32LE(0); // musicVolume
+	writeString(_currentMusic);
+	ms.writeUint32LE(_currentMusicVolume);
 
 	struct SoundState {
 		Common::String name;
@@ -968,11 +970,15 @@ Common::Error PhoenixVREngine::loadGameStream(Common::SeekableReadStream *slot)
 		debug("lockKey %d %s", i, lockKey.c_str());
 		_lockKey[i] = lockKey;
 	}
-	auto music = ms.readString(0, 257);
-	auto musicVolume = ms.readUint32LE();
-	debug("current music %s, volume: %u", music.c_str(), musicVolume);
 
 	_mixer->stopAll();
+
+	_currentMusic = ms.readString(0, 257);
+	_currentMusicVolume = ms.readUint32LE();
+	debug("current music %s, volume: %u", _currentMusic.c_str(), _currentMusicVolume);
+	if (!_currentMusic.empty() && _currentMusicVolume > 0)
+		playSound(_currentMusic, _currentMusicVolume, -1);
+
 	// sound samples
 	for (uint i = 0; i != 8; ++i) {
 		auto name = ms.readString(0, 257);
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index 72db5ff03b8..09866f7b959 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -112,6 +112,10 @@ public:
 	void playSound(const Common::String &sound, uint8 volume, int loops, bool spatial = false, float angle = 0);
 	void stopSound(const Common::String &sound);
 	void playMovie(const Common::String &movie);
+	void setCurrentMusic(const Common::String &name, int volume) {
+		_currentMusic = name;
+		_currentMusicVolume = volume;
+	}
 
 	void declareVariable(const Common::String &name);
 	void setVariable(const Common::String &name, int value);
@@ -220,6 +224,8 @@ private:
 
 	Common::Array<Common::Array<Common::String>> _cursors;
 	Common::String _defaultCursor[2];
+	Common::String _currentMusic;
+	int _currentMusicVolume = 0;
 
 	VR _vr;
 	float _fov;




More information about the Scummvm-git-logs mailing list