Debian Codegraph @

tools/heretic2/qcommon/reference.c

raw symbols SCIP
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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", //0
31 "elf_Rhandroot",
32 "elf_Rfootroot",
33 "elf_Lfootroot",
34 "elf_Bstaffroot",
35 "elf_bladeroot",
36 "elf_hellroot",
37 "StaffBone", //7
38 "SwordBone",
39 "SpearBone",
40 "RFootBone",
41 "LFootBone",
42 "hp_backroot", //12
43 "hp_staffroot",
44 "hp_lhandroot",
45 "hp_rhandroot",
46 "hp_rfootroot",
47 "hp_lfootroot",
48 "staffroot", //18
49 "rfootroot",
50 "lfootroot",
51 "rhandroot",
52 "lhandroot",
53 "leyeroot",
54 "reyeroot"
55 };
56
57 int referenceRootNameOffsets[NUM_REFERENCED] =
58 {
59 0, // CORVUS
60 7, // INSECT
61 12, // HIGH PRIESTESS
62 18, // MORCALAVIN
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 // end