91 a->associate->setMaster(0);
167 _model->setPosition(x, y, z);
175 _model->setOrientation(x, y, z, angle);
211 error(
"Unable to set race, raceID is invalid.");
260 if (!creatureClass) {
266 domain1 = creatureClass->
domain1;
267 domain2 = creatureClass->
domain2;
275 creatureClass->
domain1 = domain1;
276 creatureClass->
domain2 = domain2;
284 if (creatureClass->
knownList.size() < spellLevel)
287 std::vector<uint16> &spellLvlList = creatureClass->
knownList[spellLevel];
289 for (std::vector<uint16>::iterator s = spellLvlList.begin(); s != spellLvlList.end(); ++s)
301 creatureClass->
school = school;
309 if (creatureClass->
knownList.size() < spellLevel + 1)
310 creatureClass->
knownList.resize(spellLevel + 1);
312 std::vector<uint16> &spellLvlList = creatureClass->
knownList[spellLevel];
314 for (std::vector<uint16>::iterator s = spellLvlList.begin(); s != spellLvlList.end(); ++s)
318 spellLvlList.push_back(spell);
330 std::vector<uint16> &spellLvlList = creatureClass->
memorizedList[spellLevel];
332 for (std::vector<uint16>::iterator s = spellLvlList.begin(); s != spellLvlList.end(); ++s)
336 spellLvlList.push_back(spell);
390 if (a->associate == &henchman) {
391 assert(a->associate->getMaster() ==
this);
393 a->associate->setMaster(0);
406 std::list<Associate>::const_iterator associate =
_associates.begin();
408 while ((associate !=
_associates.end()) && (associate->type != type))
414 curAssociate = associate->associate;
454 if (!
ResMan.hasResource(part, fileType))
500 "rfoot_g" ,
"lfoot_g" ,
501 "rshin_g" ,
"lshin_g" ,
502 "lthigh_g" ,
"rthigh_g" ,
503 "rforearm_g" ,
"lforearm_g" ,
504 "rbicep_g" ,
"lbicep_g" ,
505 "rshoulder_g",
"lshoulder_g",
506 "rhand_g" ,
"lhand_g" 534 genderChar, raceChar, phenoChar, phenoAltChar,
540 const Item &item = **e;
564 for (std::vector<Class>::iterator c =
_classes.begin(); c !=
_classes.end(); ++c) {
565 if (c->classID != classID)
575 for (std::list<Graphics::Aurora::TextureHandle>::const_iterator p = plts.begin(); p != plts.end(); ++p) {
611 if (appearance.
getString(
"MODELTYPE") ==
"P") {
630 std::list<Common::UString> newTextures;
631 TextureMan.stopRecordNewTextures(newTextures);
633 for (std::list<Common::UString>::const_iterator t = newTextures.begin(); t != newTextures.end(); ++t) {
649 float x, y, z, angle;
670 _model->setEnvironmentMap(environmentMap);
686 load(gff->getTopLevel(), 0);
706 load(creature, utc ? &utc->getTopLevel() : 0);
726 float bearingX = instance.
getDouble(
"XOrientation");
727 float bearingY = instance.
getDouble(
"YOrientation");
738 "ArmorPart_RFoot",
"BodyPart_LFoot" ,
739 "BodyPart_RShin" ,
"BodyPart_LShin" ,
740 "BodyPart_LThigh",
"BodyPart_RThigh",
741 "BodyPart_RFArm" ,
"BodyPart_LFArm" ,
742 "BodyPart_RBicep",
"BodyPart_LBicep",
743 "BodyPart_RShoul",
"BodyPart_LShoul",
744 "BodyPart_RHand" ,
"BodyPart_LHand" 814 for (Aurora::GFF3List::const_iterator s = skills.begin(); s != skills.end(); ++s) {
826 for (Aurora::GFF3List::const_iterator f = feats.begin(); f != feats.end(); ++f) {
874 if (portraitID != 0) {
878 if (!portrait2DA.
empty())
879 portrait =
"po_" + portrait2DA;
882 portrait = gff.
getString(
"Portrait", portrait);
886 if (!gff.
hasField(
"Equip_ItemList"))
890 for (Aurora::GFF3List::const_iterator e = cEquipped.begin(); e != cEquipped.end(); ++e)
895 std::vector<Class> &classes,
uint8 &hitDice) {
904 for (Aurora::GFF3List::const_iterator c = cClasses.begin(); c != cClasses.end(); ++c) {
905 classes.push_back(
Class());
909 classes.back().classID = cClass.
getUint(
"Class");
910 classes.back().level = cClass.
getUint(
"ClassLevel");
912 hitDice += classes.back().level;
919 return TalkMan.getString(strRef);
923 const uint32 strRef =
TwoDAReg.get2DA(
"racialtypes").getRow(
_race).getInt(
"ConverNameLower");
925 return TalkMan.getString(strRef);
931 return TalkMan.getString(strRef);
945 classID =
_classes[position].classID;
950 for (std::vector<Class>::const_iterator c =
_classes.begin(); c !=
_classes.end(); ++c)
951 if (c->classID == classID)
958 for (std::vector<Class>::iterator c =
_classes.begin(); c !=
_classes.end(); ++c) {
959 if (c->classID != classID)
962 if (c->level + levelChange >= 0)
963 c->level += levelChange;
974 newClass.
level = levelChange;
980 const uint32 strRef =
TwoDAReg.get2DA(
"classes").getRow(classID).getInt(
"Name");
982 return TalkMan.getString(strRef);
987 const uint32 strRef =
TwoDAReg.get2DA(
"classes").getRow(classID).getInt(
"Lower");
989 return TalkMan.getString(strRef);
994 const uint32 strRef =
TwoDAReg.get2DA(
"classes").getRow(classID).getInt(
"Plural");
996 return TalkMan.getString(strRef);
1036 assert((ability >= 0) && (ability <
kAbilityMAX));
1069 for (std::vector<uint32>::const_iterator f =
_feats.begin(); f !=
_feats.end(); ++f)
1086 _model->drawBound(enabled);
1122 float length,
float speed) {
1126 if (animation.
empty()) {
1127 _model->playDefaultAnimation();
1131 _model->playAnimation(animation, restart, length, speed);
1142 if (
_model->hasAnimation(anim))
1145 warning(
"Creature::playAnimation(%d = \"%s\", %s, %f, %f)", (
int) animation, anim.
c_str(),
1146 restart ?
"true" :
"false", length, speed);
1164 name = firstName +
" " + lastName;
1177 std::vector<Class> classLevels;
1183 classes =
"(" + classes +
")";
1194 for (std::vector<Class>::const_iterator c = classes.begin(); c != classes.end(); ++c) {
1198 uint32 strRef =
TwoDAReg.get2DA(
"classes").getRow(c->classID).getInt(
"Name");
1200 str +=
TalkMan.getString(strRef);
An inventory item in Neverwinter Nights.
void setPosition(float x, float y, float z)
Set the creature's position.
int64 getSint(const Common::UString &field, int64 def=0) const
Class to hold the two-dimensional array of a 2DA file.
void destroyTooltip()
Destroy all tooltips on this object.
void setGender(Gender gender)
Set the creature's gender.
Handling version V3.2/V3.3 of BioWare's GFFs (generic file format).
#define ResMan
Shortcut for accessing the sound manager.
uint32 _colorHair
The color of the creature's hair.
uint8 getHitDice() const
Returns the number of hit dice, which is effectively the total number of levels.
void setAbility(Ability ability, uint8 score)
Set the creature's ability score.
const Common::UString & getConvclass() const
Return the creature's class as needed in conversations, e.g.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
Common::UString _partsSuperModelName
The supermodel used for parts-based creatures.
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object's orientation.
uint32 getArmorPart(size_t index) const
bool hasScript(Script script) const
uint32 _colorCloth1
The 1. color of the creature's cloth armor.
#define TalkMan
Shortcut for accessing the talk manager.
uint32 getAge() const
Return the creature's age.
bool beginConversation(Object *triggerer)
Begin a conversation between the triggerer and this object.
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
void readScripts(const Aurora::GFF3Struct &gff)
bool getBool(const Common::UString &field, bool def=false) const
uint32 _colorCloth2
The 2. color of the creature's cloth armor.
const Common::UString & getEnvironmentMap() const
Return the area's environment map.
Creature * _master
The creature's master.
void constructModelName(const Common::UString &type, uint32 id, const Common::UString &gender, const Common::UString &race, const Common::UString &phenoType, const Common::UString &phenoTypeAlt, Common::UString &model, Common::UString &texture)
Construct the resource name of a body part files.
bool _isCommandable
Is the creature commandable (has a modifiable action queue)?
A class holding an UTF-8 string.
bool isClickable() const
Can the player click the object?
void hide()
Hide the creature's model.
#define TextureMan
Shortcut for accessing the texture manager.
void setSoundSet(uint32 soundSet)
Set the creature's sound set.
virtual void setOrientation(float x, float y, float z, float angle)
Set the object's orientation.
void reset(PointerType o=0)
Resets the pointer with the new value.
void setRace(uint32 race)
Set the creature's race.
The global config manager.
Common::UString getCreatureAnimationName(Animation animation, bool simple)
Return the name (as found in the models) of a specific creature animation.
const Common::UString & getName() const
Return the object's name.
The Aurora texture manager.
virtual bool click(Object *triggerer=0)
The creature was clicked.
Common::PtrVector< Item > _equippedItems
The creature's equipped items.
bool hasFeat(uint32 feat) const
Does the creature have this feat?
bool hasField(const Common::UString &field) const
Does this specific field exist?
Common::UString _name
The object's display name.
static void loadPortrait(const Aurora::GFF3Struct &gff, Common::UString &portrait)
Load the creature's portrait.
uint32 _colorTattoo2
The 2. color of the creature's tattoo.
bool equalsIgnoreCase(const UString &str) const
A simple streaming file reading class.
void load(const Aurora::GFF3Struct &creature)
Load from a creature instance.
bool isPC() const
Is the creature a player character?
uint8 domain2
Cleric's domain.
void setColorTatto1(uint32 colorTattoo1)
Set the creature's color tattoo 1.
void removeAssociate(Creature &ssociate)
Remove an associate (henchman, familiar, ...).
uint32 _colorSkin
The color of the creature's skin.
void setColorHair(uint32 colorHair)
Set the creature's color hair.
uint64 getUint(const Common::UString &field, uint64 def=0) const
std::vector< std::vector< uint16 > > knownList
Known spells list.
uint8 getAbility(Ability ability) const
Return a creature's ability score.
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.
Common::UString _subRace
The creature's subrace.
An area in Neverwinter Nights, holding all objects and room tiles within, as well as general area pro...
uint8 getGoodEvil() const
Get the creature's good-evil alignment.
void setPhenotype(uint32 phenotype)
Set the creature's phenotype.
void setLawChaos(uint8 lawfulness)
Set the creature's law-chaos alignment.
uint32 getColor(Color color) const
static const uint32 kClassInvalid
static const char *const kBodyPartModels[]
bool isFemale() const
Is the creature female, do we need female dialogs tokens?
uint32 _colorMetal2
The 2. color of the creature's metal armor.
A vector of pointer to objects, with automatic deletion.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
bool _isPC
Is the creature a PC?
Class * findClass(uint32 classID)
Find the creature's class if any.
uint32 getXP() const
Return the creature's XP.
uint8 _goodEvil
The creature's good/evil value (0-100).
static void getPCListInfo(const Common::UString &bic, bool local, Common::UString &name, Common::UString &classes, Common::UString &portrait)
Return the information needed for a character list.
The context holding a Neverwinter Nights area.
const char * c_str() const
Return the (utf8 encoded) string data.
std::list< uint32 > _ids
The object's model IDs.
const Common::UString & getSubRace() const
Get the creature's subrace.
int8 getSkillRank(uint32 skill) const
Return the creature's rank in this skill.
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
static void loadClasses(const Aurora::GFF3Struct &gff, std::vector< Class > &classes, uint8 &hitDice)
Load the creature's classes.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
static Aurora::GFF3File * openPC(const Common::UString &bic, bool local)
uint32 _lastChangedGUIDisplay
The time a GUI relevant property was changed last.
void setColorSkin(uint32 colorSkin)
Set the creature's color skin.
#define ConfigMan
Shortcut for accessing the config manager.
const Common::UString & getConvrace() const
Return the creature's lowercase race as needed in conversations, e.g.
Common::UString _lastName
The creature's last name.
Utility templates and functions.
Creature * getAssociate(AssociateType type, size_t nth=1) const
Get this creature's nth's associate of a specific type.
bool isCommandable() const
Is this creature commandable (has a modifiable action queue)?
uint32 _colorLeather2
The 2. color of the creature's leather armor.
void setCommandable(bool commandable)
Set whether this creature commandable (has a modifiable action queue).
void setSchool(uint32 classID, uint8 school)
Set the creature's school.
double getDouble(const Common::UString &field, double def=0.0) const
uint16 level
Levels of that class.
Handling BioWare's 2DAs (two-dimensional array).
void setPortrait(const Common::UString &portrait)
Set the creature's portrait.
const Common::UString & getDeity() const
Get the creature's deity.
void setArea(Area *area)
Set the area this creature is currently in.
uint8 school
Wizard's spell school.
const Common::UString & getConvRace() const
Return the creature's race as needed in conversations, e.g.
The global events manager.
Common::ScopedPtr< Tooltip > _tooltip
The tooltip displayed over the object.
uint32 classID
Index into classes.2da.
std::vector< std::vector< uint16 > > memorizedList
Memorized spells list.
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
uint32 _phenotype
The creature's phenotype.
A node within a 3D model.
uint32 _age
The creature's age.
std::vector< Class > _classes
The creature's classes.
int32 _currentHP
The creature's current health points.
bool createTooltip(Tooltip::Type type)
Create an empty tooltip.
void setFeat(uint32 feat)
Append a feat to the creature.
virtual void setPosition(float x, float y, float z)
Set the object's position within its area.
void setDomains(uint32 classID, uint8 domain1, uint8 domain2)
Set clerical domains.
Common::UString _description
The object's description.
uint16 getClassLevel(uint32 classID) const
Get the creature's level for this class.
Area * _area
The area the object is currently in.
bool showFeedbackTooltip()
Create and show a tooltip with the name and/or portrait of the object.
bool empty() const
Is the string empty?
void setLayerColor(Layer layer, uint8 color)
Set the color of one layer within this layer texture.
#define TwoDAReg
Shortcut for accessing the 2da registry.
std::vector< uint32 > _feats
The creature's feats.
void setHead(uint32 headID)
Set the creature's head.
Creature()
Create a dummy creature instance.
uint32 _appearanceID
The creature's general appearance.
uint8 _abilities[kAbilityMAX]
The creature's abilities.
int32 getMaxHP() const
Return the max HP this creature can have.
const Common::UString & getFirstName() const
Return the creature's first name.
virtual void setArea(Area *)
Set the area this object is currently in.
Common::ScopedPtr< Graphics::Aurora::Model > _model
The creature's model.
void init()
Init the creature.
void warning(const char *s,...)
void changeClassLevel(uint32 classID, int16 levelChange)
Set the creature's level for this class.
bool hasSpell(uint32 classID, size_t spellLevel, uint16 spell)
Do the creature know the spell?
Common::UString _firstName
The creature's first name.
int32 getInt(size_t column) const
Return the contents of a cell as an int.
Associate(AssociateType t=kAssociateTypeNone, Creature *a=0)
static const char *const kBodyPartNodes[]
const Common::UString & getConvRaces() const
Return the creature's race plural as needed in conversations, e.g.
std::vector< const GFF3Struct * > GFF3List
#define EventMan
Shortcut for accessing the events manager.
uint8 _hitDice
The creature's hit dice.
std::list< Associate > _associates
The creature's associates.
uint8 _startingPackage
The package chosen at creature's creation.
static const uint32 kRaceInvalid
const Common::UString & getLastName() const
Return the creature's last name.
Implementing the stream reading interfaces for files.
void setKnownSpell(uint32 classID, size_t spellLevel, uint16 spell)
Set a creature's known spell.
void getClass(uint32 position, uint32 &classID, uint16 &level) const
Get the creature's class and level at that class slot position.
uint8 _lawChaos
The creature's law/chaos value (0-100).
uint32 _xp
The creature's experience.
Common::UString _portrait
The object's portrait.
uint8 domain1
Cleric's domain.
void getArmorModels()
Populate the armor info for body parts.
Basic type definitions to handle files used in BioWare's Aurora engine.
const GFF3List & getList(const Common::UString &field) const
Common::UString getClassString() const
Return the creature's class description.
uint32 _soundSet
The object's sound set, as an index into soundset.2da.
uint32 getRace() const
Return the creature's race value.
const TwoDARow & getRow(size_t row) const
Get a row.
bool isAnimationLooping(Animation animation)
Return true if the specified animation allows looping.
uint32 _colorLeather1
The 1. color of the creature's leather armor.
uint8 getLawChaos() const
Get the creature's law-chaos alignment.
void loadEquippedItems(const Aurora::GFF3Struct &gff)
int32 _baseHP
The creature's base maximum health points.
void loadCharacter(const Common::UString &bic, bool local)
Load from a character file.
void setGoodEvil(uint8 goodness)
Set the creature's good-evil alignment.
void addAssociate(Creature &associate, AssociateType type)
Add an associate (henchman, familiar, ...).
uint8 getStartingPackage() const
Return the creature's starting package.
uint32 _colorTattoo1
The 1. color of the creature's tattoo.
int32 getCurrentHP() const
Return the current HP this creature has.
Gender _gender
The creature's gender.
Gender getGender() const
Get the creature's gender.
virtual void highlight(bool enabled)
(Un)Highlight the creature.
void setOrientation(float x, float y, float z, float angle)
Set the creature's orientation.
The global talk manager for Aurora strings.
A creature in a Neverwinter Nights area.
const Common::UString & getPortrait() const
Get the creature's portrait.
static const uint32 kFieldIDInvalid
void unloadModel()
Unload the creature's model.
void loadProperties(const Aurora::GFF3Struct &gff)
Load general creature properties.
FileType
Various file types used by the Aurora engine and found in archives.
void status(const char *s,...)
void leave()
The cursor left the creature.
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
static float rad2deg(float rad)
void show()
Show the creature's model.
Generic Aurora engines utility functions.
Common::UString _deity
The creature's deity.
uint32 lastChangedGUIDisplay() const
Last time info was changed that's displayed in the GUI.
Creature * getMaster() const
Return the creature's master.
Common::UString _environmentMap
The environment map override to use on the model.
void loadModel()
Load the creature's model.
void playAnimation(const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f)
Play a creature animation.
std::vector< int8 > _skills
The creature's skills.
void setColorTatto2(uint32 colorTattoo2)
Set the creature's color tatto 2.
bool isDM() const
Is the creature a dungeon master?
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
void setMemorizedSpell(uint32 classID, size_t spellLevel, uint16 spell)
Set a creature's memorized spell.
void setStartingPackage(uint8 package)
Set the creature's starting package.
void setMaster(Creature *master=0)
Set the creature's master.
void NORETURN_PRE error(const char *s,...)
void setAppearance(uint32 appearanceID)
Set the creature's appearance.
void getDomains(uint32 classID, uint8 &domain1, uint8 &domain2)
Get clerical domains.
void constructPartName(const Common::UString &type, uint32 id, const Common::UString &gender, const Common::UString &race, const Common::UString &phenoType, Common::UString &part)
Construct the resource name of a body part files.
void addEquippedItem(Item *item)
Add an equippement to the creature.
Common::UString _conversation
The object's default conversation.
void clear()
Clear the string's contents.
void getPartModels()
Construct all body part models' resource names.
static const char *const kBodyPartFields[]
Creature template (user), GFF.
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
uint32 _race
The creature's race.
void enter()
The cursor entered the creature.
const Common::UString & getConvClasses() const
Return the creature's class plural as needed in conversations, e.g.
void rebuild()
Rebuild the combined texture image.
bool _isDM
Is the creature a DM?
int32 _bonusHP
The creature's bonus health points.
BioWare's Packed Layered Texture.
void hideTooltip()
Hide the tooltip again.
The global resource manager for Aurora resources.
void finishPLTs(const std::list< Graphics::Aurora::TextureHandle > &plts)
Finished those paletted textures.
const Common::UString & getConvClass() const
Return the creature's class as needed in conversations, e.g.
void setSkillRank(size_t skill, uint8 rank)
Set the creature's skill rank.
std::vector< BodyPart > _bodyParts
The creature's body parts.
uint32 _colorMetal1
The 1. color of the creature's metal armor.
static const uint32 kBICID
Generic Aurora engines model functions.