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