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

#include <door.h>

Inheritance diagram for Engines::KotOR2::Door:
Inheritance graph
[legend]
Collaboration diagram for Engines::KotOR2::Door:
Collaboration graph
[legend]

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 hide ()
 Hide the door's model. More...
 
void hideSoft ()
 Hide the door's model if applicable. 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 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...
 
bool testCollision (const glm::vec3 &orig, const glm::vec3 &dest) const
 
- Public Member Functions inherited from Engines::KotOR2::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...
 
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...
 
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::KotOR2::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...
 
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)
 
RoomgetRoom ()
 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::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::KotOR2::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 door-specific properties. More...
 
void loadAppearance ()
 Load appearance-specific properties. More...
 
- Protected Member Functions inherited from Engines::KotOR2::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::KotOR2::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...
 

Private Attributes

Module_module
 The module the door is in. 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...
 
ObjectType _linkedToType
 The type of the object this door links to. More...
 
Common::UString _linkedTo
 The object tag this door links to. More...
 
Common::UString _linkedToModule
 The module the object this door links to is in. More...
 
Common::UString _transitionDestination
 A localized string describing where this door leads to. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Engines::KotOR2::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::KotOR2::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...
 
Engines::KotOR::Walkmesh _walkmesh
 
- Protected Attributes inherited from Engines::KotOR2::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...
 
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
 

Detailed Description

Definition at line 38 of file door.h.

Member Enumeration Documentation

◆ LinkedToFlag

Enumerator
kLinkedToNothing 

This door links to nothing.

kLinkedToDoor 

This door links to another door.

kLinkedToWaypoint 

This door links to a waypoint.

Definition at line 87 of file door.h.

◆ State

The state of a door.

Enumerator
kStateClosed 

Closed.

kStateOpened1 

Opened in one direction (normally clock-wise).

kStateOpened2 

Opened in the other direction (normally counter-clock-wise).

kStateDestroyed 

Destroyed.

Definition at line 41 of file door.h.

Constructor & Destructor Documentation

◆ Door()

Engines::KotOR2::Door::Door ( Module module,
const Aurora::GFF3Struct door 
)

Load from a door instance.

Definition at line 48 of file door.cpp.

References load().

Here is the call graph for this function:

◆ ~Door()

Engines::KotOR2::Door::~Door ( )

Definition at line 55 of file door.cpp.

Member Function Documentation

◆ click()

bool Engines::KotOR2::Door::click ( Object triggerer = 0)
virtual

◆ close()

bool Engines::KotOR2::Door::close ( Object closer)

The closer object closes this door.

Definition at line 196 of file door.cpp.

References Engines::KotOR2::Situated::_lastClosedBy, Engines::KotOR2::Situated::_soundClosed, _state, isOpen(), Engines::KotOR2::kScriptClosed, kStateClosed, kStateDestroyed, Engines::KotOR2::Object::playSound(), and Engines::KotOR2::ScriptContainer::runScript().

Referenced by click().

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

◆ enter()

void Engines::KotOR2::Door::enter ( )
virtual

The cursor entered the door.

Reimplemented from Engines::KotOR2::Object.

Definition at line 129 of file door.cpp.

References highlight().

Here is the call graph for this function:

◆ hide()

void Engines::KotOR2::Door::hide ( )
virtual

Hide the door's model.

Reimplemented from Engines::KotOR2::Object.

Definition at line 120 of file door.cpp.

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

Here is the call graph for this function:

◆ hideSoft()

void Engines::KotOR2::Door::hideSoft ( )
virtual

Hide the door's model if applicable.

Reimplemented from Engines::KotOR2::Object.

Definition at line 126 of file door.cpp.

◆ highlight()

void Engines::KotOR2::Door::highlight ( bool  enabled)
virtual

(Un)Highlight the door.

Reimplemented from Engines::KotOR2::Object.

Definition at line 137 of file door.cpp.

References Engines::KotOR2::Situated::_model.

Referenced by enter(), and leave().

Here is the caller graph for this function:

◆ isOpen()

bool Engines::KotOR2::Door::isOpen ( ) const
virtual

Is the door open?

Implements Engines::KotOR2::Situated.

Definition at line 142 of file door.cpp.

References _state, kStateOpened1, and kStateOpened2.

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

Here is the caller graph for this function:

◆ leave()

void Engines::KotOR2::Door::leave ( )
virtual

The cursor left the door.

Reimplemented from Engines::KotOR2::Object.

Definition at line 133 of file door.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::KotOR2::Door::load ( const Aurora::GFF3Struct door)
private

◆ loadAppearance() [1/2]

void Engines::KotOR2::Door::loadAppearance ( )
protectedvirtual

Load appearance-specific properties.

Implements Engines::KotOR2::Situated.

Definition at line 97 of file door.cpp.

References Engines::KotOR2::Situated::_appearanceID, _genericType, Aurora::NWScript::Object::_tag, Common::UString::c_str(), Aurora::kFieldIDInvalid, and TwoDAReg.

Here is the call graph for this function:

◆ loadAppearance() [2/2]

void Engines::KotOR2::Door::loadAppearance ( const Aurora::TwoDAFile twoda,
uint32  id 
)
private

◆ loadObject()

void Engines::KotOR2::Door::loadObject ( const Aurora::GFF3Struct gff)
protectedvirtual

◆ open()

bool Engines::KotOR2::Door::open ( Object opener)

◆ testCollision()

bool Engines::KotOR2::Door::testCollision ( const glm::vec3 &  orig,
const glm::vec3 &  dest 
) const
virtual

Reimplemented from Engines::KotOR2::Situated.

Definition at line 167 of file door.cpp.

References Engines::KotOR2::Situated::_walkmesh, isOpen(), and Graphics::Aurora::Walkmesh::testCollision().

Here is the call graph for this function:

Member Data Documentation

◆ _genericType

uint32 Engines::KotOR2::Door::_genericType
private

Index into the generic door types.

Definition at line 95 of file door.h.

Referenced by loadAppearance(), and loadObject().

◆ _linkedTo

Common::UString Engines::KotOR2::Door::_linkedTo
private

The object tag this door links to.

Definition at line 101 of file door.h.

Referenced by click(), and loadObject().

◆ _linkedToFlag

LinkedToFlag Engines::KotOR2::Door::_linkedToFlag
private

Does this door link to anything?

Definition at line 99 of file door.h.

Referenced by loadObject().

◆ _linkedToModule

Common::UString Engines::KotOR2::Door::_linkedToModule
private

The module the object this door links to is in.

Definition at line 102 of file door.h.

Referenced by click(), and loadObject().

◆ _linkedToType

ObjectType Engines::KotOR2::Door::_linkedToType
private

The type of the object this door links to.

Definition at line 100 of file door.h.

Referenced by click(), and loadObject().

◆ _module

Module* Engines::KotOR2::Door::_module
private

The module the door is in.

Definition at line 93 of file door.h.

Referenced by click().

◆ _state

State Engines::KotOR2::Door::_state
private

The current state of the door.

Definition at line 97 of file door.h.

Referenced by close(), isOpen(), loadObject(), and open().

◆ _transitionDestination

Common::UString Engines::KotOR2::Door::_transitionDestination
private

A localized string describing where this door leads to.

Definition at line 105 of file door.h.

Referenced by loadObject().


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