Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 27, 2007, 7:01:08 PM (17 years ago)
Author:
nicolasc
Message:

huge diff
cleaned the individual weapons, moved stuff to weapon.{cc,h}
and some minor fixes which popped up then and when

File:
1 edited

Legend:

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

    r10698 r10771  
    5454MediumBlaster::~MediumBlaster()
    5555{
    56       // model will be deleted from WorldEntity-destructor
    57   for (int i = 0; i < this->getBarrels(); i++)
    58   {
    59    delete [] this->shootAnim[i];
    60   }
    61   delete [] this->shootAnim;
    6256}
    6357
     
    7670
    7771  this->setStateDuration(WS_RELOADING, 0);
    78   this->setStateDuration(WS_ACTIVATING, .5); //.5);
    79   this->setStateDuration(WS_DEACTIVATING, 1); // 1);
     72  this->setStateDuration(WS_ACTIVATING, .5);
     73  this->setStateDuration(WS_DEACTIVATING, 1);
    8074
    8175  this->setEnergyMax(500);
     
    9488  this->setBarrels(1);
    9589  this->setSegs(2);
    96   this->activeBarrel = 0;
    9790
    98   this->objComp = new PNode**[this->getBarrels()];
    99   this->emissionPoint = new PNode*[this->getBarrels()];
    100   this->shootAnim = new Animation3D**[this->getBarrels()];
    101   for (int i = 0; i < this->getBarrels(); i++)
    102   {
    103     this->objComp[i] = new PNode* [this->getSegs()];
    104     this->emissionPoint[i] = new PNode;
    105     this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapon
    106     this->emissionPoint[i]->setName("EmissionPoint");
    107     this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    108     this->shootAnim[i] = new Animation3D* [this->getSegs()];
    109     for(int j = 0; j < this->getSegs(); j++)
    110     {
    111       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);
    114     }
    115   }
    11691
    11792  for (int i = 0; i < this->getBarrels(); i++){
    118     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    119     this->shootAnim[i][0]->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    120     this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     93    this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     94    this->getShootAnim(i, 0)->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     95    this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    12196
    122     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
    123     this->shootAnim[i][1]->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
    124     this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     97    this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     98    this->getShootAnim(i, 1)->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     99    this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
    125100  }
    126101
     
    131106  animation3->setInfinity(ANIM_INF_CONSTANT);
    132107
    133   this->emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling());
     108  this->setEmissionPoint(Vector(3.9, 0.0, 0.0) * this->getScaling());
    134109
    135110  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     
    159134
    160135  for (int i = 0; i < this->getSegs(); i++)
    161     this->shootAnim[this->activeBarrel][i]->replay();
     136    this->getShootAnim(this->getActiveBarrel(), i)->replay(); // FIXME needs clean up
    162137}
    163138
     
    187162
    188163  glPushMatrix();
    189     glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);
     164    glTranslatef (this->getObjCompx(0,0), this->getObjCompy(0,0), this->getObjCompz(0,0));
    190165    static_cast<StaticModel*>(this->getModel())->draw(1);
    191166  glPopMatrix();
    192167
    193168  glPushMatrix();
    194     glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);
     169    glTranslatef (this->getObjCompx(0,1), this->getObjCompy(0,1), this->getObjCompz(0,1));
    195170    static_cast<StaticModel*>(this->getModel())->draw(2);
    196171  glPopMatrix();
Note: See TracChangeset for help on using the changeset viewer.