- Timestamp:
- Jun 28, 2006, 4:56:34 PM (18 years ago)
- 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 62 62 { 63 63 this->setClassID(CL_DOOR, "Door"); 64 this->toList(OM_ GROUP_00);64 this->toList(OM_COMMON); 65 65 66 66 this->lastCollided = NULL; … … 76 76 WorldEntity::loadParams(root); 77 77 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); 81 81 82 82 } … … 95 95 ((InteractiveModel*)this->getModel(0))->tick(time); 96 96 97 }98 97 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 }110 98 } 111 99 112 100 113 101 114 void Door::destroy() 102 /** 103 * checks if the door is open 104 */ 105 void Door::checkOpen() 115 106 { 116 if( this->bDeath)117 return;118 107 119 this->bDeath = true;120 int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX);121 108 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 else133 this->setAnim(DEATH_FALLBACK, MD2_ANIM_ONCE);134 109 } 135 110 111 112 -
branches/single_player_map/src/world_entities/door.h
r8870 r8872 1 #ifndef _ TEST_ENTITY_H2 #define _ TEST_ENTITY_H1 #ifndef _DOOR_H 2 #define _DOOR_H 3 3 4 4 #include "world_entity.h" 5 #include "physics_interface.h"6 5 7 class MD2Loader; 8 class MD2Model; 9 class MD2Model2; 10 struct t3DModel; 11 class Material; 6 12 7 class TiXmlElement; 13 class WorldEntity;14 8 15 class TestEntity : public WorldEntity, public PhysicsInterface 9 10 class Door : public WorldEntity 16 11 { 17 public:18 TestEntity();19 TestEntity(const TiXmlElement* root);20 virtual ~TestEntity();12 public: 13 Door (); 14 Door(const TiXmlElement* root); 15 virtual ~Door (); 21 16 22 void init();23 virtual void loadParams(const TiXmlElement* root);17 void init(); 18 virtual void loadParams(const TiXmlElement* root); 24 19 25 void setAnim(int animationIndex, int animPlaybackMode);20 void setAnim(int animationIndex, int animPlaybackMode); 26 21 27 virtual void destroy();22 virtual void tick (float time); 28 23 29 virtual void tick (float time);30 virtual void collidesWith(WorldEntity* entity, const Vector& location);24 private: 25 void checkOpen(); 31 26 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 37 29 38 WorldEntity* lastCollided;39 40 bool bDeath;41 30 }; 42 31 43 #endif /* _ TEST_ENTITY_H */32 #endif /* _DOOR_H */
Note: See TracChangeset
for help on using the changeset viewer.