XYZ bounceness;
const int numrepeats = 3;
float groundlevel = .15;
- int i, j, k, m;
+ int k, m;
+ unsigned i;
XYZ temp;
XYZ terrainnormal;
int whichhit;
float tempmult = multiplier;
//multiplier/=numrepeats;
- for (j = 0; j < numrepeats; j++) {
+ for (int j = 0; j < numrepeats; j++) {
float r = .05;
// right leg constraints?
if (!joint(rightknee).locked && !joint(righthip).locked) {
joints[i].locked = 0;
if (joints[i].delay > 0) {
bool freely = true;
- for (j = 0; j < joints.size(); j++) {
+ for (unsigned j = 0; j < joints.size(); j++) {
if (joints[j].locked)
freely = false;
}
whichhit = objects.model[k].LineCheckSlidePossible(&start, &end, &temp, &objects.position[k], &objects.yaw[k]);
if (whichhit != -1) {
joints[jointlabels[whichjointendarray[i]]].position = (end - *coords) / (*scale);
- for (j = 0; j < muscles.size(); j++) {
+ for (unsigned j = 0; j < muscles.size(); j++) {
if ((muscles[j].parent1->label == whichjointstartarray[i] && muscles[j].parent2->label == whichjointendarray[i]) || (muscles[j].parent2->label == whichjointstartarray[i] && muscles[j].parent1->label == whichjointendarray[i]))
muscles[j].DoConstraint(spinny);
}
*/
void Skeleton::DoGravity(float *scale)
{
- static int i;
- for (i = 0; i < joints.size(); i++) {
+ for (unsigned i = 0; i < joints.size(); i++) {
if (
(
((joints[i].label != leftknee) && (joints[i].label != rightknee)) ||
((joints[i].label != leftelbow) && (joints[i].label != rightelbow)) ||
(forward.y < .3)
)
- )
+ ) {
joints[i].velocity.y += gravity * multiplier / (*scale);
+ }
}
}
GLfloat M[16];
FILE *tfile;
float lSize;
- int i, j, num_joints, num_muscles;
+ int j, num_joints, num_muscles;
LOGFUNC;
model[5].loadnotex(model6filename);
model[6].loadnotex(model7filename);
- for (i = 0; i < num_models; i++) {
+ for (int i = 0; i < num_models; i++) {
model[i].Rotate(180, 0, 0);
model[i].Scale(.04, .04, .04);
model[i].CalculateNormals(0);
joints.resize(num_joints);
// read info for each joint
- for (i = 0; i < num_joints; i++) {
+ for (int i = 0; i < num_joints; i++) {
joints[i].load(tfile, joints);
}
muscles.resize(num_muscles);
// for each muscle...
- for (i = 0; i < num_muscles; i++) {
+ for (int i = 0; i < num_muscles; i++) {
muscles[i].load(tfile, model[0].vertexNum, joints);
}
// ???
for (j = 0; j < num_muscles; j++) {
- for (i = 0; i < muscles[j].vertices.size(); i++) {
+ for (unsigned i = 0; i < muscles[j].vertices.size(); i++) {
for (int k = 0; k < num_models; k++) {
- if (muscles[j].vertices[i] < model[k].vertexNum)
+ if (muscles[j].vertices[i] < model[k].vertexNum) {
model[k].owner[muscles[j].vertices[i]] = j;
+ }
}
}
}
// calculate some stuff
FindForwards();
- for (i = 0; i < num_muscles; i++) {
+ for (int i = 0; i < num_muscles; i++) {
FindRotationMuscle(i, -1);
}
// this seems to use opengl purely for matrix calculations
for (int k = 0; k < num_models; k++) {
- for (i = 0; i < model[k].vertexNum; i++) {
+ for (int i = 0; i < model[k].vertexNum; i++) {
model[k].vertex[i] = model[k].vertex[i] - (muscles[model[k].owner[i]].parent1->position + muscles[model[k].owner[i]].parent2->position) / 2;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// skip joints section
fseek(tfile, sizeof(num_joints), SEEK_CUR);
- for (i = 0; i < num_joints; i++) {
+ for (int i = 0; i < num_joints; i++) {
// skip joint info
lSize = sizeof(XYZ)
+ sizeof(float)
// skip num_muscles
fseek(tfile, sizeof(num_muscles), SEEK_CUR);
- for (i = 0; i < num_muscles; i++) {
+ for (int i = 0; i < num_muscles; i++) {
// skip muscle info
lSize = sizeof(float)
+ sizeof(float)
}
for (j = 0; j < num_muscles; j++) {
- for (i = 0; i < muscles[j].verticeslow.size(); i++) {
- if (muscles[j].verticeslow[i] < modellow.vertexNum)
+ for (unsigned i = 0; i < muscles[j].verticeslow.size(); i++) {
+ if (muscles[j].verticeslow[i] < modellow.vertexNum) {
modellow.owner[muscles[j].verticeslow[i]] = j;
+ }
}
}
// use opengl for its matrix math
- for (i = 0; i < modellow.vertexNum; i++) {
+ for (int i = 0; i < modellow.vertexNum; i++) {
modellow.vertex[i] = modellow.vertex[i] - (muscles[modellow.owner[i]].parent1->position + muscles[modellow.owner[i]].parent2->position) / 2;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// skip num_joints
fseek(tfile, sizeof(num_joints), SEEK_CUR);
- for (i = 0; i < num_joints; i++) {
+ for (int i = 0; i < num_joints; i++) {
// skip joint info
lSize = sizeof(XYZ)
+ sizeof(float)
// skip num_muscles
fseek(tfile, sizeof(num_muscles), SEEK_CUR);
- for (i = 0; i < num_muscles; i++) {
+ for (int i = 0; i < num_muscles; i++) {
// skip muscle info
lSize = sizeof(float)
+ sizeof(float)
// ???
lSize = sizeof(int);
for (j = 0; j < num_muscles; j++) {
- for (i = 0; i < muscles[j].verticesclothes.size(); i++) {
- if (muscles[j].verticesclothes.size() && muscles[j].verticesclothes[i] < modelclothes.vertexNum)
+ for (unsigned i = 0; i < muscles[j].verticesclothes.size(); i++) {
+ if (muscles[j].verticesclothes.size() && muscles[j].verticesclothes[i] < modelclothes.vertexNum) {
modelclothes.owner[muscles[j].verticesclothes[i]] = j;
+ }
}
}
// use opengl for its matrix math
- for (i = 0; i < modelclothes.vertexNum; i++) {
+ for (int i = 0; i < modelclothes.vertexNum; i++) {
modelclothes.vertex[i] = modelclothes.vertex[i] - (muscles[modelclothes.owner[i]].parent1->position + muscles[modelclothes.owner[i]].parent2->position) / 2;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
}
fclose(tfile);
- for (i = 0; i < num_joints; i++) {
+ for (int i = 0; i < num_joints; i++) {
for (j = 0; j < num_joints; j++) {
if (joints[i].label == j)
jointlabels[j] = i;
numhotspots = 0;
}
Hotspot::hotspots.resize(numhotspots);
- for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
funpackf(tfile, "Bi Bf Bf Bf Bf", &Hotspot::hotspots[i].type, &Hotspot::hotspots[i].size, &Hotspot::hotspots[i].position.x, &Hotspot::hotspots[i].position.y, &Hotspot::hotspots[i].position.z);
funpackf(tfile, "Bi", &templength);
if (templength)
emit_sound_at(fireendsound, Person::players[1]->coords);
- for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
if (Random() % 2 == 0) {
if (!Person::players[1]->skeleton.free)
temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2;
XYZ temp, temp2;
emit_sound_at(fireendsound, Person::players[1]->coords);
- for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
if (Random() % 2 == 0) {
if (!Person::players[1]->skeleton.free)
temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2;
bodyprop = Person::players[closest]->proportionbody.x / 1.1;
armprop = Person::players[closest]->proportionarms.x / 1.1;
legprop = Person::players[closest]->proportionlegs.x / 1.1;
- }
-
- if (Person::players[closest]->creature == rabbittype) {
+ } else {
+ // rabbittype
headprop = Person::players[closest]->proportionhead.x / 1.2;
bodyprop = Person::players[closest]->proportionbody.x / 1.05;
armprop = Person::players[closest]->proportionarms.x / 1.00;
XYZ headspurtdirection;
//int i = Person::players[closest]->skeleton.jointlabels[head];
Joint& headjoint = Person::players[closest]->joint(head);
- for (int k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) {
+ for (unsigned k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) {
if (!Person::players[closest]->skeleton.free)
flatvelocity2 = Person::players[closest]->velocity;
if (Person::players[closest]->skeleton.free)
emit_sound_at(splattersound, blah);
emit_sound_at(breaksound2, blah);
- for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
if (!Person::players[closest]->skeleton.free)
flatvelocity2 = Person::players[closest]->velocity;
if (Person::players[closest]->skeleton.free)
Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5);
}
- for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
if (!Person::players[closest]->skeleton.free)
flatvelocity2 = Person::players[closest]->velocity;
if (Person::players[closest]->skeleton.free)
Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .4, 1);
}
- for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
if (!Person::players[closest]->skeleton.free)
flatvelocity2 = Person::players[closest]->velocity;
if (Person::players[closest]->skeleton.free)
Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1);
}
- for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
if (!Person::players[closest]->skeleton.free)
flatvelocity2 = Person::players[closest]->velocity;
if (Person::players[closest]->skeleton.free)
Person::players[j]->skeleton.free = 1;
Person::players[j]->skeleton.longdead = 0;
Person::players[j]->RagDoll(0);
- for (int i = 0; i < Person::players[j]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[j]->skeleton.joints.size(); i++) {
temppos = Person::players[j]->skeleton.joints[i].position + Person::players[j]->coords;
if (distsq(&temppos, &Person::players[closest]->coords) < 25) {
flatvelocity2 = temppos - Person::players[closest]->coords;
bodyprop = Person::players[0]->proportionbody.x / 1.1;
armprop = Person::players[0]->proportionarms.x / 1.1;
legprop = Person::players[0]->proportionlegs.x / 1.1;
- }
-
- if (Person::players[0]->creature == rabbittype) {
+ } else {
+ // rabbittype
headprop = Person::players[0]->proportionhead.x / 1.2;
bodyprop = Person::players[0]->proportionbody.x / 1.05;
armprop = Person::players[0]->proportionarms.x / 1.00;
}
Person::players[k]->DoDamage(findLengthfast(&rotatetarget) / 4);
- for (int j = 0; j < Person::players[i]->skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < Person::players[i]->skeleton.joints.size(); j++) {
Person::players[i]->skeleton.joints[j].velocity = Person::players[i]->skeleton.joints[j].velocity / 5 + Person::players[k]->velocity;
}
- for (int j = 0; j < Person::players[k]->skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < Person::players[k]->skeleton.joints.size(); j++) {
Person::players[k]->skeleton.joints[j].velocity = Person::players[k]->skeleton.joints[j].velocity / 5 + Person::players[i]->velocity;
}
XYZ colpoint;
closest = -1;
closestdistance = -1;
- for (int j = 0; j < numpathpoints; j++)
+ for (int j = 0; j < numpathpoints; j++) {
if (closest == -1 || distsq(&Person::players[i]->finalfinaltarget, &pathpoint[j]) < closestdistance) {
closestdistance = distsq(&Person::players[i]->finalfinaltarget, &pathpoint[j]);
closest = j;
Person::players[i]->finaltarget = pathpoint[j];
}
+ }
Person::players[i]->finalpathfindpoint = closest;
- for (int j = 0; j < numpathpoints; j++)
+ for (int j = 0; j < numpathpoints; j++) {
for (int k = 0; k < numpathpointconnect[j]; k++) {
- DistancePointLine(&Person::players[i]->finalfinaltarget, &pathpoint[j], &pathpoint[pathpointconnect[j][k]], &tempdist, &colpoint );
+ DistancePointLine(&Person::players[i]->finalfinaltarget, &pathpoint[j], &pathpoint[pathpointconnect[j][k]], &tempdist, &colpoint);
if (sq(tempdist) < closestdistance)
if (findDistance(&colpoint, &pathpoint[j]) + findDistance(&colpoint, &pathpoint[pathpointconnect[j][k]]) <
findDistance(&pathpoint[j], &pathpoint[pathpointconnect[j][k]]) + .1) {
Person::players[i]->finaltarget = colpoint;
}
}
+ }
Person::players[i]->finalpathfindpoint = closest;
}
talkdelay -= multiplier;
if (talkdelay <= 0 && !Dialog::inDialog() && Animation::animations[Person::players[0]->animTarget].height != highheight) {
- for (int i = 0; i < Dialog::dialogs.size(); i++) {
+ for (unsigned i = 0; i < Dialog::dialogs.size(); i++) {
Dialog::dialogs[i].tick(i);
}
}
static float hotspotvisual[40];
if (Hotspot::hotspots.size()) {
XYZ hotspotsprite;
- if (editorenabled)
- for (int i = 0; i < Hotspot::hotspots.size(); i++)
+ if (editorenabled) {
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
hotspotvisual[i] -= multiplier / 320;
+ }
+ }
- for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
while (hotspotvisual[i] < 0) {
hotspotsprite = 0;
hotspotsprite.x = float(abs(Random() % 100000)) / 100000 * Hotspot::hotspots[i].size;
}
}
- for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
if (Hotspot::hotspots[i].type <= 10 && Hotspot::hotspots[i].type > 0) {
Hotspot::hotspots[i].position = Person::players[Hotspot::hotspots[i].type]->coords;
}
Dialog::currentScene().camerayaw = yaw;
Dialog::currentScene().camerapitch = pitch;
Dialog::indialogue++;
- if (Dialog::indialogue < Dialog::currentDialog().scenes.size()) {
+ if (Dialog::indialogue < int(Dialog::currentDialog().scenes.size())) {
if (Dialog::currentScene().sound != 0) {
playdialoguescenesound();
}
if (Input::isKeyDown(SDL_SCANCODE_KP_0)) whichend = 0;
Dialog::currentScene().participantfacing[whichend] = facing;
}
- if (Dialog::indialogue >= Dialog::currentDialog().scenes.size()) {
+ if (Dialog::indialogue >= int(Dialog::currentDialog().scenes.size())) {
Dialog::indialogue = -1;
Dialog::directing = false;
cameramode = 0;
if (Dialog::dialoguetime > 0.5) {
if (Input::isKeyPressed(attackkey)) {
Dialog::indialogue++;
- if (Dialog::indialogue < Dialog::currentDialog().scenes.size()) {
+ if (Dialog::indialogue < int(Dialog::currentDialog().scenes.size())) {
if (Dialog::currentScene().sound != 0) {
playdialoguescenesound();
if (Dialog::currentScene().sound == -5) {
}
}
}
- if (Dialog::indialogue >= Dialog::currentDialog().scenes.size()) {
+ if (Dialog::indialogue >= int(Dialog::currentDialog().scenes.size())) {
Dialog::indialogue = -1;
Dialog::directing = false;
cameramode = 0;
Person::players[i]->victim->skeleton.free = 1;
Person::players[i]->victim->skeleton.broken = 0;
- for (int l = 0; l < Person::players[i]->victim->skeleton.joints.size(); l++) {
+ for (unsigned l = 0; l < Person::players[i]->victim->skeleton.joints.size(); l++) {
Person::players[i]->victim->skeleton.joints[l].velchange = 0;
Person::players[i]->victim->skeleton.joints[l].locked = 0;
}
if (distsq(&temp, &Person::players[1]->coords) >= distsq(&temp, &temp2) - 1 || distsq(&temp3, &Person::players[1]->coords) < 4) {
emit_sound_at(fireendsound, Person::players[1]->coords);
- for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
if (Random() % 2 == 0) {
if (!Person::players[1]->skeleton.free)
temp2 = (Person::players[1]->coords - Person::players[1]->oldcoords) / multiplier / 2; //velocity/2;
}
Person::players[1]->coords = (oldtemp + oldtemp2) / 2;
- for (int i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[1]->skeleton.joints.size(); i++) {
Person::players[1]->skeleton.joints[i].velocity = 0;
if (Random() % 2 == 0) {
if (!Person::players[1]->skeleton.free)
}
Hotspot::killhotspot = 2;
- for (int i = 0; i < Hotspot::hotspots.size(); i++) {
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
if (Hotspot::hotspots[i].type > 10 && Hotspot::hotspots[i].type < 20) {
if (Person::players[Hotspot::hotspots[i].type - 10]->dead == 0)
Hotspot::killhotspot = 0;
winhotspot = false;
- for (int i = 0; i < Hotspot::hotspots.size(); i++)
- if (Hotspot::hotspots[i].type == -1)
- if (distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position) < Hotspot::hotspots[i].size)
+ for (unsigned i = 0; i < Hotspot::hotspots.size(); i++) {
+ if (Hotspot::hotspots[i].type == -1) {
+ if (distsq(&Person::players[0]->coords, &Hotspot::hotspots[i].position) < Hotspot::hotspots[i].size) {
winhotspot = true;
+ }
+ }
+ }
int numalarmed = 0;
- for (unsigned i = 1; i < Person::players.size(); i++)
- if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0)
+ for (unsigned i = 1; i < Person::players.size(); i++) {
+ if (!Person::players[i]->dead && Person::players[i]->aitype == attacktypecutoff && Person::players[i]->surprised <= 0) {
numalarmed++;
- if (numalarmed > maxalarmed)
+ }
+ }
+ if (numalarmed > maxalarmed) {
maxalarmed = numalarmed;
+ }
if (changedelay <= 0 && !loading && !editorenabled && gameon && !tutoriallevel && changedelay != -999 && !won) {
if (Person::players[0]->dead && changedelay <= 0) {
target = Person::players[0]->oldcoords + Person::players[0]->currentoffset * (1 - Person::players[0]->target) * Person::players[0]->scale + Person::players[0]->targetoffset * Person::players[0]->target * Person::players[0]->scale - Person::players[0]->facing * .05;
target.y += .1;
if (Person::players[0]->skeleton.free) {
- for (int i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
if (Person::players[0]->skeleton.joints[i].position.y * Person::players[0]->scale + Person::players[0]->coords.y > target.y)
target.y = Person::players[0]->skeleton.joints[i].position.y * Person::players[0]->scale + Person::players[0]->coords.y;
}
if (tutoriallevel != 1)
emit_sound_at(heavyimpactsound, victim->coords);
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * 120 * damagemult;
}
victim->Puff(neck);
if (howmuch > damagetolerance * 50 && skeleton.free != 2) {
XYZ flatvelocity2;
XYZ flatfacing2;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
if (skeleton.free) {
flatvelocity2 = skeleton.joints[i].velocity;
flatfacing2 = skeleton.joints[i].position * scale + coords;
skeleton.specialforward[0] = facing;
//skeleton.specialforward[0]=DoRotation(facing,0,yaw,0);
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible && (skeleton.muscles[i].parent1->label == head || skeleton.muscles[i].parent2->label == head)) {
skeleton.FindRotationMuscle(i, animTarget);
}
void Person::RagDoll(bool checkcollision)
{
static XYZ change;
- static int l, i, j;
+ static int l, i;
static float speed;
if (!skeleton.free) {
if (id == 0)
if (!isnormal(tilt)) tilt = 0;
if (!isnormal(tilt2)) tilt2 = 0;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].delay = 0;
skeleton.joints[i].locked = 0;
skeleton.joints[i].position = DoRotation(DoRotation(DoRotation(skeleton.joints[i].position, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0);
skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords;
}
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].velocity = 0;
skeleton.joints[i].velchange = 0;
}
speed *= speedmult;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
if ((Animation::animations[animCurrent].attack != reversed || animCurrent == swordslashreversedanim) && animCurrent != rabbitkickanim && !isLanding() && !wasLanding() && Animation::animations[animCurrent].height == Animation::animations[animTarget].height)
skeleton.joints[i].velocity = velocity / scale + facing * 5 + DoRotation(DoRotation(DoRotation((targetFrame().joints[i].position - currentFrame().joints[i].position) * speed, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0);
else
int howmany;
average = 0;
howmany = 0;
- for (j = 0; j < skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < skeleton.joints.size(); j++) {
average += skeleton.joints[j].position;
howmany++;
}
average /= howmany;
coords += average * scale;
- for (j = 0; j < skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < skeleton.joints.size(); j++) {
skeleton.joints[j].position -= average;
}
updatedelay = 0;
velocity = 0;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
velocity += skeleton.joints[i].velocity * scale;
}
velocity /= skeleton.joints.size();
//Footstep sounds
if (tutoriallevel != 1 || id == 0)
if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) {
- int whichsound;
+ int whichsound = -1;
if (onterrain) {
if (terrain.getOpacity(coords.x, coords.z) < .2) {
if (targetFrame().label == 1)
if (r == 2)
whichsound = highwhooshsound;
}
- if (Animation::animations[animTarget].attack == neutral)
+ if (Animation::animations[animTarget].attack == neutral) {
whichsound = movewhooshsound;
- } else if (targetFrame().label == 4)
+ }
+ } else if (targetFrame().label == 4) {
whichsound = knifeswishsound;
- if (targetFrame().label == 8 && tutoriallevel != 1)
+ }
+ if (targetFrame().label == 8 && tutoriallevel != 1) {
whichsound = landsound2;
+ }
- emit_sound_at(whichsound, coords, 256.);
+ if (whichsound != -1) {
+ emit_sound_at(whichsound, coords, 256.);
- if (id == 0)
- if (whichsound == footstepsound || whichsound == footstepsound2 || whichsound == footstepsound3 || whichsound == footstepsound4) {
- if (animTarget == wolfrunninganim || animTarget == rabbitrunninganim) {
- addEnvSound(coords, 15);
- } else {
- addEnvSound(coords, 6);
+ if (id == 0) {
+ if (whichsound == footstepsound || whichsound == footstepsound2 || whichsound == footstepsound3 || whichsound == footstepsound4) {
+ if (animTarget == wolfrunninganim || animTarget == rabbitrunninganim) {
+ addEnvSound(coords, 15);
+ } else {
+ addEnvSound(coords, 6);
+ }
}
}
- if (targetFrame().label == 3) {
- whichsound--;
- emit_sound_at(whichsound, coords, 128.);
+ if (targetFrame().label == 3) {
+ whichsound--;
+ emit_sound_at(whichsound, coords, 128.);
+ }
}
}
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (int j = 0; j < victim->skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < victim->skeleton.joints.size(); j++) {
victim->skeleton.joints[j].velchange = 0;
victim->skeleton.joints[j].locked = 0;
}
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative.y -= 1;
Normalise(&relative);
relative = DoRotation(relative, 0, 90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 100;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, 90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(head) += relative * damagemult * 100;
victim->skeleton.broken = 0;
victim->skeleton.spinny = 1;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].delay = 0;
victim->skeleton.joints[i].locked = 0;
relative = 0;
relative.y = 1;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity.y = relative.y * 10;
victim->skeleton.joints[i].position.y += relative.y * .3;
victim->skeleton.joints[i].oldposition.y += relative.y * .3;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 90;
}
victim->Puff(abdomen);
victim->skeleton.broken = 0;
victim->skeleton.spinny = 1;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velchange = 0;
//victim->skeleton.joints[i].delay=0;
victim->skeleton.joints[i].locked = 0;
Normalise(&relative);
relative.y += .3;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
if (!victim->dead)
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
relative = victim->coords - coords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = relative * 30;
}
victim->jointVel(head) += relative * damagemult * 150;
Normalise(&relative);
relative.y = .3;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = relative * 5;
}
victim->jointVel(abdomen) += relative * damagemult * 400;
relative = DoRotation(relative, 0, 90, 0);
relative.y -= 1;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 60;
}
victim->jointVel(head) += relative * damagemult * 230;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 220;
victim->skeleton.free = 1;
victim->skeleton.broken = 0;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velchange = 0;
victim->skeleton.joints[i].locked = 0;
//victim->skeleton.joints[i].velocity=0;
relative.y = -1;
Normalise(&relative);
if (!victim->dead) {
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = relative * damagemult * 40;
}
victim->jointVel(abdomen) += relative * damagemult * 40;
}
if (victim->dead) {
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = relative * damagemult * abs(Random() % 20);
}
}
DoBlood(.2, 250);
}
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(head) += relative * damagemult * 200;
} else {
if (victim->damage >= victim->damagetolerance)
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
if (Animation::animations[victim->animTarget].height == middleheight || Animation::animations[victim->animCurrent].height == middleheight || victim->damage >= victim->damagetolerance - 40) {
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 15;
}
relative = DoRotation(relative, 0, -90, 0);
relative.y += .1;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle)
victim->skeleton.joints[i].velocity = relative * 80;
}
} else {
if (victim->damage >= victim->damagetolerance)
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
relative = DoRotation(relative, 0, -90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
if (victim->skeleton.joints[i].label == leftfoot || victim->skeleton.joints[i].label == rightfoot || victim->skeleton.joints[i].label == leftankle || victim->skeleton.joints[i].label == rightankle)
victim->skeleton.joints[i].velocity += relative * damagemult * 80;
}
relative = victim->coords - oldcoords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
relative = victim->coords - oldcoords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
relative = victim->coords - oldcoords;
relative.y = 0;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 30;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
relative.y = 0;
Normalise(&relative);
relative.y -= .1;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 70;
}
victim->jointVel(lefthand) *= .1;
relative.y = 0;
Normalise(&relative);
relative.y -= .1;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 70;
}
victim->jointVel(lefthand) *= .1 - 1;
relative.y = 0;
Normalise(&relative);
relative = DoRotation(relative, 0, -90, 0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->jointVel(abdomen) += relative * damagemult * 200;
Normalise(&relative);
if (victim->id == 0)
relative /= 30;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
victim->damage = victim->damagetolerance;
if (hasvictim && (animTarget == knifefollowanim || animTarget == knifesneakattackanim) && Animation::animations[animTarget].frames[frameCurrent].label == 6) {
escapednum = 0;
victim->velocity = 0;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = 0;
}
if (animTarget == knifefollowanim) {
victim->RagDoll(0);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = 0;
}
}
if (hasvictim && animTarget == swordsneakattackanim && Animation::animations[animTarget].frames[frameCurrent].label == 6) {
escapednum = 0;
victim->velocity = 0;
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity = 0;
}
if (weaponactive != -1) {
relative = DoRotation(relative, 0, 90, 0);
relative.y = .5;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
relative = DoRotation(relative, 0, 90, 0);
relative.y = .5;
Normalise(&relative);
- for (int i = 0; i < victim->skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
//Animation end
- if (frameTarget > Animation::animations[animCurrent].frames.size() - 1) {
+ if (frameTarget > int(Animation::animations[animCurrent].frames.size()) - 1) {
frameTarget = 0;
if (wasStop()) {
animTarget = getIdle();
oldrot = 0;
targetrot = 0;
}
- if (frameCurrent >= Animation::animations[animCurrent].frames.size()) {
+ if (frameCurrent >= int(Animation::animations[animCurrent].frames.size())) {
frameCurrent = Animation::animations[animCurrent].frames.size() - 1;
}
if (animCurrent != oldanimCurrent || animTarget != oldanimTarget || ((frameCurrent != oldframeCurrent || frameTarget != oldframeTarget) && !calcrot)) {
//Old rotates
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].position = currentFrame().joints[i].position;
}
skeleton.FindForwards();
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible) {
skeleton.FindRotationMuscle(i, animTarget);
}
}
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible) {
if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100))
skeleton.muscles[i].oldrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100;
}
//New rotates
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].position = targetFrame().joints[i].position;
}
skeleton.FindForwards();
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible) {
skeleton.FindRotationMuscle(i, animTarget);
}
}
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
if (skeleton.muscles[i].visible) {
if (isnormal((float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100))
skeleton.muscles[i].newrotate1 = (float)((int)(skeleton.muscles[i].rotate1 * 100) % 36000) / 100;
oldframeTarget = frameTarget;
oldframeCurrent = frameCurrent;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ 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);
}
offset = currentoffset * (1 - target) + targetoffset * target;
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ 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);
static XYZ flatfacing;
static XYZ flatvelocity;
static float flatvelspeed;
- static int i, j, l;
+ static int i, l;
static XYZ average;
static int howmany;
static int bloodsize;
}
dead = 2;
if (animTarget == knifefollowedanim && !skeleton.free) {
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].velocity = 0;
skeleton.joints[i].velocity.y = -2;
}
endy = starty;
for (i = startx; i < endx; i++) {
- for (j = starty; j < endy; j++) {
+ for (int j = starty; j < endy; j++) {
if (Random() % 2 == 0) {
color = Random() % 85 + 170;
if (skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 0] > color / 2)
}
if (bloodtoggle && !bled)
for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0);
float size = .8;
float opacity = .6;
dead = 0;
skeleton.free = 1;
damage -= 20;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
skeleton.joints[i].velocity = 0;
}
}
average = 0;
howmany = 0;
- for (j = 0; j < skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < skeleton.joints.size(); j++) {
average += skeleton.joints[j].position;
howmany++;
}
average /= howmany;
coords += average * scale;
- for (j = 0; j < skeleton.joints.size(); j++) {
+ for (unsigned j = 0; j < skeleton.joints.size(); j++) {
skeleton.joints[j].position -= average;
}
average /= multiplier;
velocity = 0;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
velocity += skeleton.joints[i].velocity * scale;
}
velocity /= skeleton.joints.size();
}
if (bloodtoggle && !bled)
for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0);
float size = .2 * 1.2;
float opacity = .6;
}
if (bloodtoggle && !bled)
for (l = 0; l < terrain.patchobjectnum[whichpatchx][whichpatchz]; l++) {
- j = terrain.patchobjects[whichpatchx][whichpatchz][l];
+ int j = terrain.patchobjects[whichpatchx][whichpatchz][l];
XYZ point = DoRotation(headpoint - objects.position[j], 0, -objects.yaw[j], 0);
float size = .8;
float opacity = .6;
frameCurrent = 0;
target = 0;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
tempanimation.frames[0].joints[i].position = skeleton.joints[i].position;
tempanimation.frames[0].joints[i].position = DoRotation(tempanimation.frames[0].joints[i].position, 0, -yaw, 0);
}
if (middle.y > 0 && animTarget != rollanim)
targetoffset.y = middle.y + 1;
- for (int i = 0; i < skeleton.joints.size(); i++) {
+ for (unsigned i = 0; i < skeleton.joints.size(); i++) {
tempanimation.frames[0].joints[i].position = skeleton.joints[i].position;
tempanimation.frames[0].joints[i].position = DoRotation(tempanimation.frames[0].joints[i].position, 0, -yaw, 0);
}
howmany = findLength(&velocity) * 2;
if (detail == 2)
if (environment != desertenvironment)
- for (j = 0; j < howmany; j++) {
+ for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
tempvel.z = float(abs(Random() % 100) - 50) / 20;
howmany = findLength(&velocity) * 4;
if (detail == 2)
if (environment == snowyenvironment)
- for (j = 0; j < howmany; j++) {
+ for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
tempvel.z = float(abs(Random() % 100) - 50) / 20;
howmany = findLength(&velocity) * 2;
if (detail == 2)
if (environment != desertenvironment)
- for (j = 0; j < howmany; j++) {
+ for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
tempvel.z = float(abs(Random() % 100) - 50) / 20;
howmany = findLength(&velocity) * 4;
if (detail == 2)
if (environment == snowyenvironment)
- for (j = 0; j < howmany; j++) {
+ for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
tempvel.z = float(abs(Random() % 100) - 50) / 20;
}
static XYZ mid;
static float M[16];
- static int i, j, k;
+ static int i, k;
static int weaponattachmuscle;
static int weaponrotatemuscle;
static XYZ weaponpoint;
skeleton.drawmodelclothes.vertex[i] = 0;
skeleton.drawmodelclothes.vertex[i].y = 999;
}
- for (int i = 0; i < skeleton.muscles.size(); i++) {
+ for (unsigned i = 0; i < skeleton.muscles.size(); i++) {
// convenience renames
const int p1 = skeleton.muscles[i].parent1->label;
const int p2 = skeleton.muscles[i].parent2->label;
glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0);
if (playerdetail || skeleton.free == 3) {
- for (j = 0; j < skeleton.muscles[i].vertices.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles[i].vertices.size(); j++) {
XYZ &v0 = skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]];
XYZ &v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
glMatrixMode(GL_MODELVIEW);
}
}
if (!playerdetail || skeleton.free == 3) {
- for (j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) {
XYZ &v0 = skeleton.modellow.vertex[skeleton.muscles[i].verticeslow[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
skeleton.muscles[i].lastrotate3 = skeleton.muscles[i].rotate3;
glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0);
- for (j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) {
XYZ &v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
i = weaponids[k];
if (weaponactive == k) {
if (weapons[i].getType() != staff) {
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) {
weaponattachmuscle = j;
}
}
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == rightwrist || skeleton.muscles[j].parent2->label == rightwrist) && (skeleton.muscles[j].parent1->label != righthand && skeleton.muscles[j].parent2->label != righthand) && skeleton.muscles[j].vertices.size() > 0) {
weaponrotatemuscle = j;
}
weaponpoint = (jointPos(rightwrist) * .7 + jointPos(righthand) * .3);
}
if (weapons[i].getType() == staff) {
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) {
weaponattachmuscle = j;
}
}
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == rightelbow || skeleton.muscles[j].parent2->label == rightelbow) && (skeleton.muscles[j].parent1->label != rightshoulder && skeleton.muscles[j].parent2->label != rightshoulder) && skeleton.muscles[j].vertices.size() > 0) {
weaponrotatemuscle = j;
}
weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33;
if (weapons[i].getType() == staff)
weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33;
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == abdomen || skeleton.muscles[j].parent2->label == abdomen) && (skeleton.muscles[j].parent1->label == neck || skeleton.muscles[j].parent2->label == neck) && skeleton.muscles[j].vertices.size() > 0) {
weaponrotatemuscle = j;
}
weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 - skeleton.forward * .8;
else
weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 + skeleton.forward * .8;
- for (j = 0; j < skeleton.muscles.size(); j++) {
+ for (unsigned j = 0; j < skeleton.muscles.size(); j++) {
if ((skeleton.muscles[j].parent1->label == abdomen || skeleton.muscles[j].parent2->label == abdomen) && (skeleton.muscles[j].parent1->label == neck || skeleton.muscles[j].parent2->label == neck) && skeleton.muscles[j].vertices.size() > 0) {
weaponrotatemuscle = j;
}