Index: code/branches/storymodeHS14/data/gui/layouts/CampaignMenu.layout
===================================================================
--- code/branches/storymodeHS14/data/gui/layouts/CampaignMenu.layout	(revision 10157)
+++ code/branches/storymodeHS14/data/gui/layouts/CampaignMenu.layout	(revision 10157)
@@ -0,0 +1,59 @@
+<?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="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="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="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="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.7,0},{0.8,0},{0.85,0},{0.85,0}}" />
+            <Event Name="Clicked" Function="CampaignMenu.CampaignMenuBackButton_clicked"/> 
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/CampaignMenuRefreshButton" >
+            <Property Name="Text" Value="Refresh" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.8,0},{0.3,0},{0.85,0}}" />
+            <Event Name="Clicked" Function="CampaignMenu.CampaignMenuRefreshButton_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>
Index: code/branches/storymodeHS14/data/gui/layouts/SingleplayerMenu.layout
===================================================================
--- code/branches/storymodeHS14/data/gui/layouts/SingleplayerMenu.layout	(revision 10085)
+++ code/branches/storymodeHS14/data/gui/layouts/SingleplayerMenu.layout	(revision 10157)
@@ -53,5 +53,11 @@
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.725,0},{0.75,0},{0.775,0}}" />
-            <Event Name="Clicked" Function="SingleplayerMenu.SingleplayerBackButton_clicked"/>
+            <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>
Index: code/branches/storymodeHS14/data/gui/scripts/CampaignMenu.lua
===================================================================
--- code/branches/storymodeHS14/data/gui/scripts/CampaignMenu.lua	(revision 10157)
+++ code/branches/storymodeHS14/data/gui/scripts/CampaignMenu.lua	(revision 10157)
@@ -0,0 +1,136 @@
+--CampaignMenu.lua
+
+local P = createMenuSheet("CampaignMenu")
+
+function P.onLoad()
+	
+	local MissionTwoButton = winMgr:getWindow("orxonox/MissionTwoButton")
+	if (P.CheckLevel("missionOne.oxw")) then
+	MissionTwoButton:setProperty("Disabled", "False")
+	end
+	
+	local MissionThreeButton = winMgr:getWindow("orxonox/MissionThreeButton")
+	if (P.CheckLevel("fightInOurBack.oxw")) then
+	MissionThreeButton:setProperty("Disabled", "False")
+	end
+
+	local MissionFourButton = winMgr:getWindow("orxonox/MissionFourButton")
+	if (P.CheckLevel("pirateAttack.oxw")) then
+	MissionFourButton:setProperty("Disabled", "False")
+	end
+	
+	local Completed = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
+	if (P.CheckLevel("iJohnVane_TriptoArea51.oxw")) then
+	Completed:setProperty("Visible","True")
+	end
+end
+
+function P.GenerateHelperString(number)
+	local string = ""
+	while number > 1 do
+		string = string.." "
+		number = number-1
+	end
+	string = string.."."
+	return string
+end
+
+function P.FindLevel(filename)
+	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.CheckLevel(filename)
+	local file = io.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt", "r+")
+	local index = 0
+	local returnvalue = false
+	local numberoflines = 58-string.len(filename)
+	local helpstringfalse = filename.." 0"..P.GenerateHelperString(numberoflines) 
+	local helpstringtrue = filename.." 1"..P.GenerateHelperString(numberoflines)
+	while index < 100 do
+		local line = file:read()
+		if(line == helpstringfalse) then
+			returnvalue = false 
+			break
+		end
+		if(line == helpstringtrue) then
+			returnvalue = true
+			break
+		end
+		index=index+1
+	end	
+	io.close(file)
+	return returnvalue
+end
+
+function P.MissionOneButton_clicked(e)
+	local level = P.FindLevel("missionOne.oxw")
+		orxonox.execute("startGame " .. level:getXMLFilename())
+		hideAllMenuSheets()
+end
+
+function P.MissionTwoButton_clicked(e)
+	local level = P.FindLevel("fightInOurBack.oxw")
+	if (P.CheckLevel("missionOne.oxw")) then
+		orxonox.execute("startGame " .. level:getXMLFilename())
+		hideAllMenuSheets()
+	end
+end
+
+function P.MissionThreeButton_clicked(e)
+	local level = P.FindLevel("pirateAttack.oxw")
+	if (P.CheckLevel("fightInOurBack.oxw")) then
+		orxonox.execute("startGame " .. level:getXMLFilename())
+		hideAllMenuSheets()
+	else
+		 hideMenuSheet(P.name)
+	end
+end
+
+function P.MissionFourButton_clicked(e)
+	local level = P.FindLevel("iJohnVane_TriptoArea51.oxw")
+	if (P.CheckLevel("pirateAttack.oxw")) then
+		orxonox.execute("startGame " .. level:getXMLFilename())
+		hideAllMenuSheets()
+	else
+		 hideMenuSheet(P.name)
+	end
+end
+
+function P.CampaignMenuRefreshButton_clicked(e)
+	local MissionTwoButton = winMgr:getWindow("orxonox/MissionTwoButton")
+	if (P.CheckLevel("missionOne.oxw")) then
+	MissionTwoButton:setProperty("Disabled", "False")
+	end
+	
+	local MissionThreeButton = winMgr:getWindow("orxonox/MissionThreeButton")
+	if (P.CheckLevel("fightInOurBack.oxw")) then
+	MissionThreeButton:setProperty("Disabled", "False")
+	end
+
+	local MissionFourButton = winMgr:getWindow("orxonox/MissionFourButton")
+	if (P.CheckLevel("pirateAttack.oxw")) then
+	MissionFourButton:setProperty("Disabled", "False")
+	end
+	
+	local Completed = winMgr:getWindow("orxonox/CampaignMenuCongratulation")
+	if (P.CheckLevel("iJohnVane_TriptoArea51.oxw")) then
+	Completed:setProperty("Visible","True")
+	end
+end
+
+function P.CampaignMenuBackButton_clicked(e)
+    hideMenuSheet(P.name)
+end
+
+return P
Index: code/branches/storymodeHS14/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/storymodeHS14/data/gui/scripts/SingleplayerMenu.lua	(revision 10085)
+++ code/branches/storymodeHS14/data/gui/scripts/SingleplayerMenu.lua	(revision 10157)
@@ -2,5 +2,5 @@
 
 local P = createMenuSheet("SingleplayerMenu")
