Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8945 in orxonox.OLD


Ignore:
Timestamp:
Jun 30, 2006, 3:39:07 AM (18 years ago)
Author:
patrick
Message:

repair station works now. one point less in the todo list

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

Legend:

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

    r8943 r8945  
    4747{
    4848 // begin, end, fps, interruptable
    49   {   0,  12,  30,  0 },   //!< CYCLE01
     49  {   0,  12,  20,  0 },   //!< CYCLE01
    5050  {   12, 24,  30,  0 },   //!< CYCLE02
    51   {   24, 40,  30,  0 },   //!< CYCLE03
     51  {   24, 40,  10,  0 },   //!< CYCLE03
    5252  {   40, 55,  30,  0 },   //!< CYCLE04
    53   {   55, 68,  30,  0 },   //!< CYCLE05
     53  {   55, 68,  20,  0 },   //!< CYCLE05
    5454  {   68, 81,  30,  0 },   //!< CYCLE06
    55   {   81, 89,  30,  0 },   //!< CYCLE07
     55  {   81, 89,  40,  0 },   //!< CYCLE07
    5656  {   89, 99,  30,  0 }    //!< CYCLE08
    5757};
     
    7676  this->toList(OM_COMMON);
    7777
    78   this->loadMD2Texture("maps/doors.jpg");
    79   this->loadModel("models/creatures/doors.md2", this->scale);
     78  this->bActivated = true;
     79  this->animationStep = 1;
     80  this->animationCurrent = REPAIR_CYCLE01;
     81
     82  this->loadMD2Texture("maps/repairstation.jpg");
     83  this->loadModel("models/creatures/repairstation.md2", this->scale);
    8084
    8185  this->setAnimation(REPAIR_CYCLE01, MD2_ANIM_ONCE);
     
    122126{
    123127  if( likely(this->getModel(0) != NULL))
    124     ((InteractiveModel*)this->getModel(0))->getAnimation();
     128    return ((InteractiveModel*)this->getModel(0))->getAnimation();
     129  else
     130    return -1;
    125131}
    126132
     133
     134
     135/**
     136 * @returns true if animation is finished
     137 */
     138bool RepairStation::isAnimationFinished()
     139{
     140  if( likely(this->getModel(0) != NULL))
     141    return ((InteractiveModel*)this->getModel(0))->isAnimationFinished();
     142  else
     143    return false;
     144}
    127145
    128146
     
    133151{
    134152  this->animationStep = 1;
     153  this->bActivated = true;
    135154}
    136155
     
    142161{
    143162  this->animationStep = 0;
     163  this->bActivated = false;
    144164}
    145165
     
    163183    ((InteractiveModel*)this->getModel(0))->tick(time);
    164184
    165    if( this->getAnimation() == ATTACK)
    166 //     ((MD2Model*)this->getModel(0))->setAnimation(ATTACK);
     185  if( !this->bActivated)
     186    return;
    167187
    168 
    169   this->setAnimation( this->animationCurrent, MD2_ANIM_ONCE);
    170   this->animationCurrent = (this->animationCurrent + this->animationStep) % REPAIR_MAX_ANIMATIONS;
     188  if( this->isAnimationFinished())
     189  {
     190    this->animationCurrent = (this->animationCurrent + this->animationStep) % REPAIR_MAX_ANIMATIONS;
     191    this->setAnimation( this->animationCurrent, MD2_ANIM_ONCE);
     192  }
    171193}
    172194
  • branches/single_player_map/src/world_entities/npcs/repair_station.h

    r8943 r8945  
    4646    void setAnimation(int animNum, int playbackMode = 0);
    4747    int getAnimation();
     48    bool isAnimationFinished();
    4849
    4950
     
    5657    int            animationStep;     //!< the incrementation step of the animation
    5758
     59    bool           bActivated;        //!< true if activated
     60
    5861};
    5962
Note: See TracChangeset for help on using the changeset viewer.