xoreos  0.0.5
creature.h
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 #ifndef ENGINES_DRAGONAGE2_CREATURE_H
26 #define ENGINES_DRAGONAGE2_CREATURE_H
27 
28 #include <vector>
29 #include <list>
30 
31 #include "src/common/ptrlist.h"
32 #include "src/common/ustring.h"
33 
34 #include "src/aurora/types.h"
35 
37 
40 
41 namespace Aurora {
42  class GDAFile;
43 }
44 
45 namespace Engines {
46 
47 namespace DragonAge2 {
48 
49 class Creature : public Object {
50 public:
52  Creature();
54  Creature(const Aurora::GFF3Struct &placeable);
55  ~Creature();
56 
58  void createFakePC();
59 
60  // Basic visuals
61 
62  void show();
63  void hide();
64 
65  // Basic properties
66 
67  bool isPC() const;
68 
69  // Object/Cursor interactions
70 
71  void enter();
72  void leave();
73 
75  void highlight(bool enabled);
76 
78  bool click(Object *triggerer = 0);
79 
80  // Positioning
81 
83  void setPosition(float x, float y, float z);
85  void setOrientation(float x, float y, float z, float angle);
86 
87 
88 private:
90  static const size_t kPartVariationCount = 4;
91 
93  struct EquipItem {
95 
97 
98  bool stealable;
99  bool droopable;
100 
102  };
103  typedef std::vector<EquipItem> Items;
104 
106 
107 
108  bool _isPC;
109 
112 
117 
120 
123 
124 
125  void init();
126  void load(const Aurora::GFF3Struct &placeable);
127  void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint);
128 
129  void loadProperties(const Aurora::GFF3Struct &gff);
130 
131  void loadModelsSimple(const Aurora::GDAFile &gda, size_t row);
132  void loadModelsWelded(const Aurora::GDAFile &gda, size_t row);
133  void loadModelsHead (const Aurora::GDAFile &gda, size_t row);
134  void loadModelsParts (const Aurora::GDAFile &gda, size_t row);
135 
136  void loadModelsHeadMorph(bool loadHair = true);
137  void loadModelsHeadList(const Aurora::GDAFile &gda, size_t row, bool loadHair = true);
138 
139  Common::UString getItemModel(uint32 variation, const Common::UString &prefix,
140  uint8 *armorType = 0) const;
141 
143  uint8 *armorType = 0) const;
144 
145  static Common::UString createModelPrefix(const Aurora::GDAFile &gda, size_t row);
146  static Common::UString createModelPart(const Aurora::GDAFile &gda, size_t row,
147  const Common::UString &prefix);
148 };
149 
150 } // End of namespace Dragon Age
151 
152 } // End of namespace Engines
153 
154 #endif // ENGINES_DRAGONAGE2_CREATURE_H
void loadModelsParts(const Aurora::GDAFile &gda, size_t row)
Definition: creature.cpp:300
void enter()
The cursor entered the creature.
Definition: creature.cpp:128
void loadModelsSimple(const Aurora::GDAFile &gda, size_t row)
Definition: creature.cpp:210
bool stealable
Can this item be stolen?
Definition: creature.h:98
A class holding an UTF-8 string.
Definition: ustring.h:48
uint8_t uint8
Definition: types.h:200
InventorySlot
Slot in a creature&#39;s inventory.
Definition: types.h:88
Common::UString findEquipModel(InventorySlot slot, const Common::UString &prefix, uint8 *armorType=0) const
Definition: creature.cpp:376
void loadModelsHead(const Aurora::GDAFile &gda, size_t row)
Definition: creature.cpp:226
bool click(Object *triggerer=0)
The creature was clicked.
Definition: creature.cpp:144
void setPosition(float x, float y, float z)
Set the creature&#39;s position.
Definition: creature.cpp:89
int32 setNumber
ID of the set the item belongs to.
Definition: creature.h:101
bool _isPC
Is the creature a PC?
Definition: creature.h:108
Common::UString _headMorph
Name of the morph file describing the creature&#39;s head.
Definition: creature.h:114
static const size_t kPartVariationCount
Max number of model parts for a creature&#39;s head.
Definition: creature.h:90
void highlight(bool enabled)
(Un)Highlight the creature.
Definition: creature.cpp:139
Items _items
All item the creature has currently equipped.
Definition: creature.h:119
An object in a Dragon Age II area.
A list storing pointer to objects, with automatic deletion.
static Common::UString createModelPart(const Aurora::GDAFile &gda, size_t row, const Common::UString &prefix)
Definition: creature.cpp:175
void show()
Show the creature&#39;s model.
Definition: creature.cpp:105
Common::UString resRef
Name of the item blueprint resource.
Definition: creature.h:94
bool droopable
Does this item drop with the creature&#39;s death?
Definition: creature.h:99
Models _models
The models making up this creature.
Definition: creature.h:122
Basic Aurora graphics types.
std::vector< EquipItem > Items
Definition: creature.h:103
void loadModelsHeadMorph(bool loadHair=true)
Definition: creature.cpp:248
void load(const Aurora::GFF3Struct &placeable)
void loadModelsWelded(const Aurora::GDAFile &gda, size_t row)
Definition: creature.cpp:218
Creature()
Create a dummy creature instance.
Definition: creature.cpp:66
void leave()
The cursor left the creature.
Definition: creature.cpp:135
void setOrientation(float x, float y, float z, float angle)
Set the creature&#39;s orientation.
Definition: creature.cpp:97
An item equipped by the creature.
Definition: creature.h:93
bool isPC() const
Is the creature a player character?
Definition: creature.cpp:115
Unicode string handling.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
static Common::UString createModelPrefix(const Aurora::GDAFile &gda, size_t row)
Definition: creature.cpp:161
Common::UString getItemModel(uint32 variation, const Common::UString &prefix, uint8 *armorType=0) const
Definition: creature.cpp:189
uint32 _appearanceID
The creature&#39;s appearance; index into the Appearances MGDA.
Definition: creature.h:111
A struct within a GFF3.
Definition: gff3file.h:164
Common::PtrList< Graphics::Aurora::Model > Models
Definition: creature.h:105
void loadProperties(const Aurora::GFF3Struct &gff)
uint32_t uint32
Definition: types.h:204
void loadModelsHeadList(const Aurora::GDAFile &gda, size_t row, bool loadHair=true)
Definition: creature.cpp:272
uint32 _partVariation[kPartVariationCount]
Indices into the MGDAs describing the creature&#39;s head model parts.
Definition: creature.h:116
Basic Dragon Age: Origins type definitions.
InventorySlot slot
The equipment slot the item occupies.
Definition: creature.h:96
void hide()
Hide the creature&#39;s model.
Definition: creature.cpp:110
void createFakePC()
Create a fake player character creature for testing purposes.
Definition: creature.cpp:119
Class to hold the GFF&#39;d two-dimensional array of a GDA file.
Definition: gdafile.h:62
int32_t int32
Definition: types.h:203