[Orxonox-commit 7541] r12144 - in code/branches/OrxoKart_HS18: data/levels data/overlays data/tcl src/modules/orxokart
ottka at orxonox.net
ottka at orxonox.net
Wed Dec 5 10:48:32 CET 2018
Author: ottka
Date: 2018-12-05 10:48:32 +0100 (Wed, 05 Dec 2018)
New Revision: 12144
Added:
code/branches/OrxoKart_HS18/data/levels/OrxoKart2.oxw
code/branches/OrxoKart_HS18/data/tcl/orxokart_highscores.txt
code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.h
Modified:
code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
code/branches/OrxoKart_HS18/data/overlays/OrxoKartHUD.oxo
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/OrxoKartPrereqs.h
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
Log:
New HUDs and Start
Modified: code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw
===================================================================
--- code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/data/levels/OrxoKart1.oxw 2018-12-05 09:48:32 UTC (rev 12144)
@@ -70,7 +70,7 @@
<SpawnPoint
team=0
- position="<?lua print(S*0)?>,40,<?lua print(8*S)?>"
+ position="<?lua print(S*0)?>,40,<?lua print(8.5*S)?>"
lookat="0,40,0"
spawnclass=OrxoKartKart
pawndesign=OrxoKartKart
Added: code/branches/OrxoKart_HS18/data/levels/OrxoKart2.oxw
===================================================================
--- code/branches/OrxoKart_HS18/data/levels/OrxoKart2.oxw (rev 0)
+++ code/branches/OrxoKart_HS18/data/levels/OrxoKart2.oxw 2018-12-05 09:48:32 UTC (rev 12144)
@@ -0,0 +1,77 @@
+<LevelInfo
+ name = "OrxoKart Level 2"
+ description = "Level 2 of Minigame OrxoKart"
+ tags = "minigame"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/OrxoKartKart.oxt")
+ include("overlays/OrxoKartHUD.oxo")
+?>
+
+<?lua
+--number of tiles
+N = 25
+--scaling factor
+S = 80
+--level
+L = 2
+
+MAP_ORIGIN = "0,0,0"
+?>
+
+<Level
+plugins = orxokart
+gametype = OrxoKart
+>
+ <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>
+ <!-- Floor Physique and Design -->
+ <OrxoKartOrigin
+ numCells="<?lua print(N)?>"
+ cellSize="<?lua print(S)?>"
+ level="<?lua print(L)?>"
+ />
+ </attached>
+
+ <collisionShapes>
+ <!-- in case of additional collisionShapes besides the floor -->
+ </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(18.5*S)?>"
+ lookat="0,40,0"
+ spawnclass=OrxoKartKart
+ pawndesign=OrxoKartKart
+ />
+
+ </Scene>
+</Level>
\ No newline at end of file
Modified: code/branches/OrxoKart_HS18/data/overlays/OrxoKartHUD.oxo
===================================================================
--- code/branches/OrxoKart_HS18/data/overlays/OrxoKartHUD.oxo 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/data/overlays/OrxoKartHUD.oxo 2018-12-05 09:48:32 UTC (rev 12144)
@@ -16,25 +16,11 @@
align = "right"
/>
- <HUDHealthBar
- name = "HealthBar1"
- background = "Orxonox/HealthBarBackground"
- size = "0.35, 0.0875"
- position = "0.0 , 0.97"
- pickpoint = "0, 1"
- bartexture = "healthbar_bar.png"
- textfont = "VeraMono"
- textusebarcolour = true
- textscale = 0.4
- textoffset = "0.325, -0.825"
- textpickpoint = "0, 0"
- textalign = "right"
- correctaspect = true
- iconmaterial = "Orxonox/BarIconHealth"
- >
- <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
- <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
- <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
- </HUDHealthBar>
+ <ShroomHUD
+ name = "ShroomHUD"
+ position = "0.05, 0.02"
+ size = "0.18, 0.05"
+ />
+
</OverlayGroup>
</Template>
Added: code/branches/OrxoKart_HS18/data/tcl/orxokart_highscores.txt
===================================================================
--- code/branches/OrxoKart_HS18/data/tcl/orxokart_highscores.txt (rev 0)
+++ code/branches/OrxoKart_HS18/data/tcl/orxokart_highscores.txt 2018-12-05 09:48:32 UTC (rev 12144)
@@ -0,0 +1,14 @@
+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
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/CMakeLists.txt 2018-12-05 09:48:32 UTC (rev 12144)
@@ -4,6 +4,7 @@
OrxoKartTile.cc
OrxoKartOrigin.cc
OrxoKartFlag.cc
+ ShroomHUD.cc
TimeHUD.cc
)
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.cc 2018-12-05 09:48:32 UTC (rev 12144)
@@ -49,6 +49,7 @@
this->origin_ = nullptr;
this->raceFinished = false;
this->firstTick_ = true;
+ this->numberOfShrooms = 3;
this->setHUDTemplate("OrxoKartHUD");
}
@@ -180,9 +181,9 @@
if(flag_->getCollided()){
OrxoKartKart* player = flag_->getObjectofCollision();
if (level == 1)
- player->setPosition(Vector3(s*0, 20, s*8));
+ player->setPosition(Vector3(s*0, 20, s*8.5));
if (level == 2)
- player->setPosition(Vector3(s*0, 20, s*18));
+ 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));
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKart.h 2018-12-05 09:48:32 UTC (rev 12144)
@@ -56,6 +56,8 @@
inline int getRaceFinished() const
{ return this->raceFinished; }
+ inline int getNumberOfShrooms() const
+ { return this->numberOfShrooms; }
private:
WeakPtr<OrxoKartOrigin> origin_;
@@ -67,6 +69,8 @@
bool raceFinished;
bool firstTick_;
+ int numberOfShrooms;
+
int s;
int n;
int level;
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartPrereqs.h 2018-12-05 09:48:32 UTC (rev 12144)
@@ -73,6 +73,7 @@
class OrxoKartKart;
class OrxoKartTile;
class TimeHUD;
+ class ShroomHUD;
}
#endif /* _HoverPrereqs_H__*/
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.cc 2018-12-05 09:48:32 UTC (rev 12144)
@@ -47,6 +47,7 @@
this->model_ = nullptr;
this->cs_ = nullptr;
+ this->arc = nullptr;
this->enableCollisionCallback();
this->setCollisionResponse(true);
@@ -65,6 +66,8 @@
this->model_->destroy();
if (this->cs_)
this->cs_->destroy();
+ if (this->arc)
+ this->arc->destroy();
}
}
@@ -89,6 +92,13 @@
}
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));
Modified: code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h 2018-12-05 09:40:19 UTC (rev 12143)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/OrxoKartTile.h 2018-12-05 09:48:32 UTC (rev 12144)
@@ -64,6 +64,7 @@
private:
Model* model_;
+ Model* arc;
BoxCollisionShape* cs_;
bool collided_;
OrxoKartKart* kartCollider;
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.cc
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.cc (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.cc 2018-12-05 09:48:32 UTC (rev 12144)
@@ -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 <Overlay/OgreOverlayManager.h>
+# include <Overlay/OgrePanelOverlayElement.h>
+#else
+# include <OgreOverlayManager.h>
+# include <OgrePanelOverlayElement.h>
+#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::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+ .createOverlayElement("Panel", "ShroomHUD_Panel_" + getUniqueNumberString()));
+ this->panel_->setMaterialName("Hover/Flag");
+ 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<OrxoKart*>(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->orxoKartGame_ = nullptr;
+ }
+ }
+}
Added: code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.h
===================================================================
--- code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.h (rev 0)
+++ code/branches/OrxoKart_HS18/src/modules/orxokart/ShroomHUD.h 2018-12-05 09:48:32 UTC (rev 12144)
@@ -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__ */
More information about the Orxonox-commit
mailing list