*/
void Person::DoDamage(float howmuch)
{
- // subtract health (temporary?)
- if (!Tutorial::active)
- damage += howmuch / power;
// stats?
- if (id != 0)
- damagedealt += howmuch / power;
- if (id == 0)
+ if (id == 0) {
damagetaken += howmuch / power;
+ } else {
+ damagedealt += howmuch / power;
+ }
// reset bonuses
- if (id == 0 && (bonus == solidhit || bonus == twoxcombo || bonus == threexcombo || bonus == fourxcombo || bonus == megacombo))
+ if (id == 0 && (bonus == solidhit || bonus == twoxcombo || bonus == threexcombo || bonus == fourxcombo || bonus == megacombo)) {
bonus = 0;
+ }
+
// subtract health
- if (!Tutorial::active)
+ if (!Tutorial::active) {
+ damage += howmuch / power;
permanentdamage += howmuch / 2 / power;
- if (!Tutorial::active)
superpermanentdamage += howmuch / 4 / power;
+ }
// visual effects
if (permanentdamage > damagetolerance / 2 && permanentdamage - howmuch < damagetolerance / 2 && Random() % 2)
DoBlood(1, 255);
if ((permanentdamage > damagetolerance * .8 && Random() % 2 && !deathbleeding) || spurt)
DoBlood(1, 255);
spurt = 0;
- if (id == 0)
+ if (id == 0) {
camerashake += howmuch / 100;
- if (id == 0 && ((howmuch > 50 && damage > damagetolerance / 2)))
- blackout = damage / damagetolerance;
- if (blackout > 1)
- blackout = 1;
+ if ((howmuch > 50 && damage > damagetolerance / 2)) {
+ blackout = damage / damagetolerance;
+ if (blackout > 1) {
+ blackout = 1;
+ }
+ }
+ }
// cancel attack?
if (aitype == passivetype && damage < damagetolerance && ((!Tutorial::active || cananger) && hostile))
}
// play sounds
- if (!Tutorial::active || id == 0)
+ if (!Tutorial::active || id == 0) {
if (speechdelay <= 0 && !dead && aitype != playercontrolled) {
int whichsound = -1;
addEnvSound(coords);
}
}
+ }
speechdelay = .3;
}
vel[2] = velocity.z;
if (id == 0) {
- OPENAL_3D_SetAttributes(channels[whooshsound], gLoc, vel);
+ OPENAL_3D_SetAttributes(channels[whooshsound], gLoc);
OPENAL_SetVolume(channels[whooshsound], 64 * findLength(&velocity) / 5);
}
if (((velocity.y < -15) || (crouchkeydown && velocity.y < -8)) && abs(velocity.y) * 4 > fast_sqrt(velocity.x * velocity.x * velocity.z * velocity.z))
if (hasvictim)
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 (!Tutorial::active) {
victim->DoBloodBig(1.5 / victim->armorhigh, 225);
+ }
award_bonus(id, Slicebonus);
if (!Tutorial::active) {
if (aitype != playercontrolled)
weaponmissdelay = .6;
- if (!Tutorial::active)
- if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody)
+ if (!Tutorial::active) {
+ if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody) {
weapons[weaponids[weaponactive]].bloody = 1;
- if (!Tutorial::active)
+ }
weapons[weaponids[weaponactive]].blooddrip += 3;
+ }
XYZ footvel, footpoint;
footvel = 0;
} else {
footpoint = DoRotation((victim->jointPos(abdomen) + victim->jointPos(neck)) / 2, 0, victim->yaw, 0) * victim->scale + victim->coords;
}
- if (!Tutorial::active) {
- if (bloodtoggle)
+ if (Tutorial::active) {
+ Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 1, 1, .6, .3);
+ } else {
+ if (bloodtoggle) {
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .6, .3);
+ }
footvel = DoRotation(facing, 0, 90, 0) * .8;
- //footvel.y-=.3;
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(bloodflamesprite, footpoint, footvel * 5, 1, 1, 1, .2, 1);
Sprite::MakeSprite(bloodflamesprite, footpoint, footvel * 2, 1, 1, 1, .2, 1);
}
- if (Tutorial::active) {
- Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 1, 1, .6, .3);
- }
victim->DoDamage(damagemult * 0);
}
}
victim->DoBloodBig(2 / victim->armorhigh, 185);
victim->deathbleeding = 1;
emit_sound_at(swordslicesound, victim->coords);
- }
- //victim->jointVel(abdomen)+=relative*damagemult*200;
- if (!Tutorial::active) {
victim->frameTarget = 0;
victim->animTarget = staggerbackhardanim;
victim->targetyaw = targetyaw + 180;
victim->target = 0;
- }
-
- if (!Tutorial::active) {
- if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody)
+ if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody) {
weapons[weaponids[weaponactive]].bloody = 1;
+ }
weapons[weaponids[weaponactive]].blooddrip += 3;
float bloodlossamount;
bloodlossamount = 200 + abs((float)(Random() % 40)) - 20;
victim->bloodloss += bloodlossamount / victim->armorhigh;
- //victim->bloodloss+=100*(6.5-distsq(&coords,&victim->coords));
victim->DoDamage(damagemult * 0);
XYZ footvel, footpoint;
} else {
footpoint = DoRotation((victim->jointPos(abdomen) + victim->jointPos(neck)) / 2, 0, victim->yaw, 0) * victim->scale + victim->coords;
}
- if (bloodtoggle)
+ if (bloodtoggle) {
Sprite::MakeSprite(cloudimpactsprite, footpoint, footvel, 1, 0, 0, .9, .3);
+ }
footvel = DoRotation(facing, 0, 90, 0) * .8;
footvel.y -= .3;
Sprite::MakeSprite(bloodsprite, footpoint, DoRotation(footvel * 7, (float)(Random() % 20), (float)(Random() % 20), 0), 1, 1, 1, .05, .9);
static XYZ flatfacing;
static XYZ flatvelocity;
static float flatvelspeed;
- static int i, l;
+ static int l;
static int bloodsize;
static int startx, starty, endx, endy;
static GLubyte color;
vel[2] = velocity.z;
if (id == 0) {
- OPENAL_3D_SetAttributes(channels[whooshsound], gLoc, vel);
+ OPENAL_3D_SetAttributes(channels[whooshsound], gLoc);
OPENAL_SetVolume(channels[whooshsound], 64 * findLength(&velocity) / 5);
}
}
if (endy < starty)
endy = starty;
- for (i = startx; i < endx; i++) {
+ for (int i = startx; i < endx; i++) {
for (int j = starty; j < endy; j++) {
if (Random() % 2 == 0) {
color = Random() % 85 + 170;
}
}
- if (dead != 1)
+ if (dead != 1) {
unconscioustime = 0;
+ }
if (dead == 1 || howactive == typesleeping) {
unconscioustime += multiplier;
damage += 20;
}
- if (!dead)
+ if (!dead) {
damage -= multiplier * 13;
- if (!dead)
permanentdamage -= multiplier * 4;
- if (isIdle() || isCrouch()) {
- if (!dead)
+ if (isIdle() || isCrouch()) {
permanentdamage -= multiplier * 4;
+ }
}
if (damage < 0)
damage = 0;
canrecover = 0;
if (velocity.y < -30)
canrecover = 0;
- for (i = 0; i < Object::objects.size(); i++) {
+ 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 (aitype != passivetype || skeleton.free == 1)
if (findLengthfast(&velocity) > .1)
- for (i = 0; i < Object::objects.size(); i++) {
+ for (unsigned int i = 0; i < Object::objects.size(); i++) {
if (Object::objects[i]->type == firetype)
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) {
play = 0;
if (play && aitype != playercontrolled) {
int whichsound = -1;
- i = abs(Random() % 4);
if (speechdelay <= 0) {
+ unsigned int i = abs(Random() % 4);
if (creature == rabbittype) {
if (i == 0)
whichsound = rabbitchitter;
}
}
- if (animTarget == spinkickanim || animTarget == staffspinhitreversalanim || animTarget == staffspinhitreversedanim || animTarget == staffhitreversalanim || animTarget == staffhitreversedanim || animTarget == hurtidleanim || animTarget == winduppunchanim || animTarget == swordslashreversalanim || animTarget == swordslashreversedanim || animTarget == knifeslashreversalanim || animTarget == knifeslashreversedanim || animTarget == knifethrowanim || animTarget == knifefollowanim || animTarget == knifefollowedanim || animTarget == killanim || animTarget == dropkickanim || animTarget == upunchanim || animTarget == knifeslashstartanim || animTarget == swordslashanim || animTarget == staffhitanim || animTarget == staffspinhitanim || animTarget == staffgroundsmashanim || animTarget == spinkickreversalanim || animTarget == sweepreversalanim || animTarget == lowkickanim || animTarget == sweepreversedanim || animTarget == rabbitkickreversalanim || animTarget == rabbitkickreversedanim || animTarget == jumpreversalanim || animTarget == jumpreversedanim) {
+ if (animTarget == spinkickanim ||
+ animTarget == staffspinhitreversalanim ||
+ animTarget == staffspinhitreversedanim ||
+ animTarget == staffhitreversalanim ||
+ animTarget == staffhitreversedanim ||
+ animTarget == hurtidleanim ||
+ animTarget == winduppunchanim ||
+ animTarget == swordslashreversalanim ||
+ animTarget == swordslashreversedanim ||
+ animTarget == knifeslashreversalanim ||
+ animTarget == knifeslashreversedanim ||
+ animTarget == knifethrowanim ||
+ animTarget == knifefollowanim ||
+ animTarget == knifefollowedanim ||
+ animTarget == killanim ||
+ animTarget == dropkickanim ||
+ animTarget == upunchanim ||
+ animTarget == knifeslashstartanim ||
+ animTarget == swordslashanim ||
+ animTarget == staffhitanim ||
+ animTarget == staffspinhitanim ||
+ animTarget == staffgroundsmashanim ||
+ animTarget == spinkickreversalanim ||
+ animTarget == sweepreversalanim ||
+ animTarget == lowkickanim ||
+ animTarget == sweepreversedanim ||
+ animTarget == rabbitkickreversalanim ||
+ animTarget == rabbitkickreversedanim ||
+ animTarget == jumpreversalanim ||
+ animTarget == jumpreversedanim) {
//close hands and yell
- if (righthandmorphend != 1 && righthandmorphness == targetrighthandmorphness) {
+ if (righthandmorphend != 1 &&
+ righthandmorphness == targetrighthandmorphness) {
righthandmorphness = 0;
righthandmorphend = 1;
targetrighthandmorphness = 1;
}
- if (lefthandmorphend != 1 && lefthandmorphness == targetlefthandmorphness) {
+ if (lefthandmorphend != 1 &&
+ lefthandmorphness == targetlefthandmorphness) {
lefthandmorphness = 0;
lefthandmorphend = 1;
targetlefthandmorphness = 1;
ReflectVector(&facing, terrainnormal);
Normalise(&facing);
- if (isRun() || animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
+ if (isRun() ||
+ animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
if (onterrain)
targettilt2 = -facing.y * 20;
else
int findPathDist(int start, int end)
{
- int smallestcount, count, connected;
- int last, last2, last3, last4;
+ int connected;
int closest;
- smallestcount = 1000;
- for (int i = 0; i < 50; i++) {
- count = 0;
- last = start;
- last2 = -1;
- last3 = -1;
- last4 = -1;
+ unsigned int smallestcount = 1000;
+ for (char i = 0; i < 50; i++) {
+ unsigned int count = 0;
+ int last = start;
+ int last2 = -1;
+ int last3 = -1;
+ int last4 = -1;
while (last != end && count < 30) {
closest = -1;
for (int j = 0; j < Game::numpathpoints; j++) {
last = closest;
count++;
}
- if (count < smallestcount)
+ if (count < smallestcount) {
smallestcount = count;
+ }
}
return smallestcount;
}