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

#include <placeable.h>

Inheritance diagram for Engines::NWN::Placeable:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN::Placeable:
Collaboration graph
[legend]

Public Types

enum  State {
  kStateDefault = 0, kStateOpen = 1, kStateClosed = 2, kStateDestroyed = 3,
  kStateActivated = 4, kStateDeactivated = 5
}
 The state of a placeable. More...
 

Public Member Functions

 Placeable (const Aurora::GFF3Struct &placeable)
 Load from a placeable instance. More...
 
 ~Placeable ()
 
void show ()
 Show the placeable's model. More...
 
void hide ()
 Hide the placeable's model. More...
 
bool isOpen () const
 Is the placeable open? More...
 
bool isActivated () const
 Is the placeable activated? More...
 
bool open (Object *opener)
 The opener object opens this placeable. More...
 
bool close (Object *closer)
 The closer object closes this placeable. More...
 
bool activate (Object *opener)
 The user object activates this placeable. More...
 
bool deactivate (Object *closer)
 The user object deactivates this placeable. More...
 
void enter ()
 The cursor entered the placeable. More...
 
void leave ()
 The cursor left the placeable. More...
 
void highlight (bool enabled)
 (Un)Highlight the placeable. More...
 
bool click (Object *triggerer=0)
 The placeable was clicked. More...
 
void playAnimation (const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f)
 Play a placeable animation. More...
 
void playAnimation (Animation animation, bool restart=true, float length=0.0f, float speed=1.0f)
 Play a default placeable 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...
 
virtual void setLocked (bool locked)
 Lock/Unlock the situated object. More...
 
ObjectgetLastOpenedBy () const
 Return the object that last opened this situated object. More...
 
ObjectgetLastClosedBy () const
 Return the object that last closed this situated object. More...
 
ObjectgetLastUsedBy () 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::UStringgetName () const
 Return the object's name. More...
 
const Common::UStringgetDescription () const
 Return the object's description. More...
 
const Common::UStringgetPortrait () const
 Return the object's portrait. More...
 
const Common::UStringgetConversation () const
 Return the object's default conversation (DLG). More...
 
const Aurora::SSFFilegetSSF ()
 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::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...
 
AreagetArea () 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::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::NWN::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())
 

Protected Member Functions

void loadObject (const Aurora::GFF3Struct &gff)
 Load placeable-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 Member Functions

void load (const Aurora::GFF3Struct &placeable)
 Load from a placeable instance. More...
 
void setModelState ()
 Sync the model's state with the placeable's state. More...
 
const Common::UStringgetAnimationSound (Animation animation)
 

Private Attributes

State _state
 The current state of the placeable. More...
 
bool _hasInventory
 Does this placeable have an inventory? 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
 

Detailed Description

Definition at line 36 of file placeable.h.

Member Enumeration Documentation

◆ State

The state of a placeable.

Enumerator
kStateDefault 

Default.

kStateOpen 

Open.

kStateClosed 

Closed.

kStateDestroyed 

Destroyed.

kStateActivated 

Activated.

kStateDeactivated 

Deactivated.

Definition at line 39 of file placeable.h.

Constructor & Destructor Documentation

◆ Placeable()

Engines::NWN::Placeable::Placeable ( const Aurora::GFF3Struct placeable)

Load from a placeable instance.

Definition at line 42 of file placeable.cpp.

References load().

Here is the call graph for this function:

◆ ~Placeable()

Engines::NWN::Placeable::~Placeable ( )

Definition at line 48 of file placeable.cpp.

Member Function Documentation

◆ activate()

bool Engines::NWN::Placeable::activate ( Object opener)

The user object activates this placeable.

Definition at line 217 of file placeable.cpp.

References _hasInventory, Engines::NWN::Situated::_soundLocked, _state, isActivated(), Engines::NWN::Situated::isLocked(), Engines::NWN::kAnimationPlaceableActivate, Engines::NWN::kScriptUsed, kStateActivated, playAnimation(), Engines::NWN::Object::playSound(), and Engines::NWN::ScriptContainer::runScript().

Referenced by click().

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

◆ click()

bool Engines::NWN::Placeable::click ( Object triggerer = 0)
virtual

◆ close()

bool Engines::NWN::Placeable::close ( Object closer)

The closer object closes this placeable.

Definition at line 200 of file placeable.cpp.

References _hasInventory, Engines::NWN::Situated::_lastClosedBy, _state, isOpen(), Engines::NWN::kAnimationPlaceableClose, Engines::NWN::kScriptClosed, kStateClosed, playAnimation(), and Engines::NWN::ScriptContainer::runScript().

Referenced by click().

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

◆ deactivate()

bool Engines::NWN::Placeable::deactivate ( Object closer)

The user object deactivates this placeable.

Definition at line 237 of file placeable.cpp.

References _hasInventory, Engines::NWN::Situated::_soundLocked, _state, isActivated(), Engines::NWN::Situated::isLocked(), Engines::NWN::kAnimationPlaceableDeactivate, Engines::NWN::kScriptUsed, kStateDeactivated, playAnimation(), Engines::NWN::Object::playSound(), and Engines::NWN::ScriptContainer::runScript().

