]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake2/qdata_heretic2/jointed.c
my own uncrustify run
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / jointed.c
index 4d78a792112a835058fec2e0fc56c8d2bcf16d30..7879733f151c04d1eac8257b9bd0d33c333a535a 100644 (file)
@@ -1,23 +1,23 @@
 /*
-Copyright (C) 1999-2006 Id Software, Inc. and contributors.
-For a list of contributors, see the accompanying CONTRIBUTORS file.
+   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
 
-This file is part of GtkRadiant.
+   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 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.
+   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
-*/
+   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
+ */
 
 #include <assert.h>
 #include <math.h>
@@ -43,7 +43,7 @@ int NAME_OFFSETS[] =
        0
 };
 
-int numJointsForSkeleton[] = 
+int numJointsForSkeleton[] =
 {
        NUM_JOINTS_RAVEN,
        NUM_JOINTS_BOX
@@ -59,41 +59,39 @@ float g_translation[3];
 //
 //==========================================================================
 
-static void LoadHRCClustered(char *fileName, int **clusterList, int *num_verts, int skelType)
-{
+static void LoadHRCClustered( char *fileName, int **clusterList, int *num_verts, int skelType ){
        int i, j;
 
-       TK_OpenSource(fileName);
-       TK_FetchRequire(TK_HRCH);
-       TK_FetchRequire(TK_COLON);
-       TK_FetchRequire(TK_SOFTIMAGE);
+       TK_OpenSource( fileName );
+       TK_FetchRequire( TK_HRCH );
+       TK_FetchRequire( TK_COLON );
+       TK_FetchRequire( TK_SOFTIMAGE );
 
-       TK_Beyond(TK_CLUSTERS);
+       TK_Beyond( TK_CLUSTERS );
 
-       while(TK_Search(TK_CLUSTER_NAME) != TK_EOF)
+       while ( TK_Search( TK_CLUSTER_NAME ) != TK_EOF )
        {
-               TK_Require(TK_STRING);
+               TK_Require( TK_STRING );
 
-               for( i = 0; i < numJointsForSkeleton[skelType]; ++i)
+               for ( i = 0; i < numJointsForSkeleton[skelType]; ++i )
                {
-                       if(stricmp(tk_String, SKEL_NAMES[NAME_OFFSETS[skelType]+i]) == 0)
-                       {
+                       if ( stricmp( tk_String, SKEL_NAMES[NAME_OFFSETS[skelType] + i] ) == 0 ) {
                                i = -i + numJointsForSkeleton[skelType] - 1;
 
-                               TK_BeyondRequire(TK_NUM_CLUSTER_VERTICES, TK_INTNUMBER);
+                               TK_BeyondRequire( TK_NUM_CLUSTER_VERTICES, TK_INTNUMBER );
 
-                               num_verts[i+1] = tk_IntNumber;
+                               num_verts[i + 1] = tk_IntNumber;
 
-                               clusterList[i] = (int *) SafeMalloc(num_verts[i+1]*sizeof(int), "LoadHRCClustered");
-                               assert(clusterList[i]);
+                               clusterList[i] = (int *) SafeMalloc( num_verts[i + 1] * sizeof( int ), "LoadHRCClustered" );
+                               assert( clusterList[i] );
                                // currently this function is only called by LoadTriangleListClustered, which in turn is only
                                // called by Cmd_Base in qdata.  This is where the only call to free for this memory is being made.
 
-                               TK_Beyond(TK_LBRACE);
+                               TK_Beyond( TK_LBRACE );
 
-                               for(j = 0; j < num_verts[i+1]; ++j)
+                               for ( j = 0; j < num_verts[i + 1]; ++j )
                                {
-                                       TK_Require(TK_INTNUMBER);
+                                       TK_Require( TK_INTNUMBER );
                                        clusterList[i][j] = tk_IntNumber;
                                        TK_Fetch();
                                }
@@ -106,73 +104,68 @@ static void LoadHRCClustered(char *fileName, int **clusterList, int *num_verts,
        num_verts[0] = numJointsForSkeleton[skelType];
 }
 
-static void LoadHRCGlobals(char *fileName)
-{
+static void LoadHRCGlobals( char *fileName ){
        int i;
 
-       TK_OpenSource(fileName);
-       TK_FetchRequire(TK_HRCH);
-       TK_FetchRequire(TK_COLON);
-       TK_FetchRequire(TK_SOFTIMAGE);
-       TK_Beyond(TK_MODEL);
+       TK_OpenSource( fileName );
+       TK_FetchRequire( TK_HRCH );
+       TK_FetchRequire( TK_COLON );
+       TK_FetchRequire( TK_SOFTIMAGE );
+       TK_Beyond( TK_MODEL );
 
-       TK_Beyond(TK_SCALING);
-       for(i = 0; i < 3; i++)
+       TK_Beyond( TK_SCALING );
+       for ( i = 0; i < 3; i++ )
        {
-               TK_Require(TK_FLOATNUMBER);
+               TK_Require( TK_FLOATNUMBER );
                g_scaling[i] = tk_FloatNumber;
                TK_Fetch();
        }
 
-       TK_Beyond(TK_ROTATION);
-       for(i = 0; i < 3; i++)
+       TK_Beyond( TK_ROTATION );
+       for ( i = 0; i < 3; i++ )
        {
-               TK_Require(TK_FLOATNUMBER);
+               TK_Require( TK_FLOATNUMBER );
                g_rotation[i] = tk_FloatNumber;
                TK_Fetch();
        }
 
-       TK_Beyond(TK_TRANSLATION);
-       for(i = 0; i < 3; i++)
+       TK_Beyond( TK_TRANSLATION );
+       for ( i = 0; i < 3; i++ )
        {
-               TK_Require(TK_FLOATNUMBER);
+               TK_Require( TK_FLOATNUMBER );
                g_translation[i] = tk_FloatNumber;
                TK_Fetch();
        }
 }
 
-static void ParseVec3(vec3_t in)
-{
-       TK_Require(TK_FLOATNUMBER);
+static void ParseVec3( vec3_t in ){
+       TK_Require( TK_FLOATNUMBER );
        in[1] = tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[2] = tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[0] = tk_FloatNumber;
 }
 
-static void ParseRotation3(vec3_t in)
-{
-       TK_Require(TK_FLOATNUMBER);
+static void ParseRotation3( vec3_t in ){
+       TK_Require( TK_FLOATNUMBER );
        in[1] = -tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[2] = tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[0] = tk_FloatNumber;
 }
 
-static void ParseTranslation3(vec3_t in)
-{
-       TK_Require(TK_FLOATNUMBER);
+static void ParseTranslation3( vec3_t in ){
+       TK_Require( TK_FLOATNUMBER );
        in[1] = tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[2] = tk_FloatNumber;
-       TK_FetchRequire(TK_FLOATNUMBER);
+       TK_FetchRequire( TK_FLOATNUMBER );
        in[0] = tk_FloatNumber;
 }
 
-static void LoadHRCJointList(char *fileName, QDataJoint_t *jointList, int skelType)
-{
+static void LoadHRCJointList( char *fileName, QDataJoint_t *jointList, int skelType ){
 #define MAX_STACK 64
        int i, j;
        vec3_t curTranslation[MAX_STACK], curRotation[MAX_STACK], curScale[MAX_STACK];
@@ -184,34 +177,34 @@ static void LoadHRCJointList(char *fileName, QDataJoint_t *jointList, int skelTy
        float x2, y2, z2;
 
 
-       TK_OpenSource(fileName);
-       TK_FetchRequire(TK_HRCH);
-       TK_FetchRequire(TK_COLON);
-       TK_FetchRequire(TK_SOFTIMAGE);
+       TK_OpenSource( fileName );
+       TK_FetchRequire( TK_HRCH );
+       TK_FetchRequire( TK_COLON );
+       TK_FetchRequire( TK_SOFTIMAGE );
 
-       TK_Beyond(TK_MODEL);
-       TK_Beyond(TK_MODEL);
+       TK_Beyond( TK_MODEL );
+       TK_Beyond( TK_MODEL );
 
 /*     while(1)
-       {
-               TK_Beyond(TK_MODEL);
-               TK_BeyondRequire(TK_NAME, TK_STRING);
+    {
+        TK_Beyond(TK_MODEL);
+        TK_BeyondRequire(TK_NAME, TK_STRING);
 
-               if(_stricmp(tk_String, SKEL_ROOT_NAMES[skelType]) == 0)
-                       break;
-       }*/
+        if(_stricmp(tk_String, SKEL_ROOT_NAMES[skelType]) == 0)
+            break;
+    }*/
 
-       TK_Beyond(TK_SCALING);
+       TK_Beyond( TK_SCALING );
 
-       ParseVec3(curScale[currentStack]);
+       ParseVec3( curScale[currentStack] );
 
-       TK_Beyond(TK_ROTATION);
+       TK_Beyond( TK_ROTATION );
 
-       ParseRotation3(curRotation[currentStack]);
+       ParseRotation3( curRotation[currentStack] );
 
-       TK_Beyond(TK_TRANSLATION);
+       TK_Beyond( TK_TRANSLATION );
 
-       ParseVec3(curTranslation[currentStack]);
+       ParseVec3( curTranslation[currentStack] );
 
        // account for global model translation
        curTranslation[currentStack][1] += g_translation[0];
@@ -220,49 +213,49 @@ static void LoadHRCJointList(char *fileName, QDataJoint_t *jointList, int skelTy
 
        ++currentStack;
 
-       for(i = 0; i < NUM_JOINTS_RAVEN; ++i)
+       for ( i = 0; i < NUM_JOINTS_RAVEN; ++i )
        {
-               while(1)
+               while ( 1 )
                {
-                       TK_Beyond(TK_MODEL);
+                       TK_Beyond( TK_MODEL );
 
 //                     TK_BeyondRequire(TK_NAME, TK_STRING);
 
 //                     if(_stricmp(tk_String, SKEL_NAMES[NAME_OFFSETS[skelType]+i]) == 0)
-                               break;
+                       break;
 
-                       TK_Beyond(TK_SCALING);
+                       TK_Beyond( TK_SCALING );
 
-                       ParseVec3(curScale[currentStack]);
+                       ParseVec3( curScale[currentStack] );
 
-                       TK_Beyond(TK_ROTATION);
+                       TK_Beyond( TK_ROTATION );
 
-                       ParseRotation3(curRotation[currentStack]);
+                       ParseRotation3( curRotation[currentStack] );
 
-                       TK_Beyond(TK_TRANSLATION);
+                       TK_Beyond( TK_TRANSLATION );
 
-                       ParseVec3(curTranslation[currentStack]);
+                       ParseVec3( curTranslation[currentStack] );
 
                        curCorrespondingJoint[currentStack] = -1;
 
                        ++currentStack;
                }
 
-               TK_Beyond(TK_SCALING);
+               TK_Beyond( TK_SCALING );
 
-               ParseVec3(curScale[currentStack]);
+               ParseVec3( curScale[currentStack] );
 
-               TK_Beyond(TK_ROTATION);
+               TK_Beyond( TK_ROTATION );
 
-               ParseRotation3(curRotation[currentStack]);
+               ParseRotation3( curRotation[currentStack] );
 
                jointList[i].rotation[1] = curRotation[currentStack][1];
                jointList[i].rotation[2] = curRotation[currentStack][2];
                jointList[i].rotation[0] = curRotation[currentStack][0];
 
-               TK_Beyond(TK_TRANSLATION);
+               TK_Beyond( TK_TRANSLATION );
 
-               ParseVec3(curTranslation[currentStack]);
+               ParseVec3( curTranslation[currentStack] );
 
                jointList[i].placement.origin[1] = curTranslation[currentStack][1];
                jointList[i].placement.origin[2] = curTranslation[currentStack][2];
@@ -283,54 +276,54 @@ static void LoadHRCJointList(char *fileName, QDataJoint_t *jointList, int skelTy
 
        stackSize = currentStack;
 
-       for(i = 0; i < NUM_JOINTS_RAVEN; ++i)
+       for ( i = 0; i < NUM_JOINTS_RAVEN; ++i )
        {
-               rx = jointList[i].rotation[0]*ANGLE_TO_RAD;
-               ry = jointList[i].rotation[1]*ANGLE_TO_RAD;
-               rz = jointList[i].rotation[2]*ANGLE_TO_RAD;
+               rx = jointList[i].rotation[0] * ANGLE_TO_RAD;
+               ry = jointList[i].rotation[1] * ANGLE_TO_RAD;
+               rz = jointList[i].rotation[2] * ANGLE_TO_RAD;
 
-               cx = cos(rx);
-               sx = sin(rx);
+               cx = cos( rx );
+               sx = sin( rx );
 
-               cy = cos(ry);
-               sy = sin(ry);
+               cy = cos( ry );
+               sy = sin( ry );
 
-               cz = cos(rz);
-               sz = sin(rz);
+               cz = cos( rz );
+               sz = sin( rz );
 
                // y-axis rotation for direction
-               x2 = jointList[i].placement.direction[0]*cy+jointList[i].placement.direction[2]*sy;
-               z2 = -jointList[i].placement.direction[0]*sy+jointList[i].placement.direction[2]*cy;
+               x2 = jointList[i].placement.direction[0] * cy + jointList[i].placement.direction[2] * sy;
+               z2 = -jointList[i].placement.direction[0] * sy + jointList[i].placement.direction[2] * cy;
                jointList[i].placement.direction[0] = x2;
                jointList[i].placement.direction[2] = z2;
 
                // y-axis rotation for up
-               x2 = jointList[i].placement.up[0]*cy+jointList[i].placement.up[2]*sy;
-               z2 = -jointList[i].placement.up[0]*sy+jointList[i].placement.up[2]*cy;
+               x2 = jointList[i].placement.up[0] * cy + jointList[i].placement.up[2] * sy;
+               z2 = -jointList[i].placement.up[0] * sy + jointList[i].placement.up[2] * cy;
                jointList[i].placement.up[0] = x2;
                jointList[i].placement.up[2] = z2;
 
                // z-axis rotation for direction
-               x2 = jointList[i].placement.direction[0]*cz-jointList[i].placement.direction[1]*sz;
-               y2 = jointList[i].placement.direction[0]*sz+jointList[i].placement.direction[1]*cz;
+               x2 = jointList[i].placement.direction[0] * cz - jointList[i].placement.direction[1] * sz;
+               y2 = jointList[i].placement.direction[0] * sz + jointList[i].placement.direction[1] * cz;
                jointList[i].placement.direction[0] = x2;
                jointList[i].placement.direction[1] = y2;
 
                // z-axis rotation for up
-               x2 = jointList[i].placement.up[0]*cz-jointList[i].placement.up[1]*sz;
-               y2 = jointList[i].placement.up[0]*sz+jointList[i].placement.up[1]*cz;
+               x2 = jointList[i].placement.up[0] * cz - jointList[i].placement.up[1] * sz;
+               y2 = jointList[i].placement.up[0] * sz + jointList[i].placement.up[1] * cz;
                jointList[i].placement.up[0] = x2;
                jointList[i].placement.up[1] = y2;
 
                // x-axis rotation for direction vector
-               y2 = jointList[i].placement.direction[1]*cx-jointList[i].placement.direction[2]*sx;
-               z2 = jointList[i].placement.direction[1]*sx+jointList[i].placement.direction[2]*cx;
+               y2 = jointList[i].placement.direction[1] * cx - jointList[i].placement.direction[2] * sx;
+               z2 = jointList[i].placement.direction[1] * sx + jointList[i].placement.direction[2] * cx;
                jointList[i].placement.direction[1] = y2;
                jointList[i].placement.direction[2] = z2;
 
                // x-axis rotation for up vector
-               y2 = jointList[i].placement.up[1]*cx-jointList[i].placement.up[2]*sx;
-               z2 = jointList[i].placement.up[1]*sx+jointList[i].placement.up[2]*cx;
+               y2 = jointList[i].placement.up[1] * cx - jointList[i].placement.up[2] * sx;
+               z2 = jointList[i].placement.up[1] * sx + jointList[i].placement.up[2] * cx;
                jointList[i].placement.up[1] = y2;
                jointList[i].placement.up[2] = z2;
 
@@ -347,226 +340,209 @@ static void LoadHRCJointList(char *fileName, QDataJoint_t *jointList, int skelTy
 
        baseJoint = NUM_JOINTS_RAVEN;
 
-       for(i = stackSize/*NUM_JOINTS_RAVEN*/ - 1; i > 0; --i)
+       for ( i = stackSize /*NUM_JOINTS_RAVEN*/ - 1; i > 0; --i )
        {
 
-               rx = curRotation[i-1][0]*ANGLE_TO_RAD;
-               ry = curRotation[i-1][1]*ANGLE_TO_RAD;
-               rz = curRotation[i-1][2]*ANGLE_TO_RAD;
+               rx = curRotation[i - 1][0] * ANGLE_TO_RAD;
+               ry = curRotation[i - 1][1] * ANGLE_TO_RAD;
+               rz = curRotation[i - 1][2] * ANGLE_TO_RAD;
 
-               cx = cos(rx);
-               sx = sin(rx);
+               cx = cos( rx );
+               sx = sin( rx );
 
-               cy = cos(ry);
-               sy = sin(ry);
+               cy = cos( ry );
+               sy = sin( ry );
 
-               cz = cos(rz);
-               sz = sin(rz);
+               cz = cos( rz );
+               sz = sin( rz );
 
-               for(j = i-1; j < stackSize-1; ++j)
+               for ( j = i - 1; j < stackSize - 1; ++j )
                {
                        // y-axis rotation for origin
-                       x2 = jointList[j].placement.origin[0]*cy+jointList[j].placement.origin[2]*sy;
-                       z2 = -jointList[j].placement.origin[0]*sy+jointList[j].placement.origin[2]*cy;
+                       x2 = jointList[j].placement.origin[0] * cy + jointList[j].placement.origin[2] * sy;
+                       z2 = -jointList[j].placement.origin[0] * sy + jointList[j].placement.origin[2] * cy;
                        jointList[j].placement.origin[0] = x2;
                        jointList[j].placement.origin[2] = z2;
 
                        // y-axis rotation for direction
-                       x2 = jointList[j].placement.direction[0]*cy+jointList[j].placement.direction[2]*sy;
-                       z2 = -jointList[j].placement.direction[0]*sy+jointList[j].placement.direction[2]*cy;
+                       x2 = jointList[j].placement.direction[0] * cy + jointList[j].placement.direction[2] * sy;
+                       z2 = -jointList[j].placement.direction[0] * sy + jointList[j].placement.direction[2] * cy;
                        jointList[j].placement.direction[0] = x2;
                        jointList[j].placement.direction[2] = z2;
 
                        // y-axis rotation for up
-                       x2 = jointList[j].placement.up[0]*cy+jointList[j].placement.up[2]*sy;
-                       z2 = -jointList[j].placement.up[0]*sy+jointList[j].placement.up[2]*cy;
+                       x2 = jointList[j].placement.up[0] * cy + jointList[j].placement.up[2] * sy;
+                       z2 = -jointList[j].placement.up[0] * sy + jointList[j].placement.up[2] * cy;
                        jointList[j].placement.up[0] = x2;
                        jointList[j].placement.up[2] = z2;
 
                        // z-axis rotation for origin
-                       x2 = jointList[j].placement.origin[0]*cz-jointList[j].placement.origin[1]*sz;
-                       y2 = jointList[j].placement.origin[0]*sz+jointList[j].placement.origin[1]*cz;
+                       x2 = jointList[j].placement.origin[0] * cz - jointList[j].placement.origin[1] * sz;
+                       y2 = jointList[j].placement.origin[0] * sz + jointList[j].placement.origin[1] * cz;
                        jointList[j].placement.origin[0] = x2;
                        jointList[j].placement.origin[1] = y2;
 
                        // z-axis rotation for direction
-                       x2 = jointList[j].placement.direction[0]*cz-jointList[j].placement.direction[1]*sz;
-                       y2 = jointList[j].placement.direction[0]*sz+jointList[j].placement.direction[1]*cz;
+                       x2 = jointList[j].placement.direction[0] * cz - jointList[j].placement.direction[1] * sz;
+                       y2 = jointList[j].placement.direction[0] * sz + jointList[j].placement.direction[1] * cz;
                        jointList[j].placement.direction[0] = x2;
                        jointList[j].placement.direction[1] = y2;
 
                        // z-axis rotation for up
-                       x2 = jointList[j].placement.up[0]*cz-jointList[j].placement.up[1]*sz;
-                       y2 = jointList[j].placement.up[0]*sz+jointList[j].placement.up[1]*cz;
+                       x2 = jointList[j].placement.up[0] * cz - jointList[j].placement.up[1] * sz;
+                       y2 = jointList[j].placement.up[0] * sz + jointList[j].placement.up[1] * cz;
                        jointList[j].placement.up[0] = x2;
                        jointList[j].placement.up[1] = y2;
 
                        // x-axis rotation for origin
-                       y2 = jointList[j].placement.origin[1]*cx-jointList[j].placement.origin[2]*sx;
-                       z2 = jointList[j].placement.origin[1]*sx+jointList[j].placement.origin[2]*cx;
+                       y2 = jointList[j].placement.origin[1] * cx - jointList[j].placement.origin[2] * sx;
+                       z2 = jointList[j].placement.origin[1] * sx + jointList[j].placement.origin[2] * cx;
                        jointList[j].placement.origin[1] = y2;
                        jointList[j].placement.origin[2] = z2;
 
                        // x-axis rotation for direction vector
-                       y2 = jointList[j].placement.direction[1]*cx-jointList[j].placement.direction[2]*sx;
-                       z2 = jointList[j].placement.direction[1]*sx+jointList[j].placement.direction[2]*cx;
+                       y2 = jointList[j].placement.direction[1] * cx - jointList[j].placement.direction[2] * sx;
+                       z2 = jointList[j].placement.direction[1] * sx + jointList[j].placement.direction[2] * cx;
                        jointList[j].placement.direction[1] = y2;
                        jointList[j].placement.direction[2] = z2;
 
                        // x-axis rotation for up vector
-                       y2 = jointList[j].placement.up[1]*cx-jointList[j].placement.up[2]*sx;
-                       z2 = jointList[j].placement.up[1]*sx+jointList[j].placement.up[2]*cx;
+                       y2 = jointList[j].placement.up[1] * cx - jointList[j].placement.up[2] * sx;
+                       z2 = jointList[j].placement.up[1] * sx + jointList[j].placement.up[2] * cx;
                        jointList[j].placement.up[1] = y2;
                        jointList[j].placement.up[2] = z2;
 
-                       if(curCorrespondingJoint[j+1] != -1)
-                       {
+                       if ( curCorrespondingJoint[j + 1] != -1 ) {
                                // translate origin
-                               jointList[j].placement.origin[0] += curTranslation[i-1][0];
-                               jointList[j].placement.origin[1] += curTranslation[i-1][1];
-                               jointList[j].placement.origin[2] += curTranslation[i-1][2];
+                               jointList[j].placement.origin[0] += curTranslation[i - 1][0];
+                               jointList[j].placement.origin[1] += curTranslation[i - 1][1];
+                               jointList[j].placement.origin[2] += curTranslation[i - 1][2];
 
                                // translate back to local coord
-                               jointList[j].placement.direction[0] += curTranslation[i-1][0];
-                               jointList[j].placement.direction[1] += curTranslation[i-1][1];
-                               jointList[j].placement.direction[2] += curTranslation[i-1][2];
+                               jointList[j].placement.direction[0] += curTranslation[i - 1][0];
+                               jointList[j].placement.direction[1] += curTranslation[i - 1][1];
+                               jointList[j].placement.direction[2] += curTranslation[i - 1][2];
 
                                // translate back to local coord
-                               jointList[j].placement.up[0] += curTranslation[i-1][0];
-                               jointList[j].placement.up[1] += curTranslation[i-1][1];
-                               jointList[j].placement.up[2] += curTranslation[i-1][2];
+                               jointList[j].placement.up[0] += curTranslation[i - 1][0];
+                               jointList[j].placement.up[1] += curTranslation[i - 1][1];
+                               jointList[j].placement.up[2] += curTranslation[i - 1][2];
                        }
                }
        }
 }
 
-void LoadGlobals(char *fileName)
-{
+void LoadGlobals( char *fileName ){
        FILE *file1;
-    int dot = '.';
+       int dot = '.';
        char *dotstart;
-       char    InputFileName[256];
+       char InputFileName[256];
 
-       dotstart = strrchr(fileName,dot); // Does it already have an extension on the file name?
+       dotstart = strrchr( fileName,dot ); // Does it already have an extension on the file name?
 
-       if (!dotstart)
-       {
-               strcpy(InputFileName, fileName);
-               strcat(InputFileName, ".hrc");
-               if((file1 = fopen(InputFileName, "rb")) != NULL)
-               {
-                       fclose(file1);
+       if ( !dotstart ) {
+               strcpy( InputFileName, fileName );
+               strcat( InputFileName, ".hrc" );
+               if ( ( file1 = fopen( InputFileName, "rb" ) ) != NULL ) {
+                       fclose( file1 );
 
-                       LoadHRCGlobals(InputFileName);
+                       LoadHRCGlobals( InputFileName );
 
-                       printf(" - assuming .HRC\n");
+                       printf( " - assuming .HRC\n" );
                        return;
                }
 
-               Error("\n Could not open file '%s':\n"
-                       "No HRC match.\n", fileName);
+               Error( "\n Could not open file '%s':\n"
+                          "No HRC match.\n", fileName );
        }
        else
        {
-               if((file1 = fopen(fileName, "rb")) != NULL)
-               {
-                       printf("\n");
-                       fclose(file1);
-                       if (strcmp(dotstart,".hrc") == 0 || strcmp(dotstart,".HRC") == 0)
-                       {
-                               LoadHRCGlobals(fileName);
+               if ( ( file1 = fopen( fileName, "rb" ) ) != NULL ) {
+                       printf( "\n" );
+                       fclose( file1 );
+                       if ( strcmp( dotstart,".hrc" ) == 0 || strcmp( dotstart,".HRC" ) == 0 ) {
+                               LoadHRCGlobals( fileName );
                                return;
                        }
                }
 
-               Error("Could not open file '%s':\n",fileName);
+               Error( "Could not open file '%s':\n",fileName );
        }
 }
 
-void LoadClusters(char *fileName, int **clusterList, int *num_verts, int skelType)
-{
+void LoadClusters( char *fileName, int **clusterList, int *num_verts, int skelType ){
        FILE *file1;
-    int dot = '.';
+       int dot = '.';
        char *dotstart;
-       char    InputFileName[256];
+       char InputFileName[256];
 
-       dotstart = strrchr(fileName,dot); // Does it already have an extension on the file name?
+       dotstart = strrchr( fileName,dot ); // Does it already have an extension on the file name?
 
-       if (!dotstart)
-       {
-               strcpy(InputFileName, fileName);
-               strcat(InputFileName, ".hrc");
-               if((file1 = fopen(InputFileName, "rb")) != NULL)
-               {
-                       fclose(file1);
+       if ( !dotstart ) {
+               strcpy( InputFileName, fileName );
+               strcat( InputFileName, ".hrc" );
+               if ( ( file1 = fopen( InputFileName, "rb" ) ) != NULL ) {
+                       fclose( file1 );
 
-                       LoadHRCClustered(InputFileName, clusterList, num_verts, skelType);
+                       LoadHRCClustered( InputFileName, clusterList, num_verts, skelType );
 
-                       printf(" - assuming .HRC\n");
+                       printf( " - assuming .HRC\n" );
                        return;
                }
 
-               Error("\n Could not open file '%s':\n"
-                       "No HRC match.\n", fileName);
+               Error( "\n Could not open file '%s':\n"
+                          "No HRC match.\n", fileName );
        }
        else
        {
-               if((file1 = fopen(fileName, "rb")) != NULL)
-               {
-                       printf("\n");
-                       fclose(file1);
-                       if (strcmp(dotstart,".hrc") == 0 || strcmp(dotstart,".HRC") == 0)
-                       {
-                               LoadHRCClustered(fileName, clusterList, num_verts, skelType);
+               if ( ( file1 = fopen( fileName, "rb" ) ) != NULL ) {
+                       printf( "\n" );
+                       fclose( file1 );
+                       if ( strcmp( dotstart,".hrc" ) == 0 || strcmp( dotstart,".HRC" ) == 0 ) {
+                               LoadHRCClustered( fileName, clusterList, num_verts, skelType );
                                return;
                        }
                }
 
-               Error("Could not open file '%s':\n",fileName);
+               Error( "Could not open file '%s':\n",fileName );
        }
 }
 
-void LoadJointList(char *fileName, QDataJoint_t *jointList, int skelType)
-{
+void LoadJointList( char *fileName, QDataJoint_t *jointList, int skelType ){
        FILE *file1;
-    int dot = '.';
+       int dot = '.';
        char *dotstart;
-       char    InputFileName[256];
+       char InputFileName[256];
 
-       dotstart = strrchr(fileName,dot); // Does it already have an extension on the file name?
+       dotstart = strrchr( fileName,dot ); // Does it already have an extension on the file name?
 
-       if (!dotstart)
-       {
-               strcpy(InputFileName, fileName);
-               strcat(InputFileName, ".hrc");
-               if((file1 = fopen(InputFileName, "rb")) != NULL)
-               {
-                       fclose(file1);
+       if ( !dotstart ) {
+               strcpy( InputFileName, fileName );
+               strcat( InputFileName, ".hrc" );
+               if ( ( file1 = fopen( InputFileName, "rb" ) ) != NULL ) {
+                       fclose( file1 );
 
-                       LoadHRCJointList(InputFileName, jointList, skelType);
+                       LoadHRCJointList( InputFileName, jointList, skelType );
 
-                       printf(" - assuming .HRC\n");
+                       printf( " - assuming .HRC\n" );
                        return;
                }
 
-               Error("\n Could not open file '%s':\n"
-                       "No HRC.\n", fileName);
+               Error( "\n Could not open file '%s':\n"
+                          "No HRC.\n", fileName );
        }
        else
        {
-               if((file1 = fopen(fileName, "rb")) != NULL)
-               {
-                       printf("\n");
-                       fclose(file1);
-                       if (strcmp(dotstart,".hrc") == 0 || strcmp(dotstart,".HRC") == 0)
-                       {
-                               LoadHRCJointList(fileName, jointList, skelType);
+               if ( ( file1 = fopen( fileName, "rb" ) ) != NULL ) {
+                       printf( "\n" );
+                       fclose( file1 );
+                       if ( strcmp( dotstart,".hrc" ) == 0 || strcmp( dotstart,".HRC" ) == 0 ) {
+                               LoadHRCJointList( fileName, jointList, skelType );
 
                                return;
                        }
                }
 
-               Error("Could not open file '%s':\n",fileName);
+               Error( "Could not open file '%s':\n",fileName );
        }
 }
-