xoreos  0.0.5
placeable.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_PLACEABLE_H
26 #define ENGINES_NWN_PLACEABLE_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace NWN {
35 
36 class Placeable : public Situated {
37 public:
39  enum State {
41  kStateOpen = 1,
46  };
47 
49  Placeable(const Aurora::GFF3Struct &placeable);
50  ~Placeable();
51 
52  // Basic visuals
53 
54  void show();
55  void hide();
56 
57  // Basic properties
58 
60  bool isOpen() const;
62  bool isActivated() const;
63 
65  bool open(Object *opener);
67  bool close(Object *closer);
68 
70  bool activate(Object *opener);
72  bool deactivate(Object *closer);
73 
74  // Object/Cursor interactions
75 
76  void enter();
77  void leave();
78 
80  void highlight(bool enabled);
81 
83  bool click(Object *triggerer = 0);
84 
85  // Animation
86 
88  void playAnimation(const Common::UString &animation = "", bool restart = true,
89  float length = 0.0f, float speed = 1.0f);
91  void playAnimation(Animation animation, bool restart = true,
92  float length = 0.0f, float speed = 1.0f);
93 
94 protected:
96  void loadObject(const Aurora::GFF3Struct &gff);
98  void loadAppearance();
99 
100 private:
102 
104 
106  void load(const Aurora::GFF3Struct &placeable);
107 
109  void setModelState();
110 
111  const Common::UString &getAnimationSound(Animation animation);
112 };
113 
114 } // End of namespace NWN
115 
116 } // End of namespace Engines
117 
118 #endif // ENGINES_NWN_PLACEABLE_H
A class holding an UTF-8 string.
Definition: ustring.h:48
void load(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:51
void setModelState()
Sync the model&#39;s state with the placeable&#39;s state.
Definition: placeable.cpp:61
const Common::UString & getAnimationSound(Animation animation)
Definition: placeable.cpp:257
State _state
The current state of the placeable.
Definition: placeable.h:101
bool isOpen() const
Is the placeable open?
Definition: placeable.cpp:142
bool activate(Object *opener)
The user object activates this placeable.
Definition: placeable.cpp:217
void leave()
The cursor left the placeable.
Definition: placeable.cpp:128
State
The state of a placeable.
Definition: placeable.h:39
bool click(Object *triggerer=0)
The placeable was clicked.
Definition: placeable.cpp:150
Placeable(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:42
void hide()
Hide the placeable&#39;s model.
Definition: placeable.cpp:103
void loadObject(const Aurora::GFF3Struct &gff)
Load placeable-specific properties.
Definition: placeable.cpp:109
bool deactivate(Object *closer)
The user object deactivates this placeable.
Definition: placeable.cpp:237
void highlight(bool enabled)
(Un)Highlight the placeable.
Definition: placeable.cpp:132
void enter()
The cursor entered the placeable.
Definition: placeable.cpp:124
void show()
Show the placeable&#39;s model.
Definition: placeable.cpp:97
void loadAppearance()
Load appearance-specific properties.
Definition: placeable.cpp:117
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
void playAnimation(const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f)
Play a placeable animation.
Definition: placeable.cpp:278
A struct within a GFF3.
Definition: gff3file.h:164
A situated object in a Neverwinter Nights area.
bool open(Object *opener)
The opener object opens this placeable.
Definition: placeable.cpp:178
bool _hasInventory
Does this placeable have an inventory?
Definition: placeable.h:103
bool isActivated() const
Is the placeable activated?
Definition: placeable.cpp:146
bool close(Object *closer)
The closer object closes this placeable.
Definition: placeable.cpp:200