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

#include <creature.h>

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

Classes

struct  EquipItem
 An item equipped by the creature. More...
 

Public Member Functions

 Creature ()
 Create a dummy creature instance. More...
 
 Creature (const Aurora::GFF3Struct &placeable)
 Load from a placeable instance. More...
 
 ~Creature ()
 
void createFakePC ()
 Create a fake player character creature for testing purposes. More...
 
void show ()
 Show the creature's model. More...
 
void hide ()
 Hide the creature's model. More...
 
bool isPC () const
 Is the creature a player character? 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...
 
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...
 
- Public Member Functions inherited from Engines::DragonAge2::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::UStringgetResRef () const
 Return the object's resource reference. More...
 
const Aurora::LocStringgetName () const
 Return the object's name. More...
 
const Aurora::LocStringgetDescription () const
 Return the object's description. More...
 
const Common::UStringgetConversation () const
 Return the object's default conversation (DLG). More...
 
const Common::UStringgetNonLocalizedName () const
 Return the object's non-localized name. More...
 
void setNonLocalizedName (const Common::UString &name)
 Set the object's non-localized name. 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...
 
- 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::DragonAge2::ScriptContainer
 ScriptContainer ()
 
 ~ScriptContainer ()
 
const Common::UStringgetScript () const
 
bool hasScript () const
 
void enableEvent (EventType event, bool enabled)
 Enable/Disable the handling of a specific event. More...
 
void enableEvents (bool enabled)
 Enable/Disable the handling of all events. More...
 
