[Orxonox-commit 5573] r10236 - code/branches/surfaceraceHS14/src/modules/dodgerace
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 1 15:56:21 CET 2015
Author: landauf
Date: 2015-02-01 15:56:21 +0100 (Sun, 01 Feb 2015)
New Revision: 10236
Modified:
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceCube.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceHUDinfo.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.cc
code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.h
Log:
replaced tabs with spaces. no changes in code.
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.cc 2015-02-01 14:56:21 UTC (rev 10236)
@@ -87,53 +87,53 @@
void DodgeRace::tick(float dt)
{
- if (getPlayer() != NULL)
- {
- //WeakPtr<DodgeRaceShip> ship = getPlayer();
+ if (getPlayer() != NULL)
+ {
+ //WeakPtr<DodgeRaceShip> ship = getPlayer();
- currentPosition = getPlayer()->getWorldPosition().x;
- counter = counter + (currentPosition - lastPosition);
- lastPosition = currentPosition;
- point = (int) currentPosition;
- getPlayer()->speed = 830.0f - (point / 1000);
+ currentPosition = getPlayer()->getWorldPosition().x;
+ counter = counter + (currentPosition - lastPosition);
+ lastPosition = currentPosition;
+ point = (int) currentPosition;
+ getPlayer()->speed = 830.0f - (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);
- }
- }
+ 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;
+ 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.0f, 0.0f, -3600.0f + (i*1200)));
- //stEntity->setScale3D(50,50,50);
- }
+ cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000.0f, 0.0f, -3600.0f + (i*1200)));
+ //stEntity->setScale3D(50,50,50);
+ }
- pattern %= 2;
- pattern ++;
+ pattern %= 2;
+ pattern ++;
- }
+ }
- }
- SUPER(DodgeRace, tick, dt);
+ }
+ SUPER(DodgeRace, tick, dt);
}
WeakPtr<DodgeRaceShip> DodgeRace::getPlayer()
@@ -142,7 +142,7 @@
{
for (ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)
{
- player = *it;
+ player = *it;
}
}
return player;
@@ -150,8 +150,8 @@
void DodgeRace::costLife()
{
- //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
- lives = 0;
+ //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
+ lives = 0;
};
void DodgeRace::comboControll()
@@ -166,14 +166,14 @@
void DodgeRace::start()
{
- orxout() << "start" << endl;
+ orxout() << "start" << endl;
init();
- for(unsigned int i=0; i< cubeList.size();i++)
- {
- cubeList.at(i)->destroy();
- cubeList.erase(cubeList.begin()+i);
+ 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;
@@ -188,28 +188,28 @@
Deathmatch::start();
}
- void DodgeRace::playerPreSpawn(PlayerInfo* player)
- {
- if(lives <= 0)
- {
- this->end();
- }
+ 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();
+ // 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)
{
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h 2015-02-01 14:56:21 UTC (rev 10236)
@@ -38,7 +38,7 @@
#include "dodgerace/DodgeRacePrereqs.h"
#include "DodgeRaceCenterPoint.h" // Necessary for WeakPointer??
-//#include "DodgeRaceShip.h" DO NOT include in Header. Will cause forward declaration issues
+//#include "DodgeRaceShip.h" DO NOT include in Header. Will cause forward declaration issues
//#include "DodgeRaceHUDinfo.h"
@@ -117,8 +117,8 @@
bool b_combo;
Timer enemySpawnTimer;
- Timer comboTimer;
- Timer showLevelTimer;
+ Timer comboTimer;
+ Timer showLevelTimer;
/*
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceCube.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceCube.cc 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceCube.cc 2015-02-01 14:56:21 UTC (rev 10236)
@@ -35,12 +35,12 @@
namespace orxonox
{
- RegisterClass(DodgeRaceCube);
+ RegisterClass(DodgeRaceCube);
- DodgeRaceCube::DodgeRaceCube(Context* context) : MovableEntity(context)
- {
- RegisterObject(DodgeRaceCube);
- }
+ DodgeRaceCube::DodgeRaceCube(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(DodgeRaceCube);
+ }
}
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceHUDinfo.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceHUDinfo.cc 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceHUDinfo.cc 2015-02-01 14:56:21 UTC (rev 10236)
@@ -55,24 +55,24 @@
SUPER(DodgeRaceHUDinfo, tick, dt);
- if(this->bShowPoints_)
- {
- const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
- if (this->DodgeRaceGame->lives <= 0)
- {
- setTextSize(0.2);
- setPosition(Vector2(0.1, 0.02));
- this->setCaption("Final score:\n" + points);
- this->setColour(ColourValue(1, 0, 0, 1));
- }
- else
- {
- setTextSize(0.04);
- setPosition(Vector2(0.14, 0.02));
- this->setColour(ColourValue(1, 1, 1, 1));
- this->setCaption(points);
- }
- }
+ if(this->bShowPoints_)
+ {
+ const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
+ if (this->DodgeRaceGame->lives <= 0)
+ {
+ setTextSize(0.2);
+ setPosition(Vector2(0.1, 0.02));
+ this->setCaption("Final score:\n" + points);
+ this->setColour(ColourValue(1, 0, 0, 1));
+ }
+ else
+ {
+ setTextSize(0.04);
+ setPosition(Vector2(0.14, 0.02));
+ this->setColour(ColourValue(1, 1, 1, 1));
+ this->setCaption(points);
+ }
+ }
}
void DodgeRaceHUDinfo::changedOwner()
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.cc 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.cc 2015-02-01 14:56:21 UTC (rev 10236)
@@ -100,7 +100,7 @@
// bring back on track!
if(pos.y != 0)
{
- pos.y = 0;
+ pos.y = 0;
}
setPosition(pos);
@@ -125,15 +125,15 @@
void DodgeRaceShip::moveFrontBack(const Vector2& value)
{
- //lastTimeFront = 0;
- //desiredVelocity.y = value.y * speed * 42;
+ //lastTimeFront = 0;
+ //desiredVelocity.y = value.y * speed * 42;
}
void DodgeRaceShip::moveRightLeft(const Vector2& value)
{
- lastTimeLeft = 0;
- desiredVelocity.x = value.x * speed;
+ lastTimeLeft = 0;
+ desiredVelocity.x = value.x * speed;
}
void DodgeRaceShip::boost(bool bBoost)
{
@@ -143,8 +143,8 @@
inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- removeHealth(100);
- this->death();
+ removeHealth(100);
+ this->death();
return false;
}
@@ -154,7 +154,7 @@
{
for (ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)
{
- game = *it;
+ game = *it;
}
}
return game;
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.h 2015-02-01 14:43:14 UTC (rev 10235)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.h 2015-02-01 14:56:21 UTC (rev 10236)
@@ -56,20 +56,20 @@
virtual void tick(float dt);
// overwrite for 2d movement
- virtual void moveFrontBack(const Vector2& value);
- virtual void moveRightLeft(const Vector2& value);
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
- // Starts or stops fireing
- virtual void boost(bool bBoost);
+ // Starts or stops fireing
+ virtual void boost(bool bBoost);
- //no rotation!
- virtual void rotateYaw(const Vector2& value){};
- virtual void rotatePitch(const Vector2& value){};
+ //no rotation!
+ virtual void rotateYaw(const Vector2& value){};
+ virtual void rotatePitch(const Vector2& value){};
- //return to main menu if game has ended.
- virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
+ //return to main menu if game has ended.
+ virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
- virtual void updateLevel();
+ virtual void updateLevel();
float speed, damping, posforeward;
bool isFireing;
@@ -87,8 +87,8 @@
float lastTimeFront, lastTimeLeft, lastTime;
struct Velocity
{
- float x;
- float y;
+ float x;
+ float y;
} velocity, desiredVelocity;
};
More information about the Orxonox-commit
mailing list