xoreos  0.0.5
door.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_DOOR_H
26 #define ENGINES_NWN_DOOR_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace NWN {
35 
36 class Module;
37 
38 class Waypoint;
39 
40 class Door : public Situated {
41 public:
43  enum State {
48  };
49 
51  Door(Module &module, const Aurora::GFF3Struct &door);
52  ~Door();
53 
54  // Basic visuals
55 
56  void show();
57  void hide();
58 
59  // Basic properties
60 
62  bool isOpen() const;
63 
65  bool open(Object *opener);
67  bool close(Object *closer);
68 
70  void setLocked(bool locked);
71 
72  // Object/Cursor interactions
73 
74  void enter();
75  void leave();
76 
78  void highlight(bool enabled);
79 
81  bool click(Object *triggerer = 0);
82 
83  // Animation
84 
86  void playAnimation(const Common::UString &animation = "", bool restart = true,
87  float length = 0.0f, float speed = 1.0f);
89  void playAnimation(Animation animation, bool restart = true,
90  float length = 0.0f, float speed = 1.0f);
91 
92 protected:
94  void loadObject(const Aurora::GFF3Struct &gff);
96  void loadAppearance();
97 
98 private:
99  enum LinkedToFlag {
103  };
104 
106 
107  bool _invisible;
108 
110 
112 
115 
120 
122  void load(const Aurora::GFF3Struct &door);
123 
125  void loadAppearance(const Aurora::TwoDAFile &twoda, uint32 id);
126 
128  void setModelState();
130  void evaluateLink();
131 
132  const Common::UString &getAnimationSound(Animation animation);
133 };
134 
135 } // End of namespace NWN
136 
137 } // End of namespace Engines
138 
139 #endif // ENGINES_NWN_DOOR_H
LinkedToFlag _linkedToFlag
Does this door link to anything?
Definition: door.h:113
Class to hold the two-dimensional array of a 2DA file.
Definition: 2dafile.h:124
Door(Module &module, const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:45
This door links to a waypoint.
Definition: door.h:102
This door links to nothing.
Definition: door.h:100
A class holding an UTF-8 string.
Definition: ustring.h:48
Object * _link
The object this door links to.
Definition: door.h:117
Opened in one direction (normally clock-wise).
Definition: door.h:45
void hide()
Hide the door&#39;s model.
Definition: door.cpp:147
const Common::UString & getAnimationSound(Animation animation)
Definition: door.cpp:277
void setModelState()
Sync the model&#39;s state with the door&#39;s state.
Definition: door.cpp:113
uint32 _genericType
Index into the generic door types.
Definition: door.h:109
Waypoint * _linkedWaypoint
The waypoint this door links to.
Definition: door.h:119
This door links to another door.
Definition: door.h:101
void highlight(bool enabled)
(Un)Highlight the door.
Definition: door.cpp:168
State _state
The current state of the door.
Definition: door.h:111
Opened in the other direction (normally counter-clock-wise).
Definition: door.h:46
void evaluateLink()
Evaluate our link.
Definition: door.cpp:261
void setLocked(bool locked)
Lock/Unlock the door.
Definition: door.cpp:173
bool open(Object *opener)
The opener object opens this door.
Definition: door.cpp:208
Module * _module
The module the door is in.
Definition: door.h:105
bool isOpen() const
Is the door open?
Definition: door.cpp:257
void enter()
The cursor entered the door.
Definition: door.cpp:153
bool close(Object *closer)
The closer object closes this door.
Definition: door.cpp:235
void show()
Show the door&#39;s model.
Definition: door.cpp:141
Door * _linkedDoor
The door this door links to.
Definition: door.h:118
bool _invisible
Is the door invisible?
Definition: door.h:107
void leave()
The cursor left the door.
Definition: door.cpp:163
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
bool _evaluatedLink
Have we already tried to evaluate our link?
Definition: door.h:116
A struct within a GFF3.
Definition: gff3file.h:164
uint32_t uint32
Definition: types.h:204
void playAnimation(const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f)
Play a door animation.
Definition: door.cpp:300
Common::UString _linkedTo
The object tag this door links to.
Definition: door.h:114
void loadAppearance()
Load appearance-specific properties.
Definition: door.cpp:83
A situated object in a Neverwinter Nights area.
bool click(Object *triggerer=0)
The door was clicked.
Definition: door.cpp:184
State
The state of a door.
Definition: door.h:43
void load(const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:56
void loadObject(const Aurora::GFF3Struct &gff)
Load door-specific properties.
Definition: door.cpp:68