From: Alexander Monakov Date: Sun, 6 Jun 2010 16:42:56 +0000 (+0400) Subject: Remove HitStruct and associated commented-out code X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=4e2058b0ad83f1320008f980fac2234e579d3d99;p=lugaru.git Remove HitStruct and associated commented-out code --- diff --git a/Source/Person.cpp b/Source/Person.cpp index 716130c..dcccede 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -1752,175 +1752,6 @@ void Person::Puff(int whichlabel){ } -/* -HitStruct Person::BulletCollideWithPlayer(XYZ start, XYZ end){ -float damage=20; -XYZ tempbulletloc[2]; -XYZ collisionpoint; -XYZ sparkpos; -GLfloat M[16]; -int collide; -float howfar; -XYZ average; -XYZ facing; -int howmany; -float distancemax; -HitStruct hitstruct; -hitstruct.collision=0; -//Make bounding sphere -average=0; -howmany=0; -for(int j=0;jdistancemax){ -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; diff --git a/Source/Person.h b/Source/Person.h index 517ca0d..27666e4 100644 --- a/Source/Person.h +++ b/Source/Person.h @@ -47,15 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define rabbittype 0 #define wolftype 1 -class HitStruct -{ - public: - Joint *joint1; - Joint *joint2; - XYZ hitlocation; - bool collision; -}; - class Person { public: @@ -380,7 +371,6 @@ class Person void DoStuff(); void DoAnimations(); void RagDoll(bool checkcollision); - HitStruct BulletCollideWithPlayer(XYZ start, XYZ end); }; #endif