]> git.jsancho.org Git - lugaru.git/commitdiff
some small cleanups
authorCôme BERNIGAUD <come.bernigaud@gmail.com>
Fri, 13 May 2011 15:47:18 +0000 (17:47 +0200)
committerCôme BERNIGAUD <come.bernigaud@gmail.com>
Fri, 13 May 2011 15:47:18 +0000 (17:47 +0200)
Source/GameTick.cpp
Source/Person.cpp
Source/Weapons.cpp

index 36e730ecbbef0b2bedbf610345f800a3f90990a0..5b635c75db4e9abd4ae531a1d1ef4363ab60a784 100644 (file)
@@ -6940,13 +6940,13 @@ void Game::Tick(){
                         player[i].drawtogglekeydown=0;
 
                     XYZ absflatfacing;
-                    if(i==0){
+                    if(i==0) {
                         absflatfacing=0;
                         absflatfacing.z=-1;
 
                         absflatfacing=DoRotation(absflatfacing,0,-rotation,0);
-                    }
-                    else absflatfacing=flatfacing;
+                    } else
+                                               absflatfacing=flatfacing;
 
                     if(indialogue!=-1){
                         player[i].forwardkeydown=0;
index a74b2df22a3ab39f3797f614666503721d402804..bb99362f7e241d59b21f19de7c671a1df06ece5e 100644 (file)
@@ -296,7 +296,6 @@ void Person::DoBlood(float howmuch,int which){
                        bleeding=howmuch+(float)abs(Random()%100)/200-.25;
                        bleedxint=0;
                        bleedyint=0;
-                       int texdetailint=realtexdetail;
                        if(creature==rabbittype)
                                while(bloodText[bleedxint*512*3+bleedyint*3+0]>which+4||bloodText[bleedxint*512*3+bleedyint*3+0]<which-4||bleedxint<10||bleedyint<10||bleedxint>500||bleedyint>500){
                                        bleedxint=abs(Random()%512);
@@ -519,7 +518,7 @@ void Person::DoBloodBig(float howmuch,int which){
 }
 
 bool Person::DoBloodBigWhere(float howmuch,int which, XYZ where){
-       static int bleedxint,bleedyint,i,j;
+       static int i,j;
        static XYZ bloodvel;
        static XYZ startpoint,endpoint,colpoint,movepoint;
        static float rotationpoint;
@@ -1670,10 +1669,9 @@ void     Person::DoAnimations(){
                                                                }
                                                        }
 
-                                                       static bool willwork;
                                                        if(targetanimation==crouchremoveknifeanim&&animation[targetanimation].label[currentframe]==5){
                                                                for(i=0;i<weapons.size();i++){
-                                                                       bool willwork=1;
+                                                                       bool willwork=true;
                                                                        if(weapons[i].owner!=-1)
                                                                                if(player[weapons[i].owner].weaponstuck!=-1)
                                                                                        if(player[weapons[i].owner].weaponids[player[weapons[i].owner].weaponstuck]==i)
@@ -1681,21 +1679,20 @@ void    Person::DoAnimations(){
                                                                        if((weapons[i].owner==-1)||(hasvictim&&weapons[i].owner==victim->id&&victim->skeleton.free))
                                                                                if(willwork&&findDistancefastflat(&coords,&weapons[i].position)<3&&weaponactive==-1){
                                                                                        if(findDistancefast(&coords,&weapons[i].position)<1||hasvictim){
-                                                                                               bool fleshstuck=0;
+                                                                                               bool fleshstuck=false;
                                                                                                if(weapons[i].owner!=-1)
                                                                                                        if(victim->weaponstuck!=-1){
                                                                                                                if(victim->weaponids[victim->weaponstuck]==i){
-                                                                                                                       fleshstuck=1;
+                                                                                                                       fleshstuck=true;
                                                                                                                }
                                                                                                        }
-                                                                                                       if(!fleshstuck){
+                                                                                                       if(fleshstuck){
+                                                                                                               emit_sound_at(fleshstabremovesound, coords, 128.);
+                                                                                                       } else {
                                                                                                                if(weapons[i].getType()!=staff){
                                                                                                                        emit_sound_at(knifedrawsound, coords, 128.);
                                                                                                                }
                                                                                                        }
-                                                                                                       if(fleshstuck){
-                                                                                                               emit_sound_at(fleshstabremovesound, coords, 128.);
-                                                                                                       }
                                                                                                        weaponactive=0;
                                                                                                        if(weapons[i].owner!=-1){
 
@@ -3411,7 +3408,6 @@ void      Person::DoAnimations(){
                                                                          resume_stream(whooshsound);
                                                                }
                                                                if(targetanimation==sneakattackanim){
-                                                                       float ycoords=oldcoords.y;
                                                                        currentanimation=getCrouch();
                                                                        targetanimation=getCrouch();
                                                                        targetframe=1;
@@ -3428,7 +3424,6 @@ void      Person::DoAnimations(){
                                                                        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);
@@ -3748,7 +3743,6 @@ void      Person::DoStuff(){
        static int howmany;
        static int bloodsize;
        static int startx,starty,endx,endy;
-       static int texdetailint;
        static GLubyte color;
        static XYZ bloodvel;
 
@@ -3960,7 +3954,6 @@ void      Person::DoStuff(){
 
                startx=0;
                starty=0;
-               texdetailint=realtexdetail;
                startx=bleedy;//abs(Random()%(skeleton.skinsize-bloodsize-1));
                starty=bleedx;//abs(Random()%(skeleton.skinsize-bloodsize-1));
                endx=startx+bloodsize;
@@ -4466,15 +4459,6 @@ void     Person::DoStuff(){
                        velocity=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;
-
                if(findLength(&average)<10&&dead&&skeleton.free){
                        skeleton.longdead+=(2000-findLength(&average))*multiplier+multiplier;
                        if(skeleton.longdead>2000){
@@ -4614,23 +4598,9 @@ void     Person::DoStuff(){
                                if(terrainnormal.z<0)targetrotation=180-targetrotation;
                                rotation=targetrotation;
 
-                               /*if(onterrain){
-                               terrainnormal=terrain.getNormal(coords.x,coords.z);
-                               targettilt2=asin(terrainnormal.y)*180/3.14*-1;
-                               }
-                               else*/
-
-                               /*XYZ otherterrainnormal;
-                               otherterrainnormal=terrain.getNormal(coords.x,coords.y);
-                               otherterrainnormal.y=fast_sqrt(otherterrainnormal.x*otherterrainnormal.x+otherterrainnormal.z*otherterrainnormal.z)*-1;
-                               if(abs(terrainnormal.y)<abs(otherterrainnormal.y))terrainnormal.y=fast_sqrt(otherterrainnormal.x*otherterrainnormal.x+otherterrainnormal.z*otherterrainnormal.z)*-1;
-                               targettilt2=asin(otherterrainnormal.y)*180/3.14;
-                               */
-
                                targettilt2=asin(terrainnormal.y)*180/3.14*-1;
 
 
-
                                if(skeleton.forward.y<0){
                                        targetanimation=getupfrombackanim;
                                        targetframe=0;
@@ -4724,9 +4694,6 @@ void      Person::DoStuff(){
                }
                if(skeleton.freefall==0)freefall=0;
 
-               if(!isnormal(velocity.x)&&velocity.x){
-                       int xy=1;
-               }
        }
 
        if(aitype!=passivetype||skeleton.free==1)
@@ -5449,7 +5416,7 @@ int Person::DrawSkeleton(){
                static float M[16];
                static int i,j,k;
                static int weaponattachmuscle;
-               static int weaponrotatemuscle,weaponrotatemuscle2;
+               static int weaponrotatemuscle;
                static XYZ weaponpoint;
                static int start,endthing;
                if((dead!=2||skeleton.free!=2)&&updatedelay<=0){
index df2c6cfe35dc736fb4b78cdcc49bceabc8ee3f32..a771989102ce77b6d3fdc736611db052f7667e29 100644 (file)
@@ -108,15 +108,12 @@ void Weapon::DoStuff() {
        static float elasticity=.4;
        static XYZ bounceness;
        static float frictionness;
-       static float moveamount;
-       int closestline;
        static float closestdistance;
        static float distance;
        static XYZ point[3];
        static XYZ closestpoint;
        static XYZ closestswordpoint;
        static XYZ extramove;
-       static float proportion;
        static float tempmult;
        
        if(owner!=-1){
@@ -218,7 +215,6 @@ void Weapon::DoStuff() {
                                        footpoint=DoRotation((player[j].skeleton.joints[player[j].skeleton.jointlabels[abdomen]].position+player[j].skeleton.joints[player[j].skeleton.jointlabels[neck]].position)/2,0,player[j].rotation,0)*player[j].scale+player[j].coords;
                                        if(owner==-1&&findDistancefastflat(&position,&player[j].coords)<1.5&&findDistancefast(&position,&player[j].coords)<4&&player[j].weaponstuck==-1&&!player[j].skeleton.free&&j!=oldowner){
                                                if((player[j].aitype!=attacktypecutoff||abs(Random()%6)==0||(player[j].targetanimation!=backhandspringanim&&player[j].targetanimation!=rollanim&&player[j].targetanimation!=flipanim&&Random()%2==0))&&!missed){
-                                                       bool caught=0;
                                                        if((player[j].creature==wolftype&&Random()%3!=0&&player[j].weaponactive==-1&&(player[j].isIdle()||player[j].isRun()||player[j].targetanimation==walkanim))||(player[j].creature==rabbittype&&Random()%2==0&&player[j].aitype==attacktypecutoff&&player[j].weaponactive==-1)){
                                                                emit_sound_at(knifedrawsound, player[j].coords, 128.);
 
@@ -310,7 +306,6 @@ void Weapon::DoStuff() {
                                                glPopMatrix();
                                                position-=tippoint*.15;
                                                XYZ temppoint1,temppoint2,tempforward;
-                                               float distance;
 
                                                rotation3=0;
                                                smallrotation=90;
@@ -566,19 +561,16 @@ void Weapon::DoStuff() {
                                                                        if(distance<closestdistance||closestdistance==-1){
                                                                                closestpoint=colpoint;
                                                                                closestdistance=distance;
-                                                                               closestline=0;
                                                                        }
                                                                        if(DistancePointLine(&closestswordpoint, &point[1], &point[2], &distance,&colpoint ))
                                                                                if(distance<closestdistance||closestdistance==-1){
                                                                                        closestpoint=colpoint;
                                                                                        closestdistance=distance;
-                                                                                       closestline=1;
                                                                                }
                                                                                if(DistancePointLine(&closestswordpoint, &point[2], &point[0], &distance,&colpoint ))
                                                                                        if(distance<closestdistance||closestdistance==-1){
                                                                                                closestpoint=colpoint;
                                                                                                closestdistance=distance;
-                                                                                               closestline=2;
                                                                                        }
                                                                                        if(closestdistance!=-1&&isnormal(closestdistance)){
                                                                                                if(DistancePointLine(&closestpoint, &position, &tippoint, &distance,&colpoint )){
@@ -865,7 +857,7 @@ void Weapons::DoStuff() {
 }
 
 void Weapon::Draw() {
-       static int i,j;
+       static int j;
        static XYZ terrainlight;
        static GLfloat M[16];
        static bool draw;