Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2007, 11:37:52 AM (17 years ago)
Author:
nicolasc
Message:

Comestic cleanup in projectiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/src/world_entities/weapons/acid_launcher.cc

    r10579 r10600  
    3737using namespace std;
    3838
    39 ObjectListDefinition(AcidLauncher);
    40 CREATE_FACTORY(AcidLauncher);
     39ObjectListDefinition ( AcidLauncher );
     40CREATE_FACTORY ( AcidLauncher );
    4141
    4242/**
     
    4646 */
    4747AcidLauncher::AcidLauncher()
    48   : Weapon()
     48    : Weapon()
    4949{
    5050  this->init();
     
    5454 * creates a new AcidLauncher from a TiXmlElement
    5555 */
    56 AcidLauncher::AcidLauncher(const TiXmlElement* root)
     56AcidLauncher::AcidLauncher ( const TiXmlElement* root )
    5757{
    5858  this->init();
    59   if (root != NULL)
    60     this->loadParams(root);
     59  if ( root != NULL )
     60    this->loadParams ( root );
    6161}
    6262
     
    7171void AcidLauncher::init()
    7272{
    73   this->registerObject(this, AcidLauncher::_objectList);
    74 /*
    75   Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
    76   Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this);
     73  this->registerObject ( this, AcidLauncher::_objectList );
     74  /*
     75    Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
     76    Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this);
    7777
    78   animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    79   animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    80   animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    81   animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     78    animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     79    animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     80    animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
     81    animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
    8282
    83   animation1->setInfinity(ANIM_INF_CONSTANT);
    84   animation2->setInfinity(ANIM_INF_CONSTANT);
    85 */
    86   this->setStateDuration(WS_SHOOTING, 1.0f);
     83    animation1->setInfinity(ANIM_INF_CONSTANT);
     84    animation2->setInfinity(ANIM_INF_CONSTANT);
     85  */
     86  this->setStateDuration ( WS_SHOOTING, 1.0f );
    8787
    88   this->setStateDuration(WS_RELOADING, 1.0f);
    89   this->setStateDuration(WS_ACTIVATING, .4);
    90   this->setStateDuration(WS_DEACTIVATING, .4);
     88  this->setStateDuration ( WS_RELOADING, 1.0f );
     89  this->setStateDuration ( WS_ACTIVATING, .4 );
     90  this->setStateDuration ( WS_DEACTIVATING, .4 );
    9191
    92   this->setEnergyMax(100);
    93   this->increaseEnergy(100);
     92  this->setEnergyMax ( 100 );
     93  this->increaseEnergy ( 100 );
    9494  //this->minCharge = 2;
    9595
    96   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    97   this->setProjectileTypeC("AcidSplash");
     96  this->setCapability ( WTYPE_ALLDIRS | WTYPE_TURRET | WTYPE_DIRECTIONAL | WTYPE_LIGHT );
     97  this->setProjectileTypeC ( "AcidSplash" );
    9898//   this->loadModel("models/guns/turret1.obj", 1.0);
    9999
    100   this->setEmissionPoint(2.0, 0, 0);
    101   this->getProjectileFactory()->prepare(10);
     100  this->setEmissionPoint ( 2.0, 0, 0 );
     101  this->getProjectileFactory()->prepare ( 10 );
    102102
    103   this->setActionSound(WA_SHOOT, "sounds/explosions/explosion_1.wav");
    104   this->setActionSound(WA_ACTIVATE, "sounds/voices/rockets.wav");
     103  this->setActionSound ( WA_SHOOT, "sounds/explosions/explosion_1.wav" );
     104  this->setActionSound ( WA_ACTIVATE, "sounds/voices/rockets.wav" );
    105105//   this->setActionSound(WA_RELOAD, "sounds/voices/reload.wav");
    106106
    107107}
    108108
    109 void AcidLauncher::loadParams(const TiXmlElement* root)
     109void AcidLauncher::loadParams ( const TiXmlElement* root )
    110110{
    111   Weapon::loadParams(root);
     111  Weapon::loadParams ( root );
    112112}
    113113
    114114void AcidLauncher::activate()
    115 {
    116 }
     115{}
    117116
    118117void AcidLauncher::deactivate()
     118{}
     119
     120void AcidLauncher::tick ( float dt )
    119121{
    120 }
    121 
    122 void AcidLauncher::tick(float dt)
    123 {
    124   if (!Weapon::tickW(dt))
     122  if ( !Weapon::tickW ( dt ) )
    125123    return;
    126   if (this->energyWidget != NULL && !this->isEnergyWidgetInitialized)
    127   {
    128     this->energyWidget->setDisplayedImage("textures/gui/gui_acid.png");
     124  if ( this->energyWidget != NULL && !this->isEnergyWidgetInitialized ) {
     125    this->energyWidget->setDisplayedImage ( "textures/gui/gui_acid.png" );
    129126    this->isEnergyWidgetInitialized = true;
    130127  }
     
    155152
    156153  Projectile* pj = NULL;
    157   for( int i=0; i < 1; i++)
    158   {
    159       pj  = this->getProjectile();
    160       if (pj == NULL)
    161         return;
     154  for ( int i=0; i < 1; i++ ) {
     155    pj  = this->getProjectile();
     156    if ( pj == NULL )
     157      return;
    162158
    163       fired = true;
    164       pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(10)));
     159    fired = true;
     160    pj->setVelocity ( this->getVelocity() + ( this->getAbsDir().apply ( Vector ( 1,0,0 ) ) *165.0 + VECTOR_RAND ( 10 ) ) );
    165161
    166       pj->setParent(PNode::getNullParent());
    167       pj->setAbsCoor(this->getEmissionPoint() + VECTOR_RAND(.1));
    168       pj->setAbsDir(this->getAbsDir()+Quaternion(0,VECTOR_RAND(5)));
    169       pj->activate();
     162    pj->setParent ( PNode::getNullParent() );
     163    pj->setAbsCoor ( this->getEmissionPoint() + VECTOR_RAND ( .1 ) );
     164    pj->setAbsDir ( this->getAbsDir() +Quaternion ( 0,VECTOR_RAND ( 5 ) ) );
     165    pj->activate();
    170166  }
    171167}
Note: See TracChangeset for help on using the changeset viewer.