[Orxonox-commit 5593] r10255 - in code/branches/presentationHS14merge: . cmake data/defaultConfig data/gui/layouts data/gui/scripts src/orxonox src/orxonox/gametypes

landauf at orxonox.net landauf at orxonox.net
Wed Feb 4 22:21:29 CET 2015


Author: landauf
Date: 2015-02-04 22:21:28 +0100 (Wed, 04 Feb 2015)
New Revision: 10255

Added:
   code/branches/presentationHS14merge/data/defaultConfig/orxonox.ini
   code/branches/presentationHS14merge/data/gui/layouts/CampaignMenu.layout
   code/branches/presentationHS14merge/data/gui/scripts/CampaignMenu.lua
Modified:
   code/branches/presentationHS14merge/
   code/branches/presentationHS14merge/cmake/LibraryConfig.cmake
   code/branches/presentationHS14merge/data/gui/layouts/SingleplayerMenu.layout
   code/branches/presentationHS14merge/data/gui/scripts/SingleplayerMenu.lua
   code/branches/presentationHS14merge/src/orxonox/LevelManager.cc
   code/branches/presentationHS14merge/src/orxonox/LevelManager.h
   code/branches/presentationHS14merge/src/orxonox/gametypes/Mission.cc
Log:
merged storymodeHS14


Property changes on: code/branches/presentationHS14merge
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/Racingbot:9388-9513
/code/branches/ScriptableController:9999-10075
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/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/core6:9552-9666
/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/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/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/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/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/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/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/newlevel2012:9033-9244
/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/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/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/pickup2012:9029-9189
/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,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationFS14:10069-10215
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/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/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/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/weaponupdateHS14:10084-10237
   + /code/branches/Racingbot:9388-9513
/code/branches/ScriptableController:9999-10075
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/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/core6:9552-9666
/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/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/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/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/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/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/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/newlevel2012:9033-9244
/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/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/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/pickup2012:9029-9189
/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,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationFS14:10069-10215
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/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/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10254
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/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/weaponupdateHS14:10084-10237

Modified: code/branches/presentationHS14merge/cmake/LibraryConfig.cmake
===================================================================
--- code/branches/presentationHS14merge/cmake/LibraryConfig.cmake	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/cmake/LibraryConfig.cmake	2015-02-04 21:21:28 UTC (rev 10255)
@@ -160,7 +160,7 @@
 # Expand the next statement if newer boost versions are released
 SET(Boost_ADDITIONAL_VERSIONS 1.40 1.40.0 1.41 1.41.0 1.42 1.42.0 1.43 1.43.0
                               1.44 1.44.0 1.45 1.45.0 1.46 1.46.0 1.46.1 1.49.0
-			      1.53.0)
+                              1.53.0)
 IF(NOT TARDIS)
   FIND_PACKAGE(Boost 1.40 REQUIRED thread filesystem system date_time)
 ENDIF()

Copied: code/branches/presentationHS14merge/data/defaultConfig/orxonox.ini (from rev 10254, code/branches/storymodeHS14/data/defaultConfig/orxonox.ini)
===================================================================
--- code/branches/presentationHS14merge/data/defaultConfig/orxonox.ini	                        (rev 0)
+++ code/branches/presentationHS14merge/data/defaultConfig/orxonox.ini	2015-02-04 21:21:28 UTC (rev 10255)
@@ -0,0 +1,5 @@
+[LevelManager]
+campaignMissions_[0] = "missionOne.oxw"
+campaignMissions_[1] = "fightInOurBack.oxw"
+campaignMissions_[2] = "pirateAttack.oxw"
+campaignMissions_[3] = "iJohnVane_TriptoArea51.oxw"

