xoreos  0.0.5
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Engines::Jade::Area Class Reference

An area in Jade Empire, holding all objects and rooms within, as well as general area properties like the current background music and ambient sounds. More...

#include <area.h>

Inheritance diagram for Engines::Jade::Area:
Inheritance graph
[legend]
Collaboration diagram for Engines::Jade::Area:
Collaboration graph
[legend]

Public Member Functions

 Area (Module &module, const Common::UString &resRef)
 
 ~Area ()
 
void show ()
 
void hide ()
 
void addEvent (const Events::Event &event)
 Add a single event for consideration into the area event queue. More...
 
void processEventQueue ()
 Process the current event queue. More...
 
void removeFocus ()
 Forcibly remove the focus from the currently highlighted object. More...
 
- Public Member Functions inherited from Engines::Jade::AreaLayout
 AreaLayout (const Common::UString &resRef)
 
virtual ~AreaLayout ()
 
const Common::UStringgetResRef ()
 Return the area's resref (resource ID). More...
 
void updateCamera ()
 
- Public Member Functions inherited from Engines::Jade::Object
 Object (ObjectType type=kObjectTypeInvalid)
 
virtual ~Object ()
 
ObjectType getType () const
 Return the exact type of the object. More...
 
virtual void loadModel ()
 Load the object's model(s). More...
 
virtual void unloadModel ()
 Unload the object's model(s). More...
 
const std::list< uint32 > & getIDs () const
 Return the object's model IDs. More...
 
const Common::UStringgetName () const
 Return the object's name. More...
 
const Common::UStringgetDescription () const
 Return the object's description. More...
 
const Common::UStringgetConversation () const
 Return the object's default conversation (DLG). More...
 
Aurora::NWScript::ObjectgetPCSpeaker () const
 Return the PC currently speaking with this object. More...
 
void setPCSpeaker (Aurora::NWScript::Object *pc)
 Set the PC currently speaking with this object. More...
 
bool isStatic () const
 Is the object static (not manipulable at all)? More...
 
bool isUsable () const
 Can the object be used by the PC? More...
 
bool isActive () const
 Is the object currently active/available/visible? More...
 
bool isNoCollide () const
 Is collision checking disabled? More...
 
void setNoCollide (bool noCollide)
 Enable or disable collision checking. More...
 
bool isClickable () const
 Can the player click the object? More...
 
AreagetArea () const
 Return the area this object is currently in. More...
 
void setArea (Area *)
 Set the area this object is currently in. More...
 
virtual void getPosition (float &x, float &y, float &z) const
 Return the object's position within its area. More...
 
virtual void getOrientation (float &x, float &y, float &z, float &angle) const
 Return the object's orientation. More...
 
virtual void setPosition (float x, float y, float z)
 Set the object's position within its area. More...
 
virtual void setOrientation (float x, float y, float z, float angle)
 Set the object's orientation. More...
 
Location getLocation () const
 Create a Location out of the object's area, position and orientation. More...
 
virtual void enter ()
 The cursor entered the object. More...
 
virtual void leave ()
 The cursor left the object. More...
 
virtual void highlight (bool enabled)
 (Un)Highlight the object. More...
 
virtual bool click (Object *triggerer=0)
 The object was clicked. More...
 
ObjectgetLastTriggerer () const
 Return the object that last triggered this object. More...
 
void speakString (int32 resref)
 Speak the specified string. More...
 
virtual void playAnimation (const Common::UString &animation="", bool restart=true, int32 loopCount=0)
 Play an object animation. More...
 
virtual void playAnimation (Animation animation)
 Play a default object animation. More...
 
- Public Member Functions inherited from Aurora::NWScript::Object
 Object ()
 
uint32 getID () const
 
const Common::UStringgetTag () const
 
- Public Member Functions inherited from Aurora::NWScript::VariableContainer
 VariableContainer ()
 
virtual ~VariableContainer ()
 
bool hasVariable (const Common::UString &var) const
 
VariablegetVariable (const Common::UString &var, Type type=kTypeVoid)
 
const VariablegetVariable (const Common::UString &var) const
 
void setVariable (const Common::UString &var, const Variable &value)
 
void removeVariable (const Common::UString &var)
 
