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_NWN2_DOOR_H
26 #define ENGINES_NWN2_DOOR_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace NWN2 {
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 protected:
85  void loadObject(const Aurora::GFF3Struct &gff);
87  void loadAppearance();
88 
89 private:
90  enum LinkedToFlag {
94  };
95 
97 
98  bool _invisible;
99 
101 
103 
106 
111 
113  void load(const Aurora::GFF3Struct &door);
114 
116  void loadAppearance(const Aurora::TwoDAFile &twoda, uint32 id);
117 
119  void setModelState();
121  void evaluateLink();
122 };
123 
124 } // End of namespace NWN2
125 
126 } // End of namespace Engines
127 
128 #endif // ENGINES_NWN2_DOOR_H
Class to hold the two-dimensional array of a 2DA file.
Definition: 2dafile.h:124
This door links to nothing.
Definition: door.h:91
bool _evaluatedLink
Have we already tried to evaluate our link?
Definition: door.h:107
A class holding an UTF-8 string.
Definition: ustring.h:48
void setLocked(bool locked)
Lock/Unlock the door.
Definition: door.cpp:164
Opened in one direction (normally clock-wise).
Definition: door.h:45
Common::UString _linkedTo
The object tag this door links to.
Definition: door.h:105
void highlight(bool enabled)
(Un)Highlight the door.
Definition: door.cpp:159
This door links to another door.
Definition: door.h:92
Waypoint * _linkedWaypoint
The waypoint this door links to.
Definition: door.h:110
bool isOpen() const
Is the door open?
Definition: door.cpp:250
void leave()
The cursor left the door.
Definition: door.cpp:155
Opened in the other direction (normally counter-clock-wise).
Definition: door.h:46
An object within a NWN2 area.
Definition: object.h:58
State
The state of a door.
Definition: door.h:43
void enter()
The cursor entered the door.
Definition: door.cpp:151
void loadObject(const Aurora::GFF3Struct &gff)
Load door-specific properties.
Definition: door.cpp:68
bool click(Object *triggerer=0)
The door was clicked.
Definition: door.cpp:175
bool open(Object *opener)
The opener object opens this door.
Definition: door.cpp:201
Door * _linkedDoor
The door this door links to.
Definition: door.h:109
LinkedToFlag _linkedToFlag
Does this door link to anything?
Definition: door.h:104
This door links to a waypoint.
Definition: door.h:93
Door(Module &module, const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:45
Module * _module
The module the door is in.
Definition: door.h:96
void load(const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:56
State _state
The current state of the door.
Definition: door.h:102
Object * _link
The object this door links to.
Definition: door.h:108
void evaluateLink()
Evaluate our link.
Definition: door.cpp:254
void setModelState()
Sync the model&#39;s state with the door&#39;s state.
Definition: door.cpp:111
uint32 _genericType
Index into the generic door types.
Definition: door.h:100
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
A struct within a GFF3.
Definition: gff3file.h:164
A situated object in a Neverwinter Nights 2 area.
uint32_t uint32
Definition: types.h:204
void hide()
Hide the door&#39;s model.
Definition: door.cpp:145
void show()
Show the door&#39;s model.
Definition: door.cpp:139
bool close(Object *closer)
The closer object closes this door.
Definition: door.cpp:228
void loadAppearance()
Load appearance-specific properties.
Definition: door.cpp:83
bool _invisible
Is the door invisible?
Definition: door.h:98