| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef JOINTS_H |
| 23 |
#define JOINTS_H |
| 24 |
|
| 25 |
#include "globaldefs.h" |
| 26 |
|
| 27 |
#ifdef _HERETIC2_ |
| 28 |
#include "angles.h" |
| 29 |
#endif |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
#if !GDEF_OS_WINDOWS |
| 35 |
#define stricmp strcasecmp |
| 36 |
#define strcmpi strcasecmp |
| 37 |
#endif |
| 38 |
|
| 39 |
typedef struct Placement_s |
| 40 |
{ |
| 41 |
vec3_t origin; |
| 42 |
vec3_t direction; |
| 43 |
vec3_t up; |
| 44 |
} Placement_t; |
| 45 |
|
| 46 |
#if 1 |
| 47 |
typedef struct QDataJoint_s |
| 48 |
{ |
| 49 |
Placement_t placement; |
| 50 |
vec3_t rotation; |
| 51 |
} QDataJoint_t; |
| 52 |
#endif |
| 53 |
|
| 54 |
typedef struct ArrayedListNode_s |
| 55 |
{ |
| 56 |
int data; |
| 57 |
int next; |
| 58 |
int inUse; |
| 59 |
} ArrayedListNode_t; |
| 60 |
|
| 61 |
#define ARRAYEDLISTNODE_NULL -1 |
| 62 |
|
| 63 |
typedef struct JointAngles_s |
| 64 |
{ |
| 65 |
float angles[3]; |
| 66 |
int children; |
| 67 |
int created; |
| 68 |
} JointAngles_t; |
| 69 |
|
| 70 |
typedef struct JointAngles2_s |
| 71 |
{ |
| 72 |
float angles[3]; |
| 73 |
int children; |
| 74 |
int changed[3]; |
| 75 |
int inUse; |
| 76 |
} JointAngles2_t; |
| 77 |
|
| 78 |
#define MAX_MODELJOINTS 256 |
| 79 |
#define MAX_MODELJOINTNODES 255 |
| 80 |
|
| 81 |
extern JointAngles_t jointAngles[MAX_MODELJOINTS]; |
| 82 |
extern JointAngles2_t jointAngles2[MAX_MODELJOINTS]; |
| 83 |
|
| 84 |
extern ArrayedListNode_t jointAngleNodes[MAX_MODELJOINTNODES]; |
| 85 |
|
| 86 |
|
| 87 |
enum { |
| 88 |
SKEL_RAVEN = 0, |
| 89 |
SKEL_BOX, |
| 90 |
NUM_SKELETONS |
| 91 |
}; |
| 92 |
|
| 93 |
|
| 94 |
enum { |
| 95 |
RAVEN_WAIST1 = 0, |
| 96 |
RAVEN_WAIST2 = 1, |
| 97 |
RAVEN_HEAD = 2, |
| 98 |
NUM_JOINTS_RAVEN |
| 99 |
}; |
| 100 |
|
| 101 |
|
| 102 |
enum { |
| 103 |
BOX_CENTER = 0, |
| 104 |
NUM_JOINTS_BOX |
| 105 |
}; |
| 106 |
|
| 107 |
extern int numJointsForSkeleton[]; |
| 108 |
extern char *RAVEN_SKEL_NAMES[]; |
| 109 |
|
| 110 |
#define J_NEW_SKELETON 0x00001000 |
| 111 |
#define J_YAW_CHANGED 0x00002000 |
| 112 |
#define J_PITCH_CHANGED 0x00004000 |
| 113 |
#define J_ROLL_CHANGED 0x00008000 |
| 114 |
#define MAX_JOINTS 0x00000fff |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
int CreateSkeleton( int structure ); |
| 139 |
void CreateSkeletonAtIndex( int structure, int index ); |
| 140 |
void FreeSkeleton( int structure, int index ); |
| 141 |
void SetJointAngle( int jointIndex, int angleIndex, float angle ); |
| 142 |
float ModifyJointAngle( int jointIndex, int angleIndex, float deltaAngle ); |
| 143 |
int ZeroJointAngle( int jointIndex, int angleIndex, float angVel ); |
| 144 |
int ApplyAngVelToJoint( int jointIndex, int angleIndex, float angVel, float destAng ); |
| 145 |
|
| 146 |
#endif |