Referenced by click().

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

◆ enter()

void Engines::NWN::Placeable::enter ( )
virtual

The cursor entered the placeable.

Reimplemented from Engines::NWN::Object.

Definition at line 124 of file placeable.cpp.

References highlight().

Here is the call graph for this function:

◆ getAnimationSound()

const Common::UString & Engines::NWN::Placeable::getAnimationSound ( Animation  animation)
private

◆ hide()

void Engines::NWN::Placeable::hide ( )
virtual

Hide the placeable's model.

Reimplemented from Engines::NWN::Object.

Definition at line 103 of file placeable.cpp.

References Engines::NWN::Situated::hide(), and leave().

Here is the call graph for this function:

◆ highlight()

void Engines::NWN::Placeable::highlight ( bool  enabled)
virtual

(Un)Highlight the placeable.

Reimplemented from Engines::NWN::Object.

Definition at line 132 of file placeable.cpp.

References Engines::NWN::Situated::_model, Engines::NWN::Object::hideTooltip(), and Engines::NWN::Object::showFeedbackTooltip().

Referenced by enter(), and leave().

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

◆ isActivated()

bool Engines::NWN::Placeable::isActivated ( ) const

Is the placeable activated?

Definition at line 146 of file placeable.cpp.

References isOpen().

Referenced by activate(), click(), and deactivate().

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

◆ isOpen()

bool Engines::NWN::Placeable::isOpen ( ) const
virtual

Is the placeable open?

Implements Engines::NWN::Situated.

Definition at line 142 of file placeable.cpp.

References _state, kStateActivated, and kStateOpen.

Referenced by click(), close(), isActivated(), and open().

Here is the caller graph for this function:

◆ leave()

void Engines::NWN::Placeable::leave ( )
virtual

The cursor left the placeable.

Reimplemented from Engines::NWN::Object.

Definition at line 128 of file placeable.cpp.

References highlight().

Referenced by hide().

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

◆ load()

void Engines::NWN::Placeable::load ( const Aurora::GFF3Struct placeable)
private

Load from a placeable instance.

Definition at line 51 of file placeable.cpp.

References Common::UString::empty(), Aurora::GFF3Struct::getString(), Aurora::kFileTypeUTP, Engines::NWN::Situated::load(), Engines::loadOptionalGFF3(), MKTAG, and Common::ScopedPtrBase< T, Deallocator >::reset().

Referenced by Placeable().

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

◆ loadAppearance()

void Engines::NWN::Placeable::loadAppearance ( )
protectedvirtual

◆ loadObject()

void Engines::NWN::Placeable::loadObject ( const Aurora::GFF3Struct gff)
protectedvirtual

Load placeable-specific properties.

Implements Engines::NWN::Situated.

Definition at line 109 of file placeable.cpp.

References _hasInventory, _state, Aurora::GFF3Struct::getBool(), and Aurora::GFF3Struct::getUint().

Here is the call graph for this function:

◆ open()

bool Engines::NWN::Placeable::open ( Object opener)

◆ playAnimation() [1/2]

void Engines::NWN::Placeable::playAnimation ( const Common::UString animation = "",
bool  restart = true,
float  length = 0.0f,
float  speed = 1.0f 
)
virtual

Play a placeable animation.

Reimplemented from Engines::NWN::Object.

Definition at line 278 of file placeable.cpp.

References Engines::NWN::Object::playAnimation().

Referenced by activate(), close(), deactivate(), and open().

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

◆ playAnimation() [2/2]

void Engines::NWN::Placeable::playAnimation ( Animation  animation,
bool  restart = true,
float  length = 0.0f,
float  speed = 1.0f 
)
virtual

Play a default placeable animation.

Reimplemented from Engines::NWN::Object.

Definition at line 282 of file placeable.cpp.

References Engines::NWN::Situated::_model, getAnimationSound(), Engines::NWN::getPlaceableAnimationName(), Engines::NWN::isAnimationLooping(), and Engines::NWN::Object::playSound().

Here is the call graph for this function:

◆ setModelState()

void Engines::NWN::Placeable::setModelState ( )
private

Sync the model's state with the placeable's state.

Definition at line 61 of file placeable.cpp.

References Engines::NWN::Situated::_model, _state, kStateActivated, kStateClosed, kStateDeactivated, kStateDefault, kStateDestroyed, and kStateOpen.

Referenced by show().

Here is the caller graph for this function:

◆ show()

void Engines::NWN::Placeable::show ( )
virtual

Show the placeable's model.

Reimplemented from Engines::NWN::Object.

Definition at line 97 of file placeable.cpp.

References setModelState(), and Engines::NWN::Situated::show().

Here is the call graph for this function:

Member Data Documentation

◆ _hasInventory

bool Engines::NWN::Placeable::_hasInventory
private

Does this placeable have an inventory?

Definition at line 103 of file placeable.h.

Referenced by activate(), click(), close(), deactivate(), loadObject(), and open().

◆ _state

State Engines::NWN::Placeable::_state
private

The current state of the placeable.

Definition at line 101 of file placeable.h.

Referenced by activate(), click(), close(), deactivate(), isOpen(), loadObject(), open(), and setModelState().


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