[Scummvm-git-logs] scummvm master -> 312a042724abb26502458a4bf5f1efcfba5e8d63

whoozle noreply at scummvm.org
Mon Jul 20 23:48:26 UTC 2026


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

Summary:
c43cb149f8 PHOENIXVR: Add store/retrieveState API
312a042724 PHOENIXVR: Store conditional scopes on stack


Commit: c43cb149f827f24da629787aa19dd01e75546aa6
    https://github.com/scummvm/scummvm/commit/c43cb149f827f24da629787aa19dd01e75546aa6
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-07-21T00:23:02+01:00

Commit Message:
PHOENIXVR: Add store/retrieveState API

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


diff --git a/engines/phoenixvr/commands_v2.cpp b/engines/phoenixvr/commands_v2.cpp
index d663af463ac..817f9b42be9 100644
--- a/engines/phoenixvr/commands_v2.cpp
+++ b/engines/phoenixvr/commands_v2.cpp
@@ -208,25 +208,27 @@ struct Cursor_Set : public Command {
 };
 
 struct Retrieve_State : public Command {
-	Common::String index;
+	int index;
 	Common::String var;
 
-	Retrieve_State(const Common::Array<Common::String> &args) : index(args[0]), var(args[1]) {}
+	Retrieve_State(const Common::Array<Common::String> &args) : index(atoi(args[0].c_str())), var(args[1]) {}
 
 	void exec(ExecutionContext &ctx) const override {
-		debug("retrieve state stub %s %s", index.c_str(), var.c_str());
-		g_engine->setVariable(var, 1);
+		debug("retrieve state %d %s", index, var.c_str());
+		g_engine->setVariable(var, g_engine->retrieveState(index));
 	}
 };
 
 struct Store_State : public Command {
-	Common::String index;
+	int index;
 	Common::String var;
 
-	Store_State(const Common::Array<Common::String> &args) : index(args[0]), var(args[1]) {}
+	Store_State(const Common::Array<Common::String> &args) : index(atoi(args[0].c_str())), var(args[1]) {}
 
 	void exec(ExecutionContext &ctx) const override {
-		warning("store state stub %s %s -> %d", index.c_str(), var.c_str(), valueOf(var));
+		int value = valueOf(var);
+		debug("store state %d %d", index, value);
+		g_engine->storeState(index, value);
 	}
 };
 
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index 0932e992a76..fcc841cab70 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -290,6 +290,7 @@ PhoenixVREngine::PhoenixVREngine(OSystem *syst, const ADGameDescription *gameDes
 																					 _rgb565(2, 5, 6, 5, 0, 11, 5, 0, 0),
 																					 _thumbnail(isAmerzoneGame(gameDesc) ? 232 : 139, isAmerzoneGame(gameDesc) ? 174 : 103, _rgb565),
 																					 _lockKey(13),
+																					 _state(256),
 																					 _loadedCursors(16),
 																					 _fov(kPi2),
 																					 _angleX(0),
@@ -2326,4 +2327,12 @@ void PhoenixVREngine::syncSoundSettings() {
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, muted ? 0 : sfxVolume);
 }
 
+int PhoenixVREngine::retrieveState(int index) const {
+	return _state[index];
+}
+
+void PhoenixVREngine::storeState(int index, int value) {
+	_state[index] = value;
+}
+
 } // End of namespace PhoenixVR
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index 1e048ce925e..a418ed330c9 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -230,6 +230,9 @@ public:
 	void stopCible();
 	void testCible(const Common::String &insideVar, const Common::String &outsideVar);
 
