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_NWN2_PLACEABLE_H
26 #define ENGINES_NWN2_PLACEABLE_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace NWN2 {
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 protected:
87  void loadObject(const Aurora::GFF3Struct &gff);
89  void loadAppearance();
90 
91 private:
93 
95 
97  void load(const Aurora::GFF3Struct &placeable);
98 
100  void setModelState();
101 };
102 
103 } // End of namespace NWN2
104 
105 } // End of namespace Engines
106 
107 #endif // ENGINES_NWN2_PLACEABLE_H
void loadObject(const Aurora::GFF3Struct &gff)
Load placeable-specific properties.
Definition: placeable.cpp:109
void loadAppearance()
Load appearance-specific properties.
Definition: placeable.cpp:117
void hide()
Hide the placeable&#39;s model.
Definition: placeable.cpp:103
bool _hasInventory
Does this placeable have an inventory?
Definition: placeable.h:94
bool isOpen() const
Is the placeable open?
Definition: placeable.cpp:144
Placeable(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:42
void setModelState()
Sync the model&#39;s state with the placeable&#39;s state.
Definition: placeable.cpp:61
State _state
The current state of the placeable.
Definition: placeable.h:92
An object within a NWN2 area.
Definition: object.h:58
void leave()
The cursor left the placeable.
Definition: placeable.cpp:135
void load(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:51
void highlight(bool enabled)
(Un)Highlight the placeable.
Definition: placeable.cpp:139
bool open(Object *opener)
The opener object opens this placeable.
Definition: placeable.cpp:180
bool deactivate(Object *closer)
The user object deactivates this placeable.
Definition: placeable.cpp:239
void enter()
The cursor entered the placeable.
Definition: placeable.cpp:131
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
State
The state of a placeable.
Definition: placeable.h:39
A struct within a GFF3.
Definition: gff3file.h:164
A situated object in a Neverwinter Nights 2 area.
bool isActivated() const
Is the placeable activated?
Definition: placeable.cpp:148
void show()
Show the placeable&#39;s model.
Definition: placeable.cpp:97
bool click(Object *triggerer=0)
The placeable was clicked.
Definition: placeable.cpp:152
bool close(Object *closer)
The closer object closes this placeable.
Definition: placeable.cpp:202
bool activate(Object *opener)
The user object activates this placeable.
Definition: placeable.cpp:219