Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2009, 4:19:14 AM (16 years ago)
Author:
landauf
Message:

merged weapons branch back to trunk

Location:
code/trunk
Files:
13 edited
50 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/CMakeLists.txt

    r2826 r3053  
    2222ADD_SUBDIRECTORY(pickup)
    2323ADD_SUBDIRECTORY(quest)
    24 ADD_SUBDIRECTORY(weaponSystem)
     24ADD_SUBDIRECTORY(weaponsystem)
    2525ADD_SUBDIRECTORY(worldentities)
    2626
  • code/trunk/src/orxonox/objects/controllers/AIController.cc

    r3049 r3053  
    111111
    112112        if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
    113             this->getControllableEntity()->fire(WeaponMode::fire);
     113            this->getControllableEntity()->fire(0);
    114114
    115115        SUPER(AIController, tick, dt);
  • code/trunk/src/orxonox/objects/controllers/HumanController.cc

    r3038 r3053  
    4646    SetConsoleCommand(HumanController, rotateRoll,    true).setAsInputCommand();
    4747    SetConsoleCommand(HumanController, fire,          true).keybindMode(KeybindMode::OnHold);
    48     SetConsoleCommand(HumanController, altFire,       true).keybindMode(KeybindMode::OnHold);
     48    SetConsoleCommand(HumanController, reload,        true);
    4949    SetConsoleCommand(HumanController, boost,         true).keybindMode(KeybindMode::OnHold);
    5050    SetConsoleCommand(HumanController, greet,         true);
     
    109109    }
    110110
    111     void HumanController::fire()
     111    void HumanController::fire(unsigned int firemode)
    112112    {
    113113        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    114             HumanController::localController_s->controllableEntity_->fire(WeaponMode::fire);
     114            HumanController::localController_s->controllableEntity_->fire(firemode);
    115115    }
    116116
    117     void HumanController::altFire()
     117    void HumanController::reload()
    118118    {
    119119        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    120             HumanController::localController_s->controllableEntity_->fire(WeaponMode::altFire);
     120            HumanController::localController_s->controllableEntity_->reload();
    121121    }
    122122
  • code/trunk/src/orxonox/objects/controllers/HumanController.h

    r2662 r3053  
    5151            static void rotateRoll(const Vector2& value);
    5252
    53             static void fire();
    54             static void altFire();
     53            static void fire(unsigned int firemode);
     54            static void reload();
    5555
    5656            static void boost();
  • code/trunk/src/orxonox/objects/controllers/WaypointPatrolController.cc

    r3049 r3053  
    6868
    6969            if (this->getControllableEntity() && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
    70                 this->getControllableEntity()->fire(WeaponMode::fire);
     70                this->getControllableEntity()->fire(0);
    7171        }
    7272        else
  • code/trunk/src/orxonox/objects/weaponsystem/Munition.cc

    r3052 r3053  
    404404            return (this->magazines_ >= amount);
    405405        }
     406
     407        return false;
    406408    }
    407409
  • code/trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.cc

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/MuzzleFlash.h

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/WeaponSystem.cc

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/WeaponSystem.h

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.h

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.cc

    • Property svn:eol-style set to native
    r3052 r3053  
    5252        this->speed_ = 2500;
    5353        this->delay_ = 0;
    54         this->setMunitionName("EnergyDrink");
     54        this->setMunitionName("FusionMunition");
    5555
    5656        this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&EnergyDrink::shot)));
     
    104104    {
    105105        Projectile* projectile = new Projectile(this);
    106         Model* model = new Model(projectile);
    107         model->setMeshSource("can.mesh");
    108         model->setCastShadows(false);
    109         projectile->attach(model);
    110         model->setScale(5);
     106        Model* model = new Model(projectile);
     107        model->setMeshSource("can.mesh");
     108        model->setCastShadows(false);
     109        projectile->attach(model);
     110        model->setScale(5);
    111111
    112112        projectile->setOrientation(this->getMuzzleOrientation());
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/EnergyDrink.h

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.cc

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/FusionFire.h

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.cc

    • Property svn:eol-style set to native
    r3052 r3053  
    5252        this->speed_ = 2500;
    5353        this->delay_ = 0;
    54         this->setMunitionName("HsW01");
     54        this->setMunitionName("LaserMunition");
    5555
    5656        this->delayTimer_.setTimer(1.0f, false, this, createExecutor(createFunctor(&HsW01::shot)));
     
    104104    {
    105105        Projectile* projectile = new Projectile(this);
    106         Model* model = new Model(projectile);
    107         model->setMeshSource("laserbeam.mesh");
    108         model->setCastShadows(false);
    109         projectile->attach(model);
    110         model->setScale(5);
     106        Model* model = new Model(projectile);
     107        model->setMeshSource("laserbeam.mesh");
     108        model->setCastShadows(false);
     109        projectile->attach(model);
     110        model->setScale(5);
    111111
    112112        projectile->setOrientation(this->getMuzzleOrientation());
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/HsW01.h

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.cc

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LaserFire.h

    • Property svn:mergeinfo deleted
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.cc

    • Property svn:eol-style set to native
    r3052 r3053  
    5353        this->damage_ = 100;
    5454        this->speed_ = 150;
    55        
     55
    5656        this->setMunitionName("LaserMunition");
    5757    }
    58    
     58
    5959    LightningGun::~LightningGun()
    6060    {
     
    6565        LightningGunProjectile* projectile = new LightningGunProjectile(this);
    6666        projectile->setMaterial("Flares/LightningBall_");
    67        
     67
    6868        projectile->setOrientation(this->getMuzzleOrientation());
    6969        projectile->setPosition(this->getMuzzlePosition());
  • code/trunk/src/orxonox/objects/weaponsystem/weaponmodes/LightningGun.h

    • Property svn:eol-style set to native
  • code/trunk/src/orxonox/objects/worldentities/Billboard.cc

    r2896 r3053  
    4747        this->material_ = "";
    4848        this->colour_ = ColourValue::White;
     49//        this->rotation_ = 0;
    4950
    5051        this->registerVariables();
     
    6667        XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
    6768        XMLPortParam(Billboard, "colour",   setColour,   getColour,   xmlelement, mode).defaultValues(ColourValue::White);
     69//        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
    6870    }
    6971
     
    7274        registerVariable(this->material_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
    7375        registerVariable(this->colour_,   variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
     76//        registerVariable(this->rotation_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
    7477    }
    7578
     
    8790                     this->attachOgreObject(this->billboard_.getBillboardSet());
    8891                this->billboard_.setVisible(this->isVisible());
     92//                this->changedRotation();
    8993            }
    9094        }
     
    110114            this->billboard_.setColour(this->colour_);
    111115    }
     116   
     117/*
     118    void Billboard::changedRotation()
     119    {
     120        if (this->billboard_.getBillboardSet())
     121            this->billboard_.getBillboardSet()->setRotation(this->rotation_);
     122    }
     123*/
    112124
    113125    void Billboard::changedVisibility()
  • code/trunk/src/orxonox/objects/worldentities/Billboard.h

    r2826 r3053  
    6161            inline const ColourValue& getColour() const
    6262                { return this->colour_; }
    63 
     63/*
     64            inline void setRotation(const Radian& rotation)
     65                { this->rotation_ = rotation; this->changedRotation(); }
     66            inline const Radian& getRotation() const
     67                { return this->rotation_; }
     68*/
    6469            virtual void setTeamColour(const ColourValue& colour)
    6570                { this->setColour(colour); }
     
    7378        private:
    7479            void changedMaterial();
     80//            void changedRotation();
    7581
    7682            BillboardSet billboard_;
    7783            std::string material_;
    7884            ColourValue colour_;
     85//            Radian rotation_;
    7986    };
    8087}
  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h

    r3049 r3053  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 
    3433#include "MobileEntity.h"
    35 #include "objects/weaponSystem/WeaponSystem.h"
    3634
    3735namespace orxonox
     
    8280                { this->rotateRoll(Vector2(value, 0)); }
    8381
    84             virtual void fire(WeaponMode::Enum fireMode) {}
    85             virtual void altFire(WeaponMode::Enum fireMode) {}
     82            virtual void fire(unsigned int firemode) {}
     83            virtual void reload() {}
    8684
    8785            virtual void boost() {}
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r3038 r3053  
    3939#include "objects/worldentities/ParticleSpawner.h"
    4040#include "objects/worldentities/ExplosionChunk.h"
     41#include "objects/weaponsystem/WeaponSystem.h"
     42#include "objects/weaponsystem/WeaponSlot.h"
     43#include "objects/weaponsystem/WeaponPack.h"
     44#include "objects/weaponsystem/WeaponSet.h"
    4145
    4246namespace orxonox
     
    5256        this->fire_ = 0x0;
    5357        this->firehack_ = 0x0;
     58        this->bReload_ = false;
    5459
    5560        this->health_ = 0;
     
    6671        {
    6772            this->weaponSystem_ = new WeaponSystem(this);
    68             this->weaponSystem_->setParentPawn(this);
     73            this->weaponSystem_->setPawn(this);
    6974        }
    7075        else
     
    100105        XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7);
    101106
    102         XMLPortObject(Pawn, WeaponSlot, "weaponslots", setWeaponSlot, getWeaponSlot, xmlelement, mode);
    103         XMLPortObject(Pawn, WeaponSet, "weaponsets", setWeaponSet, getWeaponSet, xmlelement, mode);
    104         XMLPortObject(Pawn, WeaponPack, "weapons", setWeaponPack, getWeaponPack, xmlelement, mode);
     107        XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
     108        XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
     109        XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPack, getWeaponPack, xmlelement, mode);
    105110    }
    106111
     
    111116        registerVariable(this->initialHealth_, variableDirection::toclient);
    112117        registerVariable(this->fire_,          variableDirection::toserver);
     118        registerVariable(this->bReload_,       variableDirection::toserver);
    113119    }
    114120
     
    117123        SUPER(Pawn, tick, dt);
    118124
    119         if (this->weaponSystem_)
    120         {
    121             if (this->fire_ & WeaponMode::fire)
    122                 this->weaponSystem_->fire(WeaponMode::fire);
    123             if (this->fire_ & WeaponMode::altFire)
    124                 this->weaponSystem_->fire(WeaponMode::altFire);
    125             if (this->fire_ & WeaponMode::altFire2)
    126                 this->weaponSystem_->fire(WeaponMode::altFire2);
    127         }
     125        if (this->weaponSystem_ && GameMode::isMaster())
     126        {
     127            for (unsigned int firemode = 0; firemode < WeaponSystem::MAX_FIRE_MODES; firemode++)
     128                if (this->fire_ & WeaponSystem::getFiremodeMask(firemode))
     129                    this->weaponSystem_->fire(firemode);
     130
     131            if (this->bReload_)
     132                this->weaponSystem_->reload();
     133        }
     134
    128135        this->fire_ = this->firehack_;
    129136        this->firehack_ = 0x0;
     137        this->bReload_ = false;
    130138
    131139        if (this->health_ <= 0)
     
    251259    }
    252260
    253     void Pawn::fire(WeaponMode::Enum fireMode)
    254     {
    255         this->firehack_ |= fireMode;
     261    void Pawn::fire(unsigned int firemode)
     262    {
     263        this->firehack_ |= WeaponSystem::getFiremodeMask(firemode);
     264    }
     265
     266    void Pawn::reload()
     267    {
     268        this->bReload_ = true;
    256269    }
    257270
     
    274287    *       --> e.g. Pickup-Items
    275288    */
    276     void Pawn::setWeaponSlot(WeaponSlot * wSlot)
     289    void Pawn::addWeaponSlot(WeaponSlot * wSlot)
    277290    {
    278291        this->attach(wSlot);
    279292        if (this->weaponSystem_)
    280             this->weaponSystem_->attachWeaponSlot(wSlot);
     293            this->weaponSystem_->addWeaponSlot(wSlot);
    281294    }
    282295
     
    284297    {
    285298        if (this->weaponSystem_)
    286             return this->weaponSystem_->getWeaponSlotPointer(index);
     299            return this->weaponSystem_->getWeaponSlot(index);
    287300        else
    288301            return 0;
    289302    }
    290303
    291     void Pawn::setWeaponPack(WeaponPack * wPack)
    292     {
    293         if (this->weaponSystem_)
    294         {
    295             wPack->setParentWeaponSystem(this->weaponSystem_);
    296             wPack->setParentWeaponSystemToAllWeapons(this->weaponSystem_);
    297             this->weaponSystem_->attachWeaponPack( wPack,wPack->getFireMode() );
    298             wPack->attachNeededMunitionToAllWeapons();
    299         }
    300     }
    301 
    302     WeaponPack * Pawn::getWeaponPack(unsigned int firemode) const
    303     {
    304         if (this->weaponSystem_)
    305             return this->weaponSystem_->getWeaponPackPointer(firemode);
     304    void Pawn::addWeaponSet(WeaponSet * wSet)
     305    {
     306        if (this->weaponSystem_)
     307            this->weaponSystem_->addWeaponSet(wSet);
     308    }
     309
     310    WeaponSet * Pawn::getWeaponSet(unsigned int index) const
     311    {
     312        if (this->weaponSystem_)
     313            return this->weaponSystem_->getWeaponSet(index);
    306314        else
    307315            return 0;
    308316    }
    309317
    310     void Pawn::setWeaponSet(WeaponSet * wSet)
    311     {
    312         if (this->weaponSystem_)
    313             this->weaponSystem_->attachWeaponSet(wSet);
    314     }
    315 
    316     WeaponSet * Pawn::getWeaponSet(unsigned int index) const
    317     {
    318         if (this->weaponSystem_)
    319             return this->weaponSystem_->getWeaponSetPointer(index);
     318    void Pawn::addWeaponPack(WeaponPack * wPack)
     319    {
     320        if (this->weaponSystem_)
     321            this->weaponSystem_->addWeaponPack(wPack);
     322    }
     323
     324    WeaponPack * Pawn::getWeaponPack(unsigned int index) const
     325    {
     326        if (this->weaponSystem_)
     327            return this->weaponSystem_->getWeaponPack(index);
    320328        else
    321329            return 0;
  • code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.h

    r3038 r3053  
    3434#include "objects/worldentities/ControllableEntity.h"
    3535#include "objects/RadarViewable.h"
    36 #include "objects/weaponSystem/WeaponSystem.h"
    3736
    3837namespace orxonox
     
    4039    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
    4140    {
     41        friend class WeaponSystem;
     42
    4243        public:
    4344            Pawn(BaseObject* creator);
     
    7677            virtual void kill();
    7778
    78             virtual void fire(WeaponMode::Enum fireMode);
     79            virtual void fire(unsigned int firemode);
     80            virtual void reload();
    7981            virtual void postSpawn();
    8082
    81             void setWeaponSlot(WeaponSlot * wSlot);
     83            void addWeaponSlot(WeaponSlot * wSlot);
    8284            WeaponSlot * getWeaponSlot(unsigned int index) const;
    83             void setWeaponPack(WeaponPack * wPack);
    84             WeaponPack * getWeaponPack(unsigned int firemode) const;
    85             void setWeaponSet(WeaponSet * wSet);
     85            void addWeaponSet(WeaponSet * wSet);
    8686            WeaponSet * getWeaponSet(unsigned int index) const;
     87            void addWeaponPack(WeaponPack * wPack);
     88            WeaponPack * getWeaponPack(unsigned int index) const;
    8789
    8890            inline const WorldEntity* getWorldEntity() const
     
    130132            unsigned int fire_;
    131133            unsigned int firehack_;
     134            bool bReload_;
    132135
    133136            std::string spawnparticlesource_;
    134137            float spawnparticleduration_;
    135138            unsigned int numexplosionchunks_;
     139
     140        private:
     141            inline void setWeaponSystem(WeaponSystem* weaponsystem)
     142                { this->weaponSystem_ = weaponsystem; }
    136143    };
    137144
  • code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc

    r3039 r3053  
    196196    }
    197197
    198     void Spectator::fire(WeaponMode::Enum fireMode)
     198    void Spectator::fire(unsigned int firemode)
    199199    {
    200200        if (this->getPlayer())
  • code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.h

    r3038 r3053  
    5454            virtual void rotateRoll(const Vector2& value);
    5555
    56             virtual void fire(WeaponMode::Enum fireMode);
     56            virtual void fire(unsigned int firemode);
    5757            virtual void greet();
    5858
Note: See TracChangeset for help on using the changeset viewer.