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,
83  kPinkDebugLoadingResources,
84  kPinkDebugLoadingObjects,
85  kPinkDebugScripts,
86  kPinkDebugActions,
87 };
88 
89 enum {
90  GF_COMPRESSED = 1 << 0,
91 };
92 
93 enum PINKActions {
94  kActionNone,
95  kActionSkipWalk,
96  kActionSkipWalkAndCancelInteraction,
97  kActionSkipSequence,
98  kActionSkipSubSequence,
99  kActionRestartSequence,
100 };
101 
102 extern Graphics::PaletteLookup *g_paletteLookup;
103 
104 class PinkEngine : public Engine {
105 public:
106  PinkEngine(OSystem *system, const ADGameDescription *desc);
107  ~PinkEngine() override;
108 
109  Common::Error run() override;
110 
111  bool hasFeature(EngineFeature f) const override;
112 
113  Common::Error loadGameState(int slot) override;
114  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
115 
116  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
117  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
118  Common::String getSaveStateName(int slot) const override {
119  return Common::String::format("%s.s%02d", _targetName.c_str(), slot);
120  }
121  SaveStateList listSaves() const;
122 
123  friend class Console;
124 
125 protected:
126  void pauseEngineIntern(bool pause) override;
127 
128 public:
129  void load(Archive &archive);
130 
131  void changeScene();
132 
133  bool isPeril() const;
134  bool isPerilDemo() const;
135 
136  void setVariable(Common::String &variable, Common::String &value);
137  bool checkValueOfVariable(const Common::String &variable, const Common::String &value) const;
138 
139  void executeMenuCommand(uint id);
140  bool executePageChangeCommand(uint id);
141 
142  Common::Language getLanguage() const;
143  OrbFile *getOrb() { return &_orb; }
144  BroFile *getBro() { return _bro; }
145  Common::RandomSource &getRnd() { return _rnd; };
146  Screen *getScreen() { return _screen; }
147  PDAMgr &getPdaMgr() { return _pdaMgr; }
148 
149  void setNextExecutors(const Common::String &nextModule, const Common::String &nextPage) { _nextModule = nextModule; _nextPage = nextPage; }
150  void setLeadActor(LeadActor *actor) { _actor = actor; };
151  void setCursor(uint cursorIndex);
152 
153 private:
154  Common::Error init();
155 
156  void initMenu();
157 
158  bool loadCursors();
159 
160  void initModule(const Common::String &moduleName, const Common::String &pageName, Archive *saveFile);
161  void addModule(const Common::String &moduleName);
162  void removeModule();
163 
164  void openLocalWebPage(const Common::String &pageName) const;
165 
166 private:
169 
170  Common::String _nextModule;
171  Common::String _nextPage;
172 
173  Common::PEResources *_exeResources;
174 
175  OrbFile _orb;
176  BroFile *_bro;
177 
178  Graphics::MacMenu *_menu;
179  Screen *_screen;
180  LeadActor *_actor;
181 
182  Module *_module;
183  Array<NamedObject *> _modules;
184 
185  StringMap _variables;
186  PDAMgr _pdaMgr;
187 
188  const ADGameDescription *_desc;
189  bool _isPeril;
190  bool _isPerilDemo;
191 };
192 
193 WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
194 Common::String generateSaveName(int slot, const char *gameId);
195 
196 } // End of namespace Pink
197 
198 #endif
Definition: archive.h:39
Definition: str.h:59
Definition: winexe_pe.h:48
EngineFeature
Definition: engine.h:260
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: error.h:81
Definition: advancedDetector.h:164
Definition: random.h:44
Definition: console.h:31
Definition: palette.h:189
Definition: pink.h:104
Definition: atari-screen.h:58
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:42
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:118
Definition: utils.h:52
Definition: system.h:163
Definition: utils.h:30
Definition: engine.h:146
Language
Definition: language.h:45