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
49
50namespace Common {
51class SeekableReadStream;
52}
53
54namespace Graphics {
55class Font;
56}
57
58namespace Video {
59class VideoDecoder;
60}
61
62namespace Petka {
63
64class Console;
65class BigDialogue;
66class FileMgr;
67class SoundMgr;
68class QManager;
69class QSystem;
70class VideoSystem;
71
72enum {
73 kPetkaDebugGeneral = 1,
74 kPetkaDebugResources,
75 kPetkaDebugMessagingSystem,
76 kPetkaDebugDialogs,
77};
78
79enum {
80 GF_COMPRESSED = (1 << 0),
81};
82
83enum 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
100class PetkaEngine : public Engine {
101public:
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
152protected:
153 void pauseEngineIntern(bool pause) override;
154
155private:
156 void loadStores();
157
158private:
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
184class Console : public GUI::Debugger {
185public:
186 Console(PetkaEngine *vm) {}
187 virtual ~Console() {}
188};
189
190extern PetkaEngine *g_vm;
191
192WARN_UNUSED_RESULT bool readSaveHeader(Common::InSaveFile &in, SaveStateDescriptor &desc, bool skipThumbnail = true);
193Common::String generateSaveName(int slot, const char *gameId);
194
195} // End of namespace Petka
196
197#endif
Definition: error.h:81
Definition: random.h:44
PointerType get() const
Definition: ptr.h:637
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: debugger.h:41
Definition: font.h:83
Definition: system.h:166
Definition: big_dialogue.h:105
Definition: petka.h:184
Definition: petka.h:100
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
int getAutosaveSlot() const override
Definition: petka.h:147
void pauseEngineIntern(bool pause) override
bool hasFeature(EngineFeature f) const override
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override
Common::Error loadGameState(int slot) override
Common::Error run() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
void applyGameSettings() override
Definition: q_manager.h:41
Definition: q_system.h:50
Definition: sound.h:60
Definition: video.h:34
Definition: savestate.h:56
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: advancedDetector.h:164