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

alxpnv noreply at scummvm.org
Thu Dec 9 10:20:51 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:
77cfc02f6c ASYLUM: add debug command to draw action area
d4d1f08c3d ASYLUM: fix starting the game after loading of saved game was cancelled


Commit: 77cfc02f6c33f49bc7fe067cee02a15b2a7db99b
    https://github.com/scummvm/scummvm/commit/77cfc02f6c33f49bc7fe067cee02a15b2a7db99b
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-12-09T13:24:58+03:00

Commit Message:
ASYLUM: add debug command to draw action area

Changed paths:
    engines/asylum/console.cpp
    engines/asylum/console.h
    engines/asylum/views/scene.cpp


diff --git a/engines/asylum/console.cpp b/engines/asylum/console.cpp
index a4729e9273..b8a996c5d2 100644
--- a/engines/asylum/console.cpp
+++ b/engines/asylum/console.cpp
@@ -52,6 +52,7 @@ extern int g_debugActors;
 extern int g_debugDrawRects;
 extern int g_debugObjects;
 extern int g_debugPolygons;
+extern int g_debugPolygonIndex;
 extern int g_debugSceneRects;
 extern int g_debugScrolling;
 
@@ -289,6 +290,7 @@ Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine), _resV
 
 	registerCmd("palette",        WRAP_METHOD(Console, cmdSetPalette));
 	registerCmd("view",           WRAP_METHOD(Console, cmdViewResource));
+	registerCmd("draw_area",      WRAP_METHOD(Console, cmdDrawActionArea));
 
 	registerCmd("toggle_flag",    WRAP_METHOD(Console, cmdToggleFlag));
 
@@ -352,6 +354,7 @@ bool Console::cmdHelp(int, const char **) {
 	debugPrintf("\n");
 	debugPrintf(" palette     - set the screen palette\n");
 	debugPrintf(" view        - view game resources\n");
+	debugPrintf(" draw_area   - draw action area\n");
 	debugPrintf("\n");
 	debugPrintf(" toggle_flag - toggle a flag\n");
 	debugPrintf("\n");
@@ -1089,6 +1092,30 @@ bool Console::cmdViewResource(int argc, const char **argv) {
 	}
 }
 
+bool Console::cmdDrawActionArea(int argc, const char **argv) {
+	if (argc == 1) {
+		if (g_debugPolygonIndex) {
+			g_debugPolygonIndex = 0;
+			return false;
+		} else {
+			debugPrintf("Syntax: %s (<area_index>)\n", argv[0]);
+			return true;
+		}
+	}
+
+	int areaIndex = getWorld()->getActionAreaIndexById(atoi(argv[1]));
+	if (areaIndex == -1) {
+		debugPrintf("No such area\n");
+		return true;
+	}
+
+	ActionArea *area = getWorld()->actions[areaIndex];
+	if (area->polygonIndex)
+		g_debugPolygonIndex = area->polygonIndex;
+
+	return false;
+}
+
 //////////////////////////////////////////////////////////////////////////
 // Flags commands
 //////////////////////////////////////////////////////////////////////////
diff --git a/engines/asylum/console.h b/engines/asylum/console.h
index 45de630ad6..74643faa02 100644
--- a/engines/asylum/console.h
+++ b/engines/asylum/console.h
@@ -95,6 +95,7 @@ private:
 
 	bool cmdSetPalette(int argc, const char **argv);
 	bool cmdViewResource(int argc, const char **argv);
+	bool cmdDrawActionArea(int argc, const char **argv);
 
 	bool cmdToggleFlag(int argc, const char **argv);
 };
diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index 3f3506f6bc..a0b29bc907 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -53,6 +53,7 @@ namespace Asylum {
 int g_debugActors;
 int g_debugObjects;
 int g_debugPolygons;
+int g_debugPolygonIndex;
 int g_debugSceneRects;
 int g_debugScrolling;
 
@@ -74,6 +75,7 @@ Scene::Scene(AsylumEngine *engine): _vm(engine),
 	g_debugActors = 0;
 	g_debugObjects  = 0;
 	g_debugPolygons  = 0;
+	g_debugPolygonIndex = 0;
 	g_debugSceneRects = 0;
 	g_debugScrolling = 0;
 }
