]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Objects/Person.cpp
Small cleanups
[lugaru.git] / Source / Objects / Person.cpp
index a500e2a51ec82157174cf8b94fbb56b2405f71bf..4ac12f55cb7b961f7e990e5a04fbb0efe441a482 100644 (file)
@@ -1912,7 +1912,7 @@ void Person::Puff(int whichlabel)
 /* EFFECT
  * I think I added this in an attempt to clean up code
  */
-void Person::setAnimation(int animation)
+void Person::setTargetAnimation(int animation)
 {
     animTarget = animation;
     frameTarget = 0;
@@ -5915,8 +5915,9 @@ void Person::DoStuff()
             velocity.y = 0;
             if (velspeed < multiplier * 300 * scale) {
                 velocity = 0;
-            } else
+            } else {
                 velocity -= velocity / velspeed * multiplier * 300 * scale;
+            }
             if (velspeed > 5 && (isLanding() || isLandhard())) {
                 skiddingdelay += multiplier;
                 if (skiddelay <= 0) {
@@ -5924,17 +5925,13 @@ void Person::DoStuff()
                     FootLand(rightfoot, .5);
                     skiddelay = .02;
                 }
-            } else
+            } else {
                 skiddingdelay = 0;
+            }
         }
 
         if (isLandhard()) {
             velspeed = findLength(&velocity);
-            velocity.y = 0;
-            if (velspeed < multiplier * 600 * scale) {
-                velocity = 0;
-            } else
-                velocity -= velocity / velspeed * multiplier * 600 * scale;
             velocity = 0;
             if (velspeed > 5 && (isLanding() || isLandhard())) {
                 skiddingdelay += multiplier;
@@ -5943,8 +5940,9 @@ void Person::DoStuff()
                     FootLand(rightfoot, .5);
                     skiddelay = .02;
                 }
-            } else
+            } else {
                 skiddingdelay = 0;
+            }
         }
 
         if (skiddingdelay < 0)
@@ -7239,7 +7237,7 @@ void Person::doAI()
 
                 if (aitype != passivetype) {
                     if (howactive == typesleeping)
-                        setAnimation(getupfromfrontanim);
+                        setTargetAnimation(getupfromfrontanim);
                     howactive = typeactive;
                 }
             }
@@ -7345,7 +7343,7 @@ void Person::doAI()
                         j = Object::checkcollide(test2, test);
                     if (j == -1) {
                         velocity = 0;
-                        setAnimation(getStop());
+                        setTargetAnimation(getStop());
                         targetyaw += 180;
                         stunned = .5;
                         //aitype=passivetype;
@@ -7660,15 +7658,17 @@ void Person::doAI()
                     if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
                         if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
                             if (isIdle() || isCrouch() || isRun() || isFlip()) {
-                                if (abs(Random() % 2) == 0)
-                                    setAnimation(backhandspringanim);
-                                else
-                                    setAnimation(rollanim);
+                                if (abs(Random() % 2) == 0) {
+                                    setTargetAnimation(backhandspringanim);
+                                } else {
+                                    setTargetAnimation(rollanim);
+                                }
                                 targetyaw += 90 * (abs(Random() % 2) * 2 - 1);
                                 wentforweapon = 0;
                             }
-                            if (animTarget == jumpupanim || animTarget == jumpdownanim)
-                                setAnimation(flipanim);
+                            if (animTarget == jumpupanim || animTarget == jumpdownanim) {
+                                setTargetAnimation(flipanim);
+                            }
                         }
                     }
                     forwardkeydown = 0;
@@ -7723,7 +7723,7 @@ void Person::doAI()
                         j = Object::checkcollide(test2, test);
                     if (j == -1) {
                         velocity = 0;
-                        setAnimation(getStop());
+                        setTargetAnimation(getStop());
                         targetyaw += 180;
                         stunned = .5;
                         aitype = pathfindtype;