-glPushMatrix();
-glLoadIdentity();
-glTranslatef( (skeleton.muscles[j].parent1->position.x+skeleton.muscles[j].parent2->position.x)/2,
-(skeleton.muscles[j].parent1->position.y+skeleton.muscles[j].parent2->position.y)/2,
-(skeleton.muscles[j].parent1->position.z+skeleton.muscles[j].parent2->position.z)/2);
-glRotatef(-skeleton.muscles[j].rotate1+90,0,1,0);
-glRotatef(-skeleton.muscles[j].rotate2+90,0,0,1);
-glRotatef(-skeleton.muscles[j].rotate3,0,1,0);
-glScalef(1,findDistance(skeleton.muscles[j].parent1->position,skeleton.muscles[j].parent2->position),1);
-glTranslatef(collisionpoint.x,collisionpoint.y,collisionpoint.z);
-glGetFloatv(GL_MODELVIEW_MATRIX,M);
-collisionpoint.x=M[12];
-collisionpoint.y=M[13];
-collisionpoint.z=M[14];
-glPopMatrix();
-hitstruct.collision=1;
-hitstruct.hitlocation=collisionpoint;
-hitstruct.joint1=skeleton.muscles[j].parent1;
-hitstruct.joint2=skeleton.muscles[j].parent2;
-}
-}
-}
-}
-if(skeleton.free<1){
-if(rotation)hitstruct.hitlocation=DoRotation(hitstruct.hitlocation,0,rotation,0);
-hitstruct.hitlocation=hitstruct.hitlocation+coords;
-}
-return hitstruct;
-}
-*/
-void Person::DoAnimations(){
- if(!skeleton.free){
- int i = 0;
- static float oldtarget;
-
- if(isIdle()&¤tanimation!=getIdle())normalsupdatedelay=0;
-
- if(targetanimation==tempanim||currentanimation==tempanim){
- animation[tempanim]=tempanimation;
- }
- if(targetanimation==jumpupanim||targetanimation==jumpdownanim||isFlip()){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- if(id==0){
- FSOUND_3D_SetAttributes(channels[whooshsound], gLoc, vel);
- FSOUND_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))landhard=1;
- if(!crouchkeydown&&velocity.y>=-15)landhard=0;
- }
- if((currentanimation==jumpupanim||targetanimation==jumpdownanim)/*&&velocity.y<40*/&&!isFlip()&&(!isLanding()&&!isLandhard())&&((crouchkeydown&&!crouchtogglekeydown))){
- XYZ targfacing;
- targfacing=0;
- targfacing.z=1;
-
- targfacing=DoRotation(targfacing,0,targetrotation,0);
-
- if(normaldotproduct(targfacing,velocity)>=-.3)targetanimation=flipanim;
- else targetanimation=backflipanim;
- crouchtogglekeydown=1;
- targetframe=0;
- target=0;
-
- if(id==0)numflipped++;
- }
-
- if(animation[targetanimation].attack!=reversed)feint=0;
- if(!crouchkeydown||(isLanding()||isLandhard())||(wasLanding()||wasLandhard())){
- crouchtogglekeydown=0;
- if(aitype==playercontrolled)feint=0;
- }
- else
- {
- if(!crouchtogglekeydown&&animation[targetanimation].attack==reversed&&aitype==playercontrolled&&(escapednum<2||reversaltrain))feint=1;
- if(!isFlip())crouchtogglekeydown=1;
- }
-
-
- if(animation[targetanimation].attack||currentanimation==getupfrombackanim||currentanimation==getupfromfrontanim){
- if(detail)normalsupdatedelay=0;
- }
-
- if(target>=1){
- if(targetanimation==rollanim&&targetframe==3&&onfire){
- onfire=0;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=0;
- vel[1]=0;
- vel[2]=0;
- PlaySoundEx( fireendsound, samp[fireendsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fireendsound], gLoc, vel);
- FSOUND_SetVolume(channels[fireendsound], 256);
- FSOUND_SetPaused(channels[fireendsound], false);
- FSOUND_SetPaused(channels[stream_firesound], true);
- deathbleeding=0;
- }
-
- if(targetanimation==rabbittacklinganim&&targetframe==1){
- //if(victim->aitype==attacktypecutoff&&Random()%2==0&&victim->stunned<=0&&animation[victim->targetanimation].attack==neutral&&victim->id!=0)Reverse();
- if(victim->aitype==attacktypecutoff&&victim->stunned<=0&&victim->surprised<=0&&victim->id!=0)Reverse();
- if(targetanimation==rabbittacklinganim&&targetframe==1&&!victim->isCrouch()&&victim->targetanimation!=backhandspringanim){
- if(normaldotproduct(victim->facing,facing)>0)victim->targetanimation=rabbittackledbackanim;
- else victim->targetanimation=rabbittackledfrontanim;
- victim->targetframe=2;
- victim->target=0;
- victim->rotation=rotation;
- victim->targetrotation=rotation;
- if(victim->aitype==gethelptype)victim->DoDamage(victim->damagetolerance-victim->damage);
- //victim->DoDamage(30);
- if(creature==wolftype){
- DoBloodBig(0,255);
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(1/victim->armorhead,210);
- }
- if(id==0){
- bonus=TackleBonus;
- bonustime=0;
- bonusvalue=5;
- if(victim->aitype==gethelptype)bonusvalue=50;
- }
- }
- }
-
- if(!drawtogglekeydown&&drawkeydown&&(weaponactive==-1||num_weapons==1)&&(animation[targetanimation].label[targetframe]||(targetanimation!=currentanimation&¤tanimation==rollanim))&&num_weapons>0&&creature!=wolftype){
- if(weapons.type[weaponids[0]]==knife){
- if(weaponactive==-1)weaponactive=0;
- else if(weaponactive==0)weaponactive=-1;
-
- if(weaponactive==-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifesheathesound, samp[knifesheathesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifesheathesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifesheathesound], 128);
- FSOUND_SetPaused(channels[knifesheathesound], false);
- }
- if(weaponactive!=-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
- }
- drawtogglekeydown=1;
- }
- //Footstep sounds
- if(tutoriallevel!=1||id==0)
- if((animation[targetanimation].label[targetframe]&&(animation[targetanimation].label[targetframe]<5||animation[targetanimation].label[targetframe]==8))/*||(targetanimation==rollanim&&targetframe==animation[rollanim].numframes-1)*/){
- int whichsound;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(onterrain){
- if(terrain.getOpacity(coords.x,coords.z)<.2){
- if(animation[targetanimation].label[targetframe]==1)whichsound=footstepsound;
- else whichsound=footstepsound2;
- if(animation[targetanimation].label[targetframe]==1)FootLand(0,1);
- if(animation[targetanimation].label[targetframe]==2)FootLand(1,1);
- if(animation[targetanimation].label[targetframe]==3&&isRun()){
- FootLand(1,1);
- FootLand(0,1);
- }
-
- }
- if(terrain.getOpacity(coords.x,coords.z)>=.2){
- if(animation[targetanimation].label[targetframe]==1)whichsound=footstepsound3;
- else whichsound=footstepsound4;
- }
- }
- if(!onterrain){
- if(animation[targetanimation].label[targetframe]==1)whichsound=footstepsound3;
- else whichsound=footstepsound4;
- }
- if(animation[targetanimation].label[targetframe]==4&&(weaponactive==-1||(targetanimation!=knifeslashstartanim&&targetanimation!=knifethrowanim&&targetanimation!=crouchstabanim&&targetanimation!=swordgroundstabanim&&targetanimation!=knifefollowanim))){
- if(animation[targetanimation].attack!=neutral){
- i=abs(Random()%3);
- if(i==0)whichsound=lowwhooshsound;
- if(i==1)whichsound=midwhooshsound;
- if(i==2)whichsound=highwhooshsound;
- }
- if(animation[targetanimation].attack==neutral)whichsound=movewhooshsound;
- }
- else if(animation[targetanimation].label[targetframe]==4)whichsound=knifeswishsound;
- if(animation[targetanimation].label[targetframe]==8&&tutoriallevel!=1)whichsound=landsound2;
-
- PlaySoundEx( whichsound, samp[whichsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel);
- if(whichsound!=knifeswishsound)FSOUND_SetVolume(channels[whichsound], 128);
- if(whichsound!=knifeswishsound&&(targetanimation==staffhitanim||targetanimation==staffgroundsmashanim||targetanimation==staffspinhitanim))FSOUND_SetVolume(channels[whichsound], 256);
- if(whichsound==knifeswishsound)FSOUND_SetVolume(channels[whichsound], 512);
- FSOUND_SetPaused(channels[whichsound], false);
-
- if(id==0)
- if(whichsound==footstepsound||whichsound==footstepsound2||whichsound==footstepsound3||whichsound==footstepsound4){
- envsound[numenvsounds]=coords;
- if(targetanimation==wolfrunninganim||targetanimation==rabbitrunninganim)envsoundvol[numenvsounds]=15;
- else envsoundvol[numenvsounds]=6;
- envsoundlife[numenvsounds]=.4;
- numenvsounds++;
- }
-
- if(animation[targetanimation].label[targetframe]==3){
- whichsound--;
- PlaySoundEx( whichsound, samp[whichsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel);
- FSOUND_SetVolume(channels[whichsound], 128);
- FSOUND_SetPaused(channels[whichsound], false);
- }
- }
-
- //Combat sounds
- if(tutoriallevel!=1||id==0)
- if(speechdelay<=0)
- if(targetanimation!=crouchstabanim&&targetanimation!=swordgroundstabanim&&targetanimation!=staffgroundsmashanim)
- if((animation[targetanimation].label[targetframe]&&(animation[targetanimation].label[targetframe]<5||animation[targetanimation].label[targetframe]==8))/*||(targetanimation==rollanim&&targetframe==animation[rollanim].numframes-1)*/){
- int whichsound=-1;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(animation[targetanimation].label[targetframe]==4&&aitype!=playercontrolled){
- if(animation[targetanimation].attack!=neutral){
- i=abs(Random()%4);
- if(creature==rabbittype){
- if(i==0)whichsound=rabbitattacksound;
- if(i==1)whichsound=rabbitattack2sound;
- if(i==2)whichsound=rabbitattack3sound;
- if(i==3)whichsound=rabbitattack4sound;
- }
- if(creature==wolftype){
- if(i==0)whichsound=barksound;
- if(i==1)whichsound=bark2sound;
- if(i==2)whichsound=bark3sound;
- if(i==3)whichsound=barkgrowlsound;
- }
- speechdelay=.3;
- }
- //if(animation[targetanimation].attack==neutral)whichsound=movewhooshsound;
- }
- //else if(animation[targetanimation].label[targetframe]==4)whichsound=knifeswishsound;
- //if(animation[targetanimation].label[targetframe]==8)whichsound=landsound2;
-
- if(whichsound!=-1){
- PlaySoundEx( whichsound, samp[whichsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whichsound], gLoc, vel);
- FSOUND_SetVolume(channels[whichsound], 512);
- FSOUND_SetPaused(channels[whichsound], false);
- }
- }
-
-
-
- if((!wasLanding()&&!wasLandhard())&¤tanimation!=getIdle()&&(isLanding()||isLandhard())){
- FootLand(0,1);
- FootLand(1,1);
- }
-
- transspeed=0;
- currentoffset=targetoffset;
- targetframe=currentframe;
- currentanimation=targetanimation;
- targetframe++;
-
- if(targetanimation==removeknifeanim&&animation[targetanimation].label[currentframe]==5){
- for(i=0;i<weapons.numweapons;i++){
- if(/*weapons.velocity[i].x==0&&weapons.velocity[i].y==0&&weapons.velocity[i].z==0&&*/weapons.owner[i]==-1)
- if(findDistancefastflat(&coords,&weapons.position[i])<4&&weaponactive==-1){
- if(findDistancefast(&coords,&weapons.position[i])>=1){
- if(weapons.type[i]!=staff){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
-
- weaponactive=0;
- weapons.owner[i]=id;
- if(num_weapons>0){
- weaponids[num_weapons]=weaponids[0];
- }
- num_weapons++;
- weaponids[0]=i;
- }
- }
- }
- }
-
- static bool willwork;
- if(targetanimation==crouchremoveknifeanim&&animation[targetanimation].label[currentframe]==5){
- for(i=0;i<weapons.numweapons;i++){
- bool willwork=1;
- if(weapons.owner[i]!=-1)
- if(player[weapons.owner[i]].weaponstuck!=-1)
- if(player[weapons.owner[i]].weaponids[player[weapons.owner[i]].weaponstuck]==i)
- if(player[weapons.owner[i]].num_weapons>1)willwork=0;
- if((/*weapons.velocity[i].x==0&&weapons.velocity[i].y==0&&weapons.velocity[i].z==0&&*/weapons.owner[i]==-1)||(hasvictim&&weapons.owner[i]==victim->id&&victim->skeleton.free))
- if(willwork&&findDistancefastflat(&coords,&weapons.position[i])<3&&weaponactive==-1){
- if(findDistancefast(&coords,&weapons.position[i])<1||hasvictim){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- bool fleshstuck=0;
- if(weapons.owner[i]!=-1)
- if(victim->weaponstuck!=-1){
- if(victim->weaponids[victim->weaponstuck]==i){
- fleshstuck=1;
- }
- }
- if(!fleshstuck){
- if(weapons.type[i]!=staff){
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
- }
- if(fleshstuck){
- PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabremovesound], 128);
- FSOUND_SetPaused(channels[fleshstabremovesound], false);
- }
- weaponactive=0;
- if(weapons.owner[i]!=-1){
-
- victim=&player[weapons.owner[i]];
- if(victim->num_weapons==1)victim->num_weapons=0;
- else victim->num_weapons=1;
-
- //victim->weaponactive=-1;
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
-
- for(int j=0;j<victim->skeleton.num_joints;j++){
- victim->skeleton.joints[j].velchange=0;
- victim->skeleton.joints[j].locked=0;
- }
-
- XYZ relative;
- relative=0;
- relative.y=10;
- Normalise(&relative);
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=weapons.position[i];
- if(victim->weaponstuck!=-1){
- if(victim->weaponids[victim->weaponstuck]==i){
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
- weapons.bloody[i]=2;
- weapons.blooddrip[i]=5;
- victim->weaponstuck=-1;
- }
- }
- if(victim->num_weapons>0){
- if(victim->weaponstuck!=0&&victim->weaponstuck!=-1)victim->weaponstuck=0;
- if(victim->weaponids[0]==i)
- victim->weaponids[0]=victim->weaponids[victim->num_weapons];
- }
-
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*6;
- victim->skeleton.joints[victim->skeleton.jointlabels[neck]].velocity+=relative*6;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightshoulder]].velocity+=relative*6;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftshoulder]].velocity+=relative*6;
- }
- weapons.owner[i]=id;
- if(num_weapons>0){
- weaponids[num_weapons]=weaponids[0];
- }
- num_weapons++;
- weaponids[0]=i;
- }
- }
- }
- }
-
- if(currentanimation==drawleftanim&&animation[targetanimation].label[currentframe]==5){
- if(weaponactive==-1)weaponactive=0;
- else if(weaponactive==0){
- weaponactive=-1;
- if(num_weapons==2){
- int buffer;
- buffer=weaponids[0];
- weaponids[0]=weaponids[1];
- weaponids[1]=buffer;
- }
- }
- if(weaponactive==-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifesheathesound, samp[knifesheathesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifesheathesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifesheathesound], 128);
- FSOUND_SetPaused(channels[knifesheathesound], false);
- }
- if(weaponactive!=-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
- }
-
-
- if((currentanimation==walljumprightkickanim&&targetanimation==walljumprightkickanim)||(currentanimation==walljumpleftkickanim&&targetanimation==walljumpleftkickanim)){
- XYZ rotatetarget=DoRotation(skeleton.forward,0,rotation,0);
- Normalise(&rotatetarget);
- targetrotation=-asin(0-rotatetarget.x);
- targetrotation*=360/6.28;
- if(rotatetarget.z<0)targetrotation=180-targetrotation;
-
- if(targetanimation==walljumprightkickanim)targetrotation+=40;
- if(targetanimation==walljumpleftkickanim)targetrotation-=40;
- }
-
- bool dojumpattack;
- dojumpattack=0;
- if((targetanimation==rabbitrunninganim||targetanimation==wolfrunninganim)&&targetframe==3&&(jumpkeydown||attackkeydown||id!=0))dojumpattack=1;
- if(hasvictim)
- if(findDistancefast(&victim->coords,&/*player[i].*/coords)<5&&victim->aitype==gethelptype&&(attackkeydown)&&!victim->skeleton.free&&victim->isRun()&&victim->runninghowlong>=1)dojumpattack=1; if(!hostile)dojumpattack=0;
- if(dojumpattack){
- if((targetanimation==rabbitrunninganim||targetanimation==wolfrunninganim)&&id==0){
- targetanimation=rabbittackleanim;
- targetframe=0;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( jumpsound, samp[jumpsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel);
- FSOUND_SetVolume(channels[jumpsound], 128);
- FSOUND_SetPaused(channels[jumpsound], false);
- }
-
- float closestdist;
- closestdist=0;
- int closestid;
- closestid=-1;
- XYZ targetloc;
- targetloc=velocity;
- Normalise(&targetloc);
- targetloc+=coords;
- for(i=0;i<numplayers;i++){
- if(i!=id)
- if(findDistancefast(&targetloc,&player[i].coords)<closestdist||closestdist==0){
- closestdist=findDistancefast(&targetloc,&player[i].coords);
- closestid=i;
- }
- }
- if(closestid!=-1)
- if(closestdist<5&&!player[closestid].dead&&animation[player[closestid].targetanimation].height!=lowheight&&player[closestid].targetanimation!=backhandspringanim){
- hasvictim=1;
- victim=&player[closestid];
- coords=victim->coords;
- currentanimation=rabbittacklinganim;
- targetanimation=rabbittacklinganim;
- currentframe=0;
- targetframe=1;
- XYZ rotatetarget;
- if(coords.z!=victim->coords.z||coords.x!=victim->coords.x){
- rotatetarget=coords-victim->coords;
- Normalise(&rotatetarget);
- targetrotation=-asin(0-rotatetarget.x);
- targetrotation*=360/6.28;
- if(rotatetarget.z<0)targetrotation=180-targetrotation;
- }
- if(targetanimation!=rabbitrunninganim){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( jumpsound, samp[jumpsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[jumpsound], gLoc, vel);
- FSOUND_SetVolume(channels[jumpsound], 128);
- FSOUND_SetPaused(channels[jumpsound], false);
- }
- }
- }
-
- //Move impacts
- float damagemult=1*power;
- if(creature==wolftype)damagemult=2.5*power;
- if(hasvictim){damagemult/=victim->damagetolerance/200;}
- //if(onfire)damagemult=3;
- if((animation[targetanimation].attack==normalattack||targetanimation==walljumprightkickanim||targetanimation==walljumpleftkickanim)&&(!feint)&&(victim->skeleton.free!=2||targetanimation==killanim||targetanimation==dropkickanim||targetanimation==crouchstabanim||targetanimation==swordgroundstabanim||targetanimation==staffgroundsmashanim)){
- if(targetanimation==spinkickanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&3&&animation[victim->targetanimation].height!=lowheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2||creature==wolftype){
- victim->spurt=1;
- DoBlood(.2,250);
- if(creature==wolftype)DoBloodBig(0,250);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhead,175);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*100/victim->protectionhead);
-
- if(id==0){
- SolidHitBonus();
- }
- }
- }
-
- if(targetanimation==wolfslapanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&3&&animation[victim->targetanimation].height!=lowheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2||creature==wolftype){
- victim->spurt=1;
- if(creature==wolftype)DoBloodBig(0,235);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( whooshhitsound, samp[whooshhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whooshhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[whooshhitsound], 512);
- FSOUND_SetPaused(channels[whooshhitsound], false);
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2,175);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative.y-=1;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*20;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*100;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*50/victim->protectionhead);
- }
- }
-
- if(targetanimation==walljumprightkickanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&animation[victim->targetanimation].height!=lowheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- victim->spurt=1;
- DoBlood(.2,250);
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 160);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhead,175);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=facing;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*150/victim->protectionhead);
-
- if(victim->damage>victim->damagetolerance){
- if(id==0){
- bonus=style;
- bonustime=0;
- bonusvalue=150;
- }
- }
- else if(id==0){
- SolidHitBonus();
- }
- }
- }
-
- if(targetanimation==walljumpleftkickanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&animation[victim->targetanimation].height!=lowheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- victim->spurt=1;
- DoBlood(.2,250);
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 160);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhead,175);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=facing;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*150/victim->protectionhead);
-
- if(victim->damage>victim->damagetolerance){
- if(id==0){
- bonus=style;
- bonustime=0;
- bonusvalue=150;
- }
- }
- else if(id==0){
- SolidHitBonus();
- }
- }
- }
-
- if(targetanimation==blockhighleftstrikeanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&animation[victim->targetanimation].height!=lowheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,235);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( whooshhitsound, samp[whooshhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whooshhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[whooshhitsound], 512);
- FSOUND_SetPaused(channels[whooshhitsound], false);
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*30;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*100;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*50/victim->protectionhead);
- }
- }
-
- if(targetanimation==killanim&&animation[targetanimation].label[currentframe]==8){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&victim->dead){
- escapednum=0;
- if(id==0)camerashake+=.2;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- /*PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 128);
- FSOUND_SetPaused(channels[landsound2], false);
- */
- PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
- FSOUND_SetVolume(channels[movewhooshsound], 128);
- FSOUND_SetPaused(channels[movewhooshsound], false);
-
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
- victim->skeleton.spinny=1;
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velchange=0;
- victim->skeleton.joints[i].delay=0;
- victim->skeleton.joints[i].locked=0;
- //victim->skeleton.joints[i].velocity=0;
- }
-
- XYZ relative;
- relative=0;
- relative.y=1;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity.y=relative.y*10;
- victim->skeleton.joints[i].position.y+=relative.y*.3;
- victim->skeleton.joints[i].oldposition.y+=relative.y*.3;
- victim->skeleton.joints[i].realoldposition.y+=relative.y*.3;
- }
- victim->Puff(abdomen);
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity.y=relative.y*400;
- }
- }
-
- if(targetanimation==killanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*9&&victim->dead){
- escapednum=0;
- if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*90;
- }
- victim->Puff(abdomen);
- if(victim->dead!=2&&victim->permanentdamage>victim->damagetolerance-250&&autoslomo){
- slomo=1;
- slomodelay=.2;
- }
- victim->DoDamage(damagemult*500/victim->protectionhigh);
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*300;
- }
- }
-
- if(targetanimation==dropkickanim&&animation[targetanimation].label[currentframe]==7){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*9&&victim->skeleton.free){
- escapednum=0;
- if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( thudsound, samp[thudsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[thudsound], gLoc, vel);
- FSOUND_SetVolume(channels[thudsound], 400);
- FSOUND_SetPaused(channels[thudsound], false);
- }
-
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
- victim->skeleton.spinny=1;
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velchange=0;
- //victim->skeleton.joints[i].delay=0;
- victim->skeleton.joints[i].locked=0;
- }
- XYZ relative;
- relative=victim->coords-coords;
- Normalise(&relative);
- relative.y+=.3;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*20;
- }
- if(id==0&&!victim->dead){
- SolidHitBonus();
- }
-
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*20/victim->protectionhigh);
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- staggerdelay=.5;
- if(!victim->dead)staggerdelay=1.2;
-
-
- }
- }
-
- if((targetanimation==crouchstabanim||targetanimation==swordgroundstabanim)&&animation[targetanimation].label[currentframe]==5){
- // if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*9){
- //if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- if(hasvictim)
- if(!victim->skeleton.free)hasvictim=0;
-
- if(!hasvictim){
- terrain.MakeDecal(blooddecalfast,(weapons.tippoint[weaponids[weaponactive]]*.8+weapons.position[weaponids[weaponactive]]*.2),.08,.6,Random()%360);
- PlaySoundEx( knifesheathesound, samp[knifesheathesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifesheathesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifesheathesound], 128);
- FSOUND_SetPaused(channels[knifesheathesound], false);
- }
-
- if(victim&&hasvictim){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3){
-
- XYZ where,startpoint,endpoint,movepoint,colpoint;
- float rotationpoint;
- int whichtri;
- if(weapons.type[weaponids[weaponactive]]==knife){
- where=(weapons.tippoint[weaponids[weaponactive]]*.6+weapons.position[weaponids[weaponactive]]*.4);
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- //where=scale;
- startpoint=where;
- startpoint.y+=100;
- endpoint=where;
- endpoint.y-=100;
- }
- if(weapons.type[weaponids[weaponactive]]==sword){
- where=weapons.position[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- startpoint=where;
- where=weapons.tippoint[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- endpoint=where;
- }
- if(weapons.type[weaponids[weaponactive]]==staff){
- where=weapons.position[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- startpoint=where;
- where=weapons.tippoint[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- endpoint=where;
- }
- movepoint=0;
- rotationpoint=0;
- whichtri=victim->skeleton.drawmodel.LineCheck(&startpoint,&endpoint, &colpoint, &movepoint, &rotationpoint);
-
- if(whichtri!=-1){
- if(victim->dead!=2){
- victim->DoDamage(abs((victim->damagetolerance-victim->permanentdamage)*2));
- if(id==0&&!victim->dead){
- bonus=FinishedBonus;
- bonustime=0;
- bonusvalue=200;
- }
- }
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
-
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velchange=0;
- victim->skeleton.joints[i].locked=0;
- //victim->skeleton.joints[i].velocity=0;
- }
- PlaySoundEx( fleshstabsound, samp[fleshstabsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabsound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabsound], 128);
- FSOUND_SetPaused(channels[fleshstabsound], false);
-
- }
- if(whichtri!=-1||weapons.bloody[weaponids[weaponactive]]){
- weapons.blooddrip[weaponids[weaponactive]]+=5;
- weapons.blooddripdelay[weaponids[weaponactive]]=0;
- }
- if(whichtri==-1){
- hasvictim=0;
- PlaySoundEx( knifesheathesound, samp[knifesheathesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifesheathesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifesheathesound], 128);
- FSOUND_SetPaused(channels[knifesheathesound], false);
- }
- }
- }
- }
-
- if((targetanimation==crouchstabanim||targetanimation==swordgroundstabanim)&&animation[targetanimation].label[currentframe]==6){
- // if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*9){
- //if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(!hasvictim){
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
-
- if(victim&&hasvictim){
- XYZ footvel,footpoint;
-
- PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabremovesound], 128);
- FSOUND_SetPaused(channels[fleshstabremovesound], false);
-
- footvel=0;
- footpoint=(weapons.tippoint[weaponids[weaponactive]]*.8+weapons.position[weaponids[weaponactive]]*.2);
-
- if(weapons.type[weaponids[weaponactive]]==sword){
- XYZ where,startpoint,endpoint,movepoint;
- float rotationpoint;
- int whichtri;
-
- where=weapons.position[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- startpoint=where;
- where=weapons.tippoint[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- endpoint=where;
-
- movepoint=0;
- rotationpoint=0;
- whichtri=victim->skeleton.drawmodel.LineCheck(&startpoint,&endpoint, &footpoint, &movepoint, &rotationpoint);
- footpoint+=victim->coords;
-
- if(whichtri==-1){
- footpoint=(weapons.tippoint[weaponids[weaponactive]]*.8+weapons.position[weaponids[weaponactive]]*.2);
- }
- }
- if(weapons.type[weaponids[weaponactive]]==staff){
- XYZ where,startpoint,endpoint,movepoint;
- float rotationpoint;
- int whichtri;
-
- where=weapons.position[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- startpoint=where;
- where=weapons.tippoint[weaponids[weaponactive]];
- where-=victim->coords;
- if(!victim->skeleton.free)where=DoRotation(where,0,-victim->rotation,0);
- endpoint=where;
-
- movepoint=0;
- rotationpoint=0;
- whichtri=victim->skeleton.drawmodel.LineCheck(&startpoint,&endpoint, &footpoint, &movepoint, &rotationpoint);
- footpoint+=victim->coords;
-
- if(whichtri==-1){
- footpoint=(weapons.tippoint[weaponids[weaponactive]]*.8+weapons.position[weaponids[weaponactive]]*.2);
- }
- }
- hasvictim=victim->DoBloodBigWhere(2,220,footpoint);
- if(hasvictim){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3){
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velchange=0;
- victim->skeleton.joints[i].locked=0;
- //victim->skeleton.joints[i].velocity=0;
- }
-
- XYZ relative;
- relative=0;
- relative.y=10;
- Normalise(&relative);
- //victim->Puff(abdomen);
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
-
- if(victim->bloodloss<victim->damagetolerance){
- victim->bloodloss+=1000;
- victim->bled=0;
- }
-
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*20;
- }
- }
- }
- if(!hasvictim&&onterrain){
- weapons.bloody[weaponids[weaponactive]]=0;
- weapons.blooddrip[weaponids[weaponactive]]=0;
- }
- }
-
- if(targetanimation==upunchanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,235);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- //if(!victim->isIdle()||victim->damage>victim->damagetolerance-60){
- if(1==1){
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- }
- else {
- if(tutoriallevel!=1){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 256);
- FSOUND_SetPaused(channels[landsound2], false);
- }
- }
-
- //if(!victim->isIdle()||victim->damage>victim->damagetolerance-60)
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=relative*30;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*150;
-
- victim->targetframe=0;
- victim->targetanimation=staggerbackhardanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- victim->stunned=1;
-
- victim->Puff(head);
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*60/victim->protectionhigh);
-
- if(id==0){
- SolidHitBonus();
- }
- }
- }
-
-
- if(targetanimation==winduppunchanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*2){
- escapednum=0;
- if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- //if(!victim->isIdle()||victim->damage>victim->damagetolerance-60){
- if(victim->damage<=victim->damagetolerance-60&&normaldotproduct(victim->facing,victim->coords-coords)<(scale*5)*(scale*5)*0&&animation[victim->targetanimation].height!=lowheight){
- if(tutoriallevel!=1){
- PlaySoundEx( thudsound, samp[thudsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[thudsound], gLoc, vel);
- FSOUND_SetVolume(channels[thudsound], 512);
- FSOUND_SetPaused(channels[thudsound], false);
- }
- }
- else if(victim->damage<=victim->damagetolerance-60&&normaldotproduct(victim->facing,victim->coords-coords)<(scale*5)*(scale*5)*0&&animation[victim->targetanimation].height==lowheight){
- if(tutoriallevel!=1){
- PlaySoundEx( whooshhitsound, samp[whooshhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whooshhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[whooshhitsound], 512);
- FSOUND_SetPaused(channels[whooshhitsound], false);
- }
- }
- else {
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 256);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- }
-
- if(victim->damage>victim->damagetolerance-60||normaldotproduct(victim->facing,victim->coords-coords)>0||animation[victim->targetanimation].height==lowheight)
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative.y=.3;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=relative*5;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*400;
-
- victim->targetframe=0;
- victim->targetanimation=staggerbackhardanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- victim->stunned=1;
-
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*60/victim->protectionhigh);
-
- if(id==0){
- SolidHitBonus();
- }
- }
- }
-
- if(targetanimation==blockhighleftanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*4){
- if(victim->id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 256);
- FSOUND_SetPaused(channels[landsound2], false);
-
- Puff(righthand);
- }
- }
-
- if(targetanimation==swordslashparryanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*4){
- if(victim->id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- if(weaponactive!=-1){
- if(weapons.type[victim->weaponids[0]]==staff||weapons.type[weaponids[0]]==staff){
- if(weapons.type[victim->weaponids[0]]==staff)weapons.damage[victim->weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
- if(weapons.type[weaponids[0]]==staff)weapons.damage[weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
-
- PlaySoundEx( swordstaffsound, samp[swordstaffsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[swordstaffsound], gLoc, vel);
- FSOUND_SetVolume(channels[swordstaffsound], 512);
- FSOUND_SetPaused(channels[swordstaffsound], false);
- }
- else{
- PlaySoundEx( metalhitsound, samp[metalhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[metalhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[metalhitsound], 512);
- FSOUND_SetPaused(channels[metalhitsound], false);
- }
- }
-
- //Puff(righthand);
- }
- }
-
- if(targetanimation==knifethrowanim&&animation[targetanimation].label[currentframe]==5){
- if(weaponactive!=-1){
- escapednum=0;
- XYZ aim;
- weapons.owner[weaponids[0]]=-1;
- aim=victim->coords+DoRotation(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position,0,victim->rotation,0)*victim->scale+victim->velocity*findDistance(&victim->coords,&coords)/50-(coords+DoRotation(skeleton.joints[skeleton.jointlabels[righthand]].position,0,rotation,0)*scale);
- Normalise(&aim);
- /*if(victim->targetanimation==jumpupanim||victim->targetanimation==jumpdownanim){
- aim=DoRotation(aim,(float)abs(Random()%15)-7,(float)abs(Random()%15)-7,0);
- }*/
- weapons.velocity[weaponids[0]]=aim*50;
- weapons.tipvelocity[weaponids[0]]=aim*50;
- weapons.missed[weaponids[0]]=0;
- weapons.hitsomething[weaponids[0]]=0;
- weapons.freetime[weaponids[0]]=0;
- weapons.firstfree[weaponids[0]]=1;
- weapons.physics[weaponids[0]]=0;
- num_weapons--;
- if(num_weapons){
- weaponids[0]=weaponids[num_weapons];
- }
- weaponactive=-1;
- }
- }
-
- if(targetanimation==knifeslashstartanim&&animation[targetanimation].label[currentframe]==5){
- if(hasvictim)
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*4.5&&/*animation[victim->targetanimation].height!=lowheight&&*/victim->targetanimation!=dodgebackanim&&victim->targetanimation!=rollanim){
- escapednum=0;
- //if(Random()%2){
- if(tutoriallevel!=1)victim->DoBloodBig(1.5/victim->armorhigh,225);
- //}
-
- if(id==0){
- bonus=Slicebonus;
- bonustime=0;
- bonusvalue=10;
- }
- if(tutoriallevel!=1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( knifeslicesound, samp[knifeslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifeslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifeslicesound], 512);
- FSOUND_SetPaused(channels[knifeslicesound], false);
- }
- //victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- if(animation[victim->targetanimation].attack&&(victim->aitype!=playercontrolled||victim->targetanimation==knifeslashstartanim)&&(victim->creature==rabbittype||victim->deathbleeding<=0)){
- if(victim->id != 0 || difficulty==2){
- victim->targetframe=0;
- victim->targetanimation=staggerbackhardanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- }
- }
- victim->lowreversaldelay=0;
- victim->highreversaldelay=0;
- if(aitype!=playercontrolled)weaponmissdelay=.6;
-
- if(tutoriallevel!=1)if(bloodtoggle&&!weapons.bloody[weaponids[weaponactive]])weapons.bloody[weaponids[weaponactive]]=1;
- if(tutoriallevel!=1)weapons.blooddrip[weaponids[weaponactive]]+=3;
-
- XYZ footvel,footpoint;
- footvel=0;
- if(skeleton.free){
- footpoint=(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2*victim->scale+victim->coords;
- }
- if(!skeleton.free){
- footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->rotation,0)*victim->scale+victim->coords;
- }
- if(tutoriallevel!=1){
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .6, .3);
- footvel=DoRotation(facing,0,90,0)*.8;
- //footvel.y-=.3;
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .2, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .2, 1);
- }
- if(tutoriallevel==1){
- sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .6, .3);
- }
- victim->DoDamage(damagemult*0);
- }
- }
- if(targetanimation==swordslashanim&&animation[targetanimation].label[currentframe]==5&&victim->targetanimation!=rollanim){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*6.5&&victim->targetanimation!=dodgebackanim){
- if(victim->weaponactive==-1||normaldotproduct(victim->facing,victim->coords-coords)>0||(Random()%2==0)){
- if(id==0){
- bonus=Slashbonus;
- bonustime=0;
- bonusvalue=40;
- }
- escapednum=0;
- if(tutoriallevel!=1){
- if(normaldotproduct(victim->facing,victim->coords-coords)<0)victim->DoBloodBig(2/victim->armorhigh,190);
- else victim->DoBloodBig(2/victim->armorhigh,185);
- victim->deathbleeding=1;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( swordslicesound, samp[swordslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[swordslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[swordslicesound], 512);
- FSOUND_SetPaused(channels[swordslicesound], false);
- }
- //victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- //if(animation[victim->targetanimation].attack){
- //if(victim->creature==rabbittype){
- if(tutoriallevel!=1){
- victim->targetframe=0;
- victim->targetanimation=staggerbackhardanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- }
- //}
- //}
-
- if(tutoriallevel!=1){
- if(bloodtoggle&&!weapons.bloody[weaponids[weaponactive]])weapons.bloody[weaponids[weaponactive]]=1;
- weapons.blooddrip[weaponids[weaponactive]]+=3;
-
- float bloodlossamount;
- bloodlossamount=200+abs((float)(Random()%40))-20;
- victim->bloodloss+=bloodlossamount/victim->armorhigh;
- //victim->bloodloss+=100*(6.5-findDistancefast(&coords,&victim->coords));
- victim->DoDamage(damagemult*0);
-
- XYZ footvel,footpoint;
- footvel=0;
- if(skeleton.free){
- footpoint=(victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2*victim->scale+victim->coords;
- }
- if(!skeleton.free){
- footpoint=DoRotation((victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].position+victim->skeleton.joints[victim->skeleton.jointlabels[neck]].position)/2,0,victim->rotation,0)*victim->scale+victim->coords;
- }
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=DoRotation(facing,0,90,0)*.8;
- footvel.y-=.3;
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1);
- }
- }
- else {
-
-
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(victim->weaponactive!=-1){
- if(weapons.type[victim->weaponids[0]]==staff||weapons.type[weaponids[0]]==staff){
- if(weapons.type[victim->weaponids[0]]==staff)weapons.damage[victim->weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
- if(weapons.type[weaponids[0]]==staff)weapons.damage[weaponids[0]]+=.2+float(abs(Random()%100)-50)/250;
-
- PlaySoundEx( swordstaffsound, samp[swordstaffsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[swordstaffsound], gLoc, vel);
- FSOUND_SetVolume(channels[swordstaffsound], 512);
- FSOUND_SetPaused(channels[swordstaffsound], false);
- }
- else{
- PlaySoundEx( metalhitsound, samp[metalhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[metalhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[metalhitsound], 512);
- FSOUND_SetPaused(channels[metalhitsound], false);
- }
- }
-
-
- XYZ aim;
- victim->Puff(righthand);
- victim->target=0;
- victim->targetframe=0;
- victim->targetanimation=staggerbackhighanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- weapons.owner[victim->weaponids[0]]=-1;
- aim=DoRotation(facing,0,90,0)*21;
- aim.y+=7;
- weapons.velocity[victim->weaponids[0]]=aim*-.2;
- weapons.tipvelocity[victim->weaponids[0]]=aim;
- weapons.missed[victim->weaponids[0]]=1;
- weapons.hitsomething[weaponids[0]]=0;
- weapons.freetime[victim->weaponids[0]]=0;
- weapons.firstfree[victim->weaponids[0]]=1;
- weapons.physics[victim->weaponids[0]]=1;
- victim->num_weapons--;
- if(victim->num_weapons){
- victim->weaponids[0]=victim->weaponids[num_weapons];
- if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
- victim->weaponactive=-1;
- for(i=0;i<numplayers;i++){
- player[i].wentforweapon=0;
- }
-
- /*PlaySoundEx( metalhitsound, samp[metalhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[metalhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[metalhitsound], 512);
- FSOUND_SetPaused(channels[metalhitsound], false);*/
-
- }
- }
- }
-
- if(targetanimation==staffhitanim&&animation[targetanimation].label[currentframe]==5&&victim->targetanimation!=rollanim){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*6.5&&victim->targetanimation!=dodgebackanim&&victim->targetanimation!=sweepanim){
- if(tutoriallevel!=1){
- weapons.damage[weaponids[0]]+=.4+float(abs(Random()%100)-50)/250;
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2||creature==wolftype){
- victim->spurt=1;
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( staffheadsound, samp[staffheadsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[staffheadsound], gLoc, vel);
- FSOUND_SetVolume(channels[staffheadsound], 256);
- FSOUND_SetPaused(channels[staffheadsound], false);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);
- relative.y-=1;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*60;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*230;
- victim->skeleton.joints[victim->skeleton.jointlabels[neck]].velocity+=relative*damagemult*230;
- //FootLand(1,2);
- victim->Puff(head);
- if(tutoriallevel!=1){
- victim->DoDamage(damagemult*120/victim->protectionhigh);
-
- if(id==0){
- bonus=solidhit;
- bonustime=0;
- bonusvalue=30;
- }
- }
- }
- }
-
- if(targetanimation==staffspinhitanim&&animation[targetanimation].label[currentframe]==5&&victim->targetanimation!=rollanim){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*6.5&&victim->targetanimation!=dodgebackanim&&victim->targetanimation!=sweepanim){
- if(tutoriallevel!=1){
- weapons.damage[weaponids[0]]+=.6+float(abs(Random()%100)-50)/250;
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2||creature==wolftype){
- victim->spurt=1;
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( staffheadsound, samp[staffheadsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[staffheadsound], gLoc, vel);
- FSOUND_SetVolume(channels[staffheadsound], 256);
- FSOUND_SetPaused(channels[staffheadsound], false);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*220;
- victim->skeleton.joints[victim->skeleton.jointlabels[neck]].velocity+=relative*damagemult*220;
- //FootLand(1,2);
- victim->Puff(head);
- if(tutoriallevel!=1){victim->DoDamage(damagemult*350/victim->protectionhead);
-
- if(id==0){
- bonus=solidhit;
- bonustime=0;
- bonusvalue=60;
- }
- }
- }
- }
-
- if(targetanimation==staffgroundsmashanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*6.5){
- escapednum=0;
- if(tutoriallevel!=1){
- if(!victim->dead)weapons.damage[weaponids[0]]+=.4+float(abs(Random()%100)-50)/500;
- if(id==0)camerashake+=.4;
- if(Random()%2||creature==wolftype){
- victim->spurt=1;
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( staffbodysound, samp[staffbodysound], NULL, true);
- FSOUND_3D_SetAttributes(channels[staffbodysound], gLoc, vel);
- FSOUND_SetVolume(channels[staffbodysound], 256);
- FSOUND_SetPaused(channels[staffbodysound], false);
- }
- victim->skeleton.longdead=0;
- victim->skeleton.free=1;
- victim->skeleton.broken=0;
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velchange=0;
- victim->skeleton.joints[i].locked=0;
- //victim->skeleton.joints[i].velocity=0;
- }
-
- victim->RagDoll(0);
- XYZ relative;
- relative=0;
- /*relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);*/
- relative.y=-1;
- Normalise(&relative);
- if(!victim->dead){
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=relative*damagemult*40;
- }
- //FootLand(1,2);
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*40;
- }
- if(victim->dead){
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=relative*damagemult*abs(Random()%20);
- }
- //FootLand(1,2);
- //victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*20;
- }
- victim->Puff(abdomen);
- if(tutoriallevel!=1){victim->DoDamage(damagemult*100/victim->protectionhigh);
-
- if(!victim->dead){
- if(id==0){
- bonus=solidhit;
- bonustime=0;
- bonusvalue=40;
- }
- }
- }
- }
- }
-
- if(targetanimation==lowkickanim&&animation[targetanimation].label[currentframe]==5){
- if(findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&animation[victim->targetanimation].height!=highheight){
- escapednum=0;
- if(id==0)camerashake+=.4;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
-
- if(id==0){
- SolidHitBonus();
- }
-
- if(animation[victim->targetanimation].height==lowheight){
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,250);
- }
- victim->RagDoll(0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- victim->Puff(head);
- victim->DoDamage(damagemult*100/victim->protectionhead);
- if(victim->howactive==typesleeping)victim->DoDamage(damagemult*150/victim->protectionhead);
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhead,175);
- }
- }
- else{
- if(victim->damage>=victim->damagetolerance)victim->RagDoll(0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*10;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- victim->targetframe=0;
- victim->targetanimation=staggerbackhighanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- if(tutoriallevel!=1){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 128);
- FSOUND_SetPaused(channels[landsound2], false);
- }
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*30/victim->protectionhigh);
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhigh,170);
- }
- }
-
- }
- }
-
- if(targetanimation==sweepanim&&animation[targetanimation].label[currentframe]==5){
- if(victim->targetanimation!=jumpupanim&&findDistancefast(&coords,&victim->coords)<(scale*5)*(scale*5)*3&&victim!=this){
- escapednum=0;
- if(id==0)camerashake+=.2;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 128);
- FSOUND_SetPaused(channels[landsound2], false);
- }
- XYZ relative;
- relative=victim->coords-coords;
- relative.y=0;
- Normalise(&relative);
-
- if(animation[victim->targetanimation].height==middleheight||animation[victim->currentanimation].height==middleheight||victim->damage>=victim->damagetolerance-40){
- victim->RagDoll(0);
-
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*15;
- }
- relative=DoRotation(relative,0,-90,0);
- relative.y+=.1;
- for(i=0;i<victim->skeleton.num_joints;i++){
- if(victim->skeleton.joints[i].label==leftfoot||victim->skeleton.joints[i].label==rightfoot||victim->skeleton.joints[i].label==leftankle||victim->skeleton.joints[i].label==rightankle)
- victim->skeleton.joints[i].velocity=relative*80;
- }
- victim->Puff(rightankle);
- victim->Puff(leftankle);
- victim->DoDamage(damagemult*40/victim->protectionlow);
- }
- else{
- if(victim->damage>=victim->damagetolerance)victim->RagDoll(0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*10;
- }
- relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- if(victim->skeleton.joints[i].label==leftfoot||victim->skeleton.joints[i].label==rightfoot||victim->skeleton.joints[i].label==leftankle||victim->skeleton.joints[i].label==rightankle)
- victim->skeleton.joints[i].velocity+=relative*damagemult*80;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- victim->targetframe=0;
- victim->targetanimation=staggerbackhighanim;
- victim->targetrotation=targetrotation+180;
- victim->target=0;
- if(tutoriallevel!=1){
- PlaySoundEx( landsound2, samp[landsound2], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound2], gLoc, vel);
- FSOUND_SetVolume(channels[landsound2], 128);
- FSOUND_SetPaused(channels[landsound2], false);
- }
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*30/victim->protectionlow);
- }
-
- if(id==0){
- SolidHitBonus();
- }
-
- }
- }
- }
- if(animation[targetanimation].attack==reversal&&(!victim->feint||(victim->lastattack==victim->lastattack2&&victim->lastattack2==victim->lastattack3&&Random()%2)||targetanimation==knifefollowanim)){
- if(targetanimation==spinkickreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,230);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- if(creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhigh,170);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-oldcoords;
- relative.y=0;
- Normalise(&relative);
- //relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*150/victim->protectionhigh);
-
- if(id==0){
- bonus=Reversal;
- bonustime=0;
- bonusvalue=60;
- }
- }
-
- if((targetanimation==swordslashreversalanim||targetanimation==knifeslashreversalanim||targetanimation==staffhitreversalanim||targetanimation==staffspinhitreversalanim)&&animation[targetanimation].label[currentframe]==5){
- if(victim->weaponactive!=-1&&victim->num_weapons>0){
- if(weapons.owner[victim->weaponids[victim->weaponactive]]==victim->id){
- weapons.owner[victim->weaponids[victim->weaponactive]]=id;
- weaponactive=0;
- if(num_weapons>0){
- weaponids[num_weapons]=weaponids[victim->weaponactive];
- }
- num_weapons++;
- weaponids[0]=victim->weaponids[victim->weaponactive];
- victim->num_weapons--;
- if(victim->num_weapons>0){
- victim->weaponids[victim->weaponactive]=victim->weaponids[victim->num_weapons];
- //if(victim->weaponstuck==victim->num_weapons)victim->weaponstuck=0;
- }
- victim->weaponactive=-1;
- }
- }
- }
-
- if(targetanimation==staffhitreversalanim&&animation[targetanimation].label[currentframe]==5){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,230);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( whooshhitsound, samp[whooshhitsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[whooshhitsound], gLoc, vel);
- FSOUND_SetVolume(channels[whooshhitsound], 128);
- FSOUND_SetPaused(channels[whooshhitsound], false);
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-oldcoords;
- relative.y=0;
- Normalise(&relative);
- //relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*30;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*70/victim->protectionhigh);
- }
-
- if(targetanimation==staffspinhitreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,230);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- if(id==0){
- bonus=staffreversebonus;
- bonustime=0;
- bonusvalue=100;
- }
-
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- victim->RagDoll(0);
- if(id==0){
- bonus=staffreversebonus;
- bonustime=0;
- bonusvalue=100;
- }
-
- XYZ relative;
- relative=victim->coords-oldcoords;
- relative.y=0;
- Normalise(&relative);
- //relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*30;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(head);
- victim->DoDamage(damagemult*70/victim->protectionhigh);
- }
-
- if(targetanimation==upunchreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- victim->RagDoll(1);
- XYZ relative;
- relative=facing;
- relative.y=0;
- Normalise(&relative);
- //relative*=-1;
- relative.y-=.1;
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*70;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[lefthand]].velocity*=.1;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftwrist]].velocity*=.2;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftelbow]].velocity*=.5;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftshoulder]].velocity*=.7;
- victim->skeleton.joints[victim->skeleton.jointlabels[righthand]].velocity*=.1;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightwrist]].velocity*=.2;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightelbow]].velocity*=.5;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightshoulder]].velocity*=.7;
-
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*90/victim->protectionhigh);
-
- if(id==0){
- bonus=Reversal;
- bonustime=0;
- bonusvalue=60;
- }
-
- bool doslice;
- doslice=0;
- if(weaponactive!=-1||creature==wolftype)doslice=1;
- if(creature==rabbittype&&weaponactive!=-1)if(weapons.type[weaponids[0]]==staff)doslice=0;
- if(doslice){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(weaponactive!=-1){
- victim->DoBloodBig(2/victim->armorhigh,225);
- PlaySoundEx( knifeslicesound, samp[knifeslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifeslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifeslicesound], 512);
- FSOUND_SetPaused(channels[knifeslicesound], false);
- if(bloodtoggle&&!weapons.bloody[weaponids[weaponactive]])weapons.bloody[weaponids[weaponactive]]=1;
- weapons.blooddrip[weaponids[weaponactive]]+=3;
- }
- if(weaponactive==-1&&creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhigh,175);
- }
- }
- }
-
-
-
- if(targetanimation==swordslashreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- victim->RagDoll(1);
- XYZ relative;
- relative=facing;
- relative.y=0;
- Normalise(&relative);
- //relative*=-1;
- relative.y-=.1;
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*70;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[lefthand]].velocity*=.1-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftwrist]].velocity*=.2-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftelbow]].velocity*=.5-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[leftshoulder]].velocity*=.7-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[righthand]].velocity*=.1-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightwrist]].velocity*=.2-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightelbow]].velocity*=.5-1;
- victim->skeleton.joints[victim->skeleton.jointlabels[rightshoulder]].velocity*=.7-1;
-
- if(id==0){
- bonus=swordreversebonus;
- bonustime=0;
- bonusvalue=100;
- }
- //victim->DoDamage(90);
-
- /*if(weaponactive!=-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- victim->DoBloodBig(2,225);
- PlaySoundEx( knifeslicesound, samp[knifeslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifeslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifeslicesound], 512);
- FSOUND_SetPaused(channels[knifeslicesound], false);
- if(bloodtoggle&&!weapons.bloody[weaponids[weaponactive]])weapons.bloody[weaponids[weaponactive]]=1;
- weapons.blooddrip[weaponids[weaponactive]]+=3;
- }*/
- }
-
- if(hasvictim&&targetanimation==knifeslashreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,230);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- victim->RagDoll(0);
- XYZ relative;
- relative=victim->coords-oldcoords;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,-90,0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[abdomen]].velocity+=relative*damagemult*200;
- //FootLand(1,2);
- victim->Puff(abdomen);
- victim->DoDamage(damagemult*30/victim->protectionhigh);
-
- if(id==0){
- bonus=Reversal;
- bonustime=0;
- bonusvalue=60;
- }
- }
-
- if(hasvictim&&targetanimation==sneakattackanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- victim->RagDoll(0);
- victim->skeleton.spinny=0;
- XYZ relative;
- relative=facing*-1;
- relative.y=-3;
- Normalise(&relative);
- if(victim->id==0)relative/=30;
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*40;
- }
- //victim->DoDamage(1000);
- victim->damage=victim->damagetolerance;
- victim->permanentdamage=victim->damagetolerance-1;
- bool doslice;
- doslice=0;
- if(weaponactive!=-1||creature==wolftype)doslice=1;
- if(creature==rabbittype&&weaponactive!=-1)if(weapons.type[weaponids[0]]==staff)doslice=0;
- if(doslice){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(weaponactive!=-1){
- victim->DoBloodBig(200,225);
- PlaySoundEx( knifeslicesound, samp[knifeslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifeslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifeslicesound], 512);
- FSOUND_SetPaused(channels[knifeslicesound], false);
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
- weapons.blooddrip[weaponids[weaponactive]]+=5;
- }
-
- if(creature==wolftype&&weaponactive==-1){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2,175);
- }
- }
- if(id==0){
- bonus=spinecrusher;
- bonustime=0;
- bonusvalue=100;
- }
- }
-
- if(hasvictim&&(targetanimation==knifefollowanim||targetanimation==knifesneakattackanim)&&animation[targetanimation].label[currentframe]==5){
- if(weaponactive!=-1&&victim->bloodloss<victim->damagetolerance){
- escapednum=0;
- if(targetanimation==knifefollowanim)victim->DoBloodBig(200,210);
- if(targetanimation==knifesneakattackanim){
- /*victim->DoBloodBig(200,195);
- XYZ bloodvel;
- bloodvel=0;
- bloodvel.z=20;
- bloodvel.y=5;
- bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale;
- sprites.MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1);
- */
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=weapons.tippoint[weaponids[0]];
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=(weapons.tippoint[weaponids[0]]-weapons.position[weaponids[0]]);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1);
- victim->DoBloodBig(200,195);
- if(id==0){
- bonus=tracheotomy;
- bonustime=0;
- bonusvalue=100;
- }
-
- //victim->neckspurtamount=5;
- }
- if(targetanimation==knifefollowanim){
- if(id==0){
- bonus=Stabbonus;
- bonustime=0;
- bonusvalue=40;
- }
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=weapons.tippoint[weaponids[0]];
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=(weapons.tippoint[weaponids[0]]-weapons.position[weaponids[0]])*-1;
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .2, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .2, 1);
-
- }
- victim->bloodloss+=10000;
- victim->velocity=0;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( fleshstabsound, samp[fleshstabsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabsound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabsound], 512);
- FSOUND_SetPaused(channels[fleshstabsound], false);
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
- weapons.blooddrip[weaponids[weaponactive]]+=5;
- }
- }
-
- if(hasvictim&&(targetanimation==knifefollowanim||targetanimation==knifesneakattackanim)&&animation[targetanimation].label[currentframe]==6){
- escapednum=0;
- victim->velocity=0;
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=0;
- }
- if(targetanimation==knifefollowanim){
- victim->RagDoll(0);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=0;
- }
- }
- if(weaponactive!=-1&&animation[victim->targetanimation].attack!=reversal){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabremovesound], 512);
- FSOUND_SetPaused(channels[fleshstabremovesound], false);
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
- weapons.blooddrip[weaponids[weaponactive]]+=5;
-
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=weapons.tippoint[weaponids[0]];
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=(weapons.tippoint[weaponids[0]]-weapons.position[weaponids[0]])*-1;
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1);
- }
- }
-
- if(hasvictim&&(targetanimation==swordsneakattackanim)&&animation[targetanimation].label[currentframe]==5){
- if(weaponactive!=-1&&victim->bloodloss<victim->damagetolerance){
- if(id==0){
- bonus=backstab;
- bonustime=0;
- bonusvalue=100;
- }
-
- escapednum=0;
-
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=(weapons.tippoint[weaponids[0]]+weapons.position[weaponids[0]])/2;
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=(weapons.tippoint[weaponids[0]]-weapons.position[weaponids[0]]);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,DoRotation(footvel*5,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .3, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .3, 1);
- victim->DoBloodBig(200,180);
- victim->DoBloodBig(200,215);
- victim->bloodloss+=10000;
- victim->velocity=0;
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( fleshstabsound, samp[fleshstabsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabsound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabsound], 512);
- FSOUND_SetPaused(channels[fleshstabsound], false);
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
- weapons.blooddrip[weaponids[weaponactive]]+=5;
- }
- }
-
- if(hasvictim&&targetanimation==swordsneakattackanim&&animation[targetanimation].label[currentframe]==6){
- escapednum=0;
- victim->velocity=0;
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity=0;
- }
- if(weaponactive!=-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( fleshstabremovesound, samp[fleshstabremovesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[fleshstabremovesound], gLoc, vel);
- FSOUND_SetVolume(channels[fleshstabremovesound], 512);
- FSOUND_SetPaused(channels[fleshstabremovesound], false);
- if(bloodtoggle)weapons.bloody[weaponids[weaponactive]]=2;
- weapons.blooddrip[weaponids[weaponactive]]+=5;
-
- XYZ footvel,footpoint;
- footvel=0;
- footpoint=weapons.tippoint[weaponids[0]];
- if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3);
- footvel=(weapons.tippoint[weaponids[0]]-weapons.position[weaponids[0]])*-1;
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1);
- sprites.MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1);
- }
- }
-
- if(targetanimation==sweepreversalanim&&animation[targetanimation].label[currentframe]==7){
- escapednum=0;
- if(id==0)camerashake+=.4;
- if(Random()%2){
- victim->spurt=1;
- DoBlood(.2,240);
- }
- float gLoc[3];
- float vel[3];
- gLoc[0]=victim->coords.x;
- gLoc[1]=victim->coords.y;
- gLoc[2]=victim->coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- if(weaponactive==-1){
- if(tutoriallevel!=1){
- PlaySoundEx( heavyimpactsound, samp[heavyimpactsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[heavyimpactsound], gLoc, vel);
- FSOUND_SetVolume(channels[heavyimpactsound], 128);
- FSOUND_SetPaused(channels[heavyimpactsound], false);
- }
- }
- bool doslice;
- doslice=0;
- if(weaponactive!=-1||creature==wolftype)doslice=1;
- if(creature==rabbittype&&weaponactive!=-1)if(weapons.type[weaponids[0]]==staff)doslice=0;
- if(doslice){
- if(weaponactive!=-1){
- victim->DoBloodBig(2/victim->armorhead,225);
- PlaySoundEx( knifeslicesound, samp[knifeslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifeslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifeslicesound], 512);
- FSOUND_SetPaused(channels[knifeslicesound], false);
- if(bloodtoggle&&!weapons.bloody[weaponids[weaponactive]])weapons.bloody[weaponids[weaponactive]]=1;
- weapons.blooddrip[weaponids[weaponactive]]+=3;
- }
- if(weaponactive==-1&&creature==wolftype){
- PlaySoundEx( clawslicesound, samp[clawslicesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[clawslicesound], gLoc, vel);
- FSOUND_SetVolume(channels[clawslicesound], 128);
- FSOUND_SetPaused(channels[clawslicesound], false);
- victim->spurt=1;
- victim->DoBloodBig(2/victim->armorhead,175);
- }
- }
-
- if(id==0){
- bonus=Reversal;
- bonustime=0;
- bonusvalue=60;
- }
-
- victim->Puff(neck);
-
- XYZ relative;
- //relative=victim->coords-oldcoords;
- relative=facing*-1;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);
- relative.y=.5;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*20;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- if(victim->damage<victim->damagetolerance-100)victim->velocity=relative*200;
- victim->DoDamage(damagemult*100/victim->protectionhead);
- victim->velocity=0;
- }
-
- if(targetanimation==sweepreversalanim&&((animation[targetanimation].label[currentframe]==9&&victim->damage<victim->damagetolerance)||(animation[targetanimation].label[currentframe]==7&&victim->damage>victim->damagetolerance))){
- escapednum=0;
- victim->RagDoll(0);
- XYZ relative;
- //relative=victim->coords-oldcoords;
- relative=facing*-1;
- relative.y=0;
- Normalise(&relative);
- relative=DoRotation(relative,0,90,0);
- relative.y=.5;
- Normalise(&relative);
- for(i=0;i<victim->skeleton.num_joints;i++){
- victim->skeleton.joints[i].velocity+=relative*damagemult*20;
- }
- victim->skeleton.joints[victim->skeleton.jointlabels[head]].velocity+=relative*damagemult*200;
- }
-
- if(hasvictim&&(targetanimation==spinkickreversalanim||targetanimation==sweepreversalanim||targetanimation==rabbitkickreversalanim||targetanimation==upunchreversalanim||targetanimation==jumpreversalanim||targetanimation==swordslashreversalanim||targetanimation==knifeslashreversalanim||targetanimation==rabbittacklereversal||targetanimation==wolftacklereversal||targetanimation==staffhitreversalanim||targetanimation==staffspinhitreversalanim))
- if(victim->damage>victim->damagetolerance&&bonus!=reverseko){
- if(id==0){
- bonus=reverseko;
- bonustime=0;
- bonusvalue=100;
- }
- }
- }
-
-
- //Animation end
- if(targetframe>animation[currentanimation].numframes-1){
- targetframe=0;
- if(wasStop()){
- targetanimation=getIdle();
- FootLand(0,1);
- FootLand(1,1);
- }
- if(currentanimation==rabbittackleanim||currentanimation==rabbittacklinganim){
- targetanimation=rollanim;
- targetframe=3;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( movewhooshsound, samp[movewhooshsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[movewhooshsound], gLoc, vel);
- FSOUND_SetVolume(channels[movewhooshsound], 128);
- FSOUND_SetPaused(channels[movewhooshsound], false);
- }
- if(currentanimation==staggerbackhighanim){
- targetanimation=getIdle();
- }
- if(currentanimation==staggerbackhardanim){
- targetanimation=getIdle();
- }
- if(currentanimation==removeknifeanim){
- targetanimation=getIdle();
- }
- if(currentanimation==crouchremoveknifeanim){
- targetanimation=getCrouch();
- }
- if(currentanimation==backhandspringanim){
- targetanimation=getIdle();
- }
- if(currentanimation==dodgebackanim){
- targetanimation=getIdle();
- }
- if(currentanimation==drawleftanim){
- targetanimation=getIdle();
- }
- if(currentanimation==drawrightanim||currentanimation==crouchdrawrightanim){
- targetanimation=getIdle();
- if(currentanimation==crouchdrawrightanim){
- targetanimation=getCrouch();
- }
- if(weaponactive==-1)weaponactive=0;
- else if(weaponactive==0){
- weaponactive=-1;
- if(num_weapons==2){
- int buffer;
- buffer=weaponids[0];
- weaponids[0]=weaponids[1];
- weaponids[1]=buffer;
- }
- }
-
- if(weaponactive==-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifesheathesound, samp[knifesheathesound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifesheathesound], gLoc, vel);
- FSOUND_SetVolume(channels[knifesheathesound], 128);
- FSOUND_SetPaused(channels[knifesheathesound], false);
- }
- if(weaponactive!=-1){
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
-
- PlaySoundEx( knifedrawsound, samp[knifedrawsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[knifedrawsound], gLoc, vel);
- FSOUND_SetVolume(channels[knifedrawsound], 128);
- FSOUND_SetPaused(channels[knifedrawsound], false);
- }
- }
- if(currentanimation==rollanim){
- targetanimation=getCrouch();
- FootLand(0,1);
- FootLand(1,1);
- }
- if(isFlip()){
- if(targetanimation==walljumprightkickanim){
- targetrot=-190;
- }
- if(targetanimation==walljumpleftkickanim){
- targetrot=190;
- }
- targetanimation=jumpdownanim;
- }
- if(currentanimation==climbanim){
- targetanimation=getCrouch();
- targetframe=1;
- coords+=facing*.1;
- if(!isnormal(coords.x))
- coords=oldcoords;
- oldcoords=coords;
- collided=0;
- targetoffset=0;
- currentoffset=0;
- grabdelay=1;
- velocity=0;
- collided=0;
- avoidcollided=0;
- }
- if(targetanimation==rabbitkickreversalanim){
- targetanimation=getCrouch();
- lastfeint=0;
- }
- if(targetanimation==jumpreversalanim){
- targetanimation=getCrouch();
- lastfeint=0;
- }
- if(targetanimation==walljumprightanim||targetanimation==walljumpbackanim||targetanimation==walljumpfrontanim){
- if(attackkeydown&&targetanimation!=walljumpfrontanim){
- int closest=-1;
- float closestdist=-1;
- float distance;
- if(numplayers>1)
- for(i=0;i<numplayers;i++){
- if(id!=i&&player[i].coords.y<coords.y&&!player[i].skeleton.free){
- distance=findDistancefast(&player[i].coords,&coords);
- if(closestdist==-1||distance<closestdist){
- closestdist=distance;
- closest=i;
- }
- }
- }
- if(closestdist>0&&closest>=0&&closestdist<16){
- victim=&player[closest];
- targetanimation=walljumprightkickanim;
- targetframe=0;
- XYZ rotatetarget=victim->coords-coords;
- Normalise(&rotatetarget);
- rotation=-asin(0-rotatetarget.x);
- rotation*=360/6.28;
- if(rotatetarget.z<0)rotation=180-rotation;
- targettilt2=-asin(rotatetarget.y)*360/6.28;
- velocity=(victim->coords-coords)*4;
- velocity.y+=2;
- transspeed=40;
- }
- }
- if(targetanimation==walljumpbackanim){
- targetanimation=backflipanim;
- targetframe=3;
- velocity=facing*-8;
- velocity.y=4;
- if(id==0)FSOUND_SetPaused(channels[whooshsound], false);
- }
- if(targetanimation==walljumprightanim){
- targetanimation=rightflipanim;
- targetframe=4;
- targetrotation-=90;
- rotation-=90;
- velocity=DoRotation(facing,0,30,0)*-8;
- velocity.y=4;
- }
- if(targetanimation==walljumpfrontanim){
- targetanimation=frontflipanim;
- targetframe=2;
- //targetrotation-=180;
- ////rotation-=180;
- velocity=facing*8;
- velocity.y=4;
- }
- if(id==0)FSOUND_SetPaused(channels[whooshsound], false);
- }
- if(targetanimation==walljumpleftanim){
- if(attackkeydown){
- int closest=-1;
- float closestdist=-1;
- float distance;
- if(numplayers>1)
- for(i=0;i<numplayers;i++){
- if(id!=i&&player[i].coords.y<coords.y&&!player[i].skeleton.free){
- distance=findDistancefast(&player[i].coords,&coords);
- if(closestdist==-1||distance<closestdist){
- closestdist=distance;
- closest=i;
- }
- }
- }
- if(closestdist>0&&closest>=0&&closestdist<16){
- victim=&player[closest];
- targetanimation=walljumpleftkickanim;
- targetframe=0;
- XYZ rotatetarget=victim->coords-coords;
- Normalise(&rotatetarget);
- rotation=-asin(0-rotatetarget.x);
- rotation*=360/6.28;
- if(rotatetarget.z<0)rotation=180-rotation;
- targettilt2=-asin(rotatetarget.y)*360/6.28;
- velocity=(victim->coords-coords)*4;
- velocity.y+=2;
- transspeed=40;
- }
- }
- if(targetanimation!=walljumpleftkickanim){
- targetanimation=leftflipanim;
- targetframe=4;
- targetrotation+=90;
- rotation+=90;
- velocity=DoRotation(facing,0,-30,0)*-8;
- velocity.y=4;
- }
- if(id==0)FSOUND_SetPaused(channels[whooshsound], false);
- }
- if(targetanimation==sneakattackanim){
- float ycoords=oldcoords.y;
- currentanimation=getCrouch();
- targetanimation=getCrouch();
- targetframe=1;
- currentframe=0;
- targetrotation+=180;
- rotation+=180;
- targettilt2*=-1;
- tilt2*=-1;
- transspeed=1000000;
- targetheadrotation+=180;
- coords-=facing*.7;
- if(onterrain)coords.y=terrain.getHeight(coords.x,coords.z);
-
- lastfeint=0;
- }
- if(targetanimation==knifesneakattackanim||targetanimation==swordsneakattackanim){
- float ycoords=oldcoords.y;
- targetanimation=getIdle();
- targetframe=0;
- if(onterrain)coords.y=terrain.getHeight(coords.x,coords.z);
-
- lastfeint=0;
- }
- if(currentanimation==knifefollowanim){
- targetanimation=getIdle();
- lastfeint=0;
- }
- if(animation[targetanimation].attack==reversal&¤tanimation!=sneakattackanim&¤tanimation!=knifesneakattackanim&¤tanimation!=swordsneakattackanim&¤tanimation!=knifefollowanim){
- float ycoords=oldcoords.y;
- targetanimation=getStop();
- targetrotation+=180;
- rotation+=180;
- targettilt2*=-1;
- tilt2*=-1;
- transspeed=1000000;
- targetheadrotation+=180;
- if(!isnormal(coords.x))
- coords=oldcoords;
- if(currentanimation==spinkickreversalanim||currentanimation==swordslashreversalanim)
- oldcoords=coords+facing*.5;
- else if(currentanimation==sweepreversalanim)
- oldcoords=coords+facing*1.1;
- else if(currentanimation==upunchreversalanim){
- oldcoords=coords+facing*1.5;
- targetrotation+=180;
- rotation+=180;
- targetheadrotation+=180;
- targettilt2*=-1;
- tilt2*=-1;
- }
- else if(currentanimation==knifeslashreversalanim){
- oldcoords=coords+facing*.5;
- targetrotation+=90;
- rotation+=90;
- targetheadrotation+=90;
- targettilt2=0;
- tilt2=0;
- }
- else if(currentanimation==staffspinhitreversalanim){
- targetrotation+=180;
- rotation+=180;
- targetheadrotation+=180;
- targettilt2=0;
- tilt2=0;
- }
- if(onterrain)oldcoords.y=terrain.getHeight(oldcoords.x,oldcoords.z);
- else oldcoords.y=ycoords;
- currentoffset=coords-oldcoords;
- targetoffset=0;
- coords=oldcoords;
-
- lastfeint=0;
- }
- if(currentanimation==knifesneakattackedanim||currentanimation==swordsneakattackedanim){
- velocity=0;
- velocity.y=-5;
- RagDoll(0);
- }
- if(animation[targetanimation].attack==reversed){
- escapednum++;
- if(targetanimation==sweepreversedanim)targetrotation+=90;
- targetanimation=backhandspringanim;
- targetframe=2;
- float gLoc[3];
- float vel[3];
- gLoc[0]=coords.x;
- gLoc[1]=coords.y;
- gLoc[2]=coords.z;
- vel[0]=velocity.x;
- vel[1]=velocity.y;
- vel[2]=velocity.z;
- PlaySoundEx( landsound, samp[landsound], NULL, true);
- FSOUND_3D_SetAttributes(channels[landsound], gLoc, vel);
- FSOUND_SetVolume(channels[landsound], 128);
- FSOUND_SetPaused(channels[landsound], false);
-
- if(currentanimation==upunchreversedanim||currentanimation==swordslashreversedanim){
- targetanimation=rollanim;
- targetframe=5;
- oldcoords=coords;
- coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
- coords.y=oldcoords.y;
- }
- if(currentanimation==knifeslashreversedanim){
- targetanimation=rollanim;
- targetframe=0;
- targetrotation+=90;
- rotation+=90;
- oldcoords=coords;
- coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
- coords.y=oldcoords.y;
- }
- }
- if(wasFlip()){
- targetanimation=jumpdownanim;
- }
- if(wasLanding())targetanimation=getIdle();
- if(wasLandhard())targetanimation=getIdle();
- if(currentanimation==spinkickanim||currentanimation==getupfrombackanim||currentanimation==getupfromfrontanim||currentanimation==lowkickanim){
- targetanimation=getIdle();
- oldcoords=coords;
- coords+=(DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)+DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0))/2*scale;
- coords.y=oldcoords.y;
- //coords+=DoRotation(animation[currentanimation].offset,0,rotation,0)*scale;
- targetoffset.y=coords.y;
- if(onterrain)targetoffset.y=terrain.getHeight(coords.x,coords.z);
- currentoffset=DoRotation(animation[currentanimation].offset*-1,0,rotation,0)*scale;
- currentoffset.y-=(coords.y-targetoffset.y);
- coords.y=targetoffset.y;
- targetoffset=0;
- normalsupdatedelay=0;
- }
- if(currentanimation==upunchanim){
- targetanimation=getStop();
- normalsupdatedelay=0;
- lastfeint=0;
- }
- if(currentanimation==rabbitkickanim&&targetanimation!=backflipanim){
- targetrotation=rotation;
- bool hasstaff;
- hasstaff=0;
- if(num_weapons>0)if(weapons.type[0]==staff)hasstaff=1;
- if(!hasstaff)DoDamage(35);
- RagDoll(0);
- lastfeint=0;
- rabbitkickragdoll=1;
- }
- if(currentanimation==rabbitkickreversedanim){
- if(!feint){
- velocity=0;
- velocity.y=-10;
- //DoDamage(100);
- RagDoll(0);
- skeleton.spinny=0;
- if(id!=0)SolidHitBonus();
- }
- if(feint){
- escapednum++;
- targetanimation=rollanim;
- coords+=facing;
- if(id==0)FSOUND_SetPaused(channels[whooshsound], true);
- }
- lastfeint=0;
- }
- if(currentanimation==rabbittackledbackanim||currentanimation==rabbittackledfrontanim){
- velocity=0;
- velocity.y=-10;
- RagDoll(0);
- skeleton.spinny=0;
- }
- if(currentanimation==jumpreversedanim){
- if(!feint){
- velocity=0;
- velocity.y=-10;
- //DoDamage(100);
- RagDoll(0);
- skeleton.spinny=0;
- if(id!=0)SolidHitBonus();
- }
- if(feint){
- escapednum++;
- targetanimation=rollanim;
- coords+=facing*2;
- if(id==0)FSOUND_SetPaused(channels[whooshsound], true);
- }
- lastfeint=0;
- }
-
- if(animation[currentanimation].attack==normalattack&&!victim->skeleton.free&&victim->targetanimation!=staggerbackhighanim&&victim->targetanimation!=staggerbackhardanim&&targetanimation!=winduppunchblockedanim&&targetanimation!=blockhighleftanim&&targetanimation!=swordslashparryanim&&targetanimation!=swordslashparriedanim&&targetanimation!=crouchstabanim&&targetanimation!=swordgroundstabanim){
- targetanimation=getupfromfrontanim;
- lastfeint=0;
- }
- else if(animation[currentanimation].attack==normalattack){
- targetanimation=getIdle();
- lastfeint=0;
- }
- if(currentanimation==blockhighleftanim&&aitype!=playercontrolled){
- targetanimation=blockhighleftstrikeanim;
- }
- if(currentanimation==knifeslashstartanim||currentanimation==knifethrowanim||currentanimation==swordslashanim||currentanimation==staffhitanim||currentanimation==staffgroundsmashanim||currentanimation==staffspinhitanim){
- targetanimation=getIdle();
- lastfeint=0;
- }
- if(currentanimation==spinkickanim&&victim->skeleton.free){
- if(creature==rabbittype)targetanimation=fightidleanim;
- }
- }
- target=0;
-
- if(isIdle()&&!wasIdle())normalsupdatedelay=0;
-
- if(currentanimation==jumpupanim&&velocity.y<0&&!isFlip()){
- targetanimation=jumpdownanim;
- }
- }
- if(!skeleton.free){
- oldtarget=target;
- if(!transspeed&&animation[targetanimation].attack!=2&&animation[targetanimation].attack!=3){
- if(!isRun()||!wasRun()){
- if(animation[targetanimation].speed[targetframe]>animation[currentanimation].speed[currentframe])
- target+=multiplier*animation[targetanimation].speed[targetframe]*speed*2;
- if(animation[targetanimation].speed[targetframe]<=animation[currentanimation].speed[currentframe])
- target+=multiplier*animation[currentanimation].speed[currentframe]*speed*2;
- }
- if(isRun()&&wasRun()){
- float tempspeed;
- tempspeed=velspeed;
- if(tempspeed<10*speedmult)tempspeed=10*speedmult;
- target+=multiplier*animation[targetanimation].speed[currentframe]*speed*1.7*tempspeed/(speed*45*scale);
- }
- }
- else if(transspeed)target+=multiplier*transspeed*speed*2;
- else{
- if(!isRun()||!wasRun()){
- if(animation[targetanimation].speed[targetframe]>animation[currentanimation].speed[currentframe])
- target+=multiplier*animation[targetanimation].speed[targetframe]*2;
- if(animation[targetanimation].speed[targetframe]<=animation[currentanimation].speed[currentframe])
- target+=multiplier*animation[currentanimation].speed[currentframe]*2;
- }
- }
-
- if(currentanimation!=targetanimation)target=(target+oldtarget)/2;
-
- if(target>1){currentframe=targetframe; target=1;}
- oldrot=rot;
- rot=targetrot*target;
- rotation+=rot-oldrot;
- if(target==1){
- rot=0;
- oldrot=0;
- targetrot=0;
- }
- if(currentanimation!=oldcurrentanimation||targetanimation!=oldtargetanimation||((currentframe!=oldcurrentframe||targetframe!=oldtargetframe)&&!calcrot)){
- //Old rotates
- for(i=0;i<skeleton.num_joints;i++){
- skeleton.joints[i].position=animation[currentanimation].position[i][currentframe];
- }
-
- skeleton.FindForwards();
-
- for(i=0;i<skeleton.num_muscles;i++){
- if(skeleton.muscles[i].visible)
- {
- skeleton.FindRotationMuscle(i,targetanimation);
- }
- }
- for(i=0;i<skeleton.num_muscles;i++){
- if(skeleton.muscles[i].visible)
- {
- if(isnormal((float)((int)(skeleton.muscles[i].rotate1*100)%36000)/100))skeleton.muscles[i].oldrotate1=(float)((int)(skeleton.muscles[i].rotate1*100)%36000)/100;
- if(isnormal((float)((int)(skeleton.muscles[i].rotate2*100)%36000)/100))skeleton.muscles[i].oldrotate2=(float)((int)(skeleton.muscles[i].rotate2*100)%36000)/100;
- if(isnormal((float)((int)(skeleton.muscles[i].rotate3*100)%36000)/100))skeleton.muscles[i].oldrotate3=(float)((int)(skeleton.muscles[i].rotate3*100)%36000)/100;
- }
- }
-
- //New rotates
- for(i=0;i<skeleton.num_joints;i++){
- skeleton.joints[i].position=animation[targetanimation].position[i][targetframe];
- }
-
- skeleton.FindForwards();
-
- for(i=0;i<skeleton.num_muscles;i++){
- if(skeleton.muscles[i].visible)
- {
- skeleton.FindRotationMuscle(i,targetanimation);
- }
- }
- for(i=0;i<skeleton.num_muscles;i++){
- if(skeleton.muscles[i].visible)
- {
- if(isnormal((float)((int)(skeleton.muscles[i].rotate1*100)%36000)/100))skeleton.muscles[i].newrotate1=(float)((int)(skeleton.muscles[i].rotate1*100)%36000)/100;
- if(isnormal((float)((int)(skeleton.muscles[i].rotate2*100)%36000)/100))skeleton.muscles[i].newrotate2=(float)((int)(skeleton.muscles[i].rotate2*100)%36000)/100;
- if(isnormal((float)((int)(skeleton.muscles[i].rotate3*100)%36000)/100))skeleton.muscles[i].newrotate3=(float)((int)(skeleton.muscles[i].rotate3*100)%36000)/100;
- if(skeleton.muscles[i].newrotate3>skeleton.muscles[i].oldrotate3+180)skeleton.muscles[i].newrotate3-=360;
- if(skeleton.muscles[i].newrotate3<skeleton.muscles[i].oldrotate3-180)skeleton.muscles[i].newrotate3+=360;
- if(skeleton.muscles[i].newrotate2>skeleton.muscles[i].oldrotate2+180)skeleton.muscles[i].newrotate2-=360;
- if(skeleton.muscles[i].newrotate2<skeleton.muscles[i].oldrotate2-180)skeleton.muscles[i].newrotate2+=360;
- if(skeleton.muscles[i].newrotate1>skeleton.muscles[i].oldrotate1+180)skeleton.muscles[i].newrotate1-=360;
- if(skeleton.muscles[i].newrotate1<skeleton.muscles[i].oldrotate1-180)skeleton.muscles[i].newrotate1+=360;
- }
- }
- }
- if(currentframe>=animation[currentanimation].numframes)currentframe=animation[currentanimation].numframes-1;
-
- oldcurrentanimation=currentanimation;
- oldtargetanimation=targetanimation;
- oldtargetframe=targetframe;
- oldcurrentframe=currentframe;
-
- for(i=0;i<skeleton.num_joints;i++){
- skeleton.joints[i].velocity=(animation[currentanimation].position[i][currentframe]*(1-target)+animation[targetanimation].position[i][targetframe]*(target)-skeleton.joints[i].position)/multiplier;
- skeleton.joints[i].position=animation[currentanimation].position[i][currentframe]*(1-target)+animation[targetanimation].position[i][targetframe]*(target);
- }
- offset=currentoffset*(1-target)+targetoffset*target;
- for(i=0;i<skeleton.num_muscles;i++){
- if(skeleton.muscles[i].visible)
- {
- skeleton.muscles[i].rotate1=skeleton.muscles[i].oldrotate1*(1-target)+skeleton.muscles[i].newrotate1*(target);
- skeleton.muscles[i].rotate2=skeleton.muscles[i].oldrotate2*(1-target)+skeleton.muscles[i].newrotate2*(target);
- skeleton.muscles[i].rotate3=skeleton.muscles[i].oldrotate3*(1-target)+skeleton.muscles[i].newrotate3*(target);
- }
- }
- }
-
- if(isLanding()&&landhard){
- //if(abs(velocity.y)>fast_sqrt(velocity.x*velocity.x*velocity.z*velocity.z)){
- if(id==0)camerashake+=.4;
- targetanimation=getLandhard();
- targetframe=0;
- target=0;
- landhard=0;
- transspeed=15;
- //}
- }
- }
- //skeleton.DoConstraints();
+ int oldplayerdetail;
+ if ((frustum.SphereInFrustum(coords.x, coords.y + scale * 3, coords.z, scale * 8) && distsq(&viewer, &coords) < viewdistance * viewdistance) || skeleton.free == 3) {
+ if (onterrain && (isIdle() || isCrouch() || wasIdle() || wasCrouch()) && !skeleton.free) {
+ calcrot = 1;
+ }
+
+ if (headless) {
+ headmorphness = 0;
+ headmorphstart = 6;
+ headmorphend = 6;
+ }
+
+ glAlphaFunc(GL_GREATER, 0.0001);
+ XYZ terrainlight;
+ float terrainheight;
+ float distance;
+ if (!isnormal(yaw))
+ yaw = 0;
+ if (!isnormal(tilt))
+ tilt = 0;
+ if (!isnormal(tilt2))
+ tilt2 = 0;
+ oldplayerdetail = playerdetail;
+ playerdetail = 0;
+ if (distsq(&viewer, &coords) < viewdistance * viewdistance / 32 && detail == 2) {
+ playerdetail = 1;
+ }
+ if (distsq(&viewer, &coords) < viewdistance * viewdistance / 128 && detail == 1) {
+ playerdetail = 1;
+ }
+ if (distsq(&viewer, &coords) < viewdistance * viewdistance / 256 && (detail != 1 && detail != 2)) {
+ playerdetail = 1;
+ }
+ if (id == 0)
+ playerdetail = 1;
+ if (playerdetail != oldplayerdetail) {
+ updatedelay = 0;
+ normalsupdatedelay = 0;
+ }
+ static float updatedelaychange;
+ static float morphness;
+ static float framemult;
+ if (calcrot) {
+ skeleton.FindForwards();
+ if (howactive == typesittingwall) {
+ skeleton.specialforward[1] = 0;
+ skeleton.specialforward[1].z = 1;
+ }
+ }
+ static XYZ mid;
+ static float M[16];
+ static int i, j, k;
+ static int weaponattachmuscle;
+ static int weaponrotatemuscle;
+ static XYZ weaponpoint;
+ static int start, endthing;
+ if ((dead != 2 || skeleton.free != 2) && updatedelay <= 0) {
+ if (!isSleeping() && !isSitting()) {
+ // TODO: give these meaningful names
+ const bool cond1 = (isIdle() || isCrouch() || isLanding() || isLandhard()
+ || animTarget == drawrightanim || animTarget == drawleftanim || animTarget == crouchdrawrightanim);
+ const bool cond2 = (wasIdle() || wasCrouch() || wasLanding() || wasLandhard()
+ || animCurrent == drawrightanim || animCurrent == drawleftanim || animCurrent == crouchdrawrightanim);
+
+ if (onterrain && (cond1 && cond2) && !skeleton.free) {
+ IKHelper(this, 1);
+ if (creature == wolftype)
+ IKHelper(this, 1);
+ }
+
+ if (onterrain && (cond1 && !cond2) && !skeleton.free) {
+ IKHelper(this, target);
+ if (creature == wolftype)
+ IKHelper(this, target);
+ }
+
+ if (onterrain && (!cond1 && cond2) && !skeleton.free) {
+ IKHelper(this, 1 - target);
+ if (creature == wolftype)
+ 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()))
+ DoHead();
+ else {
+ targetheadyaw = -targetyaw;
+ targetheadpitch = 0;
+ if (Animation::animations[animTarget].attack == 3)
+ targetheadyaw += 180;
+ }
+ for (i = 0; i < skeleton.drawmodel.vertexNum; i++) {
+ skeleton.drawmodel.vertex[i] = 0;
+ skeleton.drawmodel.vertex[i].y = 999;
+ }
+ for (i = 0; i < skeleton.drawmodellow.vertexNum; i++) {
+ skeleton.drawmodellow.vertex[i] = 0;
+ skeleton.drawmodellow.vertex[i].y = 999;
+ }
+ for (i = 0; i < skeleton.drawmodelclothes.vertexNum; i++) {
+ skeleton.drawmodelclothes.vertex[i] = 0;
+ skeleton.drawmodelclothes.vertex[i].y = 999;
+ }
+ for (int i = 0; i < skeleton.muscles.size(); i++) {
+ // convenience renames
+ const int p1 = skeleton.muscles[i].parent1->label;
+ const int p2 = skeleton.muscles[i].parent2->label;
+
+ if ((skeleton.muscles[i].vertices.size() > 0 && playerdetail) || (skeleton.muscles[i].verticeslow.size() > 0 && !playerdetail)) {
+ morphness = 0;
+ start = 0;
+ endthing = 0;
+
+ if (p1 == righthand || p2 == righthand) {
+ morphness = righthandmorphness;
+ start = righthandmorphstart;
+ endthing = righthandmorphend;
+ }
+ if (p1 == lefthand || p2 == lefthand) {
+ morphness = lefthandmorphness;
+ start = lefthandmorphstart;
+ endthing = lefthandmorphend;
+ }
+ if (p1 == head || p2 == head) {
+ morphness = headmorphness;
+ start = headmorphstart;
+ endthing = headmorphend;
+ }
+ if ((p1 == neck && p2 == abdomen) || (p2 == neck && p1 == abdomen)) {
+ morphness = chestmorphness;
+ start = chestmorphstart;
+ endthing = chestmorphend;
+ }
+ if ((p1 == groin && p2 == abdomen) || (p2 == groin && p1 == abdomen)) {
+ morphness = tailmorphness;
+ start = tailmorphstart;
+ endthing = tailmorphend;
+ }
+ if (calcrot)
+ skeleton.FindRotationMuscle(i, animTarget);
+ mid = (skeleton.muscles[i].parent1->position + skeleton.muscles[i].parent2->position) / 2;
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ if (!skeleton.free)
+ glRotatef(tilt2, 1, 0, 0);
+ if (!skeleton.free)
+ 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);
+
+ skeleton.muscles[i].lastrotate2 = skeleton.muscles[i].rotate2;
+ glRotatef(-skeleton.muscles[i].lastrotate2 + 90, 0, 0, 1);
+
+ skeleton.muscles[i].lastrotate3 = skeleton.muscles[i].rotate3;
+ glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0);
+
+ if (playerdetail || skeleton.free == 3) {
+ for (j = 0; j < skeleton.muscles[i].vertices.size(); j++) {
+ XYZ &v0 = skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]];
+ XYZ &v1 = skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]];
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ if (p1 == abdomen || p2 == abdomen)
+ 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);
+ if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow)
+ 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);
+ if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee)
+ 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);
+ if (p1 == head || p2 == head)
+ 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;
+ skeleton.drawmodel.vertex[skeleton.muscles[i].vertices[j]].z = M[14] * scale;
+ glPopMatrix();
+ }
+ }
+ if (!playerdetail || skeleton.free == 3) {
+ for (j = 0; j < skeleton.muscles[i].verticeslow.size(); j++) {
+ XYZ &v0 = skeleton.modellow.vertex[skeleton.muscles[i].verticeslow[j]];
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ if (p1 == abdomen || p2 == abdomen)
+ glTranslatef(v0.x * proportionbody.x,
+ v0.y * proportionbody.y,
+ v0.z * proportionbody.z);
+ if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow)
+ glTranslatef(v0.x * proportionarms.x,
+ v0.y * proportionarms.y,
+ v0.z * proportionarms.z);
+ if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee)
+ glTranslatef(v0.x * proportionlegs.x,
+ v0.y * proportionlegs.y,
+ v0.z * proportionlegs.z);
+ if (p1 == head || p2 == head)
+ 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;
+ skeleton.drawmodellow.vertex[skeleton.muscles[i].verticeslow[j]].y = M[13] * scale;
+ skeleton.drawmodellow.vertex[skeleton.muscles[i].verticeslow[j]].z = M[14] * scale;
+ glPopMatrix();
+ }
+ }
+ glPopMatrix();
+ }
+ if (skeleton.clothes && skeleton.muscles[i].verticesclothes.size() > 0) {
+ mid = (skeleton.muscles[i].parent1->position + skeleton.muscles[i].parent2->position) / 2;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ if (!skeleton.free)
+ glRotatef(tilt2, 1, 0, 0);
+ if (!skeleton.free)
+ 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);
+
+ skeleton.muscles[i].lastrotate2 = skeleton.muscles[i].rotate2;
+ glRotatef(-skeleton.muscles[i].lastrotate2 + 90, 0, 0, 1);
+
+ skeleton.muscles[i].lastrotate3 = skeleton.muscles[i].rotate3;
+ glRotatef(-skeleton.muscles[i].lastrotate3, 0, 1, 0);
+
+ for (j = 0; j < skeleton.muscles[i].verticesclothes.size(); j++) {
+ XYZ &v0 = skeleton.modelclothes.vertex[skeleton.muscles[i].verticesclothes[j]];
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ if (p1 == abdomen || p2 == abdomen)
+ glTranslatef(v0.x * proportionbody.x,
+ v0.y * proportionbody.y,
+ v0.z * proportionbody.z);
+ if (p1 == lefthand || p1 == righthand || p1 == leftwrist || p1 == rightwrist || p1 == leftelbow || p1 == rightelbow || p2 == leftelbow || p2 == rightelbow)
+ glTranslatef(v0.x * proportionarms.x,
+ v0.y * proportionarms.y,
+ v0.z * proportionarms.z);
+ if (p1 == leftfoot || p1 == rightfoot || p1 == leftankle || p1 == rightankle || p1 == leftknee || p1 == rightknee || p2 == leftknee || p2 == rightknee)
+ glTranslatef(v0.x * proportionlegs.x,
+ v0.y * proportionlegs.y,
+ v0.z * proportionlegs.z);
+ if (p1 == head || p2 == head)
+ 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;
+ skeleton.drawmodelclothes.vertex[skeleton.muscles[i].verticesclothes[j]].z = M[14] * scale;
+ glPopMatrix();
+ }
+ glPopMatrix();
+ }
+ updatedelay = 1 + (float)(Random() % 100) / 1000;
+ }
+ if (skeleton.free != 2 && (skeleton.free == 1 || skeleton.free == 3 || id == 0 || (normalsupdatedelay <= 0) || animTarget == getupfromfrontanim || animTarget == getupfrombackanim || animCurrent == getupfromfrontanim || animCurrent == getupfrombackanim)) {
+ normalsupdatedelay = 1;
+ if (playerdetail || skeleton.free == 3)
+ skeleton.drawmodel.CalculateNormals(0);
+ if (!playerdetail || skeleton.free == 3)
+ skeleton.drawmodellow.CalculateNormals(0);
+ if (skeleton.clothes)
+ skeleton.drawmodelclothes.CalculateNormals(0);
+ } else {
+ if (playerdetail || skeleton.free == 3)
+ skeleton.drawmodel.UpdateVertexArrayNoTexNoNorm();
+ if (!playerdetail || skeleton.free == 3)
+ skeleton.drawmodellow.UpdateVertexArrayNoTexNoNorm();
+ if (skeleton.clothes) {
+ skeleton.drawmodelclothes.UpdateVertexArrayNoTexNoNorm();
+ }
+ }
+ }
+ framemult = .01;
+ updatedelaychange = -framemult * 4 * (45 - findDistance(&viewer, &coords) * 1);
+ if (updatedelaychange > -realmultiplier * 30)
+ updatedelaychange = -realmultiplier * 30;
+ if (updatedelaychange > -framemult * 4)
+ updatedelaychange = -framemult * 4;
+ if (skeleton.free == 1)
+ updatedelaychange *= 6;
+ if (id == 0)
+ updatedelaychange *= 8;
+ updatedelay += updatedelaychange;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glTranslatef(coords.x, coords.y - .02, coords.z);
+ if (!skeleton.free) {
+ glTranslatef(offset.x * scale, offset.y * scale, offset.z * scale);
+ glRotatef(yaw, 0, 1, 0);
+ }
+ if (showpoints) {
+ glPointSize(5);
+ glColor4f(.4, 1, .4, 1);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glBegin(GL_POINTS);
+ if (playerdetail)
+ for (i = 0; i < skeleton.drawmodel.vertexNum; i++) {
+ XYZ &v0 = skeleton.drawmodel.vertex[i];
+ glVertex3f(v0.x, v0.y, v0.z);
+ }
+ glEnd();
+ glBegin(GL_LINES);
+
+ if (playerdetail)
+ for (i = 0; i < skeleton.drawmodel.TriangleNum; i++) {
+ XYZ &v0 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[0]];
+ XYZ &v1 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[1]];
+ XYZ &v2 = skeleton.drawmodel.vertex[skeleton.drawmodel.Triangles[i].vertex[2]];
+ glVertex3f(v0.x, v0.y, v0.z);
+ glVertex3f(v1.x, v1.y, v1.z);
+ glVertex3f(v1.x, v1.y, v1.z);
+ glVertex3f(v2.x, v2.y, v2.z);
+ glVertex3f(v2.x, v2.y, v2.z);
+ glVertex3f(v0.x, v0.y, v0.z);
+ }
+
+ glEnd();
+ }
+
+ terrainlight = terrain.getLighting(coords.x, coords.z);
+ distance = distsq(&viewer, &coords);
+ distance = (viewdistance * viewdistance - (distance - (viewdistance * viewdistance * fadestart)) * (1 / (1 - fadestart))) / viewdistance / viewdistance;
+ if (distance > 1)
+ distance = 1;
+ if (distance > 0) {
+ terrainheight = (coords.y - terrain.getHeight(coords.x, coords.z)) / 3 + 1;
+ if (terrainheight < 1)
+ terrainheight = 1;
+ if (terrainheight > 1.7)
+ terrainheight = 1.7;
+
+ glColor4f((1 - (1 - terrainlight.x) / terrainheight) - burnt, (1 - (1 - terrainlight.y) / terrainheight) - burnt, (1 - (1 - terrainlight.z) / terrainheight) - burnt, distance);
+ glDisable(GL_BLEND);
+ glAlphaFunc(GL_GREATER, 0.0001);
+ glEnable(GL_TEXTURE_2D);
+ if (cellophane) {
+ glDisable(GL_TEXTURE_2D);
+ glColor4f(.7, .35, 0, .5);
+ glDepthMask(0);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ }
+ if (tutoriallevel && id != 0) {
+ glColor4f(.7, .7, .7, 0.6);
+ glDepthMask(0);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ if (canattack && cananger)
+ 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);
+ glTranslatef(-smoketex, 0, 0);
+ }
+ if (playerdetail) {
+ if (!showpoints) {
+ if ((tutoriallevel && id != 0))
+ skeleton.drawmodel.drawdifftex(Sprite::cloudimpacttexture);
+ else
+ skeleton.drawmodel.draw();
+ }
+ }
+ if (!playerdetail) {
+ if ((tutoriallevel && id != 0))
+ skeleton.drawmodellow.drawdifftex(Sprite::cloudimpacttexture);
+ else
+ skeleton.drawmodellow.drawdifftex(skeleton.drawmodel.textureptr);
+ }
+
+ if (!(Animation::animations[animTarget].attack == normalattack || Animation::animations[animTarget].attack == reversed))
+ if (tutoriallevel && id != 0) {
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glEnable(GL_TEXTURE_2D);
+ glColor4f(.7, .7, .7, 0.6);
+ glDepthMask(0);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_BLEND);
+ if (canattack && cananger)
+ 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) {
+ if ((tutoriallevel && id != 0))
+ skeleton.drawmodel.drawdifftex(Sprite::cloudimpacttexture);
+ else
+ skeleton.drawmodel.draw();
+ }
+ }
+ if (!playerdetail) {
+ if ((tutoriallevel && id != 0))
+ skeleton.drawmodellow.drawdifftex(Sprite::cloudimpacttexture);
+ else
+ skeleton.drawmodellow.drawdifftex(skeleton.drawmodel.textureptr);
+ }
+ }
+
+
+ if (tutoriallevel && id != 0) {
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glEnable(GL_TEXTURE_2D);
+ }
+ if (skeleton.clothes) {
+ glDepthMask(0);
+ glEnable(GL_BLEND);
+ if (!immediate)
+ skeleton.drawmodelclothes.draw();
+ if (immediate)
+ skeleton.drawmodelclothes.drawimmediate();
+ glDepthMask(1);
+ }
+ }
+ glPopMatrix();
+
+ if (num_weapons > 0) {
+ for (k = 0; k < num_weapons; k++) {
+ i = weaponids[k];
+ if (weaponactive == k) {
+ if (weapons[i].getType() != staff) {
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) {
+ weaponattachmuscle = j;
+ }
+ }
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ if ((skeleton.muscles[j].parent1->label == rightwrist || skeleton.muscles[j].parent2->label == rightwrist) && (skeleton.muscles[j].parent1->label != righthand && skeleton.muscles[j].parent2->label != righthand) && skeleton.muscles[j].vertices.size() > 0) {
+ weaponrotatemuscle = j;
+ }
+ }
+ weaponpoint = (skeleton.muscles[weaponattachmuscle].parent1->position + skeleton.muscles[weaponattachmuscle].parent2->position) / 2;
+ if (creature == wolftype)
+ weaponpoint = (jointPos(rightwrist) * .7 + jointPos(righthand) * .3);
+ }
+ if (weapons[i].getType() == staff) {
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ if ((skeleton.muscles[j].parent1->label == righthand || skeleton.muscles[j].parent2->label == righthand) && skeleton.muscles[j].vertices.size() > 0) {
+ weaponattachmuscle = j;
+ }
+ }
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ if ((skeleton.muscles[j].parent1->label == rightelbow || skeleton.muscles[j].parent2->label == rightelbow) && (skeleton.muscles[j].parent1->label != rightshoulder && skeleton.muscles[j].parent2->label != rightshoulder) && skeleton.muscles[j].vertices.size() > 0) {
+ weaponrotatemuscle = j;
+ }
+ }
+ //weaponpoint=jointPos(rightwrist);
+ weaponpoint = (skeleton.muscles[weaponattachmuscle].parent1->position + skeleton.muscles[weaponattachmuscle].parent2->position) / 2;
+ //weaponpoint+=skeleton.specialforward[1]*.1+(jointPos(rightwrist)-jointPos(rightelbow));
+ XYZ tempnormthing, vec1, vec2;
+ vec1 = (jointPos(rightwrist) - jointPos(rightelbow));
+ vec2 = (jointPos(rightwrist) - jointPos(rightshoulder));
+ CrossProduct(&vec1, &vec2, &tempnormthing);
+ Normalise(&tempnormthing);
+ if (animTarget != staffhitanim && animCurrent != staffhitanim && animTarget != staffgroundsmashanim && animCurrent != staffgroundsmashanim && animTarget != staffspinhitanim && animCurrent != staffspinhitanim)
+ weaponpoint += tempnormthing * .1 - skeleton.specialforward[1] * .3 + (jointPos(rightwrist) - jointPos(rightelbow));
+ }
+ }
+ if (weaponactive != k && weaponstuck != k) {
+ if (weapons[i].getType() == knife)
+ weaponpoint = jointPos(abdomen) + (jointPos(righthip) - jointPos(lefthip)) * .1 + (jointPos(rightshoulder) - jointPos(leftshoulder)) * .35;
+ if (weapons[i].getType() == sword)
+ weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33;
+ if (weapons[i].getType() == staff)
+ weaponpoint = jointPos(abdomen) + (jointPos(lefthip) - jointPos(righthip)) * .09 + (jointPos(leftshoulder) - jointPos(rightshoulder)) * .33;
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ 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;
+ }
+ }
+ }
+ if (weaponstuck == k) {
+ if (weaponstuckwhere == 0)
+ weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 - skeleton.forward * .8;
+ else
+ weaponpoint = jointPos(abdomen) * .5 + jointPos(neck) * .5 + skeleton.forward * .8;
+ for (j = 0; j < skeleton.muscles.size(); j++) {
+ 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;
+ }
+ }
+ }
+ if (skeleton.free) {
+ weapons[i].position = weaponpoint * scale + coords;
+ weapons[i].bigrotation = 0;
+ weapons[i].bigtilt = 0;
+ weapons[i].bigtilt2 = 0;
+ } else {
+ weapons[i].position = DoRotation(DoRotation(DoRotation(weaponpoint, 0, 0, tilt), tilt2, 0, 0), 0, yaw, 0) * scale + coords + currentoffset * (1 - target) * scale + targetoffset * target * scale;
+ weapons[i].bigrotation = yaw;
+ weapons[i].bigtilt = tilt;
+ weapons[i].bigtilt2 = tilt2;
+ }
+ weapons[i].rotation1 = skeleton.muscles[weaponrotatemuscle].lastrotate1;
+ weapons[i].rotation2 = skeleton.muscles[weaponrotatemuscle].lastrotate2;
+ weapons[i].rotation3 = skeleton.muscles[weaponrotatemuscle].lastrotate3;
+ if (weaponactive == k) {
+ if (weapons[i].getType() == knife) {
+ weapons[i].smallrotation = 180;
+ weapons[i].smallrotation2 = 0;
+ if (isCrouch() || wasCrouch()) {
+ weapons[i].smallrotation2 = 20;
+ }
+ if (animTarget == hurtidleanim) {
+ weapons[i].smallrotation2 = 50;
+ }
+ if ((animCurrent == crouchstabanim && animTarget == crouchstabanim) || (animCurrent == backhandspringanim && animTarget == backhandspringanim)) {
+ XYZ temppoint1, temppoint2;
+ float distance;
+
+ temppoint1 = jointPos(righthand);
+ temppoint2 = currentFrame().weapontarget * (1 - target) + targetFrame().weapontarget * (target);
+ distance = findDistance(&temppoint1, &temppoint2);
+ weapons[i].rotation2 = asin((temppoint1.y - temppoint2.y) / distance);
+ weapons[i].rotation2 *= 360 / 6.28;
+ temppoint1.y = 0;
+ temppoint2.y = 0;
+ weapons[i].rotation1 = acos((temppoint1.z - temppoint2.z) / findDistance(&temppoint1, &temppoint2));
+ weapons[i].rotation1 *= 360 / 6.28;
+ weapons[i].rotation3 = 0;
+ weapons[i].smallrotation = -90;
+ weapons[i].smallrotation2 = 0;
+ if (temppoint1.x > temppoint2.x)
+ weapons[i].rotation1 = 360 - weapons[i].rotation1;
+ }
+ if ((animCurrent == knifeslashreversalanim && animTarget == knifeslashreversalanim) || (animCurrent == knifeslashreversedanim && animTarget == knifeslashreversedanim)) {
+ XYZ temppoint1, temppoint2;
+ float distance;
+
+ temppoint1 = jointPos(righthand);
+ temppoint2 = currentFrame().weapontarget * (1 - target) + targetFrame().weapontarget * (target);
+ distance = findDistance(&temppoint1, &temppoint2);
+ weapons[i].rotation2 = asin((temppoint1.y - temppoint2.y) / distance);
+ weapons[i].rotation2 *= 360 / 6.28;
+ temppoint1.y = 0;
+ temppoint2.y = 0;
+ weapons[i].rotation1 = acos((temppoint1.z - temppoint2.z) / findDistance(&temppoint1, &temppoint2));
+ weapons[i].rotation1 *= 360 / 6.28;
+ weapons[i].rotation3 = 0;
+ weapons[i].smallrotation = 90;
+ weapons[i].smallrotation2 = 0;
+ if (temppoint1.x > temppoint2.x)
+ weapons[i].rotation1 = 360 - weapons[i].rotation1;
+ }
+ if (animTarget == knifethrowanim) {
+ weapons[i].smallrotation = 90;
+ //weapons[i].smallrotation2=-90;
+ weapons[i].smallrotation2 = 0;
+ weapons[i].rotation1 = 0;
+ weapons[i].rotation2 = 0;
+ weapons[i].rotation3 = 0;
+ }
+ if (animTarget == knifesneakattackanim && frameTarget < 5) {
+ weapons[i].smallrotation = -90;
+ weapons[i].rotation1 = 0;
+ weapons[i].rotation2 = 0;
+ weapons[i].rotation3 = 0;
+ }
+ }
+ if (weapons[i].getType() == sword) {
+ weapons[i].smallrotation = 0;
+ weapons[i].smallrotation2 = 0;
+ if (animTarget == knifethrowanim) {
+ weapons[i].smallrotation = -90;
+ weapons[i].smallrotation2 = 0;
+ weapons[i].rotation1 = 0;
+ weapons[i].rotation2 = 0;
+ weapons[i].rotation3 = 0;
+ }
+ if ((animTarget == swordgroundstabanim && animCurrent == swordgroundstabanim) || (animTarget == swordsneakattackanim && animCurrent == swordsneakattackanim) || (animTarget == swordslashparryanim && animCurrent == swordslashparryanim) || (animTarget == swordslashparriedanim && animCurrent == swordslashparriedanim) || (animTarget == swordslashreversalanim && animCurrent == swordslashreversalanim) || (animTarget == swordslashreversedanim && animCurrent == swordslashreversedanim) || (animTarget == knifeslashreversalanim && animCurrent == knifeslashreversalanim) || (animTarget == knifeslashreversedanim && animCurrent == knifeslashreversedanim) || (animTarget == swordslashanim && animCurrent == swordslashanim) || (animTarget == drawleftanim && animCurrent == drawleftanim) || (animCurrent == backhandspringanim && animTarget == backhandspringanim)) {
+ XYZ temppoint1, temppoint2;
+ float distance;
+
+ temppoint1 = currentFrame().joints[skeleton.jointlabels[righthand]].position * (1 - target) + targetFrame().joints[skeleton.jointlabels[righthand]].position * (target); //jointPos(righthand);
+ temppoint2 = currentFrame().weapontarget * (1 - target) + targetFrame().weapontarget * (target);
+ distance = findDistance(&temppoint1, &temppoint2);
+ weapons[i].rotation2 = asin((temppoint1.y - temppoint2.y) / distance);
+ weapons[i].rotation2 *= 360 / 6.28;
+ temppoint1.y = 0;
+ temppoint2.y = 0;
+ weapons[i].rotation1 = acos((temppoint1.z - temppoint2.z) / findDistance(&temppoint1, &temppoint2));
+ weapons[i].rotation1 *= 360 / 6.28;
+ weapons[i].rotation3 = 0;
+ weapons[i].smallrotation = 90;
+ weapons[i].smallrotation2 = 0;
+ if (temppoint1.x > temppoint2.x)
+ weapons[i].rotation1 = 360 - weapons[i].rotation1;
+ }
+ }
+ if (weapons[i].getType() == staff) {
+ weapons[i].smallrotation = 100;
+ weapons[i].smallrotation2 = 0;
+ if ((animTarget == staffhitanim && animCurrent == staffhitanim) || (animTarget == staffhitreversedanim && animCurrent == staffhitreversedanim) || (animTarget == staffspinhitreversedanim && animCurrent == staffspinhitreversedanim) || (animTarget == staffgroundsmashanim && animCurrent == staffgroundsmashanim) || (animTarget == staffspinhitanim && animCurrent == staffspinhitanim)) {
+ XYZ temppoint1, temppoint2;
+ float distance;
+
+ temppoint1 = currentFrame().joints[skeleton.jointlabels[righthand]].position * (1 - target) + targetFrame().joints[skeleton.jointlabels[righthand]].position * (target); //jointPos(righthand);
+ temppoint2 = currentFrame().weapontarget * (1 - target) + targetFrame().weapontarget * (target);
+ distance = findDistance(&temppoint1, &temppoint2);
+ weapons[i].rotation2 = asin((temppoint1.y - temppoint2.y) / distance);
+ weapons[i].rotation2 *= 360 / 6.28;
+ temppoint1.y = 0;
+ temppoint2.y = 0;
+ weapons[i].rotation1 = acos((temppoint1.z - temppoint2.z) / findDistance(&temppoint1, &temppoint2));
+ weapons[i].rotation1 *= 360 / 6.28;
+ weapons[i].rotation3 = 0;
+ weapons[i].smallrotation = 90;
+ weapons[i].smallrotation2 = 0;
+ if (temppoint1.x > temppoint2.x)
+ weapons[i].rotation1 = 360 - weapons[i].rotation1;
+ }
+ }
+ }
+ if (weaponactive != k && weaponstuck != k) {
+ if (weapons[i].getType() == knife) {
+ weapons[i].smallrotation = -70;
+ weapons[i].smallrotation2 = 10;
+ }
+ if (weapons[i].getType() == sword) {
+ weapons[i].smallrotation = -100;
+ weapons[i].smallrotation2 = -8;
+ }
+ if (weapons[i].getType() == staff) {
+ weapons[i].smallrotation = -100;
+ weapons[i].smallrotation2 = -8;
+ }
+ }
+ if (weaponstuck == k) {
+ if (weaponstuckwhere == 0)
+ weapons[i].smallrotation = 180;
+ else
+ weapons[i].smallrotation = 0;
+ weapons[i].smallrotation2 = 10;
+ }
+ }
+ }
+ }
+
+ calcrot = 0;
+ if (skeleton.free)
+ calcrot = 1;
+ if (Animation::animations[animTarget].attack || isRun() || animTarget == staggerbackhardanim || isFlip() || animTarget == climbanim || animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim || animTarget == backhandspringanim || isWallJump())
+ calcrot = 1;
+ if (animCurrent != animTarget)
+ calcrot = 1;
+ if (skeleton.free == 2)
+ calcrot = 0;
+
+ return 0;