X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FObjects%2FPerson.cpp;h=817ee03734268e777c76543571c2faa279e51c0b;hp=c055e57b0f49a5a3e24fdb3af0461415d738e9f2;hb=3bc5ee099a4322252ae9afd564335b60856a0054;hpb=086b9fc6bc5e16d7f77839bfdadb64ab187cca61 diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index c055e57..817ee03 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -75,6 +75,16 @@ extern XYZ windvector; std::vector> Person::players(1, std::shared_ptr(new Person())); std::vector PersonType::types; +PersonType::PersonType() +{ + animTalkIdle = tempanim; +} + +bool PersonType::hasAnimTalkIdle() +{ + return (animTalkIdle != tempanim); +} + void PersonType::Load() { types.resize(2); @@ -91,6 +101,8 @@ void PersonType::Load() types[wolftype].animStop = wolfstopanim; types[wolftype].animLanding = wolflandanim; types[wolftype].animLandingHard = wolflandhardanim; + types[wolftype].animFightIdle = wolfidle; + types[wolftype].animBounceIdle = wolfidle; types[wolftype].soundsAttack[0] = barksound; types[wolftype].soundsAttack[1] = bark2sound; @@ -130,6 +142,8 @@ void PersonType::Load() types[rabbittype].animStop = stopanim; types[rabbittype].animLanding = landanim; types[rabbittype].animLandingHard = landhardanim; + types[rabbittype].animFightIdle = fightidleanim; + types[rabbittype].animBounceIdle = bounceidleanim; types[rabbittype].soundsAttack[0] = rabbitattacksound; types[rabbittype].soundsAttack[1] = rabbitattack2sound; @@ -676,20 +690,15 @@ void Person::CatchFire() */ int Person::getIdle() { - if (Dialog::inDialog() && (howactive == typeactive) && (creature == rabbittype)) { - return talkidleanim; + if (Dialog::inDialog() && (howactive == typeactive) && PersonType::types[creature].hasAnimTalkIdle()) { + return PersonType::types[creature].animTalkIdle; } if (hasvictim && (victim != this->shared_from_this())) { if ((!victim->dead && victim->aitype != passivetype && victim->aitype != searchtype && aitype != passivetype && aitype != searchtype && victim->id < Person::players.size())) { if ((aitype == playercontrolled && stunned <= 0 && weaponactive == -1) || pause) { - if (creature == rabbittype) { - return fightidleanim; - } - if (creature == wolftype) { - return wolfidle; - } + return PersonType::types[creature].animFightIdle; } if (aitype == playercontrolled && stunned <= 0 && weaponactive != -1) { if (weapons[weaponids[weaponactive]].getType() == knife) { @@ -734,13 +743,7 @@ int Person::getIdle() if (howactive == typedead4) { return dead4anim; } - if (creature == rabbittype) { - return bounceidleanim; - } - if (creature == wolftype) { - return wolfidle; - } - return 0; + return PersonType::types[creature].animBounceIdle; } /* FUNCTION