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/bsp_weapon.cc

    r10698 r10704  
    3131*  Standard constructor
    3232*/
    33 BspWeapon::BspWeapon ()
    34 {
    35         this->init();
     33BspWeapon::BspWeapon ( OM_LIST list )
     34{
     35        this->init( list );
    3636}
    3737
     
    4949BspWeapon::BspWeapon (const  TiXmlElement* root)
    5050{
    51         this->init();
     51        this->init( OM_GROUP_00 );
    5252        if (root != NULL)
    5353        {
     
    9494void BspWeapon::tick( float dt )
    9595{
     96  PRINTF(0)("BSPWEAPON TICK: %d %f %f\n", bFire, bRate, dt );
    9697        if (bFire) {
    97                 if (bRate < 0) {
     98                if (bRate <= 0) {
    9899                        bRate += fireRate;
     100                        PRINTF(0)("BSPWEAPON SHOOT\n");
    99101                        this->shoot();
    100102                }
     
    111113}
    112114
    113 void BspWeapon::init()
    114 {
    115         bRate = 0;
     115void BspWeapon::init( OM_LIST list )
     116{
     117        bRate = 0.0;
    116118        bFire = false;
    117119        range = 1000;
     
    123125        this->aimingSystem = new AimingSystem( this );
    124126        this->aimingSystem->setParent( this );
    125         this->aimingSystem->toList(OM_GROUP_00);
     127        this->aimingSystem->toList(list);
    126128       
    127129}
     
    157159
    158160        bool hit = false;
     161       
     162        PRINTF(0)("groups: %d %d %d %d\n", this->getOMListNumber(), this->aimingSystem->getOMListNumber(), OM_GROUP_01, OM_GROUP_00);
    159163
    160164        if ( target == NULL )
     
    170174                                hit = true;
    171175                                printf( "HIT %s\n", target->getClassName().c_str() );
     176                                target->hit( this->damage, this );
    172177                        }
    173178                        else
     
    178183        }
    179184
    180         if ( !hit )
    181         {
    182                 //Vector explosionPos = this->getAbsCoor() + this->getAbsDir().apply( Vector( 1, 0, 0 ) )*shortestDist;
    183 
    184                 //TODO create explosion at explosionPos
    185         }
     185       
    186186       
    187187       
     
    196196    (*it)->draw();
    197197  }
    198 #if 0
     198#if 1
    199199  glMatrixMode(GL_MODELVIEW);
    200200  glPushMatrix();
Note: See TracChangeset for help on using the changeset viewer.