[Scummvm-git-logs] scummvm master -> 33292a74d331a9063276b940585a1e7169b21b8c

whoozle noreply at scummvm.org
Mon Jul 20 00:55:23 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:
33292a74d3 PHOENIXVR: Add level labels, implement V2 Goto_Level command


Commit: 33292a74d331a9063276b940585a1e7169b21b8c
    https://github.com/scummvm/scummvm/commit/33292a74d331a9063276b940585a1e7169b21b8c
Author: Vladimir Menshakov (vladimir.menshakov at gmail.com)
Date: 2026-07-20T01:53:54+01:00

Commit Message:
PHOENIXVR: Add level labels, implement V2 Goto_Level command

Use level labels for save labels in Amerzone.

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


diff --git a/engines/phoenixvr/commands_v1.cpp b/engines/phoenixvr/commands_v1.cpp
index 12275ff1655..30ed0d4258f 100644
--- a/engines/phoenixvr/commands_v1.cpp
+++ b/engines/phoenixvr/commands_v1.cpp
@@ -1251,7 +1251,7 @@ struct LoadSave : public Command {
 			debug("loadsave %s %s", srcVar.c_str(), dstVar.c_str());
 			if (!dstVar.empty() && Common::isDigit(dstVar[0])) {
 				uint level = atoi(dstVar.c_str());
-				uint currentLevel = g_engine->currentAmerzoneLevel();
+				uint currentLevel = g_engine->currentLevel();
 				if (currentLevel != 0) {
 					g_engine->setVariable(srcVar, currentLevel == level);
 					return;
diff --git a/engines/phoenixvr/commands_v2.cpp b/engines/phoenixvr/commands_v2.cpp
index 5597ab32eab..65a3df66756 100644
--- a/engines/phoenixvr/commands_v2.cpp
+++ b/engines/phoenixvr/commands_v2.cpp
@@ -62,7 +62,8 @@ struct Goto_Level : public Command {
 	Common::String name;
 	Goto_Level(const Common::Array<Common::String> &args) : name(args[0]) {}
 	void exec(ExecutionContext &ctx) const override {
-		debug("goto level %s", name.c_str());
+		g_engine->goToLevel(name);
+		ctx.running = false;
 	}
 };
 
diff --git a/engines/phoenixvr/phoenixvr.cpp b/engines/phoenixvr/phoenixvr.cpp
index 02c81ef760b..ab344c66ffb 100644
--- a/engines/phoenixvr/phoenixvr.cpp
+++ b/engines/phoenixvr/phoenixvr.cpp
@@ -77,21 +77,10 @@ static bool isAmerzoneGame(const ADGameDescription *gameDesc) {
 	return !strcmp(gameDesc->gameId, "amerzone");
 }
 
-static Common::String getAmerzoneLevelLabel(const Common::String &script) {
-	static const struct {
-		const char *prefix;
-		const char *label;
-	} levels[] = {
-		{"01VR_PHARE", "Le Phare"},
-		{"02VR_ILE", "L'Ile"},
-		{"03VR_PUEBLO", "Le Pueblo"},
-		{"04VR_FLEUVE", "Le Fleuve"},
-		{"05VR_VILLAGEMARAIS", "Le Village"},
-		{"07VRTEMPLE_VOLCAN", "Le Temple"}};
-
-	for (const auto &level : levels) {
-		if (script.hasPrefixIgnoreCase(level.prefix))
-			return level.label;
+Common::String PhoenixVREngine::getLevelLabel(const Common::String &script) const {
+	for (const auto &level : _levels) {
+		if (script.hasPrefixIgnoreCase(level.path))
+			return level.name;
 	}
 
 	return "Amerzone";
@@ -309,18 +298,18 @@ PhoenixVREngine::PhoenixVREngine(OSystem *syst, const ADGameDescription *gameDes
 	g_engine = this;
 
 	if (gameIdMatches("amerzone")) {
-		_levels.push_back("01VR_PHARE");
-		_levels.push_back("02VR_ILE");
-		_levels.push_back("03VR_PUEBLO");
-		_levels.push_back("04VR_FLEUVE");
-		_levels.push_back("05VR_VILLAGEMARAIS");
-		_levels.push_back("07VRTEMPLE_VOLCAN");
+		_levels.push_back({"01VR_PHARE", "Le Phare"});
+		_levels.push_back({"02VR_ILE", "L'Ile"});
+		_levels.push_back({"03VR_PUEBLO", "Le Pueblo"});
+		_levels.push_back({"04VR_FLEUVE", "Le Fleuve"});
+		_levels.push_back({"05VR_VILLAGEMARAIS", "Le Village"});
+		_levels.push_back({"07VRTEMPLE_VOLCAN", "Le Temple"});
 	} else if (gameIdMatches("mysteryofmummy")) {
-		_levels.push_back("level1");
-		_levels.push_back("level2");
-		_levels.push_back("level3");
-		_levels.push_back("level4");
-		_levels.push_back("level5");
+		_levels.push_back({"level1", "Level 1"});
+		_levels.push_back({"level2", "Level 2"});
+		_levels.push_back({"level3", "Level 3"});
+		_levels.push_back({"level4", "Level 4"});
+		_levels.push_back({"level5", "Level 5"});
 		setNextLevel();
 	} else if (gameIdMatches("pharaoncurse")) {
 		Common::INIFile file;
@@ -333,13 +322,17 @@ PhoenixVREngine::PhoenixVREngine(OSystem *syst, const ADGameDescription *gameDes
 		for (int i = 0; i < numLevels; ++i) {
 			Common::String media;
 			Common::String path;
+			Common::String name;
 			if (!file.getKey("MEDIA", Common::String::format("LEVEL_%d", i), media))
 				error("no media in level section");
 			if (!file.getKey("PATH", Common::String::format("LEVEL_%d", i), path))
 				error("no path in level section");
+			if (!file.getKey("NAME", Common::String::format("LEVEL_%d", i), name))
+				error("no name in level section");
 			if (media == "HD")
 				path = "install\\" + path;
-			_levels.push_back(path);
+			debug("adding level %s %s", path.c_str(), name.c_str());
+			_levels.push_back(Level{path, name});
 		}
 	}
 }
@@ -380,18 +373,15 @@ bool PhoenixVREngine::gameIdMatches(const char *gameId) const {
 	return strcmp(_gameDescription->gameId, gameId) == 0;
 }
 
-uint PhoenixVREngine::currentAmerzoneLevel() const {
-	if (!gameIdMatches("amerzone"))
-		return 0;
-
+uint PhoenixVREngine::currentLevel() const {
 	uint index = 0;
-	for (const Common::String &level : _levels) {
+	for (const auto &level : _levels) {
 		++index;
-		if (_contextScript.hasPrefixIgnoreCase(level))
+		if (_contextScript.hasPrefixIgnoreCase(level.path))
 			return index;
 	}
 
-	error("currentAmerzoneLevel: can't find current script");
+	error("currentLevel: can't find current script");
 }
 
 Common::String PhoenixVREngine::removeDrive(const Common::String &path) {
@@ -454,12 +444,16 @@ Common::SeekableReadStream *PhoenixVREngine::open(const Common::String &filename
 	return nullptr;
 }
 
+Common::String PhoenixVREngine::getLevelScript(const Level &level) const {
+	auto mainScript = gameIdMatches("amerzone") ? "amerzone" : "script";
+	return Common::String::format("%s\\%s.lst", level.path.c_str(), mainScript);
+}
+
 bool PhoenixVREngine::setNextLevel() {
 	if (_nextLevel < _levels.size()) {
 		auto &level = _levels[_nextLevel++];
-		debug("next level is %s", level.c_str());
-		auto mainScript = gameIdMatches("amerzone") ? "amerzone" : "script";
-		setNextScript(Common::String::format("%s\\%s.lst", level.c_str(), mainScript));
+		debug("next level is %s", level.path.c_str());
+		setNextScript(getLevelScript(level));
 		_loaded = true;
 
 		// reset flag or interface.vr will skip menu
@@ -785,6 +779,20 @@ bool PhoenixVREngine::goToWarp(const Common::String &warp, bool savePrev) {
 	return true;
 }
 
+void PhoenixVREngine::goToLevel(const Common::String &name) {
+	debug("goto level %s", name.c_str());
+	_nextLevel = 0;
+	for (auto &level : _levels) {
+		++_nextLevel;
+		if (level.name.equalsIgnoreCase(name)) {
+			debug("found level %s: %s", level.name.c_str(), level.path.c_str());
+			setNextScript(getLevelScript(level));
+			return;
+		}
+	}
+	error("level %s not found", name.c_str());
+}
+
 void PhoenixVREngine::returnToWarp() {
 	if (_prevWarp < 0) {
 		warning("return: no previous warp");
@@ -2093,7 +2101,7 @@ Common::Error PhoenixVREngine::loadGameStream(Common::SeekableReadStream *slot)
 		uint i = 0, n = _levels.size();
 		for (; i != n; ++i) {
 			auto &level = _levels[i];
-			if (state.script.hasPrefixIgnoreCase(level)) {
+			if (state.script.hasPrefixIgnoreCase(level.path)) {
 				_nextLevel = i + 1;
 				debug("current level is %u", _nextLevel);
 				break;
@@ -2124,8 +2132,8 @@ Common::Error PhoenixVREngine::saveGameStream(Common::WriteStream *slot, bool is
 	state.game = _contextLabel;
 	const bool isAmerzone = gameIdMatches("amerzone");
 	Common::String amerzoneLevelLabel;
-	if (isAmerzone) {
-		amerzoneLevelLabel = getAmerzoneLevelLabel(state.script);
+	if (!_levels.empty()) {
+		amerzoneLevelLabel = getLevelLabel(state.script);
 		state.game.clear();
 	}
 
diff --git a/engines/phoenixvr/phoenixvr.h b/engines/phoenixvr/phoenixvr.h
index 62912bce683..b6f34d681bf 100644
--- a/engines/phoenixvr/phoenixvr.h
+++ b/engines/phoenixvr/phoenixvr.h
@@ -129,6 +129,7 @@ public:
 	// Script API
 	void setNextScript(const Common::String &path);
 	bool goToWarp(const Common::String &warp, bool savePrev = false);
+	void goToLevel(const Common::String &name);
 	void returnToWarp();
 	void loadCursor(int idx, const Common::String &path, int w, int h);
 	void setCursorDefault(int idx, const Common::String &path);
@@ -206,7 +207,7 @@ public:
 
 	bool wasRestarted() const { return _restarted; }
 	bool wasLoaded() const { return _loaded; }
-	uint currentAmerzoneLevel() const;
+	uint currentLevel() const;
 
 	void saveVariables();
 	void loadVariables();
@@ -246,6 +247,11 @@ private:
 		uint16 color;
 	};
 
+	struct Level {
+		Common::String path;
+		Common::String name;
+	};
+
 	static Common::String removeDrive(const Common::String &path);
 	Common::SeekableReadStream *open(const Common::String &name, Common::String *origName = nullptr);
 	Common::SeekableReadStream *tryOpen(const Common::Path &name, Common::String *origName);
@@ -275,6 +281,8 @@ private:
 
 	void processGenericEvents(const Common::Event &event);
 	void pauseEngineIntern(bool pause) override;
+	Common::String getLevelLabel(const Common::String &script) const;
+	Common::String getLevelScript(const Level &level) const;
 
 private:
 	bool _hasFocus = true;
@@ -367,7 +375,7 @@ private:
 	int _ciblePeriodSeconds = 0;
 	Common::Array<int> _cibleBounds;
 
-	Common::Array<Common::String> _levels;
+	Common::Array<Level> _levels;
 	uint _nextLevel = 0;
 
 	bool _restarted = false;




More information about the Scummvm-git-logs mailing list