]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Person.cpp
Remove comments that confuse Vim
[lugaru.git] / Source / Person.cpp
index b73812151f35c760199201e59160c9de159e5873..90fdabe8beb97bdf89f9c1f322c0ffe80ede4b41 100644 (file)
@@ -357,22 +357,13 @@ bool Person::isWallJump(){
        else return 0;
 }
 
-void SolidHitBonus(){
-       if(bonustime<1.5&&(bonus==fourxcombo||bonus==megacombo)){
-         award_bonus(0, megacombo);
-       }
-       else if(bonustime<1.5&&bonus==threexcombo){
-         award_bonus(0, fourxcombo);
-       }
-       else if(bonustime<1.5&&bonus==twoxcombo){
-         award_bonus(0, threexcombo);
-       }
-       else if(bonustime<1.5&&bonus==solidhit){
-         award_bonus(0, twoxcombo);
-       }
-       else {
-         award_bonus(0, solidhit);
-       }
+static void
+SolidHitBonus(int playerid)
+{
+  if (bonustime < 1.5 && bonus >= solidhit && bonus <= megacombo)
+    award_bonus(playerid, bonus == megacombo ? bonus : bonus + 1);
+  else
+    award_bonus(playerid, solidhit);
 }
 
 void Person::DoBlood(float howmuch,int which){
@@ -1819,10 +1810,8 @@ void     Person::DoAnimations(){
                                                victim->spurt=1;
                                                victim->DoBloodBig(1/victim->armorhead,210);
                                        }
-                                       award_bonus(id, TackleBonus);
-                                       if(id==0){
-                                               if(victim->aitype==gethelptype)bonusvalue=50;
-                                       }
+                                       award_bonus(id, TackleBonus,
+                                                   victim->aitype == gethelptype ? 50 : 0);
                                }
                        }
 
@@ -2297,9 +2286,7 @@ void      Person::DoAnimations(){
                                                                                victim->Puff(head);
                                                                                victim->DoDamage(damagemult*100/victim->protectionhead);
 
-                                                                               if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               SolidHitBonus(id);
                                                                        }
                                                                }
 
@@ -2391,12 +2378,10 @@ void    Person::DoAnimations(){
                                                                                victim->Puff(head);
                                                                                victim->DoDamage(damagemult*150/victim->protectionhead);
 
-                                                                               if(victim->damage>victim->damagetolerance){
+                                                                               if(victim->damage>victim->damagetolerance)
                                                                                  award_bonus(id, style);
-                                                                               }
-                                                                               else if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               else
+                                                                                 SolidHitBonus(id);
                                                                        }
                                                                }
 
@@ -2442,12 +2427,10 @@ void    Person::DoAnimations(){
                                                                                victim->Puff(head);
                                                                                victim->DoDamage(damagemult*150/victim->protectionhead);
 
-                                                                               if(victim->damage>victim->damagetolerance){
+                                                                               if(victim->damage>victim->damagetolerance)
                                                                                  award_bonus(id, style);
-                                                                               }
-                                                                               else if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               else
+                                                                                 SolidHitBonus(id);
                                                                        }
                                                                }
 
@@ -2607,9 +2590,8 @@ void      Person::DoAnimations(){
                                                                                for(i=0;i<victim->skeleton.num_joints;i++){
                                                                                        victim->skeleton.joints[i].velocity+=relative*damagemult*20;
                                                                                }
-                                                                               if(id==0&&!victim->dead){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               if(!victim->dead)
+                                                                                 SolidHitBonus(id);
 
                                                                                victim->Puff(abdomen);
                                                                                victim->DoDamage(damagemult*20/victim->protectionhigh);
@@ -2622,7 +2604,6 @@ void      Person::DoAnimations(){
                                                                }
 
                                                                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];
@@ -2723,7 +2704,6 @@ void      Person::DoAnimations(){
                                                                }
 
                                                                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];
@@ -2848,7 +2828,6 @@ void      Person::DoAnimations(){
                                                                                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);
@@ -2887,9 +2866,7 @@ void      Person::DoAnimations(){
                                                                                victim->Puff(abdomen);
                                                                                victim->DoDamage(damagemult*60/victim->protectionhigh);
 
-                                                                               if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               SolidHitBonus(id);
                                                                        }
                                                                }
 
@@ -2906,7 +2883,6 @@ void      Person::DoAnimations(){
                                                                                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);
@@ -2954,9 +2930,7 @@ void      Person::DoAnimations(){
                                                                                victim->Puff(abdomen);
                                                                                victim->DoDamage(damagemult*60/victim->protectionhigh);
 
-                                                                               if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               SolidHitBonus(id);
                                                                        }
                                                                }
 
@@ -3044,9 +3018,7 @@ void      Person::DoAnimations(){
                                                                        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);
