xoreos
0.0.5
|
#include <placeable.h>
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 | 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... | |
bool | hasInventory () |
Inventory & | getInventory () |
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... | |
Public Member Functions inherited from Engines::KotOR::Situated | |
~Situated () | |
void | show () |
Show the situated object's model. More... | |
void | hide () |
Hide the situated object's model. More... | |
bool | isVisible () const |
Is the situated object's model visible? More... | |
bool | isLocked () const |
Is the situated object locked? More... | |
virtual void | setLocked (bool locked) |
Lock/Unlock the situated object. 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... | |
const Common::UString & | getConversation () const |
Get the conversation for this 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... | |
virtual bool | testCollision (const glm::vec3 &orig, const glm::vec3 &dest) const |
void | setWalkmeshInvisible (bool invisible) |
void | playAnimation (const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f) |
Public Member Functions inherited from Engines::KotOR::Object | |
Object (ObjectType type=kObjectTypeInvalid) | |
virtual | ~Object () |
ObjectType | getType () const |
Return the exact type of the object. More... | |
virtual void | hideSoft () |
Hide the object's model(s) if applicable. 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... | |
void | setMaxHitPoints (int maxHP) |
Set the maximum hit points for the objects. More... | |
int | getMaxHitPoints () |
Get the maximum hit points for the objects. More... | |
void | setCurrentHitPoints (int hitpoints) |
Set the current hitpoints. More... | |
int | getCurrentHitPoints () |
Return the objects current hitpoints. More... | |
void | setMinOneHitPoints (bool enabled) |
Set if the object has a minimum of one hp. More... | |
bool | getMinOneHitPoints () const |
Get if the object has a minimum of one hp. 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... | |
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... | |
void | makeLookAt (float x, float y) |
void | makeLookAt (Object *target) |
Room * | getRoom () |
Get a room the object is in. More... | |
void | setRoom (Room *room) |
Set a room the object is in. 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::KotOR::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 placeable-specific properties. More... | |
void | loadAppearance () |
Load appearance-specific properties. More... | |
Protected Member Functions inherited from Engines::KotOR::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::KotOR::ScriptContainer | |
void | clearScripts () |
void | readScripts (const Aurora::GFF3Struct &gff, bool clear=true) |
void | readScripts (const ScriptContainer &container) |
Private Member Functions | |
void | load (const Aurora::GFF3Struct &placeable) |
Load from a placeable instance. More... | |
Private Attributes | |
State | _state |
The current state of the placeable. More... | |
bool | _hasInventory |
Does this placeable have an inventory? More... | |
Inventory | _inventory |
The current items of this placeable if it has an inventory. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Engines::KotOR::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::KotOR::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... | |
Common::UString | _conversation |
The optional conversation with this situated object. 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... | |
Walkmesh | _walkmesh |
Protected Attributes inherited from Engines::KotOR::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... | |
bool | _static |
Is the object static? More... | |
bool | _usable |
Is the object usable? More... | |
int | _currentHitPoints |
The current hitpoints of the object. More... | |
int | _maxHitPoints |
The maximum hitpoints of the object. More... | |
bool | _minOneHitPoint |
If the object should have at least one hitpoint. More... | |
std::list< uint32 > | _ids |
The object's model IDs. 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... | |
Room * | _room |
Room the object is in. More... | |
Protected Attributes inherited from Aurora::NWScript::Object | |
uint32 | _id |
Common::UString | _tag |
Definition at line 38 of file placeable.h.
The state of a placeable.
Enumerator | |
---|---|
kStateDefault | Default. |
kStateOpen | Open. |
kStateClosed | Closed. |
kStateDestroyed | Destroyed. |
kStateActivated | Activated. |
kStateDeactivated | Deactivated. |
Definition at line 41 of file placeable.h.
Engines::KotOR::Placeable::Placeable | ( | const Aurora::GFF3Struct & | placeable | ) |
Load from a placeable instance.
Definition at line 47 of file placeable.cpp.
References load().
Engines::KotOR::Placeable::~Placeable | ( | ) |
Definition at line 53 of file placeable.cpp.
bool Engines::KotOR::Placeable::activate | ( | Object * | opener | ) |
The user object activates this placeable.
Definition at line 212 of file placeable.cpp.
References _hasInventory, Engines::KotOR::Situated::_soundLocked, Engines::KotOR::Situated::_soundUsed, _state, isActivated(), Engines::KotOR::Situated::isLocked(), Engines::KotOR::kScriptUsed, kStateActivated, Engines::KotOR::Object::playSound(), and Engines::KotOR::ScriptContainer::runScript().
Referenced by click().
|
virtual |
The placeable was clicked.
Reimplemented from Engines::KotOR::Object.
Definition at line 143 of file placeable.cpp.
References _hasInventory, Engines::KotOR::Situated::_lastUsedBy, Engines::KotOR::Situated::_soundLocked, _state, activate(), close(), CursorMan, deactivate(), isActivated(), Engines::KotOR::Situated::isLocked(), isOpen(), kStateDestroyed, open(), and Engines::KotOR::Object::playSound().
bool Engines::KotOR::Placeable::close | ( | Object * | closer | ) |
The closer object closes this placeable.
Definition at line 195 of file placeable.cpp.
References _hasInventory, Engines::KotOR::Situated::_lastClosedBy, Engines::KotOR::Situated::_soundClosed, _state, isOpen(), Engines::KotOR::kScriptClosed, kStateClosed, Engines::KotOR::Object::playSound(), and Engines::KotOR::ScriptContainer::runScript().
Referenced by click(), and Engines::KotOR::Module::clickObject().
bool Engines::KotOR::Placeable::deactivate | ( | Object * | closer | ) |
The user object deactivates this placeable.
Definition at line 232 of file placeable.cpp.
References _hasInventory, Engines::KotOR::Situated::_soundLocked, Engines::KotOR::Situated::_soundUsed, _state, isActivated(), Engines::KotOR::Situated::isLocked(), Engines::KotOR::kScriptUsed, kStateDeactivated, Engines::KotOR::Object::playSound(), and Engines::KotOR::ScriptContainer::runScript().
Referenced by click().
|
virtual |
The cursor entered the placeable.
Reimplemented from Engines::KotOR::Object.
Definition at line 120 of file placeable.cpp.
References CursorMan, and highlight().
Inventory & Engines::KotOR::Placeable::getInventory | ( | ) |
Definition at line 256 of file placeable.cpp.
References _inventory.
Referenced by Engines::KotOR::Module::addItemToActiveObject(), Engines::KotOR::Module::clickObject(), and Engines::KotOR::Functions::createItemOnObject().
bool Engines::KotOR::Placeable::hasInventory | ( | ) |
Definition at line 252 of file placeable.cpp.
References _hasInventory.
Referenced by Engines::KotOR::Module::addItemToActiveObject(), and Engines::KotOR::Module::clickObject().
|
virtual |
Hide the placeable's model.
Reimplemented from Engines::KotOR::Object.
Definition at line 79 of file placeable.cpp.
References Engines::KotOR::Situated::hide(), and leave().
|
virtual |
(Un)Highlight the placeable.
Reimplemented from Engines::KotOR::Object.
Definition at line 130 of file placeable.cpp.
References Engines::KotOR::Situated::_model.
Referenced by enter(), and leave().
bool Engines::KotOR::Placeable::isActivated | ( | ) | const |
Is the placeable activated?
Definition at line 139 of file placeable.cpp.
References isOpen().
Referenced by activate(), click(), and deactivate().
|
virtual |
Is the placeable open?
Implements Engines::KotOR::Situated.
Definition at line 135 of file placeable.cpp.
References _state, kStateActivated, and kStateOpen.
Referenced by click(), close(), isActivated(), and open().
|
virtual |
The cursor left the placeable.
Reimplemented from Engines::KotOR::Object.
Definition at line 125 of file placeable.cpp.
References CursorMan, and highlight().
Referenced by hide().
|
private |
Load from a placeable instance.
Definition at line 56 of file placeable.cpp.
References Engines::KotOR::Situated::_modelName, Engines::KotOR::Object::_orientation, Engines::KotOR::Object::_position, Aurora::NWScript::Object::_tag, Engines::KotOR::Situated::_walkmesh, Common::UString::c_str(), Common::deg2rad(), Common::UString::empty(), Aurora::GFF3Struct::getString(), Aurora::kFileTypePWK, Aurora::kFileTypeUTP, Engines::KotOR::Walkmesh::load(), Engines::KotOR::Situated::load(), Engines::loadOptionalGFF3(), MKTAG, Engines::KotOR::ScriptContainer::readScripts(), Common::ScopedPtrBase< T, Deallocator >::reset(), and warning().
Referenced by Placeable().
|
protectedvirtual |
Load appearance-specific properties.
Implements Engines::KotOR::Situated.
Definition at line 110 of file placeable.cpp.
References Engines::KotOR::Situated::_appearanceID, Engines::KotOR::Situated::_modelName, Engines::KotOR::Situated::_soundAppType, Aurora::TwoDARow::getInt(), Aurora::TwoDAFile::getRow(), Aurora::TwoDARow::getString(), Aurora::kFieldIDInvalid, and TwoDAReg.
|
protectedvirtual |
Load placeable-specific properties.
Implements Engines::KotOR::Situated.
Definition at line 85 of file placeable.cpp.
References Engines::KotOR::Object::_currentHitPoints, _hasInventory, _inventory, Engines::KotOR::Object::_maxHitPoints, Engines::KotOR::Object::_minOneHitPoint, _state, Engines::KotOR::Inventory::addItem(), Aurora::GFF3Struct::getBool(), Aurora::GFF3Struct::getList(), Aurora::GFF3Struct::getSint(), Aurora::GFF3Struct::getString(), Aurora::GFF3Struct::getUint(), and Aurora::GFF3Struct::hasField().
bool Engines::KotOR::Placeable::open | ( | Object * | opener | ) |
The opener object opens this placeable.
Definition at line 173 of file placeable.cpp.
References _hasInventory, Engines::KotOR::Situated::_lastOpenedBy, Engines::KotOR::Situated::_soundLocked, Engines::KotOR::Situated::_soundOpened, _state, Engines::KotOR::Situated::isLocked(), isOpen(), Engines::KotOR::kScriptOpen, kStateOpen, Engines::KotOR::Object::playSound(), and Engines::KotOR::ScriptContainer::runScript().
Referenced by click().
|
private |
Does this placeable have an inventory?
Definition at line 100 of file placeable.h.
Referenced by activate(), click(), close(), deactivate(), hasInventory(), loadObject(), and open().
|
private |
The current items of this placeable if it has an inventory.
Definition at line 101 of file placeable.h.
Referenced by getInventory(), and loadObject().
|
private |
The current state of the placeable.
Definition at line 98 of file placeable.h.
Referenced by activate(), click(), close(), deactivate(), isOpen(), loadObject(), and open().