[Orxonox-commit 6273] r10930 - code/branches/hoverHS15/src/modules/hover
meierman at orxonox.net
meierman at orxonox.net
Mon Dec 7 14:32:47 CET 2015
Author: meierman
Date: 2015-12-07 14:32:47 +0100 (Mon, 07 Dec 2015)
New Revision: 10930
Modified:
code/branches/hoverHS15/src/modules/hover/Hover.cc
code/branches/hoverHS15/src/modules/hover/Hover.h
code/branches/hoverHS15/src/modules/hover/HoverFlag.cc
code/branches/hoverHS15/src/modules/hover/HoverFlag.h
code/branches/hoverHS15/src/modules/hover/HoverOrigin.cc
code/branches/hoverHS15/src/modules/hover/HoverOrigin.h
code/branches/hoverHS15/src/modules/hover/HoverWall.cc
code/branches/hoverHS15/src/modules/hover/HoverWall.h
Log:
Finished with comments
Modified: code/branches/hoverHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.cc 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/Hover.cc 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Manuel Meier
* Co-authors:
- * ...
+ * Cyrill Muskelprotz
*
*/
/**
@file Hover.cc
- @brief Implementation of the Hover class.
+ @brief Implementation of the Hover class. Sets up the whole Minigame
*/
//#include "orxonox/worldentities/pawns/SpaceShip.h"
@@ -50,6 +50,12 @@
namespace orxonox
{
bool firstTick = true;
+
+ //Levelcode represents the pitch: It's a 10x10 field.
+ // 1 represents a Wall on the right side of this square
+ // 2 represents a Wall on the top of this square
+ // 3 represents 2 and 1 at the same time
+ // Note: the levelcode is generated from the Maze-Generator functions at the beginning of the game
int levelcode[10][10] =
{
{ 0,0,0,0,0,0,0,0,0,0 },
@@ -121,9 +127,7 @@
g_PtX=0;
g_PtY=0;
GenerateMaze();
- MazeOut();
RenderMaze();
- LevelOut();
firstTick = false;
//Outer Walls
@@ -134,6 +138,7 @@
new HoverWall(origin_->getContext(), i+1, 10, 2);
}
+ //Generate inner Walls according to levelcode
for(int y=0; y<10; y++){
for(int x=0; x<10; x++){
switch(levelcode[y][x]){
@@ -149,16 +154,15 @@
}
}
-
+ //Generate 5 flags randomly
for ( int i = 0; i < 5; i++ )
flagVector.push_back(new HoverFlag(origin_->getContext(), rand()%10, rand()%10));
Flags_ = flagVector.size();
-
- //new HoverFlag(origin_->getContext()); //Rechts in Y Richtung
- //new HoverWall(origin_->getContext(), 5, 6, 0); //Ueber in x richtung
- //new HoverWall(origin_->getContext(), 5, 5, 0); //Ueber in x richtung
- }
+
+ }//firsttick end
+
+ // Check if ship collided with one of the flags
for ( int i = 0; i < flagVector.size(); i++ ){
if(flagVector[i]->getCollided()){
flagVector[i]->destroyLater();
@@ -199,9 +203,8 @@
- ////////////////////////////////////////////////////////////////////////////
+ // Some definitions for the Maze-Generator
-
// 0 1 2 3 4 5 6 7 8
// U R D L
int Heading_X[9] = { 0, 0,+1, 0, 0, 0, 0, 0,-1 };
@@ -219,8 +222,10 @@
};
- ////////////////////////////////////////////////////////////////////////////
-
+ /**
+ @brief
+ Checks if Direction is valid (for Maze-Generator)
+ */
bool Hover::IsDirValid( eDirection Dir )
{
int NewX = g_PtX + Heading_X[ Dir ];
@@ -231,6 +236,10 @@
return !g_Maze[ NewX + NumCells * NewY ];
}
+ /**
+ @brief
+ Generates new Direction (for Maze-Generator)
+ */
eDirection Hover::GetDirection()
{
eDirection Dir = eDirection( 1 << RandomInt4() );
@@ -258,15 +267,16 @@
}
}
+ /**
+ @brief
+ Generates a Maze (for Maze-Generator)
+ */
void Hover::GenerateMaze()
{
int Cells = 0;
for ( eDirection Dir = GetDirection(); Dir != eDirection_Invalid; Dir = GetDirection() )
{
- // a progress indicator, kind of
- // if ( ++Cells % 1000 == 0 ) std::cout << ".";
-
g_Maze[ CellIdx() ] |= Dir;
g_PtX += Heading_X[ Dir ];
@@ -274,11 +284,12 @@
g_Maze[ CellIdx() ] = Mask[ Dir ];
}
-
- std::cout << std::endl;
}
-
+ /**
+ @brief
+ Print Maze (for Debugging only)
+ */
void Hover::MazeOut(){
for ( int y = 0; y < NumCells; y++ )
{
@@ -301,12 +312,16 @@
}
+ /**
+ @brief
+ Print Levelcode (for Debugging only)
+ */
void Hover::LevelOut(){
for ( int y = 0; y < NumCells; y++ )
{
for ( int x = 0; x < NumCells; x++ )
{
- /*orxout()<<"[";
+ orxout()<<"[";
if ( levelcode[x][y] < 2) orxout()<<"U";
else orxout()<<" ";
if ( levelcode[x][y] % 2 == 0) orxout()<<"R";
@@ -314,17 +329,16 @@
orxout()<<" ";
orxout()<<" ";
- orxout()<<"]";*/
-
- orxout()<<levelcode[x][y];
+ orxout()<<"]";
}
orxout()<<endl;
}
-
-
-
}
+ /**
+ @brief
+ Generate Levelcode from Maze
+ */
void Hover::RenderMaze()
{
for ( int y = 0; y < NumCells; y++ )
@@ -335,8 +349,6 @@
if ( !( v & eDirection_Up ) && y >0) levelcode[y][x] |= 2;
if ( !( v & eDirection_Right ) && x <9) levelcode[y][x] |= 1;
- //if ( !( v & eDirection_Down ) && y>0) levelcode[x][y-1] += 2;
- //if ( !( v & eDirection_Left ) && x>0) levelcode[x-1][y] += 1;
}
}
for ( int y = 3; y < 7; y++ )
Modified: code/branches/hoverHS15/src/modules/hover/Hover.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.h 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/Hover.h 2015-12-07 13:32:47 UTC (rev 10930)
@@ -19,16 +19,16 @@
* 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
+ * Master of Desaster:
+ * Manuel Meier
* Co-authors:
- * ...
+ * Cyrill Muskelprotz
*
*/
/**
@file Hover.h
- @brief Gametype.
+ @brief Gametype. For more information see .cc file
@ingroup Hover
*/
@@ -36,11 +36,8 @@
#define _Hover_H__
#include "HoverPrereqs.h"
-#include "HoverOrigin.h" // Necessary for WeakPointer
-//#include "HoverShip.h" DO NOT include in Header. Will cause forward declaration issues
+#include "HoverOrigin.h"
-//#include "HoverHUDinfo.h"
-
#include "gametypes/Gametype.h"
#include "core/EventIncludes.h"
#include "core/command/Executor.h"
@@ -79,11 +76,8 @@
virtual void start();
virtual void end();
- virtual void tick(float dt);
+ virtual void tick(float dt);
- // void setOrigin(HoverOrigin* center)
- // { center_ = center; }
-
void setOrigin(HoverOrigin* origin)
{ this->origin_ = origin; }
Modified: code/branches/hoverHS15/src/modules/hover/HoverFlag.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverFlag.cc 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverFlag.cc 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
@@ -28,7 +28,7 @@
/**
@file HoverFlag.cc
- @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes.
+ @brief The Flags that are being set in the Hover Minigame They support two coordinates from 0-9 each
*/
#include "HoverFlag.h"
@@ -55,6 +55,14 @@
cs_ = NULL;
}
+ /**
+ @brief
+ Constructor that expects two coordinate-values in the range 0-9
+ @param xCoordinate
+ X-Coordinate of the flage, 0-9, origin is bottom left
+ @param yCoordinate
+ Y-Coordinate of the flage, 0-9, origin is bottom left
+ */
HoverFlag::HoverFlag(Context* context, int xCoordinate, int yCoordinate) : StaticEntity(context)
{
RegisterObject(HoverFlag);
@@ -91,7 +99,7 @@
}
- //xml port for loading height and width of the platform
+ //xml port unused
void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(HoverFlag, XMLPort, xmlelement, mode);
@@ -103,7 +111,6 @@
/**
@brief
Is called every tick.
- Handles the movement of the ball and its interaction with the boundaries and bats.
@param dt
The time since the last tick.
*/
@@ -113,6 +120,10 @@
}
+ /**
+ @brief
+ Checks if the Hovership collided with the flag
+ */
bool HoverFlag::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
{
if(otherObject->isA(Class(HoverShip)))
Modified: code/branches/hoverHS15/src/modules/hover/HoverFlag.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverFlag.h 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverFlag.h 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
@@ -28,8 +28,8 @@
/**
@file HoverFlag.h
- @brief Declaration of the HoverFlag class.
- @ingroup Jump
+ @brief See .cc File
+ @ingroup Hover
*/
#ifndef _HoverFlag_H__
Modified: code/branches/hoverHS15/src/modules/hover/HoverOrigin.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverOrigin.cc 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverOrigin.cc 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
Modified: code/branches/hoverHS15/src/modules/hover/HoverOrigin.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverOrigin.h 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverOrigin.h 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
Modified: code/branches/hoverHS15/src/modules/hover/HoverWall.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverWall.cc 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverWall.cc 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
@@ -28,7 +28,7 @@
/**
@file HoverWall.cc
- @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes.
+ @brief Represents one Wall piece in the Hover Game
*/
#include "HoverWall.h"
@@ -53,6 +53,17 @@
cs_ = NULL;
}
+
+ /**
+ @brief
+ Constructor of a HoverWall
+ @param x
+ x-Coordinate of the Square that the Wall is attached to, 0-9, Origin is Bottom left
+ @param y
+ y-Coordinate of the Square that the Wall is attached to, 0-9, Origin is Bottom left
+ @param orientation
+ Wall on the right side (1) or on top (2) of this square, 0-1
+ */
HoverWall::HoverWall(Context* context, int x, int y, int orientation) : StaticEntity(context)
{
RegisterObject(HoverWall);
@@ -100,13 +111,10 @@
}
- //xml port for loading height and width of the platform
+ //xml port for loading height and width of the platform, unused
void HoverWall::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(HoverWall, XMLPort, xmlelement, mode);
-
- // XMLPortParam(HoverWall, "height", setHeight, getHeight, xmlelement, mode);
- //XMLPortParam(HoverWall, "width", setWidth, getWidth, xmlelement, mode);
}
/**
Modified: code/branches/hoverHS15/src/modules/hover/HoverWall.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverWall.h 2015-12-07 13:26:27 UTC (rev 10929)
+++ code/branches/hoverHS15/src/modules/hover/HoverWall.h 2015-12-07 13:32:47 UTC (rev 10930)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Manuel Meier
* Co-authors:
* ...
*
@@ -28,8 +28,8 @@
/**
@file HoverWall.h
- @brief Declaration of the HoverWall class.
- @ingroup Jump
+ @brief See .cc-file for further information
+ @ingroup Hover
*/
#ifndef _HoverWall_H__
More information about the Orxonox-commit
mailing list