@@ -2450,6 +2452,8 @@ bool Scene::drawScene() {
 		debugShowActors();
 	if (g_debugPolygons)
 		debugShowPolygons();
+	if (g_debugPolygonIndex)
+		debugHighlightPolygon(g_debugPolygonIndex);
 	if (g_debugObjects)
 		debugShowObjects();
 	if (g_debugSceneRects)


Commit: d4d1f08c3df516669217c6a34b39c72307a50370
    https://github.com/scummvm/scummvm/commit/d4d1f08c3df516669217c6a34b39c72307a50370
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-12-09T13:24:58+03:00

Commit Message:
ASYLUM: fix starting the game after loading of saved game was cancelled

Changed paths:
    engines/asylum/asylum.cpp
    engines/asylum/asylum.h
    engines/asylum/system/savegame.cpp
    engines/asylum/views/menu.cpp


diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index a5ab0aa702..37b40a939b 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -192,17 +192,18 @@ Common::Error AsylumEngine::run() {
 	return Common::kNoError;
 }
 
-void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
+bool AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
 	if (!_cursor || !_screen || !_savegame)
 		error("[AsylumEngine::startGame] Subsystems not initialized properly!");
 
 	if (type == kStartGameLoad && !_savegame->isCompatible()) {
-		Common::U32String message = _("Attempt to load saved game from a previous version: Version %s / Build %d");
+		// I18N: Warn user about loading potentially incompatible saved game
+		Common::U32String message = _("WARNING: Attempt to load saved game from a previous version: Version %s / Build %d");
 		GUI::MessageDialog dialog(Common::U32String::format(message, _savegame->getVersion(), _savegame->getBuild()), _("Load anyway"), _("Cancel"));
 
 		if (dialog.runModal() != GUI::kMessageOK) {
 			_menu->setDword455C80(false);
-			return;
+			return false;
 		}
 	}
 
@@ -279,6 +280,7 @@ void AsylumEngine::startGame(ResourcePackId sceneId, StartGameType type) {
 	}
 
 	_cursor->show();
+	return true;
 }
 
 void AsylumEngine::restart() {
@@ -304,7 +306,7 @@ void AsylumEngine::restart() {
 	_screen->clear();
 	_sound->playMusic(kResourceNone, 0);
 
-	startGame(kResourcePackTowerCells, kStartGamePlayIntro);
+	(void)startGame(kResourcePackTowerCells, kStartGamePlayIntro);
 }
 
 void AsylumEngine::reset() {
@@ -688,11 +690,9 @@ Common::Error AsylumEngine::loadGameState(int slot) {
 	savegame()->loadList();
 	savegame()->setIndex(slot);
 	if (savegame()->hasSavegame(slot))
-		startGame(savegame()->getScenePack(), AsylumEngine::kStartGameLoad);
+		return startGame(savegame()->getScenePack(), AsylumEngine::kStartGameLoad) ? Common::kNoError : Common::kReadingFailed;
 	else
 		return Common::kReadingFailed;
-
-	return Common::kNoError;
 }
 
 Common::Error AsylumEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h
index c9f7946c95..d226b44d5f 100644
--- a/engines/asylum/asylum.h
+++ b/engines/asylum/asylum.h
@@ -87,7 +87,7 @@ public:
 	/**
 	 * Start a new the game
 	 */
-	void startGame(ResourcePackId sceneId, StartGameType type);
+	bool startGame(ResourcePackId sceneId, StartGameType type);
 
 	/**
 	 * Restarts the game
@@ -104,7 +104,7 @@ public:
 	 *
 	 * @param sceneId ResourcePack for the scene
 	 */
-	void switchScene(ResourcePackId sceneId) { startGame(sceneId, kStartGameScene); }
+	void switchScene(ResourcePackId sceneId) { (void)startGame(sceneId, kStartGameScene); }
 
 	/**
 	 * Get the number of engine ticks
diff --git a/engines/asylum/system/savegame.cpp b/engines/asylum/system/savegame.cpp
index 77dc2d9e35..a042ccf3f5 100644
--- a/engines/asylum/system/savegame.cpp
+++ b/engines/asylum/system/savegame.cpp
@@ -111,7 +111,7 @@ bool Savegame::quickLoad() {
 		return false;
 
 	_index = SAVEGAME_QUICKSLOT;
-	_vm->startGame(getScenePack(), AsylumEngine::kStartGameLoad);
+	(void)_vm->startGame(getScenePack(), AsylumEngine::kStartGameLoad);
 
 	return true;
 }
diff --git a/engines/asylum/views/menu.cpp b/engines/asylum/views/menu.cpp
index 31eaa7c42b..acaa01b768 100644
--- a/engines/asylum/views/menu.cpp
+++ b/engines/asylum/views/menu.cpp
@@ -1658,7 +1658,7 @@ void Menu::clickLoadGame() {
 			 && cursor.y >= 273 && cursor.y <= (273 + 24))
 				_dword_455C80 = false;
 		} else {
-			_vm->startGame(getSaveLoad()->getScenePack(), AsylumEngine::kStartGameLoad);
+			(void)_vm->startGame(getSaveLoad()->getScenePack(), AsylumEngine::kStartGameLoad);
 		}
 		return;
 	}




More information about the Scummvm-git-logs mailing list