Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 15, 2007, 11:12:29 AM (17 years ago)
Author:
rennerc
Message:

FPSSniperRifle uses BspWeapon now

File:
1 edited

Legend:

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

    r10317 r10704  
    2727#include "weapon_manager.h"
    2828#include "util/loading/factory.h"
     29#include "debug.h"
    2930
    3031
     
    4849   creates a new weapon
    4950*/
    50 FPSSniperRifle::FPSSniperRifle ( int leftRight)
     51FPSSniperRifle::FPSSniperRifle ( int leftRight, OM_LIST list)
    5152  : Weapon()
    5253{
    53   this->init();
     54  this->init(list);
    5455
    5556  this->leftRight = leftRight;
     
    5960FPSSniperRifle::FPSSniperRifle(const TiXmlElement* root)
    6061{
    61   this->init();
     62  this->init( OM_GROUP_01 );
    6263
    6364  if (root != NULL)
     
    7677
    7778
    78 void FPSSniperRifle::init()
     79void FPSSniperRifle::init(OM_LIST list)
    7980{
    8081  this->registerObject(this, FPSSniperRifle::_objectList);
     
    9596  //this->minCharge = 2;
    9697
    97   this->setActionSound(WA_SHOOT, "sounds/laser.wav");
    98   this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
     98  //this->setActionSound(WA_SHOOT, "sounds/laser.wav");
     99  //this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");
    99100
    100101
    101102  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    102   this->setProjectileTypeC("Laser");
    103   this->prepareProjectiles(20);
    104 
     103  //this->setProjectileTypeC("Laser");
     104  //this->prepareProjectiles(20);
     105  this->toList( list );
     106  this->weapon = new BspWeapon( this->getOMListNumber() );
     107  this->weapon->setAlwaysHits( true );
     108  this->weapon->setDamage( 35 );
     109  this->weapon->setParent( this );
     110  this->weapon->toList( list );
     111   
     112  this->bFire = false;
    105113}
    106114
     
    145153void FPSSniperRifle::fire()
    146154{
    147   Projectile* pj =  this->getProjectile();
    148   if (pj == NULL)
    149     return;
    150 
    151 //   Explosion::explode(this, Vector(0.1,0.1,0.1));
    152 
    153   pj->setParent(this);
    154   pj->setParentMode(PNODE_ROTATE_AND_MOVE);
    155 
    156   pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*550 + VECTOR_RAND(5) );
    157 
    158   pj->setAbsCoor(this->getEmissionPoint() + this->getAbsDirX() * 25.0f);
    159   pj->setAbsDir(this->getAbsDir());
    160   pj->activate();
     155  PRINTF(0)("sniper fire\n");
     156  this->bFire = true;
    161157}
    162158
     
    190186}
    191187
    192 
    193 
     188void FPSSniperRifle::tick( float dt )
     189{
     190  Weapon::tick( dt );
     191  this->weapon->fire( bFire );
     192 
     193  if ( bFire ){
     194      PRINTF(0)("REAL FIRE\n");
     195  }
     196  bFire = false;
     197}
     198
     199
     200
Note: See TracChangeset for help on using the changeset viewer.