Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8894 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jun 29, 2006, 12:19:48 AM (19 years ago)
Author:
patrick
Message:

merged the branche single_player_map with the trunk

Location:
trunk/src/world_entities
Files:
9 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/WorldEntities.am

    r8793 r8894  
    1616                world_entities/character_attributes.cc \
    1717                world_entities/test_entity.cc \
     18                world_entities/door.cc \
    1819                world_entities/planet.cc \
    1920                world_entities/bsp_entity.cc \
     
    2627                world_entities/weapons/hyperblaster.cc \
    2728                world_entities/weapons/aim.cc \
     29                world_entities/weapons/fps_sniper_rifle.cc \
    2830                \
    2931                world_entities/projectiles/bomb.cc \
     
    7476                character_attributes.h \
    7577                test_entity.h \
     78                door.h \
    7679                planet.h \
    7780                bsp_entity.h \
     
    8487                weapons/targeting_turret.h \
    8588                weapons/aim.h \
     89                weapons/fps_sniper_rifle.h \
    8690                \
    8791                projectiles/bomb.h \
  • trunk/src/world_entities/creatures/fps_player.cc

    r8846 r8894  
    2626#include "weapons/turret.h"
    2727#include "weapons/cannon.h"
     28#include "weapons/fps_sniper_rifle.h"
    2829
    2930#include "key_mapper.h"
     
    3536
    3637CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER);
     38
     39#include "script_class.h"
     40CREATE_SCRIPTABLE_CLASS(FPSPlayer, CL_FPS_PLAYER,
     41                        addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     42                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     43                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     44                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     45                       );
    3746
    3847
     
    101110  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    102111
    103   Weapon* wpRight = new TestGun(0);
     112  Weapon* wpRight = new FPSSniperRifle(0);
    104113  wpRight->setName("testGun Right");
    105   Weapon* wpLeft = new TestGun(1);
     114/*  Weapon* wpLeft = new TestGun(1);*/
    106115//   Weapon* wpLeft = new Turret();
    107   wpLeft->setName("testGun Left");
    108 
    109   this->addWeapon(wpLeft, 1, 0);
    110   this->addWeapon(wpRight,1 ,1);
     116//   wpLeft->setName("testGun Left");
     117
     118//   this->addWeapon(wpLeft, 1, 0);
     119  this->addWeapon(wpRight,1, 0);
    111120  this->getWeaponManager().changeWeaponConfig(1);
    112121
    113122  this->getWeaponManager().setSlotCount(2);
    114   this->getWeaponManager().setSlotPosition(0, Vector(-0.5, .2, -1.9));
     123  this->getWeaponManager().setSlotPosition(0, Vector(0.0, 5.0, 0.0));
     124  this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(0,1,0)));
    115125  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    116126  this->getWeaponManager().setSlotPosition(1, Vector(-0.5, .2, 1.9));
  • trunk/src/world_entities/npcs/generic_npc.cc

    r8805 r8894  
    3838CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC);
    3939
     40#include "script_class.h"
     41CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
     42                       // Move
     43                        addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo))
     44                        ->addMethod("setTime", ExecutorLua1<GenericNPC,float>(&GenericNPC::setTime))
     45                        ->addMethod("turnTo", ExecutorLua4ret<GenericNPC,bool,float,float,float,float>(&GenericNPC::turnTo))
     46                       // Display
     47                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
     48                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
     49                       // Coordinates
     50                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     51                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     52                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     53                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     54                        ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir))
     55                           
     56                       );
     57
    4058
    4159
     
    5270}
    5371
     72
     73GenericNPC::GenericNPC()
     74  : NPC(NULL)
     75{
     76
     77}
    5478
    5579/**
     
    7599  this->soundBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
    76100
     101  time = 30.0f;
    77102  // collision reaction registration
    78103//   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
     
    136161
    137162  // check if this is the current goal
    138   if( this->destCoor != destCoor && this->destDir != destDir)
     163  if( this->destCoor != destCoor || this->destDir != destDir)
    139164  {
    140     this->destCoor = Vector(x, y, 0.0f);
    141     this->destDir = Quaternion(Vector(qx, qy, qz), qu);
    142 
    143     float time = 5.0f;
     165    this->destCoor = destCoor;
     166    this->destDir = destDir;
     167
     168    //float time = 100.0f;
    144169
    145170    if( this->currentAnim != NULL)
     
    147172
    148173    this->currentAnim = new Animation3D(this);
    149     this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f);
    150     this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time);
     174    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
     175    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
     176    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
     177
     178    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     179    this->currentAnim->play();
     180
     181    this->setAnimation(RUN, MD2_ANIM_LOOP);
    151182  }
    152183
     
    157188
    158189
     190/**
     191 * walk to a specific place with direction
     192 *
     193 * @param x: x coordinate to go to
     194 * @param y: y coordinate to go to
     195 * @param z: z coordinate to go to
     196 *
     197 * without turning itself
     198 */
     199float GenericNPC::walkTo(float x, float y, float z)
     200{
     201  Quaternion q = this->getAbsDir();
     202
     203  //printf("%s moving to %f, %f, %f \n",this->getName(),x,y,z);
     204
     205  return this->walkTo(x, y, z, q.w, q.v.x, q.v.y, q.v.z);
     206}
    159207
    160208/**
     
    188236
    189237
     238
     239/**
     240 * run to a specific place with direction
     241 *
     242 * @param x: x coordinate to go to
     243 * @param y: y coordinate to go to
     244 * @param z: z coordinate to go to
     245 * @param qu: angle to rotate
     246 * @param qx: x coordinate of rotation vector
     247 * @param qy: y coordinate of rotation vector
     248 * @param qz: z coordinate of rotation vector
     249 *
     250 */
     251float GenericNPC::runTo(float x, float y, float z, float qu, float qx, float qy, float qz)
     252{
     253  Vector destCoor = Vector(x, y, z);
     254  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
     255
     256  // check if this is the current goal
     257  if( this->destCoor != destCoor || this->destDir != destDir)
     258  {
     259    this->destCoor = destCoor;
     260    this->destDir = destDir;
     261
     262    float time = 5.0f;
     263
     264    if( this->currentAnim != NULL)
     265      delete this->currentAnim;
     266
     267    this->currentAnim = new Animation3D(this);
     268    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
     269    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
     270
     271
     272    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     273    this->currentAnim->play();
     274
     275    this->setAnimation(RUN, MD2_ANIM_LOOP);
     276  }
     277
     278  // calculate the distance
     279  Vector distance = this->getAbsCoor() - this->destCoor;
     280  return distance.len();
     281}
     282
     283
     284/**
     285 * run to a specific place with direction
     286 *
     287 * @param x: x coordinate to go to
     288 * @param y: y coordinate to go to
     289 * @param qu: angle to rotate
     290 * @param qx: x coordinate of rotation vector
     291 * @param qy: y coordinate of rotation vector
     292 * @param qz: z coordinate of rotation vector
     293 *
     294 */
     295float GenericNPC::runTo(float x, float y, float qu, float qx, float qy, float qz)
     296{
     297  this->runTo(x, y, 0.0f, qu, qx, qy, qz);
     298}
     299
     300
     301/**
     302 * run to a specific place with direction
     303 *
     304 * @param coor: vector place
     305 * @param dir: direction
     306 *
     307 */
     308float GenericNPC::runTo(const Vector& coordinate, const Quaternion& dir)
     309{
     310  this->runTo(coordinate.x, coordinate.y, coordinate.z, dir.w, dir.v.x, dir.v.y, dir.v.z);
     311}
     312
     313
     314/**
     315 * crouch to a specific place with direction
     316 *
     317 * @param x: x coordinate to go to
     318 * @param y: y coordinate to go to
     319 * @param z: z coordinate to go to
     320 * @param qu: angle to rotate
     321 * @param qx: x coordinate of rotation vector
     322 * @param qy: y coordinate of rotation vector
     323 * @param qz: z coordinate of rotation vector
     324 *
     325 */
     326float GenericNPC::crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz)
     327{
     328  Vector destCoor = Vector(x, y, z);
     329  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
     330
     331  // check if this is the current goal
     332  if( this->destCoor != destCoor || this->destDir != destDir)
     333  {
     334    this->destCoor = destCoor;
     335    this->destDir = destDir;
     336
     337
     338    if( this->currentAnim != NULL)
     339      delete this->currentAnim;
     340
     341    this->currentAnim = new Animation3D(this);
     342    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
     343    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
     344
     345
     346    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     347    this->currentAnim->play();
     348
     349    this->setAnimation(CROUCH_WALK, MD2_ANIM_LOOP);
     350  }
     351
     352  // calculate the distance
     353  Vector distance = this->getAbsCoor() - this->destCoor;
     354  return distance.len();
     355}
     356
     357
     358/**
     359 * couch to a specific place with direction
     360 *
     361 * @param x: x coordinate to go to
     362 * @param y: y coordinate to go to
     363 * @param qu: angle to rotate
     364 * @param qx: x coordinate of rotation vector
     365 * @param qy: y coordinate of rotation vector
     366 * @param qz: z coordinate of rotation vector
     367 *
     368 */
     369float GenericNPC::crouchTo(float x, float y, float qu, float qx, float qy, float qz)
     370{
     371  this->crouchTo(x, y, 0.0f, qu, qx, qy, qz);
     372}
     373
     374
     375
     376/**
     377 * crouch to a specific place with direction
     378 *
     379 * @param coor: vector place
     380 * @param dir: direction
     381 *
     382 */
     383float GenericNPC::crouchTo(const Vector& coordinate, const Quaternion& dir)
     384{
     385  this->crouchTo(coordinate.x, coordinate.y, coordinate.z, dir.w, dir.v.x, dir.v.y, dir.v.z);
     386}
     387
     388
     389/**
     390 * stops the generic animation
     391 */
     392void GenericNPC::stop()
     393{
     394  if( this->currentAnim != NULL)
     395  {
     396    this->currentAnim->stop();
     397    delete this->currentAnim;
     398    this->currentAnim = NULL;
     399
     400    this->setAnimation(STAND, MD2_ANIM_LOOP);
     401  }
     402}
     403
     404
     405/**
     406 * lookat a world entity
     407 * @param worldEntity: the worldentity to look at
     408 */
     409float GenericNPC::lookAt(WorldEntity* worldEntity)
     410{}
     411
     412
     413/**
     414 * turns to a given direction
     415 */
     416bool GenericNPC::turnTo(float qu, float qx, float qy, float qz)
     417{
     418  Quaternion destDir = Quaternion(Vector(qx, qy, qz).getNormalized(), qu);
     419
     420  printf("Turning: %f, %f, %f, %f \n",qu,qx,qy,qz);
     421  // check if this is the current goal
     422  if( this->destDir != destDir)
     423  {
     424//     if( this->currentAnim != NULL)
     425//       this->currentAnim->stop();
     426//
     427    PRINTF(0)("SET ANIMATION\n");
     428    this->destDir = destDir;
     429//
     430
     431
     432    if( this->currentAnim != NULL)
     433      delete this->currentAnim;
     434
     435    this->setAbsDir(destDir);
     436/*
     437    this->currentAnim = new Animation3D(this);
     438    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
     439    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
     440    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
     441
     442
     443    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     444    this->currentAnim->play();*/
     445
     446    this->setAnimation(STAND, MD2_ANIM_LOOP);
     447  }
     448
     449  // calculate the distance
     450  Vector distance = this->getAbsCoor() - this->destCoor;
     451  return distance.len();
     452}
     453
     454
     455
     456/**
     457 * talk to a world entity and play a sound/music/voice
     458 * @param worldEntity: entity
     459 * @param dialogNr: sound nr to be played (from the xml load tags)
     460 */
     461float GenericNPC::talkTo(WorldEntity* worldEntity, int dialogNr)
     462{}
     463
     464
     465/**
     466 * world entity to shoot at if there is any weapon on the npc
     467 * @param entity: entity to shoot entity
     468 */
     469void GenericNPC::shootAt(WorldEntity* entity)
     470{}
     471
     472
     473
     474
     475
     476
     477
     478
     479
     480
    190481/**
    191482 * tick this world entity
     
    196487  if( likely(this->getModel(0) != NULL))
    197488    ((InteractiveModel*)this->getModel(0))->tick(time);
     489
    198490}
    199491
  • trunk/src/world_entities/npcs/generic_npc.h

    r8802 r8894  
    2828{
    2929 public:
     30  GenericNPC();
    3031  GenericNPC(const TiXmlElement* root);
    3132  virtual ~GenericNPC ();
     
    3839  inline void setVolume(float vol) { this->soundVolume = vol; }
    3940
    40   void playAnimation(int animationIndex, int animPlaybackMode);
    4141
    42   void playSound(std::string filename);
    43   void playSound(int i);
     42  /* npc controlling functions */
    4443
    45   float lookAt(WorldEntity* worldEntity);
    46 
     44  /* walking functions */
    4745  float walkTo(const Vector& coordinate, const Quaternion& dir);
     46  float walkTo(float x, float y, float z);
    4847  float walkTo(float x, float y, float z, float qu, float qx, float qy, float qz);
    4948  float walkTo(float x, float y, float qu, float qx, float qy, float qz);
    5049
     50  /* running functions */
    5151  float runTo(const Vector& coordinate, const Quaternion& dir);
    5252  float runTo(float x, float y, float z, float qu, float qx, float qy, float qz);
    5353  float runTo(float x, float y, float qu, float qx, float qy, float qz);
    5454
     55  /* couching functinos */
    5556  float crouchTo(const Vector& coordinate, const Quaternion& dir);
    5657  float crouchTo(float x, float y, float z, float qu, float qx, float qy, float qz);
    5758  float crouchTo(float x, float y, float qu, float qx, float qy, float qz);
    5859
     60  /* stopping the movement */
     61  void stop();
     62
     63  /* some oriantation functions */
     64  float lookAt(WorldEntity* worldEntity);
     65  bool turnTo(float qu, float qx, float qy, float qz);
     66
     67  /* talking funcitons*/
    5968  float talkTo(WorldEntity* worldEntity, int dialogNr);
     69
     70  /* shooting functions */
     71  void shootAt(WorldEntity* entity);
     72
     73
     74  /* some generic control funtions */
     75  void playAnimation(int animationIndex, int animPlaybackMode);
     76  void playSound(std::string filename);
     77  void playSound(int i);
     78
     79  void setTime(float newTime){ this->time = newTime; };
     80 
     81  virtual void tick (float time);
    6082
    6183
    6284  void destroy();
    63 
    64   virtual void tick (float time);
    6585
    6686
     
    7494
    7595   Animation3D*                            currentAnim;
     96   float                                   time;          //!< Duration of the action
    7697};
    7798
  • trunk/src/world_entities/npcs/npc.cc

    r8724 r8894  
    5050void NPC::loadParams(const TiXmlElement* root)
    5151{
    52   WorldEntity::loadParams(root);
     52  if(root != NULL)
     53   WorldEntity::loadParams(root);
    5354}
    5455
  • trunk/src/world_entities/script_trigger.cc

    r8783 r8894  
    2424CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER,
    2525                            addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    26                                 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    27                                 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    28                                 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     26                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     27                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     28                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    2929                       );
    3030
     
    4141
    4242  returnCount = 1;
    43   actionFinished = false;
     43  scriptFinished = false;
    4444  doDebugDraw = false;
    4545  invert = false;
    4646  scriptCalled = false;
    4747  scriptIsOk = false;
    48   triggerLasts = false;
     48  triggerLasts = true;
    4949  addToScript = false;
    5050 
     
    5454  loadParams(root);
    5555 
    56   if(addToScript)
     56  if(addToScript && scriptIsOk)
    5757  {
    5858    script->addObject( "ScriptTrigger", this->getName());
     
    102102        .describe("The name of the parent as it is in the *.oxw file")
    103103        .defaultValues("");
    104     LoadParam(root, "callonce", this, ScriptTrigger, setCallOnce)
    105         .describe("True if the script shoul only be called once")
    106         .defaultValues("");
    107104    LoadParam(root, "invert", this, ScriptTrigger, setInvert)
    108105        .describe("")
    109         .defaultValues("");
     106        .defaultValues("false");
    110107    LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
    111108        .describe("")
    112         .defaultValues("");
     109        .defaultValues("true");
    113110    LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
    114         .describe("True if the script should only be called once")
    115         .defaultValues("");
     111        .describe("")
     112        .defaultValues("false");
    116113    LoadParam(root, "addtoscript", this, ScriptTrigger, setAddToScript)
    117114        .describe("True if this scripttrigger should be aviable in the script")
    118         .defaultValues("");
     115        .defaultValues("false");
    119116}
    120117
     
    159156void ScriptTrigger::tick(float timestep)
    160157{
    161   if(actionFinished) return;
     158  if(scriptFinished) return;
    162159
    163160  if(triggerLasts && scriptCalled)
     
    169166  if( !invert && this->distance(target) < radius)
    170167 {
    171   if(!callOnce)
    172    {
    173168    executeAction(timestep);
    174169    scriptCalled = true;
    175    }
    176   else if(callOnce && !scriptCalled)
    177   {
    178    executeAction(timestep);
    179    scriptCalled = true;
    180   }
    181170 
    182171 }
    183172 else if( invert && this->distance(target) > radius)
    184173 {
    185    if(!callOnce)
    186    {
    187      executeAction(timestep);
    188    }
    189    else if(callOnce && !scriptCalled)
    190    {
    191      executeAction(timestep);
     174     executeAction(timestep);
    192175     scriptCalled = true;
    193    }
    194    
    195176 }
    196177 //else
     
    202183void ScriptTrigger::executeAction(float timestep)
    203184{
     185 
    204186     if(scriptIsOk)
    205187     {
     
    213195       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
    214196     
    215      actionFinished = script->getReturnedBool();
     197     scriptFinished = script->getReturnedBool();
    216198     }
    217199     
  • trunk/src/world_entities/script_trigger.h

    r8783 r8894  
    3535    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
    3636    void setTriggerParent(const std::string& name);
    37     void setCallOnce(const bool call) { this->callOnce = call; }
    3837    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
    3938    void setInvert(const bool inv) { this->invert = invert; }
     
    5150
    5251    WorldEntity* target;
    53     bool         callOnce;
    5452    bool         triggerLasts;
    5553    bool         invert;
     
    6361    bool         scriptCalled;
    6462    bool         scriptIsOk;
    65     bool         actionFinished;
     63    bool         scriptFinished;
    6664    int          returnCount;        //TODO: set return count correctly
    6765
  • trunk/src/world_entities/world_entity.cc

    r8778 r8894  
    193193        PRINTF(1)("OBJ-File %s not found.\n", fileName.c_str());
    194194
    195       if( modelNumber == 0)
     195      if( modelNumber == 0 && !this->isA(CL_WEAPON))
    196196        this->buildObbTree(obbTreeDepth);
    197197    }
     
    418418  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
    419419  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    420   c->collide(entityA, entityB, bvA, bvB);
     420  c->collide(COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB);
    421421
    422422  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
     
    433433 *  @param position it collides on the plane
    434434 */
    435 bool WorldEntity::registerCollision(WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position)
     435bool WorldEntity::registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall)
    436436{
    437437  // is there any handler listening?
     
    442442  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
    443443  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
    444   c->collide(entity, groundEntity, normal, position);
     444  c->collide(type, entity, groundEntity, normal, position, bInWall);
    445445
    446446  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
  • trunk/src/world_entities/world_entity.h

    r8777 r8894  
    8888
    8989  bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
    90   bool registerCollision(WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position);
     90  bool registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall = false);
    9191  /** @return true if there is at least on collision reaction subscribed */
    9292  inline bool isReactive() const { return this->bReactive; }
     
    115115  /** @returns a Reference to the Iterator */
    116116  ObjectManager::EntityList::iterator& getEntityIterator() { return this->objectListIterator; }
     117
     118  void hide() { if( this->objectListNumber != OM_DEAD) this->lastObjectListNumber = this->objectListNumber; this->toList(OM_DEAD); }
     119  void unhide() { this->toList(this->lastObjectListNumber); }
     120
    117121
    118122  /* --- Character Attribute Block --- */
     
    176180  OM_LIST                 objectListNumber;                //!< The ObjectList from ObjectManager this Entity is in.
    177181  ObjectManager::EntityList::iterator objectListIterator;  //!< The iterator position of this Entity in the given list of the ObjectManager.
     182  OM_LIST                 lastObjectListNumber;            //!< the last ObjectList from the ObjectManager this Entity was is in
    178183
    179184
Note: See TracChangeset for help on using the changeset viewer.