Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9889 in orxonox.OLD for branches/coll_rect/src/world_entities


Ignore:
Timestamp:
Oct 13, 2006, 3:57:44 PM (18 years ago)
Author:
patrick
Message:

added namspacing to collision reaction. now comes the harder part :D

Location:
branches/coll_rect/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/coll_rect/src/world_entities/creatures/fps_player.cc

    r9869 r9889  
    167167
    168168    //subscribe to collision reaction
    169   this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
     169  this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
    170170
    171171  this->initWeapon = false;
  • branches/coll_rect/src/world_entities/npcs/generic_npc.cc

    r9869 r9889  
    9696
    9797  // collision reaction registration
    98   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
     98  this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
    9999}
    100100
  • branches/coll_rect/src/world_entities/weapons/aiming_system.cc

    r9869 r9889  
    6161
    6262  // registering default reactions:
    63   this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE);
    64   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
     63  this->unsubscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE);
     64  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
    6565
    6666  this->range = 1000.0f;
  • branches/coll_rect/src/world_entities/world_entity.cc

    r9869 r9889  
    7878
    7979  // reset all collision handles to NULL == unsubscribed state
    80   for(int i = 0; i < CREngine::CR_NUMBER; ++i)
     80  for(int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i)
    8181    this->collisionHandles[i] = NULL;
    8282  this->bReactive = false;
     
    8484
    8585  // registering default reactions:
    86   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());
     86  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());
    8787
    8888  this->toList(OM_NULL);
     
    302302 *  @param target1 a filter target (classID)
    303303 */
    304 void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1)
     304void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1)
    305305{
    306306  this->subscribeReaction(type);
     
    316316 *  @param target1 a filter target (classID)
    317317 */
    318 void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2)
     318void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2)
    319319{
    320320  this->subscribeReaction(type);
     
    331331 *  @param target1 a filter target (classID)
    332332 */
    333 void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
     333void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
    334334{
    335335  this->subscribeReaction(type);
     
    342342
    343343
    344 /**
    345  * subscribes this world entity to a collision reaction
    346  *  @param type the type of reaction to subscribe to
    347  *  @param target1 a filter target (classID)
    348  */
    349 void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4)
    350 {
    351   this->subscribeReaction(type);
    352 
    353   // add the target filter
    354   this->collisionHandles[type]->addTarget(target1);
    355   this->collisionHandles[type]->addTarget(target2);
    356   this->collisionHandles[type]->addTarget(target3);
    357   this->collisionHandles[type]->addTarget(target4);
    358 }
    359 
    360344
    361345/**
     
    365349 *  @param ... the targets as classIDs
    366350 */
    367 void WorldEntity::subscribeReaction(CREngine::CRType type)
     351void WorldEntity::subscribeReaction(CoRe::CREngine::CRType type)
    368352{
    369353  if( this->collisionHandles[type] != NULL)
     
    373357  }
    374358
    375   this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type);
     359  this->collisionHandles[type] = CoRe::CREngine::getInstance()->subscribeReaction(this, type);
    376360
    377361  // now there is at least one collision reaction subscribed
     
    384368 *  @param type the reaction to unsubscribe
    385369 */
    386 void WorldEntity::unsubscribeReaction(CREngine::CRType type)
     370void WorldEntity::unsubscribeReaction(CoRe::CREngine::CRType type)
    387371{
    388372  if( this->collisionHandles[type] == NULL)
    389373    return;
    390374
    391   CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]);
     375  CoRe::CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]);
    392376  this->collisionHandles[type] = NULL;
    393377
    394378  // check if there is still any handler registered
    395   for(int i = 0; i < CREngine::CR_NUMBER; ++i)
     379  for(int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i)
    396380  {
    397381    if( this->collisionHandles[i] != NULL)
     
    410394void WorldEntity::unsubscribeReaction()
    411395{
    412   for( int i = 0; i < CREngine::CR_NUMBER; i++)
    413     this->unsubscribeReaction((CREngine::CRType)i);
     396  for( int i = 0; i < CoRe::CREngine::CR_NUMBER; i++)
     397    this->unsubscribeReaction((CoRe::CREngine::CRType)i);
    414398
    415399  // there are no reactions subscribed from now on
     
    433417
    434418  // get a collision event
    435   CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
     419  CoRe::CollisionEvent* c = CoRe::CREngine::getInstance()->popCollisionEventObject();
    436420  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    437421  c->collide(COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB);
    438422
    439   for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     423  for( int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i)
    440424    if( this->collisionHandles[i] != NULL)
    441425      this->collisionHandles[i]->registerCollisionEvent(c);
     
    457441
    458442  // get a collision event
    459   CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
     443  CoRe::CollisionEvent* c = CoRe::CREngine::getInstance()->popCollisionEventObject();
    460444  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    461445  c->collide(type, entity, groundEntity, normal, position, bInWall);
    462446
    463   for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     447  for( int i = 0; i < CoRe::CREngine::CR_NUMBER; ++i)
    464448    if( this->collisionHandles[i] != NULL)
    465449      this->collisionHandles[i]->registerCollisionEvent(c);
  • branches/coll_rect/src/world_entities/world_entity.h

    r9888 r9889  
    8282
    8383  /* --- 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);
     84  void subscribeReaction(CoRe::CREngine::CRType type);
     85  void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1);
     86  void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2);
     87  void subscribeReaction(CoRe::CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
     88
     89  void unsubscribeReaction(CoRe::CREngine::CRType type);
    9190  void unsubscribeReaction();
    9291
     
    9695  inline bool isReactive() const { return this->bReactive; }
    9796
    98   CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }
     97  CoRe::CollisionHandle* getCollisionHandle(CoRe::CREngine::CRType type) const { return this->collisionHandles[type]; }
    9998
    10099  /** @returns true if this entity is standing on ground (BSP model) */
     
    212211  int                     healthMax_handle;
    213212
    214   CollisionHandle*        collisionHandles[CREngine::CR_NUMBER];  //!< the list of the collision reactions
     213  CoRe::CollisionHandle*  collisionHandles[CoRe::CREngine::CR_NUMBER];  //!< the list of the collision reactions
    215214  bool                    bReactive;                              //!< true if there is at least one collision reaction subscibed
     215
    216216
    217217  PhysicsInterface        physicsInterface;                //!< the physics object of the WorldEntity
Note: See TracChangeset for help on using the changeset viewer.