]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake2/qdata_heretic2/joints.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / joints.h
diff --git a/tools/quake2/qdata_heretic2/joints.h b/tools/quake2/qdata_heretic2/joints.h
new file mode 100644 (file)
index 0000000..e489114
--- /dev/null
@@ -0,0 +1,144 @@
+/*\r
+Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
+For a list of contributors, see the accompanying CONTRIBUTORS file.\r
+\r
+This file is part of GtkRadiant.\r
+\r
+GtkRadiant is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+GtkRadiant is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with GtkRadiant; if not, write to the Free Software\r
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
+*/\r
+\r
+#ifndef JOINTS_H\r
+#define JOINTS_H\r
+\r
+#ifdef _HERETIC2_\r
+#include "angles.h"\r
+#endif\r
+\r
+//typedef float vec3_t[3];\r
+//typedef unsigned char byte;\r
+\r
+#ifndef _WIN32\r
+#define stricmp strcasecmp\r
+#define strcmpi strcasecmp\r
+#endif\r
+\r
+typedef struct Placement_s\r
+{\r
+       vec3_t origin;\r
+       vec3_t direction;\r
+       vec3_t up;\r
+} Placement_t;\r
+\r
+#if 1\r
+typedef struct QDataJoint_s\r
+{\r
+       Placement_t placement;\r
+       vec3_t          rotation;\r
+} QDataJoint_t;\r
+#endif\r
+\r
+typedef struct ArrayedListNode_s\r
+{\r
+       int data;\r
+       int next;\r
+       int inUse;\r
+} ArrayedListNode_t;\r
+\r
+#define ARRAYEDLISTNODE_NULL -1\r
+\r
+typedef struct JointAngles_s\r
+{\r
+       float angles[3];\r
+       int children;\r
+       int created;\r
+} JointAngles_t;\r
+\r
+typedef struct JointAngles2_s\r
+{\r
+       float angles[3];\r
+       int children;\r
+       int changed[3];\r
+       int inUse;\r
+} JointAngles2_t;\r
+\r
+#define MAX_MODELJOINTS                        256\r
+#define MAX_MODELJOINTNODES            255\r
+\r
+extern JointAngles_t jointAngles[MAX_MODELJOINTS];\r
+extern JointAngles2_t jointAngles2[MAX_MODELJOINTS];\r
+\r
+extern ArrayedListNode_t jointAngleNodes[MAX_MODELJOINTNODES];\r
+\r
+// Skeletal structures enums\r
+enum {\r
+       SKEL_RAVEN = 0,\r
+       SKEL_BOX,\r
+       NUM_SKELETONS\r
+};\r
+\r
+// Raven Skeletal structures enums\r
+enum {\r
+       RAVEN_WAIST1 = 0,\r
+       RAVEN_WAIST2 = 1,\r
+       RAVEN_HEAD = 2,\r
+       NUM_JOINTS_RAVEN\r
+};\r
+\r
+// Box Skeletal structures enums\r
+enum {\r
+       BOX_CENTER = 0,\r
+       NUM_JOINTS_BOX\r
+};\r
+\r
+extern int numJointsForSkeleton[];\r
+extern char *RAVEN_SKEL_NAMES[];\r
+\r
+#define J_NEW_SKELETON         0x00001000\r
+#define J_YAW_CHANGED          0x00002000\r
+#define J_PITCH_CHANGED                0x00004000\r
+#define J_ROLL_CHANGED         0x00008000\r
+#define MAX_JOINTS                     0x00000fff\r
+/*\r
+inline int GetFreeNode(ArrayedListNode_t *nodeArray, int max)\r
+{      // 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
+       int i;\r
+\r
+       for(i = 0; i < max; ++i)\r
+       {\r
+               if(!nodeArray[i].inUse)\r
+               {\r
+                       nodeArray[i].inUse = 1;\r
+                       return i;\r
+               }\r
+       }\r
+\r
+       assert(0);\r
+       return -1;\r
+}\r
+\r
+inline void FreeNode(ArrayedListNode_t *nodeArray, int index)\r
+{\r
+       nodeArray[index].inUse = 0;\r
+}\r
+*/\r
+int CreateSkeleton(int structure);\r
+void CreateSkeletonAtIndex(int structure, int index);\r
+void FreeSkeleton(int structure, int index);\r
+void SetJointAngle(int jointIndex, int angleIndex, float angle);\r
+float ModifyJointAngle(int jointIndex, int angleIndex, float deltaAngle);\r
+int ZeroJointAngle(int jointIndex, int angleIndex, float angVel);\r
+int ApplyAngVelToJoint(int jointIndex, int angleIndex, float angVel, float destAng);\r
+\r
+#endif\r