Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 4, 2006, 8:27:13 PM (18 years ago)
Author:
patrick
Message:

aiming sys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/weapons/aiming_system.cc

    r9166 r9168  
    1010
    1111   ### File Specific:
    12    main-programmer: Benjamin Grauer
     12   main-programmer: Patrick Boenzli
    1313   co-programmer: ...
    1414*/
     
    2323
    2424#include "aabb.h"
     25#include "obb_tree.h"
    2526
    2627#include <vector>
     
    3334 * standart constructor
    3435 */
    35 AimingSystem::AimingSystem (const TiXmlElement* root)
     36AimingSystem::AimingSystem (WorldEntity* entity)
    3637{
    3738  this->init();
    38 
    39 
    40   if (root)
    41     this->loadParams(root);
    4239}
    4340
     
    5956
    6057  this->loadModel("models/guns/targeting_system_body.obj");
    61 }
    6258
    63 
    64 void AimingSystem::loadParams(const TiXmlElement* root)
    65 {
    66   PNode::loadParams(root);
    67 
    68 //   LoadParam(root, "texture", this, AimingSystem, setTexture)
    69 //       .describe("the texture-file to load onto the AimingSystem");
    70 //
    71 //   LoadParam(root, "size", this, AimingSystem, setSize)
    72 //       .describe("the size of the AimingSystem in Pixels");
    73 //
    74 //   LoadParam(root, "rotation-speed", this, AimingSystem, setRotationSpeed)
    75 //       .describe("the Speed with which the AimingSystem should rotate");
     59  // registering default reactions:
     60  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
    7661}
    7762
     
    8974    return this->selectionList.back();
    9075
    91   WorldEntity* nearestEntity     = this->selectionList.back();
     76  WorldEntity* nearestEntity     = NULL;
    9277  float        distance          = 0.0f;
    9378  float        smalestDistance   = this->range * 5.0f;
     
    10489  }
    10590
    106   return nearestEntity;
     91  if( nearestEntity != this->owner)
     92    return nearestEntity;
     93  else return NULL;
    10794}
    10895
     
    127114{
    128115
    129   this->selectionList.clear();
     116//   this->selectionList.clear();
    130117}
    131118
     
    136123void AimingSystem::draw() const
    137124{
    138 //   if( this->getModelAABB() != NULL)
    139 //     this->getModelAABB()->drawBV(0, 1);
     125  WorldEntity::draw();
     126
     127  if( this->getOBBTree () != NULL)
     128    this->getOBBTree()->drawBV(0, 1);
    140129}
Note: See TracChangeset for help on using the changeset viewer.