[Orxonox-commit 3817] r8494 - in code/branches/spacerace: data/levels src/modules/gametypes
msalomon at orxonox.net
msalomon at orxonox.net
Mon May 16 20:07:12 CEST 2011
Author: msalomon
Date: 2011-05-16 20:07:11 +0200 (Mon, 16 May 2011)
New Revision: 8494
Added:
code/branches/spacerace/data/levels/spaceRace.oxw
code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc
code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h
Log:
RaceCheckPoint type and test level for the spaceRace gametype.
Added: code/branches/spacerace/data/levels/spaceRace.oxw
===================================================================
--- code/branches/spacerace/data/levels/spaceRace.oxw (rev 0)
+++ code/branches/spacerace/data/levels/spaceRace.oxw 2011-05-16 18:07:11 UTC (rev 8494)
@@ -0,0 +1,168 @@
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<LevelInfo
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ tags = "test"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ gametype = SpaceRace
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/skyBoxMoreNebula"
+ >
+
+ <?lua math.randomseed(99) ?>
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="0,-2500,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+ <!-- ------------------CheckPoints----------------- -->
+ <RaceCheckPoint name=checkpoint1 position="0,-2000,1000" scale=1 distance=20 checkpointindex=0 islast=false>
+ <attached>
+ <Model mass="100" scale="100" mesh="checkPoint.mesh" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint2 position="0,-1400,1400" scale=1 distance=20 checkpointindex=1 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint3 position="0,500,2500" scale=1 distance=20 checkpointindex=2 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint4 position="0,1500,1700" scale=1 distance=20 checkpointindex=3 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint5 position="0,2200,500" scale=1 distance=20 checkpointindex=4 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint6 position="0,1500,-800" scale=1 distance=20 checkpointindex=5 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint7 position="0,200,-1900" scale=1 distance=20 checkpointindex=6 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint8 position="0,-500,-1500" scale=1 distance=20 checkpointindex=7 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint9 position="0,-1300,-800" scale=1 distance=20 checkpointindex=8 islast=false>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name=checkpoint10 position="0,-2500,0" scale=1 distance=20 checkpointindex=9 islast=true>
+ <attached>
+ <Billboard position=" 0,0,0" material="Examples/Flare" colour="1.0, 0.0, 0.0" />
+ </attached>
+ </RaceCheckPoint>
+
+ <!-- ------------------Planet needs gravity----------------- -->
+ <Planet position="0,0,0" scale=400 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+ <StaticEntity position="0,0,0" collisionType=static>
+ <collisionShapes>
+ <SphereCollisionShape radius="399" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <!-- ---------------asteroid ellypse----------------- -->
+ <?lua
+ max = 20
+ for i = 0, max, 1
+ do
+ y = math.sin(i/max*6)*2000
+ z = math.cos(i/max*6)*2500
+ x = 0
+ ?>
+<?lua
+for k = 1, 20, 1
+do
+j = math.random()
+?>
+
+ <StaticEntity position="<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>" scale="<?lua print(j * 5) ?>" >
+ <attached>
+ <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+ <?lua if k == 5 then ?><attached><!-- ---------asteroid fog----- -->
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached> <?lua end ?>
+ </Model>
+ </attached>
+ <?lua if i == 5 then ?><collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+ </collisionShapes> <?lua end ?>
+ </StaticEntity>
+<?lua
+end
+?>
+<?lua end ?>
+
+ <ForceField position="9000,9000,0" direction="-1,-1,0" diameter=500 velocity=5000 length=5000 />
+ <MovableEntity position="9000,9000,0">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,20,1 do ?>
+ <Billboard position="<?lua print(-i*200*1.414/2) ?>,<?lua print(-i*200*1.414/2) ?>,-100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="<?lua print(-i*200*1.414/2) ?>,<?lua print(-i*200*1.414/2) ?>,100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,500,-2500" direction="1,1,0" diameter=500 velocity=5000 length=5000 />
+ <MovableEntity position="9000,9000,0">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,20,1 do ?>
+ <Billboard position="<?lua print(i*200*1.414/2) ?>,<?lua print(i*200*1.414/2) ?>,-100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="<?lua print(i*200*1.414/2) ?>,<?lua print(i*200*1.414/2) ?>,100" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ </Scene>
+</Level>
Added: code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc (rev 0)
+++ code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc 2011-05-16 18:07:11 UTC (rev 8494)
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "RaceCheckPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SpaceRace.h"
+
+namespace orxonox
+{
+ CreateFactory(RaceCheckPoint);
+
+ RaceCheckPoint::RaceCheckPoint(BaseObject* creator):
+ DistanceTrigger(creator),
+ RadarViewable(creator, static_cast<WorldEntity*>(this))
+ {
+ RegisterObject(RaceCheckPoint);
+
+ this->bCheckpointIndex_ = 0;
+ this->bIsLast_ = false;
+
+ this->setRadarObjectColour(ColourValue::Red);
+ this->setRadarObjectShape(RadarViewable::Dot);
+ this->setRadarVisibility(false);
+ }
+
+ RaceCheckPoint::~RaceCheckPoint()
+ {
+ }
+
+ void RaceCheckPoint::tick(float dt)
+ {
+ Trigger::tick(dt);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (this->getCheckpointIndex() == gametype->getCheckpointsReached()) this->setRadarVisibility(true);
+ else this->setRadarVisibility(false);
+ }
+
+
+ void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
+ XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
+ }
+
+ void RaceCheckPoint::triggered(bool bIsTriggered)
+ {
+ DistanceTrigger::triggered(bIsTriggered);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (gametype)
+ {
+ if (this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
+ {
+ if (this->getLast())
+ {
+ gametype->end();
+ }
+ else
+ {
+ gametype->newCheckpointReached();
+ this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
+ }
+ }
+ }
+ }
+
+}
Added: code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h (rev 0)
+++ code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h 2011-05-16 18:07:11 UTC (rev 8494)
@@ -0,0 +1,70 @@
+/*
+ * 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:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _RaceCheckPoint_H__
+#define _RaceCheckPoint_H__
+
+#include "objects/ObjectsPrereqs.h"
+
+#include "objects/triggers/DistanceTrigger.h"
+#include "interfaces/RadarViewable.h"
+#include <boost/concept_check.hpp>
+
+namespace orxonox
+{
+ class _ObjectsExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
+ {
+ public:
+ RaceCheckPoint(BaseObject* creator);
+ virtual ~RaceCheckPoint();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+
+ protected:
+ virtual void triggered(bool bIsTriggered);
+ inline void setLast(bool isLast)
+ { this->bIsLast_ = isLast; }
+ inline bool getLast()
+ { return this->bIsLast_; }
+ inline void setCheckpointIndex(int checkpointIndex)
+ { this->bCheckpointIndex_ = checkpointIndex; }
+ inline int getCheckpointIndex()
+ { return this->bCheckpointIndex_; }
+ inline const WorldEntity* getWorldEntity() const
+ { return this; }
+
+ private:
+ int bCheckpointIndex_;
+ bool bIsLast_;
+
+
+ };
+}
+
+#endif
\ No newline at end of file
More information about the Orxonox-commit
mailing list