Copied: code/branches/presentationHS14merge/data/gui/layouts/CampaignMenu.layout (from rev 10254, code/branches/storymodeHS14/data/gui/layouts/CampaignMenu.layout)
===================================================================
--- code/branches/presentationHS14merge/data/gui/layouts/CampaignMenu.layout	                        (rev 0)
+++ code/branches/presentationHS14merge/data/gui/layouts/CampaignMenu.layout	2015-02-04 21:21:28 UTC (rev 10255)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="MenuWidgets/StaticImage" Name="orxonox/CampaignBackground" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1.0,0},{1.0,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Window Type="MenuWidgets/Button" Name="orxonox/MissionOneButton" >
+            <Property Name="Text" Value="Mission 1" />
+            <Property Name="Visible" Value="False"/>
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2875,0},{0.6,0},{0.3375,0}}" />
+            <Event Name="Clicked" Function="CampaignMenu.MissionOneButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/MissionTwoButton" >
+            <Property Name="Text" Value="Mission 2" />
+            <Property Name="Visible" Value="False"/>
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" />
+            <Property Name="Disabled" Value="True" />
+            <Event Name="Clicked" Function="CampaignMenu.MissionTwoButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/MissionThreeButton" >
+            <Property Name="Text" Value="Mission 3" />
+            <Property Name="Visible" Value="False"/>
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4375,0},{0.6,0},{0.4875,0}}" />
+            <Property Name="Disabled" Value="True" />
+            <Event Name="Clicked" Function="CampaignMenu.MissionThreeButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/MissionFourButton" >
+            <Property Name="Text" Value="Mission 4" />
+            <Property Name="Visible" Value="False"/>
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5125,0},{0.6,0},{0.5625,0}}" />
+            <Property Name="Disabled" Value="True" />
+            <Event Name="Clicked" Function="CampaignMenu.MissionFourButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignMenuBackButton" >
+            <Property Name="Text" Value="Back" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8,0},{0.6,0},{0.85,0}}" />
+            <Event Name="Clicked" Function="CampaignMenu.CampaignMenuBackButton_clicked"/> 
+        </Window>
+        <Window Type="MenuWidgets/StaticText" Name="orxonox/CampaignMenuCongratulation" >
+            <Property Name="Text" Value="Campaign Completed!!!" />
+            <Property Name="Visible" Value="False"/>
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="VertFormatting" Value="TopAligned" />
+            <Property Name="UnifiedMaxSize" Value="{{2,1},{2,1}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.15,0},{0.6,0},{0.2,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
\ No newline at end of file

Modified: code/branches/presentationHS14merge/data/gui/layouts/SingleplayerMenu.layout
===================================================================
--- code/branches/presentationHS14merge/data/gui/layouts/SingleplayerMenu.layout	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/data/gui/layouts/SingleplayerMenu.layout	2015-02-04 21:21:28 UTC (rev 10255)
@@ -54,5 +54,11 @@
             <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
             <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
         </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignButton" >
+            <Property Name="Text" Value="Campaign" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.8,0},{0.6,0},{0.85,0}}" />
+            <Event Name="Clicked" Function="SingleplayerMenu.CampaignButton_clicked"/>
+        </Window>
     </Window>
 </GUILayout>

