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 // Based on Phantasma code by Thomas Harte (2013),
23 // available at https://github.com/TomHarte/Phantasma/ (MIT)
24 
25 #ifndef FREESCAPE_OBJECT_H
26 #define FREESCAPE_OBJECT_H
27 
28 #include "math/aabb.h"
29 
30 #include "freescape/gfx.h"
31 
32 namespace Freescape {
33 
34 enum ObjectType {
35  kEntranceType = 0,
36  kCubeType = 1,
37  kSensorType = 2,
38  kRectangleType = 3,
39 
40  kEastPyramidType = 4,
41  kWestPyramidType = 5,
42  kUpPyramidType = 6,
43  kDownPyramidType = 7,
44  kNorthPyramidType = 8,
45  kSouthPyramidType = 9,
46 
47  kLineType = 10,
48  kTriangleType = 11,
49  kQuadrilateralType = 12,
50  kPentagonType = 13,
51  kHexagonType = 14,
52 
53  kGroupType = 15
54 };
55 
56 class Object {
57 public:
58  virtual ObjectType getType() { return _type; }
59  uint16 getObjectID() { return _objectID; }
60  uint16 getObjectFlags() { return _flags; }
61  void setObjectFlags(uint32 flags_) { _flags = flags_; }
62  Math::Vector3d getOrigin() { return _origin; }
63  virtual void setOrigin(Math::Vector3d origin_) { _origin = origin_; };
64  Math::Vector3d getSize() { return _size; }
65 
66  virtual bool isDrawable() { return false; }
67  virtual bool isPlanar() { return false; }
68  virtual void scale(int factor) = 0;
69 
70  bool isInvisible() { return _flags & 0x40; }
71  void makeInvisible() { _flags = _flags | 0x40; }
72  void makeVisible() { _flags = _flags & ~0x40; }
73  bool isInitiallyInvisible() { return _flags & 0x80; }
74  void makeInitiallyInvisible() { _flags = _flags | 0x80; }
75  void makeInitiallyVisible() { _flags = _flags & ~0x80; }
76  bool isDestroyed() { return _flags & 0x20; }
77  void destroy() { _flags = _flags | 0x20; }
78  void restore() { _flags = _flags & ~0x20; }
79  void toggleVisibility() { _flags = _flags ^ 0x40; }
80 
81  virtual ~Object() {}
82  virtual Object *duplicate() = 0;
83 
84  virtual void draw(Freescape::Renderer *gfx, float offset = 0.0) = 0;
85 
86  uint16 _flags;
87  ObjectType _type;
88  uint16 _objectID;
89  Math::Vector3d _origin, _size, _rotation;
90  Math::AABB _boundingBox;
91  Object *_partOfGroup = nullptr;
92 };
93 
94 } // End of namespace Freescape
95 
96 #endif // FREESCAPE_OBJECT_H
Definition: area.h:36
Definition: gfx.h:60
Definition: object.h:56