Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8931 in orxonox.OLD for branches/single_player_map/src


Ignore:
Timestamp:
Jun 30, 2006, 12:20:28 AM (18 years ago)
Author:
patrick
Message:

repair station work, collision reaction

Location:
branches/single_player_map/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8930 r8931  
    156156    }
    157157  }
    158   PRINTF(0)("collision distanzes: x: %f, y: %f, z: %f\n", front, height, side);
     158  PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    159159
    160160
  • branches/single_player_map/src/world_entities/npcs/repair_station.cc

    r8927 r8931  
    3636
    3737//! list of all different animations a std md2model supports
    38 sAnim RepairStation::animationList[2] =
     38// sAnim RepairStation::animationList[2] =
     39// {
     40//  // begin, end, fps, interruptable
     41//   {   0,  10,  30,  0 },   //!< OPEN
     42//   {   10, 20,  30,  0 }    //!< CLOSE
     43// };
     44
     45
     46sAnim RepairStation::animationList[8] =
    3947{
    4048 // begin, end, fps, interruptable
    41   {   0,  10,  30,  0 },   //!< OPEN
    42   {   10, 20,  30,  0 }    //!< CLOSE
     49  {   0,  12,  30,  0 },   //!< CYCLE01
     50  {   12, 24,  30,  0 },   //!< CYCLE02
     51  {   24, 40,  30,  0 },   //!< CYCLE03
     52  {   40, 55,  30,  0 },   //!< CYCLE04
     53  {   55, 68,  30,  0 },   //!< CYCLE05
     54  {   68, 81,  30,  0 },   //!< CYCLE06
     55  {   81, 89,  30,  0 },   //!< CYCLE07
     56  {   89, 99,  30,  0 }    //!< CYCLE08
    4357};
    4458
     
    133147
    134148
    135 /**
    136  * open the door
    137  */
    138 void RepairStation::open()
    139 {
    140   if( this->bLocked)
    141     return;
    142 
    143   this->setAnimation(DOOR_OPEN, MD2_ANIM_ONCE);
    144   this->bOpen = true;
    145 }
    146149
    147150
    148 /**
    149  * close the door
    150  */
    151 void RepairStation::close()
    152 {
    153   this->setAnimation(DOOR_CLOSE, MD2_ANIM_ONCE);
    154   this->bOpen = false;
    155 }
    156 
    157 
    158 
    159 /**
    160  * checks if the door is open
    161  */
    162 bool RepairStation::checkOpen()
    163 {
    164 
    165   std::list<BaseObject*>::const_iterator it;
    166   const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    167   WorldEntity* entity;
    168   float distance;
    169 
    170   if( list == NULL)
    171     return false;
    172 
    173   // for all players
    174   for( it = list->begin(); it != list->end(); it++)
    175   {
    176     entity = dynamic_cast<WorldEntity*>(*it);
    177 
    178     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
    179     if( distance < this->actionRadius)
    180       return true;
    181   }
    182 
    183 
    184   list = ClassList::getList(CL_GENERIC_NPC);
    185   if( list == NULL)
    186     return false;
    187   for( it = list->begin(); it != list->end(); it++)
    188   {
    189     entity = dynamic_cast<WorldEntity*>(*it);
    190 
    191     distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
    192     if( distance < this->actionRadius)
    193       return true;
    194   }
    195 
    196   return false;
    197 }
    198 
    199 
    200 
  • branches/single_player_map/src/world_entities/npcs/repair_station.h

    r8927 r8931  
    1212typedef enum RepairStationAnimType
    1313{
    14   STATION_OPEN = 0,
    15   STATION_CLOSE,
     14  REPAIR_CYCLE01 = 0,
     15  REPAIR_CYCLE02,
     16  REPAIR_CYCLE03,
     17  REPAIR_CYCLE04,
     18  REPAIR_CYCLE05,
     19  REPAIR_CYCLE06,
     20  REPAIR_CYCLE07,
     21  REPAIR_CYCLE08,
    1622
    1723  DOOR_MAX_ANIMATIONS
     
    3137    void setScale(float scale) { this->scale = scale; }
    3238
    33     void open();
    34     void close();
    35 
    36     void lock() { this->bLocked = true; }
    37     void unlock() { this->bLocked = false; }
    38     bool isLocked() const { return this->bLocked; }
    39 
    40 
    4139    virtual void tick (float time);
    4240
    4341
    4442  private:
    45     bool checkOpen();
    4643    void setAnimation(int animNum, int playbackMode = 0);
    4744
    4845
    4946  private:
    50     bool           bOpen;             //!< true if the door is open
    51     bool           bLocked;           //!< true if this door is locked
    52     float          actionRadius;      //!< action radius
    5347    float          scale;             //!< the scale of the model
    5448
    55     static sAnim   animationList[2];  //!< list of the animations
     49    static sAnim   animationList[8];  //!< list of the animations
    5650
    5751
Note: See TracChangeset for help on using the changeset viewer.