Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10136 in orxonox.OLD


Ignore:
Timestamp:
Dec 21, 2006, 2:08:01 PM (17 years ago)
Author:
nicolasc
Message:

updated animation, needs rebuild as weapon.h has been changed

Location:
branches/playability/src/world_entities/weapons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/weapons/heavy_blaster.cc

    r10133 r10136  
    6767  this->setProjectileTypeC("HBolt");   // FIXME temp project type until the blaste class exist
    6868  this->prepareProjectiles(5);
     69
     70  this->setBarrels(3);
     71  this->setSegs(2);
    6972
    7073  this->objComp1 = new PNode;
     
    7578  this->objComp6 = new PNode;
    7679
    77   Animation3D* animB0Shoot = this->getAnimation(WS_SHOOTING, this->objComp1);
    78   Animation3D* animB1Shoot = this->getAnimation(WS_SHOOTING, this->objComp2);
    79   Animation3D* animB2Shoot = this->getAnimation(WS_SHOOTING, this->objComp3);
    80   Animation3D* animT0Shoot = this->getAnimation(WS_SHOOTING, this->objComp4);
    81   Animation3D* animT1Shoot = this->getAnimation(WS_SHOOTING, this->objComp5);
    82   Animation3D* animT2Shoot = this->getAnimation(WS_SHOOTING, this->objComp6);
     80  Animation3D* animB0Shoot = this->getAnimation(WS_SHOOTING0, this->objComp1);
     81//   Animation3D* animB1Shoot = this->getAnimation(WS_SHOOTING1, this->objComp2);
     82//   Animation3D* animB2Shoot = this->getAnimation(WS_SHOOTING2, this->objComp3);
     83//   Animation3D* animT0Shoot = this->getAnimation(WS_SHOOTING3, this->objComp4);
     84//   Animation3D* animT1Shoot = this->getAnimation(WS_SHOOTING4, this->objComp5);
     85//   Animation3D* animT2Shoot = this->getAnimation(WS_SHOOTING5, this->objComp6);
    8386
    8487  animB0Shoot->setInfinity(ANIM_INF_CONSTANT);
    85   animB1Shoot->setInfinity(ANIM_INF_CONSTANT);
    86   animB2Shoot->setInfinity(ANIM_INF_CONSTANT);
    87   animT0Shoot->setInfinity(ANIM_INF_CONSTANT);
    88   animT1Shoot->setInfinity(ANIM_INF_CONSTANT);
    89   animT2Shoot->setInfinity(ANIM_INF_CONSTANT);
    90 
    91   animB0Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    92   animB0Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    93   animB0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    94 
    95   animT0Shoot->addKeyFrame(Vector(0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    96   animT0Shoot->addKeyFrame(Vector(-0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    97   animT0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    98 
    99   animB1Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    100   animB1Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
     88//   animB1Shoot->setInfinity(ANIM_INF_CONSTANT);
     89//   animB2Shoot->setInfinity(ANIM_INF_CONSTANT);
     90//   animT0Shoot->setInfinity(ANIM_INF_CONSTANT);
     91//   animT1Shoot->setInfinity(ANIM_INF_CONSTANT);
     92//   animT2Shoot->setInfinity(ANIM_INF_CONSTANT);
     93
     94  animB0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     95  animB0Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     96  animB0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     97/*
     98  animT0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     99  animT0Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     100  animT0Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);*/
     101/*
     102  animB1Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     103  animB1Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    101104  animB1Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    102105
    103   animT1Shoot->addKeyFrame(Vector(0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    104   animT1Shoot->addKeyFrame(Vector(-0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
     106  animT1Shoot->addKeyFrame(Vector(0.04, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     107  animT1Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    105108  animT1Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    106109
    107   animB2Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    108   animB2Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
     110  animB2Shoot->addKeyFrame(Vector(0.1, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     111  animB2Shoot->addKeyFrame(Vector(-0.1, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
    109112  animB2Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
    110113
    111   animT2Shoot->addKeyFrame(Vector(0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    112   animT2Shoot->addKeyFrame(Vector(-0.14, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);
    113   animT2Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);
     114  animT2Shoot->addKeyFrame(Vector(0.04, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);
     115  animT2Shoot->addKeyFrame(Vector(-0.04, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     116  animT2Shoot->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL);*/
    114117
    115118  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     
    175178
    176179  glPushMatrix();
    177   glTranslatef (this->objComp1->getAbsCoor().x, this->objComp1->getAbsCoor().y, this->objComp1->getAbsCoor().z);
    178   static_cast<StaticModel*>(this->getModel())->draw(1);
    179   static_cast<StaticModel*>(this->getModel())->draw(2);
    180   static_cast<StaticModel*>(this->getModel())->draw(0);
     180    glTranslatef (this->objComp1->getAbsCoor().x, this->objComp1->getAbsCoor().y, this->objComp1->getAbsCoor().z);
     181    static_cast<StaticModel*>(this->getModel())->draw(1);
     182    static_cast<StaticModel*>(this->getModel())->draw(2);
     183    static_cast<StaticModel*>(this->getModel())->draw(0);
     184
     185    glPushMatrix();
     186      glTranslatef (this->objComp4->getAbsCoor().x, this->objComp4->getAbsCoor().y, this->objComp4->getAbsCoor().z);
     187      static_cast<StaticModel*>(this->getModel())->draw(4);
     188      static_cast<StaticModel*>(this->getModel())->draw(5);
     189      static_cast<StaticModel*>(this->getModel())->draw(3);
     190    glPopMatrix();
    181191  glPopMatrix();
    182192/*
     
    190200  static_cast<StaticModel*>(this->getModel())->draw(0);
    191201  glPopMatrix();*/
    192 /*
    193   glTranslatef (this->objComp4->getAbsCoor().x, this->objComp4->getAbsCoor().y, this->objComp4->getAbsCoor().z);
    194   static_cast<StaticModel*>(this->getModel())->draw(4);
    195   static_cast<StaticModel*>(this->getModel())->draw(5);
    196   static_cast<StaticModel*>(this->getModel())->draw(3);
    197   glPopMatrix();*/
     202
     203//   glPushMatrix();
     204//   glTranslatef (this->objComp4->getAbsCoor().x, this->objComp4->getAbsCoor().y, this->objComp4->getAbsCoor().z);
     205//   static_cast<StaticModel*>(this->getModel())->draw(4);
     206//   static_cast<StaticModel*>(this->getModel())->draw(5);
     207//   static_cast<StaticModel*>(this->getModel())->draw(3);
     208//   glPopMatrix();
    198209/*
    199210  glPushMatrix();
  • branches/playability/src/world_entities/weapons/weapon.cc

    r10121 r10136  
    308308    {
    309309      PRINTF(2)("Node not defined for the Creation of the 3D-animation of state %s\n", stateToChar(state));
     310      return NULL;
     311    }
     312  }
     313  else
     314    return this->animation[state];
     315}
     316
     317Animation3D* Weapon::getAnimation(ShootingStates state, PNode* node)
     318{
     319  if (state >= WS_SS_MAX) // if the state is not known
     320    return NULL;
     321
     322  if (unlikely(this->animation[state] == NULL)) // if the animation does not exist yet create it.
     323  {
     324    if (likely(node != NULL))
     325      return this->animation[state] = new Animation3D(node);
     326    else
     327    {
     328//       PRINTF(2)("Node not defined for the Creation of the 3D-animation of state %s\n", stateToChar(state));
    310329      return NULL;
    311330    }
  • branches/playability/src/world_entities/weapons/weapon.h

    r9966 r10136  
    5555  WS_STATE_COUNT  =     8     //!< This must match the count of enumerations-members.
    5656} WeaponState;
     57
     58typedef enum
     59{
     60  WS_SHOOTING0    = 0x00000001, //!< Fireing 1st Barrel
     61  WS_SHOOTING1    = 0x00000002, //!< Fireing 2nd Barrel
     62  WS_SHOOTING2    = 0x00000004, //!< Fireing 3rd Barrel
     63  WS_SHOOTING3    = 0x00000008, //!< Fireing 4st Barrel
     64  WS_SHOOTING4    = 0x00000010, //!< Fireing 5st Barrel
     65  WS_SHOOTING5    = 0x00000020, //!< Fireing 6st Barrel
     66  WS_SHOOTING6    = 0x00000040, //!< Fireing 7st Barrel
     67  WS_SHOOTING7    = 0x00000080, //!< Fireing 8st Barrel
     68
     69  WS_SS_MAX       = 0x000000ff
     70}ShootingStates;
    5771
    5872//! an enumerator defining capabilities of a WeaponSlot
     
    158172
    159173    Animation3D* getAnimation(WeaponState state, PNode* node = NULL);
     174    Animation3D* getAnimation(ShootingStates state, PNode* node = NULL);
    160175    Animation3D* copyAnimation(WeaponState from, WeaponState to);
    161176
     
    186201    static WeaponState   charToState(const std::string& state);
    187202    static const char*   stateToChar(WeaponState state);
     203
     204
     205    inline int getBarrels() {return this->barrels; };
     206    inline int getSeg() {return this->segs; };
     207    inline void setBarrels(int barrels) { this->barrels = barrels; };
     208    inline void setSegs(int segs) { this->segs = segs; };
    188209
    189210  private:
     
    239260    ClassID                projectile;                      //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.)
    240261    FastFactory*           projectileFactory;               //!< A factory, that produces and handles the projectiles.
     262
     263    int                    barrels;                         //!< # of barrels
     264    int                    segs;                             //!< # of segments, one barrel has
    241265  };
    242266
Note: See TracChangeset for help on using the changeset viewer.