xoreos  0.0.5
situated.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_NWN_SITUATED_H
26 #define ENGINES_NWN_SITUATED_H
27 
28 #include "src/common/scopedptr.h"
29 
30 #include "src/aurora/types.h"
31 
33 
34 #include "src/engines/nwn/object.h"
35 
36 namespace Engines {
37 
38 namespace NWN {
39 
40 class Situated : public Object {
41 public:
42  ~Situated();
43 
44  // Basic visuals
45 
46  void loadModel();
47  void unloadModel();
48 
49  void show();
50  void hide();
51 
52  // Basic properties
53 
55  virtual bool isOpen() const = 0;
56 
57  bool isLocked() const;
58  virtual void setLocked(bool locked);
59 
61  Object *getLastOpenedBy() const;
63  Object *getLastClosedBy() const;
65  Object *getLastUsedBy () const;
66 
67  // Positioning
68 
70  void setPosition(float x, float y, float z);
72  void setOrientation(float x, float y, float z, float angle);
73 
74 protected:
76 
79 
80  bool _locked;
81 
87 
91 
93 
94 
95  Situated(ObjectType type);
96 
98  void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint = 0);
99 
101  virtual void loadObject(const Aurora::GFF3Struct &gff) = 0;
103  virtual void loadAppearance() = 0;
104 
105 
106 private:
107  void loadProperties(const Aurora::GFF3Struct &gff);
108  void loadPortrait(const Aurora::GFF3Struct &gff);
109  void loadSounds();
110 
112  bool createTooltip(Tooltip::Type type);
113 };
114 
115 } // End of namespace NWN
116 
117 } // End of namespace Engines
118 
119 #endif // ENGINES_NWN_SITUATED_H
virtual void loadAppearance()=0
Load appearance-specific properties.
virtual void setLocked(bool locked)
Lock/Unlock the situated object.
Definition: situated.cpp:125
A class holding an UTF-8 string.
Definition: ustring.h:48
Object * getLastClosedBy() const
Return the object that last closed this situated object.
Definition: situated.cpp:133
Situated(ObjectType type)
Definition: situated.cpp:44
bool _locked
Is the situated object locked?
Definition: situated.h:80
Object * getLastOpenedBy() const
Return the object that last opened this situated object.
Definition: situated.cpp:129
void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint=0)
Load the situated object from an instance and its blueprint.
Definition: situated.cpp:141
Common::UString _soundClosed
The sound the object makes when closed.
Definition: situated.h:83
Common::ScopedPtr< Graphics::Aurora::Model > _model
The situated object&#39;s model.
Definition: situated.h:92
A simple scoped smart pointer template.
virtual bool isOpen() const =0
Is the situated object open?
void loadProperties(const Aurora::GFF3Struct &gff)
Definition: situated.cpp:178
Basic Aurora graphics types.
Common::UString _soundOpened
The sound the object makes when opened.
Definition: situated.h:82
void unloadModel()
Unload the situated object&#39;s model.
Definition: situated.cpp:85
void setPosition(float x, float y, float z)
Set the situated object&#39;s position.
Definition: situated.cpp:105
Common::UString _soundLocked
The sound the object makes when locked.
Definition: situated.h:86
Common::UString _soundDestroyed
The sound the object makes when destroyed.
Definition: situated.h:84
Object * _lastClosedBy
The object that last closed this situated object.
Definition: situated.h:89
uint32 _appearanceID
The index within the situated appearance 2DA.
Definition: situated.h:77
uint32 _soundAppType
The index within the situated sounds 2DA.
Definition: situated.h:78
void setOrientation(float x, float y, float z, float angle)
Set the situated object&#39;s orientation.
Definition: situated.cpp:113
Object * _lastUsedBy
The object that last used this situated object.
Definition: situated.h:90
void loadPortrait(const Aurora::GFF3Struct &gff)
Definition: situated.cpp:210
ObjectType
Object type, matches the bitfield in nwscript.nss.
Definition: types.h:36
An object in a Neverwinter Nights area.
Object * getLastUsedBy() const
Return the object that last used this situated object.
Definition: situated.cpp:137
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
Object * _lastOpenedBy
The object that last opened this situated object.
Definition: situated.h:88
virtual void loadObject(const Aurora::GFF3Struct &gff)=0
Load object-specific properties.
A struct within a GFF3.
Definition: gff3file.h:164
bool isLocked() const
Is the situated object locked?
Definition: situated.cpp:121
uint32_t uint32
Definition: types.h:204
void loadModel()
Load the situated object&#39;s model.
Definition: situated.cpp:53
bool createTooltip(Tooltip::Type type)
Create an empty tooltip.
Definition: situated.cpp:236
Common::UString _soundUsed
The sound the object makes when used.
Definition: situated.h:85
void show()
Show the situated object&#39;s model.
Definition: situated.cpp:93
void hide()
Hide the situated object&#39;s model.
Definition: situated.cpp:98
Common::UString _modelName
The model&#39;s resource name.
Definition: situated.h:75