xoreos
0.0.5
|
#include <door.h>
Public Types | |
enum | State { kStateClosed = 0, kStateOpened1 = 1, kStateOpened2 = 2, kStateDestroyed = 3 } |
The state of a door. More... | |
Public Member Functions | |
Door (Module &module, const Aurora::GFF3Struct &door) | |
Load from a door instance. More... | |
~Door () | |
void | show () |
Show the door's model. More... | |
void | hide () |
Hide the door's model. More... | |
bool | isOpen () const |
Is the door open? More... | |
bool | open (Object *opener) |
The opener object opens this door. More... | |
bool | close (Object *closer) |
The closer object closes this door. More... | |
void | setLocked (bool locked) |
Lock/Unlock the door. More... | |
void | enter () |
The cursor entered the door. More... | |
void | leave () |
The cursor left the door. More... | |
void | highlight (bool enabled) |
(Un)Highlight the door. More... | |
bool | click (Object *triggerer=0) |
The door was clicked. More... | |
void | playAnimation (const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f) |
Play a door animation. More... | |
void | playAnimation (Animation animation, bool restart=true, float length=0.0f, float speed=1.0f) |
Play a default door animation. More... | |
Public Member Functions inherited from Engines::NWN::Situated | |
~Situated () | |
void | loadModel () |
Load the situated object's model. More... | |
void | unloadModel () |
Unload the situated object's model. More... | |
void | show () |
Show the situated object's model. More... | |
void | hide () |
Hide the situated object's model. More... | |
bool | isLocked () const |
Is the situated object locked? More... | |
Object * | getLastOpenedBy () const |
Return the object that last opened this situated object. More... | |
Object * | getLastClosedBy () const |
Return the object that last closed this situated object. More... | |
Object * | getLastUsedBy () const |
Return the object that last used this situated object. More... | |
void | setPosition (float x, float y, float z) |
Set the situated object's position. More... | |
void | setOrientation (float x, float y, float z, float angle) |
Set the situated object's orientation. More... | |
Public Member Functions inherited from Engines::NWN::Object | |
Object (ObjectType type=kObjectTypeInvalid) | |
virtual | ~Object () |
ObjectType | getType () const |
Return the exact type of the object. 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 & | getPortrait () const |
Return the object's portrait. 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... | |
Aurora::NWScript::Object * | getPCSpeaker () 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... | |
Area * | getArea () const |
Return the area this object is currently in. More... | |
virtual 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... | |
Location | getLocation () const |
Create a Location out of the object's area, position and orientation. More... | |
virtual 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::NWN::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 | loadObject (const Aurora::GFF3Struct &gff) |
Load door-specific properties. More... | |
void | loadAppearance () |
Load appearance-specific properties. More... | |
Protected Member Functions inherited from Engines::NWN::Situated | |
Situated (ObjectType type) | |
void | load (const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint=0) |
Load the situated object from an instance and its blueprint. More... | |
Protected Member Functions inherited from Engines::NWN::Object | |
void | loadSSF () |
Load the object's sound set. More... | |
bool | beginConversation (Object *triggerer) |
Begin a conversation between the triggerer and this object. More... | |
bool | createFeedbackTooltip () |
Create a tooltip with the name and/or portrait of the object. More... | |
bool | createSpeechTooltip (const Common::UString &line) |
Create a tooltip with a line the object should speak. More... | |
void | destroyTooltip () |
Destroy all tooltips on this object. More... | |
bool | showFeedbackTooltip () |
Create and show a tooltip with the name and/or portrait of the object. More... | |
bool | showSpeechTooltip (const Common::UString &line) |
Create and show a tooltip with a line the object speaks. More... | |
void | hideTooltip () |
Hide the tooltip again. More... | |
Protected Member Functions inherited from Engines::NWN::ScriptContainer | |
void | clearScripts () |
void | readScripts (const Aurora::GFF3Struct &gff) |
void | readScripts (const ScriptContainer &container) |
Private Types | |
enum | LinkedToFlag { kLinkedToNothing = 0, kLinkedToDoor = 1, kLinkedToWaypoint = 2 } |
Private Member Functions | |
void | load (const Aurora::GFF3Struct &door) |
Load from a door instance. More... | |
void | loadAppearance (const Aurora::TwoDAFile &twoda, uint32 id) |
Load the appearance from this 2DA row. More... | |
void | setModelState () |
Sync the model's state with the door's state. More... | |
void | evaluateLink () |
Evaluate our link. More... | |
const Common::UString & | getAnimationSound (Animation animation) |
Private Attributes | |
Module * | _module |
The module the door is in. More... | |
bool | _invisible |
Is the door invisible? More... | |
uint32 | _genericType |
Index into the generic door types. More... | |
State | _state |
The current state of the door. More... | |
LinkedToFlag | _linkedToFlag |
Does this door link to anything? More... | |
Common::UString | _linkedTo |
The object tag this door links to. More... | |
bool | _evaluatedLink |
Have we already tried to evaluate our link? More... | |
Object * | _link |
The object this door links to. More... | |
Door * | _linkedDoor |
The door this door links to. More... | |
Waypoint * | _linkedWaypoint |
The waypoint this door links to. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Engines::NWN::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::NWN::Situated | |
Common::UString | _modelName |
The model's resource name. More... | |
uint32 | _appearanceID |
The index within the situated appearance 2DA. More... | |
uint32 | _soundAppType |
The index within the situated sounds 2DA. More... | |
bool | _locked |
Is the situated object locked? More... | |
Common::UString | _soundOpened |
The sound the object makes when opened. More... | |
Common::UString | _soundClosed |
The sound the object makes when closed. More... | |
Common::UString | _soundDestroyed |
The sound the object makes when destroyed. More... | |
Common::UString | _soundUsed |
The sound the object makes when used. More... | |
Common::UString | _soundLocked |
The sound the object makes when locked. More... | |
Object * | _lastOpenedBy |
The object that last opened this situated object. More... | |
Object * | _lastClosedBy |
The object that last closed this situated object. More... | |
Object * | _lastUsedBy |
The object that last used this situated object. More... | |
Common::ScopedPtr< Graphics::Aurora::Model > | _model |
The situated object's model. More... | |
Protected Attributes inherited from Engines::NWN::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 | _portrait |
The object's portrait. 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... | |
Aurora::NWScript::Object * | _pcSpeaker |
The current PC speaking with the object. 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... | |
Common::ScopedPtr< Tooltip > | _tooltip |
The tooltip displayed over the object. More... | |
Protected Attributes inherited from Aurora::NWScript::Object | |
uint32 | _id |
Common::UString | _tag |
|
private |
Engines::NWN::Door::Door | ( | Module & | module, |
const Aurora::GFF3Struct & | door | ||
) |
|
virtual |
The door was clicked.
Reimplemented from Engines::NWN::Object.
Definition at line 184 of file door.cpp.
References Engines::NWN::Situated::_lastUsedBy, _link, _module, close(), evaluateLink(), Engines::NWN::Object::getArea(), Engines::NWN::Object::getPosition(), Engines::NWN::ScriptContainer::hasScript(), isOpen(), Engines::NWN::kScriptClick, Engines::NWN::Module::movePC(), open(), and Engines::NWN::ScriptContainer::runScript().
bool Engines::NWN::Door::close | ( | Object * | closer | ) |
The closer object closes this door.
Definition at line 235 of file door.cpp.
References _invisible, Engines::NWN::Situated::_lastClosedBy, _linkedDoor, _state, close(), evaluateLink(), isOpen(), Engines::NWN::kAnimationDoorClose, Engines::NWN::kScriptClosed, kStateClosed, kStateDestroyed, playAnimation(), and Engines::NWN::ScriptContainer::runScript().
Referenced by Engines::NWN::Functions::actionCloseDoor(), click(), and close().
|
virtual |
The cursor entered the door.
Reimplemented from Engines::NWN::Object.
Definition at line 153 of file door.cpp.
References _link, CursorMan, evaluateLink(), highlight(), and isOpen().
|
private |
Evaluate our link.
Definition at line 261 of file door.cpp.
References _evaluatedLink, _link, _linkedDoor, _linkedTo, _linkedToFlag, _linkedWaypoint, _module, Common::UString::empty(), Aurora::NWScript::ObjectContainer::getFirstObjectByTag(), kLinkedToDoor, and kLinkedToWaypoint.
Referenced by click(), close(), enter(), open(), and setLocked().
|
private |
Definition at line 277 of file door.cpp.
References Engines::NWN::Situated::_soundClosed, Engines::NWN::Situated::_soundDestroyed, Engines::NWN::Situated::_soundOpened, Engines::NWN::kAnimationDoorClose, Engines::NWN::kAnimationDoorDestroy, Engines::NWN::kAnimationDoorOpen1, and Engines::NWN::kAnimationDoorOpen2.
Referenced by playAnimation().
|
virtual |
Hide the door's model.
Reimplemented from Engines::NWN::Object.
Definition at line 147 of file door.cpp.
References Engines::NWN::Situated::hide(), and leave().
|
virtual |
(Un)Highlight the door.
Reimplemented from Engines::NWN::Object.
Definition at line 168 of file door.cpp.
References Engines::NWN::Situated::_model.
Referenced by enter(), and leave().
|
virtual |
Is the door open?
Implements Engines::NWN::Situated.
Definition at line 257 of file door.cpp.
References _state, kStateOpened1, and kStateOpened2.
Referenced by click(), close(), enter(), and open().
|
virtual |
The cursor left the door.
Reimplemented from Engines::NWN::Object.
Definition at line 163 of file door.cpp.
References CursorMan, and highlight().
Referenced by hide().
|
private |
Load from a door instance.
Definition at line 56 of file door.cpp.
References Common::UString::empty(), Aurora::GFF3Struct::getString(), Aurora::kFileTypeUTD, Engines::NWN::Situated::load(), Engines::loadOptionalGFF3(), MKTAG, Common::ScopedPtrBase< T, Deallocator >::reset(), and setModelState().
Referenced by Door().
|
protectedvirtual |
Load appearance-specific properties.
Implements Engines::NWN::Situated.
Definition at line 83 of file door.cpp.
References Engines::NWN::Situated::_appearanceID, _genericType, _invisible, Engines::NWN::Situated::_modelName, Engines::NWN::Object::_portrait, _state, Common::UString::clear(), Common::UString::empty(), Aurora::kFieldIDInvalid, kStateOpened1, and TwoDAReg.
|
private |
Load the appearance from this 2DA row.
Definition at line 103 of file door.cpp.
References _invisible, Engines::NWN::Situated::_modelName, Engines::NWN::Situated::_soundAppType, Aurora::TwoDARow::getInt(), Aurora::TwoDAFile::getRow(), Aurora::TwoDARow::getString(), Aurora::TwoDAFile::headerToColumn(), and Aurora::kFieldIDInvalid.
|
protectedvirtual |
Load door-specific properties.
Implements Engines::NWN::Situated.
Definition at line 68 of file door.cpp.
References _genericType, _linkedTo, _linkedToFlag, _state, Aurora::GFF3Struct::getString(), and Aurora::GFF3Struct::getUint().
bool Engines::NWN::Door::open | ( | Object * | opener | ) |
The opener object opens this door.
Definition at line 208 of file door.cpp.
References Engines::NWN::Situated::_lastOpenedBy, _linkedDoor, Engines::NWN::Situated::_soundLocked, _state, evaluateLink(), Engines::NWN::Situated::isLocked(), isOpen(), Engines::NWN::kAnimationDoorOpen1, Engines::NWN::kScriptFailToOpen, Engines::NWN::kScriptOpen, kStateDestroyed, kStateOpened1, open(), playAnimation(), Engines::NWN::Object::playSound(), and Engines::NWN::ScriptContainer::runScript().
Referenced by Engines::NWN::Functions::actionOpenDoor(), click(), and open().
|
virtual |
Play a door animation.
Reimplemented from Engines::NWN::Object.
Definition at line 300 of file door.cpp.
References Engines::NWN::Object::playAnimation().
Referenced by close(), and open().
|
virtual |
Play a default door animation.
Reimplemented from Engines::NWN::Object.
Definition at line 304 of file door.cpp.
References Engines::NWN::Situated::_model, _state, getAnimationSound(), Engines::NWN::getDoorAnimationName(), Engines::NWN::isAnimationLooping(), kStateOpened2, and Engines::NWN::Object::playSound().
|
virtual |
Lock/Unlock the door.
Reimplemented from Engines::NWN::Situated.
Definition at line 173 of file door.cpp.
References _linkedDoor, evaluateLink(), Engines::NWN::Situated::isLocked(), Engines::NWN::Situated::setLocked(), and setLocked().
Referenced by setLocked().
|
private |
Sync the model's state with the door's state.
Definition at line 113 of file door.cpp.
References Engines::NWN::Situated::_model, _state, kStateClosed, kStateDestroyed, kStateOpened1, and kStateOpened2.
Referenced by load(), and show().
|
virtual |
Show the door's model.
Reimplemented from Engines::NWN::Object.
Definition at line 141 of file door.cpp.
References setModelState(), and Engines::NWN::Situated::show().
|
private |
Have we already tried to evaluate our link?
Definition at line 116 of file door.h.
Referenced by evaluateLink().
|
private |
Index into the generic door types.
Definition at line 109 of file door.h.
Referenced by loadAppearance(), and loadObject().
|
private |
Is the door invisible?
Definition at line 107 of file door.h.
Referenced by close(), and loadAppearance().
|
private |
The object this door links to.
Definition at line 117 of file door.h.
Referenced by click(), enter(), and evaluateLink().
|
private |
The door this door links to.
Definition at line 118 of file door.h.
Referenced by close(), evaluateLink(), open(), and setLocked().
|
private |
The object tag this door links to.
Definition at line 114 of file door.h.
Referenced by evaluateLink(), and loadObject().
|
private |
Does this door link to anything?
Definition at line 113 of file door.h.
Referenced by evaluateLink(), and loadObject().
|
private |
The waypoint this door links to.
Definition at line 119 of file door.h.
Referenced by evaluateLink().
|
private |
The module the door is in.
Definition at line 105 of file door.h.
Referenced by click(), and evaluateLink().
|
private |
The current state of the door.
Definition at line 111 of file door.h.
Referenced by close(), isOpen(), loadAppearance(), loadObject(), open(), playAnimation(), and setModelState().