Changeset 10118 for code/branches/surfaceraceHS14
- Timestamp:
- Nov 12, 2014, 3:58:59 PM (10 years ago)
- Location:
- code/branches/surfaceraceHS14/src/modules/dodgerace2
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt
r10117 r10118 2 2 DodgeRace.cc 3 3 DodgeRaceCenterPoint.cc 4 DodgeRaceShip.cc 4 5 DodgeRaceHUDinfo.cc 5 DodgeRaceShip.cc6 6 ) 7 7 -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
r10117 r10118 33 33 34 34 #include "DodgeRace.h" 35 36 #include "core/CoreIncludes.h" 37 #include "core/EventIncludes.h" 38 #include "core/command/Executor.h" 39 #include "core/config/ConfigValueIncludes.h" 40 41 #include "gamestates/GSLevel.h" 42 #include "chat/ChatManager.h" 43 44 // ! HACK 45 #include "infos/PlayerInfo.h" 46 47 /*#include "DodgeRaceCenterPoint.h" 48 #include "DodgeRaceShip.h" 49 #include "DodgeRaceEnemy.h" 50 #include "DodgeRaceEnemyShooter.h" 51 */ 52 #include "core/command/ConsoleCommand.h" 53 #include "worldentities/BigExplosion.h" 35 #include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 54 36 55 37 namespace orxonox 56 38 { 57 Register Class(DodgeRace);39 RegisterUnloadableClass(DodgeRace); 58 40 59 41 DodgeRace::DodgeRace(Context* context) : Deathmatch(context) 60 42 { 61 43 RegisterObject(DodgeRace); 44 init(); 62 45 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 63 this->center_ = NULL;64 init();65 this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!! change later 46 this->center_ = 0; 47 /* 48 this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!! change later*/ 66 49 } 67 50 … … 75 58 multiplier = 1; 76 59 b_combo = false; 60 77 61 // spawn enemy every 3.5 seconds 78 62 //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this))); 79 //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this)));63 comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this))); 80 64 } 81 65 … … 83 67 { 84 68 level++; 85 if (getPlayer() != NULL)69 /* if (getPlayer() != NULL) 86 70 { 87 71 for (int i = 0; i < 7; i++) … … 92 76 chunk->setScale(20); 93 77 } 94 } 78 }*/ 95 79 addPoints(multiplier * 42); 96 80 multiplier *= 2; … … 110 94 return player; 111 95 } 112 113 /*void DodgeRace::spawnEnemy()96 /* 97 void DodgeRace::spawnEnemy() 114 98 { 115 99 if (getPlayer() == NULL) … … 134 118 newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200)); 135 119 } 136 } */120 } 137 121 138 122 void DodgeRace::costLife() … … 144 128 // enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&DodgeRace::end, this))); 145 129 }; 146 130 */ 147 131 void DodgeRace::comboControll() 148 132 { … … 161 145 this->bForceSpawn_ = true; 162 146 163 if (this->center_ == NULL) // abandon mission!147 /*if (this->center_ == NULL) // abandon mission! 164 148 { 165 149 orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl; 166 150 GSLevel::startMainMenu(); 167 151 return; 168 } 152 }*/ 169 153 // Call start for the parent class. 170 154 Deathmatch::start(); … … 178 162 } 179 163 } 180 164 /* 181 165 void DodgeRace::end() 182 166 { … … 186 170 // Instead startMainMenu, this won't crash. 187 171 GSLevel::startMainMenu(); 188 } 172 }*/ 189 173 } -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h
r10117 r10118 38 38 #include "dodgerace2/DodgeRacePrereqs.h" 39 39 40 //#include "DodgeRaceCenterPoint.h" 40 #include "DodgeRaceCenterPoint.h" // Necessary for WeakPointer?? 41 //#include "DodgeRaceShip.h" // DO NOT include in Header. Will cause forward declaration issues 42 41 43 //#include "DodgeRaceHUDinfo.h" 42 //#include "DodgeRaceShip.h" 44 45 46 #include "core/CoreIncludes.h" 47 #include "core/EventIncludes.h" 48 #include "core/command/Executor.h" 49 #include "core/config/ConfigValueIncludes.h" 50 51 #include "gamestates/GSLevel.h" 52 #include "chat/ChatManager.h" 53 54 // ! HACK 55 #include "infos/PlayerInfo.h" 56 57 #include "core/command/ConsoleCommand.h" 58 #include "worldentities/BigExplosion.h" 43 59 44 60 #include "gametypes/Deathmatch.h" … … 48 64 { 49 65 50 class DodgeRace : public Deathmatch66 class _DodgeRaceExport DodgeRace : public Deathmatch 51 67 { 52 68 public: 53 69 DodgeRace(Context* context); 54 70 71 void init(); 72 55 73 virtual void start(); 56 virtual void end(); 57 virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command 74 //virtual void end(); 58 75 59 //void spawnEnemy(); 60 61 void setCenterpoint(DodgeRaceCenterPoint* center) 62 { this->center_ = center; } 76 void levelUp(); 63 77 64 78 int getLives(){return this->lives;} … … 67 81 int getMultiplier(){return this->multiplier;} 68 82 69 void costLife(); 70 void levelUp(); 71 void addPoints(int numPoints); 83 void setCenterpoint(DodgeRaceCenterPoint* center) 84 { this->center_ = center; } 72 85 73 86 // checks if multiplier should be reset. 74 87 void comboControll(); 75 void init(); 88 89 bool bEndGame; 90 bool bShowLevel; 76 91 int lives; 77 92 int multiplier; 78 bool bEndGame; 79 bool bShowLevel; 80 private: 93 94 private: 95 WeakPtr<DodgeRaceShip> getPlayer(); 96 WeakPtr<DodgeRaceShip> player; 81 97 void toggleShowLevel(){bShowLevel = !bShowLevel;} 82 WeakPtr<DodgeRaceShip> getPlayer(); 98 void addPoints(int numPoints); 99 83 100 WeakPtr<DodgeRaceCenterPoint> center_; 84 WeakPtr<DodgeRaceShip> player;85 86 Timer enemySpawnTimer;87 Timer comboTimer;88 Timer showLevelTimer;89 //Context* context;90 101 int level; 91 102 int point; 92 103 bool b_combo; 104 105 Timer enemySpawnTimer; 106 Timer comboTimer; 107 Timer showLevelTimer; 108 109 110 /* virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command 111 112 //void spawnEnemy(); 113 114 115 116 117 118 void costLife(); 119 120 121 122 123 124 125 private: 126 127 128 129 130 //Context* context; 131 */ 93 132 }; 94 133 } -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCenterPoint.h
r10117 r10118 45 45 namespace orxonox 46 46 { 47 class DodgeRaceCenterPoint : public StaticEntity47 class _DodgeRaceExport DodgeRaceCenterPoint : public StaticEntity 48 48 { 49 49 public: -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.cc
r10117 r10118 39 39 { 40 40 RegisterObject(DodgeRaceHUDinfo); 41 41 /* 42 42 this->DodgeRaceGame = 0; 43 43 this->bShowLives_ = false; 44 44 this->bShowLevel_ = false; 45 45 this->bShowPoints_ = false; 46 this->bShowMultiplier_ = false; 46 this->bShowMultiplier_ = false;*/ 47 47 } 48 48 /* 49 49 void DodgeRaceHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode) 50 50 { … … 134 134 this->DodgeRaceGame = 0; 135 135 } 136 } 136 }*/ 137 137 } -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.h
r10117 r10118 39 39 namespace orxonox 40 40 { 41 class DodgeRaceHUDinfo : public OverlayText, public Tickable41 class _DodgeRaceExport DodgeRaceHUDinfo : public OverlayText, public Tickable 42 42 { 43 43 public: 44 44 DodgeRaceHUDinfo(Context* context); 45 45 /* 46 46 virtual void tick(float dt); 47 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); … … 74 74 bool bShowLevel_; 75 75 bool bShowPoints_; 76 bool bShowMultiplier_; 76 bool bShowMultiplier_;*/ 77 77 }; 78 78 } -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h
r10117 r10118 75 75 //class DodgeRaceWeapon; 76 76 //class DodgeRaceWeaponEnemy; 77 class DodgeRaceHUDinfo;77 //class DodgeRaceHUDinfo; 78 78 } 79 79 -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc
r10117 r10118 34 34 #include "DodgeRaceShip.h" 35 35 36 #include "core/CoreIncludes.h"37 #include "core/XMLPort.h"38 //#include "DodgeRace.h"39 40 36 namespace orxonox 41 37 { … … 49 45 isFireing = false; 50 46 damping = 10; 47 48 lastTimeFront = 0; 49 lastTimeLeft = 0; 50 lastTime = 0; 51 51 } 52 52 … … 106 106 setPosition(pos); 107 107 setOrientation(Vector3::UNIT_Y, Degree(270)); 108 108 /* 109 109 // Level up! 110 110 if (pos.x > 42000) … … 113 113 setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0) 114 114 } 115 115 */ 116 116 SUPER(DodgeRaceShip, tick, dt); 117 117 } … … 139 139 isFireing = bBoost; 140 140 } 141 /* inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 141 /* 142 inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 142 143 { 143 144 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; … … 169 170 return false; 170 171 // SUPER(DodgeRaceShip, collidesAgainst, otherObject, contactPoint); 171 } */172 172 } 173 */ 173 174 WeakPtr<DodgeRace> DodgeRaceShip::getGame() 174 175 { … … 176 177 { 177 178 for (ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it) 178 game = *it; 179 { 180 game = *it; 181 } 179 182 } 180 183 return game; 181 184 } 182 185 /* 183 186 void DodgeRaceShip::death() 184 187 { 185 188 getGame()->costLife(); 186 189 SpaceShip::death(); 187 } 190 }*/ 188 191 } -
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.h
r10117 r10118 38 38 #include "dodgerace2/DodgeRacePrereqs.h" 39 39 40 #include "core/CoreIncludes.h" 41 #include "core/XMLPort.h" 40 42 #include "worldentities/pawns/SpaceShip.h" 41 43 #include "graphics/Camera.h" 42 44 #include "weapons/projectiles/Projectile.h" 43 //#include "DodgeRace.h" 45 46 #include "DodgeRace.h" // Is necessary for getGame function 44 47 //#include "DodgeRaceCenterPoint.h" 45 48 46 49 namespace orxonox 47 50 { 48 class DodgeRaceShip : public SpaceShip51 class _DodgeRaceExport DodgeRaceShip : public SpaceShip 49 52 { 50 53 public: … … 54 57 55 58 // overwrite for 2d movement 56 57 59 virtual void moveFrontBack(const Vector2& value); 60 virtual void moveRightLeft(const Vector2& value); 58 61 59 60 62 // Starts or stops fireing 63 virtual void boost(bool bBoost); 61 64 62 //no rotation! 63 virtual void rotateYaw(const Vector2& value){}; 64 virtual void rotatePitch(const Vector2& value){}; 65 //return to main menu if game has ended. 66 virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();}; 65 //no rotation! 66 virtual void rotateYaw(const Vector2& value){}; 67 virtual void rotatePitch(const Vector2& value){}; 67 68 68 virtual void updateLevel(); 69 //return to main menu if game has ended. 70 virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();}; 71 72 virtual void updateLevel(); 73 74 float speed, damping, posforeward; 75 bool isFireing; 76 77 private: 78 WeakPtr<DodgeRace> getGame(); 79 WeakPtr<DodgeRace> game; 80 Camera* camera; 81 float lastTimeFront, lastTimeLeft, lastTime; 82 struct Velocity 83 { 84 float x; 85 float y; 86 } velocity, desiredVelocity; 87 88 89 90 91 /* 92 69 93 70 94 //virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint); … … 74 98 75 99 private: 76 WeakPtr<DodgeRace> getGame(); 77 WeakPtr<DodgeRace> game; 78 Camera* camera; 79 bool isFireing; 80 float speed, damping, posforeward; 81 float lastTimeFront, lastTimeLeft, lastTime; 82 struct Velocity 83 { 84 float x; 85 float y; 86 } velocity, desiredVelocity; 100 101 102 103 104 105 87 106 88 107 // WeakPtr<DodgeRaceEnemy> lastEnemy; 89 WeakPtr<Projectile> lastShot; 108 WeakPtr<Projectile> lastShot;*/ 90 109 91 110 };
Note: See TracChangeset
for help on using the changeset viewer.