xoreos  0.0.5
creature.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #include <cassert>
26 
27 #include "src/common/scopedptr.h"
28 #include "src/common/util.h"
29 #include "src/common/maths.h"
30 #include "src/common/configman.h"
31 #include "src/common/readfile.h"
32 
33 #include "src/aurora/types.h"
34 #include "src/aurora/gff3file.h"
35 #include "src/aurora/2dafile.h"
36 #include "src/aurora/2dareg.h"
37 
39 
42 
43 #include "src/engines/nwn2/util.h"
45 
46 static const uint32 kBICID = MKTAG('B', 'I', 'C', ' ');
47 
48 namespace Engines {
49 
50 namespace NWN2 {
51 
53  init();
54 }
55 
57  init();
58 
59  load(creature);
60 }
61 
63  init();
64 
65  loadCharacter(bic, local);
66 }
67 
69 }
70 
72  _static = false;
73  _usable = true;
74 
78 
79  _isPC = false;
80  _isDM = false;
81 
82  _age = 0;
83 
84  _xp = 0;
85 
86  _baseHP = 0;
87  _bonusHP = 0;
88  _currentHP = 0;
89 
90  _hitDice = 0;
91 
92  _goodEvil = 0;
93  _lawChaos = 0;
94 
96 
97  _appearanceHead = 0;
98  _appearanceMHair = 0;
99  _appearanceFHair = 0;
100 
101  _armorVisualType = 0;
102  _armorVariation = 0;
103 
104  _bootsVisualType = 0;
105  _bootsVariation = 0;
106 
107  for (size_t i = 0; i < kAbilityMAX; i++)
108  _abilities[i] = 0;
109 }
110 
112  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m)
113  (*m)->show();
114 }
115 
117  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m)
118  (*m)->hide();
119 }
120 
121 void Creature::setPosition(float x, float y, float z) {
122  Object::setPosition(x, y, z);
123  Object::getPosition(x, y, z);
124 
125  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m)
126  (*m)->setPosition(x, y, z);
127 }
128 
129 void Creature::setOrientation(float x, float y, float z, float angle) {
130  Object::setOrientation(x, y, z, angle);
131  Object::getOrientation(x, y, z, angle);
132 
133  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m)
134  (*m)->setOrientation(x, y, z, angle);
135 }
136 
138  highlight(true);
139 }
140 
142  highlight(false);
143 }
144 
145 void Creature::highlight(bool enabled) {
146  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m)
147  (*m)->drawBound(enabled);
148 }
149 
150 bool Creature::click(Object *triggerer) {
151  // Try the onDialog script first
153  return runScript(kScriptDialogue, this, triggerer);
154 
155  // Next, look we have a generic onClick script
156  if (hasScript(kScriptClick))
157  return runScript(kScriptClick, this, triggerer);
158 
159  return false;
160 }
161 
163  return _firstName;
164 }
165 
167  return _lastName;
168 }
169 
171  return _gender;
172 }
173 
175  _gender = gender;
176 }
177 
178 bool Creature::isFemale() const {
179  // Male and female are hardcoded. Other genders (none, both, other)
180  // count as male when it comes to tokens in text strings.
181 
182  return _gender == kGenderFemale;
183 }
184 
186  return _race;
187 }
188 
190  _race = race;
191 }
192 
194  return _subRace;
195 }
196 
198  _subRace = subRace;
199 }
200 
201 bool Creature::isPC() const {
202  return _isPC;
203 }
204 
205 bool Creature::isDM() const {
206  return _isDM;
207 }
208 
210  return _age;
211 }
212 
214  return _xp;
215 }
216 
218  return _currentHP + _bonusHP;
219 }
220 
222  return _baseHP + _bonusHP;
223 }
224 
226  const Aurora::TwoDARow &appearance = TwoDAReg.get2DA("appearance").getRow(_appearanceID);
227 
228  Common::UString baseModel = appearance.getString(base);
229 
230  // Male/Female
231  baseModel.replaceAll('?', isFemale() ? 'F' : 'M');
232 
233  return baseModel;
234 }
235 
237  const Common::UString &armor, uint8 visualType, uint8 variation) {
238 
239  const Aurora::TwoDARow &armorVisual = TwoDAReg.get2DA("armorvisualdata").getRow(visualType);
240  Common::UString armorPrefix = armorVisual.getString("Prefix");
241 
242  Common::UString modelFile;
243  modelFile = Common::UString::format("%s_%s_%s%02d",
244  body.c_str(), armorPrefix.c_str(), armor.c_str(), variation + 1);
245 
246  Graphics::Aurora::Model *model = loadModelObject(modelFile);
247  if (model)
248  _modelParts.push_back(model);
249 
250  return model != 0;
251 }
252 
253 bool Creature::loadHeadModel(uint8 appearance) {
254  if (appearance == 0)
255  return false;
256 
257  Common::UString head = getBaseModel("NWN2_Model_Head");
258  if (head.empty())
259  return false;
260 
261  Common::UString modelFile;
262  modelFile = Common::UString::format("%s%02d", head.c_str(), appearance);
263 
264  Graphics::Aurora::Model *model = loadModelObject(modelFile);
265  if (model)
266  _modelParts.push_back(model);
267 
268  return model != 0;
269 }
270 
271 bool Creature::loadHairModel(uint8 appearance) {
272  if (appearance == 0)
273  return false;
274 
275  Common::UString hair = getBaseModel("NWN2_Model_Hair");
276  if (hair.empty())
277  return false;
278 
279  Common::UString modelFile;
280  modelFile = Common::UString::format("%s%02d", hair.c_str(), appearance);
281 
282  Graphics::Aurora::Model *model = loadModelObject(modelFile);
283  if (model)
284  _modelParts.push_back(model);
285 
286  return model != 0;
287 }
288 
290  if (!_modelParts.empty())
291  return;
292 
294  warning("Creature \"%s\" has no appearance", _tag.c_str());
295  return;
296  }
297 
298  Common::UString body = getBaseModel("NWN2_Model_Body");
299  if (body.empty()) {
300  warning("Creature \"%s\" has no body", _tag.c_str());
301  return;
302  }
303 
304  // Main body model
306 
307  const Aurora::TwoDARow &appearance = TwoDAReg.get2DA("appearance").getRow(_appearanceID);
308  if (appearance.getInt("BodyType") == 1) {
309  // Creature with more part models than just the body
310 
314 
316  if (!loadArmorModel(body, "GLOVES", 10, 0))
317  loadArmorModel(body, "GLOVES", 0, 0);
318  }
319 
320  // Positioning
321 
322  float x, y, z, angle;
323 
324  getPosition(x, y, z);
325  setPosition(x, y, z);
326 
327  getOrientation(x, y, z, angle);
328  setOrientation(x, y, z, angle);
329 
330  for (ModelParts::iterator m = _modelParts.begin(); m != _modelParts.end(); ++m) {
331  (*m)->setTag(_tag);
332  (*m)->setClickable(isClickable());
333 
334  _ids.push_back((*m)->getID());
335  }
336 }
337 
339  hide();
340 
341  _modelParts.clear();
342 }
343 
344 void Creature::load(const Aurora::GFF3Struct &creature) {
345  Common::UString temp = creature.getString("TemplateResRef");
346 
348  if (!temp.empty())
349  utc.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTC, MKTAG('U', 'T', 'C', ' ')));
350 
351  load(creature, utc ? &utc->getTopLevel() : 0);
352 }
353 
354 void Creature::loadCharacter(const Common::UString &bic, bool local) {
356 
357  load(gff->getTopLevel(), 0);
358 
359  // All BICs should be PCs.
360  _isPC = true;
361 
362  // Set the PC tag to something recognizable for now.
363  // Let's hope no script depends on it being "".
364 
365  _tag = Common::UString::format("[PC: %s]", _name.c_str());
366 }
367 
368 void Creature::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
369  // General properties
370 
371  if (blueprint)
372  loadProperties(*blueprint); // Blueprint
373  loadProperties(instance); // Instance
374 
375  // Position
376 
377  setPosition(instance.getDouble("XPosition"),
378  instance.getDouble("YPosition"),
379  instance.getDouble("ZPosition"));
380 
381  // Orientation
382 
383  float bearingX = instance.getDouble("XOrientation");
384  float bearingY = instance.getDouble("YOrientation");
385 
386  setOrientation(0.0f, 0.0f, 1.0f, -Common::rad2deg(atan2(bearingX, bearingY)));
387 }
388 
390  // Tag
391 
392  _tag = gff.getString("Tag", _tag);
393 
394  // Name
395 
396  _firstName = gff.getString("FirstName", _firstName);
397  _lastName = gff.getString("LastName" , _lastName);
398 
399  _name = _firstName + " " + _lastName;
400  _name.trim();
401 
402  // Description
403 
404  _description = gff.getString("Description", _description);
405 
406  // Conversation
407 
408  _conversation = gff.getString("Conversation", _conversation);
409 
410  // Sound Set
411 
412  _soundSet = gff.getUint("SoundSetFile", Aurora::kFieldIDInvalid);
413 
414  // Gender
415  _gender = gff.getUint("Gender", _gender);
416 
417  // Race
418  _race = gff.getUint("Race", _race);
419 
420  // Subrace
421  _subRace = gff.getUint("Subrace", _subRace);
422 
423  // PC and DM
424  _isPC = gff.getBool("IsPC", _isPC);
425  _isDM = gff.getBool("IsDM", _isDM);
426 
427  // Age
428  _age = gff.getUint("Age", _age);
429 
430  // Experience
431  _xp = gff.getUint("Experience", _xp);
432 
433  // Abilities
440 
441  // Classes
443 
444  // Skills
445  if (gff.hasField("SkillList")) {
446  _skills.clear();
447 
448  const Aurora::GFF3List &skills = gff.getList("SkillList");
449  for (Aurora::GFF3List::const_iterator s = skills.begin(); s != skills.end(); ++s) {
450  const Aurora::GFF3Struct &skill = **s;
451 
452  _skills.push_back(skill.getSint("Rank"));
453  }
454  }
455 
456  // Feats
457  if (gff.hasField("FeatList")) {
458  _feats.clear();
459 
460  const Aurora::GFF3List &feats = gff.getList("FeatList");
461  for (Aurora::GFF3List::const_iterator f = feats.begin(); f != feats.end(); ++f) {
462  const Aurora::GFF3Struct &feat = **f;
463 
464  _feats.push_back(feat.getUint("Feat"));
465  }
466  }
467 
468  // Deity
469  _deity = gff.getString("Deity", _deity);
470 
471  // Health
472  if (gff.hasField("HitPoints")) {
473  _baseHP = gff.getSint("HitPoints");
474  _bonusHP = gff.getSint("MaxHitPoints", _baseHP) - _baseHP;
475  _currentHP = gff.getSint("CurrentHitPoints", _baseHP);
476  }
477 
478  // Alignment
479 
480  _goodEvil = gff.getUint("GoodEvil", _goodEvil);
481  _lawChaos = gff.getUint("LawfulChaotic", _lawChaos);
482 
483  // Appearance
484 
485  _appearanceID = gff.getUint("Appearance_Type", _appearanceID);
486 
487  _appearanceHead = gff.getUint("Appearance_Head" , _appearanceHead);
488  _appearanceMHair = gff.getUint("Appearance_Hair" , _appearanceMHair);
489  _appearanceFHair = gff.getUint("Appearance_FHair", _appearanceFHair);
490 
491  _armorVisualType = gff.getUint("ArmorVisualType", _armorVisualType);
492  _armorVariation = gff.getUint("Variation" , _armorVariation);
493 
494  if (gff.hasField("Boots")) {
495  const Aurora::GFF3Struct &boots = gff.getStruct("Boots");
496 
497  _bootsVisualType = boots.getUint("ArmorVisualType", _bootsVisualType);
498  _bootsVariation = boots.getUint("Variation" , _bootsVariation);
499  }
500 
501  // Scripts and variables
502  readScripts(gff);
503  readVarTable(gff);
504 }
505 
507  std::vector<Class> &classes, uint8 &hitDice) {
508 
509  if (!gff.hasField("ClassList"))
510  return;
511 
512  classes.clear();
513  hitDice = 0;
514 
515  const Aurora::GFF3List &cClasses = gff.getList("ClassList");
516  for (Aurora::GFF3List::const_iterator c = cClasses.begin(); c != cClasses.end(); ++c) {
517  classes.push_back(Class());
518 
519  const Aurora::GFF3Struct &cClass = **c;
520 
521  classes.back().classID = cClass.getUint("Class");
522  classes.back().level = cClass.getUint("ClassLevel");
523 
524  hitDice += classes.back().level;
525  }
526 }
527 
528 void Creature::getClass(uint32 position, uint32 &classID, uint16 &level) const {
529  if (position >= _classes.size()) {
530  classID = kClassInvalid;
531  level = 0;
532  return;
533  }
534 
535  classID = _classes[position].classID;
536  level = _classes[position].level;
537 }
538 
540  for (std::vector<Class>::const_iterator c = _classes.begin(); c != _classes.end(); ++c)
541  if (c->classID == classID)
542  return c->level;
543 
544  return 0;
545 }
546 
548  return _deity;
549 }
550 
552  return _goodEvil;
553 }
554 
556  return _lawChaos;
557 }
558 
560  return _hitDice;
561 }
562 
564  assert((ability >= 0) && (ability < kAbilityMAX));
565 
566  return _abilities[ability];
567 }
568 
570  if (skill >= _skills.size())
571  return -1;
572 
573  return _skills[skill];
574 }
575 
576 bool Creature::hasFeat(uint32 feat) const {
577  for (std::vector<uint32>::const_iterator f = _feats.begin(); f != _feats.end(); ++f)
578  if (*f == feat)
579  return true;
580 
581  return false;
582 }
583 
585  const Common::UString pcDir = ConfigMan.getString(local ? "NWN2_localPCDir" : "NWN2_serverPCDir");
586  const Common::UString pcFile = pcDir + "/" + bic + ".bic";
587 
588  return new Aurora::GFF3File(new Common::ReadFile(pcFile), kBICID);
589 }
590 
591 } // End of namespace NWN2
592 
593 } // End of namespace Engines
int64 getSint(const Common::UString &field, int64 def=0) const
Definition: gff3file.cpp:473
uint16 getClassLevel(uint32 classID) const
Get the creature&#39;s level for this class.
Definition: creature.cpp:539
Handling version V3.2/V3.3 of BioWare&#39;s GFFs (generic file format).
bool isClickable() const
Can the player click the object?
Definition: object.cpp:114
Neverwinter Nights 2 utility functions.
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like &#39;DATA&#39;, to ensure portability.
Definition: endianness.h:140
static const uint32 kSubRaceInvalid
Definition: types.h:134
uint8 _appearanceHead
The model variant used for the head.
Definition: creature.h:189
int32 _baseHP
The creature&#39;s base maximum health points.
Definition: creature.h:164
bool hasFeat(uint32 feat) const
Does the creature have this feat?
Definition: creature.cpp:576
const Common::UString & getString(size_t column) const
Return the contents of a cell as a string.
Definition: 2dafile.cpp:59
bool getBool(const Common::UString &field, bool def=false) const
Definition: gff3file.cpp:510
A class holding an UTF-8 string.
Definition: ustring.h:48
uint8 getGoodEvil() const
Definition: creature.cpp:551
void reset(PointerType o=0)
Resets the pointer with the new value.
Definition: scopedptr.h:87
The global config manager.
void init()
Init the creature.
Definition: creature.cpp:71
static const uint32 kClassInvalid
Definition: types.h:135
uint8_t uint8
Definition: types.h:200
static Aurora::GFF3File * openPC(const Common::UString &bic, bool local)
Definition: creature.cpp:584
void load(const Aurora::GFF3Struct &creature)
Load from a creature instance.
Definition: creature.cpp:344
bool hasField(const Common::UString &field) const
Does this specific field exist?
Definition: gff3file.cpp:400
Mathematical helpers.
void setSubRace(uint32 subRace)
Set the creature&#39;s subrace.
Definition: creature.cpp:197
virtual void getOrientation(float &x, float &y, float &z, float &angle) const
Return the object&#39;s orientation.
Definition: object.cpp:148
uint32 getGender() const
Get the creature&#39;s gender.
Definition: creature.cpp:170
std::vector< uint32 > _feats
The creature&#39;s feats.
Definition: creature.h:172
A simple streaming file reading class.
Definition: readfile.h:40
uint32 _soundSet
The object&#39;s sound set, as an index into soundset.2da.
Definition: object.h:152
uint32 _appearanceID
The creature&#39;s general appearance.
Definition: creature.h:181
uint64 getUint(const Common::UString &field, uint64 def=0) const
Definition: gff3file.cpp:436
void loadModel()
Load the creature&#39;s model.
Definition: creature.cpp:289
bool click(Object *triggerer=0)
The creature was clicked.
Definition: creature.cpp:150
int32 _currentHP
The creature&#39;s current health points.
Definition: creature.h:166
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.
Definition: util.cpp:150
Common::UString _name
The object&#39;s display name.
Definition: object.h:147
An object within a NWN2 area.
Definition: object.h:58
void readVarTable(const Aurora::GFF3List &varTable)
Read the object&#39;s variable table.
Definition: object.cpp:200
Common::UString _lastName
The creature&#39;s last name.
Definition: creature.h:151
void loadProperties(const Aurora::GFF3Struct &gff)
Load general creature properties.
Definition: creature.cpp:389
A simple scoped smart pointer template.
bool loadArmorModel(const Common::UString &body, const Common::UString &armor, uint8 visualType, uint8 variation)
Definition: creature.cpp:236
uint8 getAbility(Ability ability) const
Return a creature&#39;s ability score.
Definition: creature.cpp:563
bool _usable
Is the object usable?
Definition: object.h:156
void unloadModel()
Unload the creature&#39;s model.
Definition: creature.cpp:338
std::list< uint32 > _ids
The object&#39;s model IDs.
Definition: object.h:158
void leave()
The cursor left the creature.
Definition: creature.cpp:141
uint8 getHitDice() const
Returns the number of hit dice, which is effectively the total number of levels.
Definition: creature.cpp:559
A creature in a Neverwinter Nights 2 area.
const char * c_str() const
Return the (utf8 encoded) string data.
Definition: ustring.cpp:249
void replaceAll(uint32 what, uint32 with)
Replace all occurrences of a character with another character.
Definition: ustring.cpp:435
Common::UString getBaseModel(const Common::UString &base)
Definition: creature.cpp:225
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
Definition: ustring.cpp:718
void highlight(bool enabled)
(Un)Highlight the creature.
Definition: creature.cpp:145
uint32 _age
The creature&#39;s age.
Definition: creature.h:160
uint16_t uint16
Definition: types.h:202
#define ConfigMan
Shortcut for accessing the config manager.
Definition: configman.h:176
void readScripts(const Aurora::GFF3Struct &gff)
Definition: container.cpp:131
uint32 getRace() const
Return the creature&#39;s race value.
Definition: creature.cpp:185
Utility templates and functions.
uint8 _appearanceFHair
The model variant used for female hair.
Definition: creature.h:191
void hide()
Hide the creature&#39;s model.
Definition: creature.cpp:116
void loadCharacter(const Common::UString &bic, bool local)
Load from a character file.
Definition: creature.cpp:354
double getDouble(const Common::UString &field, double def=0.0) const
Definition: gff3file.cpp:514
Handling BioWare&#39;s 2DAs (two-dimensional array).
uint32 getAge() const
Return the creature&#39;s age.
Definition: creature.cpp:209
A GFF (generic file format) V3.2/V3.3 file, found in all Aurora games except Sonic Chronicles: The Da...
Definition: gff3file.h:85
bool _isDM
Is the creature a DM?
Definition: creature.h:158
bool _isPC
Is the creature a PC?
Definition: creature.h:157
A 3D model of an object.
Common::UString _conversation
The object&#39;s default conversation.
Definition: object.h:150
bool empty() const
Is the string empty?
Definition: ustring.cpp:245
#define TwoDAReg
Shortcut for accessing the 2da registry.
Definition: 2dareg.h:101
uint8 _goodEvil
The creature&#39;s good/evil value (0-100).
Definition: creature.h:178
The global 2DA registry.
Common::UString _deity
The creature&#39;s deity.
Definition: creature.h:176
int8 getSkillRank(uint32 skill) const
Return the creature&#39;s rank in this skill.
Definition: creature.cpp:569
void setGender(uint32 gender)
Set the creature&#39;s gender.
Definition: creature.cpp:174
void warning(const char *s,...)
Definition: util.cpp:33
uint32 _gender
The creature&#39;s gender.
Definition: creature.h:153
int32 getInt(size_t column) const
Return the contents of a cell as an int.
Definition: 2dafile.cpp:75
bool isPC() const
Is the creature a player character?
Definition: creature.cpp:201
std::vector< const GFF3Struct * > GFF3List
Definition: types.h:449
void getClass(uint32 position, uint32 &classID, uint16 &level) const
Get the creature&#39;s class and level at that class slot position.
Definition: creature.cpp:528
bool isDM() const
Is the creature a dungeon master?
Definition: creature.cpp:205
bool loadHairModel(uint8 appearance)
Definition: creature.cpp:271
Implementing the stream reading interfaces for files.
uint8 _lawChaos
The creature&#39;s law/chaos value (0-100).
Definition: creature.h:179
uint32 _xp
The creature&#39;s experience.
Definition: creature.h:162
uint8 _hitDice
The creature&#39;s hit dice.
Definition: creature.h:174
virtual void setOrientation(float x, float y, float z, float angle)
Set the object&#39;s orientation.
Definition: object.cpp:162
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
const GFF3List & getList(const Common::UString &field) const
Definition: gff3file.cpp:741
uint8 _appearanceMHair
The model variant used for male hair.
Definition: creature.h:190
uint32 _subRace
The creature&#39;s subrace.
Definition: creature.h:155
int32 getCurrentHP() const
Return the current HP this creature has.
Definition: creature.cpp:217
int32 _bonusHP
The creature&#39;s bonus health points.
Definition: creature.h:165
virtual void setPosition(float x, float y, float z)
Set the object&#39;s position within its area.
Definition: object.cpp:156
int8_t int8
Definition: types.h:199
void clear()
Definition: ptrlist.h:47
std::vector< Class > _classes
The creature&#39;s classes.
Definition: creature.h:170
A struct within a GFF3.
Definition: gff3file.h:164
uint32_t uint32
Definition: types.h:204
const GFF3Struct & getStruct(const Common::UString &field) const
Definition: gff3file.cpp:728
std::vector< int8 > _skills
The creature&#39;s skills.
Definition: creature.h:171
Common::UString _tag
Definition: object.h:56
static const uint32 kFieldIDInvalid
Definition: types.h:443
void enter()
The cursor entered the creature.
Definition: creature.cpp:137
uint8 _abilities[kAbilityMAX]
The creature&#39;s abilities.
Definition: creature.h:168
virtual void getPosition(float &x, float &y, float &z) const
Return the object&#39;s position within its area.
Definition: object.cpp:142
const Common::UString & getLastName() const
Return the creature&#39;s last name.
Definition: creature.cpp:166
void show()
Show the creature&#39;s model.
Definition: creature.cpp:111
ModelParts _modelParts
Definition: creature.h:193
Common::UString getString(const Common::UString &field, const Common::UString &def="") const
Definition: gff3file.cpp:527
bool _static
Is the object static?
Definition: object.h:155
void setRace(uint32 race)
Set the creature&#39;s race.
Definition: creature.cpp:189
static float rad2deg(float rad)
Definition: maths.h:93
Generic Aurora engines utility functions.
Common::UString _firstName
The creature&#39;s first name.
Definition: creature.h:150
bool runScript(Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
Definition: container.cpp:147
uint32 getSubRace() const
Return the creature&#39;s subrace value.
Definition: creature.cpp:193
bool loadHeadModel(uint8 appearance)
Definition: creature.cpp:253
Graphics::Aurora::Model * loadModelObject(const Common::UString &resref, const Common::UString &texture)
Definition: model.cpp:47
static const uint32 kBICID
Definition: creature.cpp:46
A row within a 2DA file.
Definition: 2dafile.h:61
void setOrientation(float x, float y, float z, float angle)
Set the creature&#39;s orientation.
Definition: creature.cpp:129
bool isFemale() const
Is the creature female, do we need female dialogs tokens?
Definition: creature.cpp:178
int32 getMaxHP() const
Return the max HP this creature can have.
Definition: creature.cpp:221
uint8 getLawChaos() const
Definition: creature.cpp:555
static void loadClasses(const Aurora::GFF3Struct &gff, std::vector< Class > &classes, uint8 &hitDice)
Load the creature&#39;s classes.
Definition: creature.cpp:506
Creature template (user), GFF.
Definition: types.h:93
Creature()
Create a dummy creature instance.
Definition: creature.cpp:52
void setPosition(float x, float y, float z)
Set the creature&#39;s position.
Definition: creature.cpp:121
const Common::UString & getDeity() const
Get the creature&#39;s deity.
Definition: creature.cpp:547
bool hasScript(Script script) const
Definition: container.cpp:122
uint32 _race
The creature&#39;s race.
Definition: creature.h:154
int32_t int32
Definition: types.h:203
Common::UString _description
The object&#39;s description.
Definition: object.h:148
static const uint32 kRaceInvalid
Definition: types.h:133
uint32 getXP() const
Return the creature&#39;s XP.
Definition: creature.cpp:213
Generic Aurora engines model functions.
const Common::UString & getFirstName() const
Return the creature&#39;s first name.
Definition: creature.cpp:162