-P.loadAlong = {"ShipSelectionMenu"}
+P.loadAlong = {"ShipSelectionMenu","CampaignMenu"}
 P.levelList = {}
 P.activeTabIndexes = {}
@@ -19,9 +19,10 @@
     P.createFilterTab("Tests", "test")
     P.createFilterTab("Show All", nil)
+   
 
     -- update description and screenshot boxes
     P.SingleplayerSelectionChanged()
 
-    --buttons are arranged in a 1x3 matrix
+    --buttons are arranged in a 1x4 matrix
     P:setButton(1, 1, {
             ["button"] = winMgr:getWindow("orxonox/SingleplayerStartButton"),
@@ -37,4 +38,8 @@
             ["button"] = winMgr:getWindow("orxonox/SingleplayerBackButton"),
             ["callback"]  = P.SingleplayerBackButton_clicked
+    })
+    P:setButton(1, 4,{
+    		["button"] = winMgr:getWindow("orxonox/CampaignButton"),
+    		["callback"] = P.CampaignButton_clicked
     })
 end
@@ -166,3 +171,7 @@
 end
 
+function P.CampaignButton_clicked(e)
+	showMenuSheet("CampaignMenu", true)
+end
+
 return P
Index: code/branches/storymodeHS14/data/gui/scripts/campaign.txt
===================================================================
--- code/branches/storymodeHS14/data/gui/scripts/campaign.txt	(revision 10157)
+++ code/branches/storymodeHS14/data/gui/scripts/campaign.txt	(revision 10157)
@@ -0,0 +1,7 @@
+1f you want to insert a new level do not use tab use       .
+spacebar!!!                                                .
+missionOne.oxw 1                                           .
+fightInOurBack.oxw 1                                       .
+pirateAttack.oxw 1                                         .
+iJohnVane_TriptoArea51.oxw 0                               .
+............................................................
Index: code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc	(revision 10085)
+++ code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc	(revision 10157)
@@ -36,5 +36,8 @@
 #include "network/Host.h"
 #include "worldentities/pawns/Pawn.h"
