]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - tools/quake2/qdata_heretic2/qcommon/skeletons.c
my own uncrustify run
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / qcommon / skeletons.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 //
23 // Skeletons.c
24 //
25
26 #include "skeletons.h"
27
28 char *skeletonRootNames[] =
29 {
30         "RAVEN_ROOT",
31         "BOX_ROOT",
32         "BEETLE_ROOT",
33         "ELFLORD_ROOT",
34         "PLAGUELF_ROOT",
35         "ELF_BACKROOT",
36 };
37
38 int skeletonRNameOffsets[] =
39 {
40         0,  // RAVEN
41         1,  // BOX
42         2,  // BEETLE
43         3,  // ELFLORD
44         4,  // PLAGUE ELF
45         5,  // CORVUS
46 };
47
48 char *skeletonJointNames[] =
49 {
50         "RAVEN_LOWERBACK",  // 0
51         "RAVEN_UPPERBACK",
52         "RAVEN_NECK",
53         "BOX_CENTER",       // 3
54         "BEETLE_NECK",      // 4
55         "BEETLE_HEAD",
56         "PLAGUELF_BACKB",   // 6
57         "PLAGUELF_BACKC",
58         "PLAGUELF_NECK",
59         "ELF_BACKB",        // 9
60         "ELF_BACKC",
61         "ELF_NECKB",
62 };
63
64 int skeletonNameOffsets[] =
65 {
66         0,  // RAVEN
67         3,  // BOX
68         4,  // BEETLE
69         -1, // ELFLORD
70         6,  // PLAGUE ELF
71         9,  // CORVUS
72 };
73
74 char *skeletonEffectorNames[] =
75 {
76         "BEETLE_EYES",      // 0
77         "CORVUS_EYES",      // 1
78 };
79
80 int skeletonENameOffsets[] =
81 {
82         -1, // RAVEN
83         -1, // BOX
84         0,  // BEETLE
85         -1, // ELFLORD
86         1,  // PLAGUE ELF
87 };
88
89 int numJointsInSkeleton[] =
90 {
91         NUM_JOINTS_RAVEN,
92         NUM_JOINTS_BOX,
93         NUM_JOINTS_BEETLE,
94         NUM_JOINTS_ELFLORD,
95         NUM_JOINTS_PLAGUE_ELF,
96         NUM_JOINTS_CORVUS,
97 };
98
99 int numNodesInSkeleton[] =
100 {
101         2,  // RAVEN
102         0,  // BOX
103         1,  // BEETLE
104         -1, // ELFLORD
105         2,  // PLAGUE ELF
106         2,  // CORVUS
107 };
108
109 void CreateRavenSkel( void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root );
110 void CreateBoxSkel( void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root );
111 void CreateBeetleSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex );
112 void CreateElfLordSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex );
113 void CreatePlagueElfSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex );
114
115 CreateSkeleton_t SkeletonCreators[NUM_SKELETONS] =
116 {
117         CreateRavenSkel,
118         CreateBoxSkel,
119         CreateBeetleSkel,
120         CreateElfLordSkel,
121         CreatePlagueElfSkel,
122         CreatePlagueElfSkel,    // Corvus has the same structure as the Plague Elf
123 };
124
125 void CreateRavenSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex ){
126         char *root;
127         int *children;
128         int nodeIndex;
129
130         root = (char *)g_skeletalJoints + rootIndex * jointSize;
131
132         children = (int *)( root + RAVEN_HEAD * jointSize );
133         *children = ARRAYEDLISTNODE_NULL;
134
135         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
136
137         children = (int *)( root + RAVEN_UPPERBACK * jointSize );
138         *children = nodeIndex;
139
140         g_jointNodes[nodeIndex].data = rootIndex + RAVEN_HEAD;
141         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
142
143         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
144
145         children = (int *)( root + RAVEN_LOWERBACK * jointSize );
146         *children = nodeIndex;
147
148         g_jointNodes[nodeIndex].data = rootIndex + RAVEN_UPPERBACK;
149         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
150 }
151
152 void CreateBoxSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex ){
153         char *root;
154         int *children;
155
156         root = (char *)g_skeletalJoints + rootIndex * jointSize;
157
158         children = (int *)( root + RAVEN_HEAD * jointSize );
159         *children = ARRAYEDLISTNODE_NULL;
160 }
161
162 void CreateBeetleSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex ){
163         char *root;
164         int *children;
165         int nodeIndex;
166
167         root = (char *)g_skeletalJoints + rootIndex * jointSize;
168
169         children = (int *)( root + BEETLE_HEAD * jointSize );
170         *children = ARRAYEDLISTNODE_NULL;
171
172         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
173
174         children = (int *)( root + BEETLE_NECK * jointSize );
175         *children = nodeIndex;
176
177         g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
178         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
179 }
180
181 void CreateElfLordSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex ){
182         char *root;
183         int *children;
184         int nodeIndex;
185
186         root = (char *)g_skeletalJoints + rootIndex * jointSize;
187
188         children = (int *)( root + BEETLE_HEAD * jointSize );
189         *children = ARRAYEDLISTNODE_NULL;
190
191         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
192
193         children = (int *)( root + BEETLE_NECK * jointSize );
194         *children = nodeIndex;
195
196         g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
197         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
198 }
199
200 void CreatePlagueElfSkel( void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex ){
201         char *root;
202         int *children;
203         int nodeIndex;
204
205         root = (char *)g_skeletalJoints + rootIndex * jointSize;
206
207         children = (int *)( root + PLAGUE_ELF_HEAD * jointSize );
208         *children = ARRAYEDLISTNODE_NULL;
209
210         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
211
212         children = (int *)( root + PLAGUE_ELF_UPPERBACK * jointSize );
213         *children = nodeIndex;
214
215         g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_HEAD;
216         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
217
218         nodeIndex = GetFreeNode( g_jointNodes, MAX_ARRAYED_JOINT_NODES );
219
220         children = (int *)( root + PLAGUE_ELF_LOWERBACK * jointSize );
221         *children = nodeIndex;
222
223         g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_UPPERBACK;
224         g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
225 }