Copied: code/branches/presentationHS14merge/data/gui/scripts/CampaignMenu.lua (from rev 10254, code/branches/storymodeHS14/data/gui/scripts/CampaignMenu.lua)
===================================================================
--- code/branches/presentationHS14merge/data/gui/scripts/CampaignMenu.lua	                        (rev 0)
+++ code/branches/presentationHS14merge/data/gui/scripts/CampaignMenu.lua	2015-02-04 21:21:28 UTC (rev 10255)
@@ -0,0 +1,97 @@
+--CampaignMenu.lua
+
+local P = createMenuSheet("CampaignMenu")
+
+function P:onShow()
+    P:updateButtons()
+end
+
+function P.updateButtons()
+    P.updateButton(0, winMgr:getWindow("orxonox/MissionOneButton"))
+    P.updateButton(1, winMgr:getWindow("orxonox/MissionTwoButton"))
+    P.updateButton(2, winMgr:getWindow("orxonox/MissionThreeButton"))
+    P.updateButton(3, winMgr:getWindow("orxonox/MissionFourButton"))
+
+    if (P.getIndexOfLastFinishedMission() == orxonox.LevelManager:getInstance():getNumberOfCampaignMissions() - 1) then
+        local label = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
+        label:setProperty("Visible","True")
+    end
+end
+
+function P.updateButton(index, button)
+    if (P.shouldDisplayButton(index)) then
+        button:setProperty("Visible", "True")
+
+        if (P.shouldEnableButton(index)) then
+            button:setProperty("Disabled", "False")
+        end
+    end
+end
+
+function P.shouldDisplayButton(index)
+    local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
+    return index < size
+end
+
+function P.shouldEnableButton(index)
+    return index <= P.getIndexOfLastFinishedMission() + 1
+end
+
+function P.getIndexOfLastFinishedMission()
+    local lastMission = orxonox.LevelManager:getInstance():getLastFinishedCampaignMission()
+    if (lastMission and lastMission ~= "") then
+        local size = orxonox.LevelManager:getInstance():getNumberOfCampaignMissions()
+        local index = 0
+        while index < size do
+            local mission = orxonox.LevelManager:getInstance():getCampaignMission(index)
+            if (mission == lastMission) then 
+                return index
+            end
+            index = index + 1
+        end
+    end
+    return -1
+end
+
+function P.MissionOneButton_clicked(e)
+    P.loadLevel(P.FindLevel(0))
+end
+
+function P.MissionTwoButton_clicked(e)
+    P.loadLevel(P.FindLevel(1))
+end
+
+function P.MissionThreeButton_clicked(e)
+    P.loadLevel(P.FindLevel(2))
+end
+
+function P.MissionFourButton_clicked(e)
+    P.loadLevel(P.FindLevel(3))
+end
+
+function P.loadLevel(level)
+    orxonox.execute("startGame " .. level:getXMLFilename())
+    hideAllMenuSheets()
+end
+
+function P.FindLevel(index)
+    local filename = orxonox.LevelManager:getInstance():getCampaignMission(index)
+    local level = nil
+    local templevel = nil
+    local size = orxonox.LevelManager:getInstance():getNumberOfLevels()
+    local index = 0
+    while index < size do
+        templevel = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
+        if(templevel:getXMLFilename()==filename) then 
+            level = templevel
+        end
+    index=index+1
+    end
+    return level
+end
+
+function P.CampaignMenuBackButton_clicked(e)
+    hideMenuSheet(P.name)
+end
+
+return P
\ No newline at end of file

Modified: code/branches/presentationHS14merge/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/presentationHS14merge/data/gui/scripts/SingleplayerMenu.lua	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/data/gui/scripts/SingleplayerMenu.lua	2015-02-04 21:21:28 UTC (rev 10255)
@@ -1,7 +1,7 @@
 -- SingleplayerMenu.lua
 
 local P = createMenuSheet("SingleplayerMenu")
-P.loadAlong = {"ShipSelectionMenu"}
+P.loadAlong = {"ShipSelectionMenu","CampaignMenu"}
 P.levelList = {}
 P.activeTabIndexes = {}
 P.scrollbarWidth = 13
@@ -22,7 +22,7 @@
     -- update description and screenshot boxes
     P.SingleplayerSelectionChanged()
 
-    --buttons are arranged in a 1x3 matrix
+    --buttons are arranged in a 2x3 matrix
     P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
             ["callback"]  = P.SingleplayerStartButton_clicked
@@ -37,6 +37,11 @@
             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
             ["callback"]  = P.SingleplayerBackButton_clicked
     })
+
+    P:setButton(2, 2,{
+            ["button"] = winMgr:getWindow("orxonox/CampaignButton"),
+            ["callback"] = P.CampaignButton_clicked
+    })
 end
 
 function P.createLevelList()
@@ -165,4 +170,8 @@
     hideMenuSheet(P.name)
 end
 
+function P.CampaignButton_clicked(e)
+    showMenuSheet("CampaignMenu", true)
+end
+
 return P

