xoreos  0.0.5
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Engines::KotOR2::Creature Class Reference

#include <creature.h>

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

Classes

struct  PartModels
 Parts of a creature's body. More...
 

Public Member Functions

 Creature ()
 Create a dummy creature instance. More...
 
 Creature (const Aurora::GFF3Struct &creature)
 Load from a creature instance. More...
 
 ~Creature ()
 
void createFakePC ()
 Create a fake player character creature for testing purposes. More...
 
void createPC (const CharacterGenerationInfo &info)
 Create a player character creature. More...
 
void show ()
 Show the creature's model. More...
 
void hide ()
 Hide the creature's model. More...
 
bool isVisible () const
 Is the creature's model visible? More...
 
bool isPC () const
 Is the creature a player character? More...
 
bool isPartyMember () const
 
void setPosition (float x, float y, float z)
 Set the creature's position. More...
 
void setOrientation (float x, float y, float z, float angle)
 Set the creature's orientation. More...
 
void enter ()
 The cursor entered the creature. More...
 
void leave ()
 The cursor left the creature. More...
 
void highlight (bool enabled)
 (Un)Highlight the creature. More...
 
bool click (Object *triggerer=0)
 The creature was clicked. More...
 
const Common::UStringgetConversation () const
 
float getCameraHeight () const
 
void playDefaultAnimation ()
 
void playDefaultHeadAnimation ()
 
