Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

Comestic cleanup in projectiles

Location:
branches/cleanup/src/world_entities
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/cleanup/src/world_entities/elements/glgui_energywidgetvertical.cc

    r10516 r10600  
    6666    this->_image->setBackgroundTexture(Texture());
    6767    this->_image->setBackgroundColor(Color(1,1,1,0));
    68     this->_image->loadImageFromFile("textures/evil-flower.png");
     68//     this->_image->loadImageFromFile("textures/evil-flower.png");
    6969    //this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D());
    7070    this->_image->setRelCoor2D(0,0);
  • branches/cleanup/src/world_entities/projectiles/hbolt.cc

    r10545 r10600  
    4949
    5050  this->angle = 0;
    51   this->rotationSpeed = 600;
     51//   this->rotationSpeed = 600;
    5252
    5353  this->emitter = new DotEmitter(100, 5, M_2_PI);
     
    146146    this->deactivate();
    147147
    148   this->angle += this->rotationSpeed * dt;
     148  this->angle += HBolt::rotationSpeed * dt;
    149149
    150150  for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++)
     
    177177  glPushAttrib(GL_ENABLE_BIT);
    178178  glDisable(GL_LIGHTING);
    179   glDisable(GL_FOG);
     179//   glDisable(GL_FOG);
    180180
    181181  glMatrixMode(GL_MODELVIEW);
    182182  glPushMatrix();
    183183
    184 
    185   glTranslatef (this->getAbsCoor ().x,
    186                   this->getAbsCoor ().y,
    187                   this->getAbsCoor ().z);
    188 
    189   this->halo->draw();
    190 
    191   Vector tmpRot = this->getAbsDir().getSpacialAxis();
    192   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    193   glRotatef(this->angle, 0.0, 0.0, 1.0);
    194 
    195   this->getModel()->draw();
     184//     float matrix[4][4];
     185    glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     186    Vector tmpRot = this->getAbsDir().getSpacialAxis();
     187    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     188    glRotatef(this->angle, 0.0, 0.0, 1.0);
     189//     glMultMatrixf((float*)matrix);
     190    this->getModel()->draw();
     191    this->halo->draw();
    196192
    197193  glPopMatrix();
  • branches/cleanup/src/world_entities/projectiles/hbolt.h

    r10368 r10600  
    4242
    4343    float                             angle;
    44     float                             rotationSpeed;
     44    static const float                rotationSpeed = 600;
    4545
    4646    Billboard*                        halo;
  • branches/cleanup/src/world_entities/projectiles/lbolt.cc

    r10545 r10600  
    5959
    6060  this->angle = 0;
    61   this->rotationSpeed = 130;
    6261
    6362  this->halo = new Billboard();
     
    148147    this->deactivate();
    149148
    150   angle += rotationSpeed * dt;
     149  angle += LBolt::rotationSpeed * dt;
    151150
    152151  for( ObjectList<NPC>::const_iterator eIterator = NPC::objectList().begin(); eIterator !=NPC::objectList().end(); eIterator++)
     
    182181  glPushMatrix();
    183182
    184   float matrix[4][4];
    185   glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     183    float matrix[4][4];
     184    glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
     185    Vector tmpRot = this->getAbsDir().getSpacialAxis();
     186    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     187    glRotatef(this->angle, 1.0, 0.0, 0.0);
     188    this->getAbsDir().matrix (matrix);
     189    glMultMatrixf((float*)matrix);
     190    this->getModel()->draw();
    186191
    187   glRotatef(angle, 1.0, 0.0, 0.0);
    188   this->getAbsDir().matrix (matrix);
    189   glMultMatrixf((float*)matrix);
    190   this->getModel()->draw();
    191 
    192   this->halo->draw();
     192    this->halo->draw();
    193193
    194194  glPopMatrix();
    195 
    196195  glPopAttrib();
    197196}
  • branches/cleanup/src/world_entities/projectiles/lbolt.h

    r10368 r10600  
    4343
    4444    float                             angle;
    45     float                             rotationSpeed;
     45    static const float                rotationSpeed = 1080;
    4646
    4747    Billboard*                        halo;
  • 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.