Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10140 in orxonox.OLD for branches/playability/src


Ignore:
Timestamp:
Dec 22, 2006, 9:36:55 AM (18 years ago)
Author:
nicolasc
Message:

defined emissionPoint as array, update get/set function, kept old as fallback

Location:
branches/playability/src/world_entities/weapons
Files:
3 edited

Legend:

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

    r10136 r10140  
    122122  animation3->setInfinity(ANIM_INF_CONSTANT);
    123123
    124   this->setEmissionPoint(3.8, 1.2, 0);
     124  this->setEmissionPoint(3.8, 1.2, 0, 0);
    125125
    126126  animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL);
     
    147147  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1));
    148148
    149   pj->setAbsCoor(this->getEmissionPoint());
     149  pj->setAbsCoor(this->getEmissionPoint(0));
    150150  pj->setAbsDir(this->getAbsDir());
    151151  pj->toList(OM_GROUP_01_PROJ);
  • branches/playability/src/world_entities/weapons/weapon.cc

    r10136 r10140  
    119119  }
    120120
    121   this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource.
    122   this->emissionPoint.setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
    123   this->emissionPoint.setName("EmissionPoint");
    124   this->emissionPoint.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     121  this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource
     122
     123  this->barrels = 1;
     124  this->segs = 1;
     125
     126  this->emissionPoint = new PNode*[this->barrels];
     127  for(int i = 0; i < this->barrels; i++){
     128    this->emissionPoint[i] = new PNode;
     129    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
     130    this->emissionPoint[i]->setName("EmissionPoint");
     131    this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
     132  }
    125133
    126134  this->defaultTarget = NULL;                      //< Nothing is Targeted by default.
     
    154162  LoadParam(root, "projectile", this, Weapon, setProjectileTypeC)
    155163  .describe("Sets the name of the Projectile to load onto the Entity");
    156 
     164/*
    157165  LoadParam(root, "emission-point", this, Weapon, setEmissionPoint)
    158   .describe("Sets the Point of emission of this weapon");
     166  .describe("Sets the Point of emission of this weapon (1: EmmsionVector; 2: EmissionPoint)");*/
    159167
    160168  LoadParam(root, "state-duration", this, Weapon, setStateDuration)
     
    253261 * @param point the Point relative to the mass-point of the Weapon
    254262 */
     263void Weapon::setEmissionPoint(const Vector& point, int barrel)
     264{
     265  this->emissionPoint[barrel]->setRelCoor(point);
     266}
     267
    255268void Weapon::setEmissionPoint(const Vector& point)
    256269{
    257   this->emissionPoint.setRelCoor(point);
    258 }
    259 
     270  this->emissionPoint[0]->setRelCoor(point);
     271}
    260272
    261273/**
  • branches/playability/src/world_entities/weapons/weapon.h

    r10136 r10140  
    140140
    141141    // EMISSION
     142    /** keeping old functions*/
     143    void setEmissionPoint(const Vector& point, int barrel);
    142144    void setEmissionPoint(const Vector& point);
    143145    /** @see void setEmissionPoint(const Vector& point); */
     146    inline void setEmissionPoint(float x, float y, float z, int barrel) { this->setEmissionPoint(Vector(x, y, z), barrel); };
    144147    inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x, y, z)); };
    145148    /** @returns the absolute Position of the EmissionPoint */
    146     inline const Vector& getEmissionPoint() const { return this->emissionPoint.getAbsCoor(); };
     149    inline const Vector& getEmissionPoint(int barrel) const { return this->emissionPoint[barrel]->getAbsCoor(); };
     150    inline const Vector& getEmissionPoint() const { return this->emissionPoint[0]->getAbsCoor(); };
     151
    147152
    148153    inline void setDefaultTarget(PNode* defaultTarget) { this->defaultTarget = defaultTarget; };
     
    253258    OrxSound::SoundBuffer  soundBuffers[WA_ACTION_COUNT];   //!< SoundBuffers for all actions @see WeaponAction.
    254259
    255     PNode                  emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
     260    PNode**                emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
    256261
    257262    bool                   hideInactive;                    //!< Hides the Weapon if it is inactive
Note: See TracChangeset for help on using the changeset viewer.