1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef CHARANIMATIONS_H
22 #define CHARANIMATIONS_H
24 #include "RGBAColor.h"
27 #include "Animation.h"
38 #define AV_CIRCLESIZE 5
39 #define AV_USE_PALETTE 6
44 #define IE_ANI_ATTACK 0
45 #define IE_ANI_AWAKE 1
47 #define IE_ANI_CONJURE 3
48 #define IE_ANI_DAMAGE 4
50 #define IE_ANI_HEAD_TURN 6
51 #define IE_ANI_READY 7
52 #define IE_ANI_SHOOT 8
53 #define IE_ANI_TWITCH 9
54 #define IE_ANI_WALK 10
55 #define IE_ANI_ATTACK_SLASH 11
56 #define IE_ANI_ATTACK_BACKSLASH 12
57 #define IE_ANI_ATTACK_JAB 13
58 #define IE_ANI_EMERGE 14
59 #define IE_ANI_HIDE 15
60 #define IE_ANI_RUN 15 //pst has no hide, i hope
61 #define IE_ANI_SLEEP 16
62 #define IE_ANI_GET_UP 17
63 #define IE_ANI_PST_START 18
65 //BG2, IWD animation types
66 #define IE_ANI_CODE_MIRROR 0
67 #define IE_ANI_ONE_FILE 1
68 #define IE_ANI_FOUR_FILES 2
69 #define IE_ANI_TWO_FILES 3
70 #define IE_ANI_CODE_MIRROR_2 4
71 #define IE_ANI_SIX_FILES_2 5 //MOGR
72 #define IE_ANI_TWENTYTWO 6
74 #define IE_ANI_SIX_FILES 8 //MCAR/MWYV
75 #define IE_ANI_TWO_FILES_3 9 //iwd animations
76 #define IE_ANI_TWO_FILES_2 10 //low res bg1 anim
77 #define IE_ANI_FOUR_FRAMES 11 //wyvern anims
78 #define IE_ANI_NINE_FRAMES 12 //dragon anims
79 #define IE_ANI_FRAGMENT 13 //fragment animation
80 #define IE_ANI_FOUR_FILES_2 14 //METT
81 #define IE_ANI_CODE_MIRROR_3 15 //MSPS
82 #define IE_ANI_TWO_FILES_3B 16 //iwd animations (eg. MBBM)
85 #define IE_ANI_PST_ANIMATION_1 56 //full animation
86 #define IE_ANI_PST_GHOST 57 //no orientations
87 #define IE_ANI_PST_STAND 58 //has orientations
88 #define IE_ANI_PST_ANIMATION_2 59 //full animation std-->stc
89 #define IE_ANI_PST_ANIMATION_3 60 //full animation stc-->std
92 #define IE_ANI_NO_ARMOR 0
93 #define IE_ANI_LIGHT_ARMOR 1
94 #define IE_ANI_MEDIUM_ARMOR 2
95 #define IE_ANI_HEAVY_ARMOR 3
97 #define IE_ANI_WEAPON_1H 0
98 #define IE_ANI_WEAPON_2H 1
99 #define IE_ANI_WEAPON_2W 2
101 #define IE_ANI_RANGED_BOW 0
102 #define IE_ANI_RANGED_XBOW 1
103 #define IE_ANI_RANGED_THROW 2
105 struct AvatarStruct
{
107 ieResRef Prefixes
[4];
108 unsigned int PaletteType
;
109 unsigned char AnimationType
;
110 unsigned char CircleSize
;
113 /* resdata entries */
114 unsigned int WalkScale
; /* 1000 / walkscale */
115 unsigned int RunScale
; /* 1000 / runscale */
119 struct EquipResRefData
;
121 class GEM_EXPORT CharAnimations
{
123 Animation
** Anims
[MAX_ANIMS
][MAX_ORIENT
];
128 const ieDword
*Colors
; //these are the custom color indices
129 RGBModifier ColorMods
[32]; // color modification effects
130 unsigned long lastModUpdate
;
131 RGBModifier GlobalColorMod
; // global color modification effect
134 Palette
* modifiedPalette
[4];
135 unsigned int AvatarsRowNum
;
136 unsigned char ArmorType
, WeaponType
, RangedType
;
138 ieResRef PaletteResRef
;
139 unsigned char nextStanceID
, StanceID
;
140 bool autoSwitchOnEnd
;
143 CharAnimations(unsigned int AnimID
, ieDword ArmourLevel
);
144 ~CharAnimations(void);
145 static void ReleaseMemory();
146 void SetArmourLevel(int ArmourLevel
);
147 void SetRangedType(int Ranged
);
148 void SetWeaponType(int WeaponType
);
149 void SetHelmetRef(const char* ref
);
150 void SetWeaponRef(const char* ref
);
151 void SetOffhandRef(const char* ref
);
152 void SetupColors(PaletteType type
);
153 void SetColors(const ieDword
*Colors
);
154 void LockPalette(const ieDword
*Colors
);
156 // returns an array of animations of size GetTotalPartCount()
157 Animation
** GetAnimation(unsigned char Stance
, unsigned char Orient
);
158 int GetTotalPartCount() const;
159 const int* GetZOrder(unsigned char Orient
);
161 // returns Palette for a given part (unlocked)
162 Palette
* GetPartPalette(int part
); // TODO: clean this up
164 public: //attribute functions
165 static int GetAvatarsCount();
166 static AvatarStruct
*GetAvatarStruct(int RowNum
);
167 unsigned int GetAnimationID() const;
168 int GetCircleSize() const;
169 int NoPalette() const;
170 int GetAnimType() const;
171 char GetSize() const;
173 void PulseRGBModifiers();
177 void InitAvatarsTable();
178 int GetActorPartCount() const;
179 void AddPSTSuffix(char* ResRef
, unsigned char AnimID
,
180 unsigned char& Cycle
, unsigned char Orient
);
181 void AddFFSuffix(char* ResRef
, unsigned char AnimID
,
182 unsigned char& Cycle
, unsigned char Orient
, int Part
);
183 void AddNFSuffix(char* ResRef
, unsigned char AnimID
,
184 unsigned char& Cycle
, unsigned char Orient
, int Part
);
185 void AddVHR2Suffix(char* ResRef
, unsigned char AnimID
,
186 unsigned char& Cycle
, unsigned char Orient
);
187 void AddVHRSuffix(char* ResRef
, unsigned char AnimID
,
188 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
189 void AddVHR3Suffix(char* ResRef
, unsigned char AnimID
,
190 unsigned char& Cycle
, unsigned char Orient
);
191 void GetVHREquipmentRef(char* ResRef
, unsigned char& Cycle
,
192 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
193 void AddSixSuffix(char* ResRef
, unsigned char AnimID
,
194 unsigned char& Cycle
, unsigned char Orient
);
195 void AddMHRSuffix(char* ResRef
, unsigned char AnimID
,
196 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
197 void GetMHREquipmentRef(char* ResRef
, unsigned char& Cycle
,
198 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
199 void AddMMRSuffix(char* ResRef
, unsigned char AnimID
,
200 unsigned char& Cycle
, unsigned char Orient
);
201 void AddMMR2Suffix(char* ResRef
, unsigned char AnimID
,
202 unsigned char& Cycle
, unsigned char Orient
);
203 void AddTwoFileSuffix(char* ResRef
, unsigned char AnimID
,
204 unsigned char& Cycle
, unsigned char Orient
);
205 void AddLRSuffix(char* ResRef
, unsigned char AnimID
,
206 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
207 void AddLRSuffix2( char* ResRef
, unsigned char StanceID
,
208 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*&EquipData
);
209 void GetLREquipmentRef(char* ResRef
, unsigned char& Cycle
,
210 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
211 void AddLR2Suffix(char* ResRef
, unsigned char AnimID
,
212 unsigned char& Cycle
, unsigned char Orient
);
213 void AddLR3Suffix(char* ResRef
, unsigned char AnimID
,
214 unsigned char& Cycle
, unsigned char Orient
);
215 void GetAnimResRef(unsigned char AnimID
, unsigned char Orient
,
216 char* ResRef
, unsigned char& Cycle
, int Part
, EquipResRefData
*& equip
);
217 void GetEquipmentResRef(const char* equipRef
, bool offhand
,
218 char* ResRef
, unsigned char& Cycle
, EquipResRefData
* equip
);