xoreos
0.0.5
|
An area in The Witcher, holding all objects and area geometry within, as well as general area properties like the current background music and ambient sounds. More...
#include <area.h>
Public Member Functions | |
Area (Module &module, const Common::UString &resRef) | |
~Area () | |
const Common::UString & | getResRef () const |
Return the area's resref (resource ID). More... | |
const Aurora::LocString & | getName () const |
Return the area's name. More... | |
void | refreshLocalized () |
Refresh all localized strings. More... | |
void | show () |
Show the area. More... | |
void | hide () |
Hide the area. More... | |
uint32 | getMusicDayTrack () const |
Return the music track ID playing by day. More... | |
uint32 | getMusicNightTrack () const |
Return the music track ID playing by night. More... | |
uint32 | getMusicBattleTrack () const |
Return the music track ID playing in battle. More... | |
void | setMusicDayTrack (uint32 track) |
Set the music track ID playing by day. More... | |
void | setMusicNightTrack (uint32 track) |
Set the music track ID playing by night. More... | |
void | setMusicBattleTrack (uint32 track) |
Set the music track ID playing in battle. More... | |
void | stopAmbientMusic () |
Stop the ambient music. More... | |
void | playAmbientMusic (Common::UString music="") |
Play the specified music (or the area's default) as ambient music. More... | |
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::Witcher::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::UString & | getUniqueID () const |
Return the object's globally unique ID. More... | |
const Aurora::LocString & | getName () const |
Return the object's name. More... | |
const Aurora::LocString & | getDescription () const |
Return the object's description. More... | |
const Common::UString & | getConversation () const |
Return the object's default conversation (DLG). 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 | isClickable () const |
Can the player click the object? More... | |
Area * | getArea () 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... | |
void | speakString (const Common::UString &string, uint32 volume) |
Speak the specified string. More... | |
void | speakOneLiner (Common::UString conv, Object *tokenTarget=0) |
Speak an one-liner from the specified conversation file. More... | |
void | stopSound () |
Stop the current object sound. More... | |
void | playSound (const Common::UString &sound, bool pitchVariance=false) |
Play an object sound. More... | |
Public Member Functions inherited from Aurora::NWScript::Object | |
Object () | |
uint32 | getID () const |
const Common::UString & | getTag () const |
Public Member Functions inherited from Aurora::NWScript::VariableContainer | |
VariableContainer () | |
virtual | ~VariableContainer () |
bool | hasVariable (const Common::UString &var) const |
Variable & | getVariable (const Common::UString &var, Type type=kTypeVoid) |
const Variable & | getVariable (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::Witcher::ScriptContainer | |
ScriptContainer () | |
~ScriptContainer () | |
const Common::UString & | getScript (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 () |
Static Public Member Functions | |
static Aurora::LocString | getName (const Common::UString &resRef) |
Return the name of an area. More... | |
Static Public Member Functions inherited from Engines::Witcher::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 Member Functions | |
void | notifyCameraMoved () |
Notify the area that the camera has been moved. More... | |
Protected Member Functions inherited from Engines::Witcher::ScriptContainer | |
void | clearScripts () |
void | readScripts (const Aurora::GFF3Struct &gff) |
void | readScripts (const ScriptContainer &container) |
Private Types | |
typedef Common::PtrList< Engines::Witcher::Object > | ObjectList |
typedef std::map< uint32, Engines::Witcher::Object * > | ObjectMap |
Private Member Functions | |
void | clear () |
void | loadARE (const Aurora::GFF3Struct &are) |
void | loadGIT (const Aurora::GFF3Struct &git) |
void | loadProperties (const Aurora::GFF3Struct &props) |
void | loadObject (Engines::Witcher::Object &object) |
void | loadWaypoints (const Aurora::GFF3List &list) |
void | loadPlaceables (const Aurora::GFF3List &list) |
void | loadDoors (const Aurora::GFF3List &list) |
void | loadModels () |
void | unloadModels () |
void | loadAreaModel () |
void | unloadAreaModel () |
void | checkActive (int x=-1, int y=-1) |
void | setActive (Engines::Witcher::Object *object) |
Engines::Witcher::Object * | getObjectAt (int x, int y) |
void | highlightAll (bool enabled) |
void | click (int x, int y) |
Private Attributes | |
Module * | _module |
Common::UString | _resRef |
The area's resref (resource ID). More... | |
uint32 | _musicDayTrack |
Music track ID that plays by day. More... | |
uint32 | _musicNightTrack |
Music track ID that plays by night. More... | |
uint32 | _musicBattleTrack |
Music track ID that plays in battle. More... | |
Common::UString | _musicDay |
Music that plays by day. More... | |
Common::UString | _musicNight |
Music that plays by night. More... | |
Common::UString | _musicBattle |
Music that plays in battle. More... | |
bool | _visible |
Is the area currently visible? More... | |
Sound::ChannelHandle | _ambientMusic |
Sound handle of the currently playing music. More... | |
Common::UString | _modelName |
Name of area geometry ("tile") model. More... | |
Common::ScopedPtr< Graphics::Aurora::Model > | _model |
The actual area geometry model. More... | |
ObjectList | _objects |
List of all objects in the area. More... | |
ObjectMap | _objectMap |
Map of all non-static objects in the area. More... | |
Engines::Witcher::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 | |
Protected Attributes inherited from Engines::Witcher::Object | |
ObjectType | _type |
The object's type. More... | |
Common::UString | _uniqueID |
A globally unique ID. More... | |
Aurora::LocString | _name |
The object's name. More... | |
Aurora::LocString | _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... | |
std::list< uint32 > | _ids |
The object's model IDs. More... | |
Area * | _area |
The area the object is currently in. More... | |
float | _position [3] |
The object's position. More... | |
float | _orientation [4] |
The object's orientation. More... | |
Sound::ChannelHandle | _sound |
The currently playing object sound. More... | |
Protected Attributes inherited from Aurora::NWScript::Object | |
uint32 | _id |
Common::UString | _tag |
An area in The Witcher, holding all objects and area geometry 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.
|
private |
|
private |
Engines::Witcher::Area::Area | ( | Module & | module, |
const Common::UString & | resRef | ||
) |
Definition at line 53 of file area.cpp.
References _module, _resRef, Engines::Witcher::ObjectContainer::addObject(), clear(), Aurora::GFF3File::getTopLevel(), Aurora::kFileTypeARE, Aurora::kFileTypeGIT, loadARE(), loadGIT(), and MKTAG.
Engines::Witcher::Area::~Area | ( | ) |
Definition at line 75 of file area.cpp.
References _module, clear(), hide(), removeFocus(), and Engines::Witcher::ObjectContainer::removeObject().
void Engines::Witcher::Area::addEvent | ( | const Events::Event & | event | ) |
Add a single event for consideration into the area event queue.
Definition at line 331 of file area.cpp.
References _eventQueue.
Referenced by Engines::Witcher::Module::handleEvents().
|
private |
Definition at line 387 of file area.cpp.
References _highlightAll, _mutex, CursorMan, getObjectAt(), and setActive().
Referenced by notifyCameraMoved(), and processEventQueue().
|
private |
Definition at line 85 of file area.cpp.
References _model, _module, _objects, Common::PtrList< T, Deallocator >::clear(), Engines::Witcher::ObjectContainer::removeObject(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by Area(), and ~Area().
|
private |
Definition at line 399 of file area.cpp.
References _module, _mutex, Engines::Witcher::Object::click(), getObjectAt(), and Engines::Witcher::Module::getPC().
Referenced by processEventQueue().
uint32 Engines::Witcher::Area::getMusicBattleTrack | ( | ) | const |
Return the music track ID playing in battle.
Definition at line 132 of file area.cpp.
References _musicBattleTrack.
uint32 Engines::Witcher::Area::getMusicDayTrack | ( | ) | const |
Return the music track ID playing by day.
Definition at line 124 of file area.cpp.
References _musicDayTrack.
Referenced by Engines::Witcher::Functions::musicBackgroundGetDayTrack().
uint32 Engines::Witcher::Area::getMusicNightTrack | ( | ) | const |
Return the music track ID playing by night.
Definition at line 128 of file area.cpp.
References _musicNightTrack.
Referenced by Engines::Witcher::Functions::musicBackgroundGetNightTrack().
const Aurora::LocString & Engines::Witcher::Area::getName | ( | ) | const |
Return the area's name.
Definition at line 115 of file area.cpp.
References Engines::Witcher::Object::getName().
Referenced by Engines::Witcher::Console::cmdListAreas(), and Engines::Witcher::Module::enterArea().
|
static |
Return the name of an area.
Definition at line 96 of file area.cpp.
References Aurora::GFF3Struct::getLocString(), Aurora::GFF3File::getTopLevel(), Aurora::kFileTypeARE, and MKTAG.
|
private |
Definition at line 362 of file area.cpp.
References _objectMap, Graphics::Renderable::getID(), and GfxMan.
Referenced by checkActive(), and click().
const Common::UString & Engines::Witcher::Area::getResRef | ( | ) | const |
Return the area's resref (resource ID).
Definition at line 111 of file area.cpp.
References _resRef.
Referenced by Engines::Witcher::Module::enterArea(), Engines::Witcher::Module::getObjectLocation(), Engines::Witcher::Functions::jumpTo(), and Engines::Witcher::Module::movedPC().
|
virtual |
Hide the area.
Reimplemented from Engines::Witcher::Object.
Definition at line 191 of file area.cpp.
References _model, _objects, _visible, GfxMan, removeFocus(), stopAmbientMusic(), and unloadModels().
Referenced by Engines::Witcher::Module::enterArea(), and ~Area().
|
private |
Definition at line 409 of file area.cpp.
References _highlightAll, and _objectMap.
Referenced by processEventQueue().
|
private |
Definition at line 216 of file area.cpp.
References _modelName, Engines::Witcher::Object::_name, Aurora::NWScript::Object::_tag, Aurora::GFF3Struct::getLocString(), Aurora::GFF3Struct::getString(), Aurora::GFF3Struct::getStruct(), Aurora::GFF3Struct::hasField(), loadProperties(), Engines::Witcher::ScriptContainer::readScripts(), and refreshLocalized().
Referenced by Area().
|
private |
Definition at line 285 of file area.cpp.
References _model, _modelName, Common::UString::c_str(), Common::UString::empty(), Engines::loadModelObject(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by loadModels().
|
private |
Definition at line 323 of file area.cpp.
References _module, and loadObject().
Referenced by loadGIT().
|
private |
Definition at line 239 of file area.cpp.
References Aurora::GFF3Struct::getList(), Aurora::GFF3Struct::hasField(), loadDoors(), loadPlaceables(), and loadWaypoints().
Referenced by Area().
|
private |
Definition at line 259 of file area.cpp.
References _objectMap, _objects, Engines::Witcher::Object::isStatic(), loadAreaModel(), and Engines::Witcher::Object::loadModel().
Referenced by show().
|
private |
Definition at line 300 of file area.cpp.
References _module, _objects, and Engines::Witcher::ObjectContainer::addObject().
Referenced by loadDoors(), loadPlaceables(), and loadWaypoints().
|
private |
Definition at line 315 of file area.cpp.
References loadObject().
Referenced by loadGIT().
|
private |
Definition at line 253 of file area.cpp.
References Aurora::GFF3Struct::getUint(), Aurora::kStrRefInvalid, setMusicBattleTrack(), setMusicDayTrack(), and setMusicNightTrack().
Referenced by loadARE().
|
private |
Definition at line 307 of file area.cpp.
References loadObject().
Referenced by loadGIT().
|
protectedvirtual |
Notify the area that the camera has been moved.
Reimplemented from Events::Notifyable.
Definition at line 427 of file area.cpp.
References checkActive().
void Engines::Witcher::Area::playAmbientMusic | ( | Common::UString | music = "" | ) |
Play the specified music (or the area's default) as ambient music.
Definition at line 155 of file area.cpp.
References _ambientMusic, _musicDay, Common::UString::empty(), Sound::kSoundTypeMusic, Engines::playSound(), and stopAmbientMusic().
Referenced by Engines::Witcher::Functions::musicBackgroundPlay(), Engines::Witcher::Game::playMusic(), and show().
void Engines::Witcher::Area::processEventQueue | ( | ) |
Process the current event queue.
Definition at line 335 of file area.cpp.
References _eventQueue, checkActive(), click(), highlightAll(), Events::kEventKeyDown, Events::kEventKeyUp, Events::kEventMouseDown, and Events::kEventMouseMove.
Referenced by Engines::Witcher::Module::handleEvents().
|
virtual |
Refresh all localized strings.
Reimplemented from Engines::Witcher::Object.
Definition at line 119 of file area.cpp.
References _objects.
Referenced by loadARE().
void Engines::Witcher::Area::removeFocus | ( | ) |
Forcibly remove the focus from the currently highlighted object.
Definition at line 420 of file area.cpp.
References _activeObject, and Engines::Witcher::Object::leave().
Referenced by hide(), and ~Area().
|
private |
Definition at line 374 of file area.cpp.
References _activeObject, Engines::Witcher::Object::enter(), and Engines::Witcher::Object::leave().
Referenced by checkActive().
void Engines::Witcher::Area::setMusicBattleTrack | ( | uint32 | track | ) |
Set the music track ID playing in battle.
Definition at line 146 of file area.cpp.
References _musicBattle, _musicBattleTrack, and TwoDAReg.
Referenced by loadProperties().
void Engines::Witcher::Area::setMusicDayTrack | ( | uint32 | track | ) |
Set the music track ID playing by day.
Definition at line 136 of file area.cpp.
References _musicDay, _musicDayTrack, and TwoDAReg.
Referenced by loadProperties(), and Engines::Witcher::Functions::musicBackgroundChangeDay().
void Engines::Witcher::Area::setMusicNightTrack | ( | uint32 | track | ) |
Set the music track ID playing by night.
Definition at line 141 of file area.cpp.
References _musicNight, _musicNightTrack, and TwoDAReg.
Referenced by loadProperties(), and Engines::Witcher::Functions::musicBackgroundChangeNight().
|
virtual |
Show the area.
Reimplemented from Engines::Witcher::Object.
Definition at line 168 of file area.cpp.
References _model, _objects, _visible, GfxMan, loadModels(), and playAmbientMusic().
Referenced by Engines::Witcher::Module::enterArea().
void Engines::Witcher::Area::stopAmbientMusic | ( | ) |
Stop the ambient music.
Definition at line 151 of file area.cpp.
References _ambientMusic, and SoundMan.
Referenced by hide(), Engines::Witcher::Functions::musicBackgroundStop(), playAmbientMusic(), and Engines::Witcher::Game::stopMusic().
|
private |
Definition at line 296 of file area.cpp.
References _model, and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by unloadModels().
|
private |
Definition at line 276 of file area.cpp.
References _objectMap, _objects, and unloadAreaModel().
Referenced by hide().
|
private |
The currently active (highlighted) object.
Definition at line 146 of file area.h.
Referenced by removeFocus(), and setActive().
|
private |
Sound handle of the currently playing music.
Definition at line 137 of file area.h.
Referenced by playAmbientMusic(), and stopAmbientMusic().
|
private |
The event queue.
Definition at line 150 of file area.h.
Referenced by addEvent(), and processEventQueue().
|
private |
Are we currently highlighting all objects?
Definition at line 148 of file area.h.
Referenced by checkActive(), and highlightAll().
|
private |
The actual area geometry model.
Definition at line 140 of file area.h.
Referenced by clear(), hide(), loadAreaModel(), show(), and unloadAreaModel().
|
private |
Name of area geometry ("tile") model.
Definition at line 139 of file area.h.
Referenced by loadARE(), and loadAreaModel().
|
private |
Definition at line 123 of file area.h.
Referenced by Area(), clear(), click(), loadDoors(), loadObject(), and ~Area().
|
private |
Music that plays in battle.
Definition at line 133 of file area.h.
Referenced by setMusicBattleTrack().
|
private |
Music track ID that plays in battle.
Definition at line 129 of file area.h.
Referenced by getMusicBattleTrack(), and setMusicBattleTrack().
|
private |
Music that plays by day.
Definition at line 131 of file area.h.
Referenced by playAmbientMusic(), and setMusicDayTrack().
|
private |
Music track ID that plays by day.
Definition at line 127 of file area.h.
Referenced by getMusicDayTrack(), and setMusicDayTrack().
|
private |
Music that plays by night.
Definition at line 132 of file area.h.
Referenced by setMusicNightTrack().
|
private |
Music track ID that plays by night.
Definition at line 128 of file area.h.
Referenced by getMusicNightTrack(), and setMusicNightTrack().
|
private |
Mutex securing access to the area.
Definition at line 152 of file area.h.
Referenced by checkActive(), and click().
|
private |
Map of all non-static objects in the area.
Definition at line 143 of file area.h.
Referenced by getObjectAt(), highlightAll(), loadModels(), and unloadModels().
|
private |
List of all objects in the area.
Definition at line 142 of file area.h.
Referenced by clear(), hide(), loadModels(), loadObject(), refreshLocalized(), show(), and unloadModels().
|
private |
The area's resref (resource ID).
Definition at line 125 of file area.h.
Referenced by Area(), and getResRef().
|
private |