Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 30, 2006, 4:15:48 PM (18 years ago)
Author:
patrick
Message:

better animation

Location:
branches/single_player_map/src/world_entities/npcs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8964 r8966  
    8787
    8888  time = 30.0f;
     89
    8990  // collision reaction registration
    90   //   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
     91  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
    9192}
    9293
     
    141142
    142143
     144/**
     145 * sets the animation speed of this entity
     146 */
     147void GenericNPC::setAnimationSpeed(float speed)
     148{
     149  if( likely(this->getModel(0) != NULL))
     150    ((InteractiveModel*)this->getModel(0))->setAnimationSpeed(speed);
     151}
     152
     153
    143154
    144155/**
     
    187198        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    188199        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     200
     201        this->setAnimationSpeed(0.5f);
    189202      }
    190203        break;
     
    196209        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    197210        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     211
     212        this->setAnimationSpeed(1.0f);
    198213      }
    199214        break;
     
    205220        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    206221        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     222
     223        this->setAnimationSpeed(1.0f);
    207224      }
    208225        break;
     
    247264        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    248265        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     266
     267        this->setAnimationSpeed(0.5f);
    249268      }
    250269        break;
     
    256275        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    257276        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     277
     278        this->setAnimationSpeed(1.0f);
    258279      }
    259280        break;
     
    265286        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
    266287        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     288
     289        this->setAnimationSpeed(1.0f);
    267290      }
    268291        break;
     
    505528  int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX);
    506529
     530  this->setAnimationSpeed(1.0f);
     531
    507532  if( randi == 1)
    508533    this->setAnimation(DEATH_FALLBACK, MD2_ANIM_ONCE);
  • branches/single_player_map/src/world_entities/npcs/generic_npc.h

    r8957 r8966  
    8282    int getAnimation();
    8383    bool isAnimationFinished();
     84    void setAnimationSpeed(float speed);
    8485
    8586    void initNPC();
Note: See TracChangeset for help on using the changeset viewer.