Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8129 in orxonox.OLD


Ignore:
Timestamp:
Jun 3, 2006, 3:37:01 PM (18 years ago)
Author:
patrick
Message:

cr: finished cleaning up the code, collision reaction now integrated and should either work or throw a sigfault :D

Location:
branches/cr/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/cr/src/lib/collision_reaction/collision.cc

    r8124 r8129  
    4545
    4646/**
    47  * handles the collision events
    48  */
    49 void Collision::handleCollisionEvents()
    50 {
    51 
    52   this->bDispatched = true;
    53   this->flushCollisionEvents();
    54 }
    55 
    56 
    57 /**
    5847 * flushes the CollisionEvent list
    5948 */
     
    6655  this->entityBCollide = false;
    6756
    68   this->bDispatched = false;
     57  this->bDispatched = true;
    6958
    7059  this->collisionEvents.clear();
  • branches/cr/src/lib/collision_reaction/collision.h

    r8124 r8129  
    4545    /** @returns true if this Collision has already been dispatched */
    4646    inline bool isDispatched() { return this->bDispatched; }
     47    /** sets the dispatched flag to true */
     48    inline void dispatched() { this->bDispatched = true; }
    4749
    4850    /** registers a @param event CollisionEvent to take place */
     
    5254
    5355
    54     void handleCollisionEvents();
    55 
    56 
    57   private:
    5856    void flushCollisionEvents();
    5957
  • branches/cr/src/lib/collision_reaction/collision_handle.cc

    r8126 r8129  
    2121#include "collision.h"
    2222#include "collision_event.h"
     23#include "collision_reaction.h"
     24
     25#include "cr_object_damage.h"
    2326
    2427using namespace std;
     
    3740
    3841  this->bCollided = false;
    39   this->bContinuousPoll = false;
    4042  this->bDispatched = false;
    41   this->bStopOnFirstCollision = false;
     43
     44  if( this->type == CREngine::CR_PHYSICS_STEP_BACK)
     45    this->bContinuousPoll = false;
     46  else
     47    this->bContinuousPoll = true;
     48
     49  if( this->type == CREngine::CR_OBJECT_DAMAGE)
     50    this->bStopOnFirstCollision = true;
     51  else
     52   this->bStopOnFirstCollision = false;
     53
     54  switch( type)
     55  {
     56    case CREngine::CR_OBJECT_DAMAGE:
     57      this->collisionReaction = new CRObjectDamage();
     58      break;
     59    default:
     60      break;
     61  };
    4262}
    4363
     
    166186  vector<Collision*>::iterator it = this->collisionList.begin();
    167187  for(; it < this->collisionList.end(); it++) {
    168     (*it)->handleCollisionEvents();
     188    this->collisionReaction->reactToCollision(*it);
    169189  }
    170190
  • branches/cr/src/lib/collision_reaction/collision_handle.h

    r8125 r8129  
    1616class Collision;
    1717class WorldEntity;
     18class CollisionReaction;
    1819
    1920
     
    6364    std::vector<long>             targetList;              //!< a list of target classes for filtering
    6465
     66    CollisionReaction*            collisionReaction;       //!< reference to the collision reaction object
     67
    6568};
    6669
  • branches/cr/src/lib/collision_reaction/cr_object_damage.cc

    r8111 r8129  
    5454  float damage;
    5555
    56   PRINTF(0)("dealing damage\n");
     56  PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
     57            collision->getEntityA()->getClassName(),
     58            collision->getEntityB()->getClassName());
    5759
    5860  // the collision damage been dealed by the entity
     
    6668  }
    6769
     70  collision->flushCollisionEvents();
     71  collision->dispatched();
     72
    6873//   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
    6974//   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
  • branches/cr/src/lib/graphics/effects/atmospheric_engine.cc

    r7836 r8129  
    127127    for (it = weatherEffects->begin(); it != weatherEffects->end(); it++)
    128128    {
    129       printf("%s::%s \n", (*it)->getClassName(), (*it)->getName());
     129/*      printf("%s::%s \n", (*it)->getClassName(), (*it)->getName());*/
    130130      dynamic_cast<WeatherEffect*>(*it)->tick(dt);
    131131    }
Note: See TracChangeset for help on using the changeset viewer.