void clearVariables ()
 
- Public Member Functions inherited from Engines::Jade::ScriptContainer
 ScriptContainer ()
 
 ~ScriptContainer ()
 
const Common::UStringgetScript (Script script) const
 
bool hasScript (Script script) const
 
bool runScript (Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
- Public Member Functions inherited from Events::Notifyable
 Notifyable ()
 
virtual ~Notifyable ()
 

Protected Member Functions

void notifyCameraMoved ()
 
- Protected Member Functions inherited from Engines::Jade::AreaLayout
 AreaLayout ()
 
- Protected Member Functions inherited from Engines::Jade::Object
void loadPositional (const Aurora::GFF3Struct &gff)
 Load the object's positional gff struct which contains the position and orientation. More...
 
- Protected Member Functions inherited from Engines::Jade::ScriptContainer
void clearScripts ()
 
void readScripts (const Aurora::GFF3Struct &gff)
 
void readScripts (const ScriptContainer &container)
 

Private Types

typedef Common::PtrList< ObjectObjectList
 
typedef std::map< uint32, Object * > ObjectMap
 

Private Member Functions

void clear ()
 
void load ()
 
void loadARE (const Aurora::GFF3Struct &are)
 
void loadSAV (const Aurora::GFF3Struct &sav)
 
void loadResources ()
 
void loadObject (Jade::Object &object)
 
void loadWaypoints (const Aurora::GFF3List &list)
 
void loadCreatures (const Aurora::GFF3List &list)
 
void loadPlaceables (const Aurora::GFF3List &list)
 
void loadTriggers (const Aurora::GFF3List &list)
 
void checkActive (int x=-1, int y=-1)
 
void setActive (Jade::Object *object)
 
Jade::ObjectgetObjectAt (int x, int y)
 
void highlightAll (bool enabled)
 
void click (int x, int y)
 

Private Attributes

Module_module
 The module this area is in. More...
 
ObjectList _objects
 List of all objects in the area. More...
 
ObjectMap _objectMap
 Map of all non-static objects in the area. More...
 
Jade::Object_activeObject
 The currently active (highlighted) object. More...
 
bool _highlightAll
 Are we currently highlighting all objects? More...
 
std::list< Events::Event_eventQueue
 The event queue. More...
 
Common::Mutex _mutex
 Mutex securing access to the area. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Engines::Jade::ScriptContainer
static bool runScript (const Common::UString &script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
static bool runScript (const Common::UString &script, const Aurora::NWScript::ScriptState &state, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
- Protected Attributes inherited from Engines::Jade::AreaLayout
Common::UString _resRef
 The area's resref (resource ID). More...
 
Common::UString _layout
 The area's layout resref (resource ID). More...
 
std::list< Common::ChangeID_resources
 The area's resource archives. More...
 
bool _visible
 Is the area currently visible? More...
 
- Protected Attributes inherited from Engines::Jade::Object
ObjectType _type
 The object's type. More...
 
Common::UString _name
 The object's display name. More...
 
Common::UString _description
 The object's description. More...
 
Common::UString _conversation
 The object's default conversation. More...
 
bool _static
 Is the object static? More...
 
bool _usable
 Is the object usable? More...
 
bool _active
 Is the object currently active/available/visible? More...
 
bool _noCollide
 Is collision checking for the object disabled? More...
 
std::list< uint32_ids
 The object's model IDs. More...
 
Aurora::NWScript::Object_pcSpeaker
 The current PC speaking with the object. More...
 
Area_area
 The area the object is currently in. More...
 
Object_lastTriggerer
 The object that last used this object. More...
 
float _position [3]
 The object's position. More...
 
float _orientation [4]
 The object's orientation. More...
 
- Protected Attributes inherited from Aurora::NWScript::Object
uint32 _id
 
Common::UString _tag
 

Detailed Description

An area in Jade Empire, holding all objects and rooms within, as well as general area properties like the current background music and ambient sounds.

Note: the coordinate system of the in-world graphics is oriented as viewed from the top down. The negative Z axis goes down into the ground, while the positive Y axis points due north and the positive X axis points due east.

Definition at line 57 of file area.h.

Member Typedef Documentation

◆ ObjectList

Definition at line 83 of file area.h.

◆ ObjectMap

typedef std::map<uint32, Object *> Engines::Jade::Area::ObjectMap
private

Definition at line 84 of file area.h.

Constructor & Destructor Documentation

◆ Area()

Engines::Jade::Area::Area ( Module module,
const Common::UString resRef 
)

Definition at line 50 of file area.cpp.

References _module, Engines::Jade::AreaLayout::_resRef, Engines::Jade::ObjectContainer::addObject(), clear(), and load().

Here is the call graph for this function:

◆ ~Area()

Engines::Jade::Area::~Area ( )

Definition at line 66 of file area.cpp.

References _module, clear(), hide(), removeFocus(), and Engines::Jade::ObjectContainer::removeObject().

Here is the call graph for this function:

Member Function Documentation

◆ addEvent()

void Engines::Jade::Area::addEvent ( const Events::Event event)

Add a single event for consideration into the area event queue.

Definition at line 233 of file area.cpp.

References _eventQueue.

◆ checkActive()

void Engines::Jade::Area::checkActive ( int  x = -1,
int  y = -1 
)
private

Definition at line 289 of file area.cpp.

References _highlightAll, _mutex, CursorMan, getObjectAt(), and setActive().

Referenced by notifyCameraMoved(), and processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void Engines::Jade::Area::clear ( )
privatevirtual

Reimplemented from Engines::Jade::AreaLayout.

Definition at line 86 of file area.cpp.

References _module, _objects, Common::PtrList< T, Deallocator >::clear(), Engines::Jade::AreaLayout::clear(), and Engines::Jade::ObjectContainer::removeObject().

Referenced by Area(), and ~Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ click()

void Engines::Jade::Area::click ( int  x,
int  y 
)
private

Definition at line 301 of file area.cpp.

References _module, _mutex, Engines::Jade::Object::click(), getObjectAt(), and Engines::Jade::Module::getPC().

Referenced by processEventQueue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObjectAt()

Jade::Object * Engines::Jade::Area::getObjectAt ( int  x,
int  y 
)
private

Definition at line 264 of file area.cpp.

References _objectMap, Graphics::Renderable::getID(), and GfxMan.

Referenced by checkActive(), and click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hide()

void Engines::Jade::Area::hide ( )
virtual

Reimplemented from Engines::Jade::AreaLayout.

Definition at line 115 of file area.cpp.

References _objects, Engines::Jade::AreaLayout::_visible, GfxMan, Engines::Jade::AreaLayout::hide(), and removeFocus().

Referenced by ~Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ highlightAll()

void Engines::Jade::Area::highlightAll ( bool  enabled)
private

Definition at line 311 of file area.cpp.

References _highlightAll, and _objectMap.

Referenced by processEventQueue().

Here is the caller graph for this function:

◆ load()

void Engines::Jade::Area::load ( )
privatevirtual

Reimplemented from Engines::Jade::AreaLayout.

Definition at line 76 of file area.cpp.

References Engines::Jade::AreaLayout::_resRef, Aurora::GFF3File::getTopLevel(), Aurora::kFileTypeARE, Aurora::kFileTypeSAV, Engines::Jade::AreaLayout::load(), loadARE(), loadSAV(), and MKTAG.

Referenced by Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadARE()

void Engines::Jade::Area::loadARE ( const Aurora::GFF3Struct are)
private

Definition at line 132 of file area.cpp.

References Engines::Jade::AreaLayout::_layout, Aurora::GFF3Struct::getString(), and Engines::Jade::ScriptContainer::readScripts().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadCreatures()

void Engines::Jade::Area::loadCreatures ( const Aurora::GFF3List list)
private

Definition at line 209 of file area.cpp.

References loadObject().

Referenced by loadSAV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadObject()

void Engines::Jade::Area::loadObject ( Jade::Object object)
private

Definition at line 189 of file area.cpp.

References _module, _objectMap, _objects, Engines::Jade::ObjectContainer::addObject(), and Engines::Jade::Object::isStatic().

Referenced by loadCreatures(), loadPlaceables(), loadTriggers(), and loadWaypoints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadPlaceables()

void Engines::Jade::Area::loadPlaceables ( const Aurora::GFF3List list)
private

Definition at line 217 of file area.cpp.

References loadObject().

Referenced by loadSAV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadResources()

void Engines::Jade::Area::loadResources ( )
privatevirtual

Reimplemented from Engines::Jade::AreaLayout.

Definition at line 179 of file area.cpp.

References Engines::Jade::AreaLayout::_layout, Engines::Jade::AreaLayout::_resources, Engines::Jade::AreaLayout::_resRef, and Engines::indexMandatoryArchive().

Here is the call graph for this function:

◆ loadSAV()

void Engines::Jade::Area::loadSAV ( const Aurora::GFF3Struct sav)
private

Definition at line 139 of file area.cpp.

References Aurora::GFF3Struct::getList(), Aurora::GFF3Struct::getStruct(), Aurora::GFF3Struct::hasField(), loadCreatures(), loadPlaceables(), loadTriggers(), and loadWaypoints().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadTriggers()

void Engines::Jade::Area::loadTriggers ( const Aurora::GFF3List list)
private

Definition at line 225 of file area.cpp.

References loadObject().

Referenced by loadSAV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadWaypoints()

void Engines::Jade::Area::loadWaypoints ( const Aurora::GFF3List list)
private

Definition at line 201 of file area.cpp.

References loadObject().

Referenced by loadSAV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyCameraMoved()

void Engines::Jade::Area::notifyCameraMoved ( )
protectedvirtual

Reimplemented from Events::Notifyable.

Definition at line 329 of file area.cpp.

References checkActive().

Here is the call graph for this function:

◆ processEventQueue()

void Engines::Jade::Area::processEventQueue ( )

Process the current event queue.

Definition at line 237 of file area.cpp.

References _eventQueue, checkActive(), click(), highlightAll(), Events::kEventKeyDown, Events::kEventKeyUp, Events::kEventMouseDown, and Events::kEventMouseMove.

Here is the call graph for this function:

◆ removeFocus()

void Engines::Jade::Area::removeFocus ( )

Forcibly remove the focus from the currently highlighted object.

Definition at line 322 of file area.cpp.

References _activeObject, and Engines::Jade::Object::leave().

Referenced by hide(), and ~Area().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActive()

void Engines::Jade::Area::setActive ( Jade::Object object)
private

Definition at line 276 of file area.cpp.

References _activeObject, Engines::Jade::Object::enter(), and Engines::Jade::Object::leave().

Referenced by checkActive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ show()

void Engines::Jade::Area::show ( )
virtual

Reimplemented from Engines::Jade::AreaLayout.

Definition at line 96 of file area.cpp.

References _objects, Engines::Jade::AreaLayout::_visible, GfxMan, Engines::Jade::kScriptOnSpawn, and Engines::Jade::AreaLayout::show().

Here is the call graph for this function:

Member Data Documentation

◆ _activeObject

Jade::Object* Engines::Jade::Area::_activeObject
private

The currently active (highlighted) object.

Definition at line 94 of file area.h.

Referenced by removeFocus(), and setActive().

◆ _eventQueue

std::list<Events::Event> Engines::Jade::Area::_eventQueue
private

The event queue.

Definition at line 98 of file area.h.

Referenced by addEvent(), and processEventQueue().

◆ _highlightAll

bool Engines::Jade::Area::_highlightAll
private

Are we currently highlighting all objects?

Definition at line 96 of file area.h.

Referenced by checkActive(), and highlightAll().

◆ _module

Module* Engines::Jade::Area::_module
private

The module this area is in.

Definition at line 87 of file area.h.

Referenced by Area(), clear(), click(), loadObject(), and ~Area().

◆ _mutex

Common::Mutex Engines::Jade::Area::_mutex
private

Mutex securing access to the area.

Definition at line 100 of file area.h.

Referenced by checkActive(), and click().

◆ _objectMap

ObjectMap Engines::Jade::Area::_objectMap
private

Map of all non-static objects in the area.

Definition at line 91 of file area.h.

Referenced by getObjectAt(), highlightAll(), and loadObject().

◆ _objects

ObjectList Engines::Jade::Area::_objects
private

List of all objects in the area.

Definition at line 90 of file area.h.

Referenced by clear(), hide(), loadObject(), and show().


The documentation for this class was generated from the following files: