Changeset 11041
- Timestamp:
- Jan 4, 2016, 6:19:07 PM (9 years ago)
- Location:
- code/branches/presentationHS15/src/modules/hover
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS15/src/modules/hover/FlagHUD.cc
r11030 r11041 36 36 #include <OgrePanelOverlayElement.h> 37 37 38 #include "util/StringUtils.h" 38 39 #include "core/CoreIncludes.h" 39 #include " core/XMLPort.h"40 #include "Hover.h" 40 41 41 42 namespace orxonox … … 47 48 RegisterObject(FlagHUD); 48 49 50 this->hoverGame_ = NULL; 49 51 this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 50 52 .createOverlayElement("Panel", "FlagHUD_Panel_" + getUniqueNumberString())); … … 54 56 this->flagCount_ = 5; 55 57 setFlagCount(5); 58 } 59 60 FlagHUD::~FlagHUD() 61 { 62 if (this->isInitialized()) 63 { 64 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_); 65 } 56 66 } 57 67 … … 78 88 SUPER(FlagHUD, tick, dt); 79 89 80 setFlagCount(this->hoverGame->getFlags()); 81 90 setFlagCount(this->hoverGame_->getFlags()); 82 91 } 83 92 … … 88 97 if (this->getOwner() && this->getOwner()->getGametype()) 89 98 { 90 this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());99 this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype()); 91 100 } 92 101 else 93 102 { 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; 103 104 } 104 105 } -
code/branches/presentationHS15/src/modules/hover/FlagHUD.h
r11029 r11041 33 33 #define _FlagHUD_H__ 34 34 35 #include " overlays/OverlaysPrereqs.h"35 #include "HoverPrereqs.h" 36 36 37 #include "util/Math.h"38 37 #include "util/OgreForwardRefs.h" 39 #include "core/BaseObject.h"40 38 #include "overlays/OrxonoxOverlay.h" 41 #include " Hover.h"39 #include "tools/interfaces/Tickable.h" 42 40 43 41 namespace orxonox … … 52 50 virtual void changedOwner(); 53 51 54 virtual void setFlagCount(int flagCount); 55 52 void setFlagCount(int flagCount); 56 53 57 54 private: 58 Hover* hoverGame ;55 Hover* hoverGame_; 59 56 Ogre::PanelOverlayElement* panel_; 60 57 int flagCount_; -
code/branches/presentationHS15/src/modules/hover/Hover.cc
r11040 r11041 34 34 #include "Hover.h" 35 35 36 #include "HoverOrigin.h" 36 37 #include "HoverWall.h" 37 #include "HoverFlag.h" 38 #include "HoverFlag.h" 38 39 #include "MazeGenerator.h" 39 40 #include "core/CoreIncludes.h" … … 45 46 Hover::Hover(Context* context) : Gametype(context) 46 47 { 47 48 48 RegisterObject(Hover); 49 49 … … 111 111 flags_ = flagVector_.size(); 112 112 } 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 }134 113 } -
code/branches/presentationHS15/src/modules/hover/Hover.h
r11036 r11041 37 37 38 38 #include "HoverPrereqs.h" 39 #include "HoverOrigin.h" 39 40 #include <vector> 40 41 41 42 #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" 58 44 59 45 namespace orxonox … … 64 50 Hover(Context* context); 65 51 66 virtual void start();67 virtual void end();68 69 52 virtual void tick(float dt); 70 53 … … 72 55 { this->origin_ = origin; } 73 56 74 int getFlags(); 57 inline int getFlags() const 58 { return this->flags_; } 75 59 76 60 private: -
code/branches/presentationHS15/src/modules/hover/HoverFlag.cc
r11040 r11041 36 36 37 37 #include "core/CoreIncludes.h" 38 #include "core/GameMode.h" 38 39 39 #include "graphics/Model.h" 40 #include "gametypes/Gametype.h" 41 42 43 44 40 #include "objects/collisionshapes/BoxCollisionShape.h" 45 41 #include "core/XMLPort.h" 46 42 … … 100 96 } 101 97 102 //xml port unused103 void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)104 {105 SUPER(HoverFlag, XMLPort, xmlelement, mode);106 }107 108 98 /** 109 99 @brief … … 116 106 return false; 117 107 } 118 119 bool HoverFlag::getCollided(){120 return collided_;121 }122 123 void HoverFlag::setCollided(bool setValue){124 collided_ = setValue;125 }126 127 128 108 } -
code/branches/presentationHS15/src/modules/hover/HoverFlag.h
r11040 r11041 37 37 38 38 #include "HoverPrereqs.h" 39 #include "util/Math.h" 39 #include "objects/ObjectsPrereqs.h" 40 40 41 #include "worldentities/StaticEntity.h" 41 #include "graphics/Model.h"42 #include "objects/collisionshapes/BoxCollisionShape.h"43 44 42 45 43 namespace orxonox … … 50 48 HoverFlag(Context* context); 51 49 HoverFlag(Context* context, int xCoordinate, int yCoordinate, int cellSize); 50 virtual ~HoverFlag(); 51 52 52 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; } 57 58 58 59 private: -
code/branches/presentationHS15/src/modules/hover/HoverOrigin.h
r11040 r11041 31 31 32 32 #include "HoverPrereqs.h" 33 34 #include <string>35 36 #include <util/Math.h>37 33 38 34 #include "worldentities/StaticEntity.h" -
code/branches/presentationHS15/src/modules/hover/HoverPrereqs.h
r11026 r11041 68 68 namespace orxonox 69 69 { 70 class FlagHUD; 70 71 class Hover; 72 class HoverFlag; 73 class HoverOrigin; 71 74 class HoverShip; 72 75 class HoverWall; 73 class HoverOrigin;74 class HoverFlag;76 class MazeGenerator; 77 class TimeHUD; 75 78 } 76 79 -
code/branches/presentationHS15/src/modules/hover/HoverShip.cc
r11026 r11041 32 32 #include "HoverShip.h" 33 33 #include "core/CoreIncludes.h" 34 #include "core/XMLPort.h" 35 36 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 34 37 35 38 namespace orxonox … … 42 45 enableCollisionCallback(); 43 46 isFloor_ = false; 44 } 45 46 void HoverShip::tick(float dt) 47 { 48 SUPER(HoverShip, tick, dt); 47 jumpBoost_ = 0; 49 48 } 50 49 … … 70 69 71 70 XMLPortParam(HoverShip, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode); 72 }73 74 /**75 @brief76 sets this ships jumpBoost77 @param jumpBoost78 */79 void HoverShip::setJumpBoost(float jumpBoost)80 {81 this->jumpBoost_ = jumpBoost;82 }83 84 /**85 @brief86 returns this ships jumpBoost87 @returns jumpBoost88 */89 float HoverShip::getJumpBoost()90 {91 return jumpBoost_;92 71 } 93 72 -
code/branches/presentationHS15/src/modules/hover/HoverShip.h
r11026 r11041 33 33 #define _HoverShip_H__ 34 34 35 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>36 37 35 #include "HoverPrereqs.h" 38 36 39 #include "core/XMLPort.h"40 37 #include "worldentities/pawns/SpaceShip.h" 41 #include "graphics/Camera.h"42 #include "core/class/Super.h"43 38 44 39 namespace orxonox … … 46 41 class _HoverExport HoverShip : public SpaceShip 47 42 { 48 private:49 float jumpBoost_;50 bool isFloor_;51 52 43 public: 53 44 HoverShip(Context* context); 54 45 55 virtual void tick(float dt);56 57 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 58 47 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_; } 62 54 63 55 virtual void moveFrontBack(const Vector2& value); … … 77 69 virtual void boost(bool bBoost); 78 70 71 private: 72 float jumpBoost_; 73 bool isFloor_; 79 74 }; 80 75 } -
code/branches/presentationHS15/src/modules/hover/HoverWall.cc
r11040 r11041 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h"38 37 #include "graphics/Model.h" 39 #include "gametypes/Gametype.h" 40 41 42 43 #include "core/XMLPort.h" 38 #include "objects/collisionshapes/BoxCollisionShape.h" 44 39 45 40 namespace orxonox … … 111 106 112 107 } 113 114 //xml port for loading height and width of the platform, unused115 void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)116 {117 SUPER(HoverWall, XMLPort, xmlelement, mode);118 }119 108 } -
code/branches/presentationHS15/src/modules/hover/HoverWall.h
r11040 r11041 37 37 38 38 #include "HoverPrereqs.h" 39 #include "util/Math.h" 39 #include "objects/ObjectsPrereqs.h" 40 40 41 #include "worldentities/StaticEntity.h" 41 #include "graphics/Model.h"42 #include "objects/collisionshapes/BoxCollisionShape.h"43 44 42 45 43 namespace orxonox … … 51 49 HoverWall(Context* context, int x, int y, int cellSize, int cellHeight, int orientation); 52 50 virtual ~HoverWall(); 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);54 51 55 52 private: 56 53 Model* model_; 57 54 BoxCollisionShape* cs_; 58 59 55 }; 60 56 } -
code/branches/presentationHS15/src/modules/hover/TimeHUD.cc
r11026 r11041 34 34 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 #include "util/Convert.h" 38 37 #include "Hover.h" … … 46 45 RegisterObject(TimeHUD); 47 46 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; 51 50 setRunning(true); 52 }53 54 void TimeHUD::XMLPort(Element& xmlelement, XMLPort::Mode mode)55 {56 SUPER(TimeHUD, XMLPort, xmlelement, mode);57 51 } 58 52 … … 82 76 SUPER(TimeHUD, tick, dt); 83 77 84 if(this-> _running) {85 this-> _time+= dt;78 if(this->running_) { 79 this->time_ += dt; 86 80 } 87 if (this->hoverGame )81 if (this->hoverGame_) 88 82 { 89 this->setCaption(getTimeString(this-> _time));83 this->setCaption(getTimeString(this->time_)); 90 84 } 91 if(this->hoverGame ->getFlags() == 0)85 if(this->hoverGame_->getFlags() == 0) 92 86 setRunning(false); 93 87 … … 100 94 if (this->getOwner() && this->getOwner()->getGametype()) 101 95 { 102 this->hoverGame = orxonox_cast<Hover*>(this->getOwner()->getGametype());96 this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype()); 103 97 } 104 98 else 105 99 { 106 this->hoverGame = 0;100 this->hoverGame_ = 0; 107 101 } 108 }109 110 /**111 @brief112 sets if the clock is running113 @param running114 */115 void TimeHUD::setRunning(bool running)116 {117 this->_running = running;118 }119 120 /**121 @brief122 returns if the clock is running123 @returns running124 */125 bool TimeHUD::isRunning() {126 return this->_running;127 102 } 128 103 129 104 void TimeHUD::reset() 130 105 { 131 this-> _time= 0;106 this->time_ = 0; 132 107 } 133 108 } -
code/branches/presentationHS15/src/modules/hover/TimeHUD.h
r11026 r11041 33 33 #define _TimeHUD_H__ 34 34 35 #include " hover/HoverPrereqs.h"35 #include "HoverPrereqs.h" 36 36 37 37 #include "tools/interfaces/Tickable.h" … … 46 46 47 47 virtual void tick(float dt); 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);49 48 virtual void changedOwner(); 50 49 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(); 54 58 55 59 private: 56 Hover* hoverGame ;57 float _time;58 bool _running;60 Hover* hoverGame_; 61 float time_; 62 bool running_; 59 63 }; 60 64 }
Note: See TracChangeset
for help on using the changeset viewer.