2007-11-04 03:34:51 +00:00
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include "reference.h"
|
|
|
|
#include "arrayedlist.h"
|
|
|
|
#include "resourcemanager.h"
|
|
|
|
#include "skeletons.h"
|
|
|
|
|
|
|
|
char *referenceRootNames[] =
|
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
"elf_Lhandroot", //0
|
2007-11-04 03:34:51 +00:00
|
|
|
"elf_Rhandroot",
|
|
|
|
"elf_Rfootroot",
|
|
|
|
"elf_Lfootroot",
|
|
|
|
"elf_Bstaffroot",
|
|
|
|
"elf_bladeroot",
|
|
|
|
"elf_hellroot",
|
2012-03-17 20:01:54 +00:00
|
|
|
"StaffBone", //7
|
2007-11-04 03:34:51 +00:00
|
|
|
"SwordBone",
|
|
|
|
"SpearBone",
|
|
|
|
"RFootBone",
|
|
|
|
"LFootBone",
|
2012-03-17 20:01:54 +00:00
|
|
|
"hp_backroot", //12
|
2007-11-04 03:34:51 +00:00
|
|
|
"hp_staffroot",
|
|
|
|
"hp_lhandroot",
|
|
|
|
"hp_rhandroot",
|
|
|
|
"hp_rfootroot",
|
|
|
|
"hp_lfootroot",
|
2012-03-17 20:01:54 +00:00
|
|
|
"staffroot", //18
|
2007-11-04 03:34:51 +00:00
|
|
|
"rfootroot",
|
|
|
|
"lfootroot",
|
|
|
|
"rhandroot",
|
|
|
|
"lhandroot",
|
|
|
|
"leyeroot",
|
|
|
|
"reyeroot"
|
|
|
|
};
|
|
|
|
|
|
|
|
int referenceRootNameOffsets[NUM_REFERENCED] =
|
|
|
|
{
|
2012-03-17 20:01:54 +00:00
|
|
|
0, // CORVUS
|
|
|
|
7, // INSECT
|
2007-11-04 03:34:51 +00:00
|
|
|
12, // HIGH PRIESTESS
|
2012-03-17 20:01:54 +00:00
|
|
|
18, // MORCALAVIN
|
2007-11-04 03:34:51 +00:00
|
|
|
};
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int numReferences[NUM_REFERENCED] =
|
2007-11-04 03:34:51 +00:00
|
|
|
{
|
|
|
|
NUM_REFERENCES_CORVUS,
|
|
|
|
NUM_REFERENCES_INSECT,
|
|
|
|
NUM_REFERENCES_PRIESTESS,
|
|
|
|
NUM_REFERENCES_MORK,
|
|
|
|
};
|
|
|
|
|
|
|
|
int corvusJointIDs[NUM_REFERENCES_CORVUS] =
|
|
|
|
{
|
|
|
|
CORVUS_UPPERBACK,
|
|
|
|
CORVUS_UPPERBACK,
|
|
|
|
-1,
|
|
|
|
-1,
|
|
|
|
CORVUS_UPPERBACK,
|
|
|
|
CORVUS_UPPERBACK,
|
|
|
|
CORVUS_UPPERBACK,
|
|
|
|
};
|
|
|
|
|
|
|
|
int *jointIDs[NUM_REFERENCED] =
|
|
|
|
{
|
|
|
|
corvusJointIDs,
|
|
|
|
};
|
|
|
|
|
|
|
|
static ResourceManager_t ReferenceMngr;
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void InitReferenceMngr(){
|
|
|
|
#define REFERENCE_BLOCK_SIZE 8
|
2007-11-04 03:34:51 +00:00
|
|
|
char *dummystr = NULL;
|
2012-03-17 20:01:54 +00:00
|
|
|
|
|
|
|
ResMngr_Con( &ReferenceMngr, sizeof( LERPedReferences_t ), REFERENCE_BLOCK_SIZE, dummystr );
|
2007-11-04 03:34:51 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void ReleaseReferenceMngr(){
|
|
|
|
ResMngr_Des( &ReferenceMngr );
|
2007-11-04 03:34:51 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
LERPedReferences_t *LERPedReferences_new( int init_refType ){
|
|
|
|
LERPedReferences_t *newRefs;
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
newRefs = ResMngr_AllocateResource( &ReferenceMngr, sizeof( *newRefs ) );
|
2007-11-04 03:34:51 +00:00
|
|
|
newRefs->refType = init_refType;
|
|
|
|
newRefs->jointIDs = jointIDs[init_refType];
|
2012-03-17 20:01:54 +00:00
|
|
|
newRefs->lastUpdate = -( REF_MINCULLTIME * 2.0 );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
memset( newRefs->references, 0, MAX_REFPOINTS * sizeof( Reference_t ) );
|
|
|
|
memset( newRefs->oldReferences, 0, MAX_REFPOINTS * sizeof( Reference_t ) );
|
2007-11-04 03:34:51 +00:00
|
|
|
|
|
|
|
return newRefs;
|
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void LERPedReferences_delete( LERPedReferences_t *toDelete ){
|
|
|
|
ResMngr_DeallocateResource( &ReferenceMngr, toDelete, sizeof( *toDelete ) );
|
2007-11-04 03:34:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// end
|