summaryrefslogtreecommitdiff
path: root/src/animation/AnimManager.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-11 08:59:28 +0200
committeraap <aap@papnet.eu>2019-06-11 08:59:28 +0200
commite7ed4d009636804d5dbe05aae9e7ab23b80fdd37 (patch)
tree4c95f6e07923b5ed0a7046afeb42a1ea2b8693bf /src/animation/AnimManager.h
parenta600fa99766a9a7bd8900df874b5b7228b1cea9c (diff)
added animation system (with skin support for now)
Diffstat (limited to 'src/animation/AnimManager.h')
-rw-r--r--src/animation/AnimManager.h268
1 files changed, 268 insertions, 0 deletions
diff --git a/src/animation/AnimManager.h b/src/animation/AnimManager.h
new file mode 100644
index 00000000..1b881f34
--- /dev/null
+++ b/src/animation/AnimManager.h
@@ -0,0 +1,268 @@
+#pragma once
+
+#include "AnimBlendHierarchy.h"
+
+enum AssocGroupId
+{
+ ASSOCGRP_STD,
+ ASSOCGRP_PLAYER,
+ ASSOCGRP_PLAYERROCKET,
+ ASSOCGRP_PLAYER1ARMED,
+ ASSOCGRP_PLAYER2ARMED,
+ ASSOCGRP_PLAYERBBBAT,
+ ASSOCGRP_SHUFFLE,
+ ASSOCGRP_OLD,
+ ASSOCGRP_GANG1,
+ ASSOCGRP_GANG2,
+ ASSOCGRP_FAT,
+ ASSOCGRP_OLDFAT,
+ ASSOCGRP_WOMAN,
+ ASSOCGRP_WOMANSHOP,
+ ASSOCGRP_BUSYWOMAN,
+ ASSOCGRP_SEXYWOMAN,
+ ASSOCGRP_OLDWOMAN,
+ ASSOCGRP_FARWOMAN,
+ ASSOCGRP_PANICCHUNKY,
+ ASSOCGRP_PLAYERBACK,
+ ASSOCGRP_PLAYERLEFT,
+ ASSOCGRP_PLAYERRIGHT,
+ ASSOCGRP_ROCKETBACK,
+ ASSOCGRP_ROCKETLEFT,
+ ASSOCGRP_ROCKETRIGHT,
+
+ NUM_ANIM_ASSOC_GROUPS
+};
+
+enum AnimationId
+{
+ ANIM_WALK,
+ ANIM_RUN,
+ ANI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
+ ANIM_ROAD_CROSS,
+ ANIM_TURN_180,
+ ANIM_ARREST_GUN,
+ ANIM_DROWN,
+ ANIM_CPR,
+ ANIM_DUCK_DOWN,
+ ANIM_DUCK_LOW,
+ ANIM_RBLOCK_CSHOOT,
+ ANIM_WEAPON_THROWU2,
+ ANIM_HANDSUP,
+ ANIM_HANDSCOWER,
+ ANIM_FUCKU,
+ ANIM_PHONE_IN,
+ ANIM_PHONE_OUT,
+ ANIM_PHONE_TALK,
+};
+
+class CAnimBlendAssociation;
+class CAnimBlendAssocGroup;
+
+// A block of hierarchies
+struct CAnimBlock
+{
+ char name[24];
+ int32 firstIndex;
+ int32 numAnims;
+};
+
+struct AnimAssocDesc
+{
+ int32 animId;
+ int32 flags;
+};
+
+struct AnimAssocDefinition
+{
+ char *name;
+ char *blockName;
+ int32 modelIndex;
+ int32 numAnims;
+ char **animNames;
+ AnimAssocDesc *animDescs;
+};
+
+class CAnimManager
+{
+ static AnimAssocDefinition ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS];
+ static CAnimBlock *ms_aAnimBlocks; //[2]
+ static CAnimBlendHierarchy *ms_aAnimations; //[250]
+ static int32 &ms_numAnimBlocks;
+ static int32 &ms_numAnimations;
+ static CAnimBlendAssocGroup *&ms_aAnimAssocGroups;
+ static CLinkList<CAnimBlendHierarchy*> &ms_animCache;
+public:
+
+ static void Initialise(void);
+ static void Shutdown(void);
+ static void UncompressAnimation(CAnimBlendHierarchy *anim);
+ static CAnimBlock *GetAnimationBlock(const char *name);
+ static CAnimBlendHierarchy *GetAnimation(const char *name, CAnimBlock *animBlock);
+ static CAnimBlendHierarchy *GetAnimation(int32 n) { return &ms_aAnimations[n]; }
+ static const char *GetAnimGroupName(AssocGroupId groupId);
+ static CAnimBlendAssociation *CreateAnimAssociation(AssocGroupId groupId, AnimationId animId);
+ static CAnimBlendAssociation *GetAnimAssociation(AssocGroupId groupId, AnimationId animId);
+ static CAnimBlendAssociation *GetAnimAssociation(AssocGroupId groupId, const char *name);
+ static CAnimBlendAssociation *AddAnimation(RpClump *clump, AssocGroupId groupId, AnimationId animId);
+ static CAnimBlendAssociation *AddAnimationAndSync(RpClump *clump, CAnimBlendAssociation *syncanim, AssocGroupId groupId, AnimationId animId);
+ static CAnimBlendAssociation *BlendAnimation(RpClump *clump, AssocGroupId groupId, AnimationId animId, float delta);
+ static void LoadAnimFiles(void);
+ static void LoadAnimFile(const char *filename);
+ static void LoadAnimFile(int fd, bool compress);
+ static void RemoveLastAnimFile(void);
+};