xoreos
0.0.5
|
An object within a NWN2 area. More...
#include <object.h>
Public Member Functions | |
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... | |
virtual void | show () |
Show the object's model(s). More... | |
virtual void | hide () |
Hide the object's model(s). More... | |
const std::list< uint32 > & | getIDs () const |
Return the object's model IDs. More... | |
const Common::UString & | getName () const |
Return the object's name. More... | |
const Common::UString & | getDescription () const |
Return the object's description. More... | |
const Common::UString & | getConversation () const |
Return the object's default conversation (DLG). More... | |
const Aurora::SSFFile * | getSSF () |
Return the object's sound set. 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::NWN2::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()) |
Protected Member Functions | |
void | loadSSF () |
Load the object's sound set. More... | |
void | readVarTable (const Aurora::GFF3List &varTable) |
Read the object's variable table. More... | |
void | readVarTable (const Aurora::GFF3Struct &gff) |
Protected Member Functions inherited from Engines::NWN2::ScriptContainer | |
void | clearScripts () |
void | readScripts (const Aurora::GFF3Struct &gff) |
void | readScripts (const ScriptContainer &container) |
Protected Attributes | |
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... | |
uint32 | _soundSet |
The object's sound set, as an index into soundset.2da. More... | |
Common::ScopedPtr< Aurora::SSFFile > | _ssf |
The object's sound set. 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 |
Additional Inherited Members | |
Static Public Member Functions inherited from Engines::NWN2::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()) |
Engines::NWN2::Object::Object | ( | ObjectType | type = kObjectTypeInvalid | ) |
Definition at line 53 of file object.cpp.
References Aurora::NWScript::Object::_id, _orientation, _position, Common::generateIDNumber(), and ObjectMan.
|
virtual |
Reimplemented from Aurora::NWScript::Object.
Definition at line 68 of file object.cpp.
References ObjectMan.
|
virtual |
The object was clicked.
Reimplemented in Engines::NWN2::Creature, Engines::NWN2::Placeable, and Engines::NWN2::Door.
Definition at line 178 of file object.cpp.
Referenced by Engines::NWN2::Area::click().
|
virtual |
The cursor entered the object.
Reimplemented in Engines::NWN2::Creature, Engines::NWN2::Placeable, and Engines::NWN2::Door.
Definition at line 169 of file object.cpp.
Referenced by Engines::NWN2::Module::replaceModule(), and Engines::NWN2::Area::setActive().
Area * Engines::NWN2::Object::getArea | ( | ) | const |
Return the area this object is currently in.
Definition at line 122 of file object.cpp.
References _area.
Referenced by Engines::NWN2::Door::click(), Engines::NWN2::Functions::getArea(), Engines::NWN2::Functions::getNearestCreature(), Engines::NWN2::Functions::getNearestObject(), Engines::NWN2::Functions::getNearestObjectByTag(), Engines::NWN2::Functions::jumpTo(), and Engines::NWN2::Module::movedPC().
const Common::UString & Engines::NWN2::Object::getConversation | ( | ) | const |
Return the object's default conversation (DLG).
Definition at line 96 of file object.cpp.
References _conversation.
const Common::UString & Engines::NWN2::Object::getDescription | ( | ) | const |
Return the object's description.
Definition at line 92 of file object.cpp.
References _description.
Referenced by Engines::NWN2::Module::getDescription().
const std::list< uint32 > & Engines::NWN2::Object::getIDs | ( | ) | const |
Location Engines::NWN2::Object::getLocation | ( | ) | const |
Create a Location out of the object's area, position and orientation.
Definition at line 130 of file object.cpp.
References _area, _position, Engines::NWN2::Location::setArea(), Engines::NWN2::Location::setFacing(), and Engines::NWN2::Location::setPosition().
const Common::UString & Engines::NWN2::Object::getName | ( | ) | const |
Return the object's name.
Definition at line 88 of file object.cpp.
References _name.
Referenced by Engines::NWN2::Module::enter(), Engines::NWN2::Module::getName(), Engines::NWN2::Area::getName(), Engines::NWN2::Functions::sendMessageToPC(), and speakString().
|
virtual |
Return the object's orientation.
Definition at line 148 of file object.cpp.
References _orientation.
Referenced by Engines::NWN2::Situated::loadModel(), Engines::NWN2::Creature::loadModel(), Engines::NWN2::Situated::setOrientation(), and Engines::NWN2::Creature::setOrientation().
|
virtual |
Return the object's position within its area.
Definition at line 142 of file object.cpp.
References _position.
Referenced by Engines::NWN2::Door::click(), Engines::NWN2::ObjectDistanceSort::getDistance(), Engines::NWN2::Functions::getDistanceToObject(), Engines::NWN2::Situated::loadModel(), Engines::NWN2::Creature::loadModel(), Engines::NWN2::Module::movedPC(), Engines::NWN2::Module::movePC(), Engines::NWN2::ObjectDistanceSort::ObjectDistanceSort(), Engines::NWN2::Situated::setPosition(), and Engines::NWN2::Creature::setPosition().
const Aurora::SSFFile * Engines::NWN2::Object::getSSF | ( | ) |
Return the object's sound set.
Definition at line 100 of file object.cpp.
References _ssf, Common::ScopedPtrBase< T, Deallocator >::get(), and loadSSF().
ObjectType Engines::NWN2::Object::getType | ( | ) | const |
Return the exact type of the object.
Definition at line 72 of file object.cpp.
References _type.
Referenced by Engines::NWN2::Functions::getNearestObject(), Engines::NWN2::Functions::getObjectType(), and Engines::NWN2::Functions::getParamObject().
|
virtual |
Hide the object's model(s).
Reimplemented in Engines::NWN2::Area, Engines::NWN2::Creature, Engines::NWN2::Door, Engines::NWN2::Placeable, and Engines::NWN2::Situated.
Definition at line 85 of file object.cpp.
Referenced by Engines::NWN2::Waypoint::~Waypoint().
|
virtual |
(Un)Highlight the object.
Reimplemented in Engines::NWN2::Creature, Engines::NWN2::Placeable, and Engines::NWN2::Door.
Definition at line 175 of file object.cpp.
bool Engines::NWN2::Object::isClickable | ( | ) | const |
Can the player click the object?
Definition at line 114 of file object.cpp.
References _static, and _usable.
Referenced by Engines::NWN2::Situated::loadModel(), and Engines::NWN2::Creature::loadModel().
bool Engines::NWN2::Object::isStatic | ( | ) | const |
Is the object static (not manipulable at all)?
Definition at line 106 of file object.cpp.
References _static.
Referenced by Engines::NWN2::Area::loadModels().
bool Engines::NWN2::Object::isUsable | ( | ) | const |
|
virtual |
The cursor left the object.
Reimplemented in Engines::NWN2::Creature, Engines::NWN2::Module, Engines::NWN2::Placeable, and Engines::NWN2::Door.
Definition at line 172 of file object.cpp.
Referenced by Engines::NWN2::Area::removeFocus(), and Engines::NWN2::Area::setActive().
|
virtual |
Load the object's model(s).
Reimplemented in Engines::NWN2::Creature, and Engines::NWN2::Situated.
Definition at line 76 of file object.cpp.
Referenced by Engines::NWN2::Area::loadModels().
|
protected |
Load the object's sound set.
Definition at line 182 of file object.cpp.
References _soundSet, _ssf, Aurora::NWScript::Object::_tag, Common::UString::c_str(), Common::UString::empty(), Common::exceptionDispatcherWarning(), Aurora::TwoDAFile::getRow(), Aurora::TwoDARow::getString(), Aurora::kFieldIDInvalid, Common::ScopedPtrBase< T, Deallocator >::reset(), and TwoDAReg.
Referenced by getSSF().
void Engines::NWN2::Object::playSound | ( | const Common::UString & | sound, |
bool | pitchVariance = false |
||
) |
Play an object sound.
Definition at line 284 of file object.cpp.
References _sound, Common::UString::empty(), Sound::kSoundTypeVoice, Engines::playSound(), and stopSound().
Referenced by Engines::NWN2::Placeable::activate(), Engines::NWN2::Placeable::click(), Engines::NWN2::Door::close(), Engines::NWN2::Placeable::close(), Engines::NWN2::Placeable::deactivate(), Engines::NWN2::Door::open(), Engines::NWN2::Placeable::open(), Engines::NWN2::Functions::playSound(), and speakOneLiner().
|
protected |
Read the object's variable table.
Definition at line 200 of file object.cpp.
References Common::UString::c_str(), Common::UString::empty(), Aurora::NWScript::VariableContainer::setVariable(), and warning().
Referenced by Engines::NWN2::Area::loadARE(), Engines::NWN2::Module::loadModule(), Engines::NWN2::Waypoint::loadProperties(), Engines::NWN2::Situated::loadProperties(), Engines::NWN2::Creature::loadProperties(), and readVarTable().
|
protected |
Definition at line 240 of file object.cpp.
References Aurora::GFF3Struct::getList(), Aurora::GFF3Struct::hasField(), and readVarTable().
void Engines::NWN2::Object::setArea | ( | Area * | area | ) |
Set the area this object is currently in.
Definition at line 126 of file object.cpp.
References _area.
Referenced by Engines::NWN2::Module::enterArea(), and Engines::NWN2::Module::movePC().
|
virtual |
Set the object's orientation.
Reimplemented in Engines::NWN2::Creature, and Engines::NWN2::Situated.
Definition at line 162 of file object.cpp.
References _orientation.
Referenced by Engines::NWN2::Waypoint::load(), Engines::NWN2::Situated::setOrientation(), and Engines::NWN2::Creature::setOrientation().
|
virtual |
Set the object's position within its area.
Reimplemented in Engines::NWN2::Creature, and Engines::NWN2::Situated.
Definition at line 156 of file object.cpp.
References _position.
Referenced by Engines::NWN2::Waypoint::load(), Engines::NWN2::Situated::setPosition(), and Engines::NWN2::Creature::setPosition().
|
virtual |
Show the object's model(s).
Reimplemented in Engines::NWN2::Area, Engines::NWN2::Creature, Engines::NWN2::Door, Engines::NWN2::Placeable, and Engines::NWN2::Situated.
Definition at line 82 of file object.cpp.
void Engines::NWN2::Object::speakOneLiner | ( | Common::UString | conv, |
Object * | tokenTarget = 0 |
||
) |
Speak an one-liner from the specified conversation file.
Definition at line 251 of file object.cpp.
References _conversation, Common::UString::c_str(), Common::UString::empty(), Common::exceptionDispatcherWarning(), Aurora::DLGFile::getOneLiner(), Aurora::LocString::getString(), playSound(), Aurora::DLGFile::Line::sound, speakString(), and Aurora::DLGFile::Line::text.
void Engines::NWN2::Object::speakString | ( | const Common::UString & | string, |
uint32 | volume | ||
) |
Speak the specified string.
Definition at line 245 of file object.cpp.
References getName(), and status().
Referenced by Engines::NWN2::Functions::actionSpeakString(), speakOneLiner(), and Engines::NWN2::Functions::speakString().
void Engines::NWN2::Object::stopSound | ( | ) |
Stop the current object sound.
Definition at line 280 of file object.cpp.
References _sound, and SoundMan.
Referenced by playSound().
|
virtual |
Unload the object's model(s).
Reimplemented in Engines::NWN2::Creature, and Engines::NWN2::Situated.
Definition at line 79 of file object.cpp.
|
protected |
The area the object is currently in.
Definition at line 160 of file object.h.
Referenced by getArea(), getLocation(), and setArea().
|
protected |
The object's default conversation.
Definition at line 150 of file object.h.
Referenced by getConversation(), Engines::NWN2::Situated::loadProperties(), Engines::NWN2::Creature::loadProperties(), and speakOneLiner().
|
protected |
The object's description.
Definition at line 148 of file object.h.
Referenced by getDescription(), Engines::NWN2::Situated::loadProperties(), and Engines::NWN2::Creature::loadProperties().
|
protected |
The object's model IDs.
Definition at line 158 of file object.h.
Referenced by getIDs(), Engines::NWN2::Situated::loadModel(), and Engines::NWN2::Creature::loadModel().
|
protected |
The object's display name.
Definition at line 147 of file object.h.
Referenced by Engines::NWN2::Module::enter(), getName(), Engines::NWN2::Area::loadARE(), Engines::NWN2::Creature::loadCharacter(), Engines::NWN2::Situated::loadModel(), Engines::NWN2::Module::loadModule(), Engines::NWN2::Situated::loadProperties(), and Engines::NWN2::Creature::loadProperties().
|
protected |
The object's orientation.
Definition at line 163 of file object.h.
Referenced by getOrientation(), Object(), and setOrientation().
|
protected |
The object's position.
Definition at line 162 of file object.h.
Referenced by getLocation(), getPosition(), Object(), and setPosition().
|
protected |
The currently playing object sound.
Definition at line 165 of file object.h.
Referenced by playSound(), and stopSound().
|
protected |
The object's sound set, as an index into soundset.2da.
Definition at line 152 of file object.h.
Referenced by Engines::NWN2::Creature::loadProperties(), and loadSSF().
|
protected |
|
protected |
Is the object static?
Definition at line 155 of file object.h.
Referenced by Engines::NWN2::Creature::init(), isClickable(), isStatic(), and Engines::NWN2::Situated::loadProperties().
|
protected |
|
protected |
Is the object usable?
Definition at line 156 of file object.h.
Referenced by Engines::NWN2::Creature::init(), isClickable(), isUsable(), and Engines::NWN2::Situated::loadProperties().