ScummVM API documentation
scumm_v7.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 SCUMM_SCRIPT_V7_H
23#define SCUMM_SCRIPT_V7_H
24
25#ifdef ENABLE_SCUMM_7_8
26
27#include "scumm/scumm_v6.h"
28#include "scumm/charset_v7.h"
29#include "scumm/insane/insane.h"
30
31namespace Scumm {
32
33class Insane;
34#ifdef ENABLE_REBEL2_PSX
35class Rebel2PSX;
36#endif
37class SmushMixer;
38class SmushPlayer;
39class TextRenderer_v7;
40
41class ScummEngine_v7 : public ScummEngine_v6 {
42 friend class SmushPlayer;
43 friend class Insane;
44 friend class InsaneRebel1;
45 friend class InsaneRebel2;
46#ifdef ENABLE_REBEL2_PSX
47 friend class Rebel2PSX;
48#endif
49public:
50 ScummEngine_v7(OSystem *syst, const DetectorResult &dr);
51 ~ScummEngine_v7() override;
52
53
54protected:
55 int _smushFrameRate = 0;
56
61 bool _smushVideoShouldFinish = false;
62
63 bool _smushActive = false;
64
65 Insane *_insane = nullptr;
66#ifdef ENABLE_REBEL2_PSX
67 Rebel2PSX *_rebel2PSX = nullptr;
68#endif
69
70public:
71 void syncSoundSettings() override;
72
73 SmushMixer *_smixer;
74 SmushPlayer *_splayer;
75
76
77 struct LangIndexNode {
78 char tag[12+1];
79 int32 offset;
80 };
81
82protected:
83 TextRenderer_v7 *_textV7;
84 Common::Rect _defaultTextClipRect;
85 Common::Rect _wrappedTextClipRect;
86 bool _newTextRenderStyle = false;
87 int _blastTextRectsQueue = 0;
88
89 int _verbLineSpacing = 0;
90 bool _existLanguageFile = false;
91 char *_languageBuffer = nullptr;
92 LangIndexNode *_languageIndex;
93 int _languageIndexSize = 0;
94 char _lastStringTag[12+1] = {};
95
96 struct SubtitleText : TextObject {
97 void clear() {
98 TextObject::clear();
99 actorSpeechMsg = center = wrap = false;
100 }
101 bool actorSpeechMsg;
102 bool center;
103 bool wrap;
104 };
105
106 friend void syncWithSerializer(Common::Serializer &, SubtitleText &);
107
108 int _subtitleQueuePos;
109 SubtitleText _subtitleQueue[20];
110
111public:
112 void processSubtitleQueue();
113 void addSubtitleToQueue(const byte *text, const Common::Point &pos, byte color, byte charset, bool center, bool wrap);
114 void clearSubtitleQueue();
115 void displayDialog() override;
116 bool isSmushActive() override { return _smushActive; }
117 bool isInsaneActive() override { return _insane ? _insane->isInsaneActive() : false; }
118 Insane *getInsane() { return _insane; }
119#ifdef ENABLE_REBEL2_PSX
120 Rebel2PSX *getRebel2PSX() { return _rebel2PSX; }
121#endif
122 void removeBlastTexts() override;
123 void restoreBlastTextsRects();
124
125protected:
126
127 void scummLoop_handleSound() override;
128 void scummLoop_handleDrawing() override;
129 void processInput() override;
130 void processKeyboard(Common::KeyState lastKeyHit) override;
131
132 void setupScumm(const Common::Path &macResourceFile) override;
133 void resetScumm() override;
134
135 void setupScummVars() override;
136 void resetScummVars() override;
137
138 void akos_processQueue() override;
139
140 void saveLoadWithSerializer(Common::Serializer &s) override;
141
142 void readMAXS(int blockSize) override;
143 void readGlobalObjects() override;
144 void readIndexBlock(uint32 blocktype, uint32 itemsize) override;
145
146 void setCameraAt(int pos_x, int pos_y) override;
147 void setCameraFollows(Actor *a, bool setCamera = false) override;
148 void moveCamera() override;
149 void panCameraTo(int x, int y) override;
150
151 int getObjectIdFromOBIM(const byte *obim) override;
152
153 void createTextRenderer(GlyphRenderer_v7 *gr) override;
154 void enqueueText(const byte *text, int x, int y, byte color, byte charset, TextStyleFlags flags, bool ttsVoiceText = true, bool ttsIsSubtitle = false);
155 void drawTextImmediately(const byte *text, Common::Rect *clipRect, int x, int y, byte color, byte charset, TextStyleFlags flags);
156 void drawBlastTexts() override;
157 void showMessageDialog(const byte *msg) override;
158
159 void actorTalk(const byte *msg) override;
160 void translateText(const byte *text, byte *trans_buff, int transBufferSize) override;
161 void loadLanguageBundle() override;
162 void playSpeech(const byte *ptr);
163
164 void queryQuit(bool returnToLauncher) override;
165 int getBannerColor(int bannerId) override;
166 const char *getGUIString(int stringId) override;
167 int getGUIStringHeight(const char *str) override;
168 int getGUIStringWidth(const char *str) override;
169 void drawGUIText(const char *buttonString, Common::Rect *clipRect, int textXPos, int textYPos, int textColor, bool centerFlag) override;
170 int getMusicVolume() override;
171 int getSpeechVolume() override;
172 int getSFXVolume() override;
173 void setMusicVolume(int volume) override;
174 void setSpeechVolume(int volume) override;
175 void setSFXVolume(int volume) override;
176 void toggleVoiceMode() override;
177 void handleLoadDuringSmush() override;
178
179 void setDefaultCursor() override;
180 void updateCursor() override;
181 void setCursorTransparency(int a) override;
182 void setCursorFromImg(uint img, uint room, uint imgindex) override;
183
184 void drawVerb(int verb, int mode, Common::TextToSpeechManager::Action ttsAction = Common::TextToSpeechManager::INTERRUPT) override;
185
186 void pauseEngineIntern(bool pause) override;
187
188 void o6_kernelSetFunctions() override;
189
190 struct BlastText : TextObject {
191 Common::Rect rect;
192 TextStyleFlags flags;
193#ifdef USE_TTS
194 bool voiceText;
195 bool isSubtitle;
196#endif
197
198 void clear() {
199 this->TextObject::clear();
200 rect = Common::Rect();
201#ifdef USE_TTS
202 voiceText = true;
203 isSubtitle = false;
204#endif
205 }
206 };
207
208 int _blastTextQueuePos;
209 BlastText _blastTextQueue[50];
210
211 byte *_guiStringTransBuff = nullptr;
212};
213
214
215} // End of namespace Scumm
216
217#endif // ENABLE_SCUMM_7_8
218
219#endif
Definition: path.h:52
Definition: serializer.h:80
Definition: system.h:166
Definition: actor.h:30
Definition: keyboard.h:294
Definition: rect.h:144
Definition: rect.h:536