Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2007, 9:23:49 PM (18 years ago)
Author:
nicolasc
Message:

code cleanup, rebuilt spikeball

File:
1 edited

Legend:

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

    r10132 r10286  
    3737{
    3838      // model will be deleted from WorldEntity-destructor
     39  for (int i = 0; i < this->getBarrels(); i++)
     40  {
     41   delete [] this->shootAnim[i];
     42//    delete [] this->objComp[i];
     43  }
     44  delete [] this->shootAnim;
     45//   delete [] this->objComp;
    3946}
    4047
     
    5057//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    5158
    52   this->loadModel("models/guns/plasmadriver_#.obj", 1.0);
     59  this->loadModel("models/guns/blaster.obj", .33);
    5360 
    5461
     
    7178  this->prepareProjectiles(100);
    7279
     80
     81  this->setBarrels(1);
     82  this->setSegs(2);
     83  this->activeBarrel = 0;
     84
     85  this->objComp = new PNode**[this->getBarrels()];
     86//   this->emissionPoint = new PNode*[this->getBarrels()];
     87  this->shootAnim = new Animation3D**[this->getBarrels()];
     88  for (int i = 0; i < this->getBarrels(); i++)
     89  {
     90    this->objComp[i] = new PNode* [this->getSegs()];
     91//     this->emissionPoint[i] = new PNode;
     92//     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
     93//     this->emissionPoint[i]->setName("EmissionPoint");
     94//     this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     95    this->shootAnim[i] = new Animation3D* [this->getSegs()];
     96    for(int j = 0; j < this->getSegs(); j++)
     97    {
     98      this->objComp[i][j] = new PNode;
     99      this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]);
     100      this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT);
     101    }
     102  }
     103
     104  for (int i = 0; i < this->getBarrels(); i++){
     105    this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     106    this->shootAnim[i][0]->addKeyFrame(Vector(-0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     107    this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     108
     109    this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);
     110    this->shootAnim[i][1]->addKeyFrame(Vector(.166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);
     111    this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);
     112  }
     113
    73114  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
    74115  Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this);
     
    77118  animation3->setInfinity(ANIM_INF_CONSTANT);
    78119
    79   this->setEmissionPoint(3.8, 1.2, 0);
     120
     121  this->setEmissionPoint(1.3, 0, 0);
    80122
    81123  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     
    103145  pj->setAbsDir(this->getAbsDir());
    104146  pj->activate();
     147
     148  for (int i = 0; i < this->getSegs(); i++)
     149    this->shootAnim[this->activeBarrel][i]->replay();
    105150}
    106151
     
    121166void MediumBlaster::draw() const
    122167{
     168  glMatrixMode(GL_MODELVIEW);
     169  glPushMatrix();
     170  glTranslatef (this->getAbsCoor ().x,
     171                this->getAbsCoor ().y,
     172                this->getAbsCoor ().z);
     173
     174  static_cast<StaticModel*>(this->getModel())->draw(2);
     175
     176  glPushMatrix();
     177    glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);
     178    static_cast<StaticModel*>(this->getModel())->draw(1);
     179  glPopMatrix();
     180
     181  glPushMatrix();
     182  glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);
     183  static_cast<StaticModel*>(this->getModel())->draw(0);
     184  glPopMatrix();
     185
     186  glPopMatrix();
     187
     188  glPopMatrix();
    123189}
Note: See TracChangeset for help on using the changeset viewer.