ScummVM API documentation
screen.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_SCREEN_H
23 #define MADS_SCREEN_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "mads/nebular/core/msurface.h"
28 #include "mads/nebular/core/action.h"
29 
30 namespace MADS {
31 namespace Nebular {
32 
33 #define MADS_SCREEN_WIDTH 320
34 #define MADS_SCREEN_HEIGHT 200
35 
36 enum ScreenMode {
37  SCREENMODE_VGA = 19
38 };
39 
40 enum ScreenTransition {
41  kTransitionNone = 0,
42  kTransitionFadeIn, kTransitionFadeOutIn,
43  kTransitionBoxInBottomLeft, kTransitionBoxInBottomRight,
44  kTransitionBoxInTopLeft, kTransitionBoxInTopRight,
45  kTransitionPanLeftToRight, kTransitionPanRightToLeft,
46  kTransitionCircleIn1, kTransitionCircleIn2,
47  kTransitionCircleIn3, kTransitionCircleIn4,
48  kVertTransition1, kVertTransition2, kVertTransition3,
49  kVertTransition4, kVertTransition5, kVertTransition6,
50  kVertTransition7, kNullPaletteCopy
51 };
52 
53 enum InputMode {
54  kInputBuildingSentences = 0, // Normal sentence building
55  kInputConversation = 1, // Conversation mode
56  kInputLimitedSentences = 2 // Use only scene hotspots
57 };
58 
59 enum ThroughBlack {
60  THROUGH_BLACK1 = 1,
61  THROUGH_BLACK2 = 2
62 };
63 
64 class RexNebularEngine;
65 class SpriteSlot;
66 class TextDisplay;
67 class UISlot;
68 
69 class DirtyArea {
70 private:
71  static RexNebularEngine *_vm;
72  friend class DirtyAreas;
73 public:
74  Common::Rect _bounds;
75  bool _textActive;
76  bool _active;
77  DirtyArea *_mergedArea;
78 
79  DirtyArea();
80 
81  void setArea(int width, int height, int maxWidth, int maxHeight);
82 
86  void setSpriteSlot(const SpriteSlot *spriteSlot);
87 
91  void setTextDisplay(const TextDisplay *textDisplay);
92 
96  void setUISlot(const UISlot *slot);
97 };
98 
99 class DirtyAreas : public Common::Array<DirtyArea> {
100  //private:
101  // RexNebularEngine *_vm;
102 public:
104 
110  void merge(int startIndex, int count);
111 
112  bool intersects(int idx1, int idx2);
113  void mergeAreas(int idx1, int idx2);
114 
121  void copy(BaseSurface *srcSurface, BaseSurface *destSurface, const Common::Point &posAdjust);
122 
127  void copyToScreen();
128 
129  void reset();
130 };
131 
133 public:
134  bool _active;
135  Common::Rect _bounds;
136  ScrCategory _category;
137  int _descId;
138  int _mode;
139 
140  ScreenObject();
141 };
142 
143 class ScreenObjects : public Common::Array<ScreenObject> {
144 private:
145  RexNebularEngine *_vm;
146  int _objectY;
147 
148  int scanBackwards(const Common::Point &pt, int layer);
149 public:
150  InputMode _inputMode;
151  int _v7FED6;
152  int _v8332A;
153  int _forceRescan;
154  int _selectedObject;
155  ScrCategory _category;
156  bool _released;
157  int _uiCount;
158  bool _eventFlag;
159  uint32 _baseTime;
160  int _spotId;
161 
162  /*
163  * Constructor
164  */
166 
170  ScreenObject *add(const Common::Rect &bounds, ScreenMode mode, ScrCategory category, int descId);
171 
175  void check(bool scanFlag);
176 
180  int scan(const Common::Point &pt, int layer);
181 
185  void elementHighlighted();
186 
192  assert(idx > 0);
194  }
195 
202  void setActive(ScrCategory category, int descId, bool active);
203 
207  void synchronize(Common::Serializer &s);
208 };
209 
210 class Screen : public BaseSurface {
211 private:
212  uint16 _random;
213  MSurface _rawSurface;
214 
215  void panTransition(MSurface &newScreen, byte *palData, int entrySide,
216  const Common::Point &srcPos, const Common::Point &destPos,
217  ThroughBlack throughBlack, bool setPalette, int numTicks);
218 
219  void swapForeground(byte newPalette[PALETTE_SIZE], byte *paletteMap);
220 
221  void swapPalette(const byte palData[PALETTE_SIZE], byte swapTable[PALETTE_COUNT], bool foreground);
222 public:
223  int _shakeCountdown;
224 public:
228  Screen();
229 
233  ~Screen() override {
234  }
235 
239  void update() override;
240 
244  void transition(ScreenTransition transitionType, bool surfaceFlag);
245 
249  void setClipBounds(const Common::Rect &r);
250 
254  void resetClipBounds();
255 
259  const Common::Rect getClipBounds() const {
260  const Common::Point pt = getOffsetFromOwner();
261  return Common::Rect(pt.x, pt.y, pt.x + this->w, pt.y + this->h);
262  }
263 };
264 
265 } // namespace Nebular
266 } // namespace MADS
267 
268 #endif
Definition: screen.h:210
Definition: nebular.h:51
~Screen() override
Definition: screen.h:233
Definition: array.h:52
const Common::Rect getClipBounds() const
Definition: screen.h:259
Definition: messages.h:137
T & operator[](size_type idx)
Definition: array.h:274
Definition: screen.h:69
Definition: rect.h:524
Definition: screen.h:143
void setUISlot(const UISlot *slot)
Definition: screen.h:99
Definition: serializer.h:80
void setSpriteSlot(const SpriteSlot *spriteSlot)
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
Definition: msurface.h:56
Definition: sprites.h:134
T y
Definition: rect.h:49
T x
Definition: rect.h:48
Definition: rect.h:144
void setTextDisplay(const TextDisplay *textDisplay)
ScreenObject & operator[](int idx)
Definition: screen.h:191
Definition: sound_manager.h:38
Definition: screen.h:132
Definition: msurface.h:188
Definition: user_interface.h:49