[Orxonox-commit 3957] r8631 - in code/branches/presentation: . data/levels src/modules src/modules/gametypes src/orxonox/gametypes
dafrick at orxonox.net
dafrick at orxonox.net
Fri May 27 23:09:00 CEST 2011
Author: dafrick
Date: 2011-05-27 23:09:00 +0200 (Fri, 27 May 2011)
New Revision: 8631
Added:
code/branches/presentation/data/levels/spaceRace.oxw
code/branches/presentation/src/modules/gametypes/
code/branches/presentation/src/modules/gametypes/CMakeLists.txt
code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h
code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h
code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc
code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h
code/branches/presentation/src/modules/gametypes/SpaceRace.cc
code/branches/presentation/src/modules/gametypes/SpaceRace.h
Removed:
code/branches/presentation/src/modules/gametypes/CMakeLists.txt
code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h
code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h
code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc
code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h
code/branches/presentation/src/modules/gametypes/SpaceRace.cc
code/branches/presentation/src/modules/gametypes/SpaceRace.h
Modified:
code/branches/presentation/
code/branches/presentation/src/modules/CMakeLists.txt
code/branches/presentation/src/orxonox/gametypes/Gametype.cc
Log:
Merging spacerace branch into presentation branch.
Property changes on: code/branches/presentation
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Copied: code/branches/presentation/data/levels/spaceRace.oxw (from rev 8630, code/branches/spacerace/data/levels/spaceRace.oxw)
===================================================================
--- code/branches/presentation/data/levels/spaceRace.oxw (rev 0)
+++ code/branches/presentation/data/levels/spaceRace.oxw 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,474 @@
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<LevelInfo
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ tags = "test"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ gametype = SpaceRace
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/skyBoxMoreNebula"
+ >
+
+ <?lua math.randomseed(98) ?>
+
+ <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"/>
+
+ <SimpleNotification message="Reach the last check point within 150 seconds!!" />
+
+ <!-- ------------------SpawnPoint----------------- -->
+ <SpawnPoint position="0,-2100,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="true" >
+ <events>
+ <activity>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint2" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <!-- ------------------CheckPoints----------------- -->
+ <RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint2" position="0,-900,2300" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <SpawnPoint position="0,0,0" lookat="0,1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint2" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint3" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint3" position="0,700,2700" stayActive="true" direction="0,0,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <SpawnPoint position="0,0,0" lookat="0,1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint3" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint4" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint4" position="0,2100,2300" stayActive="true" direction="0,1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger3" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint4" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint5" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint5" position="0,2200,500" stayActive="true" direction="0,1,0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger4" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint5" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint6" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint6" position="0,1500,-800" stayActive="true" direction="0,1,-1" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger5" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint6" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint7" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint7" position="0,200,-1900" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger6" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint7" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint8" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint8" position="0,-700,-1400" stayActive="true" direction="0,-1,-1" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger7" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint8" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint9" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint9" position="0,-1300,-800" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger8" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint9" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint10" position="0,-2100,0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="true" timelimit="150">
+ <attached>
+ < Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <!-- ------------------Planet----------------- -->
+ <Planet position="0,0,0" scale=300 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+ <StaticEntity position="0,0,0" collisionType=static>
+ <collisionShapes>
+ <SphereCollisionShape radius="399" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <!-- ---------------asteroid ellypse----------------- -->
+ <?lua
+ max = 20
+ for i = 0, max, 1
+ do
+ y = math.sin(i/max*6)*2000
+ z = math.cos(i/max*6)*2500
+ x = 0
+ ?>
+ <?lua
+ for k = 1, 15, 1
+ do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>"
+ collisionType = "dynamic"
+ linearDamping = "0.5"
+ angularDamping = "0.01"
+ collisiondamage = "0.01"
+ enablecollisiondamage = "true"
+ scale="<?lua print(j * 5) ?>" >
+ <attached>
+ <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+ <?lua if k == 5 then ?><attached><!-- ---------asteroid fog----- -->
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached> <?lua end ?>
+ </Model>
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 80) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+ <?lua
+ end
+ ?>
+ <?lua end ?>
+
+ <!-- ---------------ForceFields----------------- -->
+ <ForceField position="0,-700,2700" direction="0,1,0" diameter=500 velocity=2000 length=600 />
+ <MovableEntity position="0,-400,2700">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,2500,2000" direction="0,0,-1" diameter=250 velocity=2000 length=600 />
+ <MovableEntity position="0,2500,2000">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,1300,-800" direction="0,-1,-1" diameter=250 velocity=2000 length=800 />
+ <MovableEntity position="0,1300,-800">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,20,1 do ?>
+ <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,-1400,-700" direction="0,-1,1" diameter=250 velocity=2000 length=600 />
+ <MovableEntity position="0,-1400,-700">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <!-- ---------------SpaceShips----------------- -->
+ <SpaceShip position="0,2000,2000" lookat="0,0,0" team=1 >
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WaypointPatrolController alertnessradius=1500 team=0 >
+ <waypoints>
+ <Model scale=0 position="0,2000,2000" />
+ </waypoints>
+ </WaypointPatrolController>
+ </controller>
+ </SpaceShip>
+
+ <SpaceShip position="0,2000,-2000" lookat="0,0,0" team=1 >
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WaypointPatrolController alertnessradius=1500 team=0 >
+ <waypoints>
+ <Model scale=0 position="0,2000,-2000" />
+ </waypoints>
+ </WaypointPatrolController>
+ </controller>
+ </SpaceShip>
+
+ </Scene>
+</Level>
Modified: code/branches/presentation/src/modules/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/CMakeLists.txt 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/CMakeLists.txt 2011-05-27 21:09:00 UTC (rev 8631)
@@ -26,6 +26,7 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(designtools)
+ADD_SUBDIRECTORY(gametypes)
ADD_SUBDIRECTORY(notifications)
ADD_SUBDIRECTORY(objects)
ADD_SUBDIRECTORY(overlays)
Deleted: code/branches/presentation/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/branches/spacerace/src/modules/gametypes/CMakeLists.txt 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/CMakeLists.txt 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,16 +0,0 @@
-SET_SOURCE_FILES(GAMETYPES_SRC_FILES
- SpaceRace.cc
- RaceCheckPoint.cc
-)
-
-ORXONOX_ADD_LIBRARY(gametypes
- MODULE
- FIND_HEADER_FILES
- TOLUA_FILES
- PCH_FILE
- GametypesPrecompiledHeaders.h
- LINK_LIBRARIES
- orxonox
- objects
- SOURCE_FILES ${GAMETYPES_SRC_FILES}
-)
Copied: code/branches/presentation/src/modules/gametypes/CMakeLists.txt (from rev 8630, code/branches/spacerace/src/modules/gametypes/CMakeLists.txt)
===================================================================
--- code/branches/presentation/src/modules/gametypes/CMakeLists.txt (rev 0)
+++ code/branches/presentation/src/modules/gametypes/CMakeLists.txt 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,16 @@
+SET_SOURCE_FILES(GAMETYPES_SRC_FILES
+ SpaceRace.cc
+ RaceCheckPoint.cc
+)
+
+ORXONOX_ADD_LIBRARY(gametypes
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+ PCH_FILE
+ GametypesPrecompiledHeaders.h
+ LINK_LIBRARIES
+ orxonox
+ objects
+ SOURCE_FILES ${GAMETYPES_SRC_FILES}
+)
Deleted: code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h
===================================================================
--- code/branches/spacerace/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,53 +0,0 @@
-/*
- * 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:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
-*/
-
-#include "OrxonoxConfig.h"
-
-///////////////////////////////////////////
-///// Stable Headers /////
-///////////////////////////////////////////
-
-#include <LinearMath/btTransform.h>
-
-///////////////////////////////////////////
-///// All Rebuild Headers /////
-///////////////////////////////////////////
-
-#include "core/BaseObject.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-
-// Just in case some header included windows.h
-#undef min
-#undef max
Copied: code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h (from rev 8630, code/branches/spacerace/src/modules/gametypes/GametypesPrecompiledHeaders.h)
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h (rev 0)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -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:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+///// Stable Headers /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+///// All Rebuild Headers /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Deleted: code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h
===================================================================
--- code/branches/spacerace/src/modules/gametypes/GametypesPrereqs.h 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,70 +0,0 @@
-/*
- * 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:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Shared library macros, enums, constants and forward declarations for the questsystem module
-*/
-
-#ifndef _GametypesPrereqs_H__
-#define _GametypesPrereqs_H__
-
-#include "OrxonoxConfig.h"
-#include "OrxonoxPrereqs.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Gametypes_STATIC_BUILD)
-# ifdef Gametypes_SHARED_BUILD
-# define _GametypesExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _GametypesExport
-# else
-# define _GametypesExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _GametypesExport __attribute__ ((visibility("default")))
-#else
-# define _GametypesExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- class SpaceRace;
-}
-
-#endif /* _GametypesPrereqs_H__ */
Copied: code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h (from rev 8630, code/branches/spacerace/src/modules/gametypes/GametypesPrereqs.h)
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h (rev 0)
+++ code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,70 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _GametypesPrereqs_H__
+#define _GametypesPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Gametypes_STATIC_BUILD)
+# ifdef Gametypes_SHARED_BUILD
+# define _GametypesExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _GametypesExport
+# else
+# define _GametypesExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _GametypesExport __attribute__ ((visibility("default")))
+#else
+# define _GametypesExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class SpaceRace;
+}
+
+#endif /* _GametypesPrereqs_H__ */
Deleted: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,118 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#include "RaceCheckPoint.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "SpaceRace.h"
-#include "util/Convert.h"
-
-namespace orxonox
-{
- CreateFactory(RaceCheckPoint);
-
- RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
- {
- RegisterObject(RaceCheckPoint);
-
- this->bCheckpointIndex_ = 0;
- this->bIsLast_ = false;
- this->bTimeLimit_ = 0;
-
- this->setRadarObjectColour(ColourValue::Blue);
- this->setRadarObjectShape(RadarViewable::Triangle);
- this->setRadarVisibility(false);
- }
-
- RaceCheckPoint::~RaceCheckPoint()
- {
- }
-
- void RaceCheckPoint::tick(float dt)
- {
- SUPER(RaceCheckPoint, tick, dt);
-
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
- this->setRadarVisibility(true);
- else
- this->setRadarVisibility(false);
- }
-
-
- void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
-
- XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
- XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
- XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
- }
-
- void RaceCheckPoint::triggered(bool bIsTriggered)
- {
- DistanceTrigger::triggered(bIsTriggered);
-
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
- {
- gametype->clock_.capture();
- float time = gametype->clock_.getSecondsPrecise();
- if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
- {
- gametype->timeIsUp();
- gametype->end();
- }
- else if (this->getLast())
- gametype->end();
- else
- {
- gametype->newCheckpointReached();
- this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
- }
- }
- }
-
- void RaceCheckPoint::setTimelimit(float timeLimit)
- {
- this->bTimeLimit_ = timeLimit;
- if (this->bTimeLimit_ != 0)
- {
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (gametype)
- {
- const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_)
- + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
- COUT(3) << message;
- const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
- }
- }
- }
-
-}
Copied: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc (from rev 8630, code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.cc)
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc (rev 0)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,118 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "RaceCheckPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SpaceRace.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ CreateFactory(RaceCheckPoint);
+
+ RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+ {
+ RegisterObject(RaceCheckPoint);
+
+ this->bCheckpointIndex_ = 0;
+ this->bIsLast_ = false;
+ this->bTimeLimit_ = 0;
+
+ this->setRadarObjectColour(ColourValue::Blue);
+ this->setRadarObjectShape(RadarViewable::Triangle);
+ this->setRadarVisibility(false);
+ }
+
+ RaceCheckPoint::~RaceCheckPoint()
+ {
+ }
+
+ void RaceCheckPoint::tick(float dt)
+ {
+ SUPER(RaceCheckPoint, tick, dt);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
+ this->setRadarVisibility(true);
+ else
+ this->setRadarVisibility(false);
+ }
+
+
+ void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
+ XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
+ XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+ }
+
+ void RaceCheckPoint::triggered(bool bIsTriggered)
+ {
+ DistanceTrigger::triggered(bIsTriggered);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
+ {
+ gametype->clock_.capture();
+ float time = gametype->clock_.getSecondsPrecise();
+ if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
+ {
+ gametype->timeIsUp();
+ gametype->end();
+ }
+ else if (this->getLast())
+ gametype->end();
+ else
+ {
+ gametype->newCheckpointReached();
+ this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
+ }
+ }
+ }
+
+ void RaceCheckPoint::setTimelimit(float timeLimit)
+ {
+ this->bTimeLimit_ = timeLimit;
+ if (this->bTimeLimit_ != 0)
+ {
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (gametype)
+ {
+ const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_)
+ + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+ }
+ }
+ }
+
+}
Deleted: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,78 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _RaceCheckPoint_H__
-#define _RaceCheckPoint_H__
-
-#include "objects/ObjectsPrereqs.h"
-
-#include "objects/triggers/DistanceTrigger.h"
-#include "interfaces/RadarViewable.h"
-//#include <boost/concept_check.hpp>
-
-namespace orxonox
-{
- /**
- @brief
- The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
- !!! Don't forget to control the indexes of your check points and to set one last check point!!!
- */
- class _ObjectsExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
- {
- public:
- RaceCheckPoint(BaseObject* creator);
- virtual ~RaceCheckPoint();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void tick(float dt);
-
- protected:
- virtual void triggered(bool bIsTriggered);
- inline void setLast(bool isLast)
- { this->bIsLast_ = isLast; }
- inline bool getLast()
- { return this->bIsLast_; }
- inline void setCheckpointIndex(int checkpointIndex)
- { this->bCheckpointIndex_ = checkpointIndex; }
- inline int getCheckpointIndex()
- { return this->bCheckpointIndex_; }
- virtual void setTimelimit(float timeLimit);
- inline float getTimeLimit()
- { return this->bTimeLimit_;}
- inline const WorldEntity* getWorldEntity() const
- { return this; }
-
- private:
- int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
- bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
- float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
-
- };
-}
-
-#endif /* _RaceCheckPoint_H__ */
\ No newline at end of file
Copied: code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h (from rev 8630, code/branches/spacerace/src/modules/gametypes/RaceCheckPoint.h)
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h (rev 0)
+++ code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,78 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _RaceCheckPoint_H__
+#define _RaceCheckPoint_H__
+
+#include "objects/ObjectsPrereqs.h"
+
+#include "objects/triggers/DistanceTrigger.h"
+#include "interfaces/RadarViewable.h"
+//#include <boost/concept_check.hpp>
+
+namespace orxonox
+{
+ /**
+ @brief
+ The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
+ !!! Don't forget to control the indexes of your check points and to set one last check point!!!
+ */
+ class _ObjectsExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
+ {
+ public:
+ RaceCheckPoint(BaseObject* creator);
+ virtual ~RaceCheckPoint();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+
+ protected:
+ virtual void triggered(bool bIsTriggered);
+ inline void setLast(bool isLast)
+ { this->bIsLast_ = isLast; }
+ inline bool getLast()
+ { return this->bIsLast_; }
+ inline void setCheckpointIndex(int checkpointIndex)
+ { this->bCheckpointIndex_ = checkpointIndex; }
+ inline int getCheckpointIndex()
+ { return this->bCheckpointIndex_; }
+ virtual void setTimelimit(float timeLimit);
+ inline float getTimeLimit()
+ { return this->bTimeLimit_;}
+ inline const WorldEntity* getWorldEntity() const
+ { return this; }
+
+ private:
+ int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
+ bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+ float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+
+ };
+}
+
+#endif /* _RaceCheckPoint_H__ */
\ No newline at end of file
Deleted: code/branches/presentation/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/spacerace/src/modules/gametypes/SpaceRace.cc 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.cc 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,106 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#include "SpaceRace.h"
-
-#include "core/CoreIncludes.h"
-#include "network/Host.h"
-#include <util/Clock.h>
-#include <util/Math.h>
-#include "util/Convert.h"
-
-namespace orxonox
-{
- CreateUnloadableFactory(SpaceRace);
-
- SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
- {
- RegisterObject(SpaceRace);
- this->bCheckpointsReached_ = 0;
- this->bTimeIsUp_ = false;
- this->numberOfBots_ = 0;
- }
-
- void SpaceRace::end()
- {
- this->Gametype::end();
-
- if (this->bTimeIsUp_)
- {
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
- + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
- + " before the time limit. You lose!";
- COUT(3) << message;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- }
- else
- {
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
- + "." + multi_cast<std::string>(ms) + " seconds.";
- COUT(3) << message << std::endl;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- float time = this->clock_.getSecondsPrecise();
- this->scores_.insert(time);
- std::set<float>::iterator it;
- for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
- COUT(3) << multi_cast<std::string>(*it) << std::endl;
- }
- }
-
- void SpaceRace::start()
- {
- Gametype::start();
-
- std::string message("The match has started! Reach the check points as quickly as possible!");
- COUT(3) << message << std::endl;
- Host::Broadcast(message);
- }
-
- void SpaceRace::newCheckpointReached()
- {
- this->bCheckpointsReached_++;
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
- + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
- + " seconds.\n";
- COUT(3) << message;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- }
-
-}
\ No newline at end of file
Copied: code/branches/presentation/src/modules/gametypes/SpaceRace.cc (from rev 8630, code/branches/spacerace/src/modules/gametypes/SpaceRace.cc)
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.cc (rev 0)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.cc 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,106 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "SpaceRace.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include <util/Clock.h>
+#include <util/Math.h>
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(SpaceRace);
+
+ SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
+ {
+ RegisterObject(SpaceRace);
+ this->bCheckpointsReached_ = 0;
+ this->bTimeIsUp_ = false;
+ this->numberOfBots_ = 0;
+ }
+
+ void SpaceRace::end()
+ {
+ this->Gametype::end();
+
+ if (this->bTimeIsUp_)
+ {
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+ + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
+ + " before the time limit. You lose!";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ }
+ else
+ {
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
+ + "." + multi_cast<std::string>(ms) + " seconds.";
+ COUT(3) << message << std::endl;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ float time = this->clock_.getSecondsPrecise();
+ this->scores_.insert(time);
+ std::set<float>::iterator it;
+ for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
+ COUT(3) << multi_cast<std::string>(*it) << std::endl;
+ }
+ }
+
+ void SpaceRace::start()
+ {
+ Gametype::start();
+
+ std::string message("The match has started! Reach the check points as quickly as possible!");
+ COUT(3) << message << std::endl;
+ Host::Broadcast(message);
+ }
+
+ void SpaceRace::newCheckpointReached()
+ {
+ this->bCheckpointsReached_++;
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
+ + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+ + " seconds.\n";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ }
+
+}
\ No newline at end of file
Deleted: code/branches/presentation/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/spacerace/src/modules/gametypes/SpaceRace.h 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _SpaceRace_H__
-#define _SpaceRace_H__
-
-#include "gametypes/Gametype.h"
-#include "gametypes/GametypesPrereqs.h"
-#include "RaceCheckPoint.h"
-#include <boost/concept_check.hpp>
-#include <util/Clock.h>
-#include <string.h>
-#include <set>
-
-namespace orxonox
-{
- /**
- @brief
- The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
- */
- class _OrxonoxExport SpaceRace : public Gametype
- {
- friend class RaceCheckPoint;
-
- public:
- SpaceRace(BaseObject* creator);
- virtual ~SpaceRace() {}
-
- virtual void start();
- virtual void end();
-
- virtual void newCheckpointReached();
-
- inline void setCheckpointsReached(int n)
- { this->bCheckpointsReached_ = n;}
- inline int getCheckpointsReached()
- { return this->bCheckpointsReached_; }
- inline void timeIsUp()
- { this->bTimeIsUp_ = true;}
-
- protected:
-
- private:
- int bCheckpointsReached_; //The current number of check points reached by the player.
- std::set<float> scores_; //The times of the players are saved in a set.
- bool bTimeIsUp_; //True if one of the check points is reached too late.
- Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
- };
-}
-
-#endif /* _SpaceRace_H__ */
Copied: code/branches/presentation/src/modules/gametypes/SpaceRace.h (from rev 8630, code/branches/spacerace/src/modules/gametypes/SpaceRace.h)
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.h (rev 0)
+++ code/branches/presentation/src/modules/gametypes/SpaceRace.h 2011-05-27 21:09:00 UTC (rev 8631)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SpaceRace_H__
+#define _SpaceRace_H__
+
+#include "gametypes/Gametype.h"
+#include "gametypes/GametypesPrereqs.h"
+#include "RaceCheckPoint.h"
+#include <boost/concept_check.hpp>
+#include <util/Clock.h>
+#include <string.h>
+#include <set>
+
+namespace orxonox
+{
+ /**
+ @brief
+ The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
+ */
+ class _OrxonoxExport SpaceRace : public Gametype
+ {
+ friend class RaceCheckPoint;
+
+ public:
+ SpaceRace(BaseObject* creator);
+ virtual ~SpaceRace() {}
+
+ virtual void start();
+ virtual void end();
+
+ virtual void newCheckpointReached();
+
+ inline void setCheckpointsReached(int n)
+ { this->bCheckpointsReached_ = n;}
+ inline int getCheckpointsReached()
+ { return this->bCheckpointsReached_; }
+ inline void timeIsUp()
+ { this->bTimeIsUp_ = true;}
+
+ protected:
+
+ private:
+ int bCheckpointsReached_; //The current number of check points reached by the player.
+ std::set<float> scores_; //The times of the players are saved in a set.
+ bool bTimeIsUp_; //True if one of the check points is reached too late.
+ Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
+ };
+}
+
+#endif /* _SpaceRace_H__ */
Modified: code/branches/presentation/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/presentation/src/orxonox/gametypes/Gametype.cc 2011-05-27 21:01:24 UTC (rev 8630)
+++ code/branches/presentation/src/orxonox/gametypes/Gametype.cc 2011-05-27 21:09:00 UTC (rev 8631)
@@ -305,33 +305,32 @@
SpawnPoint* Gametype::getBestSpawnPoint(PlayerInfo* player) const
{
+ // If there is at least one SpawnPoint.
if (this->spawnpoints_.size() > 0)
{
+ // Fallback spawn point if there is no active one, choose a random one.
SpawnPoint* fallbackSpawnPoint = NULL;
unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size())));
unsigned int index = 0;
- std::set<SpawnPoint*> activeSpawnPoints = this->spawnpoints_;
+ std::vector<SpawnPoint*> activeSpawnPoints;
for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
{
if (index == randomspawn)
fallbackSpawnPoint = (*it);
- if (!(*it)->isActive())
- activeSpawnPoints.erase(*it);
+ if (*it != NULL && (*it)->isActive())
+ activeSpawnPoints.push_back(*it);
++index;
}
- randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size())));
- index = 0;
- for (std::set<SpawnPoint*>::const_iterator it = activeSpawnPoints.begin(); it != activeSpawnPoints.end(); ++it)
+ if(activeSpawnPoints.size() > 0)
{
- if (index == randomspawn)
- return (*it);
-
- ++index;
+ randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(activeSpawnPoints.size())));
+ return activeSpawnPoints[randomspawn];
}
+ COUT(2) << "Warning: Fallback SpawnPoint was used, because there were no active SpawnPoints." << endl;
return fallbackSpawnPoint;
}
return 0;
More information about the Orxonox-commit
mailing list