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.h

    r10707 r10771  
    2020
    2121#include "sound_buffer.h"
     22
     23#define MAX_SEGMENTS 3
     24#define MAX_BARRELS 4
     25
     26#define    W_LEFT        0
     27#define    W_RIGHT       1
    2228
    2329// FORWARD DECLARATION
     
    129135    // EMISSION
    130136    /** keeping old functions*/
    131     void setEmissionPoint(const Vector& point, int barrel);
    132     void setEmissionPoint(const Vector& point);
     137    void setEmissionPoint(const Vector& point, int barrel = 0);
     138//     void setEmissionPoint(const Vector& point);
    133139    /** @see void setEmissionPoint(const Vector& point); */
    134     inline void setEmissionPoint(float x, float y, float z, int barrel) { this->setEmissionPoint(Vector(x, y, z), barrel); };
    135     inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x, y, z)); };
     140    inline void setEmissionPoint(float x, float y, float z, int barrel = 0) { this->setEmissionPoint(Vector(x, y, z), barrel); };
     141//     inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x, y, z)); };
    136142    /** @returns the absolute Position of the EmissionPoint */
    137143    inline const Vector& getEmissionPoint(int barrel) const { return this->emissionPoint[barrel]->getAbsCoor(); };
    138     inline const Vector& getEmissionPoint() const { return this->emissionPoint[0]->getAbsCoor(); };
     144    inline const Vector& getEmissionPoint() const { return this->emissionPoint[this->activeBarrel]->getAbsCoor(); };
    139145
    140146
     
    182188    inline void setBarrels(int barrels) { this->barrels = barrels; };
    183189    inline void setSegs(int segs) { this->segs = segs; };
    184 
    185 //     inline Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; };
    186 //     inline void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); };
     190    inline void setActiveBarrel(int ab) {this->activeBarrel = ab; };
     191    inline int getActiveBarrel() { return this->activeBarrel; };
     192    inline void cycleBarrel() { this->activeBarrel = (this->activeBarrel + 1) % this->barrels; };
     193
     194    Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; };
     195//     void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); };
    187196
    188197//     void init2();
    189     void deconstr();
     198//     void deconstr();
    190199
    191200    inline int getPreferedSide() { return this->preferedSide; }
     
    194203    inline void setEnergyWidgetInitialized(bool b) {this->isEnergyWidgetInitialized = b;};
    195204
     205    inline const Vector& getObjComp(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor(); };
     206    inline const float getObjCompx(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().x; };
     207    inline const float getObjCompy(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().y; };
     208    inline const float getObjCompz(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().z; };
    196209
    197210  protected:
     
    264277    OrxSound::SoundBuffer  soundBuffers[WA_ACTION_COUNT];   //!< SoundBuffers for all actions @see WeaponAction.
    265278
    266     PNode**                emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
     279    PNode*                 emissionPoint[MAX_BARRELS];                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
    267280
    268281    bool                   hideInactive;                    //!< Hides the Weapon if it is inactive
     
    272285    FastFactory*           projectileFactory;               //!< A factory, that produces and handles the projectiles.
    273286
    274     int                    barrels;                         //!< # of barrels
    275     int                    segs;                             //!< # of segments, one barrel has
    276     Animation3D***         shootAnim;
     287    int                    barrels;                         //!< # of barrels (max 4)
     288    int                    segs;                            //!< # of segments, one barrel has (max 3)
     289    int                    activeBarrel;
     290    Animation3D*           shootAnim[MAX_BARRELS][MAX_SEGMENTS];
     291    PNode*                 objComp[MAX_BARRELS][MAX_SEGMENTS];
    277292
    278293    int                    preferedSlot;                    //!< prefered slot to add
    279294    int                    preferedSide;                    //!< prefered side (left/right) to be added
     295    int                    side;                            //!< describes left/right orientation of the weapon.
    280296
    281297  };
Note: See TracChangeset for help on using the changeset viewer.