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_WITCHER_OBJECT_H
26 #define ENGINES_WITCHER_OBJECT_H
27 
28 #include <list>
29 
30 #include "src/common/types.h"
31 #include "src/common/ustring.h"
32 
33 #include "src/aurora/locstring.h"
34 
36 
37 #include "src/sound/types.h"
38 
41 
43 
44 namespace Engines {
45 
46 namespace Witcher {
47 
48 class Area;
49 
52 public:
54  virtual ~Object();
55 
57  ObjectType getType() const;
58 
60  virtual void refreshLocalized();
61 
62  // Basic visuals
63 
64  virtual void loadModel();
65  virtual void unloadModel();
66 
67  virtual void show();
68  virtual void hide();
69 
71  const std::list<uint32> &getIDs() const;
72 
73  // Basic properties
74 
76  const Common::UString &getUniqueID() const;
77 
79  const Aurora::LocString &getName() const;
81  const Aurora::LocString &getDescription() const;
82 
84  const Common::UString &getConversation() const;
85 
86  // Interactive properties
87 
88  bool isStatic() const;
89  bool isUsable() const;
90 
91  bool isClickable() const;
92 
93  // Object/Object interactions
94 
96  Area *getArea() const;
98  void setArea(Area *);
99 
100  // Positioning
101 
103  virtual void getPosition(float &x, float &y, float &z) const;
105  virtual void getOrientation(float &x, float &y, float &z, float &angle) const;
106 
108  virtual void setPosition(float x, float y, float z);
110  virtual void setOrientation(float x, float y, float z, float angle);
111 
113  Location getLocation() const;
114 
115  // Object/Cursor interactions
116 
117  virtual void enter();
118  virtual void leave();
119 
121  virtual void highlight(bool enabled);
122 
124  virtual bool click(Object *triggerer = 0);
125 
126  // Object (text) talking
127 
129  void speakString(const Common::UString &string, uint32 volume);
131  void speakOneLiner(Common::UString conv, Object *tokenTarget = 0);
132 
133  // Sound
134 
136  void stopSound();
138  void playSound(const Common::UString &sound, bool pitchVariance = false);
139 
140 
141 protected:
143 
145 
148 
150 
151  bool _static;
152  bool _usable;
153 
154  std::list<uint32> _ids;
155 
157 
158  float _position[3];
159  float _orientation[4];
160 
162 };
163 
164 } // End of namespace Witcher
165 
166 } // End of namespace Engines
167 
168 #endif // ENGINES_WITCHER_OBJECT_H
ObjectType getType() const
Return the exact type of the object.
Definition: object.cpp:61
void stopSound()
Stop the current object sound.
Definition: object.cpp:203
Area * getArea() const
Return the area this object is currently in.
Definition: object.cpp:112
An area in The Witcher, holding all objects and area geometry within, as well as general area propert...
Definition: area.h:63
virtual void setPosition(float x, float y, float z)
Set the object&#39;s position within its area.
Definition: object.cpp:146
const Common::UString & getConversation() const
Return the object&#39;s default conversation (DLG).
Definition: object.cpp:89
A class holding an UTF-8 string.
Definition: ustring.h:48
void playSound(const Common::UString &sound, bool pitchVariance=false)
Play an object sound.
Definition: object.cpp:207
An object within a Witcher area.
Definition: object.h:51
A localized string.
Definition: locstring.h:43
void setArea(Area *)
Set the area this object is currently in.
Definition: object.cpp:116
virtual void hide()
Hide the object&#39;s model(s).
Definition: object.cpp:74
Basic sound types.
Basic The Witcher type definitions.
virtual void getPosition(float &x, float &y, float &z) const
Return the object&#39;s position within its area.
Definition: object.cpp:132
virtual bool click(Object *triggerer=0)
The object was clicked.
Definition: object.cpp:215
bool isClickable() const
Can the player click the object?
Definition: object.cpp:104
virtual void unloadModel()
Unload the object&#39;s model(s).
Definition: object.cpp:68
Sound::ChannelHandle _sound
The currently playing object sound.
Definition: object.h:161
const std::list< uint32 > & getIDs() const
Return the object&#39;s model IDs.
Definition: object.cpp:108
An object containing scripts.
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object&#39;s orientation.
Definition: object.cpp:138
virtual void show()
Show the object&#39;s model(s).
Definition: object.cpp:71
Aurora::LocString _description
The object&#39;s description.
Definition: object.h:147
bool isUsable() const
Can the object be used by the PC?
Definition: object.cpp:100
const Aurora::LocString & getName() const
Return the object&#39;s name.
Definition: object.cpp:81
Common::UString _uniqueID
A globally unique ID.
Definition: object.h:144
virtual void highlight(bool enabled)
(Un)Highlight the object.
Definition: object.cpp:165
Low-level type definitions to handle fixed width types portably.
ObjectType _type
The object&#39;s type.
Definition: object.h:142
bool _static
Is the object static?
Definition: object.h:151
Handling BioWare&#39;s localized strings.
virtual void refreshLocalized()
Refresh all localized strings.
Definition: object.cpp:93
bool _usable
Is the object usable?
Definition: object.h:152
Unicode string handling.
virtual void enter()
The cursor entered the object.
Definition: object.cpp:159
virtual void setOrientation(float x, float y, float z, float angle)
Set the object&#39;s orientation.
Definition: object.cpp:152
An NWScript object.
void speakOneLiner(Common::UString conv, Object *tokenTarget=0)
Speak an one-liner from the specified conversation file.
Definition: object.cpp:174
float _position[3]
The object&#39;s position.
Definition: object.h:158
A handle to a sound channel.
Definition: types.h:35
uint32_t uint32
Definition: types.h:204
float _orientation[4]
The object&#39;s orientation.
Definition: object.h:159
Common::UString _conversation
The object&#39;s default conversation.
Definition: object.h:149
bool isStatic() const
Is the object static (not manipulable at all)?
Definition: object.cpp:96
Area * _area
The area the object is currently in.
Definition: object.h:156
Aurora::LocString _name
The object&#39;s name.
Definition: object.h:146
Location getLocation() const
Create a Location out of the object&#39;s area, position and orientation.
Definition: object.cpp:120
A location within a The Witcher area.
const Common::UString & getUniqueID() const
Return the object&#39;s globally unique ID.
Definition: object.cpp:77
virtual void leave()
The cursor left the object.
Definition: object.cpp:162
virtual void loadModel()
Load the object&#39;s model(s).
Definition: object.cpp:65
std::list< uint32 > _ids
The object&#39;s model IDs.
Definition: object.h:154
const Aurora::LocString & getDescription() const
Return the object&#39;s description.
Definition: object.cpp:85
void speakString(const Common::UString &string, uint32 volume)
Speak the specified string.
Definition: object.cpp:168