Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10600 in orxonox.OLD for branches/cleanup/src/world_entities/weapons


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

Comestic cleanup in projectiles

Location:
branches/cleanup/src/world_entities/weapons
Files:
3 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}
  • branches/cleanup/src/world_entities/weapons/acid_launcher.h

    r10368 r10600  
    1212
    1313class AcidLauncher : public Weapon
    14   {
    15   ObjectListDeclaration(AcidLauncher);
     14{
     15    ObjectListDeclaration ( AcidLauncher );
    1616  public:
    1717    AcidLauncher ();
    18     AcidLauncher(const TiXmlElement* root);
     18    AcidLauncher ( const TiXmlElement* root );
    1919    virtual ~AcidLauncher ();
    2020
    2121    void init();
    22     virtual void loadParams(const TiXmlElement* root);
     22    virtual void loadParams ( const TiXmlElement* root );
    2323
    2424    virtual void activate();
    2525    virtual void deactivate();
    2626
    27     virtual void tick(float dt);
     27    virtual void tick ( float dt );
    2828    virtual void fire();
    2929
    3030
    3131  private:
    32   };
     32};
    3333
    3434#endif /* _ACID_LAUNCHER_H */
  • branches/cleanup/src/world_entities/weapons/light_blaster.cc

    r10579 r10600  
    9898  this->objComp = new PNode**[this->getBarrels()];
    9999  this->emissionPoint = new PNode*[this->getBarrels()];
    100   this->shootAnim = new Animation3D**[this->getBarrels()];
     100//   this->shootAnim = new Animation3D**[this->getBarrels()];
    101101  for (int i = 0; i < this->getBarrels(); i++)
    102102  {
    103103    this->objComp[i] = new PNode* [this->getSegs()];
    104104    this->emissionPoint[i] = new PNode;
    105     this->emissionPoint[i]->setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
     105    this->emissionPoint[i]->setParent(this);
    106106    this->emissionPoint[i]->setName("EmissionPoint");
    107107    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    108     this->shootAnim[i] = new Animation3D* [this->getSegs()];
     108//     this->shootAnim[i] = new Animation3D* [this->getSegs()];
    109109    for(int j = 0; j < this->getSegs(); j++)
    110110    {
    111111      this->objComp[i][j] = new PNode;
    112       this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]);
    113       this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT);
     112//       this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]);
     113//       this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT);
    114114    }
    115115  }
    116 
    117   for (int i = 0; i < this->getBarrels(); i++ )
    118     this->emissionPoint[i]->setRelCoor(Vector(1.19, 0.0, 0.1));
     116/*
     117  this->emissionPoint[0]->setRelCoor(Vector(1.19, 0.0, 0.1));
     118  this->emissionPoint[1]->setRelCoor(Vector(1.19, -0.07, -0.05));
     119  this->emissionPoint[2]->setRelCoor(Vector(1.19, 0.07, -0.05));*/
     120
     121  this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1));
     122  this->emissionPoint[1]->setRelCoor(Vector(2.2, -0.07, -0.05));
     123  this->emissionPoint[2]->setRelCoor(Vector(2.2, 0.07, -0.05));
    119124
    120125//   Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this);
     
    128133//   this->setEmissionPoint(3.8, 1.2, 0);
    129134
    130   for (int i = 0; i < this->getBarrels(); i++){
    131     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion(i * 120, Vector(1.0, 0.0, 0.0)), 0.049, ANIM_NULL, ANIM_LINEAR);
    132     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion((i+1)*120, Vector(1.0, 0.0, 0.0)), 0.001, ANIM_NULL, ANIM_LINEAR);
    133   }
     135//   for (int i = 0; i < this->getBarrels(); i++){
     136//     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion(i * 120, Vector(1.0, 0.0, 0.0)), 0.049, ANIM_NULL, ANIM_LINEAR);
     137//     this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion((i+1)*120, Vector(1.0, 0.0, 0.0)), 0.001, ANIM_NULL, ANIM_LINEAR);
     138//   }
    134139
    135140
     
    160165  pj->activate();
    161166
    162   for (int i = 0; i < this->getSegs(); i++)
    163     this->shootAnim[this->activeBarrel][i]->replay();
     167//   for (int i = 0; i < this->getSegs(); i++)
     168//     this->shootAnim[this->activeBarrel][i]->replay();
    164169
    165170  // switch barrel
Note: See TracChangeset for help on using the changeset viewer.