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_WITCHER_PLACEABLE_H
26 #define ENGINES_WITCHER_PLACEABLE_H
27 
28 #include "src/aurora/types.h"
29 
31 
32 namespace Engines {
33 
34 namespace Witcher {
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);
88 
89 private:
91 
93 
95  void load(const Aurora::GFF3Struct &placeable);
96 
98  void setModelState();
99 };
100 
101 } // End of namespace Witcher
102 
103 } // End of namespace Engines
104 
105 #endif // ENGINES_WITCHER_PLACEABLE_H
bool isActivated() const
Is the placeable activated?
Definition: placeable.cpp:132
Witcher situated object.
Definition: situated.h:41
void hide()
Hide the placeable&#39;s model.
Definition: placeable.cpp:101
bool deactivate(Object *closer)
The user object deactivates this placeable.
Definition: placeable.cpp:223
bool _hasInventory
Does this placeable have an inventory?
Definition: placeable.h:92
An object within a Witcher area.
Definition: object.h:51
A situated object in a The Witcher area.
State _state
The current state of the placeable.
Definition: placeable.h:90
Placeable(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:40
bool close(Object *closer)
The closer object closes this placeable.
Definition: placeable.cpp:186
bool isOpen() const
Is the placeable open?
Definition: placeable.cpp:128
bool open(Object *opener)
The opener object opens this placeable.
Definition: placeable.cpp:164
void enter()
The cursor entered the placeable.
Definition: placeable.cpp:115
void load(const Aurora::GFF3Struct &placeable)
Load from a placeable instance.
Definition: placeable.cpp:49
void highlight(bool enabled)
(Un)Highlight the placeable.
Definition: placeable.cpp:123
void show()
Show the placeable&#39;s model.
Definition: placeable.cpp:95
State
The state of a placeable.
Definition: placeable.h:39
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
A struct within a GFF3.
Definition: gff3file.h:164
void loadObject(const Aurora::GFF3Struct &gff)
Load placeable-specific properties.
Definition: placeable.cpp:107
bool click(Object *triggerer=0)
The placeable was clicked.
Definition: placeable.cpp:136
void leave()
The cursor left the placeable.
Definition: placeable.cpp:119
bool activate(Object *opener)
The user object activates this placeable.
Definition: placeable.cpp:203
void setModelState()
Sync the model&#39;s state with the placeable&#39;s state.
Definition: placeable.cpp:59