Changeset 10010 in orxonox.OLD for branches/coll_rect.merge/src/world_entities/world_entity.h
- Timestamp:
- Dec 4, 2006, 4:39:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect.merge/src/world_entities/world_entity.h
r9869 r10010 12 12 13 13 #include "cr_engine.h" 14 #include "collision_filter.h" 14 15 #include "object_manager.h" 15 16 #include "glincl.h" … … 25 26 namespace OrxSound { class SoundBuffer; class SoundSource; } 26 27 namespace OrxGui { class GLGuiWidget; class GLGuiBar; class GLGuiEnergyWidget; }; 28 namespace CoRe { class Collision; } 27 29 28 30 class BVTree; … … 30 32 class AABBTreeNode; 31 33 class Model; 32 class CollisionHandle;33 class Collision;34 35 36 //class CharacterAttributes;37 38 34 39 35 … … 42 38 { 43 39 ObjectListDeclaration(WorldEntity); 40 44 41 public: 45 42 WorldEntity(); … … 51 48 void loadModel2(const std::string& fileN, float scal = 1.0f){this->loadModel(fileN,scal,0,4);} 52 49 void setModel(Model* model, unsigned int modelNumber = 0); 53 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };50 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; }; 54 51 55 52 inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; } … … 74 71 virtual void collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2); 75 72 76 77 73 /** @returns a reference to the obb tree of this worldentity */ 78 74 inline BVTree* getOBBTree() const { return this->obbTree; }; … … 81 77 inline AABB* getModelAABB() const { return (this->aabbNode)?this->aabbNode->getAABB():NULL;} 82 78 79 virtual void hit(float damage, WorldEntity* killer); 80 81 83 82 /* --- Collision Reaction Block --- */ 84 void subscribeReaction(CREngine::CRType type); 85 void subscribeReaction(CREngine::CRType type, const ClassID& target1); 86 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2); 87 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3); 88 void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4); 89 90 void unsubscribeReaction(CREngine::CRType type); 91 void unsubscribeReaction(); 92 93 bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB); 94 bool registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall = false); 83 void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1); 84 void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2); 85 void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3); 86 87 void unsubscribeReaction(CoRe::CREngine::ReactionType type); 88 void unsubscribeReactions(); 89 95 90 /** @return true if there is at least on collision reaction subscribed */ 96 inline bool isReactive() const { return this->bReactive; } 97 98 CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; } 91 inline bool isReactive() const { return this->_collisionFilter.isReactive(); } 92 93 /** @param worldEntity the world entity to be checked @returns true if there is a collisionreaction registered for the worldEntity */ 94 inline bool isReactive( const WorldEntity& worldEntity) const { return this->_collisionFilter(worldEntity); } 95 /** @param worldEntity the world entity to be checked @param type special reaction type @returns true if collision reaction reg. */ 96 inline bool isReactive( const WorldEntity& worldEntity, const CoRe::CREngine::ReactionType& type) const 97 { return this->_collisionFilter(worldEntity, type); } 98 99 100 const CoRe::CollisionFilter& getCollisionFilter(CoRe::CREngine::ReactionType type) const { return this->_collisionFilter; } 99 101 100 102 /** @returns true if this entity is standing on ground (BSP model) */ 101 bool isOnGround() const { return this-> bOnGround; }103 bool isOnGround() const { return this->_bOnGround; } 102 104 /** @param flag: marks if this entity is standing on ground */ 103 void setOnGround(bool flag) { this->bOnGround = flag; } 104 105 virtual void hit(float damage, WorldEntity* killer); 105 void setOnGround(bool flag) { this->_bOnGround = flag; } 106 106 107 107 virtual void destroy( WorldEntity* killer ); … … 128 128 129 129 void hide() { if( this->objectListNumber != OM_DEAD) this->lastObjectListNumber = this->objectListNumber; this->toList(OM_DEAD); } 130 void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }130 void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); } 131 131 132 132 133 133 /* --- Character Attribute Block --- */ 134 134 /** @returns the scaling of the model */ 135 float getScaling(){return this->scaling;}135 float getScaling(){return this->scaling;} 136 136 /** @returns the damage dealt by this world entity */ 137 137 float getDamage() const { return this->damage; } … … 170 170 void setHealthMax(float healthMax); 171 171 void createHealthWidget(); 172 173 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 172 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 173 174 174 175 private: 175 176 void updateHealthWidget(); 177 176 178 177 179 private: … … 195 197 OM_LIST lastObjectListNumber; //!< the last ObjectList from the ObjectManager this Entity was is in 196 198 197 198 199 /* collision reaction stuff */ 200 CoRe::CollisionFilter _collisionFilter; //!< filter for collision event filtering (not every entity listens to all collisions) 201 bool _bOnGround; //!< flag true if the object is on the ground 202 203 PhysicsInterface physicsInterface; //!< the physics object of the WorldEntity 204 205 /* network help structures */ 199 206 float scaling; //!< model's scaling factor 200 207 int scaling_handle; //!< handle for syncing var … … 212 219 int healthMax_handle; 213 220 214 CollisionHandle* collisionHandles[CREngine::CR_NUMBER]; //!< the list of the collision reactions 215 bool bReactive; //!< true if there is at least one collision reaction subscibed 216 217 PhysicsInterface physicsInterface; //!< the physics object of the WorldEntity 218 bool bOnGround; //!< true if this entity is standing on the ground 221 219 222 220 223 protected:
Note: See TracChangeset
for help on using the changeset viewer.