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 << 0,
74  kPetkaDebugResources = 1 << 1,
75  kPetkaDebugMessagingSystem = 1 << 2,
76  kPetkaDebugDialogs = 1 << 3
77 };
78 
79 enum {
80  GF_COMPRESSED = (1 << 0),
81 };
82 
83 class PetkaEngine : public Engine {
84 public:
85  PetkaEngine(OSystem *syst, const ADGameDescription *desc);
86  ~PetkaEngine() override;
87 
88  bool isDemo() const;
89  bool isPetka2() const;
90 
91  void loadPart(byte part);
92  void loadPartAtNextFrame(byte part);
93 
94  byte getPart();
95  int getSaveSlot();
96 
97  void loadChapter(byte chapter);
98 
99  Common::Error run() override;
100 
101  bool hasFeature(EngineFeature f) const override;
102 
103  void applyGameSettings() override;
104 
105  Common::SeekableReadStream *openFile(const Common::String &name, bool addCurrentPath);
106  Common::SeekableReadStream *openIniFile(const Common::String &name);
107 
108  void playVideo(Common::SeekableReadStream *stream);
109  QSystem *getQSystem() const;
110  BigDialogue *getBigDialogue() const;
111  SoundMgr *soundMgr() const;
112  QManager *resMgr() const;
113 
114  VideoSystem *videoSystem() const;
115 
116  Common::RandomSource &getRnd();
117  const Common::String &getSpeechPath();
118 
119  Graphics::Font *getTextFont() const { return _textFont.get(); }
120  Graphics::Font *getDescriptionFont() const { return _descriptionFont.get(); }
121 
122  void pushMouseMoveEvent();
123 
124  Common::Error loadGameState(int slot) override;
125  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
126 
127  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
128  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
129 
130  int getAutosaveSlot() const override { return - 1;}
131 
132  const ADGameDescription *const _desc;
134 
135 protected:
136  void pauseEngineIntern(bool pause) override;
137 
138 private:
139  void loadStores();
140 
141 private:
145  Common::ScopedPtr<SoundMgr> _soundMgr;
151  Common::ScopedPtr<Graphics::Font> _descriptionFont;
152 
154 
155  Common::String _currentPath;
156  Common::String _speechPath;
157 
158  Common::String _chapterStoreName;
159 
160  uint8 _part;
161  uint8 _nextPart;
162  uint8 _chapter;
163  bool _shouldChangePart;
164  int _saveSlot;
165 };
166 
167 class Console : public GUI::Debugger {
168 public:
169  Console(PetkaEngine *vm) {}
170  virtual ~Console() {}
171 };
172 
173 extern PetkaEngine *g_vm;
174 
175 WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
176 Common::String generateSaveName(int slot, const char *gameId);
177 
178 } // End of namespace Petka
179 
180 #endif
Definition: str.h:59
Definition: font.h:82
EngineFeature
Definition: engine.h:250
Definition: error.h:84
int getAutosaveSlot() const override
Definition: petka.h:130
Definition: advancedDetector.h:163
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:83
Definition: petka.h:167
Definition: system.h:161
Definition: avi_frames.h:36
Definition: q_system.h:50
Definition: base.h:27
Definition: engine.h:143