+	int retrieveState(int index) const;
+	void storeState(int index, int value);
+
 private:
 	struct ArchiveImage {
 		Common::String image;
@@ -305,6 +308,7 @@ private:
 	Common::Array<Common::String> _lockKey;
 
 	Variables _variables;
+	Common::Array<int> _state;
 
 	struct Sound {
 		Audio::SoundHandle handle;


Commit: 312a042724abb26502458a4bf5f1efcfba5e8d63
    https://github.com/scummvm/scummvm/commit/312a042724abb26502458a4bf5f1efcfba5e8d63
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-07-21T00:47:18+01:00

Commit Message:
PHOENIXVR: Store conditional scopes on stack

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


diff --git a/engines/phoenixvr/script_v2.cpp b/engines/phoenixvr/script_v2.cpp
index 0ad37a41b1a..b641a4d60f7 100644
--- a/engines/phoenixvr/script_v2.cpp
+++ b/engines/phoenixvr/script_v2.cpp
@@ -164,31 +164,28 @@ void ScriptV2::parseLine(const Common::String &line, uint lineno) {
 			_currentWarp->tests.push_back(_currentTest);
 			if (!_conditionals.empty())
 				error("condition didn't have endif at the last test at line %d", lineno);
-			_testScope.reset();
 		} else if (p.maybe("ifand]:")) {
 			if (!_currentTest)
 				error("ifand without test at line %d", lineno);
 			ConditionalPtr conditional(new IfAnd(p.readStringList()));
 			conditional->trueScope.reset(new Scope);
-			_conditionalScope = conditional->trueScope;
-			_conditionals.push_back(Common::move(conditional));
+			_conditionals.push_back({conditional, conditional->trueScope});
 		} else if (p.maybe("ifor]:")) {
 			if (!_currentTest)
 				error("ifor without test at line %d", lineno);
 			ConditionalPtr conditional(new IfOr(p.readStringList()));
 			conditional->trueScope.reset(new Scope);
-			_conditionalScope = conditional->trueScope;
-			_conditionals.push_back(Common::move(conditional));
+			_conditionals.push_back({conditional, conditional->trueScope});
 		} else if (p.maybe("else]")) {
 			if (!_currentTest)
 				error("else without test at line %d", lineno);
 			if (_conditionals.empty())
 				error("else without conditional at line %d", lineno);
-			auto &conditional = _conditionals.back();
-			if (conditional->falseScope)
+			auto &top = _conditionals.back();
+			if (top.conditional->falseScope)
 				error("double else in condition at line %d", lineno);
-			conditional->falseScope.reset(new Scope());
-			_conditionalScope = conditional->falseScope;
+			top.conditional->falseScope.reset(new Scope());
+			top.scope = top.conditional->falseScope;
 		} else if (p.maybe("endif]")) {
 			if (!_currentTest)
 				error("endif without test at line %d", lineno);
@@ -196,14 +193,12 @@ void ScriptV2::parseLine(const Common::String &line, uint lineno) {
 				error("endif without conditional at line %d", lineno);
 			auto conditional = _conditionals.back();
 			_conditionals.pop_back();
-			_conditionalScope.reset();
-			_currentTest->scope.commands.push_back(Common::move(conditional));
+			topScope().commands.push_back(Common::move(conditional.conditional));
 		} else if (p.maybe("clic]")) {
 			if (!_conditionals.empty())
 				error("[clic] inside conditional at line %d", lineno);
 			if (!_currentTest)
 				error("[clic] without test at line %d", lineno);
-			_testScope.reset();
 		} else if (p.maybe("in]")) {
 			if (!_conditionals.empty())
 				error("[in] inside conditional at line %d", lineno);
@@ -212,7 +207,6 @@ void ScriptV2::parseLine(const Common::String &line, uint lineno) {
 			if (_currentTest->enter)
 				error("duplicate [in] handler");
 			_currentTest->enter.reset(new Scope);
-			_testScope = _currentTest->enter;
 		} else if (p.maybe("out]")) {
 			if (!_conditionals.empty())
 				error("[out] inside conditional at line %d", lineno);
@@ -221,7 +215,6 @@ void ScriptV2::parseLine(const Common::String &line, uint lineno) {
 			if (_currentTest->leave)
 				error("duplicate [out] handler");
 			_currentTest->leave.reset(new Scope);
-			_testScope = _currentTest->leave;
 		} else {
 			error("invalid [] directive on line %u: %s", lineno, line.c_str());
 		}
@@ -240,8 +233,7 @@ void ScriptV2::parseLine(const Common::String &line, uint lineno) {
 		} else
 			error("invalid syntax at %d", lineno);
 
-		auto &commands = _conditionalScope ? _conditionalScope->commands : _testScope ? _testScope->commands
-																					  : _currentTest->scope.commands;
+		auto &commands = topScope().commands;
 		if (command)
 			commands.push_back(command);
 	} else {
diff --git a/engines/phoenixvr/script_v2.h b/engines/phoenixvr/script_v2.h
index f1b6b8b2190..e6622caf8ea 100644
--- a/engines/phoenixvr/script_v2.h
+++ b/engines/phoenixvr/script_v2.h
@@ -51,9 +51,15 @@ public:
 private:
 	WarpPtr _currentWarp;
 	TestPtr _currentTest;
-	Common::Array<ConditionalPtr> _conditionals;
-	ScopePtr _conditionalScope;
-	ScopePtr _testScope;
+	struct ConditionalScope {
+		ConditionalPtr conditional;
+		ScopePtr scope;
+	};
+	Common::Array<ConditionalScope> _conditionals;
+
+	Scope &topScope() const {
+		return !_conditionals.empty() ? *_conditionals.back().scope : _currentTest->scope;
+	}
 
 private:
 	void parseLine(const Common::String &line, uint lineno) override;




More information about the Scummvm-git-logs mailing list