X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FPerson.cpp;h=76e95033ae3c344c30a281e7fda9e77324b8f37c;hb=38615999d550e75a973ce4d5520c9ef117d65cea;hp=388f787891bdefac4cf35e26175a7380f6eef0da;hpb=612415ff494c29cf2fc7ea560da9908eaff7d847;p=lugaru.git diff --git a/Source/Person.cpp b/Source/Person.cpp index 388f787..76e9503 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /**> HEADER FILES <**/ #include "Person.h" #include "openal_wrapper.h" +#include "Animation.h" extern float multiplier; extern Animation animation[animation_count]; @@ -30,7 +31,6 @@ extern int channels[100]; extern Terrain terrain; extern float gravity; extern int environment; -extern Sprites sprites; extern int detail; extern FRUSTUM frustum; extern XYZ viewer; @@ -89,8 +89,6 @@ extern float damagetaken; extern int hostile; extern float hostiletime; -extern int mainmenu; - extern int numfalls; extern int numflipfail; extern int numseen; @@ -202,7 +200,7 @@ void Person::CatchFire(){ if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity; if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords; if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords; - sprites.MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, 2, 1); + Sprite::MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, 2, 1); } onfiredelay=0.5; @@ -435,36 +433,33 @@ void Person::DoBlood(float howmuch,int which){ if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; if(skeleton.free){ - sprites.MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); } if(!skeleton.free){ - sprites.MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); } } if(Random()%2==0) for(int i=0;i<3;i++){ if(Random()%2!=0){ bloodvel=0; - if(!skeleton.free){ + if(skeleton.free) { + bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0); + bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; + } else { bloodvel.z=10; bloodvel=DoRotation(bloodvel,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; + bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; } - if(skeleton.free){ - bloodvel-=DoRotation(skeleton.forward*10*scale,((float)(Random()%100))/4,((float)(Random()%100))/4,0); - } - if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; - if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; bloodvel*=.2; if(skeleton.free){ - sprites.MakeSprite(splintersprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.special[sprites.numsprites-1]=3; - } - if(!skeleton.free){ - sprites.MakeSprite(splintersprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.special[sprites.numsprites-1]=3; + Sprite::MakeSprite(splintersprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); + } else { + Sprite::MakeSprite(splintersprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); } + Sprite::setLastSpriteSpecial(3); } } } @@ -478,16 +473,16 @@ void Person::DoBlood(float howmuch,int which){ bleedxint=abs(Random()%512); bleedyint=abs(Random()%512); } - if(creature==wolftype) - while(wolfbloodText[bleedxint*512*3+bleedyint*3+0]>which+4||wolfbloodText[bleedxint*512*3+bleedyint*3+0]500||bleedyint>500){ - bleedxint=abs(Random()%512); - bleedyint=abs(Random()%512); - } - bleedy=bleedxint; - bleedx=bleedyint; - bleedy/=realtexdetail; - bleedx/=realtexdetail; - direction=abs(Random()%2)*2-1; + if(creature==wolftype) + while(wolfbloodText[bleedxint*512*3+bleedyint*3+0]>which+4||wolfbloodText[bleedxint*512*3+bleedyint*3+0]500||bleedyint>500){ + bleedxint=abs(Random()%512); + bleedyint=abs(Random()%512); + } + bleedy=bleedxint; + bleedx=bleedyint; + bleedy/=realtexdetail; + bleedx/=realtexdetail; + direction=abs(Random()%2)*2-1; } } @@ -562,12 +557,12 @@ void Person::DoBloodBig(float howmuch,int which){ if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; if(skeleton.free){ - sprites.MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); } if(!skeleton.free){ - sprites.MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); } } } @@ -789,12 +784,12 @@ bool Person::DoBloodBigWhere(float howmuch,int which, XYZ where){ if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; if(skeleton.free){ - sprites.MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, skeleton.joints[skeleton.jointlabels[head]].position*scale+coords,bloodvel, 1,1,1, .3, 1); } if(!skeleton.free){ - sprites.MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); - sprites.MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); + Sprite::MakeSprite(bloodflamesprite, DoRotation((skeleton.joints[skeleton.jointlabels[head]].position+skeleton.joints[skeleton.jointlabels[neck]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .3, 1); } } } @@ -1385,9 +1380,9 @@ void Person::DoDamage(float howmuch){ flatvelocity2.x+=(float)(abs(Random()%100)-50)/10; flatvelocity2.y+=(float)(abs(Random()%100)-50)/10; flatvelocity2.z+=(float)(abs(Random()%100)-50)/10; - sprites.MakeSprite(bloodflamesprite, flatfacing2,flatvelocity2, 1,1,1, 3, 1); - sprites.MakeSprite(bloodsprite, flatfacing2,flatvelocity2, 1,1,1, .4, 1); - sprites.MakeSprite(cloudsprite, flatfacing2,flatvelocity2*0, .6,0,0, 1, .5); + Sprite::MakeSprite(bloodflamesprite, flatfacing2,flatvelocity2, 1,1,1, 3, 1); + Sprite::MakeSprite(bloodsprite, flatfacing2,flatvelocity2, 1,1,1, .4, 1); + Sprite::MakeSprite(cloudsprite, flatfacing2,flatvelocity2*0, .6,0,0, 1, .5); } float gLoc[3]; @@ -1469,7 +1464,7 @@ void Person::DoHead(){ static XYZ facing; static float lookspeed=500; - if(!freeze&&!winfreeze&&(!mainmenu||!gamestarted)){ + if(!freeze&&!winfreeze){ //head facing targetheadrotation=(float)((int)((0-rotation-targetheadrotation+180)*100)%36000)/100; @@ -1707,7 +1702,7 @@ void Person::FootLand(int which, float opacity){ if(which==0)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[leftfoot]].position,0,rotation,0)*scale+coords; if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords; //footpoint.y=coords.y; - if(findDistancefast(&footpoint,&viewer))sprites.MakeSprite(cloudsprite, footpoint,footvel, 1,1,1, .5, .2*opacity); + if(findDistancefast(&footpoint,&viewer))Sprite::MakeSprite(cloudsprite, footpoint,footvel, 1,1,1, .5, .2*opacity); } else if(environment==snowyenvironment&&onterrain&&terrain.getOpacity(coords.x,coords.z)<.2){ footvel=velocity/5; @@ -1716,7 +1711,7 @@ void Person::FootLand(int which, float opacity){ if(which==1)footpoint=DoRotation(skeleton.joints[skeleton.jointlabels[rightfoot]].position,0,rotation,0)*scale+coords; footpoint.y=terrain.getHeight(footpoint.x,footpoint.z); terrainlight=terrain.getLighting(footpoint.x,footpoint.z); - if(findDistancefast(&footpoint,&viewer)=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)=1||detail==2)if(detail==2)if(findDistancefast(&footpoint,&viewer)distancemax){ -distancemax=findDistancefast(average,skeleton.joints[j].position); -} -} -distancemax=fast_sqrt(distancemax); -//Collide with player -if(skeleton.free<1){ -start=start-coords; -end=end-coords; -if(rotation)start=DoRotation(start,0,-rotation,0); -if(rotation)end=DoRotation(end,0,-rotation,0); -} -tempbulletloc[0]=start; -tempbulletloc[1]=end; -if(sphere_line_intersection(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z, -tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z, -average.x, average.y, average.z, distancemax)){ -for(int j=0;jposition.x)/2), -(-(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2), -(-(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2)); -glTranslatef(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[0].x=M[12]; -tempbulletloc[0].y=M[13]; -tempbulletloc[0].z=M[14]; -glPopMatrix(); -glPushMatrix(); -glLoadIdentity(); -glScalef(1,1/skeleton.joints[j].length,1); -glRotatef(skeleton.joints[j].rotate2-90,0,0,1); -glRotatef(skeleton.joints[j].rotate1-90,0,1,0); -glTranslatef( (-(skeleton.joints[j].position.x+skeleton.joints[j].parent->position.x)/2), -(-(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2), -(-(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2)); -glTranslatef(tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[1].x=M[12]; -tempbulletloc[1].y=M[13]; -tempbulletloc[1].z=M[14]; -glPopMatrix(); -collide=skeletonmodels[skeleton.joints[j].modelnum].LineCheck(tempbulletloc[0],tempbulletloc[1],&collisionpoint); -if(collide!=-1) -{ -glPushMatrix(); -glLoadIdentity(); -glTranslatef( (skeleton.joints[j].position.x+skeleton.joints[j].parent->position.x)/2, -(skeleton.joints[j].position.y+skeleton.joints[j].parent->position.y)/2, -(skeleton.joints[j].position.z+skeleton.joints[j].parent->position.z)/2); -glRotatef(-skeleton.joints[j].rotate1+90,0,1,0); -glRotatef(-skeleton.joints[j].rotate2+90,0,0,1); -glScalef(1,skeleton.joints[j].length,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.joints[j]; -hitstruct.joint2=skeleton.joints[j].parent; -} -} -} -for(int j=0;jposition.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)); - -glTranslatef(tempbulletloc[0].x,tempbulletloc[0].y,tempbulletloc[0].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[0].x=M[12]; -tempbulletloc[0].y=M[13]; -tempbulletloc[0].z=M[14]; -glPopMatrix(); -glPushMatrix(); -glLoadIdentity(); -glScalef(1,1/skeleton.muscles[j].length,1); -glRotatef(skeleton.muscles[j].rotate3,0,1,0); -glRotatef(skeleton.muscles[j].rotate2-90,0,0,1); -glRotatef(skeleton.muscles[j].rotate1-90,0,1,0); - -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)); -glTranslatef(tempbulletloc[1].x,tempbulletloc[1].y,tempbulletloc[1].z); -glGetFloatv(GL_MODELVIEW_MATRIX,M); -tempbulletloc[1].x=M[12]; -tempbulletloc[1].y=M[13]; -tempbulletloc[1].z=M[14]; -glPopMatrix(); -collide=skeletonmodels[skeleton.muscles[j].parent1->modelnum].LineCheck(tempbulletloc[0],tempbulletloc[1],&collisionpoint); -if(collide!=-1) -{ -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; @@ -2306,7 +2132,7 @@ void Person::DoAnimations(){ 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); + if(bloodtoggle)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3); weapons.bloody[i]=2; weapons.blooddrip[i]=5; victim->weaponstuck=-1; @@ -3043,7 +2869,7 @@ void Person::DoAnimations(){ relative.y=10; Normalise(&relative); //victim->Puff(abdomen); - if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3); + if(bloodtoggle)Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .8, .3); if(victim->bloodlossdamagetolerance){ victim->bloodloss+=1000; @@ -3320,16 +3146,16 @@ void Person::DoAnimations(){ 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); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .2, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .2, 1); } if(tutoriallevel==1){ - sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .6, .3); + Sprite::MakeSprite(cloudimpactsprite, footpoint,footvel, 1,1,1, .6, .3); } victim->DoDamage(damagemult*0); } @@ -3390,13 +3216,13 @@ void Person::DoAnimations(){ 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); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1); } } else { @@ -4153,17 +3979,17 @@ void Person::DoAnimations(){ 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); + Sprite::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); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1); victim->DoBloodBig(200,195); if(id==0){ bonus=tracheotomy; @@ -4182,12 +4008,12 @@ void Person::DoAnimations(){ XYZ footvel,footpoint; footvel=0; footpoint=weapons.tippoint[weaponids[0]]; - if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .2, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .2, 1); } victim->bloodloss+=10000; @@ -4240,12 +4066,12 @@ void Person::DoAnimations(){ XYZ footvel,footpoint; footvel=0; footpoint=weapons.tippoint[weaponids[0]]; - if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1); } } @@ -4262,12 +4088,12 @@ void Person::DoAnimations(){ 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); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,DoRotation(footvel*5,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .3, 1); + Sprite::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; @@ -4314,12 +4140,12 @@ void Person::DoAnimations(){ XYZ footvel,footpoint; footvel=0; footpoint=weapons.tippoint[weaponids[0]]; - if(bloodtoggle)sprites.MakeSprite(cloudimpactsprite, footpoint,footvel, 1,0,0, .9, .3); + if(bloodtoggle)Sprite::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); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*7,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodsprite,footpoint,DoRotation(footvel*3,(float)(Random()%20),(float)(Random()%20),0), 1,1,1, .05, .9); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*5, 1,1,1, .3, 1); + Sprite::MakeSprite(bloodflamesprite, footpoint,footvel*2, 1,1,1, .3, 1); } } @@ -5054,12 +4880,6 @@ void Person::DoStuff(){ targetanimation=getRun(); targetframe=0; } - /*static float toggledelay; - toggledelay-=multiplier; - if(toggledelay<0){ - toggledelay=1; - if(Random()%3==0)superruntoggle=1-superruntoggle; - }*/ } if(weaponactive==-1&&num_weapons>0){ if(weapons.type[weaponids[0]]==staff){ @@ -5098,7 +4918,7 @@ void Person::DoStuff(){ if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity*scale/2; if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords; if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords; - sprites.MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1); + Sprite::MakeSprite(flamesprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, 1); } while(flamedelay<0&&!onfire&&tutoriallevel==1&&id!=0){ @@ -5108,7 +4928,7 @@ void Person::DoStuff(){ if(skeleton.free)flatvelocity=skeleton.joints[howmany].velocity*scale/2; if(!skeleton.free)flatfacing=DoRotation(DoRotation(DoRotation(skeleton.joints[howmany].position,0,0,tilt),tilt2,0,0),0,rotation,0)*scale+coords; if(skeleton.free)flatfacing=skeleton.joints[howmany].position*scale+coords; - sprites.MakeSprite(breathsprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, .3); + Sprite::MakeSprite(breathsprite, flatfacing,flatvelocity, 1,1,1, .6+(float)abs(Random()%100)/200-.25, .3); } if(bleeding>0){ @@ -5135,8 +4955,8 @@ void Person::DoStuff(){ } if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[head]].velocity,((float)(Random()%100))/40,rotation+((float)(Random()%100))/40,0)*scale; if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/40,((float)(Random()%100))/40,0)*scale; - if(skeleton.free)sprites.MakeSprite(bloodsprite, (skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5)*scale+coords,bloodvel, 1,1,1, .05, .9); - if(!skeleton.free)sprites.MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, .9); + if(skeleton.free)Sprite::MakeSprite(bloodsprite, (skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5)*scale+coords,bloodvel, 1,1,1, .05, .9); + if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation(skeleton.joints[skeleton.jointlabels[neck]].position+(skeleton.joints[skeleton.jointlabels[neck]].position-skeleton.joints[skeleton.jointlabels[head]].position)/5,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, .9); neckspurtparticledelay=.05; } if(neckspurtdelay<0){ @@ -5154,14 +4974,10 @@ void Person::DoStuff(){ bloodvel=0; if(skeleton.free)bloodvel+=DoRotation(skeleton.joints[skeleton.jointlabels[abdomen]].velocity,((float)(Random()%100))/4,rotation+((float)(Random()%100))/4,0)*scale; if(!skeleton.free)bloodvel+=DoRotation(velocity,((float)(Random()%100))/4,((float)(Random()%100))/4,0)*scale; - if(skeleton.free)sprites.MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[abdomen]].position*scale+coords,bloodvel, 1,1,1, .05, 1); - if(!skeleton.free)sprites.MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[abdomen]].position+skeleton.joints[skeleton.jointlabels[abdomen]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); + if(skeleton.free)Sprite::MakeSprite(bloodsprite, skeleton.joints[skeleton.jointlabels[abdomen]].position*scale+coords,bloodvel, 1,1,1, .05, 1); + if(!skeleton.free)Sprite::MakeSprite(bloodsprite, DoRotation((skeleton.joints[skeleton.jointlabels[abdomen]].position+skeleton.joints[skeleton.jointlabels[abdomen]].position)/2,0,rotation,0)*scale+coords,bloodvel, 1,1,1, .05, 1); } } - /*if(id==0){ - bloodloss+=deathbleeding*40; - deathbleeding=0; - }*/ bloodloss+=deathbleeding*multiplier*80; deathbleeding-=multiplier*1.6; //if(id==0)deathbleeding-=multiplier*.2; @@ -5235,10 +5051,6 @@ void Person::DoStuff(){ if(endy>skeleton.skinsize-1){endy=skeleton.skinsize-1;bleeding=0;} if(endxobjects.position[i].y+3*objects.scale[i]){ - /*if(onfire){ - if(!objects.onfire[i]){ - float gLoc[3]; - float vel[3]; - gLoc[0]=objects.position[i].x; - gLoc[1]=objects.position[i].y; - gLoc[2]=objects.position[i].z; - vel[0]=0; - vel[1]=0; - vel[2]=0; - PlaySoundEx( firestartsound, samp[firestartsound], NULL, true); - OPENAL_3D_SetAttributes(channels[firestartsound], gLoc, vel); - OPENAL_SetVolume(channels[firestartsound], 256); - OPENAL_SetPaused(channels[firestartsound], false); - objects.onfire[i]=1; - } - }*/ if(objects.messedwith[i]<=0){ XYZ tempvel; XYZ pos; @@ -6222,8 +6011,8 @@ void Person::DoStuff(){ pos.x+=float(abs(Random()%100)-50)/150; pos.y+=float(abs(Random()%100)-50)/150; pos.z+=float(abs(Random()%100)-50)/150; - sprites.MakeSprite(splintersprite, pos,tempvel*.5+velocity*float(abs(Random()%100))/100, 165/255+float(abs(Random()%100)-50)/400,0,0, .2+float(abs(Random()%100)-50)/1300, 1); - sprites.special[sprites.numsprites-1]=1; + Sprite::MakeSprite(splintersprite, pos,tempvel*.5+velocity*float(abs(Random()%100))/100, 165/255+float(abs(Random()%100)-50)/400,0,0, .2+float(abs(Random()%100)-50)/1300, 1); + Sprite::setLastSpriteSpecial(1); } howmany=findLength(&velocity)*4; if(detail==2) @@ -6238,8 +6027,8 @@ void Person::DoStuff(){ pos.x+=float(abs(Random()%100)-50)/150; pos.y+=float(abs(Random()%100)-50)/150; pos.z+=float(abs(Random()%100)-50)/150; - sprites.MakeSprite(splintersprite, pos,tempvel*.3+velocity*float(abs(Random()%100))/100/2, 1,1,1, .1, 1); - sprites.special[sprites.numsprites-1]=2; + Sprite::MakeSprite(splintersprite, pos,tempvel*.3+velocity*float(abs(Random()%100))/100/2, 1,1,1, .1, 1); + Sprite::setLastSpriteSpecial(2); } } objects.messedwith[i]=.5; @@ -6276,8 +6065,6 @@ void Person::DoStuff(){ } } speechdelay=.3; - //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); @@ -6449,7 +6236,7 @@ void Person::DoStuff(){ flatfacing=DoRotation(flatfacing,0,rotation,0); facing=flatfacing; - ReflectVector(&facing,&terrainnormal); + ReflectVector(&facing,terrainnormal); Normalise(&facing); if(isRun()||targetanimation==sneakanim||targetanimation==rollanim||targetanimation==walkanim){ @@ -6502,7 +6289,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed; } @@ -6516,7 +6303,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); if(velspeedspeed*55*scale){ - velocity/=velspeed; - velspeed=speed*55*scale; - velocity*=velspeed; - } - velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); - velspeed=findLength(&velocity); - velocity=flatfacing*velspeed; - }*/ - if(targetanimation==rollanim&&animation[targetanimation].label[targetframe]!=6){ velocity+=facing*multiplier*speed*700*scale; velspeed=findLength(&velocity); @@ -6569,7 +6341,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed; } @@ -6584,7 +6356,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed; }*/ @@ -6598,7 +6370,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed; } @@ -6612,7 +6384,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed; } @@ -6627,7 +6399,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed*-1; } @@ -6641,7 +6413,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=DoRotation(flatfacing*velspeed,0,-90,0); } @@ -6665,7 +6437,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed*-1; } @@ -6679,7 +6451,7 @@ void Person::DoStuff(){ velocity*=velspeed; } velocity.y+=gravity*multiplier*20; - ReflectVector(&velocity,&terrain.getNormal(coords.x,coords.z)); + ReflectVector(&velocity,terrain.getNormal(coords.x,coords.z)); velspeed=findLength(&velocity); velocity=flatfacing*velspeed*-1; } @@ -6864,9 +6636,12 @@ int Person::DrawSkeleton(){ if(findDistancefast(&viewer,&coords)