if (whichtri != -1) {
// low level geometry math
p0 = colpoint;
- p1 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[whichtri].vertex[0]];
- p2 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[whichtri].vertex[1]];
- p3 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[whichtri].vertex[2]];
+ p1 = skeleton.drawmodel.getTriangleVertex(whichtri, 0);
+ p2 = skeleton.drawmodel.getTriangleVertex(whichtri, 1);
+ p3 = skeleton.drawmodel.getTriangleVertex(whichtri, 2);
bary.x = distsq(&p0, &p1);
bary.y = distsq(&p0, &p2);
void Person::RagDoll(bool checkcollision)
{
static XYZ change;
- static int l, i;
+ static int i;
static float speed;
if (!skeleton.free) {
if (id == 0)
whichpatchx = coords.x / (terrain.size / subdivision * terrain.scale);
whichpatchz = coords.z / (terrain.size / subdivision * terrain.scale);
- if (terrain.patchobjectnum[whichpatchx][whichpatchz])
- for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- i = terrain.patchobjects[whichpatchx][whichpatchz][l];
- lowpoint = coords;
- lowpoint.y += 1;
- if (SphereCheck(&lowpoint, 3, &colpoint, &Object::objects[i]->position, &Object::objects[i]->yaw, &Object::objects[i]->model) != -1) {
- coords.x = lowpoint.x;
- coords.z = lowpoint.z;
- }
+ for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
+ i = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ lowpoint = coords;
+ lowpoint.y += 1;
+ if (SphereCheck(&lowpoint, 3, &colpoint, &Object::objects[i]->position, &Object::objects[i]->yaw, &Object::objects[i]->model) != -1) {
+ coords.x = lowpoint.x;
+ coords.z = lowpoint.z;
}
+ }
}
yaw = 0;
oldframeCurrent = frameCurrent;
for (unsigned i = 0; i < skeleton.joints.size(); i++) {
- skeleton.joints[i].velocity = (currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * (target) - skeleton.joints[i].position) / multiplier;
- skeleton.joints[i].position = currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * (target);
+ skeleton.joints[i].velocity = (currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * target - skeleton.joints[i].position) / multiplier;
+ skeleton.joints[i].position = currentFrame().joints[i].position * (1 - target) + targetFrame().joints[i].position * target;
}
offset = currentoffset * (1 - target) + targetoffset * target;
for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible) {
- skeleton.muscles[i].rotate1 = skeleton.muscles[i].oldrotate1 * (1 - target) + skeleton.muscles[i].newrotate1 * (target);
- skeleton.muscles[i].rotate2 = skeleton.muscles[i].oldrotate2 * (1 - target) + skeleton.muscles[i].newrotate2 * (target);
- skeleton.muscles[i].rotate3 = skeleton.muscles[i].oldrotate3 * (1 - target) + skeleton.muscles[i].newrotate3 * (target);
+ skeleton.muscles[i].rotate1 = skeleton.muscles[i].oldrotate1 * (1 - target) + skeleton.muscles[i].newrotate1 * target;
+ skeleton.muscles[i].rotate2 = skeleton.muscles[i].oldrotate2 * (1 - target) + skeleton.muscles[i].newrotate2 * target;
+ skeleton.muscles[i].rotate3 = skeleton.muscles[i].oldrotate3 * (1 - target) + skeleton.muscles[i].newrotate3 * target;
}
}
}
static XYZ flatfacing;
static XYZ flatvelocity;
static float flatvelspeed;
- static int l;
static int bloodsize;
static int startx, starty, endx, endy;
static GLubyte color;
headpoint = coords;
if (bloodtoggle && !bled) {
terrain.MakeDecal(blooddecalslow, headpoint, .8, .5, 0);
- }
- if (bloodtoggle && !bled)
- for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
+ unsigned int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
float size = .8;
float opacity = .6;
float yaw = 0;
Object::objects[j]->model.MakeDecal(blooddecalslow, &point, &size, &opacity, &yaw);
}
+ }
bled = 1;
}
DoBlood(1, 255);
if (bloodtoggle && !bled) {
terrain.MakeDecal(blooddecal, headpoint, .2 * 1.2, .5, 0);
- }
- if (bloodtoggle && !bled)
- for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
+ unsigned int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
float size = .2 * 1.2;
float opacity = .6;
float yaw = 0;
Object::objects[j]->model.MakeDecal(blooddecal, &point, &size, &opacity, &yaw);
}
+ }
bled = 1;
}
if (dead == 2 && bloodloss >= damagetolerance) {
DoBlood(1, 255);
if (bloodtoggle && !bled) {
terrain.MakeDecal(blooddecalslow, headpoint, .8, .5, 0);
- }
- if (bloodtoggle && !bled)
- for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
+ unsigned int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - Object::objects[j]->position, 0, -Object::objects[j]->yaw, 0);
float size = .8;
float opacity = .6;
float yaw = 0;
Object::objects[j]->model.MakeDecal(blooddecalslow, &point, &size, &opacity, &yaw);
}
+ }
bled = 1;
}
}
if (playerdetail) {
for (unsigned int i = 0; i < skeleton.drawmodel.Triangles.size(); i++) {
- XYZ &v0 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[0]];
- XYZ &v1 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[1]];
- XYZ &v2 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[2]];
+ const XYZ &v0 = skeleton.drawmodel.getTriangleVertex(i, 0);
+ const XYZ &v1 = skeleton.drawmodel.getTriangleVertex(i, 1);
+ const XYZ &v2 = skeleton.drawmodel.getTriangleVertex(i, 2);
glVertex3f(v0.x, v0.y, v0.z);
glVertex3f(v1.x, v1.y, v1.z);
glVertex3f(v1.x, v1.y, v1.z);