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/weapon.cc

    r10698 r10771  
    6262  if (OrxSound::SoundSource::objectList().exists(this->soundSource))
    6363    delete this->soundSource;
     64
     65//   for (int i = 0; i < MAX_BARRELS; i++)
     66//   {
     67//    delete [] this->shootAnim[i];
     68//    delete [] this->objComp[i];
     69//   }
     70//   delete [] this->emissionPoint;
     71//   delete [] this->shootAnim;
     72//   delete [] this->objComp;
     73
    6474}
    6575
     
    121131  this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource
    122132
    123   this->barrels = 1;
     133  this->barrels = 1;  // just to have an initial value
    124134  this->segs = 1;
     135  this->activeBarrel = 0;
    125136
    126137  this->preferedSide = -1;
    127138  this->preferedSlot = -1;
    128 
    129   this->shootAnim = new Animation3D**[this->getBarrels()];
    130   for (int i = 0; i < this->getBarrels(); i++)
    131     this->shootAnim[i] = new Animation3D* [this->getSegs()];
    132 
    133   this->emissionPoint = new PNode*[this->barrels];
    134   for(int i = 0; i < this->barrels; i++){
     139  this->side = -1;
     140
     141  //!< forward initialisation of animation and emissionpoints
     142  for (int i = 0; i < MAX_BARRELS; i++){
    135143    this->emissionPoint[i] = new PNode;
    136144    this->emissionPoint[i]->setParent(this);  //Parenting emissionPoint to Weapons
    137145    this->emissionPoint[i]->setName("EmissionPoint");
    138146    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     147    for(int j = 0; j < MAX_SEGMENTS; j++)
     148    {
     149      this->objComp[i][j] = new PNode;
     150      this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]);
     151      this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT);
     152    }
    139153  }
    140154
     
    149163  this->maxCharge = 1.0;                           //< The maximum charge is also one unit.
    150164
    151   this->energy = 10;                               //< The secondary Buffer (before we have to reload)
     165  this->energy = 10.0;                               //< The secondary Buffer (before we have to reload)
    152166  this->energyMax = 10.0;                          //< How much energy can be carried
    153167  this->capability = WTYPE_ALL;                    //< The Weapon has all capabilities @see W_Capability.
     
    176190  LoadParam(root, "slot", this, Weapon, setPreferedSlot)
    177191  .describe("slot this weapon will be added");
    178 /*
    179   LoadParam(root, "emission-point", this, Weapon, setEmissionPoint)
    180   .describe("Sets the Point of emission of this weapon (1: EmmsionVector; 2: EmissionPoint)");*/
    181192
    182193  LoadParam(root, "state-duration", this, Weapon, setStateDuration)
     
    274285 * sets the emissionPoint's relative position from the Weapon
    275286 * @param point the Point relative to the mass-point of the Weapon
     287 * @param barrel (optional) define a specific barrel, default = 0
    276288 */
    277289void Weapon::setEmissionPoint(const Vector& point, int barrel)
     
    280292}
    281293
    282 void Weapon::setEmissionPoint(const Vector& point)
    283 {
    284   this->emissionPoint[0]->setRelCoor(point);
    285 }
     294// void Weapon::setEmissionPoint(const Vector& point)
     295// {
     296//   this->emissionPoint[0]->setRelCoor(point);
     297// }
    286298
    287299/**
Note: See TracChangeset for help on using the changeset viewer.