Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 15, 2006, 9:34:48 PM (18 years ago)
Author:
patrick
Message:

merged the bsp branche back to trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_reaction/collision_handle.cc

    r8362 r8490  
    2424
    2525#include "cr_object_damage.h"
     26#include "cr_physics_ground_walk.h"
    2627
    2728#include "debug.h"
     
    4243
    4344  this->bCollided = false;
    44   this->bDispatched = false;
    45 
    46   if( this->type == CREngine::CR_PHYSICS_STEP_BACK)
    47     this->bContinuousPoll = false;
    48   else
    49     this->bContinuousPoll = true;
    50 
    51   if( this->type == CREngine::CR_OBJECT_DAMAGE)
    52     this->bStopOnFirstCollision = true;
    53   else
    54    this->bStopOnFirstCollision = false;
     45  this->bDispatched = true;
     46
     47  this->collisionReaction = NULL;
     48  this->bContinuousPoll = false;
     49  this->bStopOnFirstCollision = false;
     50
    5551
    5652  switch( type)
    5753  {
     54    case CREngine::CR_PHYSICS_STEP_BACK:
     55//       this->collisionReaction = new CRPhysicsGroundWalk();
     56      this->bContinuousPoll = true;
     57      break;
     58    case CREngine::CR_PHYSICS_GROUND_WALK:
     59      this->collisionReaction = new CRPhysicsGroundWalk();
     60      this->bContinuousPoll = true;
     61      break;
    5862    case CREngine::CR_OBJECT_DAMAGE:
    5963      this->collisionReaction = new CRObjectDamage();
     64      this->bStopOnFirstCollision = true;
    6065      break;
    6166    default:
     
    7176{
    7277  // delete what has to be deleted here
     78  if( this->collisionReaction != NULL)
     79    delete this->collisionReaction;
    7380}
    7481
     
    169176
    170177 c->registerCollisionEvent(collisionEvent);
     178 PRINTF(0)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName());
    171179}
    172180
     
    186194void CollisionHandle::handleCollisions()
    187195{
     196  // if continuous poll poll the reaction
     197  if( this->bContinuousPoll && !this->bCollided)
     198  {
     199    this->collisionReaction->update(this->owner);
     200    return;
     201  }
     202
    188203  // collision reaction calculations (for every collision there will be a reaction)
    189204  vector<Collision*>::iterator it = this->collisionList.begin();
     
    214229  {
    215230    if( collisionEvent->getEntityA() == this->owner) {
    216       if( collisionEvent->getEntityA()->isA((ClassID)(*it)))
     231      if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
     232        PRINTF(0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     233                  collisionEvent->getEntityB()->getClassName(), *it);
    217234        return true; }
     235    }
    218236    else {
    219       if( collisionEvent->getEntityB()->isA((ClassID)(*it)))
    220         return true; }
     237      if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
     238        PRINTF(0)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     239                  collisionEvent->getEntityA()->getClassName(), *it);
     240      return true; }
     241    }
    221242  }
    222243
Note: See TracChangeset for help on using the changeset viewer.