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_KOTOR2_CREATURE_H
26 #define ENGINES_KOTOR2_CREATURE_H
27 
28 #include "src/common/types.h"
29 #include "src/common/scopedptr.h"
30 #include "src/common/ustring.h"
31 
32 #include "src/aurora/types.h"
33 
35 
37 
38 namespace Engines {
39 
40 namespace KotOR2 {
41 
42 class CharacterGenerationInfo;
43 
44 class Creature : public Object {
45 public:
47  Creature();
49  Creature(const Aurora::GFF3Struct &creature);
50  ~Creature();
51 
53  void createFakePC();
56 
57  // Basic visuals
58 
59  void show();
60  void hide();
61  bool isVisible() const;
62 
63  // Basic properties
64 
65  bool isPC() const;
66  bool isPartyMember() const;
67 
68  // Positioning
69 
71  void setPosition(float x, float y, float z);
73  void setOrientation(float x, float y, float z, float angle);
74 
75  // Object/Cursor interactions
76 
77  void enter();
78  void leave();
79 
81  void highlight(bool enabled);
82 
84  bool click(Object *triggerer = 0);
85 
86  const Common::UString &getConversation() const;
87 
88  float getCameraHeight() const;
89 
90  // Animation
91 
92  void playDefaultAnimation();
94 
95  void playAnimation(const Common::UString &anim,
96  bool restart = true,
97  float length = 0.0f,
98  float speed = 1.0f);
99 
100  void playHeadAnimation(const Common::UString &anim,
101  bool restart = true,
102  float length = 0.0f,
103  float speed = 1.0f);
104 
105 private:
107  struct PartModels {
109 
112 
114  };
115 
116  bool _isPC;
117 
119 
123 
124 
125  void init();
126 
127  void load(const Aurora::GFF3Struct &creature);
128  void load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint);
129 
130  void loadProperties(const Aurora::GFF3Struct &gff);
131  void loadPortrait(const Aurora::GFF3Struct &gff);
132  void loadAppearance();
133 
134  void getPartModels(PartModels &parts, uint32 state = 'a');
135  void loadBody(PartModels &parts);
136  void loadHead(PartModels &parts);
137 
138  void setDefaultAnimations();
139 };
140 
141 } // End of namespace KotOR2
142 
143 } // End of namespace Engines
144 
145 #endif // ENGINES_KOTOR2_CREATURE_H
Common::UString _conversation
Definition: creature.h:121
void setPosition(float x, float y, float z)
Set the creature&#39;s position.
Definition: creature.cpp:89
void highlight(bool enabled)
(Un)Highlight the creature.
Definition: creature.cpp:294
bool isPartyMember() const
Definition: creature.cpp:85
A class holding an UTF-8 string.
Definition: ustring.h:48
bool isVisible() const
Is the creature&#39;s model visible?
Definition: creature.cpp:77
void loadBody(PartModels &parts)
Definition: creature.cpp:238
void loadHead(PartModels &parts)
Definition: creature.cpp:252
void createPC(const CharacterGenerationInfo &info)
Create a player character creature.
Definition: creature.cpp:270
void playAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Definition: creature.cpp:349
A simple scoped smart pointer template.
void load(const Aurora::GFF3Struct &creature)
Definition: creature.cpp:105
void loadProperties(const Aurora::GFF3Struct &gff)
Definition: creature.cpp:147
void enter()
The cursor entered the creature.
Definition: creature.cpp:286
void leave()
The cursor left the creature.
Definition: creature.cpp:290
void playHeadAnimation(const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
Definition: creature.cpp:354
An object in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
Basic Aurora graphics types.
bool _isPC
Is the creature a PC?
Definition: creature.h:116
void info(const char *s,...)
Definition: util.cpp:69
void getPartModels(PartModels &parts, uint32 state='a')
Definition: creature.cpp:208
float getCameraHeight() const
Definition: creature.cpp:314
Parts of a creature&#39;s body.
Definition: creature.h:107
Low-level type definitions to handle fixed width types portably.
Common::UString _modelType
Definition: creature.h:122
const Common::UString & getConversation() const
Definition: creature.cpp:310
Unicode string handling.
Basic type definitions to handle files used in BioWare&#39;s Aurora engine.
uint32 _appearance
The creature&#39;s general appearance.
Definition: creature.h:118
bool isPC() const
Is the creature a player character?
Definition: creature.cpp:81
A struct within a GFF3.
Definition: gff3file.h:164
uint32_t uint32
Definition: types.h:204
void hide()
Hide the creature&#39;s model.
Definition: creature.cpp:72
Common::ScopedPtr< Graphics::Aurora::Model > _model
The creature&#39;s model.
Definition: creature.h:120
void setOrientation(float x, float y, float z, float angle)
Set the creature&#39;s orientation.
Definition: creature.cpp:97
void createFakePC()
Create a fake player character creature for testing purposes.
Definition: creature.cpp:263
Creature()
Create a dummy creature instance.
Definition: creature.cpp:54
void show()
Show the creature&#39;s model.
Definition: creature.cpp:67
bool click(Object *triggerer=0)
The creature was clicked.
Definition: creature.cpp:298
void loadPortrait(const Aurora::GFF3Struct &gff)
Definition: creature.cpp:178