distsq(&position, &player[j].coords) < 4 && player[j].weaponstuck == -1 &&
!player[j].skeleton.free && j != oldowner) {
if ((player[j].aitype != attacktypecutoff || abs(Random() % 6) == 0 || (player[j].animTarget != backhandspringanim && player[j].animTarget != rollanim && player[j].animTarget != flipanim && Random() % 2 == 0)) && !missed) {
- if ( (player[j].creature == wolftype && Random() % 3 != 0 && player[j].weaponactive == -1 && (player[j].isIdle() || player[j].isRun() || player[j].animTarget == walkanim)) ||
- (player[j].creature == rabbittype && Random() % 2 == 0 && player[j].aitype == attacktypecutoff && player[j].weaponactive == -1)) {
+ if ( (player[j].creature == wolftype && Random() % 3 != 0 && player[j].weaponactive == -1 && (player[j].isIdle() || player[j].isRun() || player[j].animTarget == walkanim)) ||
+ (player[j].creature == rabbittype && Random() % 2 == 0 && player[j].aitype == attacktypecutoff && player[j].weaponactive == -1)) {
emit_sound_at(knifedrawsound, player[j].coords, 128.);
player[j].weaponactive = 0;
player[j].aitype = attacktypecutoff;
} else {
- if (j != 0) numthrowkill++;
+ if (j != 0)
+ numthrowkill++;
player[j].num_weapons++;
player[j].weaponstuck = player[j].num_weapons - 1;
if (normaldotproduct(player[j].facing, velocity) > 0)
else
award_bonus(0, Bullseyebonus);
}
- } else missed = 1;
+ } else {
+ missed = 1;
+ }
}
}
}
terrain.MakeDecal(shadowdecalpermanent, position, .06, .5, 0);
normalrot = terrain.getNormal(position.x, position.z) * -1;
velocity = 0;
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
GLfloat M[16];
glLoadIdentity();
bigtilt = 0;
bigtilt2 = 0;
bigrotation = 0;
- if (temppoint1.x > temppoint2.x) rotation1 = 360 - rotation1;
+ if (temppoint1.x > temppoint2.x)
+ rotation1 = 360 - rotation1;
}
}
bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
tippoint += terrainnormal * .002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&velocity, &terrainnormal);
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&tipvelocity, &terrainnormal);
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
ReflectVector(&velocity, &terrainnormal);
position += terrainnormal * .002;
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
- if (terrain.getOpacity(position.x, position.z) < .2)velocity += bounceness * elasticity * .3;
- else velocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
+ if (terrain.getOpacity(position.x, position.z) < .2)
+ velocity += bounceness * elasticity * .3;
+ else
+ velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
ReflectVector(&tipvelocity, &terrainnormal);
tippoint += terrainnormal * .002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
- if (terrain.getOpacity(tippoint.x, tippoint.z) < .2)tipvelocity += bounceness * elasticity * .3;
- else tipvelocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
+ if (terrain.getOpacity(tippoint.x, tippoint.z) < .2)
+ tipvelocity += bounceness * elasticity * .3;
+ else
+ tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
ReflectVector(&velocity, &terrainnormal);
//mid+=terrainnormal*.002;
bounceness = terrainnormal * findLength(&velocity) * (abs(normaldotproduct(velocity, terrainnormal)));
- if (findLengthfast(&velocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&velocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(velocity, terrainnormal));
velocity -= bounceness;
- if (1 - friction * frictionness > 0)velocity *= 1 - friction * frictionness;
- else velocity = 0;
- if (terrain.getOpacity(mid.x, mid.z) < .2)velocity += bounceness * elasticity * .3;
- else velocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ velocity *= 1 - friction * frictionness;
+ else
+ velocity = 0;
+ if (terrain.getOpacity(mid.x, mid.z) < .2)
+ velocity += bounceness * elasticity * .3;
+ else
+ velocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
if (terrain.getOpacity(mid.x, mid.z) > .2) {
- if (type == staff)whichsound = footstepsound3 + abs(Random() % 2);
- if (type != staff)whichsound = clank1sound + abs(Random() % 4);
- } else whichsound = footstepsound + abs(Random() % 2);
+ if (type == staff)
+ whichsound = footstepsound3 + abs(Random() % 2);
+ if (type != staff)
+ whichsound = clank1sound + abs(Random() % 4);
+ } else {
+ whichsound = footstepsound + abs(Random() % 2);
+ }
emit_sound_at(whichsound, mid,
findLengthfast(&bounceness)
* (terrain.getOpacity(position.x, position.z) > .2
ReflectVector(&tipvelocity, &terrainnormal);
//mid+=terrainnormal*.002;
bounceness = terrainnormal * findLength(&tipvelocity) * (abs(normaldotproduct(tipvelocity, terrainnormal)));
- if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))bounceness = 0;
+ if (findLengthfast(&tipvelocity) < findLengthfast(&bounceness))
+ bounceness = 0;
frictionness = abs(normaldotproduct(tipvelocity, terrainnormal));
tipvelocity -= bounceness;
- if (1 - friction * frictionness > 0)tipvelocity *= 1 - friction * frictionness;
- else tipvelocity = 0;
- if (terrain.getOpacity(mid.x, mid.z) < .2)tipvelocity += bounceness * elasticity * .3;
- else tipvelocity += bounceness * elasticity;
+ if (1 - friction * frictionness > 0)
+ tipvelocity *= 1 - friction * frictionness;
+ else
+ tipvelocity = 0;
+ if (terrain.getOpacity(mid.x, mid.z) < .2)
+ tipvelocity += bounceness * elasticity * .3;
+ else
+ tipvelocity += bounceness * elasticity;
if (findLengthfast(&bounceness) > 1) {
int whichsound;
if (terrain.getOpacity(mid.x, mid.z) > .2) {
- if (type == staff)whichsound = footstepsound3 + abs(Random() % 2);
- if (type != staff)whichsound = clank1sound + abs(Random() % 4);
- } else whichsound = footstepsound + abs(Random() % 2);
+ if (type == staff)
+ whichsound = footstepsound3 + abs(Random() % 2);
+ if (type != staff)
+ whichsound = clank1sound + abs(Random() % 4);
+ } else {
+ whichsound = footstepsound + abs(Random() % 2);
+ }
emit_sound_at(whichsound, mid,
findLengthfast(&bounceness)
* (terrain.getOpacity(position.x, position.z) > .2
bigtilt = 0;
bigtilt2 = 0;
bigrotation = 0;
- if (temppoint1.x > temppoint2.x)rotation1 = 360 - rotation1;
+ if (temppoint1.x > temppoint2.x)
+ rotation1 = 360 - rotation1;
//Stop moving
if (findLengthfast(&velocity) < .3 && findLengthfast(&tipvelocity) < .3 && hitsomething) {
if (blooddrip && bloody) {
blooddripdelay -= blooddrip * multiplier / 2;
blooddrip -= multiplier;
- if (blooddrip < 0) blooddrip = 0;
- if (blooddrip > 5) blooddrip = 5;
+ if (blooddrip < 0)
+ blooddrip = 0;
+ if (blooddrip > 5)
+ blooddrip = 5;
if (blooddripdelay < 0 && bloodtoggle) {
blooddripdelay = 1;
XYZ bloodvel;
if (player[owner].occluded < 25)
if ((frustum.SphereInFrustum(player[owner].coords.x, player[owner].coords.y + player[owner].scale * 3, player[owner].coords.z, player[owner].scale * 8) && distsq(&viewer, &player[owner].coords) < viewdistance * viewdistance) || player[owner].skeleton.free == 3)
draw = true;
- if (
+ if (
(player[owner].animTarget == knifeslashstartanim ||
player[owner].animTarget == swordsneakattackanim ||
- (player[owner].animCurrent == staffhitanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffhitreversedanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffspinhitanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffspinhitreversedanim && player[owner].frameCurrent > 1) ||
- (player[owner].animCurrent == staffgroundsmashanim && player[owner].frameCurrent > 1) ||
- (player[owner].animTarget == swordslashanim && player[owner].frameTarget < 7) ||
+ (player[owner].animCurrent == staffhitanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffhitreversedanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffspinhitanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffspinhitreversedanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animCurrent == staffgroundsmashanim && player[owner].frameCurrent > 1) ||
+ (player[owner].animTarget == swordslashanim && player[owner].frameTarget < 7) ||
player[owner].animTarget == crouchstabanim ||
player[owner].animTarget == swordslashreversalanim ||
player[owner].animTarget == swordslashreversedanim ||
glAlphaFunc(GL_GREATER, 0.01);
}
for (int j = drawhowmany; j > 0; j--) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glColor4f(terrainlight.x, terrainlight.y, terrainlight.z, j / drawhowmany);
if (owner == -1)
lastdrawnbigtilt2 = bigtilt2;
lastdrawnsmallrotation = smallrotation;
lastdrawnsmallrotation2 = smallrotation2;
- if (owner != -1)lastdrawnanim = player[owner].animCurrent;
+ if (owner != -1)
+ lastdrawnanim = player[owner].animCurrent;
}
if (owner != -1) {
- glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslatef(position.x, position.y - .02, position.z);