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_KOTOR_SITUATED_H
26 #define ENGINES_KOTOR_SITUATED_H
27 
28 #include "glm/vec3.hpp"
29 
30 #include "src/common/scopedptr.h"
31 
32 #include "src/aurora/types.h"
33 
35 
38 
39 namespace Engines {
40 
41 namespace KotOR {
42 
43 class Situated : public Object {
44 public:
45  ~Situated();
46 
47  // Basic visuals
48 
49  void show();
50  void hide();
51  bool isVisible() const;
52 
53  // Basic properties
54 
56  virtual bool isOpen() const = 0;
57 
58  bool isLocked() const;
59  virtual void setLocked(bool locked);
60 
62  Object *getLastOpenedBy() const;
64  Object *getLastClosedBy() const;
66  Object *getLastUsedBy () const;
67 
69  const Common::UString &getConversation() const;
70 
71  // Positioning
72 
74  void setPosition(float x, float y, float z);
76  void setOrientation(float x, float y, float z, float angle);
77 
78  // Walkmesh
79 
80  virtual bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const;
81  void setWalkmeshInvisible(bool invisible);
82 
83  void playAnimation(const Common::UString &anim,
84  bool restart = true,
85  float length = 0.0f,
86  float speed = 1.0f);
87 
88 protected:
90 
93 
94  bool _locked;
95 
101 
103 
107 
109 
111 
112 
113  Situated(ObjectType type);
114 
116  void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint = 0);
117 
119  virtual void loadObject(const Aurora::GFF3Struct &gff) = 0;
121  virtual void loadAppearance() = 0;
122 
123 
124 private:
125  void loadProperties(const Aurora::GFF3Struct &gff);
126  void loadPortrait(const Aurora::GFF3Struct &gff);
127  void loadSounds();
128 };
129 
130 } // End of namespace KotOR
131 
132 } // End of namespace Engines
133 
134 #endif // ENGINES_KOTOR_SITUATED_H
void show()
Show the situated object&#39;s model.
Definition: situated.cpp:52
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Definition: situated.cpp:92
void loadProperties(const Aurora::GFF3Struct &gff)
Definition: situated.cpp:177
Common::UString _soundDestroyed
The sound the object makes when destroyed.
Definition: situated.h:98
A class holding an UTF-8 string.
Definition: ustring.h:48
void setWalkmeshInvisible(bool invisible)
Definition: situated.cpp:88
virtual void loadObject(const Aurora::GFF3Struct &gff)=0
Load object-specific properties.
virtual bool isOpen() const =0
Is the situated object open?
ObjectType
Object type, matches the bitfield in nwscript.nss.
Definition: types.h:33
Common::UString _conversation
The optional conversation with this situated object.
Definition: situated.h:102
Object * _lastClosedBy
The object that last closed this situated object.
Definition: situated.h:105
A simple scoped smart pointer template.
Object * getLastUsedBy() const
Return the object that last used this situated object.
Definition: situated.cpp:113
Common::UString _modelName
The model&#39;s resource name.
Definition: situated.h:89
Basic Aurora graphics types.
Situated(ObjectType type)
Definition: situated.cpp:43
const Common::UString & getConversation() const
Get the conversation for this object.
Definition: situated.cpp:117
void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint=0)
Load the situated object from an instance and its blueprint.
Definition: situated.cpp:121
Common::UString _soundOpened
The sound the object makes when opened.
Definition: situated.h:96
uint32 _appearanceID
The index within the situated appearance 2DA.
Definition: situated.h:91
Object * _lastUsedBy
The object that last used this situated object.
Definition: situated.h:106
Object * _lastOpenedBy
The object that last opened this situated object.
Definition: situated.h:104
bool isVisible() const
Is the situated object&#39;s model visible?
Definition: situated.cpp:64
virtual void setLocked(bool locked)
Lock/Unlock the situated object.
Definition: situated.cpp:101
virtual bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
Definition: situated.cpp:84
Common::UString _soundUsed
The sound the object makes when used.
Definition: situated.h:99
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
void hide()
Hide the situated object&#39;s model.
Definition: situated.cpp:58
A struct within a GFF3.
Definition: gff3file.h:164
void setPosition(float x, float y, float z)
Set the situated object&#39;s position.
Definition: situated.cpp:68
KotOR walkmesh (BWM).
uint32_t uint32
Definition: types.h:204
void loadPortrait(const Aurora::GFF3Struct &gff)
Definition: situated.cpp:209
virtual void loadAppearance()=0
Load appearance-specific properties.
Object * getLastClosedBy() const
Return the object that last closed this situated object.
Definition: situated.cpp:109
An object in a Star Wars: Knights of the Old Republic area.
Object * getLastOpenedBy() const
Return the object that last opened this situated object.
Definition: situated.cpp:105
bool _locked
Is the situated object locked?
Definition: situated.h:94
Common::ScopedPtr< Graphics::Aurora::Model > _model
The situated object&#39;s model.
Definition: situated.h:108
void setOrientation(float x, float y, float z, float angle)
Set the situated object&#39;s orientation.
Definition: situated.cpp:76
Common::UString _soundLocked
The sound the object makes when locked.
Definition: situated.h:100
uint32 _soundAppType
The index within the situated sounds 2DA.
Definition: situated.h:92
Common::UString _soundClosed
The sound the object makes when closed.
Definition: situated.h:97
bool isLocked() const
Is the situated object locked?
Definition: situated.cpp:97