xoreos  0.0.5
area.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_JADE_AREA_H
26 #define ENGINES_JADE_AREA_H
27 
28 #include <list>
29 #include <map>
30 
31 #include "src/common/ptrlist.h"
32 #include "src/common/mutex.h"
33 
34 #include "src/aurora/types.h"
35 
36 #include "src/events/types.h"
37 #include "src/events/notifyable.h"
38 
42 
43 namespace Engines {
44 
45 namespace Jade {
46 
47 class Room;
48 
57 class Area : public AreaLayout, public Object, public Events::Notifyable {
58 public:
59  Area(Module &module, const Common::UString &resRef);
60  ~Area();
61 
62  // Visibility
63 
64  void show();
65  void hide();
66 
67  // Events
68 
70  void addEvent(const Events::Event &event);
72  void processEventQueue();
73 
75  void removeFocus();
76 
77 
78 protected:
79  void notifyCameraMoved();
80 
81 
82 private:
84  typedef std::map<uint32, Object *> ObjectMap;
85 
86 
88 
89 
92 
95 
97 
98  std::list<Events::Event> _eventQueue;
99 
101 
102  // Loading helpers
103 
104  void clear();
105  void load();
106 
107  void loadARE(const Aurora::GFF3Struct &are);
108  void loadSAV(const Aurora::GFF3Struct &sav);
109 
110  void loadResources();
111 
112  void loadObject(Jade::Object &object);
113 
114  void loadWaypoints (const Aurora::GFF3List &list);
115  void loadCreatures (const Aurora::GFF3List &list);
116  void loadPlaceables(const Aurora::GFF3List &list);
117  void loadTriggers (const Aurora::GFF3List &list);
118 
119  // Highlight / active helpers
120 
121  void checkActive(int x = -1, int y = -1);
122  void setActive(Jade::Object *object);
123  Jade::Object *getObjectAt(int x, int y);
124 
125  void highlightAll(bool enabled);
126 
127  void click(int x, int y);
128 };
129 
130 } // End of namespace Jade
131 
132 } // End of namespace Engines
133 
134 #endif // ENGINES_JADE_AREA_H
An object within a Jade Empire area.
Basic event types.
void highlightAll(bool enabled)
Definition: area.cpp:311
A class holding an UTF-8 string.
Definition: ustring.h:48
void loadWaypoints(const Aurora::GFF3List &list)
Definition: area.cpp:201
Common::PtrList< Object > ObjectList
Definition: area.h:83
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
Definition: area.cpp:233
void processEventQueue()
Process the current event queue.
Definition: area.cpp:237
void loadCreatures(const Aurora::GFF3List &list)
Definition: area.cpp:209
void setActive(Jade::Object *object)
Definition: area.cpp:276
void checkActive(int x=-1, int y=-1)
Definition: area.cpp:289
ObjectList _objects
List of all objects in the area.
Definition: area.h:90
A layout for an area.
SDL_Event Event
Definition: types.h:42
void click(int x, int y)
Definition: area.cpp:301
A list storing pointer to objects, with automatic deletion.
void loadARE(const Aurora::GFF3Struct &are)
Definition: area.cpp:132
std::list< Events::Event > _eventQueue
The event queue.
Definition: area.h:98
ObjectMap _objectMap
Map of all non-static objects in the area.
Definition: area.h:91
A mutex.
Definition: mutex.h:40
bool _highlightAll
Are we currently highlighting all objects?
Definition: area.h:96
An area in Jade Empire, holding all objects and rooms within, as well as general area properties like...
Definition: area.h:57
Area(Module &module, const Common::UString &resRef)
Definition: area.cpp:50
A Jade area layout.
Definition: arealayout.h:46
Module * _module
The module this area is in.
Definition: area.h:87
void loadTriggers(const Aurora::GFF3List &list)
Definition: area.cpp:225
Jade::Object * getObjectAt(int x, int y)
Definition: area.cpp:264
A class that can be notified by the NotificationManager.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Definition: area.cpp:322
std::vector< const GFF3Struct * > GFF3List
Definition: types.h:449
An object within a Jade area.
Definition: object.h:53
A Jade module.
Definition: module.h:53
Thread mutex classes.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
Jade::Object * _activeObject
The currently active (highlighted) object.
Definition: area.h:94
A struct within a GFF3.
Definition: gff3file.h:164
void loadPlaceables(const Aurora::GFF3List &list)
Definition: area.cpp:217
A module.
void loadSAV(const Aurora::GFF3Struct &sav)
Definition: area.cpp:139
void loadObject(Jade::Object &object)
Definition: area.cpp:189
Common::Mutex _mutex
Mutex securing access to the area.
Definition: area.h:100
void notifyCameraMoved()
Definition: area.cpp:329
void loadResources()
Definition: area.cpp:179
std::map< uint32, Object * > ObjectMap
Definition: area.h:84