]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake2/qdata_heretic2/qcommon/skeletons.c
eol style
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / qcommon / skeletons.c
index c1db9608ab82992f91ed84f42e5aea383d911005..8e2f685df19c647aa3322c57711a71ad3ab47cee 100644 (file)
-/*\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
-//\r
-// Skeletons.c\r
-//\r
-\r
-#include "skeletons.h"\r
-\r
-char *skeletonRootNames[] =\r
-{\r
-       "RAVEN_ROOT",\r
-       "BOX_ROOT",\r
-       "BEETLE_ROOT",\r
-       "ELFLORD_ROOT",\r
-       "PLAGUELF_ROOT",\r
-       "ELF_BACKROOT",\r
-};\r
-\r
-int skeletonRNameOffsets[] =\r
-{\r
-       0,      // RAVEN\r
-       1,      // BOX\r
-       2,      // BEETLE\r
-       3,      // ELFLORD\r
-       4,      // PLAGUE ELF\r
-       5,      // CORVUS\r
-};\r
-\r
-char *skeletonJointNames[] =\r
-{\r
-       "RAVEN_LOWERBACK",      // 0\r
-       "RAVEN_UPPERBACK",\r
-       "RAVEN_NECK",\r
-       "BOX_CENTER",           // 3\r
-       "BEETLE_NECK",          // 4\r
-       "BEETLE_HEAD",\r
-       "PLAGUELF_BACKB",       // 6\r
-       "PLAGUELF_BACKC",\r
-       "PLAGUELF_NECK",\r
-       "ELF_BACKB",            // 9\r
-       "ELF_BACKC",\r
-       "ELF_NECKB",\r
-};\r
-\r
-int skeletonNameOffsets[] =\r
-{\r
-       0,      // RAVEN\r
-       3,      // BOX\r
-       4,      // BEETLE\r
-       -1,     // ELFLORD\r
-       6,      // PLAGUE ELF\r
-       9,      // CORVUS\r
-};\r
-\r
-char *skeletonEffectorNames[] =\r
-{\r
-       "BEETLE_EYES",          // 0\r
-       "CORVUS_EYES",          // 1\r
-};\r
-\r
-int skeletonENameOffsets[] =\r
-{\r
-       -1,     // RAVEN\r
-       -1,     // BOX\r
-       0,      // BEETLE\r
-       -1,     // ELFLORD\r
-       1,      // PLAGUE ELF\r
-};\r
-\r
-int numJointsInSkeleton[] = \r
-{\r
-       NUM_JOINTS_RAVEN,\r
-       NUM_JOINTS_BOX,\r
-       NUM_JOINTS_BEETLE,\r
-       NUM_JOINTS_ELFLORD,\r
-       NUM_JOINTS_PLAGUE_ELF,\r
-       NUM_JOINTS_CORVUS,\r
-};\r
-\r
-int numNodesInSkeleton[] =\r
-{\r
-       2,      // RAVEN\r
-       0,      // BOX\r
-       1,      // BEETLE\r
-       -1,     // ELFLORD\r
-       2,      // PLAGUE ELF\r
-       2,      // CORVUS\r
-};\r
-\r
-void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);\r
-void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);\r
-void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);\r
-void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);\r
-void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);\r
-\r
-CreateSkeleton_t SkeletonCreators[NUM_SKELETONS] =\r
-{\r
-       CreateRavenSkel,\r
-       CreateBoxSkel,\r
-       CreateBeetleSkel,\r
-       CreateElfLordSkel,\r
-       CreatePlagueElfSkel,\r
-       CreatePlagueElfSkel,    // Corvus has the same structure as the Plague Elf\r
-};\r
-\r
-void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)\r
-{\r
-       char *root;\r
-       int *children;\r
-       int nodeIndex;\r
-\r
-       root = (char *)g_skeletalJoints + rootIndex * jointSize;\r
-\r
-       children = (int *)(root + RAVEN_HEAD * jointSize);\r
-       *children = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + RAVEN_UPPERBACK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + RAVEN_HEAD;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + RAVEN_LOWERBACK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + RAVEN_UPPERBACK;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-}\r
-\r
-void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)\r
-{\r
-       char *root;\r
-       int *children;\r
-\r
-       root = (char *)g_skeletalJoints + rootIndex * jointSize;\r
-\r
-       children = (int *)(root + RAVEN_HEAD * jointSize);\r
-       *children = ARRAYEDLISTNODE_NULL;\r
-}\r
-\r
-void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)\r
-{\r
-       char *root;\r
-       int *children;\r
-       int nodeIndex;\r
-\r
-       root = (char *)g_skeletalJoints + rootIndex * jointSize;\r
-\r
-       children = (int *)(root + BEETLE_HEAD * jointSize);\r
-       *children = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + BEETLE_NECK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-}\r
-\r
-void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)\r
-{\r
-       char *root;\r
-       int *children;\r
-       int nodeIndex;\r
-\r
-       root = (char *)g_skeletalJoints + rootIndex * jointSize;\r
-\r
-       children = (int *)(root + BEETLE_HEAD * jointSize);\r
-       *children = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + BEETLE_NECK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-}\r
-\r
-void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)\r
-{\r
-       char *root;\r
-       int *children;\r
-       int nodeIndex;\r
-\r
-       root = (char *)g_skeletalJoints + rootIndex * jointSize;\r
-\r
-       children = (int *)(root + PLAGUE_ELF_HEAD * jointSize);\r
-       *children = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + PLAGUE_ELF_UPPERBACK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_HEAD;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-\r
-       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);\r
-\r
-       children = (int *)(root + PLAGUE_ELF_LOWERBACK * jointSize);\r
-       *children = nodeIndex;\r
-\r
-       g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_UPPERBACK;\r
-       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;\r
-}\r
-\r
-\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+//
+// Skeletons.c
+//
+
+#include "skeletons.h"
+
+char *skeletonRootNames[] =
+{
+       "RAVEN_ROOT",
+       "BOX_ROOT",
+       "BEETLE_ROOT",
+       "ELFLORD_ROOT",
+       "PLAGUELF_ROOT",
+       "ELF_BACKROOT",
+};
+
+int skeletonRNameOffsets[] =
+{
+       0,      // RAVEN
+       1,      // BOX
+       2,      // BEETLE
+       3,      // ELFLORD
+       4,      // PLAGUE ELF
+       5,      // CORVUS
+};
+
+char *skeletonJointNames[] =
+{
+       "RAVEN_LOWERBACK",      // 0
+       "RAVEN_UPPERBACK",
+       "RAVEN_NECK",
+       "BOX_CENTER",           // 3
+       "BEETLE_NECK",          // 4
+       "BEETLE_HEAD",
+       "PLAGUELF_BACKB",       // 6
+       "PLAGUELF_BACKC",
+       "PLAGUELF_NECK",
+       "ELF_BACKB",            // 9
+       "ELF_BACKC",
+       "ELF_NECKB",
+};
+
+int skeletonNameOffsets[] =
+{
+       0,      // RAVEN
+       3,      // BOX
+       4,      // BEETLE
+       -1,     // ELFLORD
+       6,      // PLAGUE ELF
+       9,      // CORVUS
+};
+
+char *skeletonEffectorNames[] =
+{
+       "BEETLE_EYES",          // 0
+       "CORVUS_EYES",          // 1
+};
+
+int skeletonENameOffsets[] =
+{
+       -1,     // RAVEN
+       -1,     // BOX
+       0,      // BEETLE
+       -1,     // ELFLORD
+       1,      // PLAGUE ELF
+};
+
+int numJointsInSkeleton[] = 
+{
+       NUM_JOINTS_RAVEN,
+       NUM_JOINTS_BOX,
+       NUM_JOINTS_BEETLE,
+       NUM_JOINTS_ELFLORD,
+       NUM_JOINTS_PLAGUE_ELF,
+       NUM_JOINTS_CORVUS,
+};
+
+int numNodesInSkeleton[] =
+{
+       2,      // RAVEN
+       0,      // BOX
+       1,      // BEETLE
+       -1,     // ELFLORD
+       2,      // PLAGUE ELF
+       2,      // CORVUS
+};
+
+void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);
+void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);
+void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
+void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
+void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
+
+CreateSkeleton_t SkeletonCreators[NUM_SKELETONS] =
+{
+       CreateRavenSkel,
+       CreateBoxSkel,
+       CreateBeetleSkel,
+       CreateElfLordSkel,
+       CreatePlagueElfSkel,
+       CreatePlagueElfSkel,    // Corvus has the same structure as the Plague Elf
+};
+
+void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
+{
+       char *root;
+       int *children;
+       int nodeIndex;
+
+       root = (char *)g_skeletalJoints + rootIndex * jointSize;
+
+       children = (int *)(root + RAVEN_HEAD * jointSize);
+       *children = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + RAVEN_UPPERBACK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + RAVEN_HEAD;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + RAVEN_LOWERBACK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + RAVEN_UPPERBACK;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+}
+
+void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
+{
+       char *root;
+       int *children;
+
+       root = (char *)g_skeletalJoints + rootIndex * jointSize;
+
+       children = (int *)(root + RAVEN_HEAD * jointSize);
+       *children = ARRAYEDLISTNODE_NULL;
+}
+
+void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
+{
+       char *root;
+       int *children;
+       int nodeIndex;
+
+       root = (char *)g_skeletalJoints + rootIndex * jointSize;
+
+       children = (int *)(root + BEETLE_HEAD * jointSize);
+       *children = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + BEETLE_NECK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+}
+
+void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
+{
+       char *root;
+       int *children;
+       int nodeIndex;
+
+       root = (char *)g_skeletalJoints + rootIndex * jointSize;
+
+       children = (int *)(root + BEETLE_HEAD * jointSize);
+       *children = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + BEETLE_NECK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+}
+
+void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
+{
+       char *root;
+       int *children;
+       int nodeIndex;
+
+       root = (char *)g_skeletalJoints + rootIndex * jointSize;
+
+       children = (int *)(root + PLAGUE_ELF_HEAD * jointSize);
+       *children = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + PLAGUE_ELF_UPPERBACK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_HEAD;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+
+       nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
+
+       children = (int *)(root + PLAGUE_ELF_LOWERBACK * jointSize);
+       *children = nodeIndex;
+
+       g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_UPPERBACK;
+       g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
+}
+
+