ScummVM API documentation
pink.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef PINK_PINK_H
23 #define PINK_PINK_H
24 
25 #include "common/random.h"
26 #include "common/savefile.h"
27 
28 #include "engines/engine.h"
29 #include "engines/savestate.h"
30 
31 #include "gui/debugger.h"
32 
33 #include "pink/constants.h"
34 #include "pink/file.h"
35 #include "pink/utils.h"
36 #include "pink/pda_mgr.h"
37 
38 /*
39  * This is the namespace of the Pink engine.
40  *
41  * Status of this engine: In Development
42  *
43  * Internal name of original engine: OxCart Runtime
44  *
45  * Games using this engine:
46  * - The Pink Panther: Passport to Peril
47  * - The Pink Panther: Hokus Pokus Pink
48  *
49  * Peril game status:
50  * Fully playable*
51  *
52  * Pokus game status:
53  * Fully Playable*
54  *
55  * Known bugs:
56  * PDA is partially usable(ActionText is not implemented)
57  */
58 
59 struct ADGameDescription;
60 
61 namespace Common {
62  class PEResources;
63 }
64 
65 namespace Graphics {
66 class MacMenu;
67 struct WinCursorGroup;
68 class PaletteLookup;
69 }
70 
71 namespace Pink {
72 
73 class Console;
74 class Screen;
75 class Archive;
76 class NamedObject;
77 class Module;
78 class Page;
79 class LeadActor;
80 
81 enum {
82  kPinkDebugGeneral = 1 << 0,
83  kPinkDebugLoadingResources = 1 << 1,
84  kPinkDebugLoadingObjects = 1 << 2,
85  kPinkDebugScripts = 1 << 3,
86  kPinkDebugActions = 1 << 4
87 };
88 
89 enum {
90  GF_COMPRESSED = 1 << 0,
91 };
92 
93 extern Graphics::PaletteLookup *g_paletteLookup;
94 
95 class PinkEngine : public Engine {
96 public:
97  PinkEngine(OSystem *system, const ADGameDescription *desc);
98  ~PinkEngine() override;
99 
100  Common::Error run() override;
101 
102  bool hasFeature(EngineFeature f) const override;
103 
104  Common::Error loadGameState(int slot) override;
105  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
106 
107  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
108  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
109  Common::String getSaveStateName(int slot) const override {
110  return Common::String::format("%s.s%02d", _targetName.c_str(), slot);
111  }
112  SaveStateList listSaves() const;
113 
114  friend class Console;
115 
116 protected:
117  void pauseEngineIntern(bool pause) override;
118 
119 public:
120  void load(Archive &archive);
121 
122  void changeScene();
123 
124  bool isPeril() const;
125  bool isPerilDemo() const;
126 
127  void setVariable(Common::String &variable, Common::String &value);
128  bool checkValueOfVariable(const Common::String &variable, const Common::String &value) const;
129 
130  void executeMenuCommand(uint id);
131  bool executePageChangeCommand(uint id);
132 
133  Common::Language getLanguage() const;
134  OrbFile *getOrb() { return &_orb; }
135  BroFile *getBro() { return _bro; }
136  Common::RandomSource &getRnd() { return _rnd; };
137  Screen *getScreen() { return _screen; }
138  PDAMgr &getPdaMgr() { return _pdaMgr; }
139 
140  void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) { _nextModule = nextModule; _nextPage = nextPage; }
141  void setLeadActor(LeadActor *actor) { _actor = actor; };
142  void setCursor(uint cursorIndex);
143 
144 private:
145  Common::Error init();
146 
147  void initMenu();
148 
149  bool loadCursors();
150 
151  void initModule(const Common::String moduleName, const Common::String pageName, Archive *saveFile);
152  void addModule(const Common::String &moduleName);
153  void removeModule();
154 
155  void openLocalWebPage(const Common::String &pageName) const;
156 
157 private:
160 
161  Common::String _nextModule;
162  Common::String _nextPage;
163 
164  Common::PEResources *_exeResources;
165 
166  OrbFile _orb;
167  BroFile *_bro;
168 
169  Graphics::MacMenu *_menu;
170  Screen *_screen;
171  LeadActor *_actor;
172 
173  Module *_module;
174  Array<NamedObject *> _modules;
175 
176  StringMap _variables;
177  PDAMgr _pdaMgr;
178 
179  const ADGameDescription *_desc;
180  bool _isPeril;
181  bool _isPerilDemo;
182 };
183 
184 WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
185 Common::String generateSaveName(int slot, const char *gameId);
186 
187 } // End of namespace Pink
188 
189 #endif
Definition: archive.h:39
Definition: str.h:59
Definition: winexe_pe.h:48
EngineFeature
Definition: engine.h:250
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: error.h:84
Definition: advancedDetector.h:120
Definition: random.h:44
Definition: default_display_client.h:78
Definition: console.h:31
Definition: palette.h:141
Definition: pink.h:95
Definition: file.h:51
Definition: pda_mgr.h:38
Definition: stream.h:745
Definition: module.h:43
Definition: file.h:76
Definition: savestate.h:56
Definition: archive.h:35
Definition: screen.h:44
Definition: lead_actor.h:41
Definition: ustr.h:57
Definition: algorithm.h:29
Definition: formatinfo.h:28
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: macmenu.h:94
Common::String getSaveStateName(int slot) const override
Definition: pink.h:109
Definition: utils.h:52
Definition: system.h:167
Definition: utils.h:30
Definition: engine.h:143
Language
Definition: language.h:45