Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11041


Ignore:
Timestamp:
Jan 4, 2016, 6:19:07 PM (8 years ago)
Author:
landauf
Message:

cleanup in hover module

Location:
code/branches/presentationHS15/src/modules/hover
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS15/src/modules/hover/FlagHUD.cc

    r11030 r11041  
    3636#include <OgrePanelOverlayElement.h>
    3737
     38#include "util/StringUtils.h"
    3839#include "core/CoreIncludes.h"
    39 #include "core/XMLPort.h"
     40#include "Hover.h"
    4041
    4142namespace orxonox
     
    4748        RegisterObject(FlagHUD);
    4849
     50        this->hoverGame_ = NULL;
    4951        this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
    5052            .createOverlayElement("Panel", "FlagHUD_Panel_" + getUniqueNumberString()));
     
    5456        this->flagCount_ = 5;
    5557        setFlagCount(5);
     58    }
     59
     60    FlagHUD::~FlagHUD()
     61    {
     62        if (this->isInitialized())
     63        {
     64            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
     65        }
    5666    }
    5767
     
    7888        SUPER(FlagHUD, tick, dt);
    7989
    80             setFlagCount(this->hoverGame->getFlags());
    81        
     90        setFlagCount(this->hoverGame_->getFlags());
    8291    }
    8392
     
    8897        if (this->getOwner() && this->getOwner()->getGametype())
    8998        {
    90             this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());
     99            this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype());
    91100        }
    92101        else
    93102        {
    94             this->hoverGame = 0;
    95         }
    96     }
    97 
    98     FlagHUD::~FlagHUD()
    99     {
    100         if (this->isInitialized())
    101         {
    102             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
     103            this->hoverGame_ = 0;
    103104        }
    104105    }
  • code/branches/presentationHS15/src/modules/hover/FlagHUD.h

    r11029 r11041  
    3333#define _FlagHUD_H__
    3434
    35 #include "overlays/OverlaysPrereqs.h"
     35#include "HoverPrereqs.h"
    3636
    37 #include "util/Math.h"
    3837#include "util/OgreForwardRefs.h"
    39 #include "core/BaseObject.h"
    4038#include "overlays/OrxonoxOverlay.h"
    41 #include "Hover.h"
     39#include "tools/interfaces/Tickable.h"
    4240
    4341namespace orxonox
     
    5250        virtual void changedOwner();
    5351
    54         virtual void setFlagCount(int flagCount);
    55 
     52        void setFlagCount(int flagCount);
    5653
    5754    private:
    58         Hover* hoverGame;
     55        Hover* hoverGame_;
    5956        Ogre::PanelOverlayElement* panel_;
    6057        int flagCount_;
  • code/branches/presentationHS15/src/modules/hover/Hover.cc

    r11040 r11041  
    3434#include "Hover.h"
    3535
     36#include "HoverOrigin.h"
    3637#include "HoverWall.h"
    37 #include "HoverFlag.h" 
     38#include "HoverFlag.h"
    3839#include "MazeGenerator.h"
    3940#include "core/CoreIncludes.h"
     
    4546    Hover::Hover(Context* context) : Gametype(context)
    4647    {
    47        
    4848        RegisterObject(Hover);
    4949
     
    111111        flags_ = flagVector_.size();
    112112    }
    113 
    114     int Hover::getFlags()
    115     {
    116         // Call start for the parent class.
    117         return flags_;
    118     }   
    119 
    120     void Hover::start()
    121     {
    122         // Call start for the parent class.
    123         Gametype::start();
    124     }
    125 
    126     void Hover::end()
    127     {
    128         // DON'T CALL THIS!
    129         //      Deathmatch::end();
    130         // It will misteriously crash the game!
    131         // Instead startMainMenu, this won't crash.
    132         GSLevel::startMainMenu();
    133     }
    134113}
  • code/branches/presentationHS15/src/modules/hover/Hover.h

    r11036 r11041  
    3737
    3838#include "HoverPrereqs.h"
    39 #include "HoverOrigin.h"
     39
     40#include <vector>
    4041
    4142#include "gametypes/Gametype.h"
    42 #include "core/EventIncludes.h"
    43 #include "core/command/Executor.h"
    44 #include "core/config/ConfigValueIncludes.h"
    45 
    46 #include "gamestates/GSLevel.h"
    47 #include "chat/ChatManager.h"
    48 #include <vector>
    49 
    50 // ! HACK
    51 #include "infos/PlayerInfo.h"
    52 
    53 #include "core/command/ConsoleCommand.h"
    54 
    55 #include "tools/Timer.h"
    56 
    57 
     43#include "HoverOrigin.h"
    5844
    5945namespace orxonox
     
    6450            Hover(Context* context);
    6551
    66             virtual void start();
    67             virtual void end();
    68 
    6952            virtual void tick(float dt);         
    7053
     
    7255                { this->origin_ = origin; }
    7356
    74             int getFlags();
     57            inline int getFlags() const
     58                { return this->flags_; }
    7559
    7660        private:
  • code/branches/presentationHS15/src/modules/hover/HoverFlag.cc

    r11040 r11041  
    3636
    3737#include "core/CoreIncludes.h"
    38 #include "core/GameMode.h"
     38
    3939#include "graphics/Model.h"
    40 #include "gametypes/Gametype.h"
    41 
    42 
    43 
    44 
     40#include "objects/collisionshapes/BoxCollisionShape.h"
    4541#include "core/XMLPort.h"
    4642
     
    10096    }
    10197
    102     //xml port unused
    103     void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    104     {
    105         SUPER(HoverFlag, XMLPort, xmlelement, mode);
    106     }
    107 
    10898    /**
    10999    @brief
     
    116106        return false;
    117107    }
    118 
    119     bool HoverFlag::getCollided(){
    120         return collided_;
    121     }
    122 
    123     void HoverFlag::setCollided(bool setValue){
    124         collided_ = setValue;
    125     }
    126    
    127    
    128108}
  • code/branches/presentationHS15/src/modules/hover/HoverFlag.h

    r11040 r11041  
    3737
    3838#include "HoverPrereqs.h"
    39 #include "util/Math.h"
     39#include "objects/ObjectsPrereqs.h"
     40
    4041#include "worldentities/StaticEntity.h"
    41 #include "graphics/Model.h"   
    42 #include "objects/collisionshapes/BoxCollisionShape.h"
    43 
    4442
    4543namespace orxonox
     
    5048            HoverFlag(Context* context);
    5149            HoverFlag(Context* context, int xCoordinate, int yCoordinate, int cellSize);
     50            virtual ~HoverFlag();
     51
    5252            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint);           
    53             virtual ~HoverFlag();
    54             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    55             bool getCollided();
    56             void setCollided(bool setValue);
     53
     54            inline bool getCollided() const
     55                { return this->collided_; }
     56            inline void setCollided(bool setValue)
     57                { this->collided_ = setValue; }
    5758
    5859        private:
  • code/branches/presentationHS15/src/modules/hover/HoverOrigin.h

    r11040 r11041  
    3131
    3232#include "HoverPrereqs.h"
    33 
    34 #include <string>
    35 
    36 #include <util/Math.h>
    3733
    3834#include "worldentities/StaticEntity.h"
  • code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h

    r11026 r11041  
    6868namespace orxonox
    6969{
     70    class FlagHUD;
    7071    class Hover;
     72    class HoverFlag;
     73    class HoverOrigin;
    7174    class HoverShip;
    7275    class HoverWall;
    73     class HoverOrigin;
    74     class HoverFlag;
     76    class MazeGenerator;
     77    class TimeHUD;
    7578}
    7679
  • code/branches/presentationHS15/src/modules/hover/HoverShip.cc

    r11026 r11041  
    3232#include "HoverShip.h"
    3333#include "core/CoreIncludes.h"
     34#include "core/XMLPort.h"
     35
     36#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
    3437
    3538namespace orxonox
     
    4245        enableCollisionCallback();
    4346        isFloor_ = false;
    44     }
    45 
    46     void HoverShip::tick(float dt)
    47     {
    48         SUPER(HoverShip, tick, dt);
     47        jumpBoost_ = 0;
    4948    }
    5049
     
    7069
    7170        XMLPortParam(HoverShip, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode);
    72     }
    73 
    74     /**
    75     @brief
    76         sets this ships jumpBoost
    77     @param jumpBoost
    78     */
    79     void HoverShip::setJumpBoost(float jumpBoost)
    80     {
    81         this->jumpBoost_ = jumpBoost;
    82     }
    83 
    84     /**
    85     @brief
    86         returns this ships jumpBoost
    87     @returns jumpBoost
    88     */
    89     float HoverShip::getJumpBoost()
    90     {
    91         return jumpBoost_;
    9271    }
    9372
  • code/branches/presentationHS15/src/modules/hover/HoverShip.h

    r11026 r11041  
    3333#define _HoverShip_H__
    3434
    35 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
    36 
    3735#include "HoverPrereqs.h"
    3836
    39 #include "core/XMLPort.h"
    4037#include "worldentities/pawns/SpaceShip.h"
    41 #include "graphics/Camera.h"
    42 #include "core/class/Super.h"
    4338
    4439namespace orxonox
     
    4641    class _HoverExport HoverShip : public SpaceShip
    4742    {
    48     private:
    49         float jumpBoost_;
    50         bool isFloor_;
    51 
    5243        public:
    5344            HoverShip(Context* context);
    5445
    55             virtual void tick(float dt);
    56 
    5746            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5847
    59             virtual void setJumpBoost(float jumpBoost);
    60 
    61             virtual float getJumpBoost();
     48            /// sets this ships jumpBoost
     49            inline void setJumpBoost(float jumpBoost)
     50                { this->jumpBoost_ = jumpBoost; }
     51            /// returns this ships jumpBoost
     52            inline float getJumpBoost() const
     53                { return this->jumpBoost_; }
    6254
    6355            virtual void moveFrontBack(const Vector2& value);
     
    7769            virtual void boost(bool bBoost);
    7870
     71        private:
     72            float jumpBoost_;
     73            bool isFloor_;
    7974    };
    8075}
  • code/branches/presentationHS15/src/modules/hover/HoverWall.cc

    r11040 r11041  
    3535
    3636#include "core/CoreIncludes.h"
    37 #include "core/GameMode.h"
    3837#include "graphics/Model.h"
    39 #include "gametypes/Gametype.h"
    40 
    41 
    42 
    43 #include "core/XMLPort.h"
     38#include "objects/collisionshapes/BoxCollisionShape.h"
    4439
    4540namespace orxonox
     
    111106
    112107    }
    113 
    114     //xml port for loading height and width of the platform, unused
    115     void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    116     {
    117         SUPER(HoverWall, XMLPort, xmlelement, mode);
    118     }
    119108}
  • code/branches/presentationHS15/src/modules/hover/HoverWall.h

    r11040 r11041  
    3737
    3838#include "HoverPrereqs.h"
    39 #include "util/Math.h"
     39#include "objects/ObjectsPrereqs.h"
     40
    4041#include "worldentities/StaticEntity.h"
    41 #include "graphics/Model.h"   
    42 #include "objects/collisionshapes/BoxCollisionShape.h"
    43 
    4442
    4543namespace orxonox
     
    5149            HoverWall(Context* context, int x, int y, int cellSize, int cellHeight, int orientation);
    5250            virtual ~HoverWall();
    53             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5451
    5552        private:
    5653            Model* model_;
    5754            BoxCollisionShape* cs_;
    58 
    5955    };
    6056}
  • code/branches/presentationHS15/src/modules/hover/TimeHUD.cc

    r11026 r11041  
    3434
    3535#include "core/CoreIncludes.h"
    36 #include "core/XMLPort.h"
    3736#include "util/Convert.h"
    3837#include "Hover.h"
     
    4645        RegisterObject(TimeHUD);
    4746
    48         this->_time = 0.0f;
    49         this->_running = false;
    50         this->hoverGame = 0;
     47        this->time_ = 0.0f;
     48        this->running_ = false;
     49        this->hoverGame_ = 0;
    5150        setRunning(true);
    52     }
    53 
    54     void TimeHUD::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    55     {
    56         SUPER(TimeHUD, XMLPort, xmlelement, mode);
    5751    }
    5852
     
    8276        SUPER(TimeHUD, tick, dt);
    8377
    84         if(this->_running) {
    85             this->_time += dt;
     78        if(this->running_) {
     79            this->time_ += dt;
    8680        }
    87         if (this->hoverGame)
     81        if (this->hoverGame_)
    8882        {
    89             this->setCaption(getTimeString(this->_time));
     83            this->setCaption(getTimeString(this->time_));
    9084        }
    91         if(this->hoverGame->getFlags() == 0)
     85        if(this->hoverGame_->getFlags() == 0)
    9286            setRunning(false);
    9387       
     
    10094        if (this->getOwner() && this->getOwner()->getGametype())
    10195        {
    102             this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());
     96            this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype());
    10397        }
    10498        else
    10599        {
    106             this->hoverGame = 0;
     100            this->hoverGame_ = 0;
    107101        }
    108     }
    109 
    110     /**
    111     @brief
    112         sets if the clock is running
    113     @param running
    114     */
    115     void TimeHUD::setRunning(bool running)
    116     {
    117         this->_running = running;
    118     }
    119 
    120     /**
    121     @brief
    122         returns if the clock is running
    123     @returns running
    124     */
    125     bool TimeHUD::isRunning() {
    126         return this->_running;
    127102    }
    128103
    129104    void TimeHUD::reset()
    130105    {
    131         this->_time = 0;
     106        this->time_ = 0;
    132107    }
    133108}
  • code/branches/presentationHS15/src/modules/hover/TimeHUD.h

    r11026 r11041  
    3333#define _TimeHUD_H__
    3434
    35 #include "hover/HoverPrereqs.h"
     35#include "HoverPrereqs.h"
    3636
    3737#include "tools/interfaces/Tickable.h"
     
    4646
    4747            virtual void tick(float dt);
    48             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4948            virtual void changedOwner();
    5049
    51             virtual void setRunning(bool running);
    52             virtual bool isRunning();
    53             virtual void reset();
     50            /// sets if the clock is running
     51            inline void setRunning(bool running)
     52                { this->running_ = running; }
     53            /// returns if the clock is running
     54            inline bool isRunning() const
     55                { return this->running_; }
     56
     57            void reset();
    5458
    5559        private:
    56             Hover* hoverGame;
    57             float _time;
    58             bool _running;
     60            Hover* hoverGame_;
     61            float time_;
     62            bool running_;
    5963    };
    6064}
Note: See TracChangeset for help on using the changeset viewer.