bool runScript (EventType event, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
bool runScript (Event &event)
 

Private Types

typedef std::vector< EquipItemItems
 
typedef Common::PtrList< Graphics::Aurora::ModelModels
 

Private Member Functions

void init ()
 
void load (const Aurora::GFF3Struct &placeable)
 
void load (const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint)
 
void loadProperties (const Aurora::GFF3Struct &gff)
 
void loadModelsSimple (const Aurora::GDAFile &gda, size_t row)
 
void loadModelsWelded (const Aurora::GDAFile &gda, size_t row)
 
void loadModelsHead (const Aurora::GDAFile &gda, size_t row)
 
void loadModelsParts (const Aurora::GDAFile &gda, size_t row)
 
void loadModelsHeadMorph (bool loadHair=true)
 
void loadModelsHeadList (const Aurora::GDAFile &gda, size_t row, bool loadHair=true)
 
Common::UString getItemModel (uint32 variation, const Common::UString &prefix, uint8 *armorType=0) const
 
Common::UString findEquipModel (InventorySlot slot, const Common::UString &prefix, uint8 *armorType=0) const
 

Static Private Member Functions

static Common::UString createModelPrefix (const Aurora::GDAFile &gda, size_t row)
 
static Common::UString createModelPart (const Aurora::GDAFile &gda, size_t row, const Common::UString &prefix)
 

Private Attributes

bool _isPC
 Is the creature a PC? More...
 
uint32 _appearanceID
 The creature's appearance; index into the Appearances MGDA. More...
 
Common::UString _headMorph
 Name of the morph file describing the creature's head. More...
 
uint32 _partVariation [kPartVariationCount]
 Indices into the MGDAs describing the creature's head model parts. More...
 
Items _items
 All item the creature has currently equipped. More...
 
Models _models
 The models making up this creature. More...
 

Static Private Attributes

static const size_t kPartVariationCount = 4
 Max number of model parts for a creature's head. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Engines::DragonAge2::ScriptContainer
static bool runScript (const Common::UString &script, EventType event, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
static bool runScript (const Common::UString &script, EventType event, const Aurora::NWScript::ScriptState &state, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
static bool runScript (const Common::UString &script, Event &event)
 
static bool runScript (const Common::UString &script, Event &event, const Aurora::NWScript::ScriptState &state)
 
- Protected Member Functions inherited from Engines::DragonAge2::Object
void syncPosition ()
 
void syncOrientation ()
 
void readVarTable (const Aurora::GFF3List &varTable)
 
void readVarTable (const Aurora::GFF3Struct &gff)
 
void readVarTable (const Aurora::GFF4List &varTable)
 
void readVarTable (const Aurora::GFF4Struct &gff)
 
- Protected Member Functions inherited from Engines::DragonAge2::ScriptContainer
void clearScript ()
 
void readScript (const Aurora::GFF3Struct &gff)
 
void readScript (const Aurora::GFF4Struct &gff)
 
- Protected Attributes inherited from Engines::DragonAge2::Object
ObjectType _type
 The object's type. More...
 
Common::UString _resRef
 The object's resource reference. More...
 
Aurora::LocString _name
 The object's display name. More...
 
Aurora::LocString _description
 The object's description. More...
 
Common::UString _nonLocalizedName
 The object's non-localized name. More...
 
Common::UString _conversation
 The object's default conversation. More...
 
Common::UString _soundSet
 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...
 
float _position [3]
 The object's position. More...
 
float _orientation [4]
 The object's orientation. More...
 
- Protected Attributes inherited from Aurora::NWScript::Object
uint32 _id
 
Common::UString _tag
 

Detailed Description

Definition at line 49 of file creature.h.

Member Typedef Documentation

◆ Items

typedef std::vector<EquipItem> Engines::DragonAge2::Creature::Items
private

Definition at line 103 of file creature.h.

◆ Models

Definition at line 105 of file creature.h.

Constructor & Destructor Documentation

◆ Creature() [1/2]

Engines::DragonAge2::Creature::Creature ( )

Create a dummy creature instance.

Not playable as it is.

Definition at line 66 of file creature.cpp.

References init().

Here is the call graph for this function:

◆ Creature() [2/2]

Engines::DragonAge2::Creature::Creature ( const Aurora::GFF3Struct placeable)

Load from a placeable instance.

◆ ~Creature()

Engines::DragonAge2::Creature::~Creature ( )

Definition at line 76 of file creature.cpp.

References hide().

Here is the call graph for this function:

Member Function Documentation

◆ click()

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

The creature was clicked.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 144 of file creature.cpp.

References Engines::DragonAge2::kEventTypeClick, Engines::DragonAge2::kEventTypeConversation, and Engines::DragonAge2::ScriptContainer::runScript().

Here is the call graph for this function:

◆ createFakePC()

void Engines::DragonAge2::Creature::createFakePC ( )

Create a fake player character creature for testing purposes.

Definition at line 119 of file creature.cpp.

References _isPC, Engines::DragonAge2::Object::_name, Aurora::NWScript::Object::_tag, Common::UString::c_str(), Engines::DragonAge2::ScriptContainer::enableEvents(), Common::UString::format(), Aurora::LocString::getString(), LangMan, and Aurora::LocString::setString().

Referenced by Engines::DragonAge2::Game::runCampaigns().

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

◆ createModelPart()

Common::UString Engines::DragonAge2::Creature::createModelPart ( const Aurora::GDAFile gda,
size_t  row,
const Common::UString prefix 
)
staticprivate

Definition at line 175 of file creature.cpp.

References Common::UString::empty(), Aurora::GDAFile::getString(), and Aurora::GDAFile::kInvalidRow.

Referenced by getItemModel(), and loadModelsHeadList().

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

◆ createModelPrefix()

Common::UString Engines::DragonAge2::Creature::createModelPrefix ( const Aurora::GDAFile gda,
size_t  row 
)
staticprivate

Definition at line 161 of file creature.cpp.

References Common::UString::empty(), Aurora::GDAFile::getString(), and Aurora::GDAFile::kInvalidRow.

Referenced by loadModelsHead(), loadModelsHeadList(), and loadModelsParts().

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

◆ enter()

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

The cursor entered the creature.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 128 of file creature.cpp.

References Engines::DragonAge2::Object::_description, Engines::DragonAge2::Object::_name, Aurora::NWScript::Object::_tag, Common::UString::c_str(), Aurora::LocString::getString(), highlight(), and status().

Here is the call graph for this function:

◆ findEquipModel()

Common::UString Engines::DragonAge2::Creature::findEquipModel ( InventorySlot  slot,
const Common::UString prefix,
uint8 armorType = 0 
) const
private

Definition at line 376 of file creature.cpp.

References _items, Aurora::GDAFile::findRow(), getItemModel(), Engines::DragonAge2::getMGDA(), Aurora::kFileTypeUTI, Aurora::GDAFile::kInvalidRow, Engines::DragonAge2::kUTIID, and Engines::DragonAge2::kWorksheetItems.

Referenced by loadModelsHead(), and loadModelsParts().

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

◆ getItemModel()

Common::UString Engines::DragonAge2::Creature::getItemModel ( uint32  variation,
const Common::UString prefix,
uint8 armorType = 0 
) const
private

Definition at line 189 of file creature.cpp.

References createModelPart(), Common::UString::empty(), Aurora::GDAFile::findRow(), Aurora::GDAFile::getInt(), Engines::DragonAge2::getMGDA(), Aurora::GDAFile::kInvalidRow, and Engines::DragonAge2::kWorksheetItemVariations.

Referenced by findEquipModel(), and loadModelsParts().

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

◆ hide()

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

Hide the creature's model.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 110 of file creature.cpp.

References _models.

Referenced by ~Creature().

Here is the caller graph for this function:

◆ highlight()

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

(Un)Highlight the creature.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 139 of file creature.cpp.

References _models.

Referenced by enter(), and leave().

Here is the caller graph for this function:

◆ init()

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

Definition at line 80 of file creature.cpp.

References _appearanceID, _isPC, _partVariation, and kPartVariationCount.

Referenced by Creature().

Here is the caller graph for this function:

◆ isPC()

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

Is the creature a player character?

Definition at line 115 of file creature.cpp.

References _isPC.

◆ leave()

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

The cursor left the creature.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 135 of file creature.cpp.

References highlight().

Here is the call graph for this function:

◆ load() [1/2]

void Engines::DragonAge2::Creature::load ( const Aurora::GFF3Struct placeable)
private

◆ load() [2/2]

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

◆ loadModelsHead()

void Engines::DragonAge2::Creature::loadModelsHead ( const Aurora::GDAFile gda,
size_t  row 
)
private

◆ loadModelsHeadList()

void Engines::DragonAge2::Creature::loadModelsHeadList ( const Aurora::GDAFile gda,
size_t  row,
bool  loadHair = true 
)
private

Definition at line 272 of file creature.cpp.

References _models, _partVariation, createModelPart(), createModelPrefix(), Aurora::GDAFile::findRow(), Aurora::GDAFile::getInt(), Engines::DragonAge2::getMGDA(), Aurora::GDAFile::kInvalidRow, kPartVariationCount, and Engines::loadModelObject().

Referenced by loadModelsHead(), and loadModelsParts().

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

◆ loadModelsHeadMorph()

void Engines::DragonAge2::Creature::loadModelsHeadMorph ( bool  loadHair = true)
private

Definition at line 248 of file creature.cpp.

References _headMorph, _models, Common::debugTag(), Aurora::kFileTypeMOR, Aurora::GFF4FieldNamesEnum::kGFF4MorphParts, Engines::DragonAge2::kMORPID, Engines::DragonAge2::kVersion01, and Engines::loadModelObject().

Referenced by loadModelsHead(), and loadModelsParts().

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

◆ loadModelsParts()

void Engines::DragonAge2::Creature::loadModelsParts ( const Aurora::GDAFile gda,
size_t  row 
)
private

◆ loadModelsSimple()

void Engines::DragonAge2::Creature::loadModelsSimple ( const Aurora::GDAFile gda,
size_t  row 
)
private

Definition at line 210 of file creature.cpp.

References _models, Aurora::GDAFile::getString(), and Engines::loadModelObject().

Here is the call graph for this function:

◆ loadModelsWelded()

void Engines::DragonAge2::Creature::loadModelsWelded ( const Aurora::GDAFile gda,
size_t  row 
)
private

Definition at line 218 of file creature.cpp.

References _models, Aurora::GDAFile::getString(), and Engines::loadModelObject().

Here is the call graph for this function:

◆ loadProperties()

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

◆ setOrientation()

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

Set the creature's orientation.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 97 of file creature.cpp.

References _models, Engines::DragonAge2::Object::getOrientation(), and Engines::DragonAge2::Object::setOrientation().

Here is the call graph for this function:

◆ setPosition()

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

Set the creature's position.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 89 of file creature.cpp.

References _models, Engines::DragonAge2::Object::getPosition(), and Engines::DragonAge2::Object::setPosition().

Referenced by Engines::DragonAge2::Campaign::movePC().

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

◆ show()

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

Show the creature's model.

Reimplemented from Engines::DragonAge2::Object.

Definition at line 105 of file creature.cpp.

References _models.

Member Data Documentation

◆ _appearanceID

uint32 Engines::DragonAge2::Creature::_appearanceID
private

The creature's appearance; index into the Appearances MGDA.

Definition at line 111 of file creature.h.

Referenced by init().

◆ _headMorph

Common::UString Engines::DragonAge2::Creature::_headMorph
private

Name of the morph file describing the creature's head.

Definition at line 114 of file creature.h.

Referenced by loadModelsHead(), loadModelsHeadMorph(), and loadModelsParts().

◆ _isPC

bool Engines::DragonAge2::Creature::_isPC
private

Is the creature a PC?

Definition at line 108 of file creature.h.

Referenced by createFakePC(), init(), and isPC().

◆ _items

Items Engines::DragonAge2::Creature::_items
private

All item the creature has currently equipped.

Definition at line 119 of file creature.h.

Referenced by findEquipModel().

◆ _models

Models Engines::DragonAge2::Creature::_models
private

◆ _partVariation

uint32 Engines::DragonAge2::Creature::_partVariation[kPartVariationCount]
private

Indices into the MGDAs describing the creature's head model parts.

Definition at line 116 of file creature.h.

Referenced by init(), and loadModelsHeadList().

◆ kPartVariationCount

const size_t Engines::DragonAge2::Creature::kPartVariationCount = 4
staticprivate

Max number of model parts for a creature's head.

Definition at line 90 of file creature.h.

Referenced by init(), and loadModelsHeadList().


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