1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#pragma once
#include "AnimBlendHierarchy.h"
#include "AnimationId.h"
enum AssocGroupId
{
ASSOCGRP_STD,
ASSOCGRP_VAN,
ASSOCGRP_COACH,
ASSOCGRP_BIKE_STANDARD,
ASSOCGRP_BIKE_VESPA,
ASSOCGRP_BIKE_HARLEY,
ASSOCGRP_BIKE_DIRT,
ASSOCGRP_UNARMED,
ASSOCGRP_SCREWDRIVER,
ASSOCGRP_KNIFE,
ASSOCGRP_BASEBALLBAT,
ASSOCGRP_GOLFCLUB,
ASSOCGRP_CHAINSAW,
ASSOCGRP_PYTHON,
ASSOCGRP_COLT,
ASSOCGRP_SHOTGUN,
ASSOCGRP_BUDDY,
ASSOCGRP_TEC,
ASSOCGRP_UZI,
ASSOCGRP_RIFLE,
ASSOCGRP_M60,
ASSOCGRP_SNIPER,
ASSOCGRP_THROW,
ASSOCGRP_FLAMETHROWER,
ASSOCGRP_MEDIC,
ASSOCGRP_SUNBATHE,
ASSOCGRP_PLAYER_IDLE,
ASSOCGRP_RIOT,
ASSOCGRP_STRIP,
ASSOCGRP_LANCE,
ASSOCGRP_PLAYER,
ASSOCGRP_PLAYERROCKET,
ASSOCGRP_PLAYER1ARMED,
ASSOCGRP_PLAYER2ARMED,
ASSOCGRP_PLAYERBBBAT,
ASSOCGRP_PLAYERCHAINSAW,
ASSOCGRP_SHUFFLE,
ASSOCGRP_OLD,
ASSOCGRP_GANG1,
ASSOCGRP_GANG2,
ASSOCGRP_FAT,
ASSOCGRP_OLDFAT,
ASSOCGRP_JOGGER,
ASSOCGRP_WOMAN,
ASSOCGRP_WOMANSHOP,
ASSOCGRP_BUSYWOMAN,
ASSOCGRP_SEXYWOMAN,
ASSOCGRP_FATWOMAN,
ASSOCGRP_OLDWOMAN,
ASSOCGRP_JOGWOMAN,
ASSOCGRP_PANICCHUNKY,
ASSOCGRP_SKATE,
#ifdef PC_PLAYER_CONTROLS
ASSOCGRP_PLAYERBACK,
ASSOCGRP_PLAYERLEFT,
ASSOCGRP_PLAYERRIGHT,
ASSOCGRP_ROCKETBACK,
ASSOCGRP_ROCKETLEFT,
ASSOCGRP_ROCKETRIGHT,
ASSOCGRP_CHAINSAWBACK,
ASSOCGRP_CHAINSAWLEFT,
ASSOCGRP_CHAINSAWRIGHT,
#endif
NUM_ANIM_ASSOC_GROUPS
};
class CAnimBlendAssociation;
class CAnimBlendAssocGroup;
#define MAX_ANIMBLOCK_NAME 20
// A block of hierarchies
struct CAnimBlock
{
char name[MAX_ANIMBLOCK_NAME];
bool isLoaded;
int16 refCount;
int32 firstIndex; // first animtion in ms_aAnimations
int32 numAnims;
};
struct AnimAssocDesc
{
int32 animId;
int32 flags;
};
struct AnimAssocDefinition
{
char const *name;
char const *blockName;
int32 modelIndex;
int32 numAnims;
char const **animNames;
AnimAssocDesc *animDescs;
};
class CAnimManager
{
static const AnimAssocDefinition ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS];
static CAnimBlock ms_aAnimBlocks[NUMANIMBLOCKS];
static CAnimBlendHierarchy ms_aAnimations[NUMANIMATIONS];
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 void RemoveFromUncompressedCache(CAnimBlendHierarchy *hier);
static CAnimBlock *GetAnimationBlock(int32 block) { return &ms_aAnimBlocks[block]; }
static CAnimBlock *GetAnimationBlock(const char *name);
static int32 GetAnimationBlockIndex(const char *name);
static int32 RegisterAnimBlock(const char *name);
static int32 GetNumRefsToAnimBlock(int32 block);
static void AddAnimBlockRef(int32 block);
static void RemoveAnimBlockRefWithoutDelete(int32 block);
static void RemoveAnimBlockRef(int32 block);
static void RemoveAnimBlock(int32 block);
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(RwStream *stream, bool compress, char (*uncompressedAnims)[32] = nil);
static void CreateAnimAssocGroups(void);
static void RemoveLastAnimFile(void);
static CAnimBlendAssocGroup* GetAnimAssocGroups(void) { return ms_aAnimAssocGroups; }
};
|