void playAnimation (const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
 
void playHeadAnimation (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...
 
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::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())
 

Private Member Functions

void init ()
 
void load (const Aurora::GFF3Struct &creature)
 
void load (const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint)
 
void loadProperties (const Aurora::GFF3Struct &gff)
 
void loadPortrait (const Aurora::GFF3Struct &gff)
 
void loadAppearance ()
 
void getPartModels (PartModels &parts, uint32 state='a')
 
void loadBody (PartModels &parts)
 
void loadHead (PartModels &parts)
 
void setDefaultAnimations ()
 

Private Attributes

bool _isPC
 Is the creature a PC? More...
 
uint32 _appearance
 The creature's general appearance. More...
 
Common::ScopedPtr< Graphics::Aurora::Model_model
 The creature's model. More...
 
Common::UString _conversation
 
Common::UString _modelType
 

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 Member Functions inherited from Engines::KotOR2::ScriptContainer
void clearScripts ()
 
void readScripts (const Aurora::GFF3Struct &gff)
 
void readScripts (const ScriptContainer &container)
 
- 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 44 of file creature.h.

Constructor & Destructor Documentation

◆ Creature() [1/2]

Engines::KotOR2::Creature::Creature ( )

Create a dummy creature instance.

Not playable as it is.

Definition at line 54 of file creature.cpp.

References init().

Here is the call graph for this function:

◆ Creature() [2/2]

Engines::KotOR2::Creature::Creature ( const Aurora::GFF3Struct creature)

Load from a creature instance.

Definition at line 49 of file creature.cpp.

References init(), and load().

Here is the call graph for this function:

◆ ~Creature()

Engines::KotOR2::Creature::~Creature ( )

Definition at line 58 of file creature.cpp.

Member Function Documentation

◆ click()

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

The creature was clicked.

Reimplemented from Engines::KotOR2::Object.

Definition at line 298 of file creature.cpp.

References Engines::KotOR2::ScriptContainer::hasScript(), Engines::KotOR2::kScriptClick, Engines::KotOR2::kScriptDialogue, and Engines::KotOR2::ScriptContainer::runScript().

Here is the call graph for this function:

◆ createFakePC()

void Engines::KotOR2::Creature::createFakePC ( )

Create a fake player character creature for testing purposes.

Definition at line 263 of file creature.cpp.

References _isPC, Engines::KotOR2::Object::_name, Aurora::NWScript::Object::_tag, Common::UString::c_str(), and Common::UString::format().

Here is the call graph for this function:

◆ createPC()

void Engines::KotOR2::Creature::createPC ( const CharacterGenerationInfo info)

◆ enter()

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

The cursor entered the creature.

Reimplemented from Engines::KotOR2::Object.

Definition at line 286 of file creature.cpp.

References highlight().

Here is the call graph for this function:

◆ getCameraHeight()

float Engines::KotOR2::Creature::getCameraHeight ( ) const

Definition at line 314 of file creature.cpp.

References _model, and Graphics::Aurora::ModelNode::getPosition().

Here is the call graph for this function:

◆ getConversation()

const Common::UString & Engines::KotOR2::Creature::getConversation ( ) const

Definition at line 310 of file creature.cpp.

References _conversation.

Referenced by Engines::KotOR2::Module::clickObject(), and Engines::KotOR2::Module::startConversation().

Here is the caller graph for this function:

◆ getPartModels()

void Engines::KotOR2::Creature::getPartModels ( PartModels parts,
uint32  state = 'a' 
)
private

◆ hide()

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

Hide the creature's model.

Reimplemented from Engines::KotOR2::Object.

Definition at line 72 of file creature.cpp.

References _model.

◆ highlight()

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

(Un)Highlight the creature.

Reimplemented from Engines::KotOR2::Object.

Definition at line 294 of file creature.cpp.

References _model.

Referenced by enter(), and leave().

Here is the caller graph for this function:

◆ init()

void Engines::KotOR2::Creature::init ( )
private

Definition at line 61 of file creature.cpp.

References _appearance, _isPC, and Aurora::kFieldIDInvalid.

Referenced by Creature().

Here is the caller graph for this function:

◆ isPartyMember()

bool Engines::KotOR2::Creature::isPartyMember ( ) const

Definition at line 85 of file creature.cpp.

References _isPC.

Referenced by Engines::KotOR2::ObjectContainer::toPartyMember().

Here is the caller graph for this function:

◆ isPC()

bool Engines::KotOR2::Creature::isPC ( ) const

Is the creature a player character?

Definition at line 81 of file creature.cpp.

References _isPC.

Referenced by Engines::KotOR2::ObjectContainer::toPC().

Here is the caller graph for this function:

◆ isVisible()

bool Engines::KotOR2::Creature::isVisible ( ) const
virtual

Is the creature's model visible?

Reimplemented from Engines::KotOR2::Object.

Definition at line 77 of file creature.cpp.

References _model.

◆ leave()

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

The cursor left the creature.

Reimplemented from Engines::KotOR2::Object.

Definition at line 290 of file creature.cpp.

References highlight().

Here is the call graph for this function:

◆ load() [1/2]

void Engines::KotOR2::Creature::load ( const Aurora::GFF3Struct creature)
private

Definition at line 105 of file creature.cpp.

References Aurora::NWScript::Object::_tag, Common::UString::c_str(), Common::UString::empty(), Aurora::GFF3Struct::getString(), Aurora::kFileTypeUTC, Engines::loadOptionalGFF3(), MKTAG, Common::ScopedPtrBase< T, Deallocator >::reset(), and warning().

Referenced by Creature().

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

◆ load() [2/2]

void Engines::KotOR2::Creature::load ( const Aurora::GFF3Struct instance,
const Aurora::GFF3Struct blueprint 
)
private

◆ loadAppearance()

void Engines::KotOR2::Creature::loadAppearance ( )
private

Definition at line 191 of file creature.cpp.

References _modelType, Aurora::NWScript::Object::_tag, Engines::KotOR2::Creature::PartModels::body, Common::UString::c_str(), Common::UString::empty(), getPartModels(), loadBody(), loadHead(), setDefaultAnimations(), and warning().

Referenced by load().

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

◆ loadBody()

void Engines::KotOR2::Creature::loadBody ( PartModels parts)
private

◆ loadHead()

void Engines::KotOR2::Creature::loadHead ( PartModels parts)
private

Definition at line 252 of file creature.cpp.

References _model, Common::UString::empty(), Engines::KotOR2::Creature::PartModels::head, and Engines::loadModelObject().

Referenced by createPC(), and loadAppearance().

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

◆ loadPortrait()

void Engines::KotOR2::Creature::loadPortrait ( const Aurora::GFF3Struct gff)
private

Definition at line 178 of file creature.cpp.

References Engines::KotOR2::Object::_portrait, Common::UString::empty(), Aurora::TwoDAFile::getRow(), Aurora::TwoDARow::getString(), Aurora::GFF3Struct::getString(), Aurora::GFF3Struct::getUint(), and TwoDAReg.

Referenced by loadProperties().

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

◆ loadProperties()

void Engines::KotOR2::Creature::loadProperties ( const Aurora::GFF3Struct gff)
private

◆ playAnimation()

void Engines::KotOR2::Creature::playAnimation ( const Common::UString anim,
bool  restart = true,
float  length = 0.0f,
float  speed = 1.0f 
)
virtual

Reimplemented from Engines::KotOR2::Object.

Definition at line 349 of file creature.cpp.

References _model.

Referenced by Engines::KotOR2::DialogGUI::playTalkAnimations().

Here is the caller graph for this function:

◆ playDefaultAnimation()

void Engines::KotOR2::Creature::playDefaultAnimation ( )

Definition at line 327 of file creature.cpp.

References _model.

Referenced by Engines::KotOR2::DialogGUI::playDefaultAnimations().

Here is the caller graph for this function:

◆ playDefaultHeadAnimation()

void Engines::KotOR2::Creature::playDefaultHeadAnimation ( )

◆ playHeadAnimation()

void Engines::KotOR2::Creature::playHeadAnimation ( const Common::UString anim,
bool  restart = true,
float  length = 0.0f,
float  speed = 1.0f 
)

◆ setDefaultAnimations()

void Engines::KotOR2::Creature::setDefaultAnimations ( )
private

Definition at line 371 of file creature.cpp.

References _model, and _modelType.

Referenced by createPC(), and loadAppearance().

Here is the caller graph for this function:

◆ setOrientation()

void Engines::KotOR2::Creature::setOrientation ( float  x,
float  y,
float  z,
float  angle 
)
virtual

Set the creature's orientation.

Reimplemented from Engines::KotOR2::Object.

Definition at line 97 of file creature.cpp.

References _model, Engines::KotOR2::Object::getOrientation(), and Engines::KotOR2::Object::setOrientation().

Referenced by load().

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

◆ setPosition()

void Engines::KotOR2::Creature::setPosition ( float  x,
float  y,
float  z 
)
virtual

Set the creature's position.

Reimplemented from Engines::KotOR2::Object.

Definition at line 89 of file creature.cpp.

References _model, Engines::KotOR2::Object::getPosition(), and Engines::KotOR2::Object::setPosition().

Referenced by load().

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

◆ show()

void Engines::KotOR2::Creature::show ( )
virtual

Show the creature's model.

Reimplemented from Engines::KotOR2::Object.

Definition at line 67 of file creature.cpp.

References _model.

Member Data Documentation

◆ _appearance

uint32 Engines::KotOR2::Creature::_appearance
private

The creature's general appearance.

Definition at line 118 of file creature.h.

Referenced by getPartModels(), init(), load(), and loadProperties().

◆ _conversation

Common::UString Engines::KotOR2::Creature::_conversation
private

Definition at line 121 of file creature.h.

Referenced by getConversation(), and loadProperties().

◆ _isPC

bool Engines::KotOR2::Creature::_isPC
private

Is the creature a PC?

Definition at line 116 of file creature.h.

Referenced by createFakePC(), createPC(), init(), isPartyMember(), isPC(), and loadProperties().

◆ _model

Common::ScopedPtr<Graphics::Aurora::Model> Engines::KotOR2::Creature::_model
private

◆ _modelType

Common::UString Engines::KotOR2::Creature::_modelType
private

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