[Scummvm-git-logs] scummvm master -> 74e521d8f8d37beaf89434d7a453b45b6cf074da
bluegr
noreply at scummvm.org
Mon Aug 28 19:34: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:
74e521d8f8 PINK: Disable the Songs entry from the demo menu
Commit: 74e521d8f8d37beaf89434d7a453b45b6cf074da
https://github.com/scummvm/scummvm/commit/74e521d8f8d37beaf89434d7a453b45b6cf074da
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-08-28T22:34:28+03:00
Commit Message:
PINK: Disable the Songs entry from the demo menu
This is aimed at and tested for the German Demo menu of Passport to Peril
In the original demo, the menu item for Songs is missing from the menu. In this fix we disable it (greyed out)
because the code for removing an item from the menu causes shifting of the subsequent menu items which
leads to unreliable code and potential future bugs if it's not accounted for.
Changed paths:
engines/pink/gui.cpp
engines/pink/pink.cpp
engines/pink/pink.h
diff --git a/engines/pink/gui.cpp b/engines/pink/gui.cpp
index 3a35d23e4bf..1f88f1998b1 100644
--- a/engines/pink/gui.cpp
+++ b/engines/pink/gui.cpp
@@ -179,6 +179,16 @@ void PinkEngine::initMenu() {
Graphics::MacMenuSubMenu *subMenu = _menu->getSubmenu(nullptr, 0);
if (subMenu) {
+
+ if (isPerilDemo()) {
+ // From the first submenu ("Game"), disable the (zero indexed) item 5 ("Songs").
+ // Use setEnabled() rather than removeMenuItem() since the latter removes the item
+ // out of the list changing the index for the items that follow.
+ // The effect is that "Songs" will be greyed out for the demo, since it's not available for it.
+ // The original demo does not have the "Songs" item in the menu at all.
+ _menu->setEnabled( _menu->getSubMenuItem(_menu->getMenuItem(0), 5), false);
+ }
+
SaveStateList saves = listSaves();
if (!saves.empty()) {
_menu->removeMenuItem(subMenu, kRecentSaveId);
@@ -228,6 +238,7 @@ void PinkEngine::executeMenuCommand(uint id) {
case kExitAction:
openMainMenuDialog();
break;
+
case kSongsAction:
initModule("Muzik", "", nullptr);
break;
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 132a1fbd4f5..fe16f4224d3 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -51,6 +51,9 @@ PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
g_paletteLookup = new Graphics::PaletteLookup;
+
+ _isPeril = !strcmp(_desc->gameId, kPeril);
+ _isPerilDemo = _isPeril && (_desc->flags & ADGF_DEMO);
}
PinkEngine::~PinkEngine() {
@@ -314,7 +317,11 @@ void PinkEngine::pauseEngineIntern(bool pause) {
}
bool PinkEngine::isPeril() const {
- return !strcmp(_desc->gameId, kPeril);
+ return _isPeril;
+}
+
+bool PinkEngine::isPerilDemo() const {
+ return _isPerilDemo;
}
}
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index 734aee5b63a..6a70924e7fe 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -122,6 +122,7 @@ public:
void changeScene();
bool isPeril() const;
+ bool isPerilDemo() const;
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(const Common::String &variable, const Common::String &value) const;
@@ -176,6 +177,8 @@ private:
PDAMgr _pdaMgr;
const ADGameDescription *_desc;
+ bool _isPeril;
+ bool _isPerilDemo;
};
WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
More information about the Scummvm-git-logs
mailing list