- player[j].aitype=attacktypecutoff;
- }
- else {
- if(j!=0)numthrowkill++;
- player[j].num_weapons++;
- player[j].weaponstuck=player[j].num_weapons-1;
- if(normaldotproduct(player[j].facing,velocity[i])>0)player[j].weaponstuckwhere=1;
- else player[j].weaponstuckwhere=0;
-
- player[j].weaponids[player[j].num_weapons-1]=i;
-
- player[j].RagDoll(0);
- player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].velocity+=velocity[i]*2;
- player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].velocity+=velocity[i]*2;
- player[j].skeleton.joints[player[j].skeleton.jointlabels[rightshoulder]].velocity+=velocity[i]*2;
- player[j].skeleton.joints[player[j].skeleton.jointlabels[leftshoulder]].velocity+=velocity[i]*2;
- //player[j].Puff(abdomen);
- if(bloodtoggle&&tutoriallevel!=1)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3);
- if(tutoriallevel==1)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .8, .3);
- footvel=tippoint[i]-position[i];
- Normalise(&footvel);
- if(bloodtoggle&&tutoriallevel!=1)Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*-1, 1,0,0, .6, 1);
-
- if(tutoriallevel!=1){
- if(player[j].weaponstuckwhere==0)player[j].DoBloodBig(2,205);
- if(player[j].weaponstuckwhere==1)player[j].DoBloodBig(2,200);
- player[j].damage+=200/player[j].armorhigh;
- player[j].deathbleeding=1;
- player[j].bloodloss+=(200+abs((float)(Random()%40))-20)/player[j].armorhigh;
- owner[i]=j;
- bloody[i]=2;
- blooddrip[i]=5;
- }
+ terrain.MakeDecal(shadowdecalpermanent,position,.06,.5,0);
+ normalrot=terrain.getNormal(position.x,position.z)*-1;
+ velocity=0;
+ glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
+ glPushMatrix();
+ GLfloat M[16];
+ glLoadIdentity();
+ glRotatef(bigrotation,0,1,0);
+ glRotatef(bigtilt2,1,0,0);
+ glRotatef(bigtilt,0,0,1);
+ glRotatef(-rotation1+90,0,1,0);
+ glRotatef(-rotation2+90,0,0,1);
+ glRotatef(-rotation3,0,1,0);
+ glRotatef(smallrotation,1,0,0);
+ glRotatef(smallrotation2,0,1,0);
+ glTranslatef(0,0,1);
+ glGetFloatv(GL_MODELVIEW_MATRIX,M);
+ tippoint.x=M[12];
+ tippoint.y=M[13];
+ tippoint.z=M[14];
+ glPopMatrix();
+ position-=tippoint*.15;
+ XYZ temppoint1,temppoint2,tempforward;
+
+ rotation3=0;
+ smallrotation=90;
+ smallrotation2=0;
+ bigtilt=0;
+ bigtilt2=0;
+ bigrotation=0;
+
+ emit_sound_at(knifesheathesound, position, 128.);
+
+ XYZ terrainlight;
+ terrainlight=terrain.getLighting(position.x,position.z);
+ if(environment==snowyenvironment){
+ if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+ Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x,terrainlight.y,terrainlight.z, .5, .7);
+ }
+ else if(environment==grassyenvironment){
+ if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+ Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*90/255,terrainlight.y*70/255,terrainlight.z*8/255, .5, .5);
+ }
+ else if(environment==desertenvironment){
+ if(findDistancefast(&position,&viewer)<viewdistance*viewdistance/4)
+ Sprite::MakeSprite(cloudsprite, position,velocity, terrainlight.x*190/255,terrainlight.y*170/255,terrainlight.z*108/255, .5, .7);
+ }
+
+ bloody=0;
+ }
+ else {
+ physics=1;
+ firstfree=1;
+ position-=velocity*multiplier;
+ tippoint-=velocity*multiplier;
+ tipvelocity=velocity;
+ }
+ }
+ if(velocity.x!=0||velocity.z!=0||velocity.y!=0) {
+ velocity.y+=gravity*multiplier;
+
+ XYZ temppoint1,temppoint2,tempforward;
+ float distance;
+
+ temppoint1=0;
+ temppoint2=velocity;
+ distance=findDistance(&temppoint1,&temppoint2);
+ rotation2=asin((temppoint1.y-temppoint2.y)/distance);
+ rotation2*=360/6.28;
+ temppoint1.y=0;
+ temppoint2.y=0;
+ rotation1=acos((temppoint1.z-temppoint2.z)/findDistance(&temppoint1,&temppoint2));
+ rotation1*=360/6.28;
+ rotation3=0;
+ smallrotation=90;
+ smallrotation2=0;
+ bigtilt=0;
+ bigtilt2=0;
+ bigrotation=0;
+ if(temppoint1.x>temppoint2.x) rotation1=360-rotation1;
+ }
+
+ }
+
+ //Sword physics
+ XYZ mid;
+ XYZ oldmid;
+ XYZ oldmid2;
+
+ tempmult=multiplier;
+ multiplier/=10;
+ for(int l=0;l<10;l++) {
+ if(owner==-1&&(velocity.x||velocity.y||velocity.z)&&physics) {
+ //move
+ position+=velocity*multiplier;
+ tippoint+=tipvelocity*multiplier;
+
+ //Length constrain
+ midp=(position*mass+tippoint*tipmass)/(mass+tipmass);
+ vel=tippoint-midp;
+ Normalise(&vel);
+ newpoint1=midp-vel*length*(tipmass/(mass+tipmass));
+ newpoint2=midp+vel*length*(mass/(mass+tipmass));
+ if(!freeze){
+ if(freetime>.04) {
+ velocity=velocity+(newpoint1-position)/multiplier;
+ tipvelocity=tipvelocity+(newpoint2-tippoint)/multiplier;
+ }
+ }
+ position=newpoint1;
+ tippoint=newpoint2;