Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12273


Ignore:
Timestamp:
Apr 4, 2019, 3:51:04 PM (6 years ago)
Author:
cwaupoti
Message:

comment

Location:
code/branches/Boxhead_FS19
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Boxhead_FS19/data/levels/Hover.oxw

    r12267 r12273  
    1 <!-- include("HUDTemplates3.oxo") -->
    2   <!-- include("templates/spaceshipSwallow.oxt") -->
    3   <!-- include("templates/spaceshipPirate.oxt") -->
    4   <!-- include("templates/spaceshipEscort.oxt") -->
    5   <!-- include("templates/spaceshipCollateralDamage.oxt") -->
    6   <!-- include("templates/spaceshipAssff.oxt") -->
    7   <!-- include("templates/spaceshipAssff2.oxt") -->
    8   <!-- include("templates/spaceshipTransporter.oxt") -->
    9 
    101<LevelInfo
    112 name = "Hover level"
  • code/branches/Boxhead_FS19/data/levels/includes/weaponSettingsHover.oxi

    r12261 r12273  
    2727</weaponpacks> 
    2828<munition>
    29   <IceMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
     29  <LaserMunition initialmagazines=1 maxmagazines=1 munitionpermagazine=10/>
    3030</munition>
  • code/branches/Boxhead_FS19/src/modules/hover/Hover.h

    r12261 r12273  
    2727 */
    2828
    29 /**f
     29/**
    3030    @file Hover.h
    3131    @brief Gametype. For more information see .cc file
  • code/branches/Boxhead_FS19/src/modules/weapons/projectiles/CMakeLists.txt

    r12191 r12273  
    1515  MineProjectile.cc
    1616  WagnisProjectile.cc
     17  HoverGunProjectile.cc
    1718)
  • code/branches/Boxhead_FS19/src/modules/weapons/projectiles/HoverGunProjectile.cc

    r12262 r12273  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Joel Smely
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
    2828
    2929/**
    30     @file Projectile.h
    31     @brief Implementation of the Projectile class.
     30    @file HoverGunProjectile.h
     31    @brief Implementation of the HoverGunProjectile class.
    3232*/
    3333
    3434#include "HoverGunProjectile.h"
    3535
    36 #include "core/config/ConfigValueIncludes.h"
    3736#include "core/CoreIncludes.h"
    38 #include "core/GameMode.h"
    3937#include "core/command/Executor.h"
    40 
    41 #include "worldentities/pawns/Pawn.h"
     38#include "util/Convert.h"
    4239
    4340namespace orxonox
     
    4542    RegisterClass(HoverGunProjectile);
    4643
    47     HoverGunProjectile::HoverGunProjectile(Context* context) : MovableEntity(context), BasicProjectile()
     44    HoverGunProjectile::HoverGunProjectile(Context* context) : BillboardProjectile(context)
    4845    {
    4946        RegisterObject(HoverGunProjectile);
    5047
    51         this->setConfigValues();
     48        this->textureIndex_ = 1;
     49        this->setMass(0.1f);
     50        this->setCollisionType(CollisionType::Dynamic);
     51        this->maxTextureIndex_ = 8;
     52        this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&HoverGunProjectile::changeTexture, this)));
    5253
    53         // Get notification about collisions
    54         if (GameMode::isMaster())
    55         {
    56             this->setMass(0.1f);
    57             this->enableCollisionCallback();
    58             this->setCollisionResponse(false);
    59             this->setCollisionType(CollisionType::Dynamic);
    60 
    61             // Create a sphere collision shape and attach it to the projectile.
    62             collisionShape_ = new SphereCollisionShape(this->getContext());
    63             setCollisionShapeRadius(8.0f);
    64             this->attachCollisionShape(collisionShape_);
    65 
    66             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
    67         }
     54        registerVariables();
    6855    }
    6956
    70     HoverGunProjectile::~HoverGunProjectile()
     57    void HoverGunProjectile::registerVariables()
    7158    {
     59        registerVariable(this->materialBase_);
    7260    }
    7361
    74     void HoverGunProjectile::setConfigValues()
     62    /**
     63    @brief
     64        Set the material.
     65    @param material
     66        The name of the material. Material names with 1 to 8 appended must exist.
     67    */
     68    void HoverGunProjectile::setMaterial(const std::string& material)
    7569    {
    76         SetConfigValue(lifetime_, 4.0f).description("The time in seconds a projectile stays alive");
     70        this->materialBase_ = material;
     71
     72        BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_));
    7773    }
    7874
    79     void HoverGunProjectile::tick(float dt)
     75    /**
     76    @brief
     77        Change the texture.
     78    */
     79    void HoverGunProjectile::changeTexture()
    8080    {
    81         SUPER(Projectile, tick, dt);
     81        this->textureIndex_++;
     82        if (this->textureIndex_ > this->maxTextureIndex_)
     83            this->textureIndex_ = 1;
    8284
    83         if (!this->isActive())
    84             return;
    85 
    86         this->destroyCheck();
    87     }
    88 
    89     bool HoverGunProjectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    90     {
    91         return this->processCollision(otherObject, contactPoint, cs);
    92     }
    93 
    94     void HoverGunProjectile::setCollisionShapeRadius(float radius)
    95     {
    96         if (collisionShape_ != nullptr && radius > 0)
    97         {
    98             collisionShape_->setRadius(radius);
    99         }       
     85        this->setMaterial(this->materialBase_);
    10086    }
    10187}
  • code/branches/Boxhead_FS19/src/modules/weapons/projectiles/HoverGunProjectile.h

    r12262 r12273  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Joel Smely
    2424 *   Co-authors:
    25  *      simonmie
     25 *      ...
    2626 *
    2727 */
    2828
    2929/**
    30     @file Projectile.h
    31     @brief Definition of the Projectile class.
     30    @file HoverGunProjectile.h
     31    @brief Definition of the HoverGunProjectile class.
    3232*/
    3333
     
    3737#include "weapons/WeaponsPrereqs.h"
    3838
     39#include <string>
    3940#include "tools/Timer.h"
    40 #include "worldentities/MovableEntity.h"
    41 #include "objects/collisionshapes/SphereCollisionShape.h"
    42 
    43 #include "BasicProjectile.h"
     41#include "BillboardProjectile.h"
    4442
    4543namespace orxonox
     
    4846    /**
    4947    @brief
    50         Represents all 'standard' projectiles.
    51 
     48        The HoverGunProjectile is a projectile that is represented by a looped series of billboards.
     49       
    5250    @author
    53         Fabian 'x3n' Landau
    54     @author
    55         Simon Miescher
     51        Joel Smely
    5652    @ingroup WeaponsProjectiles
    5753    */
    58     class _WeaponsExport HoverGunProjectile : public MovableEntity, public BasicProjectile
     54    class _WeaponsExport HoverGunProjectile : public BillboardProjectile
    5955    {
    6056        public:
    6157            HoverGunProjectile(Context* context);
    62             virtual ~HoverGunProjectile();
     58            virtual ~HoverGunProjectile() {}
    6359
    64             void setConfigValues();
    65 
    66             virtual void tick(float dt) override;
    67             virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
    68 
    69         protected:
    70             virtual void setCollisionShapeRadius(float radius);
    71             float lifetime_; //!< The time the projectile exists.
     60            virtual void setMaterial(const std::string& material) override;
    7261
    7362        private:
    74             Timer destroyTimer_; //!< Timer to destroy the projectile after its lifetime has run out.
    75             WeakPtr<SphereCollisionShape> collisionShape_; // The collision shape of the projectile.
     63            void registerVariables();
     64            void changeTexture();
     65           
     66            unsigned int textureIndex_; //!< The current index of the texture. (i.e. the index of the currently displayed texture)
     67            unsigned int maxTextureIndex_; //!< The maximal index.
     68            Timer textureTimer_; //!< A timer that loops and changes textures each time it expires.
     69            std::string materialBase_; //!< The base name of the material.
    7670    };
    7771}
    7872
    79 #endif /* _Projectile_H__ */
     73#endif /* _HoverGunProjectile_H__ */
  • code/branches/Boxhead_FS19/src/modules/weapons/weaponmodes/CMakeLists.txt

    r12191 r12273  
    55  HsW01.cc
    66  LightningGun.cc
     7  HoverGun.cc
    78  SplitGun.cc
    89  IceGun.cc
  • code/branches/Boxhead_FS19/src/modules/weapons/weaponmodes/HoverGun.cc

    r12262 r12273  
    2121 *
    2222 *   Author:
    23  *      Hagen Seifert
     23 *      Joel Smely
    2424 *   Co-authors:
    2525 *      simonmie
     
    2828
    2929/**
    30     @file HsW01.h
    31     @brief Implementation of the HsW01 class.
     30    @file HoverGun.h
     31    @brief Implementation of the HoverGun class.
    3232*/
    3333
     
    3535
    3636#include "core/CoreIncludes.h"
    37 #include "core/XMLPort.h"
    38 #include "core/command/Executor.h"
    39 
    40 #include "graphics/Model.h"
    4137#include "weaponsystem/Weapon.h"
    4238#include "weaponsystem/WeaponPack.h"
    4339#include "weaponsystem/WeaponSystem.h"
    44 #include "worldentities/WorldEntity.h"
    4540#include "worldentities/pawns/Pawn.h"
    4641
    4742#include "weapons/projectiles/HoverGunProjectile.h"
    48 #include "weapons/MuzzleFlash.h"
    4943
    5044namespace orxonox
     
    5650        RegisterObject(HoverGun);
    5751
    58         this->reloadTime_ = 0.25f;
    59         this->damage_ = 0.0f; //default 15
     52        this->reloadTime_ = 1.0f;
     53        this->damage_ = 0.0f;
    6054        this->speed_ = 750.0f;
    61         this->delay_ = 0.0f;
    62         this->setMunitionName("LaserMunition");
    63         this->mesh_ = "laserbeam.mesh";
    6455
     56        this->setMunitionName("HoverMunition");
     57        this->setFireSound("sounds/Weapon_HoverGun.ogg");
    6558
    66         this->delayTimer_.setTimer(this->delay_, false, createExecutor(createFunctor(&HoverGun::shot, this)));
    67         this->delayTimer_.stopTimer();
    68 
    69         this->setFireSound("sounds/Weapon_HsW01.ogg");
    70         this->setReloadSound("sounds/Reload_HsW01.ogg", 0.5);
    71 
    72         hudImageString_ = "Orxonox/WSHUD_WM_HsW01";
     59        hudImageString_ = "Orxonox/WSHUD_WM_HoverGun";
    7360    }
    7461
     
    7663    {
    7764    }
    78 
    79     void HoverGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    80     {
    81         SUPER(HoverGun, XMLPort, xmlelement, mode);
    82 
    83         XMLPortParam(HoverGun, "delay", setDelay, getDelay, xmlelement, mode);
    84         XMLPortParam(HoverGun, "material", setMaterial, getMaterial, xmlelement, mode);
    85         XMLPortParam(HoverGun, "projectileMesh", setMesh, getMesh, xmlelement, mode);
    86         XMLPortParam(HoverGun, "sound", setSound, getSound, xmlelement, mode);
    87     }
    88 
    89     /**
    90     @brief
    91         Set the firing delay.
    92     @param delay
    93         The firing delay in seconds.
    94     */
    95     void HoverGun::setDelay(float delay)
    96     {
    97         this->delay_ = delay;
    98         this->delayTimer_.setInterval(this->delay_);
    99     }
    100 
    101     // void HoverGun::fire()
    102     // {
    103     //     this->delayTimer_.startTimer();
    104     // }
    10565
    10666    /**
     
    11070    void HoverGun::fire()
    11171    {
    112         assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
    113 
    114         // Create the projectile.
    11572        HoverGunProjectile* projectile = new HoverGunProjectile(this->getContext());
    116         Model* model = new Model(HoverGunprojectile->getContext());
    117         model->setMeshSource(mesh_);
    118         model->setCastShadows(false);
    119         projectile->attach(model);
    120         model->setScale(5);
     73        projectile->setMaterial("Flares/HoverBall_");
    12174
    12275        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
     
    12982        projectile->setShieldDamage(this->getShieldDamage());
    13083        projectile->setHealthDamage(this->getHealthDamage());
    131 
    132         // Display the muzzle flash.
    133         // this->HoverGun::muzzleflash();
    13484    }
    135 
    136     /**
    137     @brief
    138         Displays the muzzle flash.
    139     */
    140     // void HoverGun::muzzleflash()
    141     // {
    142     //     MuzzleFlash *muzzleFlash = new MuzzleFlash(this->getContext());
    143     //     this->getWeapon()->attach(muzzleFlash);
    144     //     muzzleFlash->setPosition(this->getMuzzleOffset());
    145     //     muzzleFlash->setMaterial(this->material_);
    146     // }
    14785}
  • code/branches/Boxhead_FS19/src/modules/weapons/weaponmodes/HoverGun.h

    r12262 r12273  
    2121 *
    2222 *   Author:
    23  *      Hagen Seifert
     23 *      Joel Smely
    2424 *   Co-authors:
    2525 *      ...
     
    3636
    3737#include "weapons/WeaponsPrereqs.h"
    38 
    39 #include "tools/Timer.h"
    4038#include "weaponsystem/WeaponMode.h"
    4139
     
    4543    /**
    4644    @brief
    47         Shoots laser beams.
     45        A slow ball of lightning.
    4846    @author
    49         Hagen Seifert
     47        Joel Smely
    5048    @ingroup WeaponsWeaponModes
    5149    */
     
    5755
    5856            virtual void fire() override;
    59             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    6057
    61         protected:
    62             /**
    63             @brief Set the mesh.
    64             @param mesh The mesh name.
    65             */
    66             void setMesh(const std::string& mesh)
    67                 { this->mesh_ = mesh; }
    68 
    69             /**
    70             @brief Get the mesh.
    71             @return Returns the mesh name.
    72             */
    73             const std::string& getMesh() const
    74                 { return this->mesh_; }
    75 
    76             /**
    77             @brief Set the sound.
    78             @param sound The Sound name.
    79             */
    80             void setSound(const std::string& sound)
    81                 { this->sound_ = sound; }
    82 
    83             /**
    84             @brief Get the sound.
    85             @return Returns the sound name.
    86             */
    87             const std::string& getSound() const
    88                 { return this->sound_; }
    89 
    90             /**
    91             @brief Set the material.
    92             @param material The material name.
    93             */
    94             void setMaterial(const std::string& material)
    95                 { this->material_ = material; }
    96             /**
    97             @brief Get the material.
    98             @return Returns the material name.
    99             */
    100             const std::string& getMaterial() const
    101                 { return this->material_; }
    102 
    103             void setDelay(float delay);
    104             /**
    105             @brief Get the firing delay.
    106             @return Returns the firing delay in seconds.
    107             */
    108             float getDelay() const
    109                 { return this->delay_; }
    110 
    111             virtual void shot();
    112             void muzzleflash();
    113 
    114             std::string material_; //!< The material.
    115             std::string mesh_; //!< The mesh.
    116             std::string sound_; //!< The sound.
    117 
    118 
    119 
     58       private:
    12059            float speed_; //!< The speed of the fired projectile.
    121             float delay_; //!< The firing delay.
    122             Timer delayTimer_; //!< A timer to delay the firing.
    12360    };
    12461}
    12562
    126 #endif /* HoverGun */
     63#endif /* _HoverGun_H__ */
Note: See TracChangeset for help on using the changeset viewer.