[Orxonox-commit 5558] r10221 - in code/branches/presentationHS14/src/modules: . dodgerace
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 1 13:39:16 CET 2015
Author: landauf
Date: 2015-02-01 13:39:16 +0100 (Sun, 01 Feb 2015)
New Revision: 10221
Added:
code/branches/presentationHS14/src/modules/dodgerace/
code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc
Removed:
code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc
code/branches/presentationHS14/src/modules/dodgerace2/
Modified:
code/branches/presentationHS14/src/modules/CMakeLists.txt
code/branches/presentationHS14/src/modules/dodgerace/CMakeLists.txt
code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.h
code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCenterPoint.h
code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCube.h
code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceHUDinfo.h
code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceShip.h
Log:
renamed module: dodgerace2 -> dodgerace (this also fixes build on MSVC because of inconsistent macro definition in DodgeRacePrereqs.h)
Modified: code/branches/presentationHS14/src/modules/CMakeLists.txt
===================================================================
--- code/branches/presentationHS14/src/modules/CMakeLists.txt 2015-02-01 12:37:29 UTC (rev 10220)
+++ code/branches/presentationHS14/src/modules/CMakeLists.txt 2015-02-01 12:39:16 UTC (rev 10221)
@@ -40,4 +40,4 @@
ADD_SUBDIRECTORY(towerdefense)
ADD_SUBDIRECTORY(invader)
ADD_SUBDIRECTORY(mini4Dgame)
-ADD_SUBDIRECTORY(dodgerace2)
+ADD_SUBDIRECTORY(dodgerace)
Modified: code/branches/presentationHS14/src/modules/dodgerace/CMakeLists.txt
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/CMakeLists.txt 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/CMakeLists.txt 2015-02-01 12:39:16 UTC (rev 10221)
@@ -1,17 +1,17 @@
-SET_SOURCE_FILES(Dodgerace2_SRC_FILES
-DodgeRace.cc
-DodgeRaceCenterPoint.cc
-DodgeRaceShip.cc
-DodgeRaceCube.cc
-DodgeRaceHUDinfo.cc
-)
-
-ORXONOX_ADD_LIBRARY(dodgerace2
- MODULE
- FIND_HEADER_FILES
- LINK_LIBRARIES
- orxonox
- overlays
- weapons
- SOURCE_FILES ${Dodgerace2_SRC_FILES}
-)
+SET_SOURCE_FILES(Dodgerace_SRC_FILES
+DodgeRace.cc
+DodgeRaceCenterPoint.cc
+DodgeRaceShip.cc
+DodgeRaceCube.cc
+DodgeRaceHUDinfo.cc
+)
+
+ORXONOX_ADD_LIBRARY(dodgerace
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ weapons
+ SOURCE_FILES ${Dodgerace_SRC_FILES}
+)
Deleted: code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRace.cc 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc 2015-02-01 12:39:16 UTC (rev 10221)
@@ -1,231 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Florian Zinggeler
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DodgeRace.cc
- @brief Implementation of the DodgeRace class.
-*/
-
-#include "DodgeRace.h"
-#include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header!
-#include "DodgeRaceCube.h"
-
-namespace orxonox
-{
- RegisterUnloadableClass(DodgeRace);
-
- DodgeRace::DodgeRace(Context* context) : Deathmatch(context)
- {
- RegisterObject(DodgeRace);
- init();
- this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
- this->center_ = 0;
-
- this->setHUDTemplate("DodgeRaceHUD");
- }
-
- void DodgeRace::init()
- {
- bEndGame = false;
- lives = 1;
- level = 1;
- point = 0;
- bShowLevel = false;
- multiplier = 1;
- b_combo = false;
- counter = 5000;
- pattern = 1;
- lastPosition = 0;
- // spawn enemy every 3.5 seconds
- //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this)));
- comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this)));
- }
-
- void DodgeRace::levelUp()
- {
- level++;
- if (getPlayer() != NULL)
- {
- for (int i = 0; i < 7; i++)
- {
- WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
- chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
- chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity()
- chunk->setScale(20);
- }
- }
- addPoints(multiplier * 42);
- multiplier *= 2;
- toggleShowLevel();
- showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&DodgeRace::toggleShowLevel, this)));
- }
-
- void DodgeRace::tick(float dt)
- {
- if (getPlayer() != NULL)
- {
- //WeakPtr<DodgeRaceShip> ship = getPlayer();
-
- currentPosition = getPlayer()->getWorldPosition().x;
- counter = counter + (currentPosition - lastPosition);
- lastPosition = currentPosition;
- point = currentPosition;
- getPlayer()->speed = 830 - (point / 1000);
-
- for(uint i=0; i < cubeList.size();i++)
- {
- if(cubeList.at(i)->getPosition().x < currentPosition-3000)
- {
- cubeList.at(i)->destroy();
- cubeList.erase(cubeList.begin()+i);
- }
- }
-
- if(counter >= 3000)
- {
- counter = 0;
- for(int i = 0; i<6; i++)
- {
- WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
- cubeList.push_back(cube);
- switch(pattern)
- {
- case 1: cube->addTemplate("DodgeRaceCube01");
- break;
- case 2: cube->addTemplate("DodgeRaceCube02");
- break;
-
- }
-
- cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, -3600 + (i*1200)));
- //stEntity->setScale3D(50,50,50);
- }
-
-
- pattern %= 2;
- pattern ++;
-
- }
-
- }
- SUPER(DodgeRace, tick, dt);
- }
-
- WeakPtr<DodgeRaceShip> DodgeRace::getPlayer()
- {
- if (player == NULL)
- {
- for (ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)
- {
- player = *it;
- }
- }
- return player;
- }
-
- void DodgeRace::costLife()
- {
- //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
- lives = 0;
- };
-
- void DodgeRace::comboControll()
- {
- if (b_combo)
- multiplier++;
- // if no combo was performed before, reset multiplier
- else
- multiplier = 1;
- b_combo = false;
- }
-
- void DodgeRace::start()
- {
- orxout() << "start" << endl;
- init();
- for(uint i=0; i< cubeList.size();i++)
- {
- cubeList.at(i)->destroy();
- cubeList.erase(cubeList.begin()+i);
-
- }
- cubeList.clear();
- // Set variable to temporarily force the player to spawn.
- this->bForceSpawn_ = false;
-
- if (this->center_ == NULL) // abandon mission!
- {
- orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
- GSLevel::startMainMenu();
- return;
- }
- // Call start for the parent class.
- Deathmatch::start();
- }
-
- void DodgeRace::playerPreSpawn(PlayerInfo* player)
- {
- if(lives <= 0)
- {
- this->end();
- }
-
- // Reset all the cubes
- /*
- orxout() << "prespawn" << endl;
- init();
- for(int i=0; i< cubeList.size();i++)
- {
- cubeList.at(i)->destroy();
- cubeList.erase(cubeList.begin()+i);
- }
- cubeList.clear();
- lives = 1;
- point = 0;
- lastPosition = 0;
- */
- }
-
- void DodgeRace::addPoints(int numPoints)
- {
- if (!bEndGame)
- {
- point += numPoints * multiplier;
- b_combo = true;
- }
- }
-
- void DodgeRace::end()
- {
- // DON'T CALL THIS!
- // Deathmatch::end();
- // It will misteriously crash the game!
- // Instead startMainMenu, this won't crash.
- GSLevel::startMainMenu();
- }
-}
Copied: code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc (from rev 10219, code/branches/presentationHS14/src/modules/dodgerace2/DodgeRace.cc)
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc (rev 0)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.cc 2015-02-01 12:39:16 UTC (rev 10221)
@@ -0,0 +1,231 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DodgeRace.cc
+ @brief Implementation of the DodgeRace class.
+*/
+
+#include "DodgeRace.h"
+#include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header!
+#include "DodgeRaceCube.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(DodgeRace);
+
+ DodgeRace::DodgeRace(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(DodgeRace);
+ init();
+ this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
+ this->center_ = 0;
+
+ this->setHUDTemplate("DodgeRaceHUD");
+ }
+
+ void DodgeRace::init()
+ {
+ bEndGame = false;
+ lives = 1;
+ level = 1;
+ point = 0;
+ bShowLevel = false;
+ multiplier = 1;
+ b_combo = false;
+ counter = 5000;
+ pattern = 1;
+ lastPosition = 0;
+ // spawn enemy every 3.5 seconds
+ //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this)));
+ comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this)));
+ }
+
+ void DodgeRace::levelUp()
+ {
+ level++;
+ if (getPlayer() != NULL)
+ {
+ for (int i = 0; i < 7; i++)
+ {
+ WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
+ chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
+ chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity()
+ chunk->setScale(20);
+ }
+ }
+ addPoints(multiplier * 42);
+ multiplier *= 2;
+ toggleShowLevel();
+ showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&DodgeRace::toggleShowLevel, this)));
+ }
+
+ void DodgeRace::tick(float dt)
+ {
+ if (getPlayer() != NULL)
+ {
+ //WeakPtr<DodgeRaceShip> ship = getPlayer();
+
+ currentPosition = getPlayer()->getWorldPosition().x;
+ counter = counter + (currentPosition - lastPosition);
+ lastPosition = currentPosition;
+ point = currentPosition;
+ getPlayer()->speed = 830 - (point / 1000);
+
+ for(unsigned int i=0; i < cubeList.size();i++)
+ {
+ if(cubeList.at(i)->getPosition().x < currentPosition-3000)
+ {
+ cubeList.at(i)->destroy();
+ cubeList.erase(cubeList.begin()+i);
+ }
+ }
+
+ if(counter >= 3000)
+ {
+ counter = 0;
+ for(int i = 0; i<6; i++)
+ {
+ WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
+ cubeList.push_back(cube);
+ switch(pattern)
+ {
+ case 1: cube->addTemplate("DodgeRaceCube01");
+ break;
+ case 2: cube->addTemplate("DodgeRaceCube02");
+ break;
+
+ }
+
+ cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, -3600 + (i*1200)));
+ //stEntity->setScale3D(50,50,50);
+ }
+
+
+ pattern %= 2;
+ pattern ++;
+
+ }
+
+ }
+ SUPER(DodgeRace, tick, dt);
+ }
+
+ WeakPtr<DodgeRaceShip> DodgeRace::getPlayer()
+ {
+ if (player == NULL)
+ {
+ for (ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)
+ {
+ player = *it;
+ }
+ }
+ return player;
+ }
+
+ void DodgeRace::costLife()
+ {
+ //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
+ lives = 0;
+ };
+
+ void DodgeRace::comboControll()
+ {
+ if (b_combo)
+ multiplier++;
+ // if no combo was performed before, reset multiplier
+ else
+ multiplier = 1;
+ b_combo = false;
+ }
+
+ void DodgeRace::start()
+ {
+ orxout() << "start" << endl;
+ init();
+ for(unsigned int i=0; i< cubeList.size();i++)
+ {
+ cubeList.at(i)->destroy();
+ cubeList.erase(cubeList.begin()+i);
+
+ }
+ cubeList.clear();
+ // Set variable to temporarily force the player to spawn.
+ this->bForceSpawn_ = false;
+
+ if (this->center_ == NULL) // abandon mission!
+ {
+ orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
+ GSLevel::startMainMenu();
+ return;
+ }
+ // Call start for the parent class.
+ Deathmatch::start();
+ }
+
+ void DodgeRace::playerPreSpawn(PlayerInfo* player)
+ {
+ if(lives <= 0)
+ {
+ this->end();
+ }
+
+ // Reset all the cubes
+ /*
+ orxout() << "prespawn" << endl;
+ init();
+ for(int i=0; i< cubeList.size();i++)
+ {
+ cubeList.at(i)->destroy();
+ cubeList.erase(cubeList.begin()+i);
+ }
+ cubeList.clear();
+ lives = 1;
+ point = 0;
+ lastPosition = 0;
+ */
+ }
+
+ void DodgeRace::addPoints(int numPoints)
+ {
+ if (!bEndGame)
+ {
+ point += numPoints * multiplier;
+ b_combo = true;
+ }
+ }
+
+ void DodgeRace::end()
+ {
+ // DON'T CALL THIS!
+ // Deathmatch::end();
+ // It will misteriously crash the game!
+ // Instead startMainMenu, this won't crash.
+ GSLevel::startMainMenu();
+ }
+}
Modified: code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.h
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRace.h 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRace.h 2015-02-01 12:39:16 UTC (rev 10221)
@@ -35,7 +35,7 @@
#ifndef _DodgeRace_H__
#define _DodgeRace_H__
-#include "dodgerace2/DodgeRacePrereqs.h"
+#include "dodgerace/DodgeRacePrereqs.h"
#include "DodgeRaceCenterPoint.h" // Necessary for WeakPointer??
//#include "DodgeRaceShip.h" DO NOT include in Header. Will cause forward declaration issues
Modified: code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCenterPoint.h
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRaceCenterPoint.h 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCenterPoint.h 2015-02-01 12:39:16 UTC (rev 10221)
@@ -35,7 +35,7 @@
#ifndef _DodgeRaceCenterPoint_H__
#define _DodgeRaceCenterPoint_H__
-#include "dodgerace2/DodgeRacePrereqs.h"
+#include "dodgerace/DodgeRacePrereqs.h"
//#include "DodgeRace.h"
//#include "DodgeRaceHUDinfo.h"
Modified: code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCube.h
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRaceCube.h 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceCube.h 2015-02-01 12:39:16 UTC (rev 10221)
@@ -35,7 +35,7 @@
#ifndef _DodgeRaceCube_H__
#define _DodgeRaceCube_H__
-#include "dodgerace2/DodgeRacePrereqs.h"
+#include "dodgerace/DodgeRacePrereqs.h"
#include "worldentities/MovableEntity.h"
Modified: code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceHUDinfo.h
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.h 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceHUDinfo.h 2015-02-01 12:39:16 UTC (rev 10221)
@@ -31,7 +31,7 @@
#include "DodgeRace.h"
//#include "DodgeRaceCenterPoint.h"
-#include "dodgerace2/DodgeRacePrereqs.h"
+#include "dodgerace/DodgeRacePrereqs.h"
#include "tools/interfaces/Tickable.h"
#include "overlays/OverlayText.h"
Modified: code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceShip.h
===================================================================
--- code/branches/presentationHS14/src/modules/dodgerace2/DodgeRaceShip.h 2015-01-25 22:15:24 UTC (rev 10203)
+++ code/branches/presentationHS14/src/modules/dodgerace/DodgeRaceShip.h 2015-02-01 12:39:16 UTC (rev 10221)
@@ -35,7 +35,7 @@
#define _DodgeRaceShip_H__
-#include "dodgerace2/DodgeRacePrereqs.h"
+#include "dodgerace/DodgeRacePrereqs.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
More information about the Orxonox-commit
mailing list