Index: /code/branches/mergeFS18/data/levels/OrxoKart1.oxw
===================================================================
--- /code/branches/mergeFS18/data/levels/OrxoKart1.oxw (revision 12194)
+++ /code/branches/mergeFS18/data/levels/OrxoKart1.oxw (revision 12194)
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/mergeFS18/data/levels/OrxoKart2.oxw
===================================================================
--- /code/branches/mergeFS18/data/levels/OrxoKart2.oxw (revision 12194)
+++ /code/branches/mergeFS18/data/levels/OrxoKart2.oxw (revision 12194)
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/mergeFS18/data/levels/includes/weaponSettingsHover.oxi
===================================================================
--- /code/branches/mergeFS18/data/levels/includes/weaponSettingsHover.oxi (revision 12193)
+++ /code/branches/mergeFS18/data/levels/includes/weaponSettingsHover.oxi (revision 12194)
@@ -7,5 +7,5 @@
-
+
Index: /code/branches/mergeFS18/data/levels/kart_alpha0.1.oxw
===================================================================
--- /code/branches/mergeFS18/data/levels/kart_alpha0.1.oxw (revision 12194)
+++ /code/branches/mergeFS18/data/levels/kart_alpha0.1.oxw (revision 12194)
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/mergeFS18/data/levels/templates/OrxoKartKart.oxt
===================================================================
--- /code/branches/mergeFS18/data/levels/templates/OrxoKartKart.oxt (revision 12194)
+++ /code/branches/mergeFS18/data/levels/templates/OrxoKartKart.oxt (revision 12194)
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/mergeFS18/data/overlays/OrxoKartHUD.oxo
===================================================================
--- /code/branches/mergeFS18/data/overlays/OrxoKartHUD.oxo (revision 12194)
+++ /code/branches/mergeFS18/data/overlays/OrxoKartHUD.oxo (revision 12194)
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /code/branches/mergeFS18/data/tcl/orxokart_highscores.txt
===================================================================
--- /code/branches/mergeFS18/data/tcl/orxokart_highscores.txt (revision 12194)
+++ /code/branches/mergeFS18/data/tcl/orxokart_highscores.txt (revision 12194)
@@ -0,0 +1,20 @@
+Name: 0:25:73s
+Name: 0:24:43s
+Name: 0:22:04s
+Name: 0:21:66s
+Name: 0:21:83s
+Name: 0:21:87s
+Name: 0:22:06s
+Name: 0:22:19s
+Name: 0:23:77s
+Name: 0:21:05s
+Name: 0:21:25s
+Name: 0:21:15s
+Name: 0:22:15s
+Name: 0:21:87s
+Name: 0:50:45s
+Name: 0:27:45s
+Name: 0:33:17s
+Name: 0:31:46s
+Name: 0:25:40s
+Name: 1:27:11s
Index: /code/branches/mergeFS18/src/modules/CMakeLists.txt
===================================================================
--- /code/branches/mergeFS18/src/modules/CMakeLists.txt (revision 12193)
+++ /code/branches/mergeFS18/src/modules/CMakeLists.txt (revision 12194)
@@ -51,3 +51,4 @@
ADD_SUBDIRECTORY(pacman)
ADD_SUBDIRECTORY(orxyroad)
+ADD_SUBDIRECTORY(orxokart)
ADD_SUBDIRECTORY(wagnis)
Index: /code/branches/mergeFS18/src/modules/orxokart/CMakeLists.txt
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/CMakeLists.txt (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/CMakeLists.txt (revision 12194)
@@ -0,0 +1,19 @@
+SET_SOURCE_FILES(OrxoKart_SRC_FILES
+ OrxoKart.cc
+ OrxoKartKart.cc
+ OrxoKartTile.cc
+ OrxoKartOrigin.cc
+ OrxoKartFlag.cc
+ ShroomHUD.cc
+ TimeHUD.cc
+)
+
+ORXONOX_ADD_LIBRARY(orxokart
+ PLUGIN
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ objects
+ overlays
+ SOURCE_FILES ${OrxoKart_SRC_FILES}
+)
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.cc (revision 12194)
@@ -0,0 +1,190 @@
+/*
+ * 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 "OrxoKartFlag.h"
+#include "OrxoKartKart.h"
+#include "OrxoKartOrigin.h"
+#include "OrxoKartTile.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(OrxoKart);
+
+ OrxoKart::OrxoKart(Context* context) : Gametype(context)
+ {
+ RegisterObject(OrxoKart);
+
+ this->origin_ = nullptr;
+ this->raceFinished = false;
+ this->firstTick_ = true;
+ this->numberOfShrooms = 3;
+ this->player = nullptr;
+
+ this->setHUDTemplate("OrxoKartHUD");
+ }
+
+ void OrxoKart::tick(float dt)
+ {
+ SUPER(OrxoKart, tick, dt);
+ if(this->firstTick_ && this->origin_)
+ {
+ this->firstTick_ = false;
+ this->wayPoints = std::vector(3, nullptr);
+
+ this->n = this->origin_->getNumCells();
+ this->s = this->origin_->getCellSize();
+ this->level = this->origin_->getLevel();
+ int map_1[] = {1,1,1,1,1,1,1,1,0,0,0
+ ,1,0,0,0,0,0,0,1,1,1,0
+ ,1,0,1,1,1,1,0,0,0,1,1
+ ,1,1,1,0,0,1,1,0,0,0,1
+ ,0,0,0,0,0,0,1,0,1,1,1
+ ,1,1,1,1,1,1,1,0,1,0,0
+ ,1,0,0,0,0,0,0,0,1,0,0
+ ,1,0,0,0,0,0,0,0,1,0,0
+ ,1,1,1,1,1,0,0,0,1,1,1
+ ,0,0,0,0,1,0,0,0,0,0,1
+ ,0,0,0,0,1,1,1,2,1,1,1};
+
+ int map_2[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,0,1,1,1,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,
+ 1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,
+ 1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,
+ 1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,
+ 1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,0,
+ 1,0,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,
+ 1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,0,0,
+ 1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,
+ 0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,
+ 0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,0,0,1,
+ 0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,1,
+ 0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,
+ 0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
+ 0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
+ 0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,
+ 0,1,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,
+ 0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
+ 0,1,0,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,
+ 0,1,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,
+ 0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,0,1,
+ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,2,1,1,1,0,1,1,1};
+
+ int *levelcodeArray = level==1 ? map_1 : map_2;
+ // int z = 0;
+ //Generate floor according to levelcode
+ for(int i=0; igetContext());
+ tile->init((n-1-i)*s, j*s, s, 0, type);
+ // tiles.push_back(tile);
+ //++z;
+ if (level == 1) {
+ //map 1
+ if ( i == 9 && j == 4 )
+ wayPoints.at(0) = tile;
+
+ if ( i == 0 && j == 1)
+ wayPoints.at(1) = tile;
+ if ( i == 10 && j == 7)
+ wayPoints.at(2) = tile;
+ }
+ else if (level == 2) {
+ //map 2
+ if ( i == 23 && j == 11 )
+ wayPoints.at(0) = tile;
+
+ if ( i == 0 && j == 1)
+ wayPoints.at(1) = tile;
+ if ( i == 24 && j == 17)
+ wayPoints.at(2) = tile;
+ }
+ }
+ }
+ }
+ //bottom flag
+
+ OrxoKartFlag* flag = new OrxoKartFlag(origin_->getContext());
+ flag->init(n, s);
+ flag_ = flag;
+
+
+
+ } //firsttick end
+
+ if (wayPointCounter >= 3)
+ raceFinished = true;
+
+ else if (wayPointCounter < 3 && wayPointCounter >= 0 && wayPoints.at(wayPointCounter) != nullptr) {
+ if (wayPoints.at(wayPointCounter)->getCollided()) {
+ for (int i = 0; i < 3; ++i) {
+ wayPoints.at(i)->setCollided(false);
+ }
+ ++wayPointCounter;
+ }
+ }
+ else {
+ //orxout() << " Should not happen, look in OrxoKart.cc";
+ }
+
+
+
+ //orxout() << numberOfShrooms << endl;
+
+
+ // Check if ship collided with the flag, flag is the bottom that is responsible for the game to detect the spaceship falling.
+ if(flag_->getCollided()){
+ //orxout() << numberOfShrooms << endl;
+ player = flag_->getObjectofCollision();
+ if (level == 1)
+ player->setPosition(Vector3(s*0, 20, s*8.5));
+ if (level == 2)
+ player->setPosition(Vector3(s*0, 20, s*18.5));
+ player->setOrientation(Quaternion(1, 0, 0, 0)); // 0, 0, 0
+ player->setVelocity(Vector3(0,0,0));
+ player->setAcceleration(Vector3(0,0,0));
+ flag_->setCollided(false);
+ wayPointCounter = 0;
+
+
+
+ }
+
+
+ }
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKart.h (revision 12194)
@@ -0,0 +1,81 @@
+/*
+ * 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
+
+#include "gametypes/Gametype.h"
+#include "OrxoKartOrigin.h"
+#include "OrxoKartKart.h"
+namespace orxonox
+{
+ class _OrxoKartExport OrxoKart : public Gametype
+ {
+ public:
+ OrxoKart(Context* context);
+
+ virtual void tick(float dt) override;
+
+ void setOrigin(OrxoKartOrigin* origin)
+ { this->origin_ = origin; }
+
+ inline int getRaceFinished() const
+ { return this->raceFinished; }
+ inline int getNumberOfShrooms() const
+ { return this->numberOfShrooms; }
+
+ private:
+ OrxoKartKart* player;
+ WeakPtr origin_;
+ OrxoKartFlag* flag_;
+ std::vector tiles;
+ int numberOfWP;
+ std::vector wayPoints;
+ int wayPointCounter = 0;
+ bool raceFinished;
+ bool firstTick_;
+
+ int numberOfShrooms;
+
+ int s;
+ int n;
+ int level;
+ };
+}
+
+#endif /* _OrxoKart_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.cc (revision 12194)
@@ -0,0 +1,111 @@
+/*
+ * 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 OrxoKartFlag.cc
+ @brief The Flags that are being set in the OrxoKart Minigame They support two coordinates from 0-9 each
+*/
+
+#include "OrxoKartFlag.h"
+#include "OrxoKartKart.h"
+
+#include "core/CoreIncludes.h"
+
+#include "graphics/Model.h"
+#include "objects/collisionshapes/BoxCollisionShape.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(OrxoKartFlag);
+
+ OrxoKartFlag::OrxoKartFlag(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(OrxoKartFlag);
+
+ this->model_ = nullptr;
+ this->cs_ = nullptr;
+ this->collided_ = false;
+ this->kartCollider = nullptr;
+
+ this->enableCollisionCallback();
+ this->setCollisionResponse(true);
+ this->setCollisionType(CollisionType::Static);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ OrxoKartFlag::~OrxoKartFlag()
+ {
+ if (this->isInitialized())
+ {
+ if (this->model_)
+ this->model_->destroy();
+ if (this->cs_)
+ this->cs_->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Initializes the flag.
+ @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
+ @param cellSize
+ The size of the cells
+ */
+ void OrxoKartFlag::init(int n, int s)
+ {
+
+ cs_ = new BoxCollisionShape(this->getContext());
+ cs_->setHalfExtents(Vector3(s*n, 1, s*n));
+ cs_->setPosition(Vector3(s*n*0.5f,-60.0f, s*n*0.5f));
+
+ this->attachCollisionShape(cs_);
+
+
+ }
+
+ /**
+ @brief
+ Checks if the OrxoKartship collided with the flag
+ */
+ bool OrxoKartFlag::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+ {
+ if(otherObject->isA(Class(OrxoKartKart))) {
+ collided_ = true;
+ kartCollider = (OrxoKartKart*) otherObject;
+ }
+
+ return false;
+ }
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartFlag.h (revision 12194)
@@ -0,0 +1,75 @@
+/*
+ * 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 OrxoKartFlag.h
+ @brief See .cc File
+ @ingroup OrxoKart
+*/
+
+#ifndef _OrxoKartFlag_H__
+#define _OrxoKartFlag_H__
+
+#include "OrxoKartPrereqs.h"
+#include "objects/ObjectsPrereqs.h"
+#include "OrxoKartKart.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport OrxoKartFlag : public StaticEntity
+ {
+ public:
+ OrxoKartFlag(Context* context);
+ virtual ~OrxoKartFlag();
+
+ void init(int n, int s);
+
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+
+ inline bool getCollided() const
+ { return this->collided_; }
+
+ inline OrxoKartKart* getObjectofCollision() const
+ { return this->kartCollider; }
+
+ inline void setCollided(bool setValue)
+ { this->collided_ = setValue; }
+
+
+ private:
+ Model* model_;
+ BoxCollisionShape* cs_;
+ bool collided_;
+ OrxoKartKart* kartCollider;
+
+ };
+}
+
+#endif /* _OrxoKartFlag_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.cc (revision 12194)
@@ -0,0 +1,90 @@
+/*
+ * 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 OrxoKartKart.cc
+ @brief Implementation of the OrxoKartKart control
+*/
+
+#include "OrxoKartKart.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+namespace orxonox
+{
+ RegisterClass(OrxoKartKart);
+
+
+ OrxoKartKart::OrxoKartKart(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(OrxoKartKart);
+ }
+
+ void OrxoKartKart::moveFrontBack(const Vector2& value)
+ {
+ this->steering_.z -= value.x;
+
+ }
+
+ void OrxoKartKart::moveRightLeft(const Vector2& value)
+ {
+ this->rotateYaw(value);
+ }
+
+ void OrxoKartKart::moveUpDown(const Vector2& value)
+ {
+ this->steering_.y += value.x;
+
+ }
+
+ void OrxoKartKart::rotateYaw(const Vector2& value)
+ {
+
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+ }
+
+ void OrxoKartKart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(OrxoKartKart, XMLPort, xmlelement, mode);
+
+ }
+
+
+ /**
+ @brief
+ Removed, does nothing.
+ @param value
+ */
+ void OrxoKartKart::rotatePitch(const Vector2& value) { }
+
+ /**
+ @brief
+ Removed, does nothing.
+ @param value
+ */
+ void OrxoKartKart::rotateRoll(const Vector2& value) { }
+
+
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartKart.h (revision 12194)
@@ -0,0 +1,62 @@
+/*
+ * 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 OrxoKartKart.h
+ @brief Declaration of the OrxoKartKart class.
+*/
+
+#ifndef _OrxoKartKart_H__
+#define _OrxoKartKart_H__
+
+#include "OrxoKartPrereqs.h"
+
+#include "worldentities/pawns/SpaceShip.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport OrxoKartKart : public SpaceShip
+ {
+ public:
+ OrxoKartKart(Context* context);
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+ 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;
+ };
+}
+
+#endif /* _OrxoKartKart_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.cc (revision 12194)
@@ -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, "level", setLevel, getLevel, xmlelement, mode);
+ }
+
+ void OrxoKartOrigin::checkGametype()
+ {
+ if (getGametype() != nullptr && this->getGametype()->isA(Class(OrxoKart)))
+ {
+ OrxoKart* kartGametype = orxonox_cast(this->getGametype());
+ kartGametype->setOrigin(this);
+ }
+ }
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartOrigin.h (revision 12194)
@@ -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 OrxoKart1.oxw
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 setLevel(int level)
+ { this->level_ = level; }
+ inline int getLevel() const
+ { return this->level_; }
+
+ private:
+ void checkGametype();
+
+ int numCells_;
+ int cellSize_;
+ int level_;
+ };
+}
+
+#endif /* _OrxoKartOrigin_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartPrereqs.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartPrereqs.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartPrereqs.h (revision 12194)
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ * ...
+ *
+ */
+
+/**
+@file
+@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 OrxoKartFlag;
+ class OrxoKartOrigin;
+ class OrxoKartKart;
+ class OrxoKartTile;
+ class TimeHUD;
+ class ShroomHUD;
+}
+
+#endif /* _HoverPrereqs_H__*/
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.cc (revision 12194)
@@ -0,0 +1,134 @@
+/*
+ * 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 OrxoKartTile.cc
+ @brief Represents one Wall piece in the OrxoKart Game
+*/
+
+#include "OrxoKartTile.h"
+
+#include "core/CoreIncludes.h"
+#include "graphics/Model.h"
+#include "objects/collisionshapes/BoxCollisionShape.h"
+
+namespace orxonox
+{
+ RegisterClass(OrxoKartTile);
+
+ OrxoKartTile::OrxoKartTile(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(OrxoKartTile);
+
+ this->model_ = nullptr;
+ this->cs_ = nullptr;
+ this->arc = nullptr;
+
+ this->enableCollisionCallback();
+ this->setCollisionResponse(true);
+ this->setCollisionType(CollisionType::Static);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ OrxoKartTile::~OrxoKartTile()
+ {
+ if (this->isInitialized())
+ {
+ if (this->model_)
+ this->model_->destroy();
+ if (this->cs_)
+ this->cs_->destroy();
+ if (this->arc)
+ this->arc->destroy();
+ }
+ }
+
+ /**
+ @brief
+ Initializes a OrxoKartTile
+ @param x
+ x-Coordinate of the center of the Tile
+ @param y
+ z-Coordinate of the center of the Tile
+ @param s
+ scaling factor of the map
+ @param type
+ type of tile. 1 for normal tile, 2 for Start/End tile
+ */
+ void OrxoKartTile::init(int x, int z, int s, float r, int type)
+ {
+ // floor design according to its type
+ model_ = new Model(this->getContext());
+ if (type == 1) {
+ model_->setMeshSource("OrxoKartStreckenabschnitt.mesh");
+ }
+ else if (type == 2 ) {
+ model_->setMeshSource("OrxoKartStreckenabschnittZiel.mesh");
+
+ arc = new Model(this->getContext());
+ arc->setMeshSource("OrxoKartStartTor.mesh");
+ arc->setPosition(Vector3(x*1.0f, -1.0f, z*1.0f));
+ arc->setScale3D(Vector3(s*1.0f/10, s*1.0f/10, s*1.0f/10));
+ arc->yaw(Degree(-90));
+ this->attach(arc);
+ }
+ model_->setScale3D(Vector3(s*1.0f, 8.0f, s*1.0f));
+ model_->setPosition(Vector3(x*1.0f, 0.0f, z*1.0f));
+ model_->pitch(Degree(r));
+
+ this->attach(model_);
+
+
+ //floor physics
+ cs_ = new BoxCollisionShape(this->getContext());
+ cs_->setHalfExtents(Vector3(s/2.0f, 1.0f, s/2.0f));
+ cs_->setPosition(Vector3(x*1.0f, -1.0f, z*1.0f));
+ cs_->pitch(Degree(r));
+
+ this->attachCollisionShape(cs_);
+ }
+
+ /**
+ @brief
+ Checks if the OrxoKartship collided with the flag
+ */
+ bool OrxoKartTile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+ {
+ if(otherObject->isA(Class(OrxoKartKart))) {
+ collided_ = true;
+ kartCollider = (OrxoKartKart*) otherObject;
+ }
+
+ return false;
+ }
+
+
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/OrxoKartTile.h (revision 12194)
@@ -0,0 +1,74 @@
+/*
+ * 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 OrxoKartTile.h
+ @brief See .cc-file for further information
+ @ingroup OrxoKart
+*/
+
+#ifndef _OrxoKartTile_H__
+#define _OrxoKartTile_H__
+
+#include "OrxoKartPrereqs.h"
+#include "objects/ObjectsPrereqs.h"
+
+#include "OrxoKartKart.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport OrxoKartTile : public StaticEntity
+ {
+ public:
+ OrxoKartTile(Context* context);
+ virtual ~OrxoKartTile();
+
+ void init(int x, int z, int s, float r, int type);
+
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+
+ inline bool getCollided() const
+ { return this->collided_; }
+
+ inline OrxoKartKart* getObjectofCollision() const
+ { return this->kartCollider; }
+
+ inline void setCollided(bool setValue)
+ { this->collided_ = setValue; }
+
+ private:
+ Model* model_;
+ Model* arc;
+ BoxCollisionShape* cs_;
+ bool collided_;
+ OrxoKartKart* kartCollider;
+ };
+}
+
+#endif /* _OrxoKartTile_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.cc (revision 12194)
@@ -0,0 +1,109 @@
+/*
+ * 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 ShroomHUD.cc
+ @brief Implementation of the ShroomHUD
+*/
+
+#include "ShroomHUD.h"
+
+#if OGRE_VERSION >= 0x010900
+# include
+# include
+#else
+# include
+# include
+#endif
+
+#include "util/StringUtils.h"
+#include "core/CoreIncludes.h"
+#include "OrxoKart.h"
+
+namespace orxonox
+{
+ RegisterClass(ShroomHUD);
+
+ ShroomHUD::ShroomHUD(Context* context) : OrxonoxOverlay(context)
+ {
+ RegisterObject(ShroomHUD);
+
+ this->orxoKartGame_ = nullptr;
+ this->panel_ = static_cast(Ogre::OverlayManager::getSingleton()
+ .createOverlayElement("Panel", "ShroomHUD_Panel_" + getUniqueNumberString()));
+ this->panel_->setMaterialName("mushroom");
+ this->overlay_->add2D(this->panel_);
+ this->shroomCount_ = 3;
+ setShroomCount(3);
+ }
+
+ ShroomHUD::~ShroomHUD()
+ {
+ if (this->isInitialized())
+ {
+ Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
+ }
+ }
+
+/**
+ @brief Sets the amount of shrooms displayed, once zero it does not reappear
+ @param shroomCount
+*/
+ void ShroomHUD::setShroomCount(int shroomCount) {
+ if(shroomCount == 0){
+ this->panel_->hide();
+ return;
+ }
+ this->panel_->setDimensions(
+ this->panel_->_getRelativeWidth() / ((float) shroomCount_) * ((float) shroomCount),
+ this->panel_->_getRelativeHeight()
+ );
+ this->panel_->setTiling(shroomCount*1.0f, 1.0f);
+
+ this->shroomCount_ = shroomCount;
+ }
+
+ void ShroomHUD::tick(float dt)
+ {
+ SUPER(ShroomHUD, tick, dt);
+
+ setShroomCount(this->orxoKartGame_->getNumberOfShrooms());
+ }
+
+ void ShroomHUD::changedOwner()
+ {
+ SUPER(ShroomHUD, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->orxoKartGame_ = orxonox_cast(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->orxoKartGame_ = nullptr;
+ }
+ }
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/ShroomHUD.h (revision 12194)
@@ -0,0 +1,62 @@
+/*
+ *
+ *
+ * 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 ShroomHUD.h
+ @brief Declaration of the ShroomHUD class.
+*/
+
+#ifndef _ShroomHUD_H__
+#define _ShroomHUD_H__
+
+#include "OrxoKartPrereqs.h"
+
+#include "util/OgreForwardRefs.h"
+#include "overlays/OrxonoxOverlay.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport ShroomHUD : public OrxonoxOverlay , public Tickable
+ {
+ public:
+ ShroomHUD(Context* context);
+ virtual ~ShroomHUD();
+
+ virtual void tick(float dt) override;
+ virtual void changedOwner() override;
+
+ void setShroomCount(int shroomCount);
+
+ private:
+ OrxoKart* orxoKartGame_;
+ Ogre::PanelOverlayElement* panel_;
+ int shroomCount_;
+ };
+}
+#endif /* _ShroomHUD_H__ */
Index: /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.cc
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.cc (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.cc (revision 12194)
@@ -0,0 +1,120 @@
+/*
+ * 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
+#include
+#include "Highscore.h"
+
+#include "core/CoreIncludes.h"
+#include "util/Convert.h"
+#include "OrxoKart.h"
+
+namespace orxonox
+{
+ RegisterClass(TimeHUD);
+
+ TimeHUD::TimeHUD(Context* context) : OverlayText(context)
+ {
+ RegisterObject(TimeHUD);
+
+ this->time_ = 0.0f;
+ this->running_ = false;
+ this->orxokartGame_ = 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->orxokartGame_)
+ {
+ this->setCaption(getTimeString(this->time_));
+ if (this->orxokartGame_->getRaceFinished()) {
+ setRunning(false);
+ if (!score_set) {
+ std::ofstream highscoreFile;
+ highscoreFile.open("orxokart_highscores.txt", std::ios::app);
+ highscoreFile << "Name: " << getTimeString(this->time_) << std::endl;
+ highscoreFile.close();
+ score_set = true;
+ }
+ }
+ }
+
+ }
+
+ void TimeHUD::changedOwner()
+ {
+ SUPER(TimeHUD, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->orxokartGame_ = orxonox_cast(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->orxokartGame_ = nullptr;
+ }
+ }
+
+ void TimeHUD::reset()
+ {
+ this->time_ = 0;
+ }
+}
Index: /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.h
===================================================================
--- /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.h (revision 12194)
+++ /code/branches/mergeFS18/src/modules/orxokart/TimeHUD.h (revision 12194)
@@ -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.
+ *
+ * Author:
+ * Cyrill Burgener
+ *
+ */
+
+ /**
+ @file TimeHUD.h
+ @brief Declaration of the TimeHUD class.
+*/
+
+#ifndef _TimeHUD_H__
+#define _TimeHUD_H__
+
+#include "OrxoKartPrereqs.h"
+#include
+#include
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _OrxoKartExport 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:
+ OrxoKart* orxokartGame_;
+ float time_;
+ bool running_;
+ bool score_set = false;
+ };
+}
+#endif /* _TimeHUD_H__ */
Index: /code/branches/mergeFS18/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- /code/branches/mergeFS18/src/orxonox/controllers/CMakeLists.txt (revision 12193)
+++ /code/branches/mergeFS18/src/orxonox/controllers/CMakeLists.txt (revision 12194)
@@ -21,4 +21,3 @@
ArrowController.cc;
AutonomousDroneController.cc;
-
)