xoreos  0.0.5
object.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_JADE_OBJECT_H
26 #define ENGINES_JADE_OBJECT_H
27 
28 #include <list>
29 
30 #include "src/common/types.h"
31 #include "src/common/ustring.h"
32 
34 
35 #include "src/engines/jade/types.h"
37 
39 
40 namespace Aurora {
41 
42 class GFF3Struct;
43 
44 }
45 
46 namespace Engines {
47 
48 namespace Jade {
49 
50 class Area;
51 
54 public:
56  virtual ~Object();
57 
59  ObjectType getType() const;
60 
61  // Basic visuals
62 
63  virtual void loadModel();
64  virtual void unloadModel();
65 
66  virtual void show();
67  virtual void hide();
68 
70  const std::list<uint32> &getIDs() const;
71 
72  // Basic properties
73 
75  const Common::UString &getName() const;
77  const Common::UString &getDescription() const;
78 
80  const Common::UString &getConversation() const;
81 
82  // Object/Object interactions
83 
88 
89  // Interactive properties
90 
91  bool isStatic() const;
92  bool isUsable() const;
93  bool isActive() const;
94 
95  bool isNoCollide() const;
96  void setNoCollide(bool noCollide);
97 
98  bool isClickable() const;
99 
101  Area *getArea() const;
103  void setArea(Area *);
104 
105  // Positioning
106 
108  virtual void getPosition(float &x, float &y, float &z) const;
110  virtual void getOrientation(float &x, float &y, float &z, float &angle) const;
111 
113  virtual void setPosition(float x, float y, float z);
115  virtual void setOrientation(float x, float y, float z, float angle);
116 
118  Location getLocation() const;
119 
120  // Object/Cursor interactions
121 
122  virtual void enter();
123  virtual void leave();
124 
126  virtual void highlight(bool enabled);
127 
129  virtual bool click(Object *triggerer = 0);
130 
132  Object *getLastTriggerer() const;
133 
134  // Object (text) talking
135 
137  void speakString(int32 resref);
138 
139  // Animation
140 
142  virtual void playAnimation(const Common::UString &animation = "", bool restart = true, int32 loopCount = 0);
144  virtual void playAnimation(Animation animation);
145 
146 protected:
148 
151 
153 
154  bool _static;
155  bool _usable;
156  bool _active;
157 
158  bool _noCollide;
159 
160  std::list<uint32> _ids;
161 
163 
165 
167 
168  float _position[3];
169  float _orientation[4];
170 
172  void loadPositional(const Aurora::GFF3Struct &gff);
173 };
174 
175 } // End of namespace Jade
176 
177 } // End of namespace Engines
178 
179 #endif // ENGINES_JADE_OBJECT_H
float _orientation[4]
The object&#39;s orientation.
Definition: object.h:169
virtual void highlight(bool enabled)
(Un)Highlight the object.
Definition: object.cpp:175
Common::UString _description
The object&#39;s description.
Definition: object.h:150
Common::UString _conversation
The object&#39;s default conversation.
Definition: object.h:152
Location getLocation() const
Create a Location out of the object&#39;s area, position and orientation.
Definition: object.cpp:130
bool isNoCollide() const
Is collision checking disabled?
Definition: object.cpp:98
An object containing scripts.
Area * getArea() const
Return the area this object is currently in.
Definition: object.cpp:122
A class holding an UTF-8 string.
Definition: ustring.h:48
virtual void show()
Show the object&#39;s model(s).
Definition: object.cpp:68
void loadPositional(const Aurora::GFF3Struct &gff)
Load the object&#39;s positional gff struct which contains the position and orientation.
Definition: object.cpp:212
virtual void setPosition(float x, float y, float z)
Set the object&#39;s position within its area.
Definition: object.cpp:156
const Common::UString & getDescription() const
Return the object&#39;s description.
Definition: object.cpp:78
virtual void playAnimation(const Common::UString &animation="", bool restart=true, int32 loopCount=0)
Play an object animation.
Definition: object.cpp:201
Area * _area
The area the object is currently in.
Definition: object.h:164
Aurora::NWScript::Object * getPCSpeaker() const
Return the PC currently speaking with this object.
Definition: object.cpp:114
void setNoCollide(bool noCollide)
Enable or disable collision checking.
Definition: object.cpp:102
bool isClickable() const
Can the player click the object?
Definition: object.cpp:106
const Common::UString & getConversation() const
Return the object&#39;s default conversation (DLG).
Definition: object.cpp:82
virtual ~Object()
Definition: object.cpp:54
virtual void enter()
The cursor entered the object.
Definition: object.cpp:169
float _position[3]
The object&#39;s position.
Definition: object.h:168
bool _static
Is the object static?
Definition: object.h:154
bool isUsable() const
Can the object be used by the PC?
Definition: object.cpp:90
Basic Jade Empire type definitions.
bool _usable
Is the object usable?
Definition: object.h:155
An area in Jade Empire, holding all objects and rooms within, as well as general area properties like...
Definition: area.h:57
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object&#39;s orientation.
Definition: object.cpp:148
void speakString(int32 resref)
Speak the specified string.
Definition: object.cpp:195
bool _active
Is the object currently active/available/visible?
Definition: object.h:156
Low-level type definitions to handle fixed width types portably.
virtual bool click(Object *triggerer=0)
The object was clicked.
Definition: object.cpp:178
void setPCSpeaker(Aurora::NWScript::Object *pc)
Set the PC currently speaking with this object.
Definition: object.cpp:118
virtual void getPosition(float &x, float &y, float &z) const
Return the object&#39;s position within its area.
Definition: object.cpp:142
bool isStatic() const
Is the object static (not manipulable at all)?
Definition: object.cpp:86
Object * getLastTriggerer() const
Return the object that last triggered this object.
Definition: object.cpp:191
An object within a Jade area.
Definition: object.h:53
std::list< uint32 > _ids
The object&#39;s model IDs.
Definition: object.h:160
Unicode string handling.
A location within a Jade Empire area.
An NWScript object.
A struct within a GFF3.
Definition: gff3file.h:164
bool isActive() const
Is the object currently active/available/visible?
Definition: object.cpp:94
virtual void hide()
Hide the object&#39;s model(s).
Definition: object.cpp:71
virtual void loadModel()
Load the object&#39;s model(s).
Definition: object.cpp:62
bool _noCollide
Is collision checking for the object disabled?
Definition: object.h:158
void setArea(Area *)
Set the area this object is currently in.
Definition: object.cpp:126
virtual void leave()
The cursor left the object.
Definition: object.cpp:172
virtual void unloadModel()
Unload the object&#39;s model(s).
Definition: object.cpp:65
Common::UString _name
The object&#39;s display name.
Definition: object.h:149
const std::list< uint32 > & getIDs() const
Return the object&#39;s model IDs.
Definition: object.cpp:110
ObjectType getType() const
Return the exact type of the object.
Definition: object.cpp:58
Object * _lastTriggerer
The object that last used this object.
Definition: object.h:166
const Common::UString & getName() const
Return the object&#39;s name.
Definition: object.cpp:74
virtual void setOrientation(float x, float y, float z, float angle)
Set the object&#39;s orientation.
Definition: object.cpp:162
Aurora::NWScript::Object * _pcSpeaker
The current PC speaking with the object.
Definition: object.h:162
ObjectType _type
The object&#39;s type.
Definition: object.h:147
int32_t int32
Definition: types.h:203