63 load(utc->getTopLevel());
138 for (
size_t i = 0; i <
_levels.size(); ++i) {
139 if (
_levels[i].characterClass == c)
147 if (
_levels.size() >=
static_cast<unsigned int>(position + 1))
148 return _levels[position].level;
154 if (
_levels.size() >=
static_cast<unsigned int>(position + 1))
155 return _levels[position].characterClass;
181 _model->setPosition(x, y, z);
189 _model->setOrientation(x, y, z, angle);
199 load(creature, utc ? &utc->getTopLevel() : 0);
228 float bearingX = instance.
getDouble(
"XOrientation");
229 float bearingY = instance.
getDouble(
"YOrientation");
275 for (Aurora::GFF3List::const_iterator iter = classList.begin(); iter != classList.end(); iter++) {
294 if (portraitID != 0) {
298 if (!portrait.
empty()) {
315 warning(
"TODO: Model \"%s\": ModelType \"%s\" (\"%s\")",
344 const int headNormalID = appearance.
getInt(
"normalhead");
345 const int headBackupID = appearance.
getInt(
"backuphead");
349 if (headNormalID >= 0)
351 else if (headBackupID >= 0)
379 switch (
_levels.back().characterClass) {
429 parts.
body =
"P_BastilaBB02";
465 uint8 textureVariation = 1;
469 Item *item = i->second;
491 _model->setPosition(x, y, z);
495 _model->setOrientation(x, y, z, angle);
508 Item *item = i->second;
525 _model->attachModel(hookNode, weaponModel);
529 _name =
"Fakoo McFakeston";
582 _model->drawBound(enabled);
624 _equipment.insert(std::pair<EquipmentSlot, Item *>(slot, item));
626 e.
add(
"Failed to load item: %s", tag.
c_str());
654 _model->playDefaultAnimation();
676 _model->playAnimation(anim, restart, length, speed);
795 _model->addDefaultAnimation(
"cpause1", 100);
797 _model->addDefaultAnimation(
"pause1", 100);
A creature in a Star Wars: Knights of the Old Republic area.
int64 getSint(const Common::UString &field, int64 def=0) const
Class to hold the two-dimensional array of a 2DA file.
void show()
Show the creature's model.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void createPC(const CharacterGenerationInfo &info)
Create a player character creature from a character info class.
const Common::UString getModelName() const
void add(const char *s,...) GCC_PRINTF(2
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Play a named animation.
bool _static
Is the object static?
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
void loadBody(PartModels &parts)
bool getBool(const Common::UString &field, bool def=false) const
A class holding an UTF-8 string.
uint8 _face
The face of the creature.
void reset(PointerType o=0)
Resets the pointer with the new value.
void equipItem(Common::UString tag, EquipmentSlot slot)
void enqueueAction(const Action &action)
Append action to the character's action queue.
UString composeString(T value)
Convert any POD integer, float/double or bool type into a string.
bool beginsWith(const UString &with) const
bool hasField(const Common::UString &field) const
Does this specific field exist?
bool isPartyMember() const
const Common::UString & getConversation() const
std::vector< Action > _actionQueue
Skin _skin
The skin type of the creature.
Common::ScopedPtr< Graphics::Aurora::Model > _model
The creature's model.
bool isPC() const
Is the creature a player character?
void setDefaultAnimations()
Common::UString _modelType
void loadPortrait(const Aurora::GFF3Struct &gff)
const Action * peekAction() const
uint64 getUint(const Common::UString &field, uint64 def=0) const
void getPosition(float &x, float &y, float &z) const
Get the position of the node.
Aurora::GFF3File * loadOptionalGFF3(const Common::UString &gff3, Aurora::FileType type, uint32 id, bool repairNWNPremium)
Load a GFF3, but return 0 instead of throwing on error.
void changeWeapon(EquipmentSlot slot)
Inventory & getInventory()
Common::UString _description
The object's description.
Class getClassByPosition(int position) const
Get the class by its position in the level vector.
uint32 _appearance
The creature's general appearance.
bool _isPC
Is the creature a PC?
void playHeadAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Utility templates and functions for working with strings and streams.
Exception that provides a stack of explanations.
int getTextureVariation() const
void playDefaultAnimation()
bool click(Object *triggerer=0)
The creature was clicked.
Race getRace() const
Get the race of the creature.
void load(const Aurora::GFF3Struct &creature)
Basic exceptions to throw.
Common::UString bodyTexture
const char * c_str() const
Return the (utf8 encoded) string data.
void replaceAll(uint32 what, uint32 with)
Replace all occurrences of a character with another character.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
Common::UString _portrait
The object's portrait.
bool isClickable() const
Can the player click the object?
void leave()
The cursor left the creature.
Utility templates and functions.
Common::UString _name
The object's display name.
void getPartModelsPC(PartModels &parts, uint32 state, uint8 textureVariation)
double getDouble(const Common::UString &field, double def=0.0) const
virtual void setOrientation(float x, float y, float z, float angle)
Set the object's orientation.
Handling BioWare's 2DAs (two-dimensional array).
void loadProperties(const Aurora::GFF3Struct &gff)
void info(const char *s,...)
A node within a 3D model.
SubRace _subRace
The subrace of the creature.
void loadMovementRate(const Common::UString &name)
bool empty() const
Is the string empty?
#define TwoDAReg
Shortcut for accessing the 2da registry.
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
Gender getGender() const
Get the gender of the creature.
int _currentHitPoints
The current hitpoints of the object.
Graphics::Aurora::Model * _headModel
The creature's head model.
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
int getLevelByPosition(int position) const
Get the level by its position in the level vector.
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object's orientation.
void warning(const char *s,...)
#define CursorMan
Shortcut for accessing the cursor manager.
int32 getInt(size_t column) const
Return the contents of a cell as an int.
AnimationChannel * getAnimationChannel(AnimationChannelName name)
std::vector< const GFF3Struct * > GFF3List
bool _minOneHitPoint
If the object should have at least one hitpoint.
static Common::UString getBodyMeshString(Gender gender, Class charClass, char state='b')
Generate a string for the body mesh.
Creature()
Create a dummy creature instance.
float getWalkRate() const
The Aurora cursor manager.
void addItem(const Common::UString &tag, int count=1)
std::list< uint32 > _ids
The object's model IDs.
const GFF3List & getList(const Common::UString &field) const
Common::PtrMap< EquipmentSlot, Item > _equipment
const Action * dequeueAction()
int _maxHitPoints
The maximum hitpoints of the object.
const TwoDARow & getRow(size_t row) const
Get a row.
void playDefaultAnimation()
virtual void setPosition(float x, float y, float z)
Set the object's position within its area.
void hide()
Hide the creature's model.
void highlight(bool enabled)
(Un)Highlight the creature.
bool hasScript(Script script) const
Parts of a creature's body.
static const uint32 kFieldIDInvalid
void loadHead(PartModels &parts)
void getPartModels(PartModels &parts, uint32 state='a')
void setPosition(float x, float y, float z)
Set the creature's position.
Item * getEquipedItem(EquipmentSlot slot) const
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
int getBodyVariation() const
static float rad2deg(float rad)
Generic Aurora engines utility functions.
An item in a Star Wars: Knights of the Old Republic area.
void playDefaultHeadAnimation()
void readScripts(const Aurora::GFF3Struct &gff, bool clear=true)
SubRace getSubRace() const
Get the subrace of the creature.
float getCameraHeight() const
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
A map of pointer to objects, with automatic deletion.
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
bool _usable
Is the object usable?
std::vector< ClassLevel > _levels
The levels of the creature.
static Common::UString getHeadMeshString(Gender gender, Skin skin, uint32 faceId)
Generate a string for the head mesh.
The class for storing character information for generation.
bool isVisible() const
Is the creature's model visible?
void printException(Exception &e, const UString &prefix)
Print a whole exception stack to stderr and the log.
Creature template (user), GFF.
int getLevel(const Class &c) const
Get the level of the creature regarding a specific class.
Race _race
The race of the creature.
void removeItem(const Common::UString &tag, int count=1)
Common::UString _conversation
void createFakePC()
Create a fake player character creature for testing purposes.
void enter()
The cursor entered the creature.
void setOrientation(float x, float y, float z, float angle)
Set the creature's orientation.
int stricmp(const UString &str) const
float getFloat(size_t column) const
Return the contents of a cell as a float.
Generic Aurora engines model functions.