-                                                                                       //}
 
                                                                                        award_bonus(id, Slicebonus);
                                                                                        if(tutoriallevel!=1){
@@ -3125,16 +3097,12 @@ void    Person::DoAnimations(){
                                                                                                OPENAL_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;
@@ -3398,9 +3366,7 @@ void      Person::DoAnimations(){
                                                                                relative.y=0;
                                                                                Normalise(&relative);
 
-                                                                               if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               SolidHitBonus(id);
 
                                                                                if(animation[victim->targetanimation].height==lowheight){
                                                                                        if(Random()%2){
@@ -3525,9 +3491,7 @@ void      Person::DoAnimations(){
                                                                                        victim->DoDamage(damagemult*30/victim->protectionlow);
                                                                                }
 
-                                                                               if(id==0){
-                                                                                       SolidHitBonus();
-                                                                               }
+                                                                               SolidHitBonus(id);
 
                                                                        }
                                                                }
@@ -4487,7 +4451,7 @@ void      Person::DoAnimations(){
                                                                                //DoDamage(100);
                                                                                RagDoll(0);
                                                                                skeleton.spinny=0;
-                                                                               if(id!=0)SolidHitBonus();
+                                                                               SolidHitBonus(!id); // FIXME: tricky id
                                                                        }
                                                                        if(feint){
                                                                                escapednum++;
@@ -4510,7 +4474,7 @@ void      Person::DoAnimations(){
                                                                                //DoDamage(100);
                                                                                RagDoll(0);
                                                                                skeleton.spinny=0;
-                                                                               if(id!=0)SolidHitBonus();
+                                                                               SolidHitBonus(!id); // FIXME: tricky id
                                                                        }
                                                                        if(feint){
                                                                                escapednum++;
@@ -4659,14 +4623,12 @@ void    Person::DoAnimations(){
                }
 
                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();
@@ -5512,12 +5474,8 @@ void     Person::DoStuff(){
                                if(terrainnormal.z<0)targetrotation=180-targetrotation;
                                rotation=targetrotation;
 
-                               //if(skeleton.forward.y<0){
                                targetframe=0;
-                               //}
-                               //if(skeleton.forward.y>-.3){
                                //      targetframe=2;
-                               //}
                                targetanimation=flipanim;
                                crouchtogglekeydown=1;
                                target=0;
@@ -5949,7 +5907,6 @@ void      Person::DoStuff(){
 
                                if(targetanimation==bounceidleanim||targetanimation==wolfidle||targetanimation==walkanim||targetanimation==drawrightanim||targetanimation==crouchdrawrightanim||targetanimation==drawleftanim||targetanimation==fightidleanim||targetanimation==fightsidestep||targetanimation==hanganim||isCrouch()||targetanimation==backhandspringanim){
                                        //open hands and close mouth
-                                       //if(targetanimation!=wolfidle){
                                        if(righthandmorphend!=0&&righthandmorphness==targetrighthandmorphness){
                                                righthandmorphness=0;
                                                righthandmorphend=0;
@@ -5961,7 +5918,6 @@ void      Person::DoStuff(){
                                                lefthandmorphend=0;
                                                targetlefthandmorphness=1;
                                        }
-                                       //s}
 
                                        if(headmorphend!=3&&headmorphend!=5&&headmorphstart!=3&&headmorphstart!=5&&headmorphend!=0&&headmorphness==targetheadmorphness){
                                                headmorphness=0;
@@ -6751,24 +6707,18 @@ int Person::DrawSkeleton(){
                                                                                (skeleton.model[start].vertex[skeleton.muscles[i].vertices[j]].z*(1-morphness)+skeleton.model[endthing].vertex[skeleton.muscles[i].vertices[j]].z*morphness)*proportionhead.z);
                                                                        glGetFloatv(GL_MODELVIEW_MATRIX,M);
                                                                        //if(!isnormal(M[12])||!isnormal(M[13])||!isnormal(M[14]))test=0;
-                                                                       //if(isnormal(M[12])&&isnormal(M[13])&&isnormal(M[14])){
                                                                        //if(!isnormal(scale))test=1;
-                                                                       //if(isnormal(scale)){
                                                                        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;
                                                                        //test=2;
-                                                                       //}
-                                                                       //}
                                                                glPopMatrix();
-                                                               //}
                                                        }
                                                }
                                                if(!playerdetail||skeleton.free==3)
                                                {
                                                        for(j=0;j<skeleton.muscles[i].numverticeslow;j++)
                                                        {
-                                                               //if(skeleton.muscles[i].verticeslow[j]<skeleton.modellow.vertexNum&&skeleton.muscles[i].verticeslow[j]>=0){
                                                                glMatrixMode(GL_MODELVIEW);                                                     // Select The Modelview Matrix
                                                                glPushMatrix();
                                                                        if(skeleton.muscles[i].parent1->label==abdomen||skeleton.muscles[i].parent2->label==abdomen)
@@ -6793,7 +6743,6 @@ int Person::DrawSkeleton(){
                                                                        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();
@@ -7206,8 +7155,6 @@ int Person::DrawSkeleton(){
                                        if(weaponstuckwhere==0)weapons.smallrotation[i]=180;
                                        else weapons.smallrotation[i]=0;
                                        weapons.smallrotation2[i]=10;
-                                       //if(animation[targetanimation].height==lowheight&&animation[targetanimation].attack==neutral){
-                                       //}
                                }
                        }
                }