- if (creature == wolftype) {
- // FIXME: EXACT same code as above
- point = DoRotation(jointPos(leftfoot), 0, yaw, 0) * scale + coords;
- heightleft = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightleft;
- change = jointPos(leftankle) - jointPos(leftfoot);
- change2 = jointPos(leftknee) - jointPos(leftfoot);
- jointPos(leftfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0);
- jointPos(leftankle) = jointPos(leftfoot) + change;
- jointPos(leftknee) = (jointPos(leftfoot) + change2) / 2 + (jointPos(leftknee)) / 2;
-
- point = DoRotation(jointPos(rightfoot), 0, yaw, 0) * scale + coords;
- heightright = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightright;
- change = jointPos(rightankle) - jointPos(rightfoot);
- change2 = jointPos(rightknee) - jointPos(rightfoot);
- jointPos(rightfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0);
- jointPos(rightankle) = jointPos(rightfoot) + change;
- jointPos(rightknee) = (jointPos(rightfoot) + change2) / 2 + (jointPos(rightknee)) / 2;
-
- skeleton.DoConstraints(&coords, &scale);
- }
- }
- // subtle difference in this conditional: an extra '!' in the middle
- if (onterrain && ((isIdle() || isCrouch() || isLanding() || isLandhard() || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim) && !(wasIdle() || wasCrouch() || wasLanding() || wasLandhard() || animCurrent == drawrightanim || animCurrent == drawleftanim || animCurrent == crouchdrawrightanim)) && !skeleton.free) {
- XYZ point, newpoint, change, change2;
-
- point = DoRotation(jointPos(leftfoot), 0, yaw, 0) * scale + coords;
- heightleft = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightleft;
- change = jointPos(leftankle) - jointPos(leftfoot);
- change2 = jointPos(leftknee) - jointPos(leftfoot);
- // only change is the addition of:
- // * target + jointPos(leftfoot) * (1 - target);
- // looks like interpolation
- jointPos(leftfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * target + jointPos(leftfoot) * (1 - target);
- jointPos(leftankle) = jointPos(leftfoot) + change;
- jointPos(leftknee) = (jointPos(leftfoot) + change2) / 2 + (jointPos(leftknee)) / 2;
-
- point = DoRotation(jointPos(rightfoot), 0, yaw, 0) * scale + coords;
- heightright = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightright;
- change = jointPos(rightankle) - jointPos(rightfoot);
- change2 = jointPos(rightknee) - jointPos(rightfoot);
- // likewise:
- // * target + jointPos(rightfoot) * (1 - target);
- jointPos(rightfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * target + jointPos(rightfoot) * (1 - target);
- jointPos(rightankle) = jointPos(rightfoot) + change;
- jointPos(rightknee) = (jointPos(rightfoot) + change2) / 2 + (jointPos(rightknee)) / 2;
-
- skeleton.DoConstraints(&coords, &scale);
-
- if (creature == wolftype) {
- // once again, copied verbatim from above
- point = DoRotation(jointPos(leftfoot), 0, yaw, 0) * scale + coords;
- heightleft = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightleft;
- change = jointPos(leftankle) - jointPos(leftfoot);
- change2 = jointPos(leftknee) - jointPos(leftfoot);
- jointPos(leftfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * target + jointPos(leftfoot) * (1 - target);
- jointPos(leftankle) = jointPos(leftfoot) + change;
- jointPos(leftknee) = (jointPos(leftfoot) + change2) / 2 + (jointPos(leftknee)) / 2;
-
- point = DoRotation(jointPos(rightfoot), 0, yaw, 0) * scale + coords;
- heightright = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightright;
- change = jointPos(rightankle) - jointPos(rightfoot);
- change2 = jointPos(rightknee) - jointPos(rightfoot);
- jointPos(rightfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * target + jointPos(rightfoot) * (1 - target);
- jointPos(rightankle) = jointPos(rightfoot) + change;
- jointPos(rightknee) = (jointPos(rightfoot) + change2) / 2 + (jointPos(rightknee)) / 2;
-
- skeleton.DoConstraints(&coords, &scale);
- }
- }
-
- // this time, an extra '!' toward the beginning
- if (onterrain && (!(isIdle() || isCrouch() || isLanding() || isLandhard() || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim) && (wasIdle() || wasCrouch() || wasLanding() || wasLandhard() || animCurrent == drawrightanim || animCurrent == drawleftanim || animCurrent == crouchdrawrightanim)) && !skeleton.free) {
- XYZ point, newpoint, change, change2;
-
- point = DoRotation(jointPos(leftfoot), 0, yaw, 0) * scale + coords;
- heightleft = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightleft;
- change = jointPos(leftankle) - jointPos(leftfoot);
- change2 = jointPos(leftknee) - jointPos(leftfoot);
- // interpolation again, but reversed
- jointPos(leftfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * (1 - target) + jointPos(leftfoot) * target;
- jointPos(leftankle) = jointPos(leftfoot) + change;
- jointPos(leftknee) = (jointPos(leftfoot) + change2) / 2 + (jointPos(leftknee)) / 2;
-
- point = DoRotation(jointPos(rightfoot), 0, yaw, 0) * scale + coords;
- heightright = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightright;
- change = jointPos(rightankle) - jointPos(rightfoot);
- change2 = jointPos(rightknee) - jointPos(rightfoot);
- // interpolation again, but reversed
- jointPos(rightfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * (1 - target) + jointPos(rightfoot) * target;
- jointPos(rightankle) = jointPos(rightfoot) + change;
- jointPos(rightknee) = (jointPos(rightfoot) + change2) / 2 + (jointPos(rightknee)) / 2;
-
- skeleton.DoConstraints(&coords, &scale);
-
- if (creature == wolftype) {
- // still copied verbatim
- point = DoRotation(jointPos(leftfoot), 0, yaw, 0) * scale + coords;
- heightleft = terrain.getHeight(point.x, point.z) + .04;
- point.y = heightleft;
- change = jointPos(leftankle) - jointPos(leftfoot);
- change2 = jointPos(leftknee) - jointPos(leftfoot);
- jointPos(leftfoot) = DoRotation((point - coords) / scale, 0, -yaw, 0) * (1 - target) + jointPos(leftfoot) * target;
- jointPos(leftankle) = jointPos(leftfoot) + change;
- jointPos(leftknee) = (jointPos(leftfoot) + change2) / 2 + (jointPos(leftknee)) / 2;