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_DRAGONAGE2_AREA_H
26 #define ENGINES_DRAGONAGE2_AREA_H
27 
28 #include <vector>
29 #include <list>
30 #include <map>
31 
32 #include "src/common/ptrlist.h"
33 #include "src/common/ptrvector.h"
34 #include "src/common/ustring.h"
35 #include "src/common/mutex.h"
36 
37 #include "src/aurora/types.h"
38 #include "src/aurora/locstring.h"
39 
40 #include "src/events/types.h"
41 #include "src/events/notifyable.h"
42 
44 
46 
47 namespace Engines {
48 
49 namespace DragonAge2 {
50 
51 class Campaign;
52 
53 class Room;
54 class Object;
55 
64 class Area : public DragonAge2::Object, public Events::Notifyable {
65 public:
66  Area(Campaign &campaign, const Common::UString &resRef,
67  const Common::UString &env, const Common::UString &rim);
68  ~Area();
69 
70  const Common::UString &getResRef() const;
71  const Aurora::LocString &getName() const;
72 
74  void getEntryLocation(float &posX, float &posY, float &posZ,
75  float &orientX, float &orientY, float &orientZ, float &orientAngle) const;
76 
77  void show();
78  void hide();
79 
81  void addEvent(const Events::Event &event);
83  void processEventQueue();
84 
86  void removeFocus();
87 
88  static Common::UString getName(const Common::UString &resRef, const Common::UString &rimFile = "");
89 
90 
91 protected:
92  void notifyCameraMoved();
93 
94 
95 private:
97 
99  typedef std::map<uint32, DragonAge2::Object *> ObjectMap;
100 
101 
103 
105 
109 
112 
114 
116 
118  std::list<Events::Event> _eventQueue;
119 
122 
125 
127 
129 
130 
131  void load(const Common::UString &resRef, const Common::UString &env, const Common::UString &rim);
132  void loadEnvironment(const Common::UString &resRef);
133  void loadARE(const Common::UString &resRef);
134 
135  void loadObject(DragonAge2::Object &object);
136  void loadWaypoints (const Aurora::GFF3List &list);
137  void loadPlaceables(const Aurora::GFF3List &list);
138  void loadCreatures (const Aurora::GFF3List &list);
139 
140  void checkActive(int x = -1, int y = -1);
141  void setActive(DragonAge2::Object *object);
142  DragonAge2::Object *getObjectAt(int x, int y);
143 
144  void highlightAll(bool enabled);
145 
146  void click(int x, int y);
147 
148  void clean();
149 };
150 
151 } // End of namespace DragonAge2
152 
153 } // End of namespace Engines
154 
155 #endif // ENGINES_DRAGONAGE2_AREA_H
Basic event types.
Generic Aurora engines resource utility functions.
Common::PtrVector< Room > Rooms
Definition: area.h:96
const Common::UString & getResRef() const
Definition: area.cpp:90
void loadPlaceables(const Aurora::GFF3List &list)
Definition: area.cpp:191
A class holding an UTF-8 string.
Definition: ustring.h:48
A localized string.
Definition: locstring.h:43
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Definition: area.cpp:379
void click(int x, int y)
Definition: area.cpp:358
void loadCreatures(const Aurora::GFF3List &list)
Definition: area.cpp:199
An area in Dragon Age II, holding all objects and rooms within, as well as general area properties li...
Definition: area.h:64
DragonAge2::Object * _activeObject
The currently active (highlighted) object.
Definition: area.h:124
Objects _objects
List of all objects in the area.
Definition: area.h:120
Common::Mutex _mutex
Definition: area.h:128
Common::UString _environmentName
Definition: area.h:107
An object in a Dragon Age II area.
void checkActive(int x=-1, int y=-1)
Definition: area.cpp:346
void highlightAll(bool enabled)
Definition: area.cpp:368
std::list< Common::ChangeID > ChangeList
Definition: resources.h:41
SDL_Event Event
Definition: types.h:42
A list storing pointer to objects, with automatic deletion.
void loadObject(DragonAge2::Object &object)
Definition: area.cpp:170
void processEventQueue()
Process the current event queue.
Definition: area.cpp:294
A mutex.
Definition: mutex.h:40
void load(const Common::UString &resRef, const Common::UString &env, const Common::UString &rim)
Definition: area.cpp:108
Area(Campaign &campaign, const Common::UString &resRef, const Common::UString &env, const Common::UString &rim)
Definition: area.cpp:69
ObjectMap _objectMap
Map of objects by their model IDs.
Definition: area.h:121
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
Definition: area.cpp:290
void loadWaypoints(const Aurora::GFF3List &list)
Definition: area.cpp:183
Common::UString _script
Definition: area.h:111
void loadARE(const Common::UString &resRef)
Definition: area.cpp:149
Common::UString _resRef
Definition: area.h:104
A class that can be notified by the NotificationManager.
Campaign * _campaign
Definition: area.h:102
std::map< uint32, DragonAge2::Object * > ObjectMap
Definition: area.h:99
A vector storing pointer to objects, with automatic deletion.
bool _highlightAll
Are we currently highlighting all objects?
Definition: area.h:126
Handling BioWare&#39;s localized strings.
std::vector< const GFF3Struct * > GFF3List
Definition: types.h:449
Unicode string handling.
Thread mutex classes.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
uint32_t uint32
Definition: types.h:204
void getEntryLocation(float &posX, float &posY, float &posZ, float &orientX, float &orientY, float &orientZ, float &orientAngle) const
Return the position and orientation the PC should enter this area.
Definition: area.cpp:262
ChangeList _resources
Definition: area.h:117
Common::PtrList< DragonAge2::Object > Objects
Definition: area.h:98
void hide()
Hide the object&#39;s model(s).
Definition: area.cpp:220
Common::UString _skyDome
Definition: area.h:108
void setActive(DragonAge2::Object *object)
Definition: area.cpp:333
std::list< Events::Event > _eventQueue
Definition: area.h:118
Common::UString _startPoint
Definition: area.h:110
void show()
Show the object&#39;s model(s).
Definition: area.cpp:207
void loadEnvironment(const Common::UString &resRef)
Definition: area.cpp:115
const Aurora::LocString & getName() const
Definition: area.cpp:94
Aurora::LocString _name
Definition: area.h:113
DragonAge2::Object * getObjectAt(int x, int y)
Definition: area.cpp:321