- }
- }
-
- free = 0;
-}
-
-Skeleton::Skeleton()
-{
- num_joints = 0;
-
- num_muscles = 0;
-
- selected = 0;
-
- memset(forwardjoints, 0, sizeof(forwardjoints));
- // XYZ forward;
-
- id = 0;
-
- memset(lowforwardjoints, 0, sizeof(lowforwardjoints));
- // XYZ lowforward;
-
- // XYZ specialforward[5];
- memset(jointlabels, 0, sizeof(jointlabels));
-
- // Model model[7];
- // Model modellow;
- // Model modelclothes;
- num_models = 0;
-
- // Model drawmodel;
- // Model drawmodellow;
- // Model drawmodelclothes;
-
- clothes = 0;
- spinny = 0;
-
- memset(skinText, 0, sizeof(skinText));
- skinsize = 0;
-
- checkdelay = 0;
-
- longdead = 0;
- broken = 0;
-
- free = 0;
- oldfree = 0;
- freetime = 0;
- freefall = 0;
-
- joints = 0;
- muscles = 0;
-}
-
-Skeleton::~Skeleton()
-{
- if (muscles) {
- delete [] muscles;
- }
- muscles = 0;
-
- if (joints) {
- delete [] joints;
- }
- joints = 0;
-}
-
-#if 0
-
-// the following functions are not used anywhere
-
-/* EFFECT
- * sets forward, lowforward, specialforward[]
- *
- * USES:
- * NONE
- */
-void Skeleton::FindForwardsfirst()
-{
- //Find forward vectors
- CrossProduct(joints[forwardjoints[1]].position - joints[forwardjoints[0]].position, joints[forwardjoints[2]].position - joints[forwardjoints[0]].position, &forward);
- Normalise(&forward);
-
- CrossProduct(joints[lowforwardjoints[1]].position - joints[lowforwardjoints[0]].position, joints[lowforwardjoints[2]].position - joints[lowforwardjoints[0]].position, &lowforward);
- Normalise(&lowforward);
-
- //Special forwards
- specialforward[0] = forward;
- specialforward[1] = forward;
- specialforward[2] = forward;
- specialforward[3] = forward;
- specialforward[4] = forward;
-
-}
-
-/* EFFECT
- *
- * USES:
- * NONE
- */
-void Skeleton::Draw(int muscleview)
-{
- static float jointcolor[4];
-
- if (muscleview == 2) {
- jointcolor[0] = 0;
- jointcolor[1] = 0;
- jointcolor[2] = 0;
- jointcolor[3] = .5;
- } else {
- jointcolor[0] = 0;
- jointcolor[1] = 0;
- jointcolor[2] = .5;
- jointcolor[3] = 1;
- }
-
- //Calc motionblur-ness
- for (int i = 0; i < num_joints; i++) {
- joints[i].oldposition = joints[i].position;
- joints[i].blurred = findDistance(&joints[i].position, &joints[i].oldposition) * 100;
- if (joints[i].blurred < 1)
- joints[i].blurred = 1;
- }
-
- //Do Motionblur
- glDepthMask(0);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glBegin(GL_QUADS);
- for (int i = 0; i < num_joints; i++) {
- if (joints[i].hasparent) {
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].blurred);
- glVertex3f(joints[i].position.x, joints[i].position.y, joints[i].position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].parent->blurred);
- glVertex3f(joints[i].parent->position.x, joints[i].parent->position.y, joints[i].parent->position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].parent->blurred);
- glVertex3f(joints[i].parent->oldposition.x, joints[i].parent->oldposition.y, joints[i].parent->oldposition.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].blurred);
- glVertex3f(joints[i].oldposition.x, joints[i].oldposition.y, joints[i].oldposition.z);
- }
- }
- for (int i = 0; i < num_muscles; i++) {
- if (muscles[i].type == boneconnect) {
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent2->blurred);
- glVertex3f(muscles[i].parent1->position.x, muscles[i].parent1->position.y, muscles[i].parent1->position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent2->blurred);
- glVertex3f(muscles[i].parent2->position.x, muscles[i].parent2->position.y, muscles[i].parent2->position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent2->blurred);
- glVertex3f(muscles[i].parent2->oldposition.x, muscles[i].parent2->oldposition.y, muscles[i].parent2->oldposition.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent1->blurred);
- glVertex3f(muscles[i].parent1->oldposition.x, muscles[i].parent1->oldposition.y, muscles[i].parent1->oldposition.z);
- }
- }
- glEnd();
-
- glBegin(GL_LINES);
- for (int i = 0; i < num_joints; i++) {
- if (joints[i].hasparent) {
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].blurred);
- glVertex3f(joints[i].position.x, joints[i].position.y, joints[i].position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / joints[i].parent->blurred);
- glVertex3f(joints[i].parent->position.x, joints[i].parent->position.y, joints[i].parent->position.z);
- }
- }
- for (int i = 0; i < num_muscles; i++) {
- if (muscles[i].type == boneconnect) {
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent1->blurred);
- glVertex3f(muscles[i].parent1->position.x, muscles[i].parent1->position.y, muscles[i].parent1->position.z);
- glColor4f(jointcolor[0], jointcolor[1], jointcolor[2], jointcolor[3] / muscles[i].parent2->blurred);
- glVertex3f(muscles[i].parent2->position.x, muscles[i].parent2->position.y, muscles[i].parent2->position.z);
- }
- }
- glColor3f(.6, .6, 0);
- if (muscleview == 1)
- for (int i = 0; i < num_muscles; i++) {
- if (muscles[i].type != boneconnect) {
- glVertex3f(muscles[i].parent1->position.x, muscles[i].parent1->position.y, muscles[i].parent1->position.z);
- glVertex3f(muscles[i].parent2->position.x, muscles[i].parent2->position.y, muscles[i].parent2->position.z);