]> git.jsancho.org Git - lugaru.git/commitdiff
Moved hurtidle anim to PersonType to avoid hardcoded wolftype test
authorCôme Chilliet <come@chilliet.eu>
Sat, 19 Aug 2017 00:11:00 +0000 (02:11 +0200)
committerCôme Chilliet <come@chilliet.eu>
Sat, 19 Aug 2017 00:11:00 +0000 (02:11 +0200)
Source/Objects/Person.cpp
Source/Objects/PersonType.cpp
Source/Objects/PersonType.hpp

index 8898cac60bba81fce30ded86d76c38b5dc9c3ea4..279fb32f704e870b61393255d675979c256856dc 100644 (file)
@@ -618,8 +618,8 @@ int Person::getIdle()
             }
         }
     }
-    if ((damage > permanentdamage || damage > damagetolerance * .8 || deathbleeding > 0) && creature != wolftype) {
-        return hurtidleanim;
+    if ((damage > permanentdamage || damage > damagetolerance * .8 || deathbleeding > 0) && PersonType::types[creature].hasAnimHurtIdle()) {
+        return PersonType::types[creature].animHurtIdle;
     }
     if (howactive == typesitting) {
         return sitanim;
index 0cf880c12d9bf7d36bef4111726dd582af6ef4f5..41d07c2483749444ba3f227c1ad8ac58c656bead 100644 (file)
@@ -24,6 +24,7 @@ std::vector<PersonType> PersonType::types;
 PersonType::PersonType()
 {
     animTalkIdle = tempanim;
+    animHurtIdle = tempanim;
 }
 
 bool PersonType::hasAnimTalkIdle()
@@ -31,6 +32,11 @@ bool PersonType::hasAnimTalkIdle()
     return (animTalkIdle != tempanim);
 }
 
+bool PersonType::hasAnimHurtIdle()
+{
+    return (animHurtIdle != tempanim);
+}
+
 void PersonType::Load()
 {
     types.resize(2);
@@ -99,6 +105,7 @@ void PersonType::Load()
     types[rabbittype].animFightIdle = fightidleanim;
     types[rabbittype].animBounceIdle = bounceidleanim;
     types[rabbittype].animTalkIdle = talkidleanim;
+    types[rabbittype].animHurtIdle = hurtidleanim;
 
     types[rabbittype].soundsAttack[0] = rabbitattacksound;
     types[rabbittype].soundsAttack[1] = rabbitattack2sound;
index f981113bf536fd5fd77642dacede336448cc0b05..5502b4cedb40725fb60f1528f01792daa5fbac00 100644 (file)
@@ -44,6 +44,7 @@ public:
     animation_type animFightIdle;
     animation_type animBounceIdle;
     animation_type animTalkIdle;
+    animation_type animHurtIdle;
 
     sound_type soundsAttack[4];
     sound_type soundsTalk[2];
@@ -69,6 +70,7 @@ public:
 
     PersonType();
     bool hasAnimTalkIdle();
+    bool hasAnimHurtIdle();
 
     static std::vector<PersonType> types;
     static void Load();