-
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <ios>
 
 namespace orxonox
@@ -78,4 +81,29 @@
     void Mission::start()
     {
+    	std::fstream myfile;
+    	    	myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt");
+    	    	std::string line;
+    	    	std::string mission=this->getFilename();
+    	    	int k=58-mission.length();
+    	    	std::string helperstring = "";
+    	    	if(myfile.is_open()){
+    	    	    	while (k>1) {
+    	    	    		helperstring=helperstring+" ";
+    	    	    		k=k-1;
+    	    	    	}
+    	    	    	helperstring=helperstring+".";
+    	    	       while(getline (myfile,line)){
+    	    	    	  if(line==mission+" 0"+helperstring){
+    	    	    		  long pos = myfile.tellp();
+    	    	    		  myfile.seekp (pos-61);
+    	    	    		  myfile << mission+" 1"+helperstring;
+    	    	    	  }
+    	    	    	}}
+    	    	else{
+    	    		this->end();
+    	    	}
+    	    	        myfile.flush();
+    	    	        myfile.clear();
+    	    	        myfile.close();
         Gametype::start();
         this->setTeams();
@@ -84,8 +112,43 @@
     }
 
+    std::string GenerateHelperString(int number){
+    	std::string helperstring = "";
+    	while (number>1) {
+    		helperstring=helperstring+" ";
+    		number=number-1;
+    	}
+    	helperstring=helperstring+".";
+    	return helperstring;
+    }
+
     void Mission::end()
     {
-        if (this->missionAccomplished_ && !this->gtinfo_->hasEnded())
+
+        if (this->missionAccomplished_ && !this->gtinfo_->hasEnded()){
             this->gtinfo_->sendAnnounceMessage("Mission accomplished!");
+            std::fstream myfile;
+                	    	myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt");
+                	    	std::string line;
+                	    	std::string mission=this->getFilename();
+                	    	int k=58-mission.length();
+                	    	std::string helperstring = "";
+                	    	if(myfile.is_open()){
+                	    	    	while (k>1) {
+                	    	    		helperstring=helperstring+" ";
+                	    	    		k=k-1;
+                	    	    	}
+                	    	    	helperstring=helperstring+".";
+                	    	       while(getline (myfile,line)){
+                	    	    	  if(line==mission+" 0"+helperstring){
+                	    	    		  long pos = myfile.tellp();
+                	    	    		  myfile.seekp (pos-61);
+                	    	    		  myfile << mission+" 1"+helperstring;
+                	    	    	  }
+                	    	    	}}
+                	    	        myfile.flush();
+                	    	        myfile.clear();
+                	    	        myfile.close();
+                  }
+
         else if (!this->gtinfo_->hasEnded())
             this->gtinfo_->sendAnnounceMessage("Mission failed!");
@@ -106,9 +169,35 @@
         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!
-            it->setMissionAccomplished(accomplished);
+            if(accomplished){
+            	std::fstream myfile;
+            		myfile.open("/home/pmao/pmao-extra-0/orxonox/storymodeHS14/data/gui/scripts/campaign.txt");
+            		std::string line;
+           	    	std::string mission=it->getFilename();
+  	    	    	int k=58-mission.length();
+            	    std::string helperstring = "";
+            	    if(myfile.is_open()){
+            	    	while (k>1) {
+            	    		helperstring=helperstring+" ";
+            	    	    k=k-1;
+            	    	    	    }
+            	    helperstring=helperstring+".";
+            	    	while(getline (myfile,line)){
+            	    		if(line==mission+" 0"+helperstring){
+            	    		long pos = myfile.tellp();
+            	    	    myfile.seekp (pos-61);
+            	    	    myfile << mission+" 1"+helperstring;
+            	    	    	    	  }
+            	    	}
+            	    }
+            	    myfile.flush();
+            	    myfile.clear();
+            	    myfile.close();
+            }
+        	it->setMissionAccomplished(accomplished);
             it->end();
-        }
-    }
-    
+
+        }
+    }
+
     void Mission::setLivesWrapper(unsigned int amount)
     {
