Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.