aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorAndrei Prykhodko2018-07-22 21:26:09 +0300
committerAndrei Prykhodko2018-07-22 21:26:09 +0300
commitc06e2abfb09f3dfa414e2a30b6f5cef1b4db40f8 (patch)
tree7aed6cda4ab86825a1b6e6d2018e0298c143c262 /engines
parentf4eda441862f8aacf75417f577907343278708e4 (diff)
downloadscummvm-rg350-c06e2abfb09f3dfa414e2a30b6f5cef1b4db40f8.tar.gz
scummvm-rg350-c06e2abfb09f3dfa414e2a30b6f5cef1b4db40f8.tar.bz2
scummvm-rg350-c06e2abfb09f3dfa414e2a30b6f5cef1b4db40f8.zip
PINK: added menu commands
Diffstat (limited to 'engines')
-rw-r--r--engines/pink/director.cpp5
-rw-r--r--engines/pink/director.h3
-rw-r--r--engines/pink/gui.cpp338
-rw-r--r--engines/pink/module.mk1
-rw-r--r--engines/pink/pink.cpp4
-rw-r--r--engines/pink/pink.h9
6 files changed, 352 insertions, 8 deletions
diff --git a/engines/pink/director.cpp b/engines/pink/director.cpp
index 4d16709357..6a05fe5577 100644
--- a/engines/pink/director.cpp
+++ b/engines/pink/director.cpp
@@ -76,15 +76,12 @@ static const Graphics::MacMenuData menuSubItems[] = {
};
-Director::Director(Common::PEResources &exe)
+Director::Director()
: _surface(640, 480) {
_wm.setScreen(&_surface);
_wm.setMode(Graphics::kWMModeNoDesktop | Graphics::kWMModeAutohideMenu | Graphics::kWMModalMenuMode);
_wm.setMenuHotzone(Common::Rect(0, 0, 640, 23));
_wm.setMenuDelay(250000);
-
- _menu = Graphics::MacMenu::createMenuFromPEexe(exe, &_wm);
- _menu->calcDimensions();
}
void Director::update() {
diff --git a/engines/pink/director.h b/engines/pink/director.h
index e2526adfc2..7a5b57c90e 100644
--- a/engines/pink/director.h
+++ b/engines/pink/director.h
@@ -46,7 +46,7 @@ class ActionSound;
class Director {
public:
- Director(Common::PEResources &exe);
+ Director();
void update();
bool processEvent(Common::Event &event);
@@ -81,7 +81,6 @@ private:
private:
Graphics::Screen _surface;
Graphics::MacWindowManager _wm;
- Graphics::MacMenu *_menu;
Common::Array<Common::Rect> _dirtyRects;
Common::Array<ActionCEL *> _sprites;
Common::Array<ActionCEL *> _savedSprites;
diff --git a/engines/pink/gui.cpp b/engines/pink/gui.cpp
new file mode 100644
index 0000000000..12ce345bd0
--- /dev/null
+++ b/engines/pink/gui.cpp
@@ -0,0 +1,338 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "graphics/macgui/macwindowmanager.h"
+#include "graphics/macgui/macmenu.h"
+
+#include "pink/pink.h"
+#include "pink/director.h"
+#include "pink/objects/actors/lead_actor.h"
+
+namespace Pink {
+
+enum {
+ kNewGameAction = 0,
+ kLoadSave,
+ kSaveAction,
+ kSaveAsAction,
+ kSongsAction,
+ kSoundSettingsAction,
+ kLastSavesAction,
+ kPauseAction,
+ kExitAction
+};
+
+enum {
+ kShowContent = 9,
+ kShowGreece,
+ kShowIndonesia,
+ kShowIsrael,
+ kShowKenya,
+ kShowRussia
+};
+
+enum {
+ kShowPDAAction = 15,
+
+ kShowAustraliaArt = 16,
+ kShowAustraliaCloth,
+ kShowAustraliaFood,
+ kShowAustraliaHistory,
+ kShowAustraliaNature,
+ kShowAustraliaPeople,
+ kShowAustraliaPlaces,
+ kShowAustraliaReligion,
+
+ kShowBhutanArt = 24,
+ kShowBhutanCloth,
+ kShowBhutanFood,
+ kShowBhutanHistory,
+ kShowBhutanNature,
+ kShowBhutanPeople,
+ kShowBhutanPlaces,
+ kShowBhutanReligion,
+
+ kShowChinaArt = 32,
+ kShowChinaCloth,
+ kShowChinaFood,
+ kShowChinaHistory,
+ kShowChinaNature,
+ kShowChinaPeople,
+ kShowChinaPlaces,
+ kShowChinaReligion,
+
+ kShowEnglandArt = 40,
+ kShowEnglandCloth,
+ kShowEnglandFood,
+ kShowEnglandHistory,
+ kShowEnglandNature,
+ kShowEnglandPeople,
+ kShowEnglandPlaces,
+ kShowEnglandReligion,
+
+ kShowEgyptArt = 48,
+ kShowEgyptCloth,
+ kShowEgyptFood,
+ kShowEgyptHistory,
+ kShowEgyptNature,
+ kShowEgyptPeople,
+ kShowEgyptPlaces,
+ kShowEgyptReligion,
+
+ kShowIndiaArt = 56,
+ kShowIndiaCloth,
+ kShowIndiaFood,
+ kShowIndiaHistory,
+ kShowIndiaNature,
+ kShowIndiaPeople,
+ kShowIndiaPlaces,
+ kShowIndiaReligion
+};
+
+enum {
+ kShowGameWebPage = 64,
+ kShowTechSupport,
+ kShowWinnnerPage,
+ kShowWanderlustInteractive,
+ kShowMGM,
+ kShowDiagnostics,
+ kShowAbout
+};
+
+static void menuCommandsCallback(int action, Common::U32String &, void *data) {
+ PinkEngine *engine = (PinkEngine *)data;
+ bool isPeril = engine->isPeril();
+ if (!isPeril && action > 14) {
+ action += 49;
+ } else if (isPeril && action >= 9) {
+ action += 6;
+ }
+ engine->executeMenuCommand(action);
+}
+
+void PinkEngine::initMenu(Common::PEResources &exeResources) {
+ _director->getWndManager().setEnginePauseCallback(this, &pauseEngine);
+
+ _menu = Graphics::MacMenu::createMenuFromPEexe(exeResources, &_director->getWndManager());
+ _menu->calcDimensions();
+ _menu->setCommandsCallback(&menuCommandsCallback, this);
+}
+
+void PinkEngine::executeMenuCommand(uint id) {
+ switch (id) {
+ case kNewGameAction: {
+ const Common::String moduleName = _modules[0]->getName();
+ initModule(moduleName, "", nullptr);
+ break;
+ }
+ case kLoadSave:
+ case kSaveAction:
+ case kSaveAsAction:
+ case kSoundSettingsAction:
+ case kLastSavesAction:
+ case kPauseAction:
+ case kExitAction:
+ openMainMenuDialog();
+ break;
+ case kSongsAction:
+ initModule("Muzik", "", nullptr);
+ break;
+
+ case kShowPDAAction:
+ _actor->loadPDA(kNavigatePage);
+ break;
+
+ case kShowAustraliaArt:
+ _actor->loadPDA("AUSART");
+ break;
+ case kShowAustraliaCloth:
+ _actor->loadPDA("AUSCLO");
+ break;
+ case kShowAustraliaFood:
+ _actor->loadPDA("AUSFOO");
+ break;
+ case kShowAustraliaHistory:
+ _actor->loadPDA("AUSHIS");
+ break;
+ case kShowAustraliaNature:
+ _actor->loadPDA("AUSNAT");
+ break;
+ case kShowAustraliaPeople:
+ _actor->loadPDA("AUSPEO");
+ break;
+ case kShowAustraliaPlaces:
+ _actor->loadPDA("AUSPLA");
+ break;
+ case kShowAustraliaReligion:
+ _actor->loadPDA("AUSREL");
+ break;
+
+ case kShowBhutanArt:
+ _actor->loadPDA("BHUART");
+ break;
+ case kShowBhutanCloth:
+ _actor->loadPDA("BHUCLO");
+ break;
+ case kShowBhutanFood:
+ _actor->loadPDA("BHUFOO");
+ break;
+ case kShowBhutanHistory:
+ _actor->loadPDA("BHUHIS");
+ break;
+ case kShowBhutanNature:
+ _actor->loadPDA("BHUNAT");
+ break;
+ case kShowBhutanPeople:
+ _actor->loadPDA("BHUPEO");
+ break;
+ case kShowBhutanPlaces:
+ _actor->loadPDA("BHUPLA");
+ break;
+ case kShowBhutanReligion:
+ _actor->loadPDA("BHUREL");
+ break;
+
+ case kShowChinaArt:
+ _actor->loadPDA("CHIART");
+ break;
+ case kShowChinaCloth:
+ _actor->loadPDA("CHICLO");
+ break;
+ case kShowChinaFood:
+ _actor->loadPDA("CHIFOO");
+ break;
+ case kShowChinaHistory:
+ _actor->loadPDA("CHIHIS");
+ break;
+ case kShowChinaNature:
+ _actor->loadPDA("CHINAT");
+ break;
+ case kShowChinaPeople:
+ _actor->loadPDA("CHIPEO");
+ break;
+ case kShowChinaPlaces:
+ _actor->loadPDA("CHIPLA");
+ break;
+ case kShowChinaReligion:
+ _actor->loadPDA("CHIREL");
+ break;
+
+ case kShowEnglandArt:
+ _actor->loadPDA("BRIART");
+ break;
+ case kShowEnglandCloth:
+ _actor->loadPDA("BRICLO");
+ break;
+ case kShowEnglandFood:
+ _actor->loadPDA("BRIFOO");
+ break;
+ case kShowEnglandHistory:
+ _actor->loadPDA("BRIHIS");
+ break;
+ case kShowEnglandNature:
+ _actor->loadPDA("BRINAT");
+ break;
+ case kShowEnglandPeople:
+ _actor->loadPDA("BRIPEO");
+ break;
+ case kShowEnglandPlaces:
+ _actor->loadPDA("BRIPLA");
+ break;
+ case kShowEnglandReligion:
+ _actor->loadPDA("BRIREL");
+ break;
+
+ case kShowEgyptArt:
+ _actor->loadPDA("BRIART");
+ break;
+ case kShowEgyptCloth:
+ _actor->loadPDA("BRICLO");
+ break;
+ case kShowEgyptFood:
+ _actor->loadPDA("BRIFOO");
+ break;
+ case kShowEgyptHistory:
+ _actor->loadPDA("BRIHIS");
+ break;
+ case kShowEgyptNature:
+ _actor->loadPDA("BRINAT");
+ break;
+ case kShowEgyptPeople:
+ _actor->loadPDA("BRIPEO");
+ break;
+ case kShowEgyptPlaces:
+ _actor->loadPDA("BRIPLA");
+ break;
+ case kShowEgyptReligion:
+ _actor->loadPDA("BRIREL");
+ break;
+
+ case kShowIndiaArt:
+ _actor->loadPDA("INDART");
+ break;
+ case kShowIndiaCloth:
+ _actor->loadPDA("INDCLO");
+ break;
+ case kShowIndiaFood:
+ _actor->loadPDA("INDFOO");
+ break;
+ case kShowIndiaHistory:
+ _actor->loadPDA("INDHIS");
+ break;
+ case kShowIndiaNature:
+ _actor->loadPDA("INDNAT");
+ break;
+ case kShowIndiaPeople:
+ _actor->loadPDA("INDPEO");
+ break;
+ case kShowIndiaPlaces:
+ _actor->loadPDA("INDPLA");
+ break;
+ case kShowIndiaReligion:
+ _actor->loadPDA("INDREL");
+ break;
+
+ case kShowContent:
+ _actor->loadPDA("TOC");
+ break;
+ case kShowGreece:
+ _actor->loadPDA("GREOVER");
+ break;
+ case kShowIndonesia:
+ _actor->loadPDA("INDOVER");
+ break;
+ case kShowIsrael:
+ _actor->loadPDA("ISROVER");
+ break;
+ case kShowKenya:
+ _actor->loadPDA("KENOVER");
+ break;
+ case kShowRussia:
+ _actor->loadPDA("SIBOVER");
+ break;
+
+ default:
+ break;
+ }
+}
+
+} // End of namespace Pink
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
index ab9cc89624..80422cfd7d 100644
--- a/engines/pink/module.mk
+++ b/engines/pink/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS = \
detection.o \
director.o \
file.o \
+ gui.o \
pda_mgr.o \
pink.o \
resource_mgr.o \
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 18e1dcb6c0..2f645c76d4 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -76,9 +76,9 @@ Common::Error PinkEngine::init() {
_console = new Console(this);
- _director = new Director(exeResources);
+ _director = new Director();
- _director->getWndManager().setEnginePauseCallback(this, &pauseEngine);
+ initMenu(exeResources);
Common::String orbName;
Common::String broName;
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
index da7ac49bc8..b46d4f07b4 100644
--- a/engines/pink/pink.h
+++ b/engines/pink/pink.h
@@ -59,6 +59,10 @@
* missing menu
*/
+namespace Graphics {
+class MacMenu;
+}
+
namespace Pink {
class Console;
@@ -109,6 +113,8 @@ public:
void setVariable(Common::String &variable, Common::String &value);
bool checkValueOfVariable(Common::String &variable, Common::String &value);
+ void executeMenuCommand(uint id);
+
OrbFile *getOrb() { return &_orb; }
BroFile *getBro() { return _bro; }
Common::RandomSource &getRnd() { return _rnd; };
@@ -122,6 +128,8 @@ public:
private:
Common::Error init();
+ void initMenu(Common::PEResources &exeResources);
+
bool loadCursors(Common::PEResources &exeResources);
void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
@@ -139,6 +147,7 @@ private:
OrbFile _orb;
BroFile *_bro;
+ Graphics::MacMenu *_menu;
Director *_director;
LeadActor *_actor;