| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#include <string.h> |
| 23 |
#include "reference.h" |
| 24 |
#include "arrayedlist.h" |
| 25 |
#include "resourcemanager.h" |
| 26 |
#include "skeletons.h" |
| 27 |
|
| 28 |
char *referenceRootNames[] = |
| 29 |
{ |
| 30 |
"elf_Lhandroot", |
| 31 |
"elf_Rhandroot", |
| 32 |
"elf_Rfootroot", |
| 33 |
"elf_Lfootroot", |
| 34 |
"elf_Bstaffroot", |
| 35 |
"elf_bladeroot", |
| 36 |
"elf_hellroot", |
| 37 |
"StaffBone", |
| 38 |
"SwordBone", |
| 39 |
"SpearBone", |
| 40 |
"RFootBone", |
| 41 |
"LFootBone", |
| 42 |
"hp_backroot", |
| 43 |
"hp_staffroot", |
| 44 |
"hp_lhandroot", |
| 45 |
"hp_rhandroot", |
| 46 |
"hp_rfootroot", |
| 47 |
"hp_lfootroot", |
| 48 |
"staffroot", |
| 49 |
"rfootroot", |
| 50 |
"lfootroot", |
| 51 |
"rhandroot", |
| 52 |
"lhandroot", |
| 53 |
"leyeroot", |
| 54 |
"reyeroot" |
| 55 |
}; |
| 56 |
|
| 57 |
int referenceRootNameOffsets[NUM_REFERENCED] = |
| 58 |
{ |
| 59 |
0, |
| 60 |
7, |
| 61 |
12, |
| 62 |
18, |
| 63 |
}; |
| 64 |
|
| 65 |
int numReferences[NUM_REFERENCED] = |
| 66 |
{ |
| 67 |
NUM_REFERENCES_CORVUS, |
| 68 |
NUM_REFERENCES_INSECT, |
| 69 |
NUM_REFERENCES_PRIESTESS, |
| 70 |
NUM_REFERENCES_MORK, |
| 71 |
}; |
| 72 |
|
| 73 |
int corvusJointIDs[NUM_REFERENCES_CORVUS] = |
| 74 |
{ |
| 75 |
CORVUS_UPPERBACK, |
| 76 |
CORVUS_UPPERBACK, |
| 77 |
-1, |
| 78 |
-1, |
| 79 |
CORVUS_UPPERBACK, |
| 80 |
CORVUS_UPPERBACK, |
| 81 |
CORVUS_UPPERBACK, |
| 82 |
}; |
| 83 |
|
| 84 |
int *jointIDs[NUM_REFERENCED] = |
| 85 |
{ |
| 86 |
corvusJointIDs, |
| 87 |
}; |
| 88 |
|
| 89 |
static ResourceManager_t ReferenceMngr; |
| 90 |
|
| 91 |
void InitReferenceMngr(){ |
| 92 |
#define REFERENCE_BLOCK_SIZE 8 |
| 93 |
char *dummystr = NULL; |
| 94 |
|
| 95 |
ResMngr_Con( &ReferenceMngr, sizeof( LERPedReferences_t ), REFERENCE_BLOCK_SIZE, dummystr ); |
| 96 |
} |
| 97 |
|
| 98 |
void ReleaseReferenceMngr(){ |
| 99 |
ResMngr_Des( &ReferenceMngr ); |
| 100 |
} |
| 101 |
|
| 102 |
LERPedReferences_t *LERPedReferences_new( int init_refType ){ |
| 103 |
LERPedReferences_t *newRefs; |
| 104 |
|
| 105 |
newRefs = ResMngr_AllocateResource( &ReferenceMngr, sizeof( *newRefs ) ); |
| 106 |
newRefs->refType = init_refType; |
| 107 |
newRefs->jointIDs = jointIDs[init_refType]; |
| 108 |
newRefs->lastUpdate = -( REF_MINCULLTIME * 2.0 ); |
| 109 |
|
| 110 |
memset( newRefs->references, 0, MAX_REFPOINTS * sizeof( Reference_t ) ); |
| 111 |
memset( newRefs->oldReferences, 0, MAX_REFPOINTS * sizeof( Reference_t ) ); |
| 112 |
|
| 113 |
return newRefs; |
| 114 |
} |
| 115 |
|
| 116 |
void LERPedReferences_delete( LERPedReferences_t *toDelete ){ |
| 117 |
ResMngr_DeallocateResource( &ReferenceMngr, toDelete, sizeof( *toDelete ) ); |
| 118 |
} |
| 119 |
|
| 120 |
|