ScummVM API documentation
menu_views.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 MADS_MENU_VIEWS_H
23 #define MADS_MENU_VIEWS_H
24 
25 #include "common/scummsys.h"
26 #include "mads/nebular/core/dialogs.h"
27 #include "mads/nebular/core/game.h"
28 #include "mads/nebular/core/msurface.h"
29 
30 namespace MADS {
31 namespace Nebular {
32 
33 class RexNebularEngine;
34 
35 class MenuView : public FullScreenDialog {
36 protected:
37  bool _breakFlag;
38  bool _redrawFlag;
39  Common::Path _filename;
40 
41  virtual void doFrame() = 0;
42 
43  void display() override;
44 
48  bool onEvent(Common::Event &event) override;
49 public:
51 
52  ~MenuView() override {
53  }
54 
55  virtual void show();
56 
57  Common::String getResourceName();
58 };
59 
60 struct TextLine {
61  Common::Point _pos;
62  Common::String _line;
63  int _textDisplayIndex;
64 };
65 
69 class TextView : public MenuView {
70 private:
71  static char _resourceName[100];
72 
73  bool _animating;
74  Common::Array<TextLine> _textLines;
75  Common::Point _pan;
76  int _panSpeed;
77  MSurface _spareScreens[4];
78  int _scrollCount;
79  int _lineY;
80  uint32 _scrollTimeout;
81  int _panCountdown;
82  int _translationX;
83  Common::File _script;
84  char _currentLine[80];
85  MSurface *_spareScreen;
86  Font *_font;
87 private:
91  void load();
92 
96  void processLines();
97 
101  void processCommand();
102 
106  void processText();
107 
111  int getParameter(const char **paramP);
112 
116  void resetPalette();
117 protected:
118  void display() override;
119 
120  void doFrame() override;
121 
125  virtual void scriptDone();
126 public:
130  static void execute(RexNebularEngine *vm, const Common::Path &resName);
131 
133 
134  ~TextView() override;
135 };
136 
137 enum ResyncMode {
138  NEVER, ALWAYS, BEGINNING
139 };
140 
142  Common::Path _resourceName;
143  int _fx;
144  bool _soundFlag;
145  bool _bgFlag;
146  bool _showWhiteBars;
147 
148  ResourceEntry() {
149  }
150  ResourceEntry(const Common::Path &resName, int fx, bool soundFlag,
151  bool bgFlag, bool showWhiteBars) {
152  _resourceName = resName;
153  _fx = fx;
154  _soundFlag = soundFlag;
155  _bgFlag = bgFlag;
156  _showWhiteBars = showWhiteBars;
157  }
158 };
159 
161  int _id;
162  int _v;
163  Common::String _resourceName;
164 
165  ResIndexEntry() {
166  }
167 };
168 
172 class AnimationView : public MenuView {
173 private:
174  static char _resourceName[100];
175 
176  Common::File _script;
177  uint32 _previousUpdate;
178  Common::String _currentLine;
179  bool _soundDriverLoaded;
180  bool _resetPalette;
181  ResyncMode _resyncMode;
182  int _sfx;
183  bool _soundFlag;
184  bool _bgLoadFlag;
185  bool _showWhiteBars;
186  Common::Array<ResourceEntry> _resources;
188  int _v1;
189  int _v2;
190  int _resourceIndex;
191  SceneInfo *_sceneInfo;
192  Animation *_currentAnimation;
193  int _manualFrameNumber;
194  SpriteAsset *_manualSpriteSet;
195  int _manualStartFrame, _manualEndFrame;
196  int _manualFrame2;
197  int _animFrameNumber;
198  bool _nextCyclingActive;
199 private:
200  void checkResource(const Common::String &resourceName);
201 
202  int scanResourceIndex(const Common::String &resourceName);
203 
204  uint _scrollFrameCtr;
205 private:
206  void load();
207 
208  void processLines();
209 
210  void processCommand();
211 
212  int getParameter();
213 
214  void loadNextResource();
215 
216  void scroll();
217 protected:
218  void display() override;
219 
220  void doFrame() override;
221 
222  bool onEvent(Common::Event &event) override;
223 
224  virtual void scriptDone();
225 public:
229  static void execute(RexNebularEngine *vm, const Common::Path &resName);
230 
232 
233  ~AnimationView() override;
234 };
235 
236 } // namespace Nebular
237 } // namespace MADS
238 
239 #endif
Definition: str.h:59
Definition: nebular.h:51
Definition: menu_views.h:172
Definition: array.h:52
Definition: path.h:52
bool onEvent(Common::Event &event) override
Definition: menu_views.h:69
Definition: animation.h:141
Definition: menu_views.h:160
Definition: font.h:48
Definition: menu_views.h:141
Definition: file.h:47
Definition: events.h:210
Definition: rect.h:144
void display() override
Definition: menu_views.h:35
Definition: assets.h:63
Definition: mps_installer.h:31
Definition: menu_views.h:60
Definition: scene_data.h:149
Definition: dialogs.h:268
Definition: msurface.h:188