Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8872 in orxonox.OLD for branches/single_player_map


Ignore:
Timestamp:
Jun 28, 2006, 4:56:34 PM (18 years ago)
Author:
patrick
Message:

more door work

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

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/door.cc

    r8870 r8872  
    6262{
    6363  this->setClassID(CL_DOOR, "Door");
    64   this->toList(OM_GROUP_00);
     64  this->toList(OM_COMMON);
    6565
    6666  this->lastCollided = NULL;
     
    7676  WorldEntity::loadParams(root);
    7777
    78   LoadParam(root, "md2animation", this, Door, setAnim)
    79       .describe("sets the animation of the md2 model")
    80       .defaultValues(1);
     78//   LoadParam(root, "", this, Door, set)
     79//       .describe("sets the animation of the md2 model")
     80//       .defaultValues(1);
    8181
    8282}
     
    9595    ((InteractiveModel*)this->getModel(0))->tick(time);
    9696
    97 }
    9897
    99 
    100 void Door::collidesWith(WorldEntity* entity, const Vector& location)
    101 {
    102   if( this->lastCollided != entity)
    103   {
    104     this->destroy();
    105     this->lastCollided = entity;
    106 
    107     if(State::getGameRules())
    108       State::getGameRules()->registerKill(Kill(entity, this));
    109   }
    11098}
    11199
    112100
    113101
    114 void Door::destroy()
     102/**
     103 * checks if the door is open
     104 */
     105void Door::checkOpen()
    115106{
    116   if( this->bDeath)
    117     return;
    118107
    119   this->bDeath = true;
    120   int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX);
    121108
    122   PRINTF(0)("randi = %i\n", randi);
    123 
    124   if( randi == 1)
    125     this->setAnim(DEATH_FALLBACK, MD2_ANIM_ONCE);
    126   else if( randi == 2)
    127     this->setAnim(DEATH_FALLFORWARD, MD2_ANIM_ONCE);
    128   else if( randi == 3)
    129     this->setAnim(DEATH_FALLBACKSLOW, MD2_ANIM_ONCE);
    130   else if( randi == 4)
    131     this->setAnim(CROUCH_DEATH, MD2_ANIM_ONCE);
    132   else
    133     this->setAnim(DEATH_FALLBACK, MD2_ANIM_ONCE);
    134109}
    135110
     111
     112
  • branches/single_player_map/src/world_entities/door.h

    r8870 r8872  
    1 #ifndef _TEST_ENTITY_H
    2 #define _TEST_ENTITY_H
     1#ifndef _DOOR_H
     2#define _DOOR_H
    33
    44#include "world_entity.h"
    5 #include "physics_interface.h"
    65
    7 class MD2Loader;
    8 class MD2Model;
    9 class MD2Model2;
    10 struct t3DModel;
    11 class Material;
     6
    127class TiXmlElement;
    13 class WorldEntity;
    148
    15 class TestEntity : public WorldEntity, public PhysicsInterface
     9
     10class Door : public WorldEntity
    1611{
    17  public:
    18   TestEntity ();
    19   TestEntity(const TiXmlElement* root);
    20   virtual ~TestEntity ();
     12  public:
     13    Door ();
     14    Door(const TiXmlElement* root);
     15    virtual ~Door ();
    2116
    22   void init();
    23   virtual void loadParams(const TiXmlElement* root);
     17    void init();
     18    virtual void loadParams(const TiXmlElement* root);
    2419
    25   void setAnim(int animationIndex, int animPlaybackMode);
     20    void setAnim(int animationIndex, int animPlaybackMode);
    2621
    27   virtual void destroy();
     22    virtual void tick (float time);
    2823
    29   virtual void tick (float time);
    30   virtual void collidesWith(WorldEntity* entity, const Vector& location);
     24  private:
     25    void checkOpen();
    3126
    32  private:
    33   /* TESTING TESTING TESTING */
    34   t3DModel* model;
    35   MD2Model* md2Model;
    36   Material* material;
     27  private:
     28    bool           bOpen;             //!< true if the door is open
    3729
    38   WorldEntity* lastCollided;
    39 
    40   bool bDeath;
    4130};
    4231
    43 #endif /* _TEST_ENTITY_H */
     32#endif /* _DOOR_H */
Note: See TracChangeset for help on using the changeset viewer.