51 namespace DragonAge2 {
59 using ::Aurora::GFF3File;
60 using ::Aurora::GFF3Struct;
63 using ::Aurora::GFF4File;
64 using ::Aurora::GFF4Struct;
71 Object(
kObjectTypeArea), _campaign(&campaign), _resRef(resRef), _environmentID(0xFFFFFFFF), _activeObject(0), _highlightAll(0) {
75 load(resRef, env, rim);
80 e.
add(
"Failed loading area \"%s\"", resRef.
c_str());
120 const GFF4Struct &arlTop = arl.getTopLevel();
130 if (!layout.
empty()) {
136 _rooms.reserve(rooms.size());
138 for (GFF4List::const_iterator r = rooms.begin(); r != rooms.end(); ++r) {
142 if (!*r || ((*r)->getLabel() !=
kROOMID))
152 const GFF3Struct &areTop = are.getTopLevel();
154 _tag = areTop.getString(
"Tag");
156 areTop.getLocString(
"Name",
_name);
162 if (areTop.hasField(
"WaypointList"))
164 if (areTop.hasField(
"PlaceableList"))
166 if (areTop.hasField(
"CreatureList"))
176 const std::list<uint32> &ids =
object.getIDs();
178 for (std::list<uint32>::const_iterator
id = ids.begin();
id != ids.end(); ++id)
179 _objectMap.insert(std::make_pair(*
id, &
object));
184 for (Aurora::GFF3List::const_iterator w = list.begin(); w != list.end(); ++w) {
192 for (Aurora::GFF3List::const_iterator p = list.begin(); p != list.end(); ++p) {
200 for (Aurora::GFF3List::const_iterator c = list.begin(); c != list.end(); ++c) {
212 for (Rooms::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
227 for (Rooms::iterator r =
_rooms.begin(); r !=
_rooms.end(); ++r)
234 if (!rimFile.
empty()) {
246 return are.getTopLevel().getString(
"Name");
255 return are.getTopLevel().getString(
"Name");
263 float &orientX,
float &orientY,
float &orientZ,
float &orientAngle)
const {
275 object->getOrientation(orientX, orientY, orientZ, orientAngle);
295 bool hasMove =
false;
296 for (std::list<Events::Event>::const_iterator e =
_eventQueue.begin();
302 if (e->button.button == SDL_BUTTON_LMASK) {
304 click(e->button.x, e->button.y);
307 if (e->key.keysym.sym == SDLK_TAB)
310 if (e->key.keysym.sym == SDLK_TAB)
352 if ((x < 0) || (y < 0))
375 if (o->second->isClickable())
376 o->second->highlight(enabled);
::Aurora::NWScript::Object * getFirstObjectByType(ObjectType type) const
Return the first object of this type.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define ResMan
Shortcut for accessing the sound manager.
A placeable object in a Dragon Age II area.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
uint32 findResource(uint64 hash) const
Return the index of the resource matching the hash, or 0xFFFFFFFF if not found.
void add(const char *s,...) GCC_PRINTF(2
const Common::UString & getResRef() const
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource's contents.
The global graphics manager.
A creature in a Dragon Age II area.
static const uint32 kAREID
void loadPlaceables(const Aurora::GFF3List &list)
A class holding an UTF-8 string.
virtual void enter()
The cursor entered the object.
void removeFocus()
Forcibly remove the focus from the currently highlighted object.
Creature * getPC() const
Return the currently playing PC.
static const uint32 kVersion40
Handling BioWare's RIMs (resource archives).
static const uint32 kARLID
The context holding a Dragon Age II area.
bool indexOptionalArchive(const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID)
void loadCreatures(const Aurora::GFF3List &list)
void enableEvents(bool enabled)
Enable/Disable the handling of all events.
void addObject(DragonAge2::Object &object)
Add an object to this container.
DragonAge2::Object * _activeObject
The currently active (highlighted) object.
Objects _objects
List of all objects in the area.
void removeObject(DragonAge2::Object &object)
Remove an object from this container.
Object * getFirstObject() const
Return the first object.
Utility templates and functions for working with strings and streams.
Common::UString _environmentName
An object in a Dragon Age II area.
void checkActive(int x=-1, int y=-1)
Exception that provides a stack of explanations.
void highlightAll(bool enabled)
void deindexResources(Common::ChangeID &changeID)
Remove previously added resources from the ResourceManager.
Mouse button was pressed.
void loadObject(DragonAge2::Object &object)
Keyboard key was pressed.
std::vector< const GFF4Struct * > GFF4List
void processEventQueue()
Process the current event queue.
Handling version V4.0/V4.1 of BioWare's GFFs (generic file format).
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
void load(const Common::UString &resRef, const Common::UString &env, const Common::UString &rim)
Area(Campaign &campaign, const Common::UString &resRef, const Common::UString &env, const Common::UString &rim)
ObjectMap _objectMap
Map of objects by their model IDs.
Utility templates and functions.
void addEvent(const Events::Event &event)
Add a single event for consideration into the area event queue.
A waypoint in a Dragon Age II area.
void loadWaypoints(const Aurora::GFF3List &list)
The global events manager.
void loadARE(const Common::UString &resRef)
bool empty() const
Is the string empty?
bool _highlightAll
Are we currently highlighting all objects?
#define CursorMan
Shortcut for accessing the cursor manager.
std::vector< const GFF3Struct * > GFF3List
Convenience class that locks a mutex on creation and unlocks it on destruction.
#define EventMan
Shortcut for accessing the events manager.
The Aurora cursor manager.
The context holding a Dragon Age II campaign.
An object that can be displayed by the graphics manager.
uint32 getID() const
Get the object's unique ID.
static const uint32 kROOMID
static DragonAge2::Object * toObject(::Aurora::NWScript::Object *object)
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
A room in a Dragon Age II area.
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.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
virtual void leave()
The cursor left the object.
void hide()
Hide the object's model(s).
Class to hold resource data of a RIM archive file.
void setActive(DragonAge2::Object *object)
virtual bool click(Object *triggerer=0)
The object was clicked.
std::list< Events::Event > _eventQueue
Common::UString _startPoint
void show()
Show the object's model(s).
Keyboard key was released.
An object that can be displayed by the graphics manager.
void loadEnvironment(const Common::UString &resRef)
const Aurora::LocString & getName() const
Object * getFirstObjectByTag(const Common::UString &tag) const
Return the first object with this tag.
Interface for a seekable & readable data stream.
#define GfxMan
Shortcut for accessing the graphics manager.
void readVarTable(const Aurora::GFF3List &varTable)
The global resource manager for Aurora resources.
bool isStatic() const
Is the object static (not manipulable at all)?
void readScript(const Aurora::GFF3Struct &gff)
DragonAge2::Object * getObjectAt(int x, int y)