]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - tools/quake2/qdata_heretic2/joints.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / joints.h
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 #ifndef JOINTS_H\r
23 #define JOINTS_H\r
24 \r
25 #ifdef _HERETIC2_\r
26 #include "angles.h"\r
27 #endif\r
28 \r
29 //typedef float vec3_t[3];\r
30 //typedef unsigned char byte;\r
31 \r
32 #ifndef _WIN32\r
33 #define stricmp strcasecmp\r
34 #define strcmpi strcasecmp\r
35 #endif\r
36 \r
37 typedef struct Placement_s\r
38 {\r
39         vec3_t origin;\r
40         vec3_t direction;\r
41         vec3_t up;\r
42 } Placement_t;\r
43 \r
44 #if 1\r
45 typedef struct QDataJoint_s\r
46 {\r
47         Placement_t placement;\r
48         vec3_t          rotation;\r
49 } QDataJoint_t;\r
50 #endif\r
51 \r
52 typedef struct ArrayedListNode_s\r
53 {\r
54         int data;\r
55         int next;\r
56         int inUse;\r
57 } ArrayedListNode_t;\r
58 \r
59 #define ARRAYEDLISTNODE_NULL -1\r
60 \r
61 typedef struct JointAngles_s\r
62 {\r
63         float angles[3];\r
64         int children;\r
65         int created;\r
66 } JointAngles_t;\r
67 \r
68 typedef struct JointAngles2_s\r
69 {\r
70         float angles[3];\r
71         int children;\r
72         int changed[3];\r
73         int inUse;\r
74 } JointAngles2_t;\r
75 \r
76 #define MAX_MODELJOINTS                 256\r
77 #define MAX_MODELJOINTNODES             255\r
78 \r
79 extern JointAngles_t jointAngles[MAX_MODELJOINTS];\r
80 extern JointAngles2_t jointAngles2[MAX_MODELJOINTS];\r
81 \r
82 extern ArrayedListNode_t jointAngleNodes[MAX_MODELJOINTNODES];\r
83 \r
84 // Skeletal structures enums\r
85 enum {\r
86         SKEL_RAVEN = 0,\r
87         SKEL_BOX,\r
88         NUM_SKELETONS\r
89 };\r
90 \r
91 // Raven Skeletal structures enums\r
92 enum {\r
93         RAVEN_WAIST1 = 0,\r
94         RAVEN_WAIST2 = 1,\r
95         RAVEN_HEAD = 2,\r
96         NUM_JOINTS_RAVEN\r
97 };\r
98 \r
99 // Box Skeletal structures enums\r
100 enum {\r
101         BOX_CENTER = 0,\r
102         NUM_JOINTS_BOX\r
103 };\r
104 \r
105 extern int numJointsForSkeleton[];\r
106 extern char *RAVEN_SKEL_NAMES[];\r
107 \r
108 #define J_NEW_SKELETON          0x00001000\r
109 #define J_YAW_CHANGED           0x00002000\r
110 #define J_PITCH_CHANGED         0x00004000\r
111 #define J_ROLL_CHANGED          0x00008000\r
112 #define MAX_JOINTS                      0x00000fff\r
113 /*\r
114 inline int GetFreeNode(ArrayedListNode_t *nodeArray, int max)\r
115 {       // yeah, I know this is a sucky, inefficient way to do this, but I didn't feel like taking the time to write a real resource manager in C\r
116         int i;\r
117 \r
118         for(i = 0; i < max; ++i)\r
119         {\r
120                 if(!nodeArray[i].inUse)\r
121                 {\r
122                         nodeArray[i].inUse = 1;\r
123                         return i;\r
124                 }\r
125         }\r
126 \r
127         assert(0);\r
128         return -1;\r
129 }\r
130 \r
131 inline void FreeNode(ArrayedListNode_t *nodeArray, int index)\r
132 {\r
133         nodeArray[index].inUse = 0;\r
134 }\r
135 */\r
136 int CreateSkeleton(int structure);\r
137 void CreateSkeletonAtIndex(int structure, int index);\r
138 void FreeSkeleton(int structure, int index);\r
139 void SetJointAngle(int jointIndex, int angleIndex, float angle);\r
140 float ModifyJointAngle(int jointIndex, int angleIndex, float deltaAngle);\r
141 int ZeroJointAngle(int jointIndex, int angleIndex, float angVel);\r
142 int ApplyAngVelToJoint(int jointIndex, int angleIndex, float angVel, float destAng);\r
143 \r
144 #endif\r