Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9615 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 30, 2006, 12:51:58 PM (18 years ago)
Author:
bensch
Message:

AimingTurret is better suited for network, as the projectiles are not connected to anything.
also it makes the game a little bit easier, and more fun as the turrets move around :)

Location:
branches/proxy/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/world_entities/npcs/network_turret.cc

    r9613 r9615  
    2929#include "effects/explosion.h"
    3030
    31 #include "weapons/targeting_turret.h"
     31#include "weapons/aiming_turret.h"
    3232
    3333CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET);
     
    6565  this->loadModel("models/ground_turret_#.obj", 5);
    6666
    67   this->weapon = new TargetingTurret();
     67  this->weapon = new AimingTurret();
    6868  this->weapon->loadModel("models/guns/turret2.obj", 10);
    6969  this->weapon->setParent(this);
     
    117117    diffVec = ( (*entity)->getAbsCoor() - this->getAbsCoor() );
    118118
    119     if ( diffVec.len() < 1000 )//&&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) )  < angle)
     119    if ( diffVec.len() < 100.0 )//&&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) )  < angle)
    120120    {
    121121      //if (this->getParent() != (*entity))
  • branches/proxy/src/world_entities/npcs/network_turret.h

    r9610 r9615  
    99#include "npcs/npc.h"
    1010
    11 class TargetingTurret;
     11class AimingTurret;
    1212
    1313//! A Class to ...
     
    4242private:
    4343  PNode  weaponHolder;
    44   TargetingTurret *weapon;
     44  AimingTurret *weapon;
    4545
    4646  int    targetGroup;
  • branches/proxy/src/world_entities/projectiles/projectile.cc

    r9406 r9615  
    4545  this->explosionBuffer = NULL;
    4646  this->engineBuffer = NULL;
     47
     48  //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    4749}
    4850
  • branches/proxy/src/world_entities/weapons/aiming_turret.cc

    r9406 r9615  
    3838*/
    3939AimingTurret::AimingTurret ()
    40   : Weapon()
     40  : Weapon(), target(this)
    4141{
    4242  this->init();
     
    4646
    4747AimingTurret::AimingTurret(const TiXmlElement* root)
     48  : target(this)
    4849{
    4950  this->init();
     
    9192  //this->getProjectileFactory()->prepare(100);
    9293
    93   this->target = new Aim(this);
    94   this->target->setVisibility(false);
    95   this->target->setRange(400);
    96   this->target->setAngle(M_PI_2);
     94  this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
     95  this->target.setVisibility(false);
     96  this->target.setRange(400);
     97  this->target.setAngle(M_PI_2);
    9798
    9899  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_3.wav");
     
    110111void AimingTurret::activate()
    111112{
    112   this->target->setVisibility(true);
     113  this->target.setVisibility(true);
    113114}
    114115
    115116void AimingTurret::deactivate()
    116117{
    117   this->target->setVisibility(false);
     118  this->target.setVisibility(false);
    118119}
    119120
     
    123124    return;
    124125  Quaternion quat;
    125   Vector direction = this->target->getAbsCoor() - this->getAbsCoor();
     126  Vector direction = this->target.getAbsCoor() - this->getAbsCoor();
    126127
    127128  direction.normalize();
     
    134135  this->setAbsDirSoft(quat, 5);
    135136
    136   this->target->tick(dt);
     137  this->target.tick(dt);
    137138}
    138139
     
    144145
    145146  pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    146             /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     147            /*target.getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    147148
    148149  pj->setParent(PNode::getNullParent());
  • branches/proxy/src/world_entities/weapons/aiming_turret.h

    r8777 r9615  
    88
    99#include "weapon.h"
    10 
     10#include "aim.h"
    1111/* FORWARD DECLARATION */
    12 class Aim;
    1312
    1413class AimingTurret : public Weapon
    15   {
    16   public:
    17     AimingTurret ();
    18     AimingTurret(const TiXmlElement* root);
    19     virtual ~AimingTurret ();
     14{
     15public:
     16  AimingTurret ();
     17  AimingTurret(const TiXmlElement* root);
     18  virtual ~AimingTurret ();
    2019
    21     void init();
    22     virtual void loadParams(const TiXmlElement* root);
     20  virtual void loadParams(const TiXmlElement* root);
    2321
    24     virtual void activate();
    25     virtual void deactivate();
     22  void setTargetGroup(OM_LIST targetGroup) { this->target.setTargetGroup(targetGroup); };
    2623
    27     virtual void tick(float dt);
    28     virtual void fire();
     24  virtual void activate();
     25  virtual void deactivate();
     26
     27  virtual void tick(float dt);
     28  virtual void fire();
    2929
    3030
    31     virtual void draw() const;
     31  virtual void draw() const;
    3232
    33   private:
    34     Aim*          target;
    35   };
     33private:
     34  void init();
     35
     36private:
     37  Aim           target;
     38};
    3639
    3740#endif /* _AIMING_TURRET_H */
Note: See TracChangeset for help on using the changeset viewer.