for (int k = 0; k < numclothes; k++) {
int templength;
funpackf(tfile, "Bi", &templength);
for (int k = 0; k < numclothes; k++) {
int templength;
funpackf(tfile, "Bi", &templength);
clothes[k][templength] = '\0';
funpackf(tfile, "Bf Bf Bf", &clothestintr[k], &clothestintg[k], &clothestintb[k]);
}
clothes[k][templength] = '\0';
funpackf(tfile, "Bf Bf Bf", &clothestintr[k], &clothestintg[k], &clothestintb[k]);
}
- if (!(hasvictim && (animTarget == rabbitkickanim && victim && victim != this->shared_from_this() && frameCurrent >= 2 && animCurrent == rabbitkickanim) && distsq(&coords, &victim->coords) < 1.2 && !victim->skeleton.free))
+ if (!(hasvictim && (animTarget == rabbitkickanim && victim && victim != this->shared_from_this() && frameCurrent >= 2 && animCurrent == rabbitkickanim) && distsq(&coords, &victim->coords) < 1.2 && !victim->skeleton.free)) {
if (Animation::animations[victim->animTarget].height != lowheight) {
float damagemult = (creature == wolftype ? 2.5 : 1.) * power * power;
if (Animation::animations[victim->animTarget].height != lowheight) {
float damagemult = (creature == wolftype ? 2.5 : 1.) * power * power;
victim->RagDoll(0);
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * 120 * damagemult;
}
victim->Puff(neck);
victim->DoDamage(100 * damagemult / victim->protectionhigh);
victim->RagDoll(0);
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * 120 * damagemult;
}
victim->Puff(neck);
victim->DoDamage(100 * damagemult / victim->protectionhigh);
if (hasvictim && (victim != this->shared_from_this())) {
if ((!victim->dead && victim->aitype != passivetype &&
victim->aitype != searchtype && aitype != passivetype && aitype != searchtype &&
victim->id < Person::players.size())) {
if ((aitype == playercontrolled && stunned <= 0 && weaponactive == -1) || pause) {
if (hasvictim && (victim != this->shared_from_this())) {
if ((!victim->dead && victim->aitype != passivetype &&
victim->aitype != searchtype && aitype != passivetype && aitype != searchtype &&
victim->id < Person::players.size())) {
if ((aitype == playercontrolled && stunned <= 0 && weaponactive == -1) || pause) {
Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .3, 1);
}
}
Sprite::MakeSprite(bloodflamesprite, DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords, bloodvel, 1, 1, 1, .3, 1);
}
}
while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
{
static int bleedxint, bleedyint, i, j;
static XYZ bloodvel;
{
static int bleedxint, bleedyint, i, j;
static XYZ bloodvel;
if (aitype != playercontrolled && howmuch > 0) {
// play pain sounds
int whichsound = -1;
if (creature == wolftype) {
int i = abs(Random() % 2);
if (aitype != playercontrolled && howmuch > 0) {
// play pain sounds
int whichsound = -1;
if (creature == wolftype) {
int i = abs(Random() % 2);
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || bloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
while (wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] > which + 4 || wolfbloodText[bleedxint * 512 * 3 + bleedyint * 3 + 0] < which - 4 || bleedxint < 10 || bleedyint < 10 || bleedxint > 500 || bleedyint > 500) {
bleedxint = abs(Random() % 512);
bleedyint = abs(Random() % 512);
}
where = DoRotation(where, 0, -yaw, 0);
where = DoRotation(where, 0, -yaw, 0);
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (bloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && bloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = 0; i < 512; i++) {
for (j = 0; j < 512; j++) {
if (wolfbloodText[i * 512 * 3 + j * 3 + 0] <= which + 4 && wolfbloodText[i * 512 * 3 + j * 3 + 0] >= which - 4) {
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
skeleton.skinText[where + 1] = 0;
skeleton.skinText[where + 2] = 0;
} else if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
skeleton.skinText[where + 1] = 0;
skeleton.skinText[where + 2] = 0;
} else if (bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && bloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
for (i = startx; i < endx; i++) {
for (j = starty; j < endy; j++) {
if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= which + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= which - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
skeleton.skinText[where + 1] = 0;
skeleton.skinText[where + 2] = 0;
} else if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
skeleton.skinText[where + 1] = 0;
skeleton.skinText[where + 2] = 0;
} else if (wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] <= 160 + 4 && wolfbloodText[(i * texdetailint - offsetx) * 512 * 3 + (j * texdetailint - offsety) * 3 + 0] >= 160 - 4) {
color = Random() % 85 + 170;
where = i * skeleton.skinsize * 3 + j * 3;
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
if (victim->weaponactive != -1) {
victim->throwtogglekeydown = 1;
XYZ tempVelocity = victim->velocity * .2;
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
weapons[victim->weaponids[0]].drop(tempVelocity, tempVelocity, false);
victim->num_weapons--;
if (victim->num_weapons) {
victim->weaponids[0] = victim->weaponids[victim->num_weapons];
if (abs(Random() % 20) == 0 || weapons[victim->weaponids[victim->weaponactive]].getType() == knife) {
if (victim->weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (abs(Random() % 20) == 0 || weapons[victim->weaponids[victim->weaponactive]].getType() == knife) {
if (victim->weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
emit_sound_at(swordstaffsound, victim->coords);
} else {
emit_sound_at(metalhitsound, victim->coords);
emit_sound_at(swordstaffsound, victim->coords);
} else {
emit_sound_at(metalhitsound, victim->coords);
if (abs(Random() % 20) == 0) {
if (weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (abs(Random() % 20) == 0) {
if (weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (animTarget == knifeslashstartanim || animTarget == swordslashanim || animTarget == staffhitanim || animTarget == staffspinhitanim) {
if ((animTarget != staffhitanim && animTarget != staffspinhitanim) || distsq(&coords, &victim->coords) > .2) {
victim->animTarget = dodgebackanim;
if (animTarget == knifeslashstartanim || animTarget == swordslashanim || animTarget == staffhitanim || animTarget == staffspinhitanim) {
if ((animTarget != staffhitanim && animTarget != staffspinhitanim) || distsq(&coords, &victim->coords) > .2) {
victim->animTarget = dodgebackanim;
Normalise(&rotatetarget);
victim->targetyaw = -asin(0 - rotatetarget.x);
victim->targetyaw *= 360 / 6.28;
Normalise(&rotatetarget);
victim->targetyaw = -asin(0 - rotatetarget.x);
victim->targetyaw *= 360 / 6.28;
Normalise(&rotatetarget);
victim->targetyaw = -asin(0 - rotatetarget.x);
victim->targetyaw *= 360 / 6.28;
Normalise(&rotatetarget);
victim->targetyaw = -asin(0 - rotatetarget.x);
victim->targetyaw *= 360 / 6.28;
if (!Tutorial::active && aitype != playercontrolled && damage < damagetolerance && damage > damagetolerance * 2 / 3 && creature == rabbittype) {
if (abs(Random() % 2) == 0) {
aitype = gethelptype;
lastseentime = 12;
if (!Tutorial::active && aitype != playercontrolled && damage < damagetolerance && damage > damagetolerance * 2 / 3 && creature == rabbittype) {
if (abs(Random() % 2) == 0) {
aitype = gethelptype;
lastseentime = 12;
targetheadyaw = (float)((int)((0 - yaw - targetheadyaw + 180) * 100) % 36000) / 100;
targetheadpitch = (float)((int)(targetheadpitch * 100) % 36000) / 100;
targetheadyaw = (float)((int)((0 - yaw - targetheadyaw + 180) * 100) % 36000) / 100;
targetheadpitch = (float)((int)(targetheadpitch * 100) % 36000) / 100;
headyaw -= multiplier * lookspeed;
} else if (headyaw < targetheadyaw) {
headyaw += multiplier * lookspeed;
}
headyaw -= multiplier * lookspeed;
} else if (headyaw < targetheadyaw) {
headyaw += multiplier * lookspeed;
}
headpitch -= multiplier * lookspeed / 2;
} else if (headpitch < targetheadpitch) {
headpitch += multiplier * lookspeed / 2;
headpitch -= multiplier * lookspeed / 2;
} else if (headpitch < targetheadpitch) {
headpitch += multiplier * lookspeed / 2;
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);
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].position = DoRotation(skeleton.joints[i].position, 0, yaw, 0);
skeleton.joints[i].position = DoRotation(skeleton.joints[i].position, 0, yaw, 0);
skeleton.joints[i].position.y += .1;
skeleton.joints[i].oldposition = skeleton.joints[i].position;
skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords;
skeleton.joints[i].position.y += .1;
skeleton.joints[i].oldposition = skeleton.joints[i].position;
skeleton.joints[i].realoldposition = skeleton.joints[i].position * scale + coords;
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);
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);
change.x = (float)(Random() % 100) / 100;
change.y = (float)(Random() % 100) / 100;
change.z = (float)(Random() % 100) / 100;
change.x = (float)(Random() % 100) / 100;
change.y = (float)(Random() % 100) / 100;
change.z = (float)(Random() % 100) / 100;
if (opacity > 1) {
footvel = 0;
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
if (opacity > 1) {
footvel = 0;
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
Sprite::MakeSprite(cloudsprite, footpoint, footvel, 1, 1, 1, .5, .2 * opacity);
Sprite::MakeSprite(cloudsprite, footpoint, footvel, 1, 1, 1, .5, .2 * opacity);
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
footpoint.y = terrain.getHeight(footpoint.x, footpoint.z);
terrainlight = terrain.getLighting(footpoint.x, footpoint.z);
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
footpoint.y = terrain.getHeight(footpoint.x, footpoint.z);
terrainlight = terrain.getLighting(footpoint.x, footpoint.z);
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
if (distsq(&footpoint, &viewer) < viewdistance * viewdistance / 4) {
Sprite::MakeSprite(cloudsprite, footpoint, footvel * .6, 1, 1, 1, .5, .2 * opacity);
footpoint = DoRotation(jointPos(whichfoot), 0, yaw, 0) * scale + coords;
if (distsq(&footpoint, &viewer) < viewdistance * viewdistance / 4) {
Sprite::MakeSprite(cloudsprite, footpoint, footvel * .6, 1, 1, 1, .5, .2 * opacity);
if (animTarget == tempanim || animCurrent == tempanim) {
Animation::animations[tempanim] = tempanimation;
if (animTarget == tempanim || animCurrent == tempanim) {
Animation::animations[tempanim] = tempanimation;
OPENAL_3D_SetAttributes(channels[whooshsound], gLoc);
OPENAL_SetVolume(channels[whooshsound], 64 * findLength(&velocity) / 5);
}
OPENAL_3D_SetAttributes(channels[whooshsound], gLoc);
OPENAL_SetVolume(channels[whooshsound], 64 * findLength(&velocity) / 5);
}
targfacing = DoRotation(targfacing, 0, targetyaw, 0);
targfacing = DoRotation(targfacing, 0, targetyaw, 0);
if (!drawtogglekeydown && drawkeydown && (weaponactive == -1 || num_weapons == 1) && (targetFrame().label || (animTarget != animCurrent && animCurrent == rollanim)) && num_weapons > 0 && creature != wolftype) {
if (weapons[weaponids[0]].getType() == knife) {
if (!drawtogglekeydown && drawkeydown && (weaponactive == -1 || num_weapons == 1) && (targetFrame().label || (animTarget != animCurrent && animCurrent == rollanim)) && num_weapons > 0 && creature != wolftype) {
if (weapons[weaponids[0]].getType() == knife) {
if (weaponactive == -1) {
emit_sound_at(knifesheathesound, coords);
if (weaponactive == -1) {
emit_sound_at(knifesheathesound, coords);
if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) {
int whichsound = -1;
if (onterrain) {
if (terrain.getOpacity(coords.x, coords.z) < .2) {
if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) {
int whichsound = -1;
if (onterrain) {
if (terrain.getOpacity(coords.x, coords.z) < .2) {
if (targetFrame().label == 3 && isRun()) {
FootLand(rightfoot, 1);
FootLand(leftfoot, 1);
}
}
if (terrain.getOpacity(coords.x, coords.z) >= .2) {
if (targetFrame().label == 3 && isRun()) {
FootLand(rightfoot, 1);
FootLand(leftfoot, 1);
}
}
if (terrain.getOpacity(coords.x, coords.z) >= .2) {
}
if (targetFrame().label == 4 && (weaponactive == -1 || (animTarget != knifeslashstartanim && animTarget != knifethrowanim && animTarget != crouchstabanim && animTarget != swordgroundstabanim && animTarget != knifefollowanim))) {
if (Animation::animations[animTarget].attack != neutral) {
unsigned r = abs(Random() % 3);
}
if (targetFrame().label == 4 && (weaponactive == -1 || (animTarget != knifeslashstartanim && animTarget != knifethrowanim && animTarget != crouchstabanim && animTarget != swordgroundstabanim && animTarget != knifefollowanim))) {
if (Animation::animations[animTarget].attack != neutral) {
unsigned r = abs(Random() % 3);
- if (!Tutorial::active || id == 0)
- if (speechdelay <= 0)
- if (animTarget != crouchstabanim && animTarget != swordgroundstabanim && animTarget != staffgroundsmashanim)
+ if (!Tutorial::active || id == 0) {
+ if (speechdelay <= 0) {
+ if (animTarget != crouchstabanim && animTarget != swordgroundstabanim && animTarget != staffgroundsmashanim) {
if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) {
int whichsound = -1;
if (targetFrame().label == 4 && aitype != playercontrolled) {
if (Animation::animations[animTarget].attack != neutral) {
unsigned r = abs(Random() % 4);
if (creature == rabbittype) {
if ((targetFrame().label && (targetFrame().label < 5 || targetFrame().label == 8))) {
int whichsound = -1;
if (targetFrame().label == 4 && aitype != playercontrolled) {
if (Animation::animations[animTarget].attack != neutral) {
unsigned r = abs(Random() % 4);
if (creature == rabbittype) {
if (animTarget == removeknifeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
for (unsigned i = 0; i < weapons.size(); i++) {
if (animTarget == removeknifeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
for (unsigned i = 0; i < weapons.size(); i++) {
if (distsqflat(&coords, &weapons[i].position) < 4 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) >= 1) {
if (weapons[i].getType() != staff) {
if (distsqflat(&coords, &weapons[i].position) < 4 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) >= 1) {
if (weapons[i].getType() != staff) {
}
}
if (animTarget == crouchremoveknifeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
for (unsigned i = 0; i < weapons.size(); i++) {
bool willwork = true;
}
}
if (animTarget == crouchremoveknifeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
for (unsigned i = 0; i < weapons.size(); i++) {
bool willwork = true;
- if (weapons[i].owner != -1)
- if (Person::players[weapons[i].owner]->weaponstuck != -1)
- if (Person::players[weapons[i].owner]->weaponids[Person::players[weapons[i].owner]->weaponstuck] == int(i))
- if (Person::players[weapons[i].owner]->num_weapons > 1)
+ if (weapons[i].owner != -1) {
+ if (Person::players[weapons[i].owner]->weaponstuck != -1) {
+ if (Person::players[weapons[i].owner]->weaponids[Person::players[weapons[i].owner]->weaponstuck] == int(i)) {
+ if (Person::players[weapons[i].owner]->num_weapons > 1) {
if (willwork && distsqflat(&coords, &weapons[i].position) < 3 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) < 1 || hasvictim) {
bool fleshstuck = false;
if (willwork && distsqflat(&coords, &weapons[i].position) < 3 && weaponactive == -1) {
if (distsq(&coords, &weapons[i].position) < 1 || hasvictim) {
bool fleshstuck = false;
footpoint = weapons[i].position;
if (victim->weaponstuck != -1) {
if (victim->weaponids[victim->weaponstuck] == int(i)) {
footpoint = weapons[i].position;
if (victim->weaponstuck != -1) {
if (victim->weaponids[victim->weaponstuck] == int(i)) {
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
weapons[i].bloody = 2;
weapons[i].blooddrip = 5;
victim->weaponstuck = -1;
}
}
if (victim->num_weapons > 0) {
weapons[i].bloody = 2;
weapons[i].blooddrip = 5;
victim->weaponstuck = -1;
}
}
if (victim->num_weapons > 0) {
if (dojumpattack) {
if ((animTarget == rabbitrunninganim || animTarget == wolfrunninganim) && id == 0) {
animTarget = rabbittackleanim;
if (dojumpattack) {
if ((animTarget == rabbitrunninganim || animTarget == wolfrunninganim) && id == 0) {
animTarget = rabbittackleanim;
if (distsq(&targetloc, &Person::players[i]->coords) < closestdist || closestdist == 0) {
closestdist = distsq(&targetloc, &Person::players[i]->coords);
closestid = i;
}
if (distsq(&targetloc, &Person::players[i]->coords) < closestdist || closestdist == 0) {
closestdist = distsq(&targetloc, &Person::players[i]->coords);
closestid = i;
}
if (closestdist < 5 && !Person::players[closestid]->dead && Animation::animations[Person::players[closestid]->animTarget].height != lowheight && Person::players[closestid]->animTarget != backhandspringanim) {
hasvictim = 1;
victim = Person::players[closestid];
if (closestdist < 5 && !Person::players[closestid]->dead && Animation::animations[Person::players[closestid]->animTarget].height != lowheight && Person::players[closestid]->animTarget != backhandspringanim) {
hasvictim = 1;
victim = Person::players[closestid];
}
if (animTarget != rabbitrunninganim) {
emit_sound_at(jumpsound, coords, 128.);
}
}
}
if (animTarget != rabbitrunninganim) {
emit_sound_at(jumpsound, coords, 128.);
}
}
if (animTarget == spinkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
if (animTarget == spinkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
if (animTarget == wolfslapanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
if (animTarget == wolfslapanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
}
emit_sound_at(whooshhitsound, victim->coords);
if (creature == wolftype) {
}
emit_sound_at(whooshhitsound, victim->coords);
if (creature == wolftype) {
if (animTarget == walljumprightkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
if (animTarget == walljumprightkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
}
}
if (animTarget == walljumpleftkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
}
}
if (animTarget == walljumpleftkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
}
}
if (animTarget == blockhighleftstrikeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
}
}
if (animTarget == blockhighleftstrikeanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != lowheight) {
escapednum = 0;
if (animTarget == killanim && Animation::animations[animTarget].frames[frameCurrent].label == 8) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && victim->dead) {
escapednum = 0;
if (animTarget == killanim && Animation::animations[animTarget].frames[frameCurrent].label == 8) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && victim->dead) {
escapednum = 0;
emit_sound_at(whooshhitsound, victim->coords, 128.);
victim->skeleton.longdead = 0;
emit_sound_at(whooshhitsound, victim->coords, 128.);
victim->skeleton.longdead = 0;
if (animTarget == killanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 9 && victim->dead) {
escapednum = 0;
if (animTarget == killanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 9 && victim->dead) {
escapednum = 0;
if (animTarget == dropkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 7) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 9 && victim->skeleton.free) {
escapednum = 0;
if (animTarget == dropkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 7) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 9 && victim->skeleton.free) {
escapednum = 0;
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->Puff(abdomen);
victim->DoDamage(damagemult * 20 / victim->protectionhigh);
victim->jointVel(abdomen) += relative * damagemult * 200;
staggerdelay = .5;
victim->Puff(abdomen);
victim->DoDamage(damagemult * 20 / victim->protectionhigh);
victim->jointVel(abdomen) += relative * damagemult * 200;
staggerdelay = .5;
if (!hasvictim) {
terrain.MakeDecal(blooddecalfast, (weapons[weaponids[weaponactive]].tippoint * .8 + weapons[weaponids[weaponactive]].position * .2), .08, .6, Random() % 360);
if (!hasvictim) {
terrain.MakeDecal(blooddecalfast, (weapons[weaponids[weaponactive]].tippoint * .8 + weapons[weaponids[weaponactive]].position * .2), .08, .6, Random() % 360);
if (weapons[weaponids[weaponactive]].getType() == knife) {
where = (weapons[weaponids[weaponactive]].tippoint * .6 + weapons[weaponids[weaponactive]].position * .4);
where -= victim->coords;
if (weapons[weaponids[weaponactive]].getType() == knife) {
where = (weapons[weaponids[weaponactive]].tippoint * .6 + weapons[weaponids[weaponactive]].position * .4);
where -= victim->coords;
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
if (weapons[weaponids[weaponactive]].getType() == sword) {
where = weapons[weaponids[weaponactive]].position;
where -= victim->coords;
if (weapons[weaponids[weaponactive]].getType() == sword) {
where = weapons[weaponids[weaponactive]].position;
where -= victim->coords;
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
endpoint = where;
}
if (weapons[weaponids[weaponactive]].getType() == staff) {
where = weapons[weaponids[weaponactive]].position;
where -= victim->coords;
endpoint = where;
}
if (weapons[weaponids[weaponactive]].getType() == staff) {
where = weapons[weaponids[weaponactive]].position;
where -= victim->coords;
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
where = DoRotation(where, 0, -victim->yaw, 0);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .8, .3);
if (animTarget == upunchanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3) {
escapednum = 0;
if (animTarget == upunchanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3) {
escapednum = 0;
if (animTarget == winduppunchanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 2) {
escapednum = 0;
if (animTarget == winduppunchanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 2) {
escapednum = 0;
if (victim->damage <= victim->damagetolerance - 60 && normaldotproduct(victim->facing, victim->coords - coords) < (scale * 5) * (scale * 5) * 0 && Animation::animations[victim->animTarget].height != lowheight) {
if (!Tutorial::active) {
emit_sound_at(thudsound, victim->coords);
if (victim->damage <= victim->damagetolerance - 60 && normaldotproduct(victim->facing, victim->coords - coords) < (scale * 5) * (scale * 5) * 0 && Animation::animations[victim->animTarget].height != lowheight) {
if (!Tutorial::active) {
emit_sound_at(thudsound, victim->coords);
if (animTarget == blockhighleftanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4) {
if (animTarget == blockhighleftanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4) {
if (animTarget == swordslashparryanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4) {
if (animTarget == swordslashparryanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4) {
if (weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4.5 && /*Animation::animations[victim->animTarget].height!=lowheight&&*/ victim->animTarget != dodgebackanim && victim->animTarget != rollanim) {
escapednum = 0;
if (!Tutorial::active) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 4.5 && /*Animation::animations[victim->animTarget].height!=lowheight&&*/ victim->animTarget != dodgebackanim && victim->animTarget != rollanim) {
escapednum = 0;
if (!Tutorial::active) {
}
if (animTarget == swordslashanim && Animation::animations[animTarget].frames[frameCurrent].label == 5 && victim->animTarget != rollanim) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 6.5 && victim->animTarget != dodgebackanim) {
}
if (animTarget == swordslashanim && Animation::animations[animTarget].frames[frameCurrent].label == 5 && victim->animTarget != rollanim) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 6.5 && victim->animTarget != dodgebackanim) {
victim->deathbleeding = 1;
emit_sound_at(swordslicesound, victim->coords);
victim->frameTarget = 0;
victim->deathbleeding = 1;
emit_sound_at(swordslicesound, victim->coords);
victim->frameTarget = 0;
} else {
if (victim->weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
} else {
if (victim->weaponactive != -1) {
if (weapons[victim->weaponids[0]].getType() == staff || weapons[weaponids[0]].getType() == staff) {
if (animTarget == lowkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != highheight) {
escapednum = 0;
if (animTarget == lowkickanim && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3 && Animation::animations[victim->animTarget].height != highheight) {
escapednum = 0;
if (creature == wolftype) {
emit_sound_at(clawslicesound, victim->coords, 128.);
victim->spurt = 1;
victim->DoBloodBig(2 / victim->armorhead, 175);
}
} else {
if (creature == wolftype) {
emit_sound_at(clawslicesound, victim->coords, 128.);
victim->spurt = 1;
victim->DoBloodBig(2 / victim->armorhead, 175);
}
} else {
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 10;
}
(distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3) &&
(victim != this->shared_from_this())) {
escapednum = 0;
(distsq(&coords, &victim->coords) < (scale * 5) * (scale * 5) * 3) &&
(victim != this->shared_from_this())) {
escapednum = 0;
relative = DoRotation(relative, 0, -90, 0);
relative.y += .1;
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
relative = DoRotation(relative, 0, -90, 0);
relative.y += .1;
for (unsigned 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 (unsigned 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 (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
if (Animation::animations[animTarget].attack == reversal && (!victim->feint || (victim->lastattack == victim->lastattack2 && victim->lastattack2 == victim->lastattack3 && Random() % 2) || animTarget == knifefollowanim)) {
if (animTarget == spinkickreversalanim && Animation::animations[animTarget].frames[frameCurrent].label == 7) {
escapednum = 0;
if (Animation::animations[animTarget].attack == reversal && (!victim->feint || (victim->lastattack == victim->lastattack2 && victim->lastattack2 == victim->lastattack3 && Random() % 2) || animTarget == knifefollowanim)) {
if (animTarget == spinkickreversalanim && Animation::animations[animTarget].frames[frameCurrent].label == 7) {
escapednum = 0;
- if (creature == rabbittype && weaponactive != -1)
- if (weapons[weaponids[0]].getType() == staff)
+ }
+ if (creature == rabbittype && weaponactive != -1) {
+ if (weapons[weaponids[0]].getType() == staff) {
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(2 / victim->armorhigh, 225);
emit_sound_at(knifeslicesound, victim->coords);
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(2 / victim->armorhigh, 225);
emit_sound_at(knifeslicesound, victim->coords);
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
for (unsigned i = 0; i < victim->skeleton.joints.size(); i++) {
victim->skeleton.joints[i].velocity += relative * damagemult * 40;
}
- if (creature == rabbittype && weaponactive != -1)
- if (weapons[weaponids[0]].getType() == staff)
+ }
+ if (creature == rabbittype && weaponactive != -1) {
+ if (weapons[weaponids[0]].getType() == staff) {
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(200, 225);
emit_sound_at(knifeslicesound, victim->coords);
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(200, 225);
emit_sound_at(knifeslicesound, victim->coords);
if (hasvictim && (animTarget == knifefollowanim || animTarget == knifesneakattackanim) && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (weaponactive != -1 && victim->bloodloss < victim->damagetolerance) {
escapednum = 0;
if (hasvictim && (animTarget == knifefollowanim || animTarget == knifesneakattackanim) && Animation::animations[animTarget].frames[frameCurrent].label == 5) {
if (weaponactive != -1 && victim->bloodloss < victim->damagetolerance) {
escapednum = 0;
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
victim->bloodloss += 10000;
victim->velocity = 0;
emit_sound_at(fleshstabsound, victim->coords);
victim->bloodloss += 10000;
victim->velocity = 0;
emit_sound_at(fleshstabsound, victim->coords);
}
if (weaponactive != -1 && Animation::animations[victim->animTarget].attack != reversal) {
emit_sound_at(fleshstabremovesound, victim->coords);
}
if (weaponactive != -1 && Animation::animations[victim->animTarget].attack != reversal) {
emit_sound_at(fleshstabremovesound, victim->coords);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
victim->bloodloss += 10000;
victim->velocity = 0;
emit_sound_at(fleshstabsound, victim->coords);
victim->bloodloss += 10000;
victim->velocity = 0;
emit_sound_at(fleshstabsound, victim->coords);
}
if (weaponactive != -1) {
emit_sound_at(fleshstabremovesound, victim->coords);
}
if (weaponactive != -1) {
emit_sound_at(fleshstabremovesound, victim->coords);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
footvel = (weapons[weaponids[0]].tippoint - weapons[weaponids[0]].position) * -1;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 3, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
- if (creature == rabbittype && weaponactive != -1)
- if (weapons[weaponids[0]].getType() == staff)
+ }
+ if (creature == rabbittype && weaponactive != -1) {
+ if (weapons[weaponids[0]].getType() == staff) {
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(2 / victim->armorhead, 225);
emit_sound_at(knifeslicesound, victim->coords);
if (doslice) {
if (weaponactive != -1) {
victim->DoBloodBig(2 / victim->armorhead, 225);
emit_sound_at(knifeslicesound, victim->coords);
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
victim->skeleton.joints[i].velocity += relative * damagemult * 20;
}
victim->jointVel(head) += relative * damagemult * 200;
- if (hasvictim && (animTarget == spinkickreversalanim || animTarget == sweepreversalanim || animTarget == rabbitkickreversalanim || animTarget == upunchreversalanim || animTarget == jumpreversalanim || animTarget == swordslashreversalanim || animTarget == knifeslashreversalanim || animTarget == rabbittacklereversal || animTarget == wolftacklereversal || animTarget == staffhitreversalanim || animTarget == staffspinhitreversalanim))
+ if (hasvictim && (animTarget == spinkickreversalanim || animTarget == sweepreversalanim || animTarget == rabbitkickreversalanim || animTarget == upunchreversalanim || animTarget == jumpreversalanim || animTarget == swordslashreversalanim || animTarget == knifeslashreversalanim || animTarget == rabbittacklereversal || animTarget == wolftacklereversal || animTarget == staffhitreversalanim || animTarget == staffspinhitreversalanim)) {
if (victim->damage > victim->damagetolerance && bonus != reverseko) {
award_bonus(id, reverseko);
}
if (victim->damage > victim->damagetolerance && bonus != reverseko) {
award_bonus(id, reverseko);
}
for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
if (closestdist > 0 && closest >= 0 && closestdist < 16) {
victim = Person::players[closest];
animTarget = walljumprightkickanim;
if (closestdist > 0 && closest >= 0 && closestdist < 16) {
victim = Person::players[closest];
animTarget = walljumprightkickanim;
for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
for (unsigned i = 0; i < Person::players.size(); i++) {
if (id != i && Person::players[i]->coords.y < coords.y && !Person::players[i]->skeleton.free) {
distance = distsq(&Person::players[i]->coords, &coords);
if (closestdist > 0 && closest >= 0 && closestdist < 16) {
victim = Person::players[closest];
animTarget = walljumpleftkickanim;
if (closestdist > 0 && closest >= 0 && closestdist < 16) {
victim = Person::players[closest];
animTarget = walljumpleftkickanim;
velocity = DoRotation(facing, 0, -30, 0) * -8;
velocity.y = 4;
}
velocity = DoRotation(facing, 0, -30, 0) * -8;
velocity.y = 4;
}
animTarget = backhandspringanim;
frameTarget = 2;
emit_sound_at(landsound, coords, 128);
animTarget = backhandspringanim;
frameTarget = 2;
emit_sound_at(landsound, coords, 128);
coords.y = oldcoords.y;
//coords+=DoRotation(Animation::animations[animCurrent].offset,0,yaw,0)*scale;
targetoffset.y = coords.y;
coords.y = oldcoords.y;
//coords+=DoRotation(Animation::animations[animCurrent].offset,0,yaw,0)*scale;
targetoffset.y = coords.y;
currentoffset = DoRotation(Animation::animations[animCurrent].offset * -1, 0, yaw, 0) * scale;
currentoffset.y -= (coords.y - targetoffset.y);
coords.y = targetoffset.y;
currentoffset = DoRotation(Animation::animations[animCurrent].offset * -1, 0, yaw, 0) * scale;
currentoffset.y -= (coords.y - targetoffset.y);
coords.y = targetoffset.y;
oldtarget = target;
if (!transspeed && Animation::animations[animTarget].attack != 2 && Animation::animations[animTarget].attack != 3) {
if (!isRun() || !wasRun()) {
oldtarget = target;
if (!transspeed && Animation::animations[animTarget].attack != 2 && Animation::animations[animTarget].attack != 3) {
if (!isRun() || !wasRun()) {
/* FIXME - mixed of target and current here, is that intended? */
target += multiplier * Animation::animations[animTarget].frames[frameCurrent].speed * speed * 1.7 * tempspeed / (speed * 45 * scale);
}
/* FIXME - mixed of target and current here, is that intended? */
target += multiplier * Animation::animations[animTarget].frames[frameCurrent].speed * speed * 1.7 * tempspeed / (speed * 45 * scale);
}
speechdelay -= multiplier;
texupdatedelay -= multiplier;
interestdelay -= multiplier;
speechdelay -= multiplier;
texupdatedelay -= multiplier;
interestdelay -= multiplier;
OPENAL_SetVolume(channels[stream_firesound], 256 + 256 * findLength(&velocity) / 3);
if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) {
OPENAL_SetVolume(channels[stream_firesound], 256 + 256 * findLength(&velocity) / 3);
if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) {
if (bloodloss > damagetolerance && Animation::animations[animTarget].attack == neutral) {
if (weaponactive != -1) {
weapons[weaponids[0]].drop(velocity * scale * -.3, velocity * scale);
if (bloodloss > damagetolerance && Animation::animations[animTarget].attack == neutral) {
if (weaponactive != -1) {
weapons[weaponids[0]].drop(velocity * scale * -.3, velocity * scale);
for (int i = startx; i < endx; i++) {
for (int j = starty; j < endy; j++) {
if (Random() % 2 == 0) {
color = Random() % 85 + 170;
for (int i = startx; i < endx; i++) {
for (int j = starty; j < endy; j++) {
if (Random() % 2 == 0) {
color = Random() % 85 + 170;
skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 1] = 0;
skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 2] = 0;
}
skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 1] = 0;
skeleton.skinText[i * skeleton.skinsize * 3 + j * 3 + 2] = 0;
}
footvel = DoRotation(skeleton.specialforward[0], 0, yaw, 0) * -1;
footpoint = DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords;
}
footvel = DoRotation(skeleton.specialforward[0], 0, yaw, 0) * -1;
footpoint = DoRotation((jointPos(head) + jointPos(neck)) / 2, 0, yaw, 0) * scale + coords;
}
footvel = DoRotation(footvel, 0, 90, 0);
footvel = DoRotation(footvel, 0, 90, 0);
Sprite::MakeSprite(breathsprite, footpoint + footvel * .2, footvel * .4, 1, 1, 1, .4, .3);
}
}
Sprite::MakeSprite(breathsprite, footpoint + footvel * .2, footvel * .4, 1, 1, 1, .4, .3);
}
}
if (howactive <= typesleeping) {
if (tailmorphstart == 0 && tailmorphend == 0 && twitchdelay2 <= 0) {
tailmorphness = 0;
if (howactive <= typesleeping) {
if (tailmorphstart == 0 && tailmorphend == 0 && twitchdelay2 <= 0) {
tailmorphness = 0;
if (dead == 1 || howactive == typesleeping) {
unconscioustime += multiplier;
//If unconscious, close eyes and mouth
if (dead == 1 || howactive == typesleeping) {
unconscioustime += multiplier;
//If unconscious, close eyes and mouth
if (dead == 2 || howactive > typesleeping) {
//If dead, open mouth and hands
if (dead == 2 || howactive > typesleeping) {
//If dead, open mouth and hands
lefthandmorphend = 0;
targetlefthandmorphness = 1;
if (headmorphend != 3 && headmorphend != 5 && headmorphstart != 3 && headmorphstart != 5) {
lefthandmorphend = 0;
targetlefthandmorphness = 1;
if (headmorphend != 3 && headmorphend != 5 && headmorphstart != 3 && headmorphstart != 5) {
skeleton.DoGravity(&scale);
float damageamount;
damageamount = skeleton.DoConstraints(&coords, &scale) * 5;
skeleton.DoGravity(&scale);
float damageamount;
damageamount = skeleton.DoConstraints(&coords, &scale) * 5;
skeleton.longdead += (2000 - findLength(&average)) * multiplier + multiplier;
if (skeleton.longdead > 2000) {
if (skeleton.longdead > 6000) {
skeleton.longdead += (2000 - findLength(&average)) * multiplier + multiplier;
if (skeleton.longdead > 2000) {
if (skeleton.longdead > 6000) {
if (dead == 2 && bloodloss >= damagetolerance) {
XYZ headpoint;
headpoint = (jointPos(abdomen) + jointPos(neck)) / 2 * scale + coords;
if (dead == 2 && bloodloss >= damagetolerance) {
XYZ headpoint;
headpoint = (jointPos(abdomen) + jointPos(neck)) / 2 * scale + coords;
if (bloodtoggle && !bled) {
terrain.MakeDecal(blooddecalslow, headpoint, .8, .5, 0);
for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
if (bloodtoggle && !bled) {
terrain.MakeDecal(blooddecalslow, headpoint, .8, .5, 0);
for (unsigned int l = 0; l < terrain.patchobjects[whichpatchx][whichpatchz].size(); l++) {
for (unsigned int i = 0; i < Object::objects.size(); i++) {
if (Object::objects[i]->type != treeleavestype && Object::objects[i]->type != bushtype && Object::objects[i]->type != firetype) {
colviewer = startpoint;
coltarget = endpoint;
for (unsigned int i = 0; i < Object::objects.size(); i++) {
if (Object::objects[i]->type != treeleavestype && Object::objects[i]->type != bushtype && Object::objects[i]->type != firetype) {
colviewer = startpoint;
coltarget = endpoint;
- if (Object::objects[i]->model.LineCheck(&colviewer, &coltarget, &colpoint, &Object::objects[i]->position, &Object::objects[i]->yaw) != -1)
+ if (Object::objects[i]->model.LineCheck(&colviewer, &coltarget, &colpoint, &Object::objects[i]->position, &Object::objects[i]->yaw) != -1) {
if (findLength(&average) < 10 && !dead && skeleton.free) {
skeleton.longdead += (2000 - findLength(&average)) * multiplier + multiplier;
if (skeleton.longdead > (damage + 500) * 1.5) {
if (findLength(&average) < 10 && !dead && skeleton.free) {
skeleton.longdead += (2000 - findLength(&average)) * multiplier + multiplier;
if (skeleton.longdead > (damage + 500) * 1.5) {
for (unsigned i = 0; i < skeleton.joints.size(); i++) {
tempanimation.frames[0].joints[i].position = skeleton.joints[i].position;
for (unsigned i = 0; i < skeleton.joints.size(); i++) {
tempanimation.frames[0].joints[i].position = skeleton.joints[i].position;
if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
if (distsqflat(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 12 && distsq(&coords, &Object::objects[i]->position) < Object::objects[i]->scale * Object::objects[i]->scale * 49) {
if (onfire) {
if (!Object::objects[i]->onfire) {
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
Sprite::MakeSprite(splintersprite, pos, tempvel * .5 + velocity * float(abs(Random() % 100)) / 100, 165 / 255 + float(abs(Random() % 100) - 50) / 400, 0, 0, .2 + float(abs(Random() % 100) - 50) / 1300, 1);
Sprite::setLastSpriteSpecial(1);
}
Sprite::MakeSprite(splintersprite, pos, tempvel * .5 + velocity * float(abs(Random() % 100)) / 100, 165 / 255 + float(abs(Random() % 100) - 50) / 400, 0, 0, .2 + float(abs(Random() % 100) - 50) / 1300, 1);
Sprite::setLastSpriteSpecial(1);
}
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
Sprite::MakeSprite(splintersprite, pos, tempvel * .3 + velocity * float(abs(Random() % 100)) / 100 / 2, 1, 1, 1, .1, 1);
Sprite::setLastSpriteSpecial(2);
}
Sprite::MakeSprite(splintersprite, pos, tempvel * .3 + velocity * float(abs(Random() % 100)) / 100 / 2, 1, 1, 1, .1, 1);
Sprite::setLastSpriteSpecial(2);
}
}
Object::objects[i]->rotx += velocity.x * multiplier * 6;
Object::objects[i]->roty += velocity.z * multiplier * 6;
Object::objects[i]->messedwith = .5;
}
}
Object::objects[i]->rotx += velocity.x * multiplier * 6;
Object::objects[i]->roty += velocity.z * multiplier * 6;
Object::objects[i]->messedwith = .5;
}
tempcoord = coords - Object::objects[i]->position;
tempcoord = DoRotation(tempcoord, 0, -Object::objects[i]->yaw, 0);
tempcoord = DoRotation(tempcoord, -Object::objects[i]->pitch, 0, 0);
tempcoord = coords - Object::objects[i]->position;
tempcoord = DoRotation(tempcoord, 0, -Object::objects[i]->yaw, 0);
tempcoord = DoRotation(tempcoord, -Object::objects[i]->pitch, 0, 0);
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
Sprite::MakeSprite(splintersprite, pos, tempvel * .5 + velocity * float(abs(Random() % 100)) / 100, 165 / 255 + float(abs(Random() % 100) - 50) / 400, 0, 0, .2 + float(abs(Random() % 100) - 50) / 1300, 1);
Sprite::setLastSpriteSpecial(1);
}
Sprite::MakeSprite(splintersprite, pos, tempvel * .5 + velocity * float(abs(Random() % 100)) / 100, 165 / 255 + float(abs(Random() % 100) - 50) / 400, 0, 0, .2 + float(abs(Random() % 100) - 50) / 1300, 1);
Sprite::setLastSpriteSpecial(1);
}
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
for (int j = 0; j < howmany; j++) {
tempvel.x = float(abs(Random() % 100) - 50) / 20;
tempvel.y = float(abs(Random() % 100) - 50) / 20;
Sprite::MakeSprite(splintersprite, pos, tempvel * .3 + velocity * float(abs(Random() % 100)) / 100 / 2, 1, 1, 1, .1, 1);
Sprite::setLastSpriteSpecial(2);
}
Sprite::MakeSprite(splintersprite, pos, tempvel * .3 + velocity * float(abs(Random() % 100)) / 100 / 2, 1, 1, 1, .1, 1);
Sprite::setLastSpriteSpecial(2);
}
if (play && aitype != playercontrolled) {
int whichsound = -1;
if (speechdelay <= 0) {
unsigned int i = abs(Random() % 4);
if (creature == rabbittype) {
if (play && aitype != playercontrolled) {
int whichsound = -1;
if (speechdelay <= 0) {
unsigned int i = abs(Random() % 4);
if (creature == rabbittype) {
if (behind || animTarget == killanim || animTarget == knifethrowanim || animTarget == knifefollowanim || animTarget == spinkickreversalanim || animTarget == rabbitkickreversedanim || animTarget == jumpreversedanim) {
if (headmorphend != 4 || headmorphness == targetheadmorphness) {
headmorphend = 4;
if (behind || animTarget == killanim || animTarget == knifethrowanim || animTarget == knifefollowanim || animTarget == spinkickreversalanim || animTarget == rabbitkickreversedanim || animTarget == jumpreversedanim) {
if (headmorphend != 4 || headmorphness == targetheadmorphness) {
headmorphend = 4;
terrainnormal = terrain.getNormal(coords.x, coords.z);
if (Animation::animations[animTarget].attack != reversal) {
terrainnormal = terrain.getNormal(coords.x, coords.z);
if (Animation::animations[animTarget].attack != reversal) {
if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) {
flatvelocity = velocity;
flatvelocity.y = 0;
flatvelspeed = findLength(&flatvelocity);
targettilt = flatvelspeed * fast_sqrt(abs(velocity.y) * .7) * normaldotproduct(DoRotation(flatfacing, 0, -90, 0), flatvelocity);
targettilt2 = flatvelspeed * fast_sqrt(abs(velocity.y) * .7) * normaldotproduct(flatfacing, flatvelocity);
if (animTarget == jumpupanim || animTarget == jumpdownanim || isFlip()) {
flatvelocity = velocity;
flatvelocity.y = 0;
flatvelspeed = findLength(&flatvelocity);
targettilt = flatvelspeed * fast_sqrt(abs(velocity.y) * .7) * normaldotproduct(DoRotation(flatfacing, 0, -90, 0), flatvelocity);
targettilt2 = flatvelspeed * fast_sqrt(abs(velocity.y) * .7) * normaldotproduct(flatfacing, flatvelocity);
tilt2 -= multiplier * 400;
} else if (tilt2 < targettilt2) {
tilt2 += multiplier * 400;
}
if (!Animation::animations[animTarget].attack && animTarget != getupfrombackanim && animTarget != getupfromfrontanim) {
tilt2 -= multiplier * 400;
} else if (tilt2 < targettilt2) {
tilt2 += multiplier * 400;
}
if (!Animation::animations[animTarget].attack && animTarget != getupfrombackanim && animTarget != getupfromfrontanim) {
velocity.y += gravity * multiplier * 20;
ReflectVector(&velocity, terrain.getNormal(coords.x, coords.z));
velspeed = findLength(&velocity);
velocity.y += gravity * multiplier * 20;
ReflectVector(&velocity, terrain.getNormal(coords.x, coords.z));
velspeed = findLength(&velocity);
animTarget = getLanding();
emit_sound_at(landsound, coords, 128.);
animTarget = getLanding();
emit_sound_at(landsound, coords, 128.);
if (animTarget != jumpupanim && animTarget != jumpdownanim && !isFlip() && coords.y < terrain.getHeight(coords.x, coords.z)) {
coords.y = terrain.getHeight(coords.x, coords.z);
onterrain = 1;
if (animTarget != jumpupanim && animTarget != jumpdownanim && !isFlip() && coords.y < terrain.getHeight(coords.x, coords.z)) {
coords.y = terrain.getHeight(coords.x, coords.z);
onterrain = 1;
if (skiddingdelay > .02 && !forwardkeydown && !backkeydown && !leftkeydown && !rightkeydown && !jumpkeydown && isLanding() && !landhard) {
skiddingdelay = -1;
if (!onterrain || environment == grassyenvironment) {
if (skiddingdelay > .02 && !forwardkeydown && !backkeydown && !leftkeydown && !rightkeydown && !jumpkeydown && isLanding() && !landhard) {
skiddingdelay = -1;
if (!onterrain || environment == grassyenvironment) {
oldplayerdetail = playerdetail;
playerdetail = 0;
if (distsq(&viewer, &coords) < viewdistance * viewdistance / 32 && detail == 2) {
oldplayerdetail = playerdetail;
playerdetail = 0;
if (distsq(&viewer, &coords) < viewdistance * viewdistance / 32 && detail == 2) {
}
if (onterrain && (!cond1 && cond2) && !skeleton.free) {
IKHelper(this, 1 - target);
}
if (onterrain && (!cond1 && cond2) && !skeleton.free) {
IKHelper(this, 1 - target);
- if (!skeleton.free && (!Animation::animations[animTarget].attack && animTarget != getupfrombackanim && ((animTarget != rollanim && !isFlip()) || targetFrame().label == 6) && animTarget != getupfromfrontanim && animTarget != wolfrunninganim && animTarget != rabbitrunninganim && animTarget != backhandspringanim && animTarget != walljumpfrontanim && animTarget != hurtidleanim && !isLandhard() && !isSleeping()))
+ if (!skeleton.free && (!Animation::animations[animTarget].attack && animTarget != getupfrombackanim && ((animTarget != rollanim && !isFlip()) || targetFrame().label == 6) && animTarget != getupfromfrontanim && animTarget != wolfrunninganim && animTarget != rabbitrunninganim && animTarget != backhandspringanim && animTarget != walljumpfrontanim && animTarget != hurtidleanim && !isLandhard() && !isSleeping())) {
mid = (skeleton.muscles[i].parent1->position + skeleton.muscles[i].parent2->position) / 2;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
mid = (skeleton.muscles[i].parent1->position + skeleton.muscles[i].parent2->position) / 2;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glRotatef(tilt2, 1, 0, 0);
glRotatef(tilt2, 1, 0, 0);
glRotatef(tilt, 0, 0, 1);
glRotatef(tilt, 0, 0, 1);
XYZ& v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
XYZ& v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionbody.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionbody.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionbody.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionbody.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionbody.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionbody.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionarms.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionarms.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionarms.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionarms.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionarms.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionarms.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionlegs.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionlegs.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionlegs.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionlegs.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionlegs.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionlegs.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionhead.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionhead.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionhead.z);
glTranslatef((v0.x * (1 - morphness) + v1.x * morphness) * proportionhead.x,
(v0.y * (1 - morphness) + v1.y * morphness) * proportionhead.y,
(v0.z * (1 - morphness) + v1.z * morphness) * proportionhead.z);
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].x = M[12] * scale;
skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].y = M[13] * scale;
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].x = M[12] * scale;
skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].y = M[13] * scale;
glTranslatef(v0.x * proportionbody.x,
v0.y * proportionbody.y,
v0.z * proportionbody.z);
glTranslatef(v0.x * proportionbody.x,
v0.y * proportionbody.y,
v0.z * proportionbody.z);
glTranslatef(v0.x * proportionarms.x,
v0.y * proportionarms.y,
v0.z * proportionarms.z);
glTranslatef(v0.x * proportionarms.x,
v0.y * proportionarms.y,
v0.z * proportionarms.z);
glTranslatef(v0.x * proportionlegs.x,
v0.y * proportionlegs.y,
v0.z * proportionlegs.z);
glTranslatef(v0.x * proportionlegs.x,
v0.y * proportionlegs.y,
v0.z * proportionlegs.z);
glTranslatef(v0.x * proportionhead.x,
v0.y * proportionhead.y,
v0.z * proportionhead.z);
glTranslatef(v0.x * proportionhead.x,
v0.y * proportionhead.y,
v0.z * proportionhead.z);
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodellow.vertex[skeleton.muscles[i].verticeslow[j]].x = M[12] * scale;
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodellow.vertex[skeleton.muscles[i].verticeslow[j]].x = M[12] * scale;
glRotatef(tilt2, 1, 0, 0);
glRotatef(tilt2, 1, 0, 0);
glRotatef(tilt, 0, 0, 1);
glRotatef(tilt, 0, 0, 1);
glTranslatef(mid.x, mid.y, mid.z);
skeleton.muscles[i].lastrotate1 = skeleton.muscles[i].rotate1;
glRotatef(-skeleton.muscles[i].lastrotate1 + 90, 0, 1, 0);
glTranslatef(mid.x, mid.y, mid.z);
skeleton.muscles[i].lastrotate1 = skeleton.muscles[i].rotate1;
glRotatef(-skeleton.muscles[i].lastrotate1 + 90, 0, 1, 0);
XYZ& v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
XYZ& v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(v0.x * proportionbody.x,
v0.y * proportionbody.y,
v0.z * proportionbody.z);
glTranslatef(v0.x * proportionbody.x,
v0.y * proportionbody.y,
v0.z * proportionbody.z);
glTranslatef(v0.x * proportionarms.x,
v0.y * proportionarms.y,
v0.z * proportionarms.z);
glTranslatef(v0.x * proportionarms.x,
v0.y * proportionarms.y,
v0.z * proportionarms.z);
glTranslatef(v0.x * proportionlegs.x,
v0.y * proportionlegs.y,
v0.z * proportionlegs.z);
glTranslatef(v0.x * proportionlegs.x,
v0.y * proportionlegs.y,
v0.z * proportionlegs.z);
glTranslatef(v0.x * proportionhead.x,
v0.y * proportionhead.y,
v0.z * proportionhead.z);
glTranslatef(v0.x * proportionhead.x,
v0.y * proportionhead.y,
v0.z * proportionhead.z);
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].x = M[12] * scale;
skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].y = M[13] * scale;
glGetFloatv(GL_MODELVIEW_MATRIX, M);
skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].x = M[12] * scale;
skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].y = M[13] * scale;
terrainlight = terrain.getLighting(coords.x, coords.z);
distance = distsq(&viewer, &coords);
distance = (viewdistance * viewdistance - (distance - (viewdistance * viewdistance * fadestart)) * (1 / (1 - fadestart))) / viewdistance / viewdistance;
terrainlight = terrain.getLighting(coords.x, coords.z);
distance = distsq(&viewer, &coords);
distance = (viewdistance * viewdistance - (distance - (viewdistance * viewdistance * fadestart)) * (1 / (1 - fadestart))) / viewdistance / viewdistance;
glColor4f((1 - (1 - terrainlight.x) / terrainheight) - burnt, (1 - (1 - terrainlight.y) / terrainheight) - burnt, (1 - (1 - terrainlight.z) / terrainheight) - burnt, distance);
glDisable(GL_BLEND);
glColor4f((1 - (1 - terrainlight.x) / terrainheight) - burnt, (1 - (1 - terrainlight.y) / terrainheight) - burnt, (1 - (1 - terrainlight.z) / terrainheight) - burnt, distance);
glDisable(GL_BLEND);
if (Animation::animations[animTarget].attack == normalattack || Animation::animations[animTarget].attack == reversed) {
glDisable(GL_TEXTURE_2D);
glColor4f(1, 0, 0, 0.8);
}
if (Animation::animations[animTarget].attack == normalattack || Animation::animations[animTarget].attack == reversed) {
glDisable(GL_TEXTURE_2D);
glColor4f(1, 0, 0, 0.8);
}
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(0, -smoketex, 0);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(0, -smoketex, 0);
if (Animation::animations[animTarget].attack == normalattack || Animation::animations[animTarget].attack == reversed) {
glDisable(GL_TEXTURE_2D);
glColor4f(1, 0, 0, 0.8);
}
if (Animation::animations[animTarget].attack == normalattack || Animation::animations[animTarget].attack == reversed) {
glDisable(GL_TEXTURE_2D);
glColor4f(1, 0, 0, 0.8);
}
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(0, -smoketex * .6, 0);
glTranslatef(smoketex * .6, 0, 0);
if (playerdetail) {
if (!showpoints) {
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(0, -smoketex * .6, 0);
glTranslatef(smoketex * .6, 0, 0);
if (playerdetail) {
if (!showpoints) {
vec2 = (jointPos(rightwrist) - jointPos(rightshoulder));
CrossProduct(&vec1, &vec2, &tempnormthing);
Normalise(&tempnormthing);
vec2 = (jointPos(rightwrist) - jointPos(rightshoulder));
CrossProduct(&vec1, &vec2, &tempnormthing);
Normalise(&tempnormthing);
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;
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;
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;
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;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = -90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = -90;
weapons[i].smallrotation2 = 0;
}
if ((animCurrent == knifeslashreversalanim && animTarget == knifeslashreversalanim) || (animCurrent == knifeslashreversedanim && animTarget == knifeslashreversedanim)) {
XYZ temppoint1, temppoint2;
}
if ((animCurrent == knifeslashreversalanim && animTarget == knifeslashreversalanim) || (animCurrent == knifeslashreversedanim && animTarget == knifeslashreversedanim)) {
XYZ temppoint1, temppoint2;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
weapons[i].rotation3 = 0;
weapons[i].smallrotation = 90;
weapons[i].smallrotation2 = 0;
*p1 = DoRotation(*p1, 0, -*rotate, 0);
*p1 = DoRotation(*p1, 0, -*rotate, 0);
for (int i = 0; i < 4; i++) {
for (unsigned int j = 0; j < model->Triangles.size(); j++) {
if (model->Triangles[j].facenormal.y <= slopethreshold) {
for (int i = 0; i < 4; i++) {
for (unsigned int j = 0; j < model->Triangles.size(); j++) {
if (model->Triangles[j].facenormal.y <= slopethreshold) {
distance = abs((model->Triangles[j].facenormal.x * p1->x) + (model->Triangles[j].facenormal.y * p1->y) + (model->Triangles[j].facenormal.z * p1->z) - ((model->Triangles[j].facenormal.x * model->vertex[model->Triangles[j].vertex[0]].x) + (model->Triangles[j].facenormal.y * model->vertex[model->Triangles[j].vertex[0]].y) + (model->Triangles[j].facenormal.z * model->vertex[model->Triangles[j].vertex[0]].z)));
if (distance < radius) {
point = *p1 - model->Triangles[j].facenormal * distance;
distance = abs((model->Triangles[j].facenormal.x * p1->x) + (model->Triangles[j].facenormal.y * p1->y) + (model->Triangles[j].facenormal.z * p1->z) - ((model->Triangles[j].facenormal.x * model->vertex[model->Triangles[j].vertex[0]].x) + (model->Triangles[j].facenormal.y * model->vertex[model->Triangles[j].vertex[0]].y) + (model->Triangles[j].facenormal.z * model->vertex[model->Triangles[j].vertex[0]].z)));
if (distance < radius) {
point = *p1 - model->Triangles[j].facenormal * distance;
- if (PointInTriangle(&point, model->Triangles[j].facenormal, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]]))
+ if (PointInTriangle(&point, model->Triangles[j].facenormal, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]])) {
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[0]],
&model->vertex[model->Triangles[j].vertex[1]],
p1, &radius);
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[0]],
&model->vertex[model->Triangles[j].vertex[1]],
p1, &radius);
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[1]],
&model->vertex[model->Triangles[j].vertex[2]],
p1, &radius);
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[1]],
&model->vertex[model->Triangles[j].vertex[2]],
p1, &radius);
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[0]],
&model->vertex[model->Triangles[j].vertex[2]],
p1, &radius);
intersecting = sphere_line_intersection(&model->vertex[model->Triangles[j].vertex[0]],
&model->vertex[model->Triangles[j].vertex[2]],
p1, &radius);
if (LineFacetd(&start, &end, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]], &model->Triangles[j].facenormal, &point)) {
p1->y = point.y + radius;
if ((animTarget == jumpdownanim || isFlip())) {
if (LineFacetd(&start, &end, &model->vertex[model->Triangles[j].vertex[0]], &model->vertex[model->Triangles[j].vertex[1]], &model->vertex[model->Triangles[j].vertex[2]], &model->Triangles[j].facenormal, &point)) {
p1->y = point.y + radius;
if ((animTarget == jumpdownanim || isFlip())) {
animTarget = getLanding();
emit_sound_at(landsound, coords, 128.);
animTarget = getLanding();
emit_sound_at(landsound, coords, 128.);
distance = abs((model->Triangles[j].facenormal.x * start.x) + (model->Triangles[j].facenormal.y * start.y) + (model->Triangles[j].facenormal.z * start.z) - ((model->Triangles[j].facenormal.x * v0.x) + (model->Triangles[j].facenormal.y * v0.y) + (model->Triangles[j].facenormal.z * v0.z)));
if (distance < radius * .5) {
point = start - model->Triangles[j].facenormal * distance;
distance = abs((model->Triangles[j].facenormal.x * start.x) + (model->Triangles[j].facenormal.y * start.y) + (model->Triangles[j].facenormal.z * start.z) - ((model->Triangles[j].facenormal.x * v0.x) + (model->Triangles[j].facenormal.y * v0.y) + (model->Triangles[j].facenormal.z * v0.z)));
if (distance < radius * .5) {
point = start - model->Triangles[j].facenormal * distance;
- if (PointInTriangle(&point, model->Triangles[j].facenormal, &v0, &v1, &v2))
+ if (PointInTriangle(&point, model->Triangles[j].facenormal, &v0, &v1, &v2)) {
intersecting = sphere_line_intersection(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, p1->x, p1->y, p1->z, radius / 2);
intersecting = sphere_line_intersection(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, p1->x, p1->y, p1->z, radius / 2);
intersecting = sphere_line_intersection(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z, p1->x, p1->y, p1->z, radius / 2);
intersecting = sphere_line_intersection(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z, p1->x, p1->y, p1->z, radius / 2);
intersecting = sphere_line_intersection(v0.x, v0.y, v0.z, v2.x, v2.y, v2.z, p1->x, p1->y, p1->z, radius / 2);
intersecting = sphere_line_intersection(v0.x, v0.y, v0.z, v2.x, v2.y, v2.z, p1->x, p1->y, p1->z, radius / 2);
end = *p1 - point;
if (dotproduct(&model->Triangles[j].facenormal, &end) > 0 && intersecting) {
if ((animTarget == jumpdownanim || animTarget == jumpupanim || isFlip())) {
start = velocity;
velocity -= DoRotation(model->Triangles[j].facenormal, 0, *rotate, 0) * findLength(&velocity) * abs(normaldotproduct(velocity, DoRotation(model->Triangles[j].facenormal, 0, *rotate, 0))); //(distance-radius*.5)/multiplier;
end = *p1 - point;
if (dotproduct(&model->Triangles[j].facenormal, &end) > 0 && intersecting) {
if ((animTarget == jumpdownanim || animTarget == jumpupanim || isFlip())) {
start = velocity;
velocity -= DoRotation(model->Triangles[j].facenormal, 0, *rotate, 0) * findLength(&velocity) * abs(normaldotproduct(velocity, DoRotation(model->Triangles[j].facenormal, 0, *rotate, 0))); //(distance-radius*.5)/multiplier;
*p = DoRotation(*p, 0, *rotate, 0);
*p = DoRotation(*p, 0, *rotate, 0);
*p1 = DoRotation(*p1, 0, *rotate, 0);
*p1 = DoRotation(*p1, 0, *rotate, 0);
for (int j = 0; j < Game::numpathpoints; j++) {
if (j != last && j != last2 && j != last3 && j != last4) {
connected = 0;
for (int j = 0; j < Game::numpathpoints; j++) {
if (j != last && j != last2 && j != last3 && j != last4) {
connected = 0;
int bytesPerPixel = texture.bpp / 8;
int tempnum = 0;
alphanum = 255;
for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
int bytesPerPixel = texture.bpp / 8;
int tempnum = 0;
alphanum = 255;
for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
pause = 0;
if (distsqflat(&Person::players[0]->coords, &coords) < 30 &&
Person::players[0]->coords.y > coords.y + 2 &&
pause = 0;
if (distsqflat(&Person::players[0]->coords, &coords) < 30 &&
Person::players[0]->coords.y > coords.y + 2 &&
for (int j = 0; j < Game::numpathpoints; j++) {
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
DistancePointLine(&finalfinaltarget, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
for (int j = 0; j < Game::numpathpoints; j++) {
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
DistancePointLine(&finalfinaltarget, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
if (findDistance(&colpoint, &Game::pathpoint[j]) + findDistance(&colpoint, &Game::pathpoint[Game::pathpointconnect[j][k]]) <
findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
closestdistance = sq(tempdist);
closest = j;
finaltarget = colpoint;
}
if (findDistance(&colpoint, &Game::pathpoint[j]) + findDistance(&colpoint, &Game::pathpoint[Game::pathpointconnect[j][k]]) <
findDistance(&Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]]) + .1) {
closestdistance = sq(tempdist);
closest = j;
finaltarget = colpoint;
}
if (closest == -1 || (distsq(&coords, &Game::pathpoint[j]) < closestdistance)) {
closestdistance = distsq(&coords, &Game::pathpoint[j]);
closest = j;
}
if (closest == -1 || (distsq(&coords, &Game::pathpoint[j]) < closestdistance)) {
closestdistance = distsq(&coords, &Game::pathpoint[j]);
closest = j;
}
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
DistancePointLine(&coords, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
if (sq(tempdist) < closestdistance) {
for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
DistancePointLine(&coords, &Game::pathpoint[j], &Game::pathpoint[Game::pathpointconnect[j][k]], &tempdist, &colpoint);
if (sq(tempdist) < closestdistance) {
if (j != lastpathfindpoint &&
j != lastpathfindpoint2 &&
j != lastpathfindpoint3 &&
j != lastpathfindpoint4) {
bool connected = 0;
if (j != lastpathfindpoint &&
j != lastpathfindpoint2 &&
j != lastpathfindpoint3 &&
j != lastpathfindpoint4) {
bool connected = 0;
- if (Game::numpathpointconnect[j])
- for (int k = 0; k < Game::numpathpointconnect[j]; k++)
- if (Game::pathpointconnect[j][k] == lastpathfindpoint)
+ if (Game::numpathpointconnect[j]) {
+ for (int k = 0; k < Game::numpathpointconnect[j]; k++) {
+ if (Game::pathpointconnect[j][k] == lastpathfindpoint) {
- if (!connected)
- if (Game::numpathpointconnect[lastpathfindpoint])
- for (int k = 0; k < Game::numpathpointconnect[lastpathfindpoint]; k++)
- if (Game::pathpointconnect[lastpathfindpoint][k] == j)
+ }
+ }
+ }
+ if (!connected) {
+ if (Game::numpathpointconnect[lastpathfindpoint]) {
+ for (int k = 0; k < Game::numpathpointconnect[lastpathfindpoint]; k++) {
+ if (Game::pathpointconnect[lastpathfindpoint][k] == j) {
if (connected) {
tempdist = findPathDist(j, finalpathfindpoint);
if (closest == -1 || tempdist < closestdistance) {
if (connected) {
tempdist = findPathDist(j, finalpathfindpoint);
if (closest == -1 || tempdist < closestdistance) {
lastpathfindpoint3 = lastpathfindpoint2;
lastpathfindpoint2 = lastpathfindpoint;
lastpathfindpoint = targetpathfindpoint;
lastpathfindpoint3 = lastpathfindpoint2;
lastpathfindpoint2 = lastpathfindpoint;
lastpathfindpoint = targetpathfindpoint;
targetpathfindpoint = -1;
}
if (distsqflat(&coords, &finalfinaltarget) <
targetpathfindpoint = -1;
}
if (distsqflat(&coords, &finalfinaltarget) <
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
Animation::animations[Person::players[0]->animTarget].height != lowheight &&
!Game::editorenabled &&
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
Animation::animations[Person::players[0]->animTarget].height != lowheight &&
!Game::editorenabled &&
if (distsq(&coords, &Person::players[0]->coords) < 30 &&
Animation::animations[Person::players[0]->animTarget].height == highheight &&
if (distsq(&coords, &Person::players[0]->coords) < 30 &&
Animation::animations[Person::players[0]->animTarget].height == highheight &&
- for (unsigned j = 0; j < Person::players.size(); j++)
- if (j == 0 || Person::players[j]->skeleton.free || Person::players[j]->aitype != passivetype)
- if (abs(Random() % 2) || Animation::animations[Person::players[j]->animTarget].height != lowheight || j != 0)
- if (distsq(&coords, &Person::players[j]->coords) < 400)
- if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0)
- if (Person::players[j]->coords.y < coords.y + 5 || Person::players[j]->onterrain)
+ for (unsigned j = 0; j < Person::players.size(); j++) {
+ if (j == 0 || Person::players[j]->skeleton.free || Person::players[j]->aitype != passivetype) {
+ if (abs(Random() % 2) || Animation::animations[Person::players[j]->animTarget].height != lowheight || j != 0) {
+ if (distsq(&coords, &Person::players[j]->coords) < 400) {
+ if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0) {
+ if (Person::players[j]->coords.y < coords.y + 5 || Person::players[j]->onterrain) {
if (!Person::players[j]->isWallJump() && -1 == Object::checkcollide(DoRotation(jointPos(head), 0, yaw, 0) * scale + coords, DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0) * Person::players[j]->scale + Person::players[j]->coords) ||
(Person::players[j]->animTarget == hanganim &&
normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
if (!Person::players[j]->isWallJump() && -1 == Object::checkcollide(DoRotation(jointPos(head), 0, yaw, 0) * scale + coords, DoRotation(Person::players[j]->jointPos(head), 0, Person::players[j]->yaw, 0) * Person::players[j]->scale + Person::players[j]->coords) ||
(Person::players[j]->animTarget == hanganim &&
normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
if (aitype == passivetype) {
aiupdatedelay -= multiplier;
losupdatedelay -= multiplier;
lastseentime += multiplier;
pausetime -= multiplier;
if (aitype == passivetype) {
aiupdatedelay -= multiplier;
losupdatedelay -= multiplier;
lastseentime += multiplier;
pausetime -= multiplier;
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
- if (howactive <= typesleeping)
- if (numenvsounds > 0 && (!Tutorial::active || cananger) && hostile)
+ if (howactive <= typesleeping) {
+ if (numenvsounds > 0 && (!Tutorial::active || cananger) && hostile) {
for (int j = 0; j < numenvsounds; j++) {
float vol = howactive == typesleeping ? envsoundvol[j] - 14 : envsoundvol[j];
for (int j = 0; j < numenvsounds; j++) {
float vol = howactive == typesleeping ? envsoundvol[j] - 14 : envsoundvol[j];
distsq(&coords, &Person::players[0]->coords) < 400 &&
occluded < 25) {
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
distsq(&coords, &Person::players[0]->coords) < 400 &&
occluded < 25) {
if (distsq(&coords, &Person::players[0]->coords) < 12 &&
if (j == 0 || (Person::players[j]->dead && Person::players[j]->bloodloss > 0)) {
float smelldistance = 50;
if (j == 0 && Person::players[j]->num_weapons > 0) {
if (j == 0 || (Person::players[j]->dead && Person::players[j]->bloodloss > 0)) {
float smelldistance = 50;
if (j == 0 && Person::players[j]->num_weapons > 0) {
- if (Person::players[j]->num_weapons == 2)
- if (weapons[Person::players[j]->weaponids[1]].bloody)
+ }
+ if (Person::players[j]->num_weapons == 2) {
+ if (weapons[Person::players[j]->weaponids[1]].bloody) {
losupdatedelay = .2;
for (unsigned j = 0; j < Person::players.size(); j++) {
if (j == 0 || Person::players[j]->skeleton.free || Person::players[j]->aitype != passivetype) {
losupdatedelay = .2;
for (unsigned j = 0; j < Person::players.size(); j++) {
if (j == 0 || Person::players[j]->skeleton.free || Person::players[j]->aitype != passivetype) {
- if (abs(Random() % 2) || Animation::animations[Person::players[j]->animTarget].height != lowheight || j != 0)
- if (distsq(&coords, &Person::players[j]->coords) < 400)
- if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0)
+ if (abs(Random() % 2) || Animation::animations[Person::players[j]->animTarget].height != lowheight || j != 0) {
+ if (distsq(&coords, &Person::players[j]->coords) < 400) {
+ if (normaldotproduct(facing, Person::players[j]->coords - coords) > 0) {
if ((-1 == Object::checkcollide(
DoRotation(jointPos(head), 0, yaw, 0) *
scale +
if ((-1 == Object::checkcollide(
DoRotation(jointPos(head), 0, yaw, 0) *
scale +
(Person::players[j]->animTarget == hanganim &&
normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
lastseentime -= .2;
(Person::players[j]->animTarget == hanganim &&
normaldotproduct(Person::players[j]->facing, coords - Person::players[j]->coords) < 0)) {
lastseentime -= .2;
if (aitype == searchtype) {
aiupdatedelay -= multiplier;
losupdatedelay -= multiplier;
if (aitype == searchtype) {
aiupdatedelay -= multiplier;
losupdatedelay -= multiplier;
XYZ test = coords + facing;
test.y -= 10;
j = Object::checkcollide(test2, test, laststanding);
XYZ test = coords + facing;
test.y -= 10;
j = Object::checkcollide(test2, test, laststanding);
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
for (int k = 0; k < numenvsounds; k++) {
if (distsq(&coords, &envsound[k]) < 2 * (envsoundvol[k] + envsoundvol[k] * (creature == rabbittype) * 3)) {
aitype = attacktypecutoff;
}
}
for (int k = 0; k < numenvsounds; k++) {
if (distsq(&coords, &envsound[k]) < 2 * (envsoundvol[k] + envsoundvol[k] * (creature == rabbittype) * 3)) {
aitype = attacktypecutoff;
}
}
- if (distsq(&coords, &Person::players[0]->coords) < 400)
- if (normaldotproduct(facing, Person::players[0]->coords - coords) > 0)
+ if (distsq(&coords, &Person::players[0]->coords) < 400) {
+ if (normaldotproduct(facing, Person::players[0]->coords - coords) > 0) {
if ((Object::checkcollide(
DoRotation(jointPos(head), 0, yaw, 0) *
scale +
if ((Object::checkcollide(
DoRotation(jointPos(head), 0, yaw, 0) *
scale +
XYZ flatfacing = Person::players[ally]->coords;
facing.y += jointPos(head).y * scale;
flatfacing.y += Person::players[ally]->jointPos(head).y * Person::players[ally]->scale;
XYZ flatfacing = Person::players[ally]->coords;
facing.y += jointPos(head).y * scale;
flatfacing.y += Person::players[ally]->jointPos(head).y * Person::players[ally]->scale;
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
if (weapons[k].owner == -1) {
float distance = distsq(&coords, &weapons[k].position);
if (closestdist == -1 || distance < closestdist) {
if (weapons[k].owner == -1) {
float distance = distsq(&coords, &weapons[k].position);
if (closestdist == -1 || distance < closestdist) {
if (ally >= 0) {
if (weapons[ally].owner != -1 ||
distsq(&coords, &weapons[ally].position) > 16) {
if (ally >= 0) {
if (weapons[ally].owner != -1 ||
distsq(&coords, &weapons[ally].position) > 16) {
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
XYZ leftpos, rightpos;
float leftdist, rightdist;
leftpos = coords + DoRotation(facing, 0, 90, 0);
rightpos = coords - DoRotation(facing, 0, 90, 0);
leftdist = distsq(&leftpos, &avoidwhere);
rightdist = distsq(&rightpos, &avoidwhere);
}
if (aitype == attacktypecutoff) {
aiupdatedelay -= multiplier;
//dodge or reverse rabbit kicks, knife throws, flips
}
if (aitype == attacktypecutoff) {
aiupdatedelay -= multiplier;
//dodge or reverse rabbit kicks, knife throws, flips
if ((Person::players[0]->animTarget == rabbitkickanim ||
Person::players[0]->animTarget == knifethrowanim ||
(Person::players[0]->isFlip() &&
if ((Person::players[0]->animTarget == rabbitkickanim ||
Person::players[0]->animTarget == knifethrowanim ||
(Person::players[0]->isFlip() &&
if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
if (isIdle() || isCrouch() || isRun() || isFlip()) {
if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
if (isIdle() || isCrouch() || isRun() || isFlip()) {
//get confused by flips
if (Person::players[0]->isFlip() &&
!Person::players[0]->skeleton.free &&
Person::players[0]->animTarget != walljumprightkickanim &&
Person::players[0]->animTarget != walljumpleftkickanim) {
//get confused by flips
if (Person::players[0]->isFlip() &&
!Person::players[0]->skeleton.free &&
Person::players[0]->animTarget != walljumprightkickanim &&
Person::players[0]->animTarget != walljumpleftkickanim) {
- if (distsq(&Person::players[0]->coords, &coords) < 25)
- if ((1 - damage / damagetolerance) > .5)
+ if (distsq(&Person::players[0]->coords, &coords) < 25) {
+ if ((1 - damage / damagetolerance) > .5) {
- if (wentforweapon < 3)
- for (unsigned k = 0; k < weapons.size(); k++)
- if (creature != wolftype)
+ if (wentforweapon < 3) {
+ for (unsigned k = 0; k < weapons.size(); k++) {
+ if (creature != wolftype) {
if (damage < damagetolerance * .5 &&
((Person::players[0]->animTarget == walljumprightkickanim ||
Person::players[0]->animTarget == walljumpleftkickanim) &&
if (damage < damagetolerance * .5 &&
((Person::players[0]->animTarget == walljumprightkickanim ||
Person::players[0]->animTarget == walljumpleftkickanim) &&
if (coords.y > terrain.getHeight(coords.x, coords.z) + 10) {
XYZ test2 = coords + facing;
test2.y += 5;
XYZ test = coords + facing;
test.y -= 10;
j = Object::checkcollide(test2, test, laststanding);
if (coords.y > terrain.getHeight(coords.x, coords.z) + 10) {
XYZ test2 = coords + facing;
test2.y += 5;
XYZ test = coords + facing;
test.y -= 10;
j = Object::checkcollide(test2, test, laststanding);
//lose sight of player in the air (?)
if (Person::players[0]->coords.y > coords.y + 5 &&
Animation::animations[Person::players[0]->animTarget].height != highheight &&
//lose sight of player in the air (?)
if (Person::players[0]->coords.y > coords.y + 5 &&
Animation::animations[Person::players[0]->animTarget].height != highheight &&
rabbitkickenabled = Random() % 2;
//chase player
XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity;
XYZ targetpoint = Person::players[0]->coords;
if (distsq(&Person::players[0]->coords, &coords) <
rabbitkickenabled = Random() % 2;
//chase player
XYZ rotatetarget = Person::players[0]->coords + Person::players[0]->velocity;
XYZ targetpoint = Person::players[0]->coords;
if (distsq(&Person::players[0]->coords, &coords) <
targetpoint += Person::players[0]->velocity *
findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity);
targetpoint += Person::players[0]->velocity *
findDistance(&Person::players[0]->coords, &coords) / findLength(&velocity);
targetyaw = roughDirectionTo(coords, targetpoint);
lookyaw = targetyaw;
aiupdatedelay = .2 + fabs((float)(Random() % 100) / 1000);
targetyaw = roughDirectionTo(coords, targetpoint);
lookyaw = targetyaw;
aiupdatedelay = .2 + fabs((float)(Random() % 100) / 1000);
- else if ((distsq(&coords, &Person::players[0]->coords) > 16 ||
- distsq(&coords, &Person::players[0]->coords) < 9) &&
- Person::players[0]->weaponactive != -1)
+ } else if ((distsq(&coords, &Person::players[0]->coords) > 16 ||
+ distsq(&coords, &Person::players[0]->coords) < 9) &&
+ Person::players[0]->weaponactive != -1) {
if (j != id && !Person::players[j]->skeleton.free &&
Person::players[j]->hasvictim &&
(Tutorial::active && reversaltrain ||
if (j != id && !Person::players[j]->skeleton.free &&
Person::players[j]->hasvictim &&
(Tutorial::active && reversaltrain ||
Person::players[j]->animTarget == swordslashanim &&
weaponactive != -1 ||
Person::players[j]->animTarget == staffhitanim ||
Person::players[j]->animTarget == swordslashanim &&
weaponactive != -1 ||
Person::players[j]->animTarget == staffhitanim ||
if (distsq(&Person::players[j]->coords, &Person::players[j]->victim->coords) < 4 &&
Person::players[j]->victim == Person::players[id] &&
(Person::players[j]->animTarget == sweepanim ||
if (distsq(&Person::players[j]->coords, &Person::players[j]->victim->coords) < 4 &&
Person::players[j]->victim == Person::players[id] &&
(Person::players[j]->animTarget == sweepanim ||
if (collided > .8 && jumppower >= 5 ||
distsq(&coords, &Person::players[0]->coords) > 400 &&
onterrain &&
if (collided > .8 && jumppower >= 5 ||
distsq(&coords, &Person::players[0]->coords) > 400 &&
onterrain &&
XYZ facing = coords;
XYZ flatfacing = Person::players[0]->coords;
facing.y += jointPos(head).y * scale;
flatfacing.y += Person::players[0]->jointPos(head).y * Person::players[0]->scale;
XYZ facing = coords;
XYZ flatfacing = Person::players[0]->coords;
facing.y += jointPos(head).y * scale;
flatfacing.y += Person::players[0]->jointPos(head).y * Person::players[0]->scale;
}
}
if (Animation::animations[Person::players[0]->animTarget].height == highheight &&
(aitype == attacktypecutoff ||
}
}
if (Animation::animations[Person::players[0]->animTarget].height == highheight &&
(aitype == attacktypecutoff ||
if (Person::players[0]->coords.y > terrain.getHeight(Person::players[0]->coords.x, Person::players[0]->coords.z) + 10) {
XYZ test = Person::players[0]->coords;
test.y -= 40;
if (Person::players[0]->coords.y > terrain.getHeight(Person::players[0]->coords.x, Person::players[0]->coords.z) + 10) {
XYZ test = Person::players[0]->coords;
test.y -= 40;