Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6054 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Dec 11, 2005, 6:23:42 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: multiple new Reparenting modes in PNode.
Testing the stuff in GuidedMissile
Projectile has a PNode as reference not as pointer
some minor weapon changes

Location:
trunk/src/world_entities/weapons
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/aim.cc

    r5779 r6054  
    6565  this->setClassID(CL_CROSSHAIR, "Aim");
    6666  this->setName("Aim");
     67
     68  this->addNodeModeFlags(PNODE_REPARENT_TO_NULLPARENT);
    6769
    6870  this->setLayer(E2D_LAYER_TOP);
  • trunk/src/world_entities/weapons/guided_missile.cc

    r5994 r6054  
    152152{
    153153  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    154   if (target != NULL && target->getParent() != NullParent::getInstance())
     154  if (target.getParent() != NullParent::getInstance())
    155155   {
    156      velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
     156     velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    157157     float speed = velocity.len();
    158158     if (speed > this->maxVelocity)
  • trunk/src/world_entities/weapons/guided_missile.h

    r5766 r6054  
    99#include "projectile.h"
    1010
    11 class Vector;
    1211class Weapon;
    1312class ParticleSystem;
  • trunk/src/world_entities/weapons/projectile.cc

    r5994 r6054  
    3838  this->lifeCycle = 0.0;
    3939  this->lifeSpan = 1.0f; /* sec */
    40   this->target = NULL;
     40  this->target.addNodeModeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT |
     41                                PNODE_REPARENT_TO_NULLPARENT);
    4142
    4243  this->removeNode();
     
    103104void Projectile::setTarget(PNode* target)
    104105{
    105 
    106   if (this->target == NULL)
    107      this->target = new PNode();
    108   this->target->setParent(target);
     106  this->target.setParent(target);
    109107}
    110108
  • trunk/src/world_entities/weapons/projectile.h

    r5994 r6054  
    5555    Vector                velocity;                  //!< velocity of the projectile.
    5656
    57     PNode*                target;                    //!< A target for guided Weapons.
     57    PNode                 target;                    //!< A target for guided Weapons.
    5858};
    5959
  • trunk/src/world_entities/weapons/weapon.cc

    r5930 r6054  
    528528  tick(dt);
    529529}
    530 
    531 /**
    532  *  this will draw the weapon
    533 */
    534 void Weapon::draw () const
    535 {}
    536 
    537530
    538531
  • trunk/src/world_entities/weapons/weapon.h

    r5750 r6054  
    148148
    149149    virtual void tick(float dt) {};
    150     virtual void draw() const;
    151150
    152151    bool check() const;
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r5982 r6054  
    3535
    3636/**
    37  * this initializes the weaponManager for a given nnumber of weapon slots
     37 * @brief this initializes the weaponManager for a given nnumber of weapon slots
    3838 * @param number of weapon slots of the model/ship <= 8 (limitied)
    3939 */
     
    5151
    5252/**
    53  * Destroys a WeaponManager
     53 * @brief Destroys a WeaponManager
    5454 */
    5555WeaponManager::~WeaponManager()
     
    6060
    6161/**
    62  * initializes the WeaponManager
     62 * @brief initializes the WeaponManager
    6363 */
    6464void WeaponManager::init()
Note: See TracChangeset for help on using the changeset viewer.