ScummVM API documentation
petka.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 PETKA_PETKA_H
23 #define PETKA_PETKA_H
24 
25 #include "common/random.h"
26 #include "common/stream.h"
27 #include "common/memstream.h"
28 #include "common/savefile.h"
29 
30 #include "engines/engine.h"
31 #include "engines/savestate.h"
32 
33 #include "gui/debugger.h"
34 
35 #include "graphics/surface.h"
36 
37 /*
38  * This is the namespace of the Petka engine.
39  *
40  * Status of this engine: In Development
41  *
42  * Games using this engine:
43  * - Red Comrades Demo
44  * - Red Comrades Save the Galaxy - Fully playable
45  * - Red Comrades 2: For the Great Justice - Fully playable
46  */
47 
48 struct ADGameDescription;
49 
50 namespace Common {
51 class SeekableReadStream;
52 }
53 
54 namespace Graphics {
55 class Font;
56 }
57 
58 namespace Video {
59 class VideoDecoder;
60 }
61 
62 namespace Petka {
63 
64 class Console;
65 class BigDialogue;
66 class FileMgr;
67 class SoundMgr;
68 class QManager;
69 class QSystem;
70 class VideoSystem;
71 
72 enum {
73  kPetkaDebugGeneral = 1,
74  kPetkaDebugResources,
75  kPetkaDebugMessagingSystem,
76  kPetkaDebugDialogs,
77 };
78 
79 enum {
80  GF_COMPRESSED = (1 << 0),
81 };
82 
83 enum PETKAActions {
84  kActionNone,
85  kActionCursorLook,
86  kActionCursorWalk,
87  kActionCursorTake,
88  kActionCursorUse,
89  kActionCursorTalk,
90  kActionCursorChapayev,
91  kActionInventory,
92  kActionMap,
93  kActionOptions,
94  kActionPrevInterface,
95  kActionSave,
96  kActionLoad,
97  kActionSkip,
98 };
99 
100 class PetkaEngine : public Engine {
101 public:
102  PetkaEngine(OSystem *syst, const ADGameDescription *desc);
103  ~PetkaEngine() override;
104 
105  bool isDemo() const;
106  bool isPetka2() const;
107 
108  void loadPart(byte part);
109  void loadPartAtNextFrame(byte part);
110 
111  byte getPart();
112  int getSaveSlot();
113 
114  void loadChapter(byte chapter);
115 
116  Common::Error run() override;
117 
118  bool hasFeature(EngineFeature f) const override;
119 
120  void applyGameSettings() override;
121 
122  Common::SeekableReadStream *openFile(const Common::String &name, bool addCurrentPath);
123  Common::SeekableReadStream *openIniFile(const Common::String &name);
124 
125  void playVideo(Common::SeekableReadStream *stream);
126  QSystem *getQSystem() const;
127  BigDialogue *getBigDialogue() const;
128  SoundMgr *soundMgr() const;
129  QManager *resMgr() const;
130 
131  VideoSystem *videoSystem() const;
132 
133  Common::RandomSource &getRnd();
134  const Common::String &getSpeechPath();
135 
136  Graphics::Font *getTextFont() const { return _textFont.get(); }
137  Graphics::Font *getDescriptionFont() const { return _descriptionFont.get(); }
138 
139  void pushMouseMoveEvent();
140 
141  Common::Error loadGameState(int slot) override;
142  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
143 
144  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
145  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
146 
147  int getAutosaveSlot() const override { return - 1;}
148 
149  const ADGameDescription *const _desc;
151 
152 protected:
153  void pauseEngineIntern(bool pause) override;
154 
155 private:
156  void loadStores();
157 
158 private:
162  Common::ScopedPtr<SoundMgr> _soundMgr;
168  Common::ScopedPtr<Graphics::Font> _descriptionFont;
169 
171 
172  Common::String _currentPath;
173  Common::String _speechPath;
174 
175  Common::String _chapterStoreName;
176 
177  uint8 _part;
178  uint8 _nextPart;
179  uint8 _chapter;
180  bool _shouldChangePart;
181  int _saveSlot;
182 };
183 
184 class Console : public GUI::Debugger {
185 public:
186  Console(PetkaEngine *vm) {}
187  virtual ~Console() {}
188 };
189 
190 extern PetkaEngine *g_vm;
191 
192 WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
193 Common::String generateSaveName(int slot, const char *gameId);
194 
195 } // End of namespace Petka
196 
197 #endif
Definition: str.h:59
Definition: font.h:83
EngineFeature
Definition: engine.h:258
Definition: error.h:81
int getAutosaveSlot() const override
Definition: petka.h:147
Definition: advancedDetector.h:164
Definition: debugger.h:41
Definition: random.h:44
Definition: q_manager.h:41
Definition: stream.h:745
Definition: big_dialogue.h:105
Definition: savestate.h:56
Definition: ustr.h:57
Definition: sound.h:60
Definition: algorithm.h:29
Definition: formatinfo.h:28
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: video.h:33
Definition: petka.h:100
Definition: petka.h:184
Definition: system.h:163
Definition: avi_frames.h:36
Definition: q_system.h:50
Definition: base.h:27
Definition: engine.h:144