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_DRAGONAGE2_OBJECT_H
26 #define ENGINES_DRAGONAGE2_OBJECT_H
27 
28 #include <list>
29 
30 #include "src/common/types.h"
31 #include "src/common/ustring.h"
32 
33 #include "src/aurora/types.h"
34 #include "src/aurora/locstring.h"
35 
37 
39 
41 
42 namespace Engines {
43 
44 namespace DragonAge2 {
45 
47 public:
49  virtual ~Object();
50 
52  ObjectType getType() const;
53 
54  // Basic visuals
55 
56  virtual void show();
57  virtual void hide();
58 
60  const std::list<uint32> &getIDs() const;
61 
62  // Basic properties
63 
65  const Common::UString &getResRef() const;
66 
68  const Aurora::LocString &getName() const;
70  const Aurora::LocString &getDescription() const;
71 
73  const Common::UString &getConversation() const;
74 
79  const Common::UString &getNonLocalizedName() const;
81  void setNonLocalizedName(const Common::UString &name);
82 
83  // Interactive properties
84 
85  bool isStatic() const;
86  bool isUsable() const;
87 
88  bool isClickable() const;
89 
90  // Positioning
91 
93  virtual void getPosition(float &x, float &y, float &z) const;
95  virtual void getOrientation(float &x, float &y, float &z, float &angle) const;
96 
98  virtual void setPosition(float x, float y, float z);
100  virtual void setOrientation(float x, float y, float z, float angle);
101 
102  // Object/Cursor interactions
103 
104  virtual void enter();
105  virtual void leave();
106 
108  virtual void highlight(bool enabled);
109 
111  virtual bool click(Object *triggerer = 0);
112 
113 
114 protected:
116 
118 
121 
123 
125 
127 
128  bool _static;
129  bool _usable;
130 
131  std::list<uint32> _ids;
132 
133  float _position[3];
134  float _orientation[4];
135 
136 
137  void syncPosition();
138  void syncOrientation();
139 
140  void readVarTable(const Aurora::GFF3List &varTable);
141  void readVarTable(const Aurora::GFF3Struct &gff);
142  void readVarTable(const Aurora::GFF4List &varTable);
143  void readVarTable(const Aurora::GFF4Struct &gff);
144 };
145 
146 } // End of namespace DragonAge2
147 
148 } // End of namespace Engines
149 
150 #endif // ENGINES_DRAGONAGE2_OBJECT_H
virtual void show()
Show the object&#39;s model(s).
Definition: object.cpp:74
bool _usable
Is the object usable?
Definition: object.h:129
bool isUsable() const
Can the object be used by the PC?
Definition: object.cpp:112
A class holding an UTF-8 string.
Definition: ustring.h:48
A localized string.
Definition: locstring.h:43
virtual void enter()
The cursor entered the object.
Definition: object.cpp:161
virtual void setOrientation(float x, float y, float z, float angle)
Set the object&#39;s orientation.
Definition: object.cpp:140
const Aurora::LocString & getDescription() const
Return the object&#39;s description.
Definition: object.cpp:92
virtual void setPosition(float x, float y, float z)
Set the object&#39;s position within its area.
Definition: object.cpp:134
Common::UString _soundSet
The object&#39;s sound set.
Definition: object.h:126
An object containing scripts.
bool isClickable() const
Can the player click the object?
Definition: object.cpp:116
Common::UString _resRef
The object&#39;s resource reference.
Definition: object.h:117
bool _static
Is the object static?
Definition: object.h:128
ObjectType getType() const
Return the exact type of the object.
Definition: object.cpp:70
Common::UString _conversation
The object&#39;s default conversation.
Definition: object.h:124
float _orientation[4]
The object&#39;s orientation.
Definition: object.h:134
const Common::UString & getConversation() const
Return the object&#39;s default conversation (DLG).
Definition: object.cpp:104
std::vector< const GFF4Struct * > GFF4List
Definition: types.h:453
void setNonLocalizedName(const Common::UString &name)
Set the object&#39;s non-localized name.
Definition: object.cpp:100
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object&#39;s orientation.
Definition: object.cpp:126
const std::list< uint32 > & getIDs() const
Return the object&#39;s model IDs.
Definition: object.cpp:80
Low-level type definitions to handle fixed width types portably.
virtual void hide()
Hide the object&#39;s model(s).
Definition: object.cpp:77
Handling BioWare&#39;s localized strings.
virtual void highlight(bool enabled)
(Un)Highlight the object.
Definition: object.cpp:167
std::vector< const GFF3Struct * > GFF3List
Definition: types.h:449
Unicode string handling.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
An NWScript object.
ObjectType
Object type, matches the bitfield in script.ldf.
Definition: types.h:60
const Common::UString & getNonLocalizedName() const
Return the object&#39;s non-localized name.
Definition: object.cpp:96
Common::UString _nonLocalizedName
The object&#39;s non-localized name.
Definition: object.h:122
A struct within a GFF3.
Definition: gff3file.h:164
ObjectType _type
The object&#39;s type.
Definition: object.h:115
const Common::UString & getResRef() const
Return the object&#39;s resource reference.
Definition: object.cpp:84
virtual void getPosition(float &x, float &y, float &z) const
Return the object&#39;s position within its area.
Definition: object.cpp:120
Aurora::LocString _name
The object&#39;s display name.
Definition: object.h:119
virtual void leave()
The cursor left the object.
Definition: object.cpp:164
Aurora::LocString _description
The object&#39;s description.
Definition: object.h:120
virtual bool click(Object *triggerer=0)
The object was clicked.
Definition: object.cpp:170
Basic Dragon Age II type definitions.
const Aurora::LocString & getName() const
Return the object&#39;s name.
Definition: object.cpp:88
float _position[3]
The object&#39;s position.
Definition: object.h:133
void readVarTable(const Aurora::GFF3List &varTable)
std::list< uint32 > _ids
The object&#39;s model IDs.
Definition: object.h:131
bool isStatic() const
Is the object static (not manipulable at all)?
Definition: object.cpp:108