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 "Animation.h"
25 #include "RGBAColor.h"
36 #define AV_CIRCLESIZE 5
37 #define AV_USE_PALETTE 6
42 #define IE_ANI_ATTACK 0
43 #define IE_ANI_AWAKE 1
45 #define IE_ANI_CONJURE 3
46 #define IE_ANI_DAMAGE 4
48 #define IE_ANI_HEAD_TURN 6
49 #define IE_ANI_READY 7
50 #define IE_ANI_SHOOT 8
51 #define IE_ANI_TWITCH 9
52 #define IE_ANI_WALK 10
53 #define IE_ANI_ATTACK_SLASH 11
54 #define IE_ANI_ATTACK_BACKSLASH 12
55 #define IE_ANI_ATTACK_JAB 13
56 #define IE_ANI_EMERGE 14
57 #define IE_ANI_HIDE 15
58 #define IE_ANI_RUN 15 //pst has no hide, i hope
59 #define IE_ANI_SLEEP 16
60 #define IE_ANI_GET_UP 17
61 #define IE_ANI_PST_START 18
63 //BG2, IWD animation types
64 #define IE_ANI_CODE_MIRROR 0
65 #define IE_ANI_ONE_FILE 1
66 #define IE_ANI_FOUR_FILES 2
67 #define IE_ANI_TWO_FILES 3
68 #define IE_ANI_CODE_MIRROR_2 4
69 #define IE_ANI_SIX_FILES_2 5 //MOGR
70 #define IE_ANI_TWENTYTWO 6
72 #define IE_ANI_SIX_FILES 8 //MCAR/MWYV
73 #define IE_ANI_TWO_FILES_3 9 //iwd animations
74 #define IE_ANI_TWO_FILES_2 10 //low res bg1 anim
75 #define IE_ANI_FOUR_FRAMES 11 //wyvern anims
76 #define IE_ANI_NINE_FRAMES 12 //dragon anims
77 #define IE_ANI_FRAGMENT 13 //fragment animation
78 #define IE_ANI_FOUR_FILES_2 14 //METT
79 #define IE_ANI_CODE_MIRROR_3 15 //MSPS
80 #define IE_ANI_TWO_FILES_3B 16 //iwd animations (eg. MBBM)
83 #define IE_ANI_PST_ANIMATION_1 56 //full animation
84 #define IE_ANI_PST_GHOST 57 //no orientations
85 #define IE_ANI_PST_STAND 58 //has orientations
86 #define IE_ANI_PST_ANIMATION_2 59 //full animation std-->stc
87 #define IE_ANI_PST_ANIMATION_3 60 //full animation stc-->std
90 #define IE_ANI_NO_ARMOR 0
91 #define IE_ANI_LIGHT_ARMOR 1
92 #define IE_ANI_MEDIUM_ARMOR 2
93 #define IE_ANI_HEAVY_ARMOR 3
95 #define IE_ANI_WEAPON_1H 0
96 #define IE_ANI_WEAPON_2H 1
97 #define IE_ANI_WEAPON_2W 2
99 #define IE_ANI_RANGED_BOW 0
100 #define IE_ANI_RANGED_XBOW 1
101 #define IE_ANI_RANGED_THROW 2
103 struct AvatarStruct
{
105 ieResRef Prefixes
[4];
106 unsigned int PaletteType
;
107 unsigned char AnimationType
;
108 unsigned char CircleSize
;
111 /* resdata entries */
112 unsigned int WalkScale
; /* 1000 / walkscale */
113 unsigned int RunScale
; /* 1000 / runscale */
117 struct EquipResRefData
;
119 class GEM_EXPORT CharAnimations
{
121 Animation
** Anims
[MAX_ANIMS
][MAX_ORIENT
];
126 const ieDword
*Colors
; //these are the custom color indices
127 RGBModifier ColorMods
[32]; // color modification effects
128 unsigned long lastModUpdate
;
129 RGBModifier GlobalColorMod
; // global color modification effect
132 Palette
* modifiedPalette
[4];
133 unsigned int AvatarsRowNum
;
134 unsigned char ArmorType
, WeaponType
, RangedType
;
136 ieResRef PaletteResRef
;
137 unsigned char nextStanceID
, StanceID
;
138 bool autoSwitchOnEnd
;
141 CharAnimations(unsigned int AnimID
, ieDword ArmourLevel
);
142 ~CharAnimations(void);
143 static void ReleaseMemory();
144 void SetArmourLevel(int ArmourLevel
);
145 void SetRangedType(int Ranged
);
146 void SetWeaponType(int WeaponType
);
147 void SetHelmetRef(const char* ref
);
148 void SetWeaponRef(const char* ref
);
149 void SetOffhandRef(const char* ref
);
150 void SetupColors(PaletteType type
);
151 void SetColors(const ieDword
*Colors
);
152 void LockPalette(const ieDword
*Colors
);
154 // returns an array of animations of size GetTotalPartCount()
155 Animation
** GetAnimation(unsigned char Stance
, unsigned char Orient
);
156 int GetTotalPartCount() const;
157 const int* GetZOrder(unsigned char Orient
);
159 // returns Palette for a given part (unlocked)
160 Palette
* GetPartPalette(int part
); // TODO: clean this up
162 public: //attribute functions
163 static int GetAvatarsCount();
164 static AvatarStruct
*GetAvatarStruct(int RowNum
);
165 unsigned int GetAnimationID() const;
166 int GetCircleSize() const;
167 int NoPalette() const;
168 int GetAnimType() const;
169 char GetSize() const;
171 void PulseRGBModifiers();
175 void InitAvatarsTable();
176 int GetActorPartCount() const;
177 void AddPSTSuffix(char* ResRef
, unsigned char AnimID
,
178 unsigned char& Cycle
, unsigned char Orient
);
179 void AddFFSuffix(char* ResRef
, unsigned char AnimID
,
180 unsigned char& Cycle
, unsigned char Orient
, int Part
);
181 void AddNFSuffix(char* ResRef
, unsigned char AnimID
,
182 unsigned char& Cycle
, unsigned char Orient
, int Part
);
183 void AddVHR2Suffix(char* ResRef
, unsigned char AnimID
,
184 unsigned char& Cycle
, unsigned char Orient
);
185 void AddVHRSuffix(char* ResRef
, unsigned char AnimID
,
186 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
187 void AddVHR3Suffix(char* ResRef
, unsigned char AnimID
,
188 unsigned char& Cycle
, unsigned char Orient
);
189 void GetVHREquipmentRef(char* ResRef
, unsigned char& Cycle
,
190 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
191 void AddSixSuffix(char* ResRef
, unsigned char AnimID
,
192 unsigned char& Cycle
, unsigned char Orient
);
193 void AddMHRSuffix(char* ResRef
, unsigned char AnimID
,
194 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
195 void GetMHREquipmentRef(char* ResRef
, unsigned char& Cycle
,
196 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
197 void AddMMRSuffix(char* ResRef
, unsigned char AnimID
,
198 unsigned char& Cycle
, unsigned char Orient
);
199 void AddMMR2Suffix(char* ResRef
, unsigned char AnimID
,
200 unsigned char& Cycle
, unsigned char Orient
);
201 void AddTwoFileSuffix(char* ResRef
, unsigned char AnimID
,
202 unsigned char& Cycle
, unsigned char Orient
);
203 void AddLRSuffix(char* ResRef
, unsigned char AnimID
,
204 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*& equip
);
205 void AddLRSuffix2( char* ResRef
, unsigned char StanceID
,
206 unsigned char& Cycle
, unsigned char Orient
, EquipResRefData
*&EquipData
);
207 void GetLREquipmentRef(char* ResRef
, unsigned char& Cycle
,
208 const char* equipRef
, bool offhand
, EquipResRefData
* equip
);
209 void AddLR2Suffix(char* ResRef
, unsigned char AnimID
,
210 unsigned char& Cycle
, unsigned char Orient
);
211 void AddLR3Suffix(char* ResRef
, unsigned char AnimID
,
212 unsigned char& Cycle
, unsigned char Orient
);
213 void GetAnimResRef(unsigned char AnimID
, unsigned char Orient
,
214 char* ResRef
, unsigned char& Cycle
, int Part
, EquipResRefData
*& equip
);
215 void GetEquipmentResRef(const char* equipRef
, bool offhand
,
216 char* ResRef
, unsigned char& Cycle
, EquipResRefData
* equip
);