ScummVM API documentation
node.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 MYST3_ROOM_H
23 #define MYST3_ROOM_H
24 
25 #include "engines/myst3/archive.h"
26 #include "engines/myst3/gfx.h"
27 
28 #include "common/array.h"
29 #include "common/rect.h"
30 
31 #include "graphics/surface.h"
32 
33 namespace Myst3 {
34 
35 class Texture;
36 class Myst3Engine;
37 class Subtitles;
38 class Effect;
39 
40 class Face {
41 public:
42  Graphics::Surface *_bitmap;
43  Graphics::Surface *_finalBitmap;
44  Texture *_texture;
45 
46  Face(Myst3Engine *vm, bool is3D = false);
47  ~Face();
48 
49  void setTextureFromJPEG(const ResourceDescription *jpegDesc);
50 
51  void addTextureDirtyRect(const Common::Rect &rect);
52  bool isTextureDirty() { return _textureDirty; }
53 
54  void uploadTexture();
55 
56 private:
57  bool _textureDirty;
58  Common::Rect _textureDirtyRect;
59 
60  Myst3Engine *_vm;
61  bool _is3D;
62 };
63 
64 class SpotItemFace {
65 public:
66  SpotItemFace(Face *face, uint16 posX, uint16 posY);
67  ~SpotItemFace();
68 
69  void initBlack(uint16 width, uint16 height);
70  void loadData(const ResourceDescription *jpegDesc);
71  void updateData(const Graphics::Surface *surface);
72  void clear();
73 
74  void draw();
75  void undraw();
76  void fadeDraw();
77 
78  bool isDrawn() { return _drawn; }
79  void setDrawn(bool drawn) { _drawn = drawn; }
80  uint16 getFadeValue() { return _fadeValue; }
81  void setFadeValue(uint16 value) { _fadeValue = value; }
82 
83  Common::Rect getFaceRect() const;
84 
85 private:
86  Face *_face;
87  bool _drawn;
88  uint16 _fadeValue;
89  uint16 _posX;
90  uint16 _posY;
91 
92  Graphics::Surface *_bitmap;
93  Graphics::Surface *_notDrawnBitmap;
94 
95  void initNotDrawn(uint16 width, uint16 height);
96 };
97 
98 class SpotItem {
99 public:
100  SpotItem(Myst3Engine *vm);
101  ~SpotItem();
102 
103  void setCondition(int16 condition) { _condition = condition; }
104  void setFade(bool fade) { _enableFade = fade; }
105  void setFadeVar(uint16 var) { _fadeVar = var; }
106  void addFace(SpotItemFace *face) { _faces.push_back(face); }
107 
108  void updateUndraw();
109  void updateDraw();
110 private:
111  Myst3Engine *_vm;
112 
113  int16 _condition;
114  uint16 _fadeVar;
115  bool _enableFade;
116 
118 };
119 
120 class SunSpot {
121 public:
122  uint16 pitch;
123  uint16 heading;
124  float intensity;
125  uint32 color;
126  uint16 var;
127  bool variableIntensity;
128  float radius;
129 };
130 
131 class Node : public Drawable {
132 public:
133  Node(Myst3Engine *vm, uint16 id);
134  ~Node() override;
135 
136  void initEffects();
137  void resetEffects();
138 
139  void update();
140  void drawOverlay() override;
141 
142  void loadSpotItem(uint16 id, int16 condition, bool fade);
143  SpotItemFace *loadMenuSpotItem(int16 condition, const Common::Rect &rect);
144 
145  void loadSubtitles(uint32 id);
146  bool hasSubtitlesToDraw();
147 
148 protected:
149  virtual bool isFaceVisible(uint faceId) = 0;
150 
151  Myst3Engine *_vm;
152  uint16 _id;
153  Face *_faces[6];
154  Common::Array<SpotItem *> _spotItems;
155  Subtitles *_subtitles;
156  Common::Array<Effect *> _effects;
157 };
158 
159 } // end of namespace Myst3
160 
161 #endif
Definition: node.h:120
Definition: surface.h:67
Definition: array.h:52
Definition: ambient.h:27
Definition: node.h:40
Definition: rect.h:144
Definition: node.h:64
Definition: gfx.h:93
Definition: node.h:131
Definition: node.h:98
Definition: gfx.h:36
Definition: myst3.h:87
Definition: archive.h:105
Definition: subtitles.h:34