]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - tools/quake2/qdata_heretic2/qcommon/reference.c
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / qcommon / reference.c
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 #include <string.h>\r
23 #include "reference.h"\r
24 #include "arrayedlist.h"\r
25 #include "resourcemanager.h"\r
26 #include "skeletons.h"\r
27 \r
28 char *referenceRootNames[] =\r
29 {\r
30         "elf_Lhandroot",//0\r
31         "elf_Rhandroot",\r
32         "elf_Rfootroot",\r
33         "elf_Lfootroot",\r
34         "elf_Bstaffroot",\r
35         "elf_bladeroot",\r
36         "elf_hellroot",\r
37         "StaffBone",//7\r
38         "SwordBone",\r
39         "SpearBone",\r
40         "RFootBone",\r
41         "LFootBone",\r
42         "hp_backroot",//12\r
43         "hp_staffroot",\r
44         "hp_lhandroot",\r
45         "hp_rhandroot",\r
46         "hp_rfootroot",\r
47         "hp_lfootroot",\r
48         "staffroot",//18\r
49         "rfootroot",\r
50         "lfootroot",\r
51         "rhandroot",\r
52         "lhandroot",\r
53         "leyeroot",\r
54         "reyeroot"\r
55 };\r
56 \r
57 int referenceRootNameOffsets[NUM_REFERENCED] =\r
58 {\r
59         0,      // CORVUS\r
60         7,      // INSECT\r
61         12, // HIGH PRIESTESS\r
62         18,     // MORCALAVIN\r
63 };\r
64 \r
65 int numReferences[NUM_REFERENCED] = \r
66 {\r
67         NUM_REFERENCES_CORVUS,\r
68         NUM_REFERENCES_INSECT,\r
69         NUM_REFERENCES_PRIESTESS,\r
70         NUM_REFERENCES_MORK,\r
71 };\r
72 \r
73 int corvusJointIDs[NUM_REFERENCES_CORVUS] =\r
74 {\r
75         CORVUS_UPPERBACK,\r
76         CORVUS_UPPERBACK,\r
77         -1,\r
78         -1,\r
79         CORVUS_UPPERBACK,\r
80         CORVUS_UPPERBACK,\r
81         CORVUS_UPPERBACK,\r
82 };\r
83 \r
84 int *jointIDs[NUM_REFERENCED] =\r
85 {\r
86         corvusJointIDs,\r
87 };\r
88 \r
89 static ResourceManager_t ReferenceMngr;\r
90 \r
91 void InitReferenceMngr()\r
92 {\r
93 #define REFERENCE_BLOCK_SIZE 8\r
94         char *dummystr = NULL;\r
95         \r
96         ResMngr_Con(&ReferenceMngr, sizeof(LERPedReferences_t), REFERENCE_BLOCK_SIZE, dummystr);\r
97 }\r
98 \r
99 void ReleaseReferenceMngr()\r
100 {\r
101         ResMngr_Des(&ReferenceMngr);\r
102 }\r
103 \r
104 LERPedReferences_t *LERPedReferences_new(int init_refType)\r
105 {\r
106         LERPedReferences_t      *newRefs;\r
107 \r
108         newRefs = ResMngr_AllocateResource(&ReferenceMngr, sizeof(*newRefs));\r
109         newRefs->refType = init_refType;\r
110         newRefs->jointIDs = jointIDs[init_refType];\r
111         newRefs->lastUpdate = -(REF_MINCULLTIME*2.0);\r
112 \r
113         memset(newRefs->references, 0, MAX_REFPOINTS*sizeof(Reference_t));\r
114         memset(newRefs->oldReferences, 0, MAX_REFPOINTS*sizeof(Reference_t));\r
115 \r
116         return newRefs;\r
117 }\r
118 \r
119 void LERPedReferences_delete(LERPedReferences_t *toDelete)\r
120 {\r
121         ResMngr_DeallocateResource(&ReferenceMngr, toDelete, sizeof(*toDelete));\r
122 }\r
123 \r
124 // end\r