Modified: code/branches/presentationHS14merge/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/presentationHS14merge/src/orxonox/LevelManager.cc	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/src/orxonox/LevelManager.cc	2015-02-04 21:21:28 UTC (rev 10255)
@@ -88,9 +88,21 @@
     {
         SetConfigValue(defaultLevelName_, "missionOne.oxw")
             .description("Sets the pre selection of the level in the main menu.");
+        SetConfigValue(lastFinishedCampaignMission_,  "")
+            .description("The last finished mission of a campaign");
+        SetConfigValue(campaignMissions_,  std::vector<std::string>())
+            .description("The list of missions in the campaign");
     }
 
     /**
+     * @brief Stores the argument in the corresponding config value.
+     */
+    void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission)
+    {
+        ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission);
+    }
+
+    /**
     @brief
         Request activity for the input Level.
         The Level will be added to the list of Levels whose activity is requested. The list is accessed in a FIFO manner.

Modified: code/branches/presentationHS14merge/src/orxonox/LevelManager.h
===================================================================
--- code/branches/presentationHS14merge/src/orxonox/LevelManager.h	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/src/orxonox/LevelManager.h	2015-02-04 21:21:28 UTC (rev 10255)
@@ -90,6 +90,15 @@
             unsigned int getNumberOfLevels(void);
             LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels.
 
+            void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission);
+            inline const std::string& getLastFinishedCampaignMission() const
+                { return this->lastFinishedCampaignMission_; }
+
+            inline unsigned int getNumberOfCampaignMissions()
+                { return this->campaignMissions_.size(); }
+            inline const std::string& getCampaignMission(unsigned int index)
+                { return this->campaignMissions_[index]; }
+
             /**
             @brief Get the instance of the LevelManager.
             @return Returns the instance of the LevelManager.
@@ -115,6 +124,8 @@
 
             // config values
             std::string defaultLevelName_;
+            std::string lastFinishedCampaignMission_;
+            std::vector<std::string> campaignMissions_;
 
             static LevelManager* singletonPtr_s;
     }; // tolua_export

Modified: code/branches/presentationHS14merge/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/branches/presentationHS14merge/src/orxonox/gametypes/Mission.cc	2015-02-03 22:43:42 UTC (rev 10254)
+++ code/branches/presentationHS14merge/src/orxonox/gametypes/Mission.cc	2015-02-04 21:21:28 UTC (rev 10255)
@@ -27,6 +27,7 @@
  */
 
 #include "Mission.h"
+
 #include "items/Engine.h"
 #include "controllers/ArtificialController.h"
 
@@ -35,8 +36,8 @@
 #include "infos/PlayerInfo.h"
 #include "network/Host.h"
 #include "worldentities/pawns/Pawn.h"
+#include "LevelManager.h"
 
-
 namespace orxonox
 {
     SetConsoleCommand("Mission", "endMission", &Mission::endMission);
@@ -69,7 +70,7 @@
 
     void Mission::pawnKilled(Pawn* victim, Pawn* killer)
     {
-        if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer() )
+        if (victim && victim->getPlayer() && victim->getPlayer()->isHumanPlayer())
         {
             this->lives_--;
         }
@@ -86,37 +87,41 @@
     void Mission::end()
     {
         if (this->missionAccomplished_ && !this->gtinfo_->hasEnded())
+        {
             this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+
+            LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());
+        }
         else if (!this->gtinfo_->hasEnded())
             this->gtinfo_->sendAnnounceMessage("Mission failed!");
+
         Gametype::end();
     }
 
     void Mission::setTeams()
-    {//Set pawn-colours
+    { //Set pawn-colours
         for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
         {
             Pawn* pawn = static_cast<Pawn*>(*it);
-            if(!pawn) continue;
-                this->setDefaultObjectColour(pawn);
+            if (!pawn)
+                continue;
+            this->setDefaultObjectColour(pawn);
         }
     }
     void Mission::endMission(bool accomplished)
     {
         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
-        {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
+        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions!
             it->setMissionAccomplished(accomplished);
             it->end();
         }
     }
-    
+
     void Mission::setLivesWrapper(unsigned int amount)
     {
         for (ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)
-        {//TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
+        { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions!
             it->setLives(amount);
         }
     }
-
-
 }




More information about the Orxonox-commit mailing list