[Orxonox-commit 5415] r10078 - in code/branches/presentationFS14: data/levels data/overlays src/modules src/modules/invader src/modules/jump
smerkli at orxonox.net
smerkli at orxonox.net
Tue May 27 10:35:28 CEST 2014
Author: smerkli
Date: 2014-05-27 10:35:27 +0200 (Tue, 27 May 2014)
New Revision: 10078
Added:
code/branches/presentationFS14/data/levels/jump.oxw
code/branches/presentationFS14/data/overlays/jumpHUD.oxo
code/branches/presentationFS14/src/modules/jump/
code/branches/presentationFS14/src/modules/jump/CMakeLists.txt
code/branches/presentationFS14/src/modules/jump/Jump.cc
code/branches/presentationFS14/src/modules/jump/Jump.h
code/branches/presentationFS14/src/modules/jump/JumpBoots.cc
code/branches/presentationFS14/src/modules/jump/JumpBoots.h
code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.cc
code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.h
code/branches/presentationFS14/src/modules/jump/JumpEnemy.cc
code/branches/presentationFS14/src/modules/jump/JumpEnemy.h
code/branches/presentationFS14/src/modules/jump/JumpFigure.cc
code/branches/presentationFS14/src/modules/jump/JumpFigure.h
code/branches/presentationFS14/src/modules/jump/JumpItem.cc
code/branches/presentationFS14/src/modules/jump/JumpItem.h
code/branches/presentationFS14/src/modules/jump/JumpPlatform.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatform.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.h
code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.cc
code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.h
code/branches/presentationFS14/src/modules/jump/JumpPrereqs.h
code/branches/presentationFS14/src/modules/jump/JumpProjectile.cc
code/branches/presentationFS14/src/modules/jump/JumpProjectile.h
code/branches/presentationFS14/src/modules/jump/JumpPropeller.cc
code/branches/presentationFS14/src/modules/jump/JumpPropeller.h
code/branches/presentationFS14/src/modules/jump/JumpRocket.cc
code/branches/presentationFS14/src/modules/jump/JumpRocket.h
code/branches/presentationFS14/src/modules/jump/JumpScore.cc
code/branches/presentationFS14/src/modules/jump/JumpScore.h
code/branches/presentationFS14/src/modules/jump/JumpShield.cc
code/branches/presentationFS14/src/modules/jump/JumpShield.h
code/branches/presentationFS14/src/modules/jump/JumpSpring.cc
code/branches/presentationFS14/src/modules/jump/JumpSpring.h
Modified:
code/branches/presentationFS14/src/modules/CMakeLists.txt
code/branches/presentationFS14/src/modules/invader/InvaderWeapon.cc
Log:
Merged Jump minigame, tested, works.
Added: code/branches/presentationFS14/data/levels/jump.oxw
===================================================================
--- code/branches/presentationFS14/data/levels/jump.oxw (rev 0)
+++ code/branches/presentationFS14/data/levels/jump.oxw 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,260 @@
+<LevelInfo
+ name = "Jump"
+ description = "Jump in space!"
+ tags = "minigame"
+ screenshot = "jump.png"
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("jumpHUD.oxo")
+ include("stats.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<Template name=jumpfigurecameras defaults=0>
+ <JumpFigure>
+ <camerapositions>
+ <CameraPosition position="0,-150,0" absolute=true mouselook=false drag=false lookat="0,0,0"/>
+ </camerapositions>
+ </JumpFigure>
+</Template>
+
+<Template name=figureLeftHand defaults=0>
+ <Model position="4.0,0.0,5.0" mesh="JumpFigureLeftHand.mesh" scale=1>
+ </Model>
+</Template>
+
+<Template name=figureRightHand defaults=0>
+ <Model position="-4.0,0.0,5.0" mesh="JumpFigureRightHand.mesh" scale=1>
+ </Model>
+</Template>
+
+<Template name=jumpFigureTemplate>
+ <JumpFigure camerapositiontemplate=jumpfigurecameras mouseFactor="100.0" modelLefthand=figureLeftHand modelRighthand=figureRightHand rocketPos=8.0 propellerPos=8.0 bootsPos=-5.2 jumpSpeed=250.0 handMinAngle=-20 handMaxAngle=75 handSpeed=250 rocketSpeed=250.0 propellerSpeed=150.0>
+ <attached>
+ <Model position="0,0,0" mesh="JumpFigure.mesh" scale=1 pitch=90/>
+ </attached>
+ </JumpFigure>
+</Template>
+
+<Template name=jumpProjectileTemplate>
+ <JumpProjectile>
+ <attached>
+ <Model mesh="JumpProjectile.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scale=1 pitch=0 roll=0 position="0, 0, 0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpProjectile>
+</Template>
+
+<Template name=jumpPlatformStaticTemplate>
+ <JumpPlatformStatic height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform01.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.9, 0.4, 0.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformStatic>
+</Template>
+
+<Template name=jumpPlatformHMoveTemplate>
+ <JumpPlatformHMove height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform02.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.1, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformHMove>
+</Template>
+
+<Template name=jumpPlatformVMoveTemplate>
+ <JumpPlatformVMove height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform03.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="1.0, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformVMove>
+</Template>
+
+<Template name=jumpPlatformDisappearTemplate>
+ <JumpPlatformDisappear height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform04.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.1, 1.0, 0.1" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformDisappear>
+</Template>
+
+<Template name=jumpPlatformTimerTemplate>
+ <JumpPlatformTimer height=3 width=19 effectPath="Orxonox/BigExplosion1part2" effectStartTime="0.4">
+ <attached>
+ <Model mesh="JumpPlatform05.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="-4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="0, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpPlatformTimer>
+</Template>
+
+<Template name=jumpPlatformFakeTemplate>
+ <JumpPlatformFake height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform06.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scale3D="0.2,0.2,0.2" pitch=0 roll=0 position="0, 0, -2.5" source="Orxonox/sparks" lifetime=1.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpPlatformFake>
+</Template>
+
+<Template name=jumpEnemy1Template>
+ <JumpEnemy height=13 width=35>
+ <attached>
+ <Model mesh="JumpEnemy1.mesh" scale=1 pitch=90/>
+ <FadingBillboard active=true scale=0.09 position="0, 0, 10" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <Backlight scale=0.33 name=bltest position="0, 0, -10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy2Template>
+ <JumpEnemy height=15 width=36>
+ <attached>
+ <Model mesh="JumpEnemy2.mesh" scale=1 pitch=90/>
+ <MovableEntity position="-16, 0, 2" rotationaxis="0, 1, 0" rotationrate=500 >
+ <attached>
+ <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
+ </attached>
+ </MovableEntity>
+ <MovableEntity position="16, 0, 2" rotationaxis="0, 1, 0" rotationrate=500 >
+ <attached>
+ <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
+ </attached>
+ </MovableEntity>
+ <ParticleEmitter scale3D="1.0,1.0,1.0" pitch=0 roll=0 position="-1, 0, -3" source="Orxonox/laser" lifetime=1.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy3Template>
+ <JumpEnemy height=18.5 width=14>
+ <attached>
+ <Model mesh="JumpEnemy3.mesh" scale=1 pitch=90/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="0, -11, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="-6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy4Template>
+ <JumpEnemy height=12.5 width=36 rotationaxis="0, 0, 1" rotationrate=40 >
+ <attached>
+ <Model mesh="JumpEnemy4.mesh" scale=1 pitch=90/>
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpSpringTemplate>
+ <JumpSpring height=6 width=9.25>
+ <attached>
+ <Model mesh="JumpSpring.mesh" scale=1 rotationaxis="0, 0, 1" pitch=90 position="0.0, 0.0, 0.0"/>
+ </attached>
+ </JumpSpring>
+</Template>
+
+<Template name=jumpRocketTemplate>
+ <JumpRocket height=8.5 width=13.5>
+ <attached>
+ <Model mesh="JumpRocket.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpRocket>
+</Template>
+
+<Template name=jumpPropellerTemplate>
+ <JumpPropeller height=4 width=15.5>
+ <attached>
+ <Model mesh="JumpPropeller.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpPropeller>
+</Template>
+
+<Template name=jumpBootsTemplate>
+ <JumpBoots height=5.2 width=3.5>
+ <attached>
+ <Model mesh="JumpBoots.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpBoots>
+</Template>
+
+<Template name=jumpShieldTemplate>
+ <JumpShield height=1.55 width=15.5>
+ <attached>
+ <Model mesh="JumpShield.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpShield>
+</Template>
+
+<Level gametype = "Jump">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/>
+ <JumpBot />
+
+ <Scene ambientlight="1.0, 1.0, 1.0" skybox="Orxonox/skyBoxBasic">
+ <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 position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />
+
+ <MovableEntity>
+ <attached>
+ <JumpCenterpoint
+ name=jumpcenter
+ dimension="120,80"
+ sectionLength="150"
+ platformSpeed="20"
+ cameraOffset="10"
+
+ platformStaticTemplate=jumpPlatformStaticTemplate
+ platformHMoveTemplate=jumpPlatformHMoveTemplate
+ platformVMoveTemplate=jumpPlatformVMoveTemplate
+ platformDisappearTemplate=jumpPlatformDisappearTemplate
+ platformTimerTemplate=jumpPlatformTimerTemplate
+ platformFakeTemplate=jumpPlatformFakeTemplate
+ figureTemplate=jumpFigureTemplate
+ projectileTemplate=jumpProjectileTemplate
+ springTemplate=jumpSpringTemplate
+ rocketTemplate=jumpRocketTemplate
+ propellerTemplate=jumpPropellerTemplate
+ bootsTemplate=jumpBootsTemplate
+ shieldTemplate=jumpShieldTemplate
+ enemy1Template=jumpEnemy1Template
+ enemy2Template=jumpEnemy2Template
+ enemy3Template=jumpEnemy3Template
+ enemy4Template=jumpEnemy4Template
+ >
+
+ <attached>
+
+ <Model position="0,0,-1000" mesh="JumpPlatform01.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform02.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform03.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform04.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform05.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform06.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpProjectile.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy1.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy2.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy2Wing.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy3.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy4.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpSpring.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpRocket.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPropeller.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpShield.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpBoots.mesh" scale="1" />
+ </attached>
+ </JumpCenterpoint>
+ </attached>
+ </MovableEntity>
+ </Scene>
+</Level>
Added: code/branches/presentationFS14/data/overlays/jumpHUD.oxo
===================================================================
--- code/branches/presentationFS14/data/overlays/jumpHUD.oxo (rev 0)
+++ code/branches/presentationFS14/data/overlays/jumpHUD.oxo 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,27 @@
+<Template name="JumpHUD">
+ <OverlayGroup name="JumpHUD" scale = "1, 1">
+ <JumpScore
+ position = "0.5, 0.05"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.06
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "center"
+ showScore = true
+ showMessages = false
+ />
+
+ <JumpScore
+ position = "0.5, 0.5"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.2
+ colour = "1.0, 0.0, 0.0, 1.0"
+ align = "center"
+ gameOverText = "GAME OVER"
+ showScore = false
+ showMessages = true
+ />
+
+ </OverlayGroup>
+</Template>
Modified: code/branches/presentationFS14/src/modules/CMakeLists.txt
===================================================================
--- code/branches/presentationFS14/src/modules/CMakeLists.txt 2014-05-27 07:54:25 UTC (rev 10077)
+++ code/branches/presentationFS14/src/modules/CMakeLists.txt 2014-05-27 08:35:27 UTC (rev 10078)
@@ -39,3 +39,4 @@
ADD_SUBDIRECTORY(docking)
ADD_SUBDIRECTORY(towerdefense)
ADD_SUBDIRECTORY(invader)
+ADD_SUBDIRECTORY(jump)
Modified: code/branches/presentationFS14/src/modules/invader/InvaderWeapon.cc
===================================================================
--- code/branches/presentationFS14/src/modules/invader/InvaderWeapon.cc 2014-05-27 07:54:25 UTC (rev 10077)
+++ code/branches/presentationFS14/src/modules/invader/InvaderWeapon.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -56,8 +56,11 @@
RegisterObject(InvaderWeapon);
}
- InvaderWeapon::~InvaderWeapon(){}
+ InvaderWeapon::~InvaderWeapon()
+ {
+ }
+
void InvaderWeapon::shot()
{
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
Added: code/branches/presentationFS14/src/modules/jump/CMakeLists.txt
===================================================================
--- code/branches/presentationFS14/src/modules/jump/CMakeLists.txt (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/CMakeLists.txt 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,33 @@
+SET_SOURCE_FILES(JUMP_SRC_FILES
+BUILD_UNIT JumpBuildUnit.cc
+ Jump.cc
+ JumpPlatform.cc
+ JumpPlatformStatic.cc
+ JumpPlatformHMove.cc
+ JumpPlatformVMove.cc
+ JumpPlatformDisappear.cc
+ JumpPlatformTimer.cc
+ JumpPlatformFake.cc
+ JumpProjectile.cc
+ JumpEnemy.cc
+ JumpFigure.cc
+ JumpItem.cc
+ JumpSpring.cc
+ JumpRocket.cc
+ JumpShield.cc
+ JumpPropeller.cc
+ JumpBoots.cc
+ JumpCenterpoint.cc
+ JumpScore.cc
+END_BUILD_UNIT
+)
+
+ORXONOX_ADD_LIBRARY(jump
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ weapons
+ SOURCE_FILES ${JUMP_SRC_FILES}
+)
Added: code/branches/presentationFS14/src/modules/jump/Jump.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/Jump.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/Jump.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,1277 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Jump.cc
+ @brief This is the gametype for the awesome minigame. Here the level is randomly created, the camera is shifted, ...
+*/
+
+#include "Jump.h"
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
+#include "JumpCenterpoint.h"
+#include "JumpPlatform.h"
+#include "JumpPlatformStatic.h"
+#include "JumpPlatformHMove.h"
+#include "JumpPlatformVMove.h"
+#include "JumpPlatformDisappear.h"
+#include "JumpPlatformTimer.h"
+#include "JumpPlatformFake.h"
+#include "JumpProjectile.h"
+#include "JumpEnemy.h"
+#include "JumpFigure.h"
+#include "JumpItem.h"
+#include "JumpSpring.h"
+#include "JumpRocket.h"
+#include "JumpPropeller.h"
+#include "JumpBoots.h"
+#include "JumpShield.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(Jump);
+
+ Jump::Jump(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(Jump);
+
+ center_ = 0;
+ figure_ = 0;
+ camera = 0;
+ setHUDTemplate("JumpHUD");
+
+ setConfigValues();
+ }
+
+ Jump::~Jump()
+ {
+ if (isInitialized())
+ {
+ cleanup();
+ }
+ }
+
+ void Jump::tick(float dt)
+ {
+ SUPER(Jump, tick, dt);
+
+ if (figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getPosition();
+ Vector3 figureVelocity = figure_->getVelocity();
+
+ float boundary = totalScreenShift_+center_->getCameraOffset();
+
+ if (figurePosition.z > boundary)
+ {
+ screenShiftSinceLastUpdate_ += figurePosition.z - boundary;
+ totalScreenShift_ = figurePosition.z - center_->getCameraOffset();
+
+ // Create new platforms if needed
+ if (screenShiftSinceLastUpdate_ > center_->getSectionLength())
+ {
+ if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == false && figure_->rocketActive_ == false && addAdventure(adventureNumber_) == true)
+ {
+ screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength();
+ ++ adventureNumber_;
+ }
+ else
+ {
+ screenShiftSinceLastUpdate_ -= center_->getSectionLength();
+ addSection();
+ }
+ }
+ }
+
+ if (figurePosition.z < totalScreenShift_ - center_->getFieldDimension().y + platformHeight_ && figureVelocity.z < 0)
+ {
+ figure_->dead_ = true;
+ }
+
+ if (figure_->fireSignal_ == true)
+ {
+ if (figure_->dead_ == true)
+ {
+ end();
+ }
+ else
+ {
+ figure_->fireSignal_ = false;
+ addProjectile(figurePosition.x, figurePosition.z + figure_->getPropellerPos());
+ }
+ }
+
+
+ if (camera != NULL)
+ {
+ Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0);
+ camera->setPosition(cameraPosition);
+ }
+ else
+ {
+ orxout() << "No camera found." << endl;
+ }
+ }
+
+ ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin();
+ ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end();
+ ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform;
+ Vector3 platformPosition;
+
+ while (itPlatform != endPlatform)
+ {
+ platformPosition = itPlatform->getPosition();
+ if (platformPosition.z < totalScreenShift_ - center_->getFieldDimension().y)
+ {
+ ObjectList<JumpPlatform>::iterator temp = itPlatform;
+ ++ itPlatform;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itPlatform;
+ }
+ }
+
+ // Deleted deactivated platforms
+ ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin();
+ ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end();
+ ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear;
+
+ while (itDisappear != endDisappear)
+ {
+ if (!itDisappear->isActive())
+ {
+ ObjectList<JumpPlatformDisappear>::iterator temp = itDisappear;
+ ++ itDisappear;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itDisappear;
+ }
+ }
+
+ ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin();
+ ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end();
+ ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer;
+
+ while (itTimer != endTimer)
+ {
+ if (!itTimer->isActive())
+ {
+ ObjectList<JumpPlatformTimer>::iterator temp = itTimer;
+ ++ itTimer;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itTimer;
+ }
+ }
+
+ ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin();
+ ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end();
+ ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile;
+ Vector3 projectilePosition;
+
+ while (itProjectile != endProjectile)
+ {
+ projectilePosition = itProjectile->getPosition();
+ if (projectilePosition.z > totalScreenShift_ + 5*center_->getFieldDimension().y)
+ {
+ ObjectList<JumpProjectile>::iterator temp = itProjectile;
+ ++ itProjectile;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itProjectile;
+ }
+ }
+
+ ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin();
+ ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end();
+ ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy;
+ Vector3 enemyPosition;
+
+ while (itEnemy != endEnemy)
+ {
+ enemyPosition = itEnemy->getPosition();
+ if (enemyPosition.z < totalScreenShift_ - center_->getFieldDimension().y || itEnemy->dead_ == true)
+ {
+ ObjectList<JumpEnemy>::iterator temp = itEnemy;
+ ++ itEnemy;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itEnemy;
+ }
+ }
+
+ ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin();
+ ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end();
+ ObjectList<JumpItem>::iterator itItem = beginItem;
+ Vector3 itemPosition;
+
+ while (itItem != endItem)
+ {
+ itemPosition = itItem->getPosition();
+
+ WorldEntity* parent = itItem->getParent();
+
+ if (itItem->attachedToFigure_ == false && itemPosition.z < totalScreenShift_ - center_->getFieldDimension().y && parent == center_)
+ {
+ ObjectList<JumpItem>::iterator temp = itItem;
+ ++ itItem;
+ center_->detach(*temp);
+ temp->destroy();
+ }
+ else
+ {
+ ++ itItem;
+ }
+ }
+ }
+
+ void Jump::cleanup()
+ {
+ camera = 0;
+ }
+
+ void Jump::start()
+ {
+ if (center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.
+ {
+ if (figure_ == NULL)
+ {
+ figure_ = new JumpFigure(center_->getContext());
+ figure_->addTemplate(center_->getFigureTemplate());
+ figure_->InitializeAnimation(center_->getContext());
+ }
+
+ center_->attach(figure_);
+ figure_->setPosition(0, 0, 0);
+ figure_->setFieldDimension(center_->getFieldDimension());
+ }
+ else // If no centerpoint was specified, an error is thrown and the level is exited.
+ {
+ orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
+ GSLevel::startMainMenu();
+ return;
+ }
+
+ // Call start for the parent class.
+ Deathmatch::start();
+
+ if (figure_ != NULL)
+ {
+ camera = figure_->getCamera();
+ }
+
+ totalScreenShift_ = 0.0;
+ screenShiftSinceLastUpdate_ = 0.0;
+ sectionNumber_ = 0;
+ adventureNumber_ = 0;
+
+ addStartSection();
+ addSection();
+ addSection();
+ }
+
+ void Jump::end()
+ {
+ cleanup();
+ GSLevel::startMainMenu();
+
+ Deathmatch::end();
+ }
+
+ void Jump::spawnPlayer(PlayerInfo* player)
+ {
+ assert(player);
+
+ if (figure_->getPlayer() == NULL)
+ {
+ player->startControl(figure_);
+ players_[player].state_ = PlayerState::Alive;
+ }
+ }
+
+ PlayerInfo* Jump::getPlayer() const
+ {
+ if (this->figure_ != NULL)
+ {
+ return this->figure_->getPlayer();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ void Jump::addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition)
+ {
+ if (newPlatform != NULL && center_ != NULL)
+ {
+ newPlatform->addTemplate(platformTemplate);
+ newPlatform->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newPlatform->setFigure(this->figure_);
+ center_->attach(newPlatform);
+ }
+ }
+
+ JumpPlatformStatic* Jump::addPlatformStatic(float xPosition, float zPosition)
+ {
+ JumpPlatformStatic* newPlatform = new JumpPlatformStatic(center_->getContext());
+ addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, zPosition);
+
+ return newPlatform;
+ }
+
+ JumpPlatformHMove* Jump::addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed)
+ {
+ JumpPlatformHMove* newPlatform = new JumpPlatformHMove(center_->getContext());
+ newPlatform->setProperties(leftBoundary, rightBoundary, speed);
+ addPlatform(newPlatform, center_->getPlatformHMoveTemplate(), xPosition, zPosition);
+
+ return newPlatform;
+ }
+
+ JumpPlatformVMove* Jump::addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed)
+ {
+ JumpPlatformVMove* newPlatform = new JumpPlatformVMove(center_->getContext());
+ newPlatform->setProperties(lowerBoundary, upperBoundary, speed);
+ addPlatform(newPlatform, center_->getPlatformVMoveTemplate(), xPosition, zPosition);
+
+ return newPlatform;
+ }
+
+ JumpPlatformDisappear* Jump::addPlatformDisappear(float xPosition, float zPosition)
+ {
+ JumpPlatformDisappear* newPlatform = new JumpPlatformDisappear(center_->getContext());
+ newPlatform->setProperties(true);
+ addPlatform(newPlatform, center_->getPlatformDisappearTemplate(), xPosition, zPosition);
+
+ return newPlatform;
+ }
+
+ JumpPlatformTimer* Jump::addPlatformTimer(float xPosition, float zPosition, float time, float variance)
+ {
+ float additionalTime = (float)(rand()%100)/(100*variance) - variance/2;
+
+ JumpPlatformTimer* newPlatform = new JumpPlatformTimer(center_->getContext());
+ newPlatform->setProperties(time + additionalTime);
+ addPlatform(newPlatform, center_->getPlatformTimerTemplate(), xPosition, zPosition);
+
+ return newPlatform;
+ }
+
+ JumpPlatformFake* Jump::addPlatformFake(float xPosition, float zPosition)
+ {
+ JumpPlatformFake* newPlatform = new JumpPlatformFake(center_->getContext());
+ addPlatform(newPlatform, center_->getPlatformFakeTemplate(), xPosition, zPosition);
+ newPlatform->setAngularVelocity(Vector3(0, 0, 2.0));
+
+ return newPlatform;
+ }
+
+
+ void Jump::addProjectile(float xPosition, float zPosition)
+ {
+ JumpProjectile* newProjectile = new JumpProjectile(center_->getContext());
+ if (newProjectile != NULL && center_ != NULL)
+ {
+ newProjectile->addTemplate(center_->getProjectileTemplate());
+ newProjectile->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newProjectile->setFieldDimension(center_->getFieldDimension());
+ newProjectile->setFigure(this->figure_);
+ center_->attach(newProjectile);
+ }
+ }
+
+ void Jump::addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpSpring* newSpring = new JumpSpring(center_->getContext());
+ if (newSpring != NULL && center_ != NULL)
+ {
+ newSpring->addTemplate(center_->getSpringTemplate());
+ newSpring->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newSpring->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newSpring->setFigure(figure_);
+ center_->attach(newSpring);
+ }
+ }
+
+ void Jump::addSpring(JumpPlatform* platform)
+ {
+ JumpSpring* newSpring = new JumpSpring(center_->getContext());
+ if (newSpring != NULL && center_ != NULL)
+ {
+ newSpring->addTemplate(center_->getSpringTemplate());
+ newSpring->setPosition(Vector3(0.0, 0.0, 0.0));
+ newSpring->setProperties(-10.0, 10.0, -10.0, 10.0, 0.0, 0.0);
+ newSpring->setFigure(figure_);
+ platform->attach(newSpring);
+ }
+ }
+
+ void Jump::addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpRocket* newRocket = new JumpRocket(center_->getContext());
+ if (newRocket != NULL && center_ != NULL)
+ {
+ newRocket->addTemplate(center_->getRocketTemplate());
+ newRocket->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newRocket->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newRocket->setFigure(figure_);
+ center_->attach(newRocket);
+ }
+ }
+
+ void Jump::addRocket(JumpPlatform* platform)
+ {
+ JumpRocket* newRocket = new JumpRocket(center_->getContext());
+ if (newRocket != NULL && center_ != NULL)
+ {
+ newRocket->addTemplate(center_->getRocketTemplate());
+ newRocket->setPosition(Vector3(0.0, 0.0, 0.0));
+ newRocket->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ newRocket->setFigure(figure_);
+ platform->attach(newRocket);
+ }
+ }
+
+ void Jump::addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
+ if (newPropeller != NULL && center_ != NULL)
+ {
+ newPropeller->addTemplate(center_->getPropellerTemplate());
+ newPropeller->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newPropeller->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newPropeller->setFigure(figure_);
+ center_->attach(newPropeller);
+ }
+ }
+
+ void Jump::addPropeller(JumpPlatform* platform)
+ {
+ JumpPropeller* newPropeller = new JumpPropeller(center_->getContext());
+ if (newPropeller != NULL && center_ != NULL)
+ {
+ newPropeller->addTemplate(center_->getPropellerTemplate());
+ newPropeller->setPosition(Vector3(0.0, 0.0, 0.0));
+ newPropeller->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ newPropeller->setFigure(figure_);
+ platform->attach(newPropeller);
+ }
+ }
+
+ void Jump::addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpBoots* newBoots = new JumpBoots(center_->getContext());
+ if (newBoots != NULL && center_ != NULL)
+ {
+ newBoots->addTemplate(center_->getBootsTemplate());
+ newBoots->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newBoots->setFigure(figure_);
+ center_->attach(newBoots);
+ }
+ }
+
+ void Jump::addBoots(JumpPlatform* platform)
+ {
+ JumpBoots* newBoots = new JumpBoots(center_->getContext());
+ if (newBoots != NULL && center_ != NULL)
+ {
+ newBoots->addTemplate(center_->getBootsTemplate());
+ newBoots->setPosition(Vector3(0.0, 0.0, 0.0));
+ newBoots->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ newBoots->setFigure(figure_);
+ platform->attach(newBoots);
+ }
+ }
+
+ void Jump::addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpShield* newShield = new JumpShield(center_->getContext());
+ if (newShield != NULL && center_ != NULL)
+ {
+ newShield->addTemplate(center_->getShieldTemplate());
+ newShield->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newShield->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newShield->setFigure(figure_);
+ center_->attach(newShield);
+ }
+ }
+
+ void Jump::addShield(JumpPlatform* platform)
+ {
+ JumpShield* newShield = new JumpShield(center_->getContext());
+ if (newShield != NULL && center_ != NULL)
+ {
+ newShield->addTemplate(center_->getShieldTemplate());
+ newShield->setPosition(Vector3(0.0, 0.0, 0.0));
+ newShield->setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ newShield->setFigure(figure_);
+ platform->attach(newShield);
+ }
+ }
+
+ void Jump::addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity)
+ {
+ JumpEnemy* newEnemy = new JumpEnemy(center_->getContext());
+ if (newEnemy != NULL && center_ != NULL)
+ {
+ switch (type)
+ {
+ case 1:
+ newEnemy->addTemplate(center_->getEnemy1Template());
+ break;
+ case 2:
+ newEnemy->addTemplate(center_->getEnemy2Template());
+ break;
+ case 3:
+ newEnemy->addTemplate(center_->getEnemy3Template());
+ break;
+ case 4:
+ newEnemy->addTemplate(center_->getEnemy4Template());
+ break;
+ default:
+ return;
+ }
+
+ newEnemy->setPosition(Vector3(xPosition, 0.0, zPosition));
+ newEnemy->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ newEnemy->setFieldDimension(center_->getFieldDimension());
+ newEnemy->setFigure(this->figure_);
+ center_->attach(newEnemy);
+ }
+ }
+
+ void Jump::addStartSection()
+ {
+ JumpPlatform* newPlatform;
+
+ float sectionLength = center_->getSectionLength();
+
+ newPlatform = new JumpPlatformStatic(center_->getContext());
+ addPlatform(newPlatform, center_->getPlatformStaticTemplate(), 0.0, -0.05*sectionLength);
+
+ platformWidth_ = newPlatform->getWidth();
+ platformHeight_ = newPlatform->getHeight();
+
+ for (float xPosition = platformWidth_; xPosition <= center_->getFieldDimension().x; xPosition += platformWidth_)
+ {
+ newPlatform = new JumpPlatformStatic(center_->getContext());
+ addPlatform(newPlatform, center_->getPlatformStaticTemplate(), xPosition, -0.05*sectionLength);
+ newPlatform = new JumpPlatformStatic(center_->getContext());
+ addPlatform(newPlatform, center_->getPlatformStaticTemplate(), -xPosition, -0.05*sectionLength);
+ }
+ }
+
+ void Jump::addSection()
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+ float sectionLength = center_->getSectionLength();
+ float sectionBegin = sectionNumber_ * sectionLength;
+ float sectionEnd = (1 + sectionNumber_) * sectionLength;
+
+ int numI = 6;
+ int numJ = 4;
+
+ enum PlatformType
+ {
+ PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE
+ };
+
+ enum ItemType
+ {
+ ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD
+ };
+
+ struct PlatformMatrix
+ {
+ PlatformType type;
+ bool done;
+ } matrix[numI][numJ];
+
+
+ for (int i = 0; i < numI; ++i)
+ {
+ for (int j = 0; j < numJ; ++j)
+ {
+ matrix[i][j].type = PLATFORM_EMPTY;
+ matrix[i][j].done = false;
+ }
+ }
+ PlatformType platformtype1;
+ PlatformType platformtype2;
+ ItemType itemType = ITEM_NOTHING;
+
+ if (rand()%2 == 0)
+ {
+ itemType = ITEM_SPRING;
+ }
+ else if (rand()%2 == 0 && sectionNumber_ > 3)
+ {
+ switch(rand()%4)
+ {
+ case 0:
+ itemType = ITEM_PROPELLER;
+ break;
+ case 1:
+ itemType = ITEM_ROCKET;
+ break;
+ case 2:
+ itemType = ITEM_BOOTS;
+ break;
+ case 3:
+ itemType = ITEM_SHIELD;
+ break;
+ default:
+ break;
+ }
+ }
+
+ switch((sectionNumber_ > 28) ? rand()%29 : rand()%(sectionNumber_+1))
+ {
+ case 0:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 1:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 2:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 3:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 4:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 5:
+ platformtype1 = PLATFORM_STATIC;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ case 6:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 7:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 8:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 9:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 10:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 11:
+ platformtype1 = PLATFORM_HMOVE;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ case 12:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 13:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 14:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 15:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 16:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 17:
+ platformtype1 = PLATFORM_DISAPPEAR;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ case 18:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 19:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 20:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 21:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 22:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 23:
+ platformtype1 = PLATFORM_VMOVE;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ case 24:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_STATIC;
+ break;
+ case 25:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_HMOVE;
+ break;
+ case 26:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_DISAPPEAR;
+ break;
+ case 27:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_VMOVE;
+ break;
+ case 28:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ default:
+ platformtype1 = PLATFORM_TIMER;
+ platformtype2 = PLATFORM_TIMER;
+ break;
+ }
+
+ // Fill matrix with selected platform types
+ for (int i = 0; i < numI; ++ i)
+ {
+ for (int j = 0; j < numJ; ++ j)
+ {
+ if (rand()%3 == 0)
+ {
+ matrix[i][j].type = platformtype1;
+ }
+ else
+ {
+ matrix[i][j].type = platformtype2;
+ }
+ matrix[i][j].done = false;
+ }
+ }
+
+ if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+
+ // Delete some planned platforms or replace them with fake platforms
+ if (sectionNumber_ > 5)
+ {
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ }
+ else if (sectionNumber_ > 10)
+ {
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ }
+ else if (sectionNumber_ > 15)
+ {
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ if (rand()%2 == 0)
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_EMPTY;
+ }
+ else
+ {
+ matrix[rand()%numI][rand()%numJ].type = PLATFORM_FAKE;
+ }
+ }
+
+ std::vector<JumpPlatform*> platformList;
+
+ for (int i = 0; i < numI; ++ i)
+ {
+ for (int j = 0; j < numJ; ++ j)
+ {
+ if (matrix[i][j].done == false)
+ {
+ float xPosition = 0.0;
+ float zPosition = 0.0;
+ float leftBoundary = 0.0;
+ float rightBoundary = 0.0;
+ float lowerBoundary = 0.0;
+ float upperBoundary = 0.0;
+ float xVelocity = 0.0;
+ float zVelocity = 0.0;
+
+ switch(matrix[i][j].type)
+ {
+ case PLATFORM_EMPTY:
+ matrix[i][j].done = true;
+ break;
+ case PLATFORM_STATIC:
+ xPosition = randomXPosition(numJ, j);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformStatic(xPosition, zPosition));
+ matrix[i][j].done = true;
+ break;
+ case PLATFORM_FAKE:
+ xPosition = randomXPosition(numJ, j);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformFake(xPosition, zPosition));
+ matrix[i][j].done = true;
+ break;
+ case PLATFORM_TIMER:
+ xPosition = randomXPosition(numJ, j);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformTimer(xPosition, zPosition, 12.0, 1.5));
+ matrix[i][j].done = true;
+ break;
+ case PLATFORM_DISAPPEAR:
+ xPosition = randomXPosition(numJ, j);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformDisappear(xPosition, zPosition));
+ matrix[i][j].done = true;
+ break;
+ case PLATFORM_HMOVE:
+ xVelocity = randomSpeed();
+ if (j <= numJ-3 && matrix[i][j+1].type == PLATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)
+ {
+ leftBoundary = randomXPositionLeft(numJ, j);
+ rightBoundary = randomXPositionRight(numJ, j+2);
+ xPosition = randomPosition(leftBoundary, rightBoundary);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
+ matrix[i][j].done = true;
+ matrix[i][j+1].done = true;
+ matrix[i][j+2].done = true;
+ }
+ else if (j <= numJ-2 && matrix[i][j+1].type == PLATFORM_HMOVE && rand()%2 == 0)
+ {
+ leftBoundary = randomXPositionLeft(numJ, j);
+ rightBoundary = randomXPositionRight(numJ, j+1);
+ xPosition = randomPosition(leftBoundary, rightBoundary);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
+ matrix[i][j].done = true;
+ matrix[i][j+1].done = true;
+ }
+ else
+ {
+ leftBoundary = randomXPositionLeft(numJ, j);
+ rightBoundary = randomXPositionRight(numJ, j);
+ xPosition = randomPosition(leftBoundary, rightBoundary);
+ zPosition = sectionBegin + i*sectionLength/numI;
+ platformList.push_back(addPlatformHMove(xPosition, zPosition, leftBoundary, rightBoundary, xVelocity));
+ matrix[i][j].done = true;
+ }
+ break;
+ case PLATFORM_VMOVE:
+ zVelocity = randomSpeed();
+ if (i <= numI-3 && matrix[i+1][j].type == PLATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)
+ {
+ lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
+ upperBoundary = randomZPositionUpper(numI, i+2, sectionBegin, sectionEnd);
+ zPosition = randomPosition(lowerBoundary, upperBoundary);
+ xPosition = randomXPosition(numJ, j);
+ platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
+ matrix[i][j].done = true;
+ matrix[i+1][j].done = true;
+ matrix[i+2][j].done = true;
+ }
+ else if (i <= numI-2 && matrix[i+1][j].type == PLATFORM_VMOVE && rand()%2 == 0)
+ {
+ lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
+ upperBoundary = randomZPositionUpper(numI, i+1, sectionBegin, sectionEnd);
+ zPosition = randomPosition(lowerBoundary, upperBoundary);
+ xPosition = randomXPosition(numJ, j);
+ platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
+ matrix[i][j].done = true;
+ matrix[i+1][j].done = true;
+ }
+ else
+ {
+ lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd);
+ upperBoundary = randomZPositionUpper(numI, i, sectionBegin, sectionEnd);
+ zPosition = randomPosition(lowerBoundary, upperBoundary);
+ xPosition = randomXPosition(numJ, j);
+ platformList.push_back(addPlatformVMove(xPosition, zPosition, lowerBoundary, upperBoundary, zVelocity));
+ matrix[i][j].done = true;
+ }
+ break;
+ default:
+ //ERROR
+ break;
+
+ }
+ }
+ }
+ }
+
+ //Add items
+ int numNewPlatforms = platformList.size();
+
+ if (rand()%4 == 0)
+ {
+ if (rand()%2 == 0)
+ {
+ switch (itemType)
+ {
+ case ITEM_ROCKET:
+ addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
+ break;
+ case ITEM_PROPELLER:
+ addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
+ break;
+ case ITEM_BOOTS:
+ addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
+ break;
+ case ITEM_SHIELD:
+ addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (itemType)
+ {
+ case ITEM_ROCKET:
+ addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
+ break;
+ case ITEM_PROPELLER:
+ addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
+ break;
+ case ITEM_BOOTS:
+ addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
+ break;
+ case ITEM_SHIELD:
+ addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (numNewPlatforms > 0)
+ {
+ JumpPlatform* itemPlatform = platformList[rand()%numNewPlatforms];
+
+ switch (itemType)
+ {
+ case ITEM_SPRING:
+ addSpring(itemPlatform);
+ break;
+ case ITEM_ROCKET:
+ addRocket(itemPlatform);
+ break;
+ case ITEM_PROPELLER:
+ addPropeller(itemPlatform);
+ break;
+ case ITEM_BOOTS:
+ addBoots(itemPlatform);
+ break;
+ case ITEM_SHIELD:
+ addShield(itemPlatform);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (sectionNumber_ >= 5 && rand()%3 == 0)
+ {
+ switch(rand()%4)
+ {
+ case 0:
+ addEnemy(1, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
+ break;
+ case 1:
+ addEnemy(2, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
+ break;
+ case 2:
+ addEnemy(3, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
+ break;
+ case 3:
+ addEnemy(4, randomXPosition(), randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/3*2, fieldWidth/3*2, sectionBegin, sectionBegin + sectionLength, randomSpeed(), 0.0);
+ break;
+ }
+ }
+ ++ sectionNumber_;
+ }
+
+ bool Jump::addAdventure(int number)
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+ float sectionLength = center_->getSectionLength();
+ float sectionBegin = sectionNumber_ * sectionLength;
+ sectionLength *= 2;
+
+ switch(number)
+ {
+ case 0:
+ {
+ int numI = 10;
+ if (rand()%2 == 0)
+ {
+ for (int i = 0; i < numI; ++ i)
+ {
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+i*sectionLength/numI);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < numI; ++ i)
+ {
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+(numI-i)*sectionLength/numI);
+ }
+ }
+ break;
+ }
+ case 1:
+ {
+ int numI = 7;
+
+ addPlatformStatic(0.0, sectionBegin);
+ if (rand()%2 == 0)
+ {
+ for (int i = 1; i < numI; ++ i)
+ {
+ addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
+ addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+i*sectionLength/numI);
+ }
+ }
+ else
+ {
+ for (int i = 1; i < numI; ++ i)
+ {
+ addPlatformStatic((fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI);
+ addPlatformStatic(-(fieldWidth-platformWidth_/2)*i/numI, sectionBegin+(numI-i)*sectionLength/numI);
+ }
+ }
+ break;
+ }
+ case 2:
+ {
+ int numI = 5;
+ for (int i = 0; i <= numI; ++ i)
+ {
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin);
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength/5);
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*2/5);
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*3/5);
+ addPlatformStatic((2*fieldWidth-platformWidth_)*i/numI-fieldWidth, sectionBegin+sectionLength*4/5);
+ addEnemy(4, (2*fieldWidth-platformWidth_)*i/numI-fieldWidth+platformWidth_/2, sectionBegin+sectionLength/2, -fieldWidth, fieldWidth, sectionBegin, sectionBegin + sectionLength, 0.0, 0.0);
+ }
+ break;
+ }
+ case 3:
+ {
+ addRocket(addPlatformStatic(0.0, sectionBegin));
+ addEnemy(2, 0.0, sectionBegin+sectionLength/5, 0.0,0.0, 0.0, 0.0, 0.0, 0.0);
+ break;
+ }
+ case 4:
+ {
+ addPropeller(addPlatformStatic(0.0, sectionBegin));
+ addPropeller(addPlatformStatic(-fieldWidth/2, sectionBegin));
+ addPropeller(addPlatformStatic(fieldWidth/2, sectionBegin));
+ break;
+ }
+ default:
+ return false;
+ }
+ sectionNumber_ +=2;
+ return true;
+ }
+
+ float Jump::randomXPosition()
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+
+ return (float)(rand()%(2*(int)fieldWidth)) - fieldWidth;
+ }
+
+ float Jump::randomXPosition(int totalColumns, int culomn)
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+
+ float halfWidth = fieldWidth/totalColumns;
+ float leftBound = culomn*halfWidth*2-fieldWidth;
+ float rightBound = leftBound + 2*halfWidth;
+
+ return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
+ }
+
+ float Jump::randomXPositionLeft(int totalColumns, int culomn)
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+
+ float halfWidth = fieldWidth/totalColumns;
+ float leftBound = culomn*halfWidth*2-fieldWidth;
+ float rightBound = leftBound + 2*halfWidth/3;
+
+ return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
+ }
+
+ float Jump::randomXPositionRight(int totalColumns, int culomn)
+ {
+ float fieldWidth = center_->getFieldDimension().x;
+
+ float halfWidth = fieldWidth/totalColumns;
+ float rightBound = (culomn+1)*halfWidth*2-fieldWidth;
+ float leftBound = rightBound - 2*halfWidth/3;
+ return randomPosition(leftBound+platformWidth_/2, rightBound-platformWidth_/2);
+ }
+
+ float Jump::randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd)
+ {
+ float fieldHeight = SectionEnd - sectionBegin;
+ float halfHeight = fieldHeight/totalRows;
+ float lowerBound = row*halfHeight*2+sectionBegin;
+ float upperBound = lowerBound + 2*halfHeight;
+
+ return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
+ }
+
+ float Jump::randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd)
+ {
+ float fieldHeight = SectionEnd - sectionBegin;
+ float rowHeight = fieldHeight/totalRows;
+ float lowerBound = row*rowHeight+sectionBegin;
+ float upperBound = lowerBound + rowHeight/3;
+
+ return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
+ }
+
+ float Jump::randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd)
+ {
+ float fieldHeight = SectionEnd - sectionBegin;
+ float rowHeight = fieldHeight/totalRows;
+ float lowerBound = (row+1)*rowHeight+sectionBegin;
+ float upperBound = lowerBound - rowHeight/3;
+
+ return randomPosition(lowerBound+platformHeight_/2, upperBound-platformHeight_/2);
+ }
+
+ float Jump::randomPosition(float lowerBoundary, float upperBoundary)
+ {
+ if (lowerBoundary >= upperBoundary)
+ {
+ return (lowerBoundary + upperBoundary)/2;
+ }
+
+ return (float)(rand()%(int)(100*(upperBoundary - lowerBoundary)))/100 + lowerBoundary;
+ }
+
+ float Jump::randomSpeed()
+ {
+ float platformSpeed = center_->getPlatformSpeed();
+ return randomPosition(0.5*platformSpeed, 1.5*platformSpeed);
+ }
+
+ int Jump::getScore(PlayerInfo* player) const
+ {
+ return sectionNumber_ - 2;
+ }
+
+ bool Jump::getDead(PlayerInfo* player) const
+ {
+ return figure_->dead_;
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/Jump.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/Jump.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/Jump.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,102 @@
+/*
+ * 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:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Jump_H__
+#define _Jump_H__
+
+#include "jump/JumpPrereqs.h"
+#include "tools/Timer.h"
+#include "graphics/Camera.h"
+#include "gametypes/Deathmatch.h"
+#include "JumpCenterpoint.h"
+#include <list>
+
+namespace orxonox
+{
+ class _JumpExport Jump : public Deathmatch
+ {
+ public:
+ Jump(Context* context);
+ virtual ~Jump();
+ virtual void tick(float dt);
+ virtual void start();
+ virtual void end();
+ virtual void spawnPlayer(PlayerInfo* player);
+ int getScore(PlayerInfo* player) const;
+ bool getDead(PlayerInfo* player) const;
+ void setCenterpoint(JumpCenterpoint* center)
+ { center_ = center; }
+ PlayerInfo* getPlayer() const;
+
+ protected:
+ void cleanup();
+ virtual void addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition);
+ virtual JumpPlatformStatic* addPlatformStatic(float xPosition, float zPosition);
+ virtual JumpPlatformHMove* addPlatformHMove(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float speed);
+ virtual JumpPlatformVMove* addPlatformVMove(float xPosition, float zPosition, float lowerBoundary, float upperBoundary, float speed);
+ virtual JumpPlatformDisappear* addPlatformDisappear(float xPosition, float zPosition);
+ virtual JumpPlatformTimer* addPlatformTimer(float xPosition, float zPosition, float time, float variance);
+ virtual JumpPlatformFake* addPlatformFake(float xPosition, float zPosition);
+ virtual void addProjectile(float xPosition, float zPosition);
+ virtual void addEnemy(int type, float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addSpring(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addSpring(JumpPlatform* platform);
+ virtual void addRocket(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addRocket(JumpPlatform* platform);
+ virtual void addPropeller(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addPropeller(JumpPlatform* platform);
+ virtual void addBoots(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addBoots(JumpPlatform* platform);
+ virtual void addShield(float xPosition, float zPosition, float leftBoundary, float rightBoundary, float lowerBoundary, float upperBoundary, float xVelocity, float zVelocity);
+ virtual void addShield(JumpPlatform* platform);
+ virtual void addStartSection();
+ virtual void addSection();
+ virtual bool addAdventure(int number);
+ virtual float randomXPosition();
+ virtual float randomXPosition(int totalColumns, int culomn);
+ virtual float randomXPositionLeft(int totalColumns, int culomn);
+ virtual float randomXPositionRight(int totalColumns, int culomn);
+ virtual float randomZPosition(int totalRows, int row, float sectionBegin, float SectionEnd);
+ virtual float randomZPositionLower(int totalRows, int row, float sectionBegin, float SectionEnd);
+ virtual float randomZPositionUpper(int totalRows, int row, float sectionBegin, float SectionEnd);
+ virtual float randomPosition(float lowerBoundary, float upperBoundary);
+ virtual float randomSpeed();
+
+ WeakPtr<JumpCenterpoint> center_;
+ WeakPtr<JumpFigure> figure_;
+ WeakPtr<Camera> camera;
+ float totalScreenShift_;
+ float screenShiftSinceLastUpdate_;
+ int sectionNumber_;
+ int adventureNumber_;
+ float platformWidth_;
+ float platformHeight_;
+ };
+}
+
+#endif /* _Jump_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpBoots.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpBoots.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpBoots.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,104 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpBoots.cc
+ @brief These boots give the figure a speed bonus when it jumpes.
+*/
+
+#include "JumpBoots.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpBoots);
+
+ JumpBoots::JumpBoots(Context* context) : JumpItem(context)
+ {
+ RegisterObject(JumpBoots);
+
+ fuel_ = 3.0;
+ attachedToFigure_ = false;
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ JumpBoots::~JumpBoots()
+ {
+
+ }
+
+ void JumpBoots::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpBoots, XMLPort, xmlelement, mode);
+ }
+
+ void JumpBoots::tick(float dt)
+ {
+ SUPER(JumpBoots, tick, dt);
+
+ Vector3 rocketPosition = getWorldPosition();
+
+ if (attachedToFigure_ == false && figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getWorldPosition();
+
+ if(figurePosition.x > rocketPosition.x-width_ && figurePosition.x < rocketPosition.x+width_ && figurePosition.z > rocketPosition.z-height_ && figurePosition.z < rocketPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ else if (attachedToFigure_ == true)
+ {
+ fuel_ -= dt;
+ if (fuel_ < 0.0)
+ {
+ figure_->StopBoots(this);
+ }
+ }
+ }
+
+ void JumpBoots::touchFigure()
+ {
+ JumpItem::touchFigure();
+
+ attachedToFigure_ = figure_->StartBoots(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpBoots.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpBoots.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpBoots.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpBoots_H__
+#define _JumpBoots_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpBoots : public JumpItem
+ {
+ public:
+ JumpBoots(Context* context);
+ virtual ~JumpBoots();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void touchFigure();
+ protected:
+ float stretch_;
+ float fuel_;
+ };
+}
+
+#endif /* _JumpBoots_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpCenterpoint.cc
+ @brief The JumpCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the JumpCenterpoint.
+*/
+
+#include "JumpCenterpoint.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Jump.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpCenterpoint);
+
+ JumpCenterpoint::JumpCenterpoint(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(JumpCenterpoint);
+
+ width_ = 0.0;
+ height_ = 0.0;
+ sectionLength_ = 0.0;
+ platformSpeed_ = 0.0;
+
+ checkGametype();
+ }
+
+ void JumpCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpCenterpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpCenterpoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "sectionLength", setSectionLength, getSectionLength, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformSpeed", setPlatformSpeed, getPlatformSpeed, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformStaticTemplate", setPlatformStaticTemplate, getPlatformStaticTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformHMoveTemplate", setPlatformHMoveTemplate, getPlatformHMoveTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformVMoveTemplate", setPlatformVMoveTemplate, getPlatformVMoveTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformDisappearTemplate", setPlatformDisappearTemplate, getPlatformDisappearTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformTimerTemplate", setPlatformTimerTemplate, getPlatformTimerTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "platformFakeTemplate", setPlatformFakeTemplate, getPlatformFakeTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "figureTemplate", setFigureTemplate, getFigureTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "projectileTemplate", setProjectileTemplate, getProjectileTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "springTemplate", setSpringTemplate, getSpringTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "rocketTemplate", setRocketTemplate, getRocketTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "propellerTemplate", setPropellerTemplate, getPropellerTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "bootsTemplate", setBootsTemplate, getBootsTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "shieldTemplate", setShieldTemplate, getShieldTemplate, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "enemy1Template", setEnemy1Template, getEnemy1Template, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "enemy2Template", setEnemy2Template, getEnemy2Template, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "enemy3Template", setEnemy3Template, getEnemy3Template, xmlelement, mode);
+ XMLPortParam(JumpCenterpoint, "enemy4Template", setEnemy4Template, getEnemy4Template, xmlelement, mode);
+ }
+
+ void JumpCenterpoint::changedGametype()
+ {
+ SUPER(JumpCenterpoint, changedGametype);
+
+ checkGametype();
+ }
+
+ void JumpCenterpoint::checkGametype()
+ {
+ if (getGametype() != NULL && this->getGametype()->isA(Class(Jump)))
+ {
+ Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype().get());
+ jumpGametype->setCenterpoint(this);
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpCenterpoint.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,228 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpCenterpoint_H__
+#define _JumpCenterpoint_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include <string>
+
+#include <util/Math.h>
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The JumpCenterpoint implements the playing field @ref orxonox::Jump "Jump" 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.
+
+ Various parameters can be set:
+ - The <b>dimension</b> is a vector, that defines the width and height of the playing field. The default is <em>(200, 120)</em>.
+ - The <b>balltemplate</b> is a template that is applied to the @ref orxonox::JumpPlatform "JumpPlatform", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example.
+ - The <b>battemplate</b> is a template that is applied to the @ref orxonox::JumpPlatform "JumpFigure", it can be used to attach different things to it, e.g. its @ref orxonox::Model "Model". See below for a usage example.
+ - The <b>ballspeed</b> is the speed with which the @ref orxonox::JumpPlatform "JumpPlatform" moves. The default is <em>100</em>.
+ - The <b>ballaccfactor</b> is the acceleration factor for the @ref orxonox::JumpPlatform "JumpPlatform". The default is <em>1.0</em>.
+ - The <b>batspeed</b> is the speed with which the @ref orxonox::JumpFigure "JumpFigures" move. The default is <em>60</em>.
+ - The <b>batlength</b> is the length of the @ref orxonox::JumpFigure "JumpFigures" as the percentage of the height of the playing field. The default is <em>0.25</em>.
+
+ An example in XML of the JumpCenterpoint would be:
+
+ First the needed templates:
+ The template for the @ref orxonox::JumpPlatform "JumpPlatform".
+ @code
+ <Template name="jumpball">
+ <JumpPlatform>
+ <attached>
+ <Model mesh="sphere.mesh" scale="2" />
+ <ParticleSpawner name="hiteffect" position="0,0,0" source="Orxonox/sparks2" lifetime="0.01" autostart="0" mainstate="spawn" />
+ </attached>
+ <eventlisteners>
+ <EventTarget target="hiteffect" />
+ </eventlisteners>
+ </JumpPlatform>
+ </Template>
+ @endcode
+ As can be seen, a sphere is attached as the @ref orxonox::Model "Model" for the @ref orxonox::JumpPlatform "JumpPlatform", and also an @ref orxonox::EventListener "EventListener" that triggers a @ref orxonox::ParticleSpawner "ParticleSpawner", whenever the ball hits the boundaries is attached.
+
+ Additionally the template for the @ref orxonox::JumpFigure "JumpFigure".
+ @code
+ <Template name="jumpbatcameras" defaults="0">
+ <JumpFigure>
+ <camerapositions>
+ <CameraPosition position="0,200,0" pitch="-90" absolute="true" />
+ </camerapositions>
+ </JumpFigure>
+ </Template>
+
+ <Template name="jumpbat">
+ <JumpFigure camerapositiontemplate=jumpbatcameras>
+ <attached>
+ <Model position="0,0,3" mesh="cube.mesh" scale3D="14,2,2" />
+ </attached>
+ </JumpFigure>
+ </Template>
+ @endcode
+ As can be seen, there are actually two templates. The first template is needed to set the camera for the @ref orxonox::JumpFigure "JumpFigure". The second template ist the actual template for the @ref orxonox::JumpFigure "JumpFigure", the template for the camera position is added and a @ref orxonox::Model "Model" for the @ref orxonox::JumpFigure "JumpFigure" is attached.
+ propellerTemplate_
+ Finally the JumpCenterpoint is created.
+ @code
+ <JumpCenterpoint name="jumpcenter" dimension="200,120" balltemplate="jumpball" battemplate="jumpbat" ballspeed="200" ballaccfactor="1.0" batspeed="130" batlength="0.25">
+ <attached>
+ <Model position="0,0,60" mesh="cube.mesh" scale3D="105,1,1" />
+ <Model position="0,0,-60" mesh="cube.mesh" scale3D="105,1,1" />
+ </attached>
+ </JumpCenterpoint>
+ @endcode
+ All parameters are specified. And also two @ref orxonox::Model "Models" (for the upper and lower boundary) are attached.
+
+ For a more elaborate example, have a look at the <code>jump.oxw</code> level file.
+
+ */
+ class _JumpExport JumpCenterpoint : public StaticEntity
+ {
+ public:
+ JumpCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Jump.
+ virtual ~JumpCenterpoint() {}
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a JumpCenterpoint through XML.
+ virtual void changedGametype();
+ void setPlatformStaticTemplate(const std::string& balltemplate)
+ { this->platformStaticTemplate_ = balltemplate; }
+ const std::string& getPlatformStaticTemplate() const
+ { return this->platformStaticTemplate_; }
+ void setPlatformHMoveTemplate(const std::string& balltemplate)
+ { this->platformHMoveTemplate_ = balltemplate; }
+ const std::string& getPlatformHMoveTemplate() const
+ { return this->platformHMoveTemplate_; }
+ void setPlatformVMoveTemplate(const std::string& balltemplate)
+ { this->platformVMoveTemplate_ = balltemplate; }
+ const std::string& getPlatformVMoveTemplate() const
+ { return this->platformVMoveTemplate_; }
+ void setPlatformDisappearTemplate(const std::string& balltemplate)
+ { this->platformDisappearTemplate_ = balltemplate; }
+ const std::string& getPlatformDisappearTemplate() const
+ { return this->platformDisappearTemplate_; }
+ void setPlatformTimerTemplate(const std::string& balltemplate)
+ { this->platformTimerTemplate_ = balltemplate; }
+ const std::string& getPlatformTimerTemplate() const
+ { return this->platformTimerTemplate_; }
+ void setPlatformFakeTemplate(const std::string& balltemplate)
+ { this->platformFakeTemplate_ = balltemplate; }
+ const std::string& getPlatformFakeTemplate() const
+ { return this->platformFakeTemplate_; }
+ void setProjectileTemplate(const std::string& newTemplate)
+ { this->projectileTemplate_ = newTemplate; }
+ const std::string& getProjectileTemplate() const
+ { return this->projectileTemplate_; }
+ void setSpringTemplate(const std::string& newTemplate)
+ { this->springTemplate_ = newTemplate; }
+ const std::string& getSpringTemplate() const
+ { return this->springTemplate_; }
+ void setRocketTemplate(const std::string& newTemplate)
+ { this->rocketTemplate_ = newTemplate; }
+ const std::string& getRocketTemplate() const
+ { return this->rocketTemplate_; }
+ void setPropellerTemplate(const std::string& newTemplate)
+ { this->propellerTemplate_ = newTemplate; }
+ const std::string& getPropellerTemplate() const
+ { return this->propellerTemplate_; }
+ void setBootsTemplate(const std::string& newTemplate)
+ { this->bootsTemplate_ = newTemplate; }
+ const std::string& getBootsTemplate() const
+ { return this->bootsTemplate_; }
+ void setShieldTemplate(const std::string& newTemplate)
+ { this->shieldTemplate_ = newTemplate; }
+ const std::string& getShieldTemplate() const
+ { return this->shieldTemplate_; }
+ void setFigureTemplate(const std::string& newTemplate)
+ { this->figureTemplate_ = newTemplate; }
+ const std::string& getFigureTemplate() const
+ { return this->figureTemplate_; }
+ void setEnemy1Template(const std::string& newTemplate)
+ { this->enemy1Template_ = newTemplate; }
+ const std::string& getEnemy1Template() const
+ { return this->enemy1Template_; }
+ void setEnemy2Template(const std::string& newTemplate)
+ { this->enemy2Template_ = newTemplate; }
+ const std::string& getEnemy2Template() const
+ { return this->enemy2Template_; }
+ void setEnemy3Template(const std::string& newTemplate)
+ { this->enemy3Template_ = newTemplate; }
+ const std::string& getEnemy3Template() const
+ { return this->enemy3Template_; }
+ void setEnemy4Template(const std::string& newTemplate)
+ { this->enemy4Template_ = newTemplate; }
+ const std::string& getEnemy4Template() const
+ { return this->enemy4Template_; }
+ void setFieldDimension(const Vector2& dimension)
+ { this->width_ = dimension.x; this->height_ = dimension.y; }
+ Vector2 getFieldDimension() const
+ { return Vector2(this->width_, this->height_); }
+ void setSectionLength(const float sectionLength)
+ { this->sectionLength_ = sectionLength; }
+ float getSectionLength() const
+ { return sectionLength_; }
+ void setPlatformSpeed(const float platformSpeed)
+ { this->platformSpeed_ = platformSpeed; }
+ float getPlatformSpeed() const
+ { return platformSpeed_; }
+ void setCameraOffset(const float cameraOffset)
+ { this->cameraOffset_ = cameraOffset; }
+ float getCameraOffset() const
+ { return cameraOffset_; }
+ private:
+ void checkGametype();
+ std::string platformStaticTemplate_;
+ std::string platformHMoveTemplate_;
+ std::string platformVMoveTemplate_;
+ std::string platformDisappearTemplate_;
+ std::string platformTimerTemplate_;
+ std::string platformFakeTemplate_;
+ std::string projectileTemplate_;
+ std::string springTemplate_;
+ std::string rocketTemplate_;
+ std::string propellerTemplate_;
+ std::string bootsTemplate_;
+ std::string shieldTemplate_;
+ std::string figureTemplate_;
+ std::string enemy1Template_;
+ std::string enemy2Template_;
+ std::string enemy3Template_;
+ std::string enemy4Template_;
+ float width_;
+ float height_;
+ float sectionLength_;
+ float platformSpeed_;
+ float cameraOffset_;
+ };
+}
+
+#endif /* _JumpCenterpoint_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpEnemy.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpEnemy.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpEnemy.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,165 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpEnemy.cc
+ @brief All enemies in the minigame inherit from this class. This class manages the movement of all enemies and allows enemies to touch the figure to kill it.
+*/
+
+#include "JumpEnemy.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpEnemy);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ JumpEnemy::JumpEnemy(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(JumpEnemy);
+
+ dead_ = false;
+ figure_ = 0;
+ width_ = 0.0;
+ height_ = 0.0;
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ JumpEnemy::~JumpEnemy()
+ {
+ /*if (this->isInitialized())
+ {
+ if (this->bDeleteBats_)
+ delete this->figure_;
+
+ delete[] this->batID_;
+ }*/
+ }
+
+ //xml port for loading sounds
+ void JumpEnemy::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpEnemy, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpEnemy, "height", setHeight, getHeight, xmlelement, mode);
+ XMLPortParam(JumpEnemy, "width", setWidth, getWidth, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Is called every tick.
+ Handles the movement of the ball and its interaction with the boundaries and bats.
+ @param dt
+ The time since the last tick.
+ */
+ void JumpEnemy::tick(float dt)
+ {
+ SUPER(JumpEnemy, tick, dt);
+
+ // Get the current position, velocity and acceleration of the enemy.
+ Vector3 position = getPosition();
+ Vector3 velocity = getVelocity();
+
+ if ((position.x < leftBoundary_ && velocity.x < 0) || (position.x > rightBoundary_ && velocity.x > 0))
+ {
+ velocity.x = -velocity.x;
+ }
+
+ if ((position.z < lowerBoundary_ && velocity.z < 0) || (position.z > upperBoundary_ && velocity.z > 0))
+ {
+ velocity.z = -velocity.z;
+ }
+
+ // Set the position, velocity and acceleration of the enemy, if they have changed.
+ if (velocity != getVelocity())
+ setVelocity(velocity);
+ if (position != getPosition())
+ setPosition(position);
+
+
+ // Interact with Figure
+ Vector3 enemyPosition = getPosition();
+
+ if (figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getPosition();
+ if(figurePosition.x > enemyPosition.x-width_ && figurePosition.x < enemyPosition.x+width_ && figurePosition.z > enemyPosition.z-height_ && figurePosition.z < enemyPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ }
+
+ void JumpEnemy::setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed)
+ {
+ leftBoundary_ = newLeftBoundary;
+ rightBoundary_ = newRightBoundary;
+ lowerBoundary_ = newLowerBoundary;
+ upperBoundary_ = newUpperBoundary;
+
+ this->setVelocity(Vector3(newHSpeed,0,newVSpeed));
+ }
+
+ /**
+ @brief
+ Set the bats for the ball.
+ @param bats
+ An array (of size 2) of weak pointers, to be set as the new bats.
+ */
+ void JumpEnemy::setFigure(WeakPtr<JumpFigure> newFigure)
+ {
+ figure_ = newFigure;
+ }
+
+ void JumpEnemy::touchFigure()
+ {
+ if (dead_ == false)
+ {
+ figure_->CollisionWithEnemy(this);
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpEnemy.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpEnemy.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpEnemy.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,86 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpEnemy.h
+ @brief Declaration of the JumpEnemy class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpEnemy_H__
+#define _JumpEnemy_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpEnemy : public MovableEntity
+ {
+ public:
+ JumpEnemy(Context* context);
+ virtual ~JumpEnemy();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void setFieldDimension(float width, float height)
+ { this->fieldWidth_ = width; this->fieldHeight_ = height; }
+ void setFieldDimension(const Vector2& dimension)
+ { this->setFieldDimension(dimension.x, dimension.y); }
+ Vector2 getFieldDimension() const
+ { return Vector2(this->fieldWidth_, this->fieldHeight_); }
+ void setWidth(const float width)
+ { this->width_ = width; }
+ float getWidth() const
+ { return width_; }
+ void setHeight(const float height)
+ { this->height_ = height; }
+ float getHeight() const
+ { return height_; }
+
+ virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
+ void setFigure(WeakPtr<JumpFigure> bats);
+ virtual void touchFigure();
+ bool dead_;
+ protected:
+ float width_;
+ float height_;
+ float fieldWidth_;
+ float fieldHeight_;
+ float leftBoundary_;
+ float rightBoundary_;
+ float lowerBoundary_;
+ float upperBoundary_;
+ WeakPtr<JumpFigure> figure_;
+ };
+}
+
+#endif /* _JumpEnemy_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpFigure.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpFigure.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpFigure.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,398 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpFigure.cc
+ @brief This class represents your figure when you play the minigame. Here the movement of the figure, activating items, ... are handled.
+*/
+
+#include "JumpFigure.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpFigure);
+
+ JumpFigure::JumpFigure(Context* context) : ControllableEntity(context)
+ {
+ RegisterObject(JumpFigure);
+
+ // initialize variables
+ leftHand_ = NULL;
+ rightHand_ = NULL;
+ fieldHeight_ = 0;
+ fieldWidth_ = 0;
+ jumpSpeed_ = 0.0;
+ handSpeed_ = 0.0;
+ handMaxAngle_ = 0.0;
+ handMinAngle_ = 0.0;
+ rocketPos_ = 0.0;
+ propellerPos_ = 0.0;
+ bootsPos_ = 0.0;
+ moveUpPressed_ = false;
+ moveDownPressed_ = false;
+ moveLeftPressed_ = false;
+ moveDownPressed_ = false;
+ firePressed_ = false;
+ fireSignal_ = false;
+ timeSinceLastFire_ = 0.0;
+ gravityAcceleration_ = 8.0;
+ mouseFactor_ = 75.0;
+ maxFireRate_ = 0.3;
+ handAngle_ = 0.0;
+ animateHands_ = false;
+ turnUp_ = false;
+ rocketActive_ = false;
+ propellerActive_ = false;
+ bootsActive_ = false;
+ shieldActive_ = false;
+ rocketSpeed_ = 0.0;
+ propellerSpeed_ = 0.0;
+ dead_ = false;
+ }
+
+ void JumpFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpFigure, XMLPort, xmlelement, mode);
+ XMLPortParam(JumpFigure, "mouseFactor", setMouseFactor, getMouseFactor, xmlelement, mode);
+ XMLPortParam(JumpFigure, "modelLefthand", setModelLeftHand, getModelLeftHand, xmlelement, mode);
+ XMLPortParam(JumpFigure, "modelRighthand", setModelRightHand, getModelRightHand, xmlelement, mode);
+ XMLPortParam(JumpFigure, "rocketPos", setRocketPos, getRocketPos, xmlelement, mode);
+ XMLPortParam(JumpFigure, "propellerPos", setPropellerPos, getPropellerPos, xmlelement, mode);
+ XMLPortParam(JumpFigure, "bootsPos", setBootsPos, getBootsPos, xmlelement, mode);
+ XMLPortParam(JumpFigure, "jumpSpeed", setJumpSpeed, getJumpSpeed, xmlelement, mode);
+ XMLPortParam(JumpFigure, "rocketSpeed", setRocketSpeed, getRocketSpeed, xmlelement, mode);
+ XMLPortParam(JumpFigure, "propellerSpeed", setPropellerSpeed, getPropellerSpeed, xmlelement, mode);
+ XMLPortParam(JumpFigure, "handMinAngle", setHandMinAngle, getHandMinAngle, xmlelement, mode);
+ XMLPortParam(JumpFigure, "handMaxAngle", setHandMaxAngle, getHandMaxAngle, xmlelement, mode);
+ XMLPortParam(JumpFigure, "handSpeed", setHandSpeed, getHandSpeed, xmlelement, mode);
+ }
+
+ void JumpFigure::tick(float dt)
+ {
+ SUPER(JumpFigure, tick, dt);
+
+ if (hasLocalController())
+ {
+ timeSinceLastFire_ += dt;
+
+ // Move up/down
+ Vector3 velocity = getVelocity();
+ if (rocketActive_ == true)
+ {
+ velocity.z = rocketSpeed_;
+ }
+ else if (propellerActive_ == true)
+ {
+ velocity.z = propellerSpeed_;
+ }
+ else
+ {
+ velocity.z -= gravityAcceleration_;
+ }
+
+ // Animate Hands
+ if (animateHands_ == true)
+ {
+ if (turnUp_ == true)
+ {
+ handAngle_ += handSpeed_ * dt;
+ }
+ else
+ {
+ handAngle_ -= handSpeed_ * dt;
+ }
+ if (handAngle_ > handMaxAngle_)
+ {
+ turnUp_ = false;
+ }
+ if (handAngle_ <= handMinAngle_)
+ {
+ animateHands_ = false;
+ }
+
+ if (leftHand_ != NULL)
+ {
+ leftHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(-handAngle_));
+ }
+ if (rightHand_ != NULL)
+ {
+ rightHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(handAngle_));
+ }
+ }
+
+ // Move left/right
+ if (dead_ == false)
+ {
+ velocity.x = -mouseFactor_*horizontalSpeed_;
+ }
+ else
+ {
+ velocity.x = 0.0;
+ }
+
+ // Cheats
+ /*if (moveUpPressed_ == true)
+ {
+ velocity.z = 400.0f;
+ moveUpPressed_ = false;
+ dead_ = false;
+ }
+ if (moveDownPressed_ == true)
+ {
+ moveDownPressed_ = false;
+ }*/
+
+ setVelocity(velocity);
+
+
+ if (firePressed_ && timeSinceLastFire_ >= maxFireRate_)
+ {
+ firePressed_ = false;
+ timeSinceLastFire_ = 0.0;
+ fireSignal_ = true;
+ }
+ }
+
+ // Move through the left and right screen boundaries
+ Vector3 position = getPosition();
+ if (position.x < -fieldWidth_*1.1)
+ {
+ position.x = fieldWidth_*1.1;
+ }
+ else if (position.x > fieldWidth_*1.1)
+ {
+ position.x = -fieldWidth_*1.1;
+ }
+ setPosition(position);
+
+ // Reset key variables
+ moveUpPressed_ = false;
+ moveDownPressed_ = false;
+ moveLeftPressed_ = false;
+ moveDownPressed_ = false;
+ firePressed_ = false;
+ }
+
+ void JumpFigure::JumpFromPlatform(JumpPlatform* platform)
+ {
+ if (dead_ == false)
+ {
+ Vector3 velocity = getVelocity();
+ velocity.z = (bootsActive_ ? 1.2*jumpSpeed_ : jumpSpeed_);
+ setVelocity(velocity);
+
+ animateHands_ = true;
+ handAngle_ = 0.0;
+ turnUp_ = true;
+ }
+ }
+
+ void JumpFigure::JumpFromSpring(JumpSpring* spring)
+ {
+ if (dead_ == false)
+ {
+ Vector3 velocity = getVelocity();
+ velocity.z = 1.2*jumpSpeed_;
+ setVelocity(velocity);
+ }
+ }
+
+ void JumpFigure::CollisionWithEnemy(JumpEnemy* enemy)
+ {
+ if (rocketActive_ == false && propellerActive_ == false && shieldActive_ == false)
+ {
+ dead_ = true;
+ }
+ }
+
+ bool JumpFigure::StartRocket(JumpRocket* rocket)
+ {
+ if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
+ {
+ attach(rocket);
+ rocket->setPosition(0.0, rocketPos_, 0.0);
+ rocket->setVelocity(0.0, 0.0, 0.0);
+ rocketActive_ = true;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void JumpFigure::StopRocket(JumpRocket* rocket)
+ {
+ rocket->setPosition(0.0, 0.0, -1000.0);
+ rocket->setVelocity(0.0, 0.0, 0.0);
+ detach(rocket);
+ rocket->destroy();
+ rocketActive_ = false;
+ }
+
+ bool JumpFigure::StartPropeller(JumpPropeller* propeller)
+ {
+ if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
+ {
+ attach(propeller);
+ propeller->setPosition(0.0, 0.0, propellerPos_);
+ propeller->setVelocity(0.0, 0.0, 0.0);
+ propellerActive_ = true;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void JumpFigure::StopPropeller(JumpPropeller* propeller)
+ {
+ propeller->setPosition(0.0, 0.0, -1000.0);
+ propeller->setVelocity(0.0, 0.0, 0.0);
+ detach(propeller);
+ propeller->destroy();
+ propellerActive_ = false;
+ }
+
+ bool JumpFigure::StartBoots(JumpBoots* boots)
+ {
+ if (rocketActive_ == false && propellerActive_ == false && bootsActive_ == false)
+ {
+ attach(boots);
+ boots->setPosition(0.0, 0.0, bootsPos_);
+ boots->setVelocity(0.0, 0.0, 0.0);
+ bootsActive_ = true;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void JumpFigure::StopBoots(JumpBoots* boots)
+ {
+ boots->setPosition(0.0, 0.0, -1000.0);
+ boots->setVelocity(0.0, 0.0, 0.0);
+ detach(boots);
+ boots->destroy();
+ bootsActive_ = false;
+ }
+
+ bool JumpFigure::StartShield(JumpShield* shield)
+ {
+ if (shieldActive_ == false)
+ {
+ attach(shield);
+ shield->setPosition(0.0, 0.0, propellerPos_);
+ shield->setVelocity(0.0, 0.0, 0.0);
+ shieldActive_ = true;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void JumpFigure::StopShield(JumpShield* shield)
+ {
+ shield->setPosition(0.0, 0.0, -1000.0);
+ shield->setVelocity(0.0, 0.0, 0.0);
+ detach(shield);
+ shield->destroy();
+ shieldActive_ = false;
+ }
+
+ void JumpFigure::InitializeAnimation(Context* context)
+ {
+ leftHand_ = new Model(context);
+ rightHand_ = new Model(context);
+
+ leftHand_->addTemplate(modelLeftHand_);
+ rightHand_->addTemplate(modelRightHand_);
+
+ attach(leftHand_);
+ attach(rightHand_);
+ }
+
+ void JumpFigure::moveFrontBack(const Vector2& value)
+ {
+ if (value.x > 0)
+ {
+ moveUpPressed_ = true;
+ moveDownPressed_ = false;
+ }
+ else
+ {
+ moveUpPressed_ = false;
+ moveDownPressed_ = true;
+ }
+ }
+
+ void JumpFigure::moveRightLeft(const Vector2& value)
+ {
+ if (value.x > 0)
+ {
+ moveLeftPressed_ = false;
+ moveRightPressed_ = true;
+ }
+ else
+ {
+ moveLeftPressed_ = true;
+ moveRightPressed_ = false;
+ }
+ }
+
+ void JumpFigure::rotateYaw(const Vector2& value)
+ {
+ horizontalSpeed_ = value.x;
+ }
+
+ void JumpFigure::rotatePitch(const Vector2& value)
+ {
+
+
+ }
+
+ void JumpFigure::rotateRoll(const Vector2& value)
+ {
+
+
+ }
+
+ void JumpFigure::fire(unsigned int firemode)
+ {
+
+ }
+
+ void JumpFigure::fired(unsigned int firemode)
+ {
+ firePressed_ = true;
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpFigure.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpFigure.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpFigure.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,158 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpFigure_H__
+#define _JumpFigure_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpFigure : public ControllableEntity
+ {
+ public:
+ JumpFigure(Context* context); //!< Constructor. Registers and initializes the object.
+ virtual ~JumpFigure() {}
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+ virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+ virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+ void fire(unsigned int firemode);
+ virtual void fired(unsigned int firemode);
+ virtual void JumpFromPlatform(JumpPlatform* platform);
+ virtual void JumpFromSpring(JumpSpring* spring);
+ virtual void CollisionWithEnemy(JumpEnemy* enemy);
+ virtual bool StartRocket(JumpRocket* rocket);
+ virtual void StopRocket(JumpRocket* rocket);
+ virtual bool StartPropeller(JumpPropeller* propeller);
+ virtual void StopPropeller(JumpPropeller* propeller);
+ virtual bool StartBoots(JumpBoots* boots);
+ virtual void StopBoots(JumpBoots* boots);
+ virtual bool StartShield(JumpShield* shield);
+ virtual void StopShield(JumpShield* shield);
+ virtual void InitializeAnimation(Context* context);
+
+ void setFieldDimension(float width, float height)
+ { fieldWidth_ = width; fieldHeight_ = height; }
+ void setFieldDimension(const Vector2& dimension)
+ { setFieldDimension(dimension.x, dimension.y); }
+ Vector2 getFieldDimension() const
+ { return Vector2(fieldWidth_, fieldHeight_); }
+ void setMouseFactor(const float mouseFactor)
+ { mouseFactor_ = mouseFactor; }
+ const float getMouseFactor() const
+ { return mouseFactor_; }
+ void setModelLeftHand(const std::string& modelLeftHand)
+ { modelLeftHand_ = modelLeftHand; }
+ const std::string& getModelLeftHand() const
+ { return modelLeftHand_; }
+ void setModelRightHand(const std::string& modelRightHand)
+ { modelRightHand_ = modelRightHand; }
+ const std::string& getModelRightHand() const
+ { return modelRightHand_; }
+ void setRocketPos(const float rocketPos)
+ { rocketPos_ = rocketPos; }
+ const float getRocketPos() const
+ { return rocketPos_; }
+ void setPropellerPos(const float propellerPos)
+ { propellerPos_ = propellerPos; }
+ const float getPropellerPos() const
+ { return propellerPos_; }
+ void setBootsPos(const float bootsPos)
+ { bootsPos_ = bootsPos; }
+ const float getBootsPos() const
+ { return bootsPos_; }
+ void setJumpSpeed(const float jumpSpeed)
+ { jumpSpeed_ = jumpSpeed; }
+ const float getJumpSpeed() const
+ { return jumpSpeed_; }
+ void setRocketSpeed(const float rocketSpeed)
+ { rocketSpeed_ = rocketSpeed; }
+ const float getRocketSpeed() const
+ { return rocketSpeed_; }
+ void setPropellerSpeed(const float propellerSpeed)
+ { propellerSpeed_ = propellerSpeed; }
+ const float getPropellerSpeed() const
+ { return propellerSpeed_; }
+ void setHandMinAngle(const float handMinAngle)
+ { handMinAngle_ = handMinAngle; }
+ const float getHandMinAngle() const
+ { return handMinAngle_; }
+ void setHandMaxAngle(const float handMaxAngle)
+ { handMaxAngle_ = handMaxAngle; }
+ const float getHandMaxAngle() const
+ { return handMaxAngle_; }
+ void setHandSpeed(const float handSpeed)
+ { handSpeed_ = handSpeed; }
+ const float getHandSpeed() const
+ { return handSpeed_; }
+
+ bool fireSignal_;
+ bool rocketActive_;
+ bool propellerActive_;
+ bool dead_;
+ private:
+ std::string modelLeftHand_;
+ std::string modelRightHand_;
+ Model* leftHand_;
+ Model* rightHand_;
+ float fieldWidth_;
+ float fieldHeight_;
+ float timeSinceLastFire_;
+ bool moveUpPressed_;
+ bool moveDownPressed_;
+ bool moveLeftPressed_;
+ bool moveRightPressed_;
+ bool firePressed_;
+ float gravityAcceleration_;
+ float mouseFactor_;
+ float jumpSpeed_;
+ float handSpeed_;
+ float handMaxAngle_;
+ float handMinAngle_;
+ float rocketPos_;
+ float propellerPos_;
+ float bootsPos_;
+ float maxFireRate_;
+ float horizontalSpeed_;
+ float handAngle_;
+ bool animateHands_;
+ bool turnUp_;
+ bool bootsActive_;
+ bool shieldActive_;
+ float rocketSpeed_;
+ float propellerSpeed_;
+ };
+}
+
+#endif /* _JumpFigure_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpItem.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpItem.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpItem.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpItem.cc
+ @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
+*/
+
+#include "JumpItem.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpItem);
+
+ JumpItem::JumpItem(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(JumpItem);
+
+ attachedToFigure_ = false;
+
+ figure_ = 0;
+ height_ = 0.0;
+ width_ = 0.0;
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ }
+
+ JumpItem::~JumpItem()
+ {
+
+ }
+
+ void JumpItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpItem, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpItem, "height", setHeight, getHeight, xmlelement, mode);
+ XMLPortParam(JumpItem, "width", setWidth, getWidth, xmlelement, mode);
+ }
+
+ void JumpItem::tick(float dt)
+ {
+ SUPER(JumpItem, tick, dt);
+ // Get the current position, velocity and acceleration of the item.
+ Vector3 position = getWorldPosition();
+ Vector3 velocity = getVelocity();
+
+ if ((position.x < leftBoundary_ && velocity.x < 0) || (position.x > rightBoundary_ && velocity.x > 0))
+ {
+ velocity.x = -velocity.x;
+ }
+
+ if ((position.z < lowerBoundary_ && velocity.z < 0) || (position.z > upperBoundary_ && velocity.z > 0))
+ {
+ velocity.z = -velocity.z;
+ }
+
+ // Set the position, velocity and acceleration of the item, if they have changed.
+ if (velocity != getVelocity())
+ {
+ setVelocity(velocity);
+ }
+ }
+
+ void JumpItem::setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed)
+ {
+ leftBoundary_ = newLeftBoundary;
+ rightBoundary_ = newRightBoundary;
+ lowerBoundary_ = newLowerBoundary;
+ upperBoundary_ = newUpperBoundary;
+
+ setVelocity(Vector3(newHSpeed,0,newVSpeed));
+ }
+
+ void JumpItem::setFigure(WeakPtr<JumpFigure> newFigure)
+ {
+ figure_ = newFigure;
+ }
+
+ void JumpItem::touchFigure()
+ {
+
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpItem.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpItem.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpItem.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpItem.h
+ @brief Declaration of the JumpItem class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpItem_H__
+#define _JumpItem_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpItem : public MovableEntity
+ {
+ public:
+ JumpItem(Context* context);
+ virtual ~JumpItem();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed);
+ virtual void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
+ virtual void touchFigure();
+
+ void setFieldDimension(float width, float height)
+ { this->fieldWidth_ = width; this->fieldHeight_ = height; }
+ void setFieldDimension(const Vector2& dimension)
+ { this->setFieldDimension(dimension.x, dimension.y); }
+ Vector2 getFieldDimension() const
+ { return Vector2(this->fieldWidth_, this->fieldHeight_); }
+ void setWidth(const float width)
+ { this->width_ = width; }
+ float getWidth() const
+ { return width_; }
+ void setHeight(const float height)
+ { this->height_ = height; }
+ float getHeight() const
+ { return height_; }
+
+ bool attachedToFigure_;
+
+ protected:
+ float fieldWidth_; //!< The width of the playing field.
+ float fieldHeight_; //!< The height of the playing field.
+ WeakPtr<JumpFigure> figure_; //!< An array with the two bats.
+ float height_;
+ float width_;
+ float leftBoundary_;
+ float rightBoundary_;
+ float lowerBoundary_;
+ float upperBoundary_;
+ };
+}
+
+#endif /* _JumpItem_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatform.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatform.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatform.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,187 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatform.cc
+ @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes.
+*/
+
+#include "JumpPlatform.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatform);
+
+ JumpPlatform::JumpPlatform(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(JumpPlatform);
+
+ figure_ = 0;
+
+ //initialize sound
+ if (GameMode::isMaster())
+ {
+ defScoreSound_ = new WorldSound(this->getContext());
+ defScoreSound_->setVolume(1.0f);
+ defBatSound_ = new WorldSound(this->getContext());
+ defBatSound_->setVolume(0.4f);
+ defBoundarySound_ = new WorldSound(this->getContext());
+ defBoundarySound_->setVolume(0.5f);
+ }
+ else
+ {
+ defScoreSound_ = 0;
+ defBatSound_ = 0;
+ defBoundarySound_ = 0;
+ }
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ JumpPlatform::~JumpPlatform()
+ {
+
+ }
+
+ //xml port for loading sounds
+ void JumpPlatform::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatform, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpPlatform, "height", setHeight, getHeight, xmlelement, mode);
+ XMLPortParam(JumpPlatform, "width", setWidth, getWidth, xmlelement, mode);
+
+ XMLPortParam(JumpPlatform, "defScoreSound", setDefScoreSound, getDefScoreSound, xmlelement, mode);
+ XMLPortParam(JumpPlatform, "defBatSound", setDefBatSound, getDefBatSound, xmlelement, mode);
+ XMLPortParam(JumpPlatform, "defBoundarySound", setDefBoundarySound, getDefBoundarySound, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Is called every tick.
+ Handles the movement of the ball and its interaction with the boundaries and bats.
+ @param dt
+ The time since the last tick.
+ */
+ void JumpPlatform::tick(float dt)
+ {
+ SUPER(JumpPlatform, tick, dt);
+
+ Vector3 platformPosition = this->getPosition();
+
+ if (figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getPosition();
+ Vector3 figureVelocity = figure_->getVelocity();
+
+ float tolerance = 3.0;
+
+ if(figureVelocity.z < 0 && figurePosition.x > platformPosition.x-width_/2 && figurePosition.x < platformPosition.x+width_/2 && figurePosition.z > platformPosition.z-height_/2*tolerance && figurePosition.z < platformPosition.z+height_/2)
+ {
+ touchFigure();
+ }
+ }
+ }
+
+ void JumpPlatform::setFigure(WeakPtr<JumpFigure> newFigure)
+ {
+ figure_ = newFigure;
+ }
+
+ void JumpPlatform::touchFigure()
+ {
+
+ }
+
+ void JumpPlatform::setDefScoreSound(const std::string &jumpSound)
+ {
+ if( defScoreSound_ )
+ defScoreSound_->setSource(jumpSound);
+ else
+ assert(0); // This should never happen, because soundpointer is only available on master
+ }
+
+ const std::string& JumpPlatform::getDefScoreSound()
+ {
+ if( defScoreSound_ )
+ return defScoreSound_->getSource();
+ else
+ assert(0);
+ return BLANKSTRING;
+ }
+
+ void JumpPlatform::setDefBatSound(const std::string &jumpSound)
+ {
+ if( defBatSound_ )
+ defBatSound_->setSource(jumpSound);
+ else
+ assert(0); // This should never happen, because soundpointer is only available on master
+ }
+
+ const std::string& JumpPlatform::getDefBatSound()
+ {
+ if( defBatSound_ )
+ return defBatSound_->getSource();
+ else
+ assert(0);
+ return BLANKSTRING;
+ }
+
+ void JumpPlatform::setDefBoundarySound(const std::string &jumpSound)
+ {
+ if( defBoundarySound_ )
+ defBoundarySound_->setSource(jumpSound);
+ else
+ assert(0); // This should never happen, because soundpointer is only available on master
+ }
+
+ const std::string& JumpPlatform::getDefBoundarySound()
+ {
+ if( defBoundarySound_ )
+ return defBoundarySound_->getSource();
+ else
+ assert(0);
+ return BLANKSTRING;
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatform.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatform.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatform.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatform.h
+ @brief Declaration of the JumpPlatform class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpPlatform_H__
+#define _JumpPlatform_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatform : public MovableEntity
+ {
+ public:
+ JumpPlatform(Context* context);
+ virtual ~JumpPlatform();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void setFigure(WeakPtr<JumpFigure> bats); //!< Set the bats for the ball.
+ virtual void touchFigure();
+
+ void setDefScoreSound(const std::string& engineSound);
+ const std::string& getDefScoreSound();
+ void setDefBatSound(const std::string& engineSound);
+ const std::string& getDefBatSound();
+ void setDefBoundarySound(const std::string& engineSound);
+ const std::string& getDefBoundarySound();
+
+ void setWidth(const float width)
+ { this->width_ = width; }
+ float getWidth() const
+ { return width_; }
+ void setHeight(const float height)
+ { this->height_ = height; }
+ float getHeight() const
+ { return height_; }
+
+ protected:
+ float width_;
+ float height_;
+ WeakPtr<JumpFigure> figure_;
+ WorldSound* defScoreSound_;
+ WorldSound* defBatSound_;
+ WorldSound* defBoundarySound_;
+ };
+}
+
+#endif /* _JumpPlatform_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformDisappear.cc
+ @brief This platform disappears after contact with the figure.
+*/
+
+#include "JumpPlatformDisappear.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformDisappear);
+
+ JumpPlatformDisappear::JumpPlatformDisappear(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformDisappear);
+
+ setProperties(true);
+ }
+
+ JumpPlatformDisappear::~JumpPlatformDisappear()
+ {
+
+ }
+
+ void JumpPlatformDisappear::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformDisappear, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPlatformDisappear::tick(float dt)
+ {
+ SUPER(JumpPlatformDisappear, tick, dt);
+ }
+
+ void JumpPlatformDisappear::setProperties(bool active)
+ {
+ active_ = active;
+ }
+
+ bool JumpPlatformDisappear::isActive()
+ {
+ return active_;
+ }
+
+ void JumpPlatformDisappear::touchFigure()
+ {
+ if (isActive())
+ {
+ figure_->JumpFromPlatform(this);
+ active_ = false;
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformDisappear.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformDisappear.h
+ @brief Declaration of the JumpPlatformDisappear class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpPlatformDisappear_H__
+#define _JumpPlatformDisappear_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatformDisappear : public JumpPlatform
+ {
+ public:
+ JumpPlatformDisappear(Context* context);
+ virtual ~JumpPlatformDisappear();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setProperties(bool active);
+ virtual bool isActive();
+ virtual void touchFigure();
+
+ protected:
+ bool active_;
+ };
+}
+
+#endif /* _JumpPlatformDisappear_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformFake.cc
+ @brief This platform has a hole in it. You cannot jump from this platform. It has no touchFigure function.
+*/
+
+#include "JumpPlatformFake.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformFake);
+
+ JumpPlatformFake::JumpPlatformFake(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformFake);
+ }
+
+ JumpPlatformFake::~JumpPlatformFake()
+ {
+
+ }
+
+ void JumpPlatformFake::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformFake, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPlatformFake::tick(float dt)
+ {
+ SUPER(JumpPlatformFake, tick, dt);
+ }
+
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformFake.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,57 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformFake.h
+ @brief Declaration of the JumpPlatform class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpPlatformFake_H__
+#define _JumpPlatformFake_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatformFake : public JumpPlatform
+ {
+ public:
+ JumpPlatformFake(Context* context);
+ virtual ~JumpPlatformFake();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ };
+}
+
+#endif /* _JumpPlatformFake_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,99 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformHMove.cc
+ @brief This platform can move horizontally.
+*/
+
+#include "JumpPlatformHMove.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformHMove);
+
+ JumpPlatformHMove::JumpPlatformHMove(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformHMove);
+
+ setProperties(-100,100,5);
+ }
+
+ JumpPlatformHMove::~JumpPlatformHMove()
+ {
+
+ }
+
+ void JumpPlatformHMove::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformHMove, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPlatformHMove::tick(float dt)
+ {
+ SUPER(JumpPlatformHMove, tick, dt);
+
+ // Get the current position, velocity and acceleration of the ball.
+ Vector3 position = getPosition();
+ Vector3 velocity = getVelocity();
+
+ if ((position.x < leftBoundary_ && velocity.x < 0) || (position.x > rightBoundary_ && velocity.x > 0))
+
+ {
+ velocity.x = -velocity.x;
+ }
+
+ // Set the position, velocity and acceleration of the ball, if they have changed.
+ if (velocity != getVelocity())
+ {
+ setVelocity(velocity);
+ }
+ if (position != this->getPosition())
+ {
+ setPosition(position);
+ }
+ }
+
+ void JumpPlatformHMove::setProperties(float leftBoundary, float rightBoundary, float speed)
+ {
+ leftBoundary_ = leftBoundary;
+ rightBoundary_ = rightBoundary;
+ setVelocity(Vector3(speed,0,0));
+ }
+
+ void JumpPlatformHMove::touchFigure()
+ {
+ figure_->JumpFromPlatform(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformHMove.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpPlatformHMove_H__
+#define _JumpPlatformHMove_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+
+ class _JumpExport JumpPlatformHMove : public JumpPlatform
+ {
+ public:
+ JumpPlatformHMove(Context* context);
+ virtual ~JumpPlatformHMove();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setProperties(float leftBoundary, float rightBoundary, float speed);
+ virtual void touchFigure();
+
+ protected:
+ float leftBoundary_;
+ float rightBoundary_;
+ };
+}
+
+#endif /* _JumpPlatform_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformStatic.cc
+ @brief This is the most simple platform in this minigame.
+*/
+
+#include "JumpPlatformStatic.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformStatic);
+
+ JumpPlatformStatic::JumpPlatformStatic(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformStatic);
+
+ }
+
+ JumpPlatformStatic::~JumpPlatformStatic()
+ {
+
+ }
+
+ //xml port for loading sounds
+ void JumpPlatformStatic::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformStatic, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPlatformStatic::tick(float dt)
+ {
+ SUPER(JumpPlatformStatic, tick, dt);
+ }
+
+ void JumpPlatformStatic::touchFigure()
+ {
+ figure_->JumpFromPlatform(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformStatic.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpPlatformStatic_H__
+#define _JumpPlatformStatic_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatformStatic : public JumpPlatform
+ {
+ public:
+ JumpPlatformStatic(Context* context);
+ virtual ~JumpPlatformStatic();
+
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void touchFigure();
+ };
+}
+
+#endif /* _JumpPlatform_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,104 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformTimer.cc
+ @brief This platform will explode if you wait for too long time.
+*/
+
+#include "JumpPlatformTimer.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformTimer);
+
+ JumpPlatformTimer::JumpPlatformTimer(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformTimer);
+
+ particleSpawner_ = NULL;
+
+ setProperties(3.0);
+
+ }
+
+ JumpPlatformTimer::~JumpPlatformTimer()
+ {
+
+ }
+
+ void JumpPlatformTimer::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformTimer, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpPlatformTimer, "effectPath", setEffectPath, getEffectPath, xmlelement, mode);
+ XMLPortParam(JumpPlatformTimer, "effectStartTime", setEffectStartTime, getEffectStartTime, xmlelement, mode);
+ }
+
+ void JumpPlatformTimer::tick(float dt)
+ {
+ SUPER(JumpPlatformTimer, tick, dt);
+
+ time_ -= dt;
+ if (time_ < effectStartTime_ && particleSpawner_ == NULL)
+ {
+
+ particleSpawner_ = new ParticleSpawner(getContext());
+ particleSpawner_->setSource(effectPath_);
+ particleSpawner_->setLoop(false);
+ particleSpawner_->setLOD(LODParticle::Low);
+ particleSpawner_->setLifetime(effectStartTime_);
+
+ attach(particleSpawner_);
+ }
+ }
+
+ void JumpPlatformTimer::setProperties(float time)
+ {
+ time_ = time;
+ }
+
+ bool JumpPlatformTimer::isActive(void)
+ {
+ return time_ > 0.0;
+ }
+
+ void JumpPlatformTimer::touchFigure()
+ {
+ if (isActive())
+ {
+ figure_->JumpFromPlatform(this);
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformTimer.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformTimer.h
+ @brief Declaration of the JumpPlatformTimer class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpPlatformTimer_H__
+#define _JumpPlatformTimer_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+#include "graphics/ParticleSpawner.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatformTimer : public JumpPlatform
+ {
+ public:
+ JumpPlatformTimer(Context* context);
+ virtual ~JumpPlatformTimer();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setProperties(float time);
+ virtual bool isActive(void);
+ virtual void touchFigure();
+
+ void setEffectPath(const std::string& effectPath)
+ { this->effectPath_ = effectPath; }
+
+ const std::string& getEffectPath() const
+ { return this->effectPath_; }
+
+ void setEffectStartTime(const float effectStartTime)
+ { this->effectStartTime_ = effectStartTime; }
+
+ const float getEffectStartTime() const
+ { return this->effectStartTime_; }
+
+ protected:
+ float time_;
+ ParticleSpawner* particleSpawner_;
+ std::string effectPath_;
+ float effectStartTime_;
+ };
+}
+
+#endif /* _JumpPlatformTimer_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,100 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPlatformVMove.cc
+ @brief This platform can move vertically.
+*/
+
+#include "JumpPlatformVMove.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPlatformVMove);
+
+ JumpPlatformVMove::JumpPlatformVMove(Context* context) : JumpPlatform(context)
+ {
+ RegisterObject(JumpPlatformVMove);
+
+ setProperties(0,80,10);
+ }
+
+ JumpPlatformVMove::~JumpPlatformVMove()
+ {
+
+ }
+
+ void JumpPlatformVMove::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPlatformVMove, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPlatformVMove::tick(float dt)
+ {
+ SUPER(JumpPlatformVMove, tick, dt);
+
+ // Get the current position, velocity and acceleration of the ball.
+ Vector3 position = getPosition();
+ Vector3 velocity = getVelocity();
+
+ if ((position.z < lowerBoundary_ && velocity.z < 0) || (position.z > upperBoundary_ && velocity.z > 0))
+ {
+ velocity.z = -velocity.z;
+ }
+
+ // Set the position, velocity and acceleration of the ball, if they have changed.
+ if (velocity != getVelocity())
+ {
+ setVelocity(velocity);
+ }
+ if (position != getPosition())
+ {
+ setPosition(position);
+ }
+ }
+
+ void JumpPlatformVMove::setProperties(float lowerBoundary, float upperBoundary, float speed)
+ {
+ lowerBoundary_ = lowerBoundary;
+ upperBoundary_ = upperBoundary;
+
+ setVelocity(Vector3(0,0,speed));
+
+ }
+
+ void JumpPlatformVMove::touchFigure()
+ {
+ figure_->JumpFromPlatform(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPlatformVMove.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpPlatformVMove_H__
+#define _JumpPlatformVMove_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpPlatformVMove : public JumpPlatform
+ {
+ public:
+ JumpPlatformVMove(Context* context);
+ virtual ~JumpPlatformVMove();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void setProperties(float leftBoundary, float rightBoundary, float speed);
+ virtual void touchFigure();
+
+ protected:
+ float lowerBoundary_;
+ float upperBoundary_;
+ };
+}
+
+#endif /* _JumpPlatform_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPrereqs.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPrereqs.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPrereqs.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,91 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the jump module
+*/
+
+#ifndef _JumpPrereqs_H__
+#define _JumpPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(PONG_STATIC_BUILD)
+# ifdef PONG_SHARED_BUILD
+# define _JumpExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _JumpExport
+# else
+# define _JumpExport __declspec(dllimport)
+# endif
+# endif
+# define _JumpPrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _JumpExport __attribute__ ((visibility("default")))
+# define _JumpPrivate __attribute__ ((visibility("hidden")))
+#else
+# define _JumpExport
+# define _JumpPrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Jump;
+ class JumpPlatform;
+ class JumpPlatformStatic;
+ class JumpPlatformHMove;
+ class JumpPlatformVMove;
+ class JumpPlatformDisappear;
+ class JumpPlatformTimer;
+ class JumpPlatformFake;
+ class JumpProjectile;
+ class JumpEnemy;
+ class JumpItem;
+ class JumpSpring;
+ class JumpRocket;
+ class JumpPropeller;
+ class JumpBoots;
+ class JumpShield;
+ class JumpFigure;
+ class JumpCenterpoint;
+ class JumpScore;
+}
+
+#endif /* _JumpPrereqs_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpProjectile.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpProjectile.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpProjectile.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpProjectile.cc
+ @brief projectiles are created by the gametype if the figure shoots. All projectiles check every tick, whether they hit an enemy.
+*/
+
+#include "JumpProjectile.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpProjectile);
+
+ JumpProjectile::JumpProjectile(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(JumpProjectile);
+
+ figure_ = 0;
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,250.0));
+ setAcceleration(Vector3(0,0,0));
+ }
+
+ JumpProjectile::~JumpProjectile()
+ {
+
+ }
+
+ void JumpProjectile::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpProjectile, XMLPort, xmlelement, mode);
+ }
+
+ void JumpProjectile::tick(float dt)
+ {
+ SUPER(JumpProjectile, tick, dt);
+
+ Vector3 projectilePosition = getPosition();
+
+ for (ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)
+ {
+ Vector3 enemyPosition = it->getPosition();
+ float enemyWidth = it->getWidth();
+ float enemyHeight = it->getHeight();
+
+ if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight)
+ {
+ it->dead_ = true;
+ }
+ }
+ }
+
+ void JumpProjectile::setFigure(WeakPtr<JumpFigure> figure)
+ {
+ figure_ = figure;
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpProjectile.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpProjectile.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpProjectile.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,67 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpProjectile_H__
+#define _JumpProjectile_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpProjectile : public MovableEntity
+ {
+ public:
+ JumpProjectile(Context* context);
+ virtual ~JumpProjectile();
+
+ virtual void tick(float dt);
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void setFieldDimension(float width, float height)
+ { this->fieldWidth_ = width; this->fieldHeight_ = height; }
+
+ void setFieldDimension(const Vector2& dimension)
+ { this->setFieldDimension(dimension.x, dimension.y); }
+
+ Vector2 getFieldDimension() const
+ { return Vector2(this->fieldWidth_, this->fieldHeight_); }
+
+ void setFigure(WeakPtr<JumpFigure> figure);
+
+ protected:
+ float fieldWidth_;
+ float fieldHeight_;
+ WeakPtr<JumpFigure> figure_;
+ };
+}
+
+#endif /* _JumpProjectile_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpPropeller.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPropeller.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPropeller.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpPropeller.cc
+ @brief If this propeller is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying until the fuel is reduced to zero.
+*/
+
+#include "JumpPropeller.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpPropeller);
+
+ JumpPropeller::JumpPropeller(Context* context) : JumpItem(context)
+ {
+ RegisterObject(JumpPropeller);
+
+ fuel_ = 3.0;
+ attachedToFigure_ = false;
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ JumpPropeller::~JumpPropeller()
+ {
+
+ }
+
+ void JumpPropeller::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpPropeller, XMLPort, xmlelement, mode);
+ }
+
+ void JumpPropeller::tick(float dt)
+ {
+ SUPER(JumpPropeller, tick, dt);
+
+ Vector3 PropellerPosition = getWorldPosition();
+
+ if (attachedToFigure_ == false && figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getWorldPosition();
+
+ if(figurePosition.x > PropellerPosition.x-width_ && figurePosition.x < PropellerPosition.x+width_ && figurePosition.z > PropellerPosition.z-height_ && figurePosition.z < PropellerPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ else if (attachedToFigure_ == true)
+ {
+ fuel_ -= dt;
+ if (fuel_ < 0.0)
+ {
+ figure_->StopPropeller(this);
+ }
+ }
+ }
+
+ void JumpPropeller::touchFigure()
+ {
+ JumpItem::touchFigure();
+
+ attachedToFigure_ = figure_->StartPropeller(this);
+ if (attachedToFigure_)
+ {
+ setAngularVelocity(Vector3(0,0,10.0));
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpPropeller.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpPropeller.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpPropeller.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpPropeller_H__
+#define _JumpPropeller_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpPropeller : public JumpItem
+ {
+ public:
+ JumpPropeller(Context* context);
+ virtual ~JumpPropeller();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void touchFigure();
+ protected:
+ float stretch_;
+ float fuel_;
+ };
+}
+
+#endif /* _JumpPropeller_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpRocket.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpRocket.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpRocket.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,101 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpRocket.cc
+ @brief If this rocket is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying fast until the fuel is reduced to zero.
+*/
+
+#include "JumpRocket.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpRocket);
+
+ JumpRocket::JumpRocket(Context* context) : JumpItem(context)
+ {
+ RegisterObject(JumpRocket);
+
+ fuel_ = 3.0;
+ attachedToFigure_ = false;
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ JumpRocket::~JumpRocket()
+ {
+
+ }
+
+ void JumpRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpRocket, XMLPort, xmlelement, mode);
+ }
+
+ void JumpRocket::tick(float dt)
+ {
+ SUPER(JumpRocket, tick, dt);
+
+ Vector3 rocketPosition = getWorldPosition();
+
+ if (attachedToFigure_ == false && figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getWorldPosition();
+
+ if(figurePosition.x > rocketPosition.x-width_ && figurePosition.x < rocketPosition.x+width_ && figurePosition.z > rocketPosition.z-height_ && figurePosition.z < rocketPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ else if (attachedToFigure_ == true)
+ {
+ fuel_ -= dt;
+ if (fuel_ < 0.0)
+ {
+ figure_->StopRocket(this);
+ }
+ }
+ }
+
+ void JumpRocket::touchFigure()
+ {
+ JumpItem::touchFigure();
+
+ attachedToFigure_ = figure_->StartRocket(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpRocket.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpRocket.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpRocket.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,52 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpRocket_H__
+#define _JumpRocket_H__
+
+#include "jump/JumpPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/MovableEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpRocket : public JumpItem
+ {
+ public:
+ JumpRocket(Context* context);
+ virtual ~JumpRocket();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void touchFigure();
+ protected:
+ float stretch_;
+ float fuel_;
+ };
+}
+
+#endif /* _JumpRocket_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpScore.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpScore.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpScore.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpScore.cc
+ @brief HUD of thejump minigame. If showScore_ is set, it displays the score. If showMessages_ is set, it displays the game over message.
+*/
+
+#include "JumpScore.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+#include "infos/PlayerInfo.h"
+#include "Jump.h"
+#include "sound/WorldSound.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpScore);
+
+ JumpScore::JumpScore(Context* context) : OverlayText(context)
+ {
+ RegisterObject(JumpScore);
+
+ owner_ = NULL;
+ showScore_ = false;
+ showMessages_ = false;
+ }
+
+ JumpScore::~JumpScore()
+ {
+
+ }
+
+ void JumpScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpScore, XMLPort, xmlelement, mode);
+
+ XMLPortParam(JumpScore, "showScore", setShowScore, getShowScore, xmlelement, mode);
+ XMLPortParam(JumpScore, "showMessages", setShowMessages, getShowMessages, xmlelement, mode);
+ XMLPortParam(JumpScore, "gameOverText", setGameOverText, getGameOverText, xmlelement, mode);
+ }
+
+ void JumpScore::tick(float dt)
+ {
+ SUPER(JumpScore, tick, dt);
+
+ if (owner_ != NULL)
+ {
+ if (!owner_->hasEnded())
+ {
+ player_ = owner_->getPlayer();
+
+ if (player_ != NULL)
+ {
+ if (showScore_ == true)
+ {
+ int score = owner_->getScore(player_);
+
+ std::string str = multi_cast<std::string>(score);
+ setCaption(str);
+ }
+ else if (showMessages_ == true)
+ {
+
+ setCaption(owner_->getDead(player_) == true ? gameOverText_ : "");
+ }
+ }
+ }
+ }
+ }
+
+ void JumpScore::changedOwner()
+ {
+ SUPER(JumpScore, changedOwner);
+
+ if (this->getOwner() != NULL && this->getOwner()->getGametype())
+ {
+ this->owner_ = orxonox_cast<Jump*>(this->getOwner()->getGametype().get());
+ }
+ else
+ {
+ this->owner_ = NULL;
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpScore.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpScore.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpScore.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpScore_H__
+#define _JumpScore_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpScore : public OverlayText, public Tickable
+ {
+ public:
+ JumpScore(Context* context);
+ virtual ~JumpScore();
+
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void changedOwner();
+
+ void setShowScore(const bool showScore)
+ { showScore_ = showScore; }
+
+ const bool getShowScore() const
+ { return showScore_; }
+
+ void setShowMessages(const bool showMessages)
+ { showMessages_ = showMessages; }
+
+ const bool getShowMessages() const
+ { return showMessages_; }
+
+ void setGameOverText(const std::string& gameOverText)
+ { this->gameOverText_ = gameOverText; }
+
+ const std::string& getGameOverText() const
+ { return this->gameOverText_; }
+
+ private:
+ Jump* owner_;
+ WeakPtr<PlayerInfo> player_;
+ WorldSound* scoreSound_;
+ bool showScore_;
+ bool showMessages_;
+ std::string gameOverText_;
+ };
+}
+#endif /* _JumpScore_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpShield.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpShield.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpShield.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,104 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpShield.cc
+ @brief If this shield is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure is protected until the fuel is reduced to zero.
+*/
+
+#include "JumpShield.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+#include "JumpFigure.h"
+
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpShield);
+
+ JumpShield::JumpShield(Context* context) : JumpItem(context)
+ {
+ RegisterObject(JumpShield);
+
+ fuel_ = 7.0;
+ attachedToFigure_ = false;
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ JumpShield::~JumpShield()
+ {
+
+ }
+
+ void JumpShield::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpShield, XMLPort, xmlelement, mode);
+ }
+
+ void JumpShield::tick(float dt)
+ {
+ SUPER(JumpShield, tick, dt);
+
+ Vector3 shieldPosition = getWorldPosition();
+
+ if (attachedToFigure_ == false && figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getWorldPosition();
+
+ if(figurePosition.x > shieldPosition.x-width_ && figurePosition.x < shieldPosition.x+width_ && figurePosition.z > shieldPosition.z-height_ && figurePosition.z < shieldPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ else if (attachedToFigure_ == true)
+ {
+ fuel_ -= dt;
+ if (fuel_ < 0.0)
+ {
+ figure_->StopShield(this);
+ }
+ }
+ }
+
+ void JumpShield::touchFigure()
+ {
+ JumpItem::touchFigure();
+
+ attachedToFigure_ = figure_->StartShield(this);
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpShield.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpShield.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpShield.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpShield_H__
+#define _JumpShield_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpShield : public JumpItem
+ {
+ public:
+ JumpShield(Context* context);
+ virtual ~JumpShield();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void touchFigure();
+ protected:
+ float stretch_;
+ float fuel_;
+ };
+}
+
+#endif /* _JumpShield_H__ */
Added: code/branches/presentationFS14/src/modules/jump/JumpSpring.cc
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpSpring.cc (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpSpring.cc 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,110 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpSpring.cc
+ @brief If this spring is touched by the figure, it jumps higher then from a platform.
+*/
+
+#include "JumpSpring.h"
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+#include "JumpFigure.h"
+#include "sound/WorldSound.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpSpring);
+
+ JumpSpring::JumpSpring(Context* context) : JumpItem(context)
+ {
+ RegisterObject(JumpSpring);
+
+ stretch_ = 1.0;
+
+ setPosition(Vector3(0,0,0));
+ setVelocity(Vector3(0,0,0));
+ setAcceleration(Vector3(0,0,0));
+
+ setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ JumpSpring::~JumpSpring()
+ {
+
+ }
+
+ void JumpSpring::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpSpring, XMLPort, xmlelement, mode);
+ }
+
+ void JumpSpring::tick(float dt)
+ {
+ SUPER(JumpSpring, tick, dt);
+
+ if (stretch_ > 1.0)
+ {
+ stretch_ -= dt;
+ setScale3D(1.0, 1.0, stretch_);
+ }
+
+ Vector3 springPosition = getWorldPosition();
+
+ if (figure_ != NULL)
+ {
+ Vector3 figurePosition = figure_->getWorldPosition();
+ Vector3 figureVelocity = figure_->getVelocity();
+
+ if(figureVelocity.z < 0 && figurePosition.x > springPosition.x-width_ && figurePosition.x < springPosition.x+width_ && figurePosition.z > springPosition.z-height_ && figurePosition.z < springPosition.z+height_)
+ {
+ touchFigure();
+ }
+ }
+ }
+
+ void JumpSpring::touchFigure()
+ {
+ JumpItem::touchFigure();
+
+ stretch_ = 3.0;
+
+ accelerateFigure();
+ }
+
+ void JumpSpring::accelerateFigure()
+ {
+ if (figure_ != 0)
+ {
+ figure_->JumpFromSpring(this);
+ }
+ }
+}
Added: code/branches/presentationFS14/src/modules/jump/JumpSpring.h
===================================================================
--- code/branches/presentationFS14/src/modules/jump/JumpSpring.h (rev 0)
+++ code/branches/presentationFS14/src/modules/jump/JumpSpring.h 2014-05-27 08:35:27 UTC (rev 10078)
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _JumpSpring_H__
+#define _JumpSpring_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "util/Math.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _JumpExport JumpSpring : public JumpItem
+ {
+ public:
+ JumpSpring(Context* context);
+ virtual ~JumpSpring();
+ virtual void tick(float dt);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void accelerateFigure();
+ virtual void touchFigure();
+ protected:
+ float stretch_;
+ };
+}
+
+#endif /* _JumpSpring_H__ */
More information about the Orxonox-commit
mailing list