Permalink
Browse files

add Demogorgon animation support

Not quite complete. I haven't figured out the palettes for this one.
  • Loading branch information...
1 parent fc8f75b commit b65de9dba8f4411fb330dafa4e15613e61896744 @fizzet fizzet committed Jun 21, 2013
Showing with 76 additions and 1 deletion.
  1. +72 −1 gemrb/core/CharAnimations.cpp
  2. +3 −0 gemrb/core/CharAnimations.h
  3. +1 −0 gemrb/unhardcoded/bg2/avatars.2da
@@ -162,6 +162,7 @@ int CharAnimations::GetActorPartCount() const
case IE_ANI_NINE_FRAMES: //dragon animations
return 9;
case IE_ANI_FOUR_FRAMES: //wyvern animations
+ case IE_ANI_FOUR_FRAMES_2: //demogorgon animations
return 4;
case IE_ANI_TWO_PIECE: //ankheg animations
return 2;
@@ -462,6 +463,7 @@ Palette* CharAnimations::GetPartPalette(int part)
//these animations use several palettes
type = NINE_FRAMES_PALETTE(StanceID);
}
+ else if (GetAnimType() == IE_ANI_FOUR_FRAMES_2) return NULL;
// always use unmodified BAM palette for the supporting part
else if (GetAnimType() == IE_ANI_TWO_PIECE && part == 1) return NULL;
else if (part == actorPartCount) type = PAL_WEAPON;
@@ -815,6 +817,7 @@ IE_ANI_TWO_PIECE: This is a modified IE_ANI_SIX_FILES with supporting still fram
IE_ANI_FOUR_FRAMES: These animations are large, four bams make a frame.
+IE_ANI_FOUR_FRAMES_2: Another variation of the four frames format with more files.
IE_ANI_NINE_FRAMES: These animations are huge, nine bams make a frame.
@@ -1053,7 +1056,7 @@ Animation** CharAnimations::GetAnimation(unsigned char Stance, unsigned char Ori
//these animations use several palettes
ptype = NINE_FRAMES_PALETTE(StanceID);
}
-
+
//if you need to revert this change, consider true paletted
//animations which need a GlobalColorMod (mgir for example)
@@ -1111,6 +1114,7 @@ Animation** CharAnimations::GetAnimation(unsigned char Stance, unsigned char Ori
switch (GetAnimType()) {
case IE_ANI_NINE_FRAMES: //dragon animations
case IE_ANI_FOUR_FRAMES: //wyvern animations
+ case IE_ANI_FOUR_FRAMES_2:
case IE_ANI_BIRD:
case IE_ANI_CODE_MIRROR:
case IE_ANI_CODE_MIRROR_2: //9 orientations
@@ -1136,6 +1140,7 @@ Animation** CharAnimations::GetAnimation(unsigned char Stance, unsigned char Ori
switch (GetAnimType()) {
case IE_ANI_NINE_FRAMES: //dragon animations
case IE_ANI_FOUR_FRAMES: //wyvern animations
+ case IE_ANI_FOUR_FRAMES_2:
case IE_ANI_BIRD:
case IE_ANI_CODE_MIRROR:
case IE_ANI_SIX_FILES: //16 anims some are stored elsewhere
@@ -1225,6 +1230,10 @@ void CharAnimations::GetAnimResRef(unsigned char StanceID,
AddFFSuffix( NewResRef, StanceID, Cycle, Orient, Part );
break;
+ case IE_ANI_FOUR_FRAMES_2:
+ AddFF2Suffix( NewResRef, StanceID, Cycle, Orient, Part );
+ break;
+
case IE_ANI_NINE_FRAMES:
AddNFSuffix( NewResRef, StanceID, Cycle, Orient, Part );
break;
@@ -1637,6 +1646,68 @@ void CharAnimations::AddFFSuffix(char* ResRef, unsigned char StanceID,
ResRef[7]=0;
}
+void CharAnimations::AddFF2Suffix(char* ResRef, unsigned char StanceID,
+ unsigned char& Cycle, unsigned char Orient, int Part) const
+{
+ Cycle = SixteenToNine[Orient];
+ switch (StanceID) {
+ case IE_ANI_HEAD_TURN:
+ strcat( ResRef, "g101" );
+ break;
+
+ case IE_ANI_READY:
+ case IE_ANI_AWAKE:
+ strcat( ResRef, "g102" );
+ Cycle += 9;
+ break;
+
+ case IE_ANI_WALK:
+ strcat( ResRef, "g101" );
+ break;
+
+ case IE_ANI_CAST:
+ case IE_ANI_CONJURE:
+ strcat( ResRef, "g205" );
+ Cycle += 45;
+ break;
+
+ case IE_ANI_ATTACK:
+ case IE_ANI_ATTACK_SLASH:
+ strcat( ResRef, "g206" );
+ Cycle += 54;
+ break;
+
+ case IE_ANI_ATTACK_BACKSLASH:
+ strcat( ResRef, "g202" );
+ break;
+
+ case IE_ANI_ATTACK_JAB:
+ strcat( ResRef, "g203" );
+ Cycle += 18;
+ break;
+
+ case IE_ANI_DIE:
+ case IE_ANI_GET_UP:
+ case IE_ANI_EMERGE:
+ strcat( ResRef, "g104" );
+ Cycle += 36;
+ break;
+
+ case IE_ANI_SLEEP:
+ case IE_ANI_TWITCH:
+ case IE_ANI_DAMAGE:
+ strcat( ResRef, "g103" );
+ Cycle += 27;
+ break;
+
+ default:
+ error("CharAnimation", "Four frames 2 Animation: unhandled stance: %s %d\n", ResRef, StanceID);
+ break;
+
+ }
+ ResRef[6]=(char) (Part+'1');
+}
+
void CharAnimations::AddNFSuffix(char* ResRef, unsigned char StanceID,
unsigned char& Cycle, unsigned char Orient, int Part)
{
@@ -85,6 +85,7 @@ namespace GemRB {
#define IE_ANI_TWO_PIECE 17 //MAKH
#define IE_ANI_FOUR_FILES_3 18 //mostly civilians
#define IE_ANI_TWO_FILES_4 19
+#define IE_ANI_FOUR_FRAMES_2 20 //MDEM
//PST animation types
#define IE_ANI_PST_ANIMATION_1 56 //full animation
@@ -218,6 +219,8 @@ class GEM_EXPORT CharAnimations {
unsigned char& Cycle, unsigned char Orient);
void AddFFSuffix(char* ResRef, unsigned char AnimID,
unsigned char& Cycle, unsigned char Orient, int Part);
+ void AddFF2Suffix(char* ResRef, unsigned char AnimID,
+ unsigned char& Cycle, unsigned char Orient, int Part) const;
void AddHLSuffix(char* ResRef, unsigned char AnimID,
unsigned char& Cycle, unsigned char Orient);
void AddNFSuffix(char* ResRef, unsigned char AnimID,
@@ -16,6 +16,7 @@
0x1206 MDR1 MDR1 MDR1 MDR1 12 7 BR *
0x1207 MDR1 MDR1 MDR1 MDR1 12 7 MC *
0x1208 MDR1 MDR1 MDR1 MDR1 12 7 PU *
+0x1300 MDEM MDEM MDEM MDEM 20 4 0 *
0x2000 MSIR MSIR MSIR MSIR 2 2 0 +
0x2100 UVOL UVOL UVOL UVOL 2 2 1 *
0x2200 MOGM MOGM MOGM MOGM 2 2 0 S

0 comments on commit b65de9d

Please sign in to comment.