[Orxonox-commit 7450] r12057 - in code/branches/OrxoKart_HS18: data/levels src/modules src/modules/orxokart
ottka at orxonox.net
ottka at orxonox.net
Wed Oct 24 11:43:55 CEST 2018
Author: ottka
Date: 2018-10-24 11:43:55 +0200 (Wed, 24 Oct 2018)
New Revision: 12057
Added:
code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
code/branches/OrxoKart_HS18/src/modules/orxokart/
code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.h
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.h
Log:
rainbow road testing
Added: code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
===================================================================
--- code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw (rev 0)
+++ code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,411 @@
+<LevelInfo
+ name = "Hover 2"
+ description = "Level for Minigame Hover"
+ tags = "minigame"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipHover.oxt")
+ include("overlays/HoverHUD.oxo")
+?>
+
+<?lua
+MAZE_NUM_CELLS = 10
+MAZE_CELL_SIZE = 100
+MAZE_CELL_HEIGHT = 30
+MAZE_SIZE = MAZE_NUM_CELLS*MAZE_CELL_SIZE
+--number of tiles
+N = 11
+--scaling factor
+S = 250
+
+MAP_ORIGIN = "0,0,0"
+?>
+
+<Level
+plugins = hover
+gametype = Hover
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ gravity = "0, -200, 0"
+ >
+
+ <StaticEntity position="0,0,0" collisionType="static">
+ <attached>
+ <!-- Walls and flags (physics and design)-->
+ <!--
+ <HoverOrigin
+ numCells="<?lua print(MAZE_NUM_CELLS)?>"
+ cellSize="<?lua print(MAZE_CELL_SIZE)?>"
+ cellHeight="<?lua print(MAZE_CELL_HEIGHT)?>"
+ />
+ -->
+
+ <!-- floor design -->
+
+
+
+
+
+
+
+ <Model
+ position="<?lua print((N-1)*S/2)?>,0,<?lua print((N-1)*S/2)?>"
+
+ scale3D="<?lua print(S)?>,8,<?lua print(S)?>"
+ mesh="teststrecke.mesh"
+ />
+
+
+ </attached>
+ <collisionShapes>
+ <!-- roof physics -->
+ <!--
+ <BoxCollisionShape
+ position="<?lua print(MAZE_SIZE/2)?>,<?lua print(MAZE_CELL_HEIGHT+1)?>,<?lua print(MAZE_SIZE/2)?>"
+ halfExtents="<?lua print(MAZE_SIZE/2)?>,1,<?lua print(MAZE_SIZE/2)?>"
+ />
+ -->
+ <!-- floor physics -->
+
+<!-- tile number 0-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 1-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(1*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 2-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(2*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 3-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(3*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 4-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 5-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(5*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 6-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(6*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 7-->
+<BoxCollisionShape
+position="<?lua print((N-1-0)*S) ?>,-1, <?lua print(7*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 8-->
+<BoxCollisionShape
+position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 9-->
+<BoxCollisionShape
+position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(7*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 10-->
+<BoxCollisionShape
+position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 11-->
+<BoxCollisionShape
+position="<?lua print((N-1-1)*S) ?>,-1, <?lua print(9*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 12-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 13-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(2*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 14-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(3*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 15-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 16-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(5*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 17-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(9*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 18-->
+<BoxCollisionShape
+position="<?lua print((N-1-2)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 19-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 20-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(1*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 21-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(2*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 22-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(5*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 23-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(6*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 24-->
+<BoxCollisionShape
+position="<?lua print((N-1-3)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 25-->
+<BoxCollisionShape
+position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(6*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 26-->
+<BoxCollisionShape
+position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 27-->
+<BoxCollisionShape
+position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(9*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 28-->
+<BoxCollisionShape
+position="<?lua print((N-1-4)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 29-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 30-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(1*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 31-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(2*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 32-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(3*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 33-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 34-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(5*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 35-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(6*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 36-->
+<BoxCollisionShape
+position="<?lua print((N-1-5)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 37-->
+<BoxCollisionShape
+position="<?lua print((N-1-6)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 38-->
+<BoxCollisionShape
+position="<?lua print((N-1-6)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 39-->
+<BoxCollisionShape
+position="<?lua print((N-1-7)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 40-->
+<BoxCollisionShape
+position="<?lua print((N-1-7)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 41-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(0*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 42-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(1*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 43-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(2*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 44-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(3*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 45-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 46-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 47-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(9*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 48-->
+<BoxCollisionShape
+position="<?lua print((N-1-8)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 49-->
+<BoxCollisionShape
+position="<?lua print((N-1-9)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 50-->
+<BoxCollisionShape
+position="<?lua print((N-1-9)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 51-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(4*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 52-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(5*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 53-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(6*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 54-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(7*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 55-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(8*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 56-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(9*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+<!-- tile number 57-->
+<BoxCollisionShape
+position="<?lua print((N-1-10)*S) ?>,-1, <?lua print(10*S) ?>"
+halfExtents="<?lua print(S/2) ?>,1, <?lua print(S/2) ?>"
+/>
+
+
+
+
+
+
+ <!--
+ <BoxCollisionShape
+ position="<?lua print((N-1)*S/2)?>,-1,<?lua print((N-1)*S/2)?>"
+ halfExtents="<?lua print(S*N/2)?>,1,<?lua print(S*N/2)?>"
+ />
+
+ -->
+ </collisionShapes>
+
+ </StaticEntity>
+
+ <Light
+ type=directional
+ position="-50,500,-50"
+ direction="0.577, -0.577, 0.577"
+ diffuse="1.0, 0.9, 0.9, 1.0"
+ specular="1.0, 0.9, 0.9, 1.0"
+ />
+
+ <SpawnPoint
+ team=0
+ position="<?lua print(S*0)?>,40,<?lua print(8*S)?>"
+ lookat="0,40,0"
+ spawnclass=HoverShip
+ pawndesign=spaceshiphover
+ />
+
+ </Scene>
+</Level>
+
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,17 @@
+SET_SOURCE_FILES(Hover_SRC_FILES
+ OrxoKart.cc
+ OrxoKartKart.cc
+ OrxoKartTile.cc
+ OrxoKartOrigin.cc
+ TimeHUD.cc
+)
+
+ORXONOX_ADD_LIBRARY(hover
+ PLUGIN
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ objects
+ overlays
+ SOURCE_FILES ${Hover_SRC_FILES}
+)
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ * Manuel Meier
+ * Co-authors:
+ * Cyrill Burgener
+ *
+ */
+
+/**
+ @file OrxoKart.cc
+ @brief Implementation of the OrxoKart class. Sets up the whole Minigame
+*/
+
+#include "OrxoKart.h"
+
+#include "OrxoKartOrigin.h"
+#include "OrxoKartWall.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(OrxoKart);
+
+ OrxoKart::OrxoKart(Context* context) : Gametype(context)
+ {
+ RegisterObject(OrxoKart);
+
+ this->origin_ = nullptr;
+ this->numberOfFlags_ = 1;
+ this->firstTick_ = true;
+
+ this->setHUDTemplate("HoverHUD");
+ }
+
+ void OrxoKart::tick(float dt)
+ { /*
+ SUPER(OrxoKart, tick, dt);
+
+ if(this->firstTick_ && this->origin_)
+ {
+ this->firstTick_ = false;
+
+ int numCells = this->origin_->getNumCells();
+ int cellSize = this->origin_->getCellSize();
+ int cellHeight = this->origin_->getCellHeight();
+
+ MazeGenerator generator(numCells);
+ generator.generateMaze();
+ generator.renderMaze();
+
+ int* levelcode = generator.getLevelcode();
+
+ //Outer Walls
+ for(int i = 0; i<numCells; i++){
+ (new HoverWall(origin_->getContext()))->init(0, i+1, cellSize, cellHeight, 1);
+ (new HoverWall(origin_->getContext()))->init(numCells, i+1, cellSize, cellHeight, 1);
+ (new HoverWall(origin_->getContext()))->init(i+1, 0, cellSize, cellHeight, 2);
+ (new HoverWall(origin_->getContext()))->init(i+1, numCells, cellSize, cellHeight, 2);
+ }
+
+ //Generate inner Walls according to levelcode
+ for(int y=0; y<numCells; y++){
+ for(int x=0; x<numCells; x++){
+ switch(levelcode[ y * numCells + x ]){
+ case 1: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
+ break;
+ case 3: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 1);
+ case 2: (new HoverWall(origin_->getContext()))->init(x+1, numCells-y, cellSize, cellHeight, 0);
+ default: break;
+ }
+ }
+ }
+
+ //Generate 5 flags randomly
+ for ( int i = 0; i < 5; i++ )
+ {
+ HoverFlag* flag = new HoverFlag(origin_->getContext());
+ flag->init(rand()%numCells, rand()%numCells, cellSize);
+ flags_.push_back(flag);
+ }
+
+ }//firsttick end
+
+ // Check if ship collided with one of the flags
+ for ( unsigned int i = 0; i < flags_.size(); i++ ){
+ if(flags_[i]->getCollided()){
+ flags_[i]->destroyLater();
+ flags_.erase (flags_.begin()+i);
+ }
+ }
+ numberOfFlags_ = flags_.size();
+ */
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *
+ * Master of Desaster:
+ * Manuel Meier
+ * Co-authors:
+ * Cyrill Burgener
+ *
+ */
+
+/**
+ @file OrxoKart.h
+ @brief Gametype. For more information see .cc file
+ @ingroup OrxoKart
+*/
+
+#ifndef _OrxoKart_H__
+#define _OrxoKart_H__
+
+#include "OrxoKartPrereqs.h"
+
+#include <vector>
+
+#include "gametypes/Gametype.h"
+#include "OrxoKartOrigin.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport OrxoKart : public Gametype
+ {
+ public:
+ OrxoKart(Context* context);
+
+ virtual void tick(float dt) override;
+
+ void setOrigin(HoverOrigin* origin)
+ { this->origin_ = origin; }
+
+ /*inline int getNumberOfFlags() const
+ { return this->numberOfFlags_; }*/
+
+ private:
+ WeakPtr<OrxoKartOrigin> origin_;
+ std::vector<OrxoKartFlag*> flags_;
+ int numberOfFlags_;
+ bool firstTick_;
+ };
+}
+
+#endif /* _OrxoKart_H__ */
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.cc 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,122 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ *
+ */
+
+/**
+ @file HoverShip.cc
+ @brief Implementation of the HoverShip control
+*/
+
+#include "HoverShip.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
+
+namespace orxonox
+{
+ RegisterClass(HoverShip);
+
+ HoverShip::HoverShip(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(HoverShip);
+ enableCollisionCallback();
+ isFloor_ = false;
+ jumpBoost_ = 0;
+ }
+
+ void HoverShip::moveFrontBack(const Vector2& value)
+ { this->steering_.z -= value.x; }
+
+ void HoverShip::moveRightLeft(const Vector2& value)
+ { this->steering_.x += value.x; }
+
+ void HoverShip::moveUpDown(const Vector2& value)
+ { this->steering_.y += value.x; }
+
+ void HoverShip::rotateYaw(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
+
+ Pawn::rotateYaw(value);
+ }
+
+ void HoverShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(HoverShip, XMLPort, xmlelement, mode);
+
+ XMLPortParam(HoverShip, "jumpBoost", setJumpBoost, getJumpBoost, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Removed, does nothing.
+ @param value
+ */
+ void HoverShip::rotatePitch(const Vector2& value) { }
+
+ /**
+ @brief
+ Removed, does nothing.
+ @param value
+ */
+ void HoverShip::rotateRoll(const Vector2& value) { }
+
+ /**
+ @brief
+ Checks if the ship is touching the floor. The ship can only jump if there is contact with someting beneath it.
+ */
+ bool HoverShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
+ {
+ SpaceShip::collidesAgainst(otherObject, cs, contactPoint);
+ //SUPER(HoverShip, collidesAgainst, otherObject, cs, contactPoint);
+
+ if (contactPoint.m_normalWorldOnB.y() > 0.6
+ && this->getVelocity().y < 1) {
+ this->isFloor_ = true;
+ } else {
+ this->isFloor_ = false;
+ }
+
+ return false;
+ }
+
+ /**
+ @brief
+ Makes the ship jump
+ @param bBoost
+ */
+ void HoverShip::boost(bool bBoost) {
+ if (bBoost && this->isFloor_)
+ {
+ this->setVelocity(
+ this->getVelocity().x,
+ jumpBoost_,
+ this->getVelocity().z
+ );
+ this->isFloor_ = false;
+ }
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartKart.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ *
+ */
+
+/**
+ @file HoverShip.h
+ @brief Declaration of the HoverShip class.
+*/
+
+#ifndef _HoverShip_H__
+#define _HoverShip_H__
+
+#include "HoverPrereqs.h"
+
+#include "worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+ class _HoverExport HoverShip : public SpaceShip
+ {
+ public:
+ HoverShip(Context* context);
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+ /// sets this ships jumpBoost
+ inline void setJumpBoost(float jumpBoost)
+ { this->jumpBoost_ = jumpBoost; }
+ /// returns this ships jumpBoost
+ inline float getJumpBoost() const
+ { return this->jumpBoost_; }
+
+ virtual void moveFrontBack(const Vector2& value) override;
+
+ virtual void moveRightLeft(const Vector2& value) override;
+
+ virtual void moveUpDown(const Vector2& value) override;
+
+ virtual void rotateYaw(const Vector2& value) override;
+
+ virtual void rotatePitch(const Vector2& value) override;
+
+ virtual void rotateRoll(const Vector2& value) override;
+
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
+
+ virtual void boost(bool bBoost) override;
+
+ private:
+ float jumpBoost_;
+ bool isFloor_;
+ };
+}
+
+#endif /* _HoverShip_H__ */
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.cc 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,66 @@
+/*
+ * 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:
+ * Manuel Meier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file OrxoKartOrigin.cc
+ @brief The OrxoKartOrigin is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the OrxoKart.
+*/
+
+#include "OrxoKartOrigin.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "OrxoKart.h"
+
+namespace orxonox
+{
+ RegisterClass(OrxoKartOrigin);
+
+ OrxoKartOrigin::OrxoKartOrigin(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(OrxoKartOrigin);
+ checkGametype();
+ }
+
+ void OrxoKartOrigin::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(OrxoKartOrigin, XMLPort, xmlelement, mode);
+
+ XMLPortParam(OrxoKartOrigin, "numCells", setNumCells, getNumCells, xmlelement, mode);
+ XMLPortParam(OrxoKartOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode);
+ XMLPortParam(OrxoKartOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode);
+ }
+
+ void HoverOrigin::checkGametype()
+ {
+ if (getGametype() != nullptr && this->getGametype()->isA(Class(OrxoKart)))
+ {
+ OrxoKart* kartGametype = orxonox_cast<OrxoKart*>(this->getGametype());
+ kartGametype->setOrigin(this);
+ }
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartOrigin.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * Manuel Meier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _OrxoKartOrigin_H__
+#define _OrxoKartOrigin_H__
+
+#include "OrxoKartPrereqs.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The OrxoKartOrigin implements the playing field @ref orxonox::OrxoKart "OrxoKart" takes place in and allows for many parameters of the minigame to be set.
+ The playing field resides in the x,z-plane, with the x-axis being the horizontal axis and the z-axis being the vertical axis.
+ For an example, have a look at the <code>OrxoKart1.oxw</code> level file.
+
+ */
+ class _OrxoKartExport OrxoKartOrigin : public StaticEntity
+ {
+ public:
+ OrxoKartOrigin(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually OrxoKart.
+ virtual ~OrxoKartOrigin() = default;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a OrxoKartOrigin through XML.
+
+ inline void setNumCells(int numCells)
+ { this->numCells_ = numCells; }
+ inline int getNumCells() const
+ { return this->numCells_; }
+
+ inline void setCellSize(int cellSize)
+ { this->cellSize_ = cellSize; }
+ inline int getCellSize() const
+ { return this->cellSize_; }
+
+ inline void setCellHeight(int cellHeight)
+ { this->cellHeight_ = cellHeight; }
+ inline int getCellHeight() const
+ { return this->cellHeight_; }
+
+ private:
+ void checkGametype();
+
+ int numCells_;
+ int cellSize_;
+ int cellHeight_;
+ };
+}
+
+#endif /* _OrxoKartOrigin_H__ */
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the OrxoKart module
+*/
+
+#ifndef _OrxoKartPrereqs_H__
+#define _OrxoKartPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(HOVER_STATIC_BUILD)
+# ifdef HOVER_SHARED_BUILD
+# define _OrxoKartExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _OrxoKartExport
+# else
+# define _OrxoKartExport __declspec(dllimport)
+# endif
+# endif
+# define _OrxoKartPrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _OrxoKartExport __attribute__ ((visibility("default")))
+# define _OrxoKartPrivate __attribute__ ((visibility("hidden")))
+#else
+# define _OrxoKartExport
+# define _OrxoKartPrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class OrxoKart;
+ class OrxoKartOrigin;
+ class OrxoKartKart;
+ class OrxoKartTile;
+ class TimeHUD;
+}
+
+#endif /* _HoverPrereqs_H__*/
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ * Manuel Meier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file HoverWall.cc
+ @brief Represents one Wall piece in the Hover Game
+*/
+
+#include "HoverWall.h"
+
+#include "core/CoreIncludes.h"
+#include "graphics/Model.h"
+#include "objects/collisionshapes/BoxCollisionShape.h"
+
+namespace orxonox
+{
+ RegisterClass(HoverWall);
+
+ HoverWall::HoverWall(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(HoverWall);
+
+ this->model_ = nullptr;
+ this->cs_ = nullptr;
+
+ this->enableCollisionCallback();
+ this->setCollisionResponse(true);
+ this->setCollisionType(CollisionType::Static);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ HoverWall::~HoverWall()
+ {
+ if (this->isInitialized())
+ {
+ if (this->model_)
+ this->model_->destroy();
+ if (this->cs_)
+ this->cs_->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Initializes 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 cellSize
+ The size of a cell
+ @param cellHeight
+ The height of a cell
+ @param orientation
+ Wall on the right side (1) or on top (2) of this square, 0-1
+ */
+ void HoverWall::init(int x, int y, int cellSize, int cellHeight, int orientation)
+ {
+ int xSize_, zSize_, xPos_, zPos_;
+
+ if(orientation == 1){
+ xSize_ = cellSize/2;
+ zSize_ = 2;
+ zPos_ = x*cellSize;
+ xPos_ = y*cellSize-cellSize/2;
+ }
+ else{
+ xSize_ = 2;
+ zSize_ = cellSize/2;
+ zPos_ = x*cellSize-cellSize/2;
+ xPos_ = y*cellSize;
+ }
+
+
+ model_ = new Model(this->getContext());
+ model_->setMeshSource("CuboidBody.mesh");
+ model_->setScale3D(Vector3(xSize_*1.0f, cellHeight*1.0f, zSize_*1.0f));
+ model_->setPosition(Vector3(xPos_*1.0f, 0.0f, zPos_*1.0f));
+
+ this->attach(model_);
+
+ cs_ = new BoxCollisionShape(this->getContext());
+ cs_->setHalfExtents(Vector3(xSize_*1.0f, cellHeight*1.0f, zSize_*1.0f));
+ cs_->setPosition(Vector3(xPos_*1.0f, 0.0f, zPos_*1.0f));
+
+ this->attachCollisionShape(cs_);
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ * Manuel Meier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file HoverWall.h
+ @brief See .cc-file for further information
+ @ingroup Hover
+*/
+
+#ifndef _HoverWall_H__
+#define _HoverWall_H__
+
+#include "HoverPrereqs.h"
+#include "objects/ObjectsPrereqs.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _HoverExport HoverWall : public StaticEntity
+ {
+ public:
+ HoverWall(Context* context);
+ virtual ~HoverWall();
+
+ void init(int x, int y, int cellSize, int cellHeight, int orientation);
+
+ private:
+ Model* model_;
+ BoxCollisionShape* cs_;
+ };
+}
+
+#endif /* _HoverWall_H__ */
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.cc 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,108 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ *
+ */
+
+/**
+ @file TimeHUD.cc
+ @brief Implementation of the TimeHUD
+*/
+
+
+#include "TimeHUD.h"
+
+#include "core/CoreIncludes.h"
+#include "util/Convert.h"
+#include "Hover.h"
+
+namespace orxonox
+{
+ RegisterClass(TimeHUD);
+
+ TimeHUD::TimeHUD(Context* context) : OverlayText(context)
+ {
+ RegisterObject(TimeHUD);
+
+ this->time_ = 0.0f;
+ this->running_ = false;
+ this->hoverGame_ = nullptr;
+ setRunning(true);
+ }
+
+ inline std::string getTimeString(float time) {
+ std::ostringstream ss;
+
+ int h = ((int) (time * 100.0f)) % 100;
+ int s = ((int) time) % 60;
+ int m = (int) (time / 60.0f);
+
+ ss << m << ":";
+
+ if(s < 10) {
+ ss << 0;
+ }
+ ss << s << ":";
+
+ if(h < 10) {
+ ss << 0;
+ }
+ ss << h << "s";
+ return ss.str();
+ }
+
+ void TimeHUD::tick(float dt)
+ {
+ SUPER(TimeHUD, tick, dt);
+
+ if(this->running_) {
+ this->time_ += dt;
+ }
+ if (this->hoverGame_)
+ {
+ this->setCaption(getTimeString(this->time_));
+ if (this->hoverGame_->getNumberOfFlags() == 0)
+ setRunning(false);
+ }
+
+ }
+
+ void TimeHUD::changedOwner()
+ {
+ SUPER(TimeHUD, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->hoverGame_ = orxonox_cast<Hover*>(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->hoverGame_ = nullptr;
+ }
+ }
+
+ void TimeHUD::reset()
+ {
+ this->time_ = 0;
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/TimeHUD.h 2018-10-24 09:43:55 UTC (rev 12057)
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ * Cyrill Burgener
+ *
+ */
+
+ /**
+ @file TimeHUD.h
+ @brief Declaration of the TimeHUD class.
+*/
+
+#ifndef _TimeHUD_H__
+#define _TimeHUD_H__
+
+#include "HoverPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _HoverExport TimeHUD : public OverlayText, public Tickable
+ {
+ public:
+ TimeHUD(Context* context);
+
+ virtual void tick(float dt) override;
+ virtual void changedOwner() override;
+
+ /// sets if the clock is running
+ inline void setRunning(bool running)
+ { this->running_ = running; }
+ /// returns if the clock is running
+ inline bool isRunning() const
+ { return this->running_; }
+
+ void reset();
+
+ private:
+ Hover* hoverGame_;
+ float time_;
+ bool running_;
+ };
+}
+#endif /* _TimeHUD_H__ */
More information about the Orxonox-commit
mailing list