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_KOTOR_DOOR_H
26 #define ENGINES_KOTOR_DOOR_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace KotOR {
35 
36 class Module;
37 
38 class Door : public Situated {
39 public:
41  enum State {
46  };
47 
49  Door(Module &module, const Aurora::GFF3Struct &door);
50  ~Door();
51 
52  // Basic visuals
53 
54  void hide();
55  void hideSoft();
56 
57  // Basic properties
58 
60  bool isOpen() const;
61 
63  bool open(Object *opener);
65  bool close(Object *closer);
66 
67  // Object/Cursor interactions
68 
69  void enter();
70  void leave();
71 
73  void highlight(bool enabled);
74 
76  bool click(Object *triggerer = 0);
77 
78  bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const;
79 
80 protected:
82  void loadObject(const Aurora::GFF3Struct &gff);
84  void loadAppearance();
85 
86 private:
87  enum LinkedToFlag {
91  };
92 
94 
96 
98 
103 
106 
108  void load(const Aurora::GFF3Struct &door);
109 
111  void loadAppearance(const Aurora::TwoDAFile &twoda, uint32 id);
112 };
113 
114 } // End of namespace KotOR
115 
116 } // End of namespace Engines
117 
118 #endif // ENGINES_KOTOR_DOOR_H
Class to hold the two-dimensional array of a 2DA file.
Definition: 2dafile.h:124
void loadObject(const Aurora::GFF3Struct &gff)
Load door-specific properties.
Definition: door.cpp:80
bool isOpen() const
Is the door open?
Definition: door.cpp:145
A class holding an UTF-8 string.
Definition: ustring.h:48
bool close(Object *closer)
The closer object closes this door.
Definition: door.cpp:199
This door links to a waypoint.
Definition: door.h:90
Opened in the other direction (normally counter-clock-wise).
Definition: door.h:44
State
The state of a door.
Definition: door.h:41
ObjectType
Object type, matches the bitfield in nwscript.nss.
Definition: types.h:33
This door links to another door.
Definition: door.h:89
State _state
The current state of the door.
Definition: door.h:97
void load(const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:59
bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
Definition: door.cpp:170
This door links to nothing.
Definition: door.h:88
A situated object in a Star Wars: Knights of the Old Republic area.
LinkedToFlag _linkedToFlag
Does this door link to anything?
Definition: door.h:99
uint32 _genericType
Index into the generic door types.
Definition: door.h:95
Common::UString _transitionDestination
A localized string describing where this door leads to.
Definition: door.h:105
Opened in one direction (normally clock-wise).
Definition: door.h:43
void hideSoft()
Hide the door&#39;s model if applicable.
Definition: door.cpp:127
Door(Module &module, const Aurora::GFF3Struct &door)
Load from a door instance.
Definition: door.cpp:49
bool click(Object *triggerer=0)
The door was clicked.
Definition: door.cpp:149
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
A struct within a GFF3.
Definition: gff3file.h:164
void highlight(bool enabled)
(Un)Highlight the door.
Definition: door.cpp:140
uint32_t uint32
Definition: types.h:204
void enter()
The cursor entered the door.
Definition: door.cpp:130
void leave()
The cursor left the door.
Definition: door.cpp:135
Module * _module
The module the door is in.
Definition: door.h:93
Common::UString _linkedTo
The object tag this door links to.
Definition: door.h:101
Common::UString _linkedToModule
The module the object this door links to is in.
Definition: door.h:102
bool open(Object *opener)
The opener object opens this door.
Definition: door.cpp:174
void hide()
Hide the door&#39;s model.
Definition: door.cpp:121
void loadAppearance()
Load appearance-specific properties.
Definition: door.cpp:98
ObjectType _linkedToType
The type of the object this door links to.
Definition: door.h:100