[Scummvm-git-logs] scummvm master -> 02ad8494d0ecff55b6e93f212bdefd08e2fc1515

AndywinXp noreply at scummvm.org
Wed Nov 22 22:28:31 UTC 2023


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

Summary:
02ad8494d0 SCUMM: MACGUI: Improve enabling/disabling save and load menus


Commit: 02ad8494d0ecff55b6e93f212bdefd08e2fc1515
    https://github.com/scummvm/scummvm/commit/02ad8494d0ecff55b6e93f212bdefd08e2fc1515
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-11-22T23:28:22+01:00

Commit Message:
SCUMM: MACGUI: Improve enabling/disabling save and load menus

The Indy3 code now matches the disasm, thanks to athrxx.

Changed paths:
    engines/scumm/gfx_mac.cpp


diff --git a/engines/scumm/gfx_mac.cpp b/engines/scumm/gfx_mac.cpp
index c0aa244ab98..b411664ae05 100644
--- a/engines/scumm/gfx_mac.cpp
+++ b/engines/scumm/gfx_mac.cpp
@@ -2667,9 +2667,25 @@ void MacGui::updateWindowManager() {
 
 	bool isActive = _windowManager->isMenuActive();
 
-	bool gameCondition = _vm->_game.id == GID_INDY3 ? _vm->VAR(58) != 0 : true;
-	bool canLoad = _vm->canLoadGameStateCurrently() && gameCondition;
-	bool canSave = _vm->canSaveGameStateCurrently() && gameCondition;
+	bool saveCondition = true;
+	bool loadCondition = true;
+
+	if (_vm->_game.id == GID_INDY3) {
+		// Taken from Mac disasm...
+		// The VAR(94) part tells us whether the copy protection has
+		// failed or not, while the VAR(58) part uses bitmasks to enable
+		// or disable saving and loading during normal gameplay.
+		saveCondition = (_vm->VAR(58) & 0x01) && !(_vm->VAR(94) & 0x10);
+		loadCondition = (_vm->VAR(58) & 0x02) && !(_vm->VAR(94) & 0x10);
+	} else {
+		// TODO: Complete LOOM with the rest of the proper code from disasm,
+		// for now we only have the copy protection code in place...
+		saveCondition = !(_vm->VAR(221) & 0x4000);
+		loadCondition = !(_vm->VAR(221) & 0x4000);
+	}
+
+	bool canLoad = _vm->canLoadGameStateCurrently() && saveCondition;
+	bool canSave = _vm->canSaveGameStateCurrently() && loadCondition;
 
 	Graphics::MacMenuItem *gameMenu = _windowManager->getMenu()->getMenuItem("Game");
 	Graphics::MacMenuItem *loadMenu = _windowManager->getMenu()->getSubMenuItem(gameMenu, 0);




More information about the Scummvm-git-logs mailing list