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/dialogs.h"
27 #include "mads/game.h"
28 #include "mads/msurface.h"
29 
30 namespace MADS {
31 
32 class MADSEngine;
33 
34 class MenuView: public FullScreenDialog {
35 protected:
36  bool _breakFlag;
37  bool _redrawFlag;
38  Common::Path _filename;
39 
40  virtual void doFrame() = 0;
41 
42  void display() override;
43 
47  bool onEvent(Common::Event &event) override;
48 public:
49  MenuView(MADSEngine *vm);
50 
51  ~MenuView() override {}
52 
53  virtual void show();
54 
55  Common::String getResourceName();
56 };
57 
58 struct TextLine {
59  Common::Point _pos;
60  Common::String _line;
61  int _textDisplayIndex;
62 };
63 
67 class TextView : public MenuView {
68 private:
69  static char _resourceName[100];
70 
71  bool _animating;
72  Common::Array<TextLine> _textLines;
73  Common::Point _pan;
74  int _panSpeed;
75  MSurface _spareScreens[4];
76  int _scrollCount;
77  int _lineY;
78  uint32 _scrollTimeout;
79  int _panCountdown;
80  int _translationX;
81  Common::File _script;
82  char _currentLine[80];
83  MSurface *_spareScreen;
84  Font *_font;
85 private:
89  void load();
90 
94  void processLines();
95 
99  void processCommand();
100 
104  void processText();
105 
109  int getParameter(const char **paramP);
110 
114  void resetPalette();
115 protected:
116  void display() override;
117 
118  void doFrame() override;
119 
123  virtual void scriptDone();
124 public:
128  static void execute(MADSEngine *vm, const Common::Path &resName);
129 
130  TextView(MADSEngine *vm);
131 
132  ~TextView() override;
133 };
134 
135 enum ResyncMode { NEVER, ALWAYS, BEGINNING };
136 
138  Common::Path _resourceName;
139  int _fx;
140  bool _soundFlag;
141  bool _bgFlag;
142  bool _showWhiteBars;
143 
144  ResourceEntry() {}
145  ResourceEntry(const Common::Path &resName, int fx, bool soundFlag,
146  bool bgFlag, bool showWhiteBars) {
147  _resourceName = resName;
148  _fx = fx;
149  _soundFlag = soundFlag;
150  _bgFlag = bgFlag;
151  _showWhiteBars = showWhiteBars;
152  }
153 };
154 
156  int _id;
157  int _v;
158  Common::String _resourceName;
159 
160  ResIndexEntry() {}
161 };
162 
166 class AnimationView : public MenuView {
167 private:
168  static char _resourceName[100];
169 
170  Common::File _script;
171  uint32 _previousUpdate;
172  Common::String _currentLine;
173  bool _soundDriverLoaded;
174  bool _resetPalette;
175  ResyncMode _resyncMode;
176  int _sfx;
177  bool _soundFlag;
178  bool _bgLoadFlag;
179  bool _showWhiteBars;
180  Common::Array<ResourceEntry> _resources;
182  int _v1;
183  int _v2;
184  int _resourceIndex;
185  SceneInfo *_sceneInfo;
186  Animation *_currentAnimation;
187  int _manualFrameNumber;
188  SpriteAsset *_manualSpriteSet;
189  int _manualStartFrame, _manualEndFrame;
190  int _manualFrame2;
191  int _animFrameNumber;
192  bool _nextCyclingActive;
193 private:
194  void checkResource(const Common::String &resourceName);
195 
196  int scanResourceIndex(const Common::String &resourceName);
197 
198  uint _scrollFrameCtr;
199 private:
200  void load();
201 
202  void processLines();
203 
204  void processCommand();
205 
206  int getParameter();
207 
208  void loadNextResource();
209 
210  void scroll();
211 protected:
212  void display() override;
213 
214  void doFrame() override;
215 
216  bool onEvent(Common::Event &event) override;
217 
218  virtual void scriptDone();
219 public:
223  static void execute(MADSEngine *vm, const Common::Path &resName);
224 
226 
227  ~AnimationView() override;
228 };
229 
230 } // End of namespace MADS
231 
232 #endif /* MADS_MENU_VIEWS_H */
Definition: str.h:59
Definition: menu_views.h:67
Definition: array.h:52
Definition: path.h:52
void display() override
Definition: file.h:47
Definition: menu_views.h:137
Definition: events.h:199
Definition: rect.h:45
Definition: scene_data.h:141
Definition: mads.h:87
Definition: font.h:47
Definition: assets.h:61
bool onEvent(Common::Event &event) override
Definition: menu_views.h:34
Definition: menu_views.h:155
Definition: action.h:28
Definition: menu_views.h:58
Definition: menu_views.h:166
Definition: msurface.h:172
Definition: animation.h:140
Definition: dialogs.h:261