ScummVM API documentation
object.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 ASYLUM_RESOURCES_OBJECT_H
23 #define ASYLUM_RESOURCES_OBJECT_H
24 
25 #include "common/rect.h"
26 #include "common/serializer.h"
27 #include "common/stream.h"
28 
29 #include "asylum/shared.h"
30 
31 #include "asylum/system/sound.h"
32 
33 namespace Asylum {
34 
35 class Actor;
36 class AsylumEngine;
37 
38 class Object : public Common::Serializable {
39 public:
40  Object(AsylumEngine *engine);
41  virtual ~Object() {};
42 
44  // Public variables & accessors
46  int16 x;
47  int16 y;
48  uint32 flags;
49  int32 actionType;
50 
51  void setFrameIndex(int32 index) { _frameIndex = index; }
52  void setPriority(int32 priority) { _priority = priority; }
53  void setSoundResourceId(ResourceId id) { _soundResourceId = id; }
54 
55  void setTransparency(int32 val) { _transparency = val; }
56  void setField6A4(ActorDirection val) { _field_6A4 = val; }
57 
58  Common::Rect *getBoundingRect() { return &_boundingRect; }
59  uint32 getFrameIndex() { return _frameIndex; }
60  uint32 getFrameCount() { return _frameCount; }
61  FrameSoundItem *getFrameSoundItem(uint32 index) { assert(index < ARRAYSIZE(_frameSoundItems)); return &_frameSoundItems[index]; }
62  ObjectId getId() { return _id; }
63  uint32 getPolygonIndex() { return _polygonIndex; }
64  int32 getPriority() { return _priority; }
65  ResourceId getResourceId() { return _resourceId; }
66  ResourceId getSoundResourceId() { return _soundResourceId; }
67 
68  Common::Rect *getRect() { return &_rect; }
69  int32 getScriptIndex() { return _scriptIndex; }
70  int32 getSoundY() { return _soundCoords.y; }
71  int32 getTransparency() { return _transparency; }
72  int32 getField688() { return _field_688; }
73  ActorDirection getField6A4() { return _field_6A4; }
74 
76  // Loading & disabling
78 
84  void load(Common::SeekableReadStream *stream);
85 
89  void disable();
90 
95 
97  // Visibility
99 
105  bool isOnScreen();
106 
112  void adjustCoordinates(Common::Point *point);
113 
115  // Drawing & update
117 
121  void draw();
122 
126  void update();
127 
133  void setNextFrame(uint32 flags);
134 
136  // Misc
138 
142  void stopSound();
143 
147  void stopAllSounds();
148 
154  bool checkFlags() const;
155 
156  char *getName() { return _name; }
164  Common::String toString(bool shortString = true);
165 
166  // Serializable
167  void saveLoadWithSerializer(Common::Serializer &s);
168 
169 private:
170  AsylumEngine *_vm;
171 
172  //int32 _index; ///< our index
173 
175  // Data
177  ObjectId _id;
178  ResourceId _resourceId;
179  // x, y
180  Common::Rect _boundingRect;
181  int32 _field_20;
182  uint32 _frameIndex;
183  uint32 _frameCount;
184  int32 _field_2C;
185  int32 _field_30;
186  int32 _field_34;
187  // flags
188  int32 _field_3C;
189  char _name[52];
190  Common::Rect _rect;
191  uint32 _polygonIndex;
192  // actionType
193  int32 _gameFlags[10];
194  int32 _field_B4;
195  uint32 _tickCount;
196  uint32 _tickCount2;
197  uint32 _field_C0;
198  int32 _priority;
199  int32 _scriptIndex;
200  SoundItem _soundItems[16];
201  FrameSoundItem _frameSoundItems[50];
202  int32 _transparency;
203  Common::Point _soundCoords;
204  int32 _field_688;
205  ResourceId _randomResourceIds[5];
206  ResourceId _soundResourceId;
207  ActorDirection _field_6A4;
208 
214  bool isVisible() const;
215 
219  void playSounds();
220 
225  void updateSoundItems();
226 
230  void setVolume();
231 
237  ResourceId getRandomResourceId();
238 
239 }; // end of class Object
240 
241 } // end of namespace Asylum
242 
243 #endif // ASYLUM_RESOURCES_OBJECT_H
#define ARRAYSIZE(x)
Definition: util.h:91
void setNextFrame(uint32 flags)
Definition: str.h:59
Common::String toString(bool shortString=true)
Definition: asylum.h:53
Definition: rect.h:144
bool checkFlags() const
Definition: stream.h:745
Definition: serializer.h:79
void adjustCoordinates(Common::Point *point)
void disableAndRemoveFromQueue()
void load(Common::SeekableReadStream *stream)
Definition: rect.h:45
Definition: asylum.h:73
Definition: serializer.h:308
Definition: sound.h:40
int16 y
Definition: rect.h:47
void stopAllSounds()
Definition: sound.h:54
Definition: object.h:38