]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - misc/mediasource/extra/netradiant-src/tools/quake2/qdata_heretic2/qcommon/reference.c
Include netRadiant source in this GIT
[voretournament/voretournament.git] / misc / mediasource / extra / netradiant-src / tools / quake2 / qdata_heretic2 / qcommon / reference.c
1 /*
2 Copyright (C) 1999-2006 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 {
93 #define REFERENCE_BLOCK_SIZE 8
94         char *dummystr = NULL;
95         
96         ResMngr_Con(&ReferenceMngr, sizeof(LERPedReferences_t), REFERENCE_BLOCK_SIZE, dummystr);
97 }
98
99 void ReleaseReferenceMngr()
100 {
101         ResMngr_Des(&ReferenceMngr);
102 }
103
104 LERPedReferences_t *LERPedReferences_new(int init_refType)
105 {
106         LERPedReferences_t      *newRefs;
107
108         newRefs = ResMngr_AllocateResource(&ReferenceMngr, sizeof(*newRefs));
109         newRefs->refType = init_refType;
110         newRefs->jointIDs = jointIDs[init_refType];
111         newRefs->lastUpdate = -(REF_MINCULLTIME*2.0);
112
113         memset(newRefs->references, 0, MAX_REFPOINTS*sizeof(Reference_t));
114         memset(newRefs->oldReferences, 0, MAX_REFPOINTS*sizeof(Reference_t));
115
116         return newRefs;
117 }
118
119 void LERPedReferences_delete(LERPedReferences_t *toDelete)
120 {
121         ResMngr_DeallocateResource(&ReferenceMngr, toDelete, sizeof(*toDelete));
122 }
123
124 // end