Index: code/branches/resource2/data/CMakeLists.txt
===================================================================
--- code/branches/resource2/data/CMakeLists.txt	(revision 5646)
+++ code/branches/resource2/data/CMakeLists.txt	(revision 5646)
@@ -0,0 +1,65 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        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
+ #  Description:
+ #    Finds the external data directory and configures the data installation.
+ #    Default search paths are: ../../data and ../data_extern
+ #
+
+# For dev runs we've got two data directory. The one from the other repository root folder
+# is called EXTERNAL_DATA
+SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
+
+# Specify data directory
+GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../${DEFAULT_DATA_PATH} ABSOLUTE)
+FIND_PATH(EXTERNAL_DATA_DIRECTORY resources.oxr
+  PATHS
+    ${CMAKE_SOURCE_DIR}/data_extern
+    ${_search_path_1}
+  NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
+)
+
+IF(NOT EXTERNAL_DATA_DIRECTORY)
+  MESSAGE(STATUS "Warning: External data directory not found. If you want to compile while downloading the data files, you will have to recompile about four files afterwards and relink everything. \\n You can specify your own folder with the DATA_DIRECTORY variable. Default location for the path is orxonox_root/data_extern")
+  # Temporary override to the default location.
+  SET(EXTERNAL_DATA_DIRECTORY ${CMAKE_SOURCE_DIR}/data_extern)
+ENDIF()
+
+
+################ Installation #################
+
+# Internal directory
+INSTALL(
+  DIRECTORY ${DATA_DIRECTORY}/
+  DESTINATION ${DATA_INSTALL_DIRECTORY}
+  REGEX "\\.svn$|_svn$|CMakeLists.txt|InstallScript.cmake" EXCLUDE
+)
+# External directory
+INSTALL(
+  DIRECTORY ${EXTERNAL_DATA_DIRECTORY}/
+  DESTINATION ${DATA_INSTALL_DIRECTORY}
+  REGEX "\\.svn$|_svn$|resources\\.oxr" EXCLUDE
+)
+# Configure the install scripts (variables not available during installation)
+CONFIGURE_FILE(DataInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake @ONLY)
+# Join both resources.oxr files
+INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake)
Index: code/branches/resource2/data/DataInstallScript.cmake
===================================================================
--- code/branches/resource2/data/DataInstallScript.cmake	(revision 5646)
+++ code/branches/resource2/data/DataInstallScript.cmake	(revision 5646)
@@ -0,0 +1,37 @@
+ #
+ #             ORXONOX - the hottest 3D action shooter ever to exist
+ #                             > www.orxonox.net <
+ #
+ #        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
+ #  Description:
+ #    Joins both resources.oxr files together
+ #  Caution:
+ #    Variables are declared with @...@ because they don't exist anymore
+ #    during the installation. But we still require variables (_external_file)
+ #    so we can only replace @...@ but not ${...}
+ #
+
+# Write some comment
+FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr "\n\n\n <!-- ---------------------------------------- -->")
+FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr     "\n <!-- Content from the external data directory -->")
+FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr     "\n <!-- ---------------------------------------- -->\n\n")
+
+# Append the external file
+FILE(READ   @EXTERNAL_DATA_DIRECTORY@/resources.oxr _external_file)
+FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr ${_external_file})
Index: code/branches/resource2/data/defaultConfig/keybindings.ini
===================================================================
--- code/branches/resource2/data/defaultConfig/keybindings.ini	(revision 5646)
+++ code/branches/resource2/data/defaultConfig/keybindings.ini	(revision 5646)
@@ -0,0 +1,173 @@
+[Keys]
+KeyA="scale -1 moveRightLeft"
+KeyABNT_C1=
+KeyABNT_C2=
+KeyAT=
+KeyAX=
+KeyApostrophe=
+KeyApps=
+KeyB=
+KeyBack=
+KeyBackslash=
+KeyC=switchCamera
+KeyCalculator=
+KeyCapsLock=
+KeyColon=
+KeyComma=
+KeyConvert=
+KeyD="scale 1 moveRightLeft"
+KeyDelete="scale 1 rotateRoll"
+KeyDivide=
+KeyDown="scale -1 moveFrontBack"
+KeyE="scale -1 rotateRoll"
+KeyEnd=boost
+KeyEquals=
+KeyEscape="exit"
+KeyF="scale -1 moveUpDown"
+KeyF1=
+KeyF10=
+KeyF11=
+KeyF12=
+KeyF13=
+KeyF14=
+KeyF15=
+KeyF2="OverlayGroup toggleVisibility Stats"
+KeyF3=
+KeyF4=
+KeyF5=
+KeyF6=
+KeyF7=
+KeyF8=
+KeyF9=
+KeyG=greet
+KeyGrave=
+KeyH=
+KeyHome=showGUI
+KeyI=
+KeyInsert=
+KeyJ=
+KeyK=
+KeyKana=
+KeyKanji=
+KeyL=dropItems
+KeyLeft="scale -1 moveRightLeft"
+KeyLeftAlt=
+KeyLeftBracket=
+KeyLeftControl=mouseLook
+KeyLeftShift=
+KeyLeftWindows=
+KeyLessThan=
+KeyM=openMap
+KeyMail=
+KeyMediaSelect=
+KeyMediaStop=
+KeyMinus=
+KeyMultiply=
+KeyMute=
+KeyMyComputer=
+KeyN=
+KeyNextTrack=
+KeyNoConvert=
+KeyNumLock=
+KeyNumRow0=
+KeyNumRow1=
+KeyNumRow2=
+KeyNumRow3=
+KeyNumRow4=
+KeyNumRow5=
+KeyNumRow6=
+KeyNumRow7=
+KeyNumRow8=
+KeyNumRow9=
+KeyNumpad0=
+KeyNumpad1=
+KeyNumpad2=
+KeyNumpad3=
+KeyNumpad4=
+KeyNumpad5=
+KeyNumpad6=
+KeyNumpad7=
+KeyNumpad8=
+KeyNumpad9=
+KeyNumpadAdd=
+KeyNumpadComma=
+KeyNumpadEnter=
+KeyNumpadEquals=
+KeyNumpadPeriod=
+KeyNumpadSubtract=
+KeyO=
+KeyP=
+KeyPageDown="scale -1 rotateRoll"
+KeyPageUp=
+KeyPause=pause
+KeyPeriod=
+KeyPlayPause=
+KeyPower=
+KeyPreviousTrack=
+KeyQ="scale 1 rotateRoll"
+KeyR="scale 1 moveUpDown"
+KeyReturn=
+KeyRight="scale 1 moveRightLeft"
+KeyRightAlt=
+KeyRightBracket=
+KeyRightControl="scale -1 moveUpDown"
+KeyRightShift="scale 1 moveUpDown"
+KeyRightWindows=
+KeyS="scale -1 moveFrontBack"
+KeyScrollLock=
+KeySemicolon=
+KeySlash=
+KeySleep=
+KeySpace=boost
+KeyStop=
+KeySystemRequest=
+KeyT=
+KeyTab="cycleNavigationFocus"
+KeyU=
+KeyUP="scale 1 moveFrontBack"
+KeyUnassigned=
+KeyUnderline=
+KeyUnlabeled=
+KeyV=
+KeyVolumeDown=
+KeyVolumeUp=
+KeyW="scale 1 moveFrontBack"
+KeyWake=
+KeyWebBack=
+KeyWebFavorites=
+KeyWebForward=
+KeyWebHome=
+KeyWebRefresh=
+KeyWebSearch=
+KeyWebStop=
+KeyX=
+KeyY=
+KeyYen=
+KeyZ=
+
+[MouseButtons]
+MouseButton3=
+MouseButton4=
+MouseButton5=
+MouseButton6=
+MouseButton7=
+MouseLeft="fire 0"
+MouseMiddle=
+MouseRight="fire 1"
+MouseWheel1Down=
+MouseWheel1Up=
+MouseWheel2Down=
+MouseWheel2Up=
+Left="fire 0"
+Right="fire 1"
+
+[MouseAxes]
+MouseXNeg="scale 1 rotateYaw"
+MouseXPos="scale -1 rotateYaw"
+MouseYNeg="scale -1 rotatePitch"
+MouseYPos="scale 1 rotatePitch"
+XNeg="scale 1 rotateYaw"
+XPos="scale -1 rotateYaw"
+YNeg="scale -1 rotatePitch"
+YPos="scale 1 rotatePitch"
+
Index: code/branches/resource2/data/defaultConfig/masterKeybindings.ini
===================================================================
--- code/branches/resource2/data/defaultConfig/masterKeybindings.ini	(revision 5646)
+++ code/branches/resource2/data/defaultConfig/masterKeybindings.ini	(revision 5646)
@@ -0,0 +1,167 @@
+[Keys]
+KeyA=
+KeyABNT_C1=
+KeyABNT_C2=
+KeyAT=
+KeyAX=
+KeyApostrophe=
+KeyApps=
+KeyB=
+KeyBack=
+KeyBackslash=
+KeyC=
+KeyCalculator=
+KeyCapsLock=
+KeyColon=
+KeyComma=
+KeyConvert=
+KeyD=
+KeyDelete=
+KeyDivide=
+KeyDown=
+KeyE=
+KeyEnd=
+KeyEquals=
+KeyEscape=
+KeyF=
+KeyF1="OverlayGroup toggleVisibility Debug"
+KeyF10=
+KeyF11=
+KeyF12=
+KeyF13=
+KeyF14=
+KeyF15=
+KeyF2=
+KeyF3=
+KeyF4=
+KeyF5=
+KeyF6=
+KeyF7=
+KeyF8=
+KeyF9=
+KeyG=
+KeyGrave="openConsole"
+KeyH=
+KeyHome=
+KeyI=
+KeyInsert=
+KeyJ=
+KeyK=
+KeyKana=
+KeyKanji=
+KeyL=
+KeyLeft=
+KeyLeftAlt=
+KeyLeftBracket=
+KeyLeftControl=
+KeyLeftShift=
+KeyLeftWindows=
+KeyLessThan=
+KeyM=
+KeyMail=
+KeyMediaSelect=
+KeyMediaStop=
+KeyMinus=
+KeyMultiply=
+KeyMute=
+KeyMyComputer=
+KeyN=
+KeyNextTrack=
+KeyNoConvert=
+KeyNumLock=
+KeyNumRow0=
+KeyNumRow1=
+KeyNumRow2=
+KeyNumRow3=
+KeyNumRow4=
+KeyNumRow5=
+KeyNumRow6=
+KeyNumRow7=
+KeyNumRow8=
+KeyNumRow9=
+KeyNumpad0=
+KeyNumpad1=
+KeyNumpad2=
+KeyNumpad3=
+KeyNumpad4=
+KeyNumpad5=
+KeyNumpad6=
+KeyNumpad7=
+KeyNumpad8=
+KeyNumpad9=
+KeyNumpadAdd=
+KeyNumpadComma=
+KeyNumpadEnter=
+KeyNumpadEquals=
+KeyNumpadPeriod=
+KeyNumpadSubtract=
+KeyO=
+KeyP=
+KeyPageDown=
+KeyPageUp=
+KeyPause=
+KeyPeriod=
+KeyPlayPause=
+KeyPower=
+KeyPreviousTrack=
+KeyQ=
+KeyR=
+KeyReturn=
+KeyRight=
+KeyRightAlt=
+KeyRightBracket=
+KeyRightControl=
+KeyRightShift=
+KeyRightWindows=
+KeyS=
+KeyScrollLock=
+KeySemicolon=
+KeySlash=
+KeySleep=
+KeySpace=
+KeyStop=
+KeySystemRequest=
+KeyT=
+KeyTab=
+KeyU=
+KeyUP=
+KeyUnassigned="openConsole"
+KeyUnderline=
+KeyUnlabeled=
+KeyV=
+KeyVolumeDown=
+KeyVolumeUp=
+KeyW=
+KeyWake=
+KeyWebBack=
+KeyWebFavorites=
+KeyWebForward=
+KeyWebHome=
+KeyWebRefresh=
+KeyWebSearch=
+KeyWebStop=
+KeyX=
+KeyY=
+KeyYen=
+KeyZ=
+
+[MouseButtons]
+MouseButton3=
+MouseButton4=
+MouseButton5=
+MouseButton6=
+MouseButton7=
+MouseLeft=
+MouseMiddle=
+MouseRight=
+MouseWheel1Down=
+MouseWheel1Up=
+MouseWheel2Down=
+MouseWheel2Up=
+
+[MouseAxes]
+MouseXNeg=
+MouseXPos=
+MouseYNeg=
+MouseYPos=
+
Index: code/branches/resource2/data/gui/configs/CEGUIConfig.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/CEGUIConfig.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/CEGUIConfig.xsd	(revision 5646)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="CEGUIConfig" type="CEGUIConfigType"/>
+
+    <xsd:simpleType name="LogLevel">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Errors"/>
+            <xsd:enumeration value="Standard"/>
+            <xsd:enumeration value="Informative"/>
+            <xsd:enumeration value="Insane"/>
+        </xsd:restriction>
+    </xsd:simpleType>
+    
+	<xsd:complexType name="CEGUIConfigType">
+		<xsd:attribute name="Logfile" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="Scheme" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="DefaultFont" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="Layout" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="InitScript" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="TerminateScript" type="xsd:string" use="optional" default=""/>
+		<xsd:attribute name="DefaultResourceGroup" type="xsd:string" use="optional"  default="" />
+        <xsd:attribute name="LoggingLevel" type="LogLevel" use="optional"  default="Standard" />
+	</xsd:complexType>
+	
+</xsd:schema>
+
+
Index: code/branches/resource2/data/gui/configs/Falagard.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/Falagard.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/Falagard.xsd	(revision 5646)
@@ -0,0 +1,391 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Falagard" type="falagardSpecificationType" />
+	<xsd:complexType name="falagardSpecificationType">
+		<xsd:sequence>
+			<xsd:element name="WidgetLook" type="widgetLookType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="widgetLookType">
+		<xsd:sequence>
+            <xsd:element name="PropertyDefinition" type="propertyDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="PropertyLinkDefinition" type="propertyLinkDefinitionType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="NamedArea" type="namedAreaType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Child" type="widgetComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImagerySection" type="imagerySectionType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="StateImagery" type="stateType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="propertyDefinitionType">
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyLinkDefinitionType">
+        <xsd:attribute name="type" type="propertyTypeEnum" use="optional" default="Generic" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="widget" type="xsd:string" use="required" />
+        <xsd:attribute name="targetProperty" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="initialValue" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="layoutOnWrite" type="xsd:boolean" use="optional" default="false" />
+        <xsd:attribute name="redrawOnWrite" type="xsd:boolean" use="optional" default="false" />
+    </xsd:complexType>
+    <xsd:complexType name="namedAreaType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" />
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="stateType">
+		<xsd:sequence>
+			<xsd:element name="Layer" type="layerType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+        <xsd:attribute name="clipped" type="xsd:boolean" use="optional" default="true" />
+	</xsd:complexType>
+	<xsd:complexType name="layerType">
+		<xsd:sequence>
+			<xsd:element name="Section" type="sectionSpecType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="priority" type="xsd:integer" use="optional" default="0" />
+	</xsd:complexType>
+    <xsd:complexType name="sectionSpecType">
+        <xsd:choice  minOccurs="0" maxOccurs="1">
+            <xsd:element name="Colour" type="colourType" />
+            <xsd:element name="Colours" type="colourRectType" />
+            <xsd:element name="ColourProperty" type="settingByPropertyType" />
+            <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+        </xsd:choice>
+        <xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="section" type="xsd:string" use="required" />
+        <xsd:attribute name="controlProperty" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+	<xsd:complexType name="imagerySectionType">
+		<xsd:sequence>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:element name="FrameComponent" type="frameComponentType" minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="ImageryComponent" type="imageryComponentType" minOccurs="0" maxOccurs="unbounded" />
+            <xsd:element name="TextComponent" type="textComponentType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" />
+            <xsd:element name="Image" type="frameImageType" minOccurs="0" maxOccurs="9" />
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="textComponentType">
+        <xsd:sequence>
+            <xsd:element name="Area" type="componentAreaType" />
+            <xsd:element name="Text" type="textStringType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="TextProperty" type="textPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:element name="FontProperty" type="fontPropertyType" minOccurs="0" maxOccurs="1" />
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertTextFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzTextFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+        </xsd:sequence>
+    </xsd:complexType>
+	<xsd:complexType name="imageryComponentType">
+		<xsd:sequence>
+			<xsd:element name="Area" type="componentAreaType" />
+            <xsd:choice>
+                <xsd:element name="Image" type="imageType" />
+                <xsd:element name="ImageProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="Colour" type="colourType" />
+                <xsd:element name="Colours" type="colourRectType" />
+                <xsd:element name="ColourProperty" type="settingByPropertyType" />
+                <xsd:element name="ColourRectProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="VertFormat" type="vertFormatType" />
+                <xsd:element name="VertFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+            <xsd:choice  minOccurs="0" maxOccurs="1">
+                <xsd:element name="HorzFormat" type="horzFormatType" />
+                <xsd:element name="HorzFormatProperty" type="settingByPropertyType" />
+            </xsd:choice>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="widgetComponentType">
+		<xsd:sequence>
+			<xsd:element name="Area" type="componentAreaType" />
+			<xsd:element name="VertAlignment" type="vertAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="HorzAlignment" type="horzAlignmentType" minOccurs="0" maxOccurs="1" />
+			<xsd:element name="Property" type="propertyType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="type" type="xsd:string" use="required" />
+		<xsd:attribute name="nameSuffix" type="xsd:string" use="required" />
+		<xsd:attribute name="renderer" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="look" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+	<xsd:complexType name="horzFormatType">
+		<xsd:attribute name="type" type="horzFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertFormatType">
+		<xsd:attribute name="type" type="vertFormatEnum" use="required" />
+	</xsd:complexType>
+        <xsd:complexType name="horzTextFormatType">
+		<xsd:attribute name="type" type="horzTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertTextFormatType">
+		<xsd:attribute name="type" type="vertTextFormatEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="horzAlignmentType">
+		<xsd:attribute name="type" type="horzAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="vertAlignmentType">
+		<xsd:attribute name="type" type="vertAlignmentEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="propertyType">
+		<xsd:attribute name="name" type="xsd:string" use="required" />
+		<xsd:attribute name="value" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="imageType">
+		<xsd:attribute name="imageset" type="xsd:string" use="required" />
+		<xsd:attribute name="image" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="frameImageType">
+        <xsd:attribute name="type" type="frameImageComponentEnum" use="required" />
+        <xsd:attribute name="imageset" type="xsd:string" use="required" />
+        <xsd:attribute name="image" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="componentAreaType">
+        <xsd:choice>
+            <xsd:sequence>
+                <xsd:element name="Dim" type="dimensionType" minOccurs="4" maxOccurs="4" />
+            </xsd:sequence>
+            <xsd:element name="AreaProperty" type="settingByPropertyType" />
+        </xsd:choice>
+	</xsd:complexType>
+	<xsd:complexType name="dimensionType">
+		<xsd:choice>
+			<xsd:element name="UnifiedDim" type="unifiedDimType" />
+			<xsd:element name="AbsoluteDim" type="absoluteDimType" />
+			<xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+		</xsd:choice>
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="fontDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="type" type="fontMetricTypeEnum" use="required" />
+        <xsd:attribute name="padding" type="xsd:decimal" use="optional" default="0" />
+    </xsd:complexType>
+    <xsd:complexType name="propertyDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+        <xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="unifiedDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+		<xsd:attribute name="scale" type="xsd:decimal" use="optional" default="0" />
+		<xsd:attribute name="offset" type="xsd:integer" use="optional" default="0" />
+		<xsd:attribute name="type" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="absoluteDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+		<xsd:attribute name="value" type="xsd:decimal" use="optional" default="0" />
+	</xsd:complexType>
+	<xsd:complexType name="imageDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+		<xsd:attribute name="imageset" type="xsd:string" use="required" />
+		<xsd:attribute name="image" type="xsd:string" use="required" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="widgetDimType">
+        <xsd:sequence>
+            <xsd:element name="DimOperator" type="dimensionOperatorType" minOccurs="0" maxOccurs="1" />
+        </xsd:sequence>
+		<xsd:attribute name="widget" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="dimension" type="dimensionTypeEnum" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="settingByPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+	<xsd:complexType name="colourRectType">
+		<xsd:attribute name="topLeft" type="colourValType" use="required" />
+		<xsd:attribute name="topRight" type="colourValType" use="required" />
+		<xsd:attribute name="bottomLeft" type="colourValType" use="required" />
+		<xsd:attribute name="bottomRight" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="colourType">
+		<xsd:attribute name="colour" type="colourValType" use="required" />
+	</xsd:complexType>
+	<xsd:simpleType name="colourValType">
+		<xsd:restriction base="xsd:string">
+			<xsd:pattern value="[a-fA-F0-9]{8}" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:complexType name="textStringType">
+        <xsd:attribute name="string" type="xsd:string" use="optional" default="" />
+        <xsd:attribute name="font" type="xsd:string" use="optional" default="" />
+    </xsd:complexType>
+    <xsd:complexType name="textPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="fontPropertyType">
+        <xsd:attribute name="name" type="xsd:string" use="required" />
+    </xsd:complexType>
+    <xsd:complexType name="dimensionOperatorType">
+        <xsd:choice>
+            <xsd:element name="UnifiedDim" type="unifiedDimType" />
+            <xsd:element name="AbsoluteDim" type="absoluteDimType" />
+            <xsd:element name="ImageDim" type="imageDimType" />
+            <xsd:element name="WidgetDim" type="widgetDimType" />
+            <xsd:element name="FontDim" type="fontDimType" />
+            <xsd:element name="PropertyDim" type="propertyDimType" />
+        </xsd:choice>
+        <xsd:attribute name="op" type="dimensionOperatorEnum" use="required" />
+    </xsd:complexType>
+	<xsd:simpleType name="dimensionTypeEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftEdge" />
+			<xsd:enumeration value="TopEdge" />
+			<xsd:enumeration value="RightEdge" />
+			<xsd:enumeration value="BottomEdge" />
+			<xsd:enumeration value="XPosition" />
+			<xsd:enumeration value="YPosition" />
+			<xsd:enumeration value="Width" />
+			<xsd:enumeration value="Height" />
+			<xsd:enumeration value="XOffset" />
+			<xsd:enumeration value="YOffset" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzFormatEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+			<xsd:enumeration value="Stretched" />
+			<xsd:enumeration value="Tiled" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="vertAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="TopAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="BottomAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+	<xsd:simpleType name="horzAlignmentEnum">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="LeftAligned" />
+			<xsd:enumeration value="CentreAligned" />
+			<xsd:enumeration value="RightAligned" />
+		</xsd:restriction>
+	</xsd:simpleType>
+    <xsd:simpleType name="horzTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LeftAligned" />
+            <xsd:enumeration value="RightAligned" />
+            <xsd:enumeration value="CentreAligned" />
+            <xsd:enumeration value="Justified" />
+            <xsd:enumeration value="WordWrapLeftAligned" />
+            <xsd:enumeration value="WordWrapRightAligned" />
+            <xsd:enumeration value="WordWrapCentreAligned" />
+            <xsd:enumeration value="WordWrapJustified" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="vertTextFormatEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="TopAligned" />
+            <xsd:enumeration value="BottomAligned" />
+            <xsd:enumeration value="CentreAligned" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="propertyTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Generic" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="fontMetricTypeEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="LineSpacing" />
+            <xsd:enumeration value="Baseline" />
+            <xsd:enumeration value="HorzExtent" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="dimensionOperatorEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Noop" />
+            <xsd:enumeration value="Add" />
+            <xsd:enumeration value="Subtract" />
+            <xsd:enumeration value="Multiply" />
+            <xsd:enumeration value="Divide" />
+        </xsd:restriction>
+    </xsd:simpleType>
+    <xsd:simpleType name="frameImageComponentEnum">
+        <xsd:restriction base="xsd:string">
+            <xsd:enumeration value="Background" />
+            <xsd:enumeration value="TopLeftCorner" />
+            <xsd:enumeration value="TopRightCorner" />
+            <xsd:enumeration value="BottomLeftCorner" />
+            <xsd:enumeration value="BottomRightCorner" />
+            <xsd:enumeration value="LeftEdge" />
+            <xsd:enumeration value="RightEdge" />
+            <xsd:enumeration value="TopEdge" />
+            <xsd:enumeration value="BottomEdge" />
+        </xsd:restriction>
+    </xsd:simpleType>
+</xsd:schema>
Index: code/branches/resource2/data/gui/configs/Font.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/Font.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/Font.xsd	(revision 5646)
@@ -0,0 +1,34 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="Font" type="FontType" />
+
+	<xsd:complexType name="FontType">
+		<xsd:sequence>
+			<xsd:element name="Mapping" type="MapType" maxOccurs="unbounded" minOccurs="0" />
+		</xsd:sequence>
+		<xsd:attributeGroup ref="FontAttrs" />
+	</xsd:complexType>
+	<xsd:complexType name="MapType">
+		<xsd:attribute name="Codepoint" type="xsd:nonNegativeInteger" use="required" />
+		<xsd:attribute name="Image" type="xsd:string" use="required" />
+		<xsd:attribute name="HorzAdvance" type="xsd:integer" use="optional" default="-1" />
+	</xsd:complexType>
+	<xsd:attributeGroup name="FontAttrs">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="Type" use="required">
+			<xsd:simpleType>
+				<xsd:restriction base="xsd:string">
+					<xsd:enumeration value="FreeType" />
+					<xsd:enumeration value="Pixmap" />
+				</xsd:restriction>
+			</xsd:simpleType>
+		</xsd:attribute>
+		<xsd:attribute name="Size" type="xsd:nonNegativeInteger" use="optional" default="12" />
+		<xsd:attribute name="NativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="NativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="AutoScaled" type="xsd:boolean" use="optional" default="false" />
+		<xsd:attribute name="AntiAlias" type="xsd:boolean" use="optional" default="true" />
+	</xsd:attributeGroup>
+</xsd:schema>
Index: code/branches/resource2/data/gui/configs/GUILayout.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/GUILayout.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/GUILayout.xsd	(revision 5646)
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="GUILayout" type="GUILayoutType"/>
+	
+	<xsd:complexType name="GUILayoutType">
+		<xsd:sequence>
+			<xsd:element name="Window" type="WindowType" />
+		</xsd:sequence>
+		<xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/>
+	</xsd:complexType>
+	
+	<xsd:complexType name="WindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Type" type="xsd:string" use="required"/>
+		<xsd:attribute name="Name" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="AutoWindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="NameSuffix" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="PropertyType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="Name" type="xsd:string" use="required"/>
+				<xsd:attribute name="Value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+
+	<xsd:complexType name="LayoutImportType">
+		<xsd:attribute name="Filename" type="xsd:string" use="required"/>
+		<xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="EventType">
+		<xsd:attribute name="Name" type="xsd:string" use="required"/>
+		<xsd:attribute name="Function" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+</xsd:schema>
+
Index: code/branches/resource2/data/gui/configs/GUIScheme.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/GUIScheme.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/GUIScheme.xsd	(revision 5646)
@@ -0,0 +1,54 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="GUIScheme" type="SchemeType" />
+	<xsd:complexType name="SchemeType">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+			<xsd:element name="Imageset" type="NamedDataType" />
+            <xsd:element name="ImagesetFromImage" type="NamedDataType" />
+			<xsd:element name="Font" type="NamedDataType" />
+            <xsd:element name="LookNFeel" type="FileDataType" />
+			<xsd:element name="WindowSet" type="WindowSetType" />
+			<xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
+			<xsd:element name="WindowAlias" type="WindowAliasType" />
+            <xsd:element name="FalagardMapping" type="FalagardMapType" />
+		</xsd:choice>
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FileDataType">
+        <xsd:attribute name="Filename" type="xsd:string" use="required" />
+        <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+    </xsd:complexType>
+	<xsd:complexType name="NamedDataType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowFactoryType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererFactoryType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowAliasType">
+		<xsd:attribute name="Alias" type="xsd:string" use="required" />
+		<xsd:attribute name="Target" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FalagardMapType">
+        <xsd:attribute name="WindowType" type="xsd:string" use="required" />
+        <xsd:attribute name="TargetType" type="xsd:string" use="required" />
+		<xsd:attribute name="Renderer" type="xsd:string" use="required" />
+        <xsd:attribute name="LookNFeel" type="xsd:string" use="required" />
+    </xsd:complexType>
+</xsd:schema>
Index: code/branches/resource2/data/gui/configs/Imageset.xsd
===================================================================
--- code/branches/resource2/data/gui/configs/Imageset.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/configs/Imageset.xsd	(revision 5646)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="Imageset" type="ImagesetType"/>
+	
+	<xsd:complexType name="ImagesetType">
+		<xsd:sequence>
+			<xsd:element name="Image" type="ImageType" maxOccurs="unbounded"/>
+		</xsd:sequence>
+		<xsd:attribute name="Imagefile" type="xsd:string" use="required"/>
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+		<xsd:attribute name="Name" type="xsd:string" use="required"/>
+		<xsd:attribute name="NativeHorzRes" type="xsd:nonNegativeInteger" use="optional" default="640" />
+		<xsd:attribute name="NativeVertRes" type="xsd:nonNegativeInteger" use="optional" default="480" />
+		<xsd:attribute name="AutoScaled" type="xsd:boolean" use="optional" default="false" />
+	</xsd:complexType>
+	
+	<xsd:complexType name="ImageType">
+		<xsd:attribute name="Name" type="xsd:string" use="required"/>
+		<xsd:attribute name="XPos" type="xsd:nonNegativeInteger" use="required"/>
+		<xsd:attribute name="YPos" type="xsd:nonNegativeInteger" use="required"/>
+		<xsd:attribute name="Width" type="xsd:nonNegativeInteger" use="required"/>
+		<xsd:attribute name="Height" type="xsd:nonNegativeInteger" use="required"/>
+		<xsd:attribute name="XOffset" type="xsd:integer" use="optional" default="0"/>
+		<xsd:attribute name="YOffset" type="xsd:integer" use="optional" default="0"/>						
+	</xsd:complexType>
+
+</xsd:schema>
Index: code/branches/resource2/data/gui/layouts/CompositorDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/CompositorDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/CompositorDemo.layout	(revision 5646)
@@ -0,0 +1,182 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="root">
+
+	<Window Type="DefaultGUISheet" Name="debug_overlay">
+		<Property Name="AlwaysOnTop" Value="True" />
+		<Property Name="Disabled" Value="True" />
+		
+		<Window Type="TaharezLook/StaticText" Name="Panel 1">
+			<Property Name="UnifiedPosition" Value="{{0,0},{0.83,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.23,0},{0.17,0}}" />
+			<Property Name="TopLeftFrameImage" Value="set:OgreGuiImagery image:BoxTopLeft" />
+			<Property Name="TopRightFrameImage" Value="set:OgreGuiImagery image:BoxTopRight" />
+			<Property Name="BottomLeftFrameImage" Value="set:OgreGuiImagery image:BoxBottomLeft" />
+			<Property Name="BottomRightFrameImage" Value="set:OgreGuiImagery image:BoxBottomRight" />
+			<Property Name="LeftFrameImage" Value="set:OgreGuiImagery image:BoxLeft" />
+			<Property Name="TopFrameImage" Value="set:OgreGuiImagery image:BoxTop" />
+			<Property Name="RightFrameImage" Value="set:OgreGuiImagery image:BoxRight" />
+			<Property Name="BottomFrameImage" Value="set:OgreGuiImagery image:BoxBottom" />
+			<Property Name="BackgroundImage" Value="set:OgreGuiImagery image:BoxBack" />
+			<Property Name="Alpha" Value="0.9" />
+			<Property Name="InheritsAlpha" Value="False" />
+	
+			<Window Type="TaharezLook/StaticText" Name="OPCurrentFPS">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="Font" Value="BlueHighway-10" />
+				<Property Name="UnifiedPosition" Value="{{0.075,0},{0.12,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.85,0},{0.25,0}}" />
+				<Property Name="TextColours" Value="tl:FF4FF06F tr:FF4FF06F bl:FF4FF06F br:FF4FF06F" />
+				<Property Name="HorzFormatting" Value="HorzCentred" />
+				<Property Name="Text" Value="Current FPS: " />
+			</Window>
+
+			<Window Type="TaharezLook/StaticImage" Name="OPBar1">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="UnifiedPosition" Value="{{0.2,0},{0.27,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.6,0},{0.025,0}}" />
+				<Property Name="Image" Value="set:OgreGuiImagery image:Bar" />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="OPAverageFPS">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="Font" Value="BlueHighway-10" />
+				<Property Name="UnifiedPosition" Value="{{0.075,0},{0.32,0}}" />
+				<Property Name="UnifiedSize" Value="{{1.0,0},{0.25,0}}" />
+				<Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+				<Property Name="Text" Value="Average FPS: " />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="OPWorstFPS">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="Font" Value="BlueHighway-10" />
+				<Property Name="UnifiedPosition" Value="{{0.075,0},{0.45,0}}" />
+				<Property Name="UnifiedSize" Value="{{1.0,0},{0.25,0}}" />
+				<Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+				<Property Name="Text" Value="Worst FPS: " />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="OPBestFPS">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="Font" Value="BlueHighway-10" />
+				<Property Name="UnifiedPosition" Value="{{0.075,0},{0.58,0}}" />
+				<Property Name="UnifiedSize" Value="{{1.0,0},{0.25,0}}" />
+				<Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+				<Property Name="Text" Value="Best FPS: " />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="OPTriCount">
+				<Property Name="FrameEnabled" Value="False" />
+				<Property Name="BackgroundEnabled" Value="False" />
+				<Property Name="Font" Value="BlueHighway-10" />
+				<Property Name="UnifiedPosition" Value="{{0.075,0},{0.71,0}}" />
+				<Property Name="UnifiedSize" Value="{{1.0,0},{0.25,0}}" />
+				<Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+				<Property Name="Text" Value="Triangle Count: " />
+			</Window>
+
+		</Window>
+
+		<Window Type="TaharezLook/StaticText" Name="OPDebugMsg">
+			<Property Name="FrameEnabled" Value="False" />
+			<Property Name="BackgroundEnabled" Value="False" />
+			<Property Name="Font" Value="BlueHighway-10" />
+			<Property Name="UnifiedPosition" Value="{{0.25,0},{0.93,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.65,0},{0.07,0}}" />
+			<Property Name="TextColours" Value="tl:A0FFFFFF tr:A0FFFFFF bl:A0FFFFFF br:A0FFFFFF" />
+			<Property Name="InheritsAlpha" Value="False" />
+			<Property Name="VertFormatting" Value="VertCentred" />
+			<Property Name="HorzFormatting" Value="WordWrapCentred" />
+		</Window>
+
+		<Window Type="TaharezLook/StaticImage" Name="OgreLogo">
+			<Property Name="FrameEnabled" Value="False" />
+			<Property Name="BackgroundEnabled" Value="False" />
+			<Property Name="UnifiedPosition" Value="{{0.9,0},{0.95,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.1,0},{0.05,0}}" />
+			<Property Name="Image" Value="set:OgreGuiImagery image:OgreLogo" />
+			<Property Name="Alpha" Value="0.75" />
+			<Property Name="InheritsAlpha" Value="False" />
+		</Window>
+
+		<Window Type="TaharezLook/StaticImage" Name="CeguiLogo">
+			<Property Name="FrameEnabled" Value="False" />
+			<Property Name="BackgroundEnabled" Value="False" />
+			<Property Name="UnifiedPosition" Value="{{0.9125,0},{0.9115,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.075,0},{0.0385,0}}" />
+			<Property Name="Image" Value="set:OgreGuiImagery image:CeguiLogo" />
+			<Property Name="Alpha" Value="0.75" />
+			<Property Name="InheritsAlpha" Value="False" />
+		</Window>
+
+	</Window>
+
+	<Window Type="DefaultGUISheet" Name="CompositorDemo">
+
+		<Property Name="UnifiedMaxSize" Value="{{1,0},{2,0}}" />
+		<Property Name="UnifiedSize" Value="{{1,0},{2,0}}" />
+
+
+		<Window Type="TaharezLook/StaticText" Name="HelpTxt">
+			<Property Name="UnifiedPosition" Value="{{0.6,0},{0.8,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0.5,0},{0.3,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.5,0},{0.3,0}}" />
+			<Property Name="Text" Value="Use the Combo boxes to select a shader and a model" />
+			<Property Name="InheritsAlpha" Value="False" />
+		</Window>
+		
+		<Window Type="TaharezLook/FrameWindow" Name="CompositorSelectorWin">
+			<Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0.16,0},{0.22,0}}" />
+			<Property Name="UnifiedMaxSize" Value="{{0.16,0},{0.75,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.16,0},{0.3,0}}" />
+			<Property Name="Text" Value="Compositors" />
+			<Property Name="Alpha" Value="0.75" />
+			<Property Name="CloseButtonEnabled" Value="False" />
+
+			<Window Type="TaharezLook/Button" Name="ExitDemoBtn">
+				<Property Name="VerticalAlignment" Value="Bottom" />
+				<Property Name="HorizontalAlignment" Value="Centre" />
+				<Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
+				<Property Name="UnifiedMaxSize" Value="{{0.12,0},{0.03,0}}" />
+				<Property Name="UnifiedMinSize" Value="{{0.12,0},{0.03,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.33,0},{0.03,0}}" />
+				<Property Name="Text" Value="Exit Demo" />
+				<Property Name="InheritsAlpha" Value="False" />
+			</Window>
+
+		</Window>
+		<Window Type="TaharezLook/FrameWindow" Name="DebugRTTs">
+			<Property Name="RollUpState" Value="True" />
+			<Property Name="UnifiedPosition" Value="{{0.70,0},{0,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0.3,0},{0.3,0}}" />
+			<Property Name="UnifiedMaxSize" Value="{{0.3,0},{0.3,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.3,0},{0.3,0}}" />
+			<Property Name="Text" Value="Debug RTTs" />
+			<Property Name="Alpha" Value="0.75" />
+			<Property Name="CloseButtonEnabled" Value="False" />
+
+			<Window Type="TaharezLook/Listbox" Name="DebugRTTListbox">
+				<Property Name="UnifiedPosition" Value="{{0.02,0},{0.1,0}}" />
+				<Property Name="UnifiedMinSize" Value="{{0.1,0},{0.25,0}}" />
+				<Property Name="UnifiedMaxSize" Value="{{0.1,0},{0.25,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.1,0},{0.25,0}}" />
+			</Window>
+			<Window Type="TaharezLook/StaticImage" Name="DebugRTTImage">
+				<Property Name="UnifiedPosition" Value="{{0.36,0},{0.1,0}}" />
+				<Property Name="UnifiedMinSize" Value="{{0.2,0},{0.25,0}}" />
+				<Property Name="UnifiedMaxSize" Value="{{0.2,0},{0.25,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.2,0},{0.25,0}}" />
+			</Window>
+		</Window>
+	</Window>
+
+
+</Window>
+
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/Console.wnd
===================================================================
--- code/branches/resource2/data/gui/layouts/Console.wnd	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/Console.wnd	(revision 5646)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+        <Window Type="TaharezLook/FrameWindow" Name="Console/Frame" >
+            <Property Name="Text" Value="Console" />
+            <Property Name="TitlebarFont" Value="DejaVuSans-10" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="TitlebarEnabled" Value="True" />
+            <Property Name="UnifiedAreaRect" Value="{{0.208832,0},{0.650387,0},{0.80736,0},{0.998062,0}}" />
+            <Window Type="TaharezLook/MultiLineEditbox" Name="Console/Frame/ConsoleText" >
+                <Property Name="Text" Value=""/>
+                <Property Name="ReadOnly" Value="True" />
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.019238,0},{0.156633,0},{0.973721,0},{0.839186,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Editbox" Name="Console/Frame/Input" >
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.019119,0},{0.842141,0},{0.972016,0},{0.980658,0}}" />
+            </Window>
+        </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/CrowdDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/CrowdDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/CrowdDemo.layout	(revision 5646)
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="root" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="DefaultWindow" Name="debug_overlay" >
+            <Property Name="Disabled" Value="True" />
+            <Property Name="AlwaysOnTop" Value="True" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+            <Window Type="TaharezLook/StaticText" Name="Panel 1" >
+                <Property Name="Alpha" Value="0.9" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0,0},{0.83,0},{0.23,0},{1,0}}" />
+                <Window Type="TaharezLook/StaticText" Name="OPCurrentFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Current FPS: " />
+                    <Property Name="TextColours" Value="tl:FF4FF06F tr:FF4FF06F bl:FF4FF06F br:FF4FF06F" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="HorzFormatting" Value="HorzCentred" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.12,0},{0.925,0},{0.37,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticImage" Name="OPBar1" >
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.27,0},{0.8,0},{0.295,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPAverageFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Average FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.32,0},{1.075,0},{0.57,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPWorstFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Worst FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.45,0},{1.075,0},{0.7,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPBestFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Best FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.58,0},{1.075,0},{0.83,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPTriCount" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Triangle Count: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.71,0},{1.075,0},{0.96,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="OPDebugMsg" >
+                <Property Name="Font" Value="BlueHighway-10" />
+                <Property Name="TextColours" Value="tl:A0FFFFFF tr:A0FFFFFF bl:A0FFFFFF br:A0FFFFFF" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.93,0},{0.9,0},{1,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="OgreLogo" >
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.9,0},{0.95,0},{1,0},{1,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="CeguiLogo" >
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.9125,0},{0.9115,0},{0.9875,0},{0.95,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+        </Window>
+        <Window Type="DefaultWindow" Name="InstancingDemo" >
+            <Property Name="Font" Value="BlueHighway-8" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+            <Window Type="TaharezLook/FrameWindow" Name="CompositorSelectorWin" >
+                <Property Name="Text" Value="Techniques" />
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="TitlebarFont" Value="BlueHighway-12" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="TitlebarEnabled" Value="True" />
+                <Property Name="UnifiedAreaRect" Value="{{-0.00292969,0},{0.00381679,1.25081e-037},{0.331094,0},{0.464121,1.25081e-037}}" />
+                <Property Name="CloseButtonEnabled" Value="False" />
+                <Window Type="TaharezLook/RadioButton" Name="tInstancing" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Instancing" />
+                    <Property Name="Selected" Value="True" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.055847,0},{0.10764,0},{0.973986,0},{0.187074,0}}" />
+                </Window>
+                <Window Type="TaharezLook/RadioButton" Name="tIndependantEntities" >
+                    <Property Name="ID" Value="1" />
+                    <Property Name="Font" Value="BlueHighway-12" />
+					<Property Name="Text" Value="Independent Entities" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.055847,0},{0.172136,0},{0.962291,0},{0.265333,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Checkbox" Name="Shadows" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Shadows on/off" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.475788,0},{1.05,0},{0.579744,0}}" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Object Count Text" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Object Count:" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0880073,0},{0.263737,0},{0.382815,0},{0.369793,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Object Count Number" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="160" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.388902,0},{0.277557,0},{0.631087,0},{0.364265,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Object Count" >
+                    <Property Name="PageSize" Value="0" />
+                    <Property Name="StepSize" Value="1" />
+                    <Property Name="OverlapSize" Value="0" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.39,0},{0.95,0},{0.441213,0}}" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Time Burner Text" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="CPU occupation:" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.59802,0},{0.427339,0},{0.680451,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Time Burner Value" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="0 ms" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.415811,0},{0.599679,0},{0.640395,0},{0.686178,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Time Burner" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="PageSize" Value="0" />
+                    <Property Name="StepSize" Value="1" />
+                    <Property Name="OverlapSize" Value="0" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.687236,0},{0.95,0},{0.74726,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Checkbox" Name="PostEffect" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Post Effect On/Off" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0470764,0},{0.765568,0},{0.892124,0},{0.82884,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Button" Name="ExitDemoBtn" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Exit Demo" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{-0.0526254,0},{-0.063219,0},{0.277375,0},{-4.06504e-005,0}}" />
+                    <Property Name="VerticalAlignment" Value="Bottom" />
+                    <Property Name="HorizontalAlignment" Value="Centre" />
+                </Window>
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/Demo7Windows.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/Demo7Windows.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/Demo7Windows.layout	(revision 5646)
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<GUILayout>
+    <Window Type="DefaultWindow" Name="root">
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="TaharezLook/FrameWindow" Name="Demo7/Window1" >
+            <Property Name="Text" Value="Demo 7 - Window 1" />
+            <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+            <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.2,0},{0.7,0},{0.7,0}}" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+            <Window Type="TaharezLook/Button" Name="Demo7/Window1/Quit" >
+                <Property Name="Text" Value="Exit Demo" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.1,0},{0.27,0},{0.2,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Demo7/Window1/Radio1" >
+                <Property Name="Text" Value="Option 1" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.23,0},{0.27,0},{0.305,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Demo7/Window1/Radio2" >
+                <Property Name="ID" Value="1" />
+                <Property Name="Text" Value="Option 2" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.306,0},{0.27,0},{0.381,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Demo7/Window1/Radio3" >
+                <Property Name="ID" Value="2" />
+                <Property Name="Text" Value="Option 3" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.382,0},{0.27,0},{0.457,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Checkbox" Name="Demo7/Window1/Checkbox" >
+                <Property Name="Text" Value="Enable some option" />
+                <Property Name="Selected" Value="True" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.48,0},{0.47,0},{0.555,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="Demo7/Window1/Text1" >
+                <Property Name="Text" Value="This is a re-creation of the original 'Demo7' preview application, it shows many of the CEGUI widgets." />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.1,0},{0.95,0},{0.6,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/Editbox" Name="Demo7/Window1/Editbox" >
+                <Property Name="Text" Value="Single-line editbox" />
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.6,0},{0.8,0},{0.7,0}}" />
+            </Window>
+            <Window Type="TaharezLook/LargeVerticalScrollbar" Name="Demo7/Window1/Scrollbar1" >
+                <Property Name="PageSize" Value="0" />
+                <Property Name="StepSize" Value="1" />
+                <Property Name="OverlapSize" Value="0" />
+                <Property Name="DocumentSize" Value="1" />
+                <Property Name="ScrollPosition" Value="0" />
+                <Property Name="UnifiedMaxSize" Value="{{0.03,0},{1,0}}" />
+                <Property Name="UnifiedMinSize" Value="{{0.01,0},{0.1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.06,0},{0.6,0},{0.12,0},{0.98,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Slider" Name="Demo7/Window1/Slider1" >
+                <Property Name="CurrentValue" Value="1" />
+                <Property Name="MaximumValue" Value="1" />
+                <Property Name="ClickStepSize" Value="0.01" />
+                <Property Name="UnifiedMaxSize" Value="{{0.03,0},{1,0}}" />
+                <Property Name="UnifiedMinSize" Value="{{0.01,0},{0.1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.9,0},{0.625,0},{0.93,0},{0.905,0}}" />
+            </Window>
+        </Window>
+        <Window Type="TaharezLook/FrameWindow" Name="Demo7/Window2" >
+            <Property Name="Text" Value="Demo 7 - Window 2" />
+            <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+            <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.1,0},{0.9,0},{0.7,0}}" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+            <Window Type="TaharezLook/ProgressBar" Name="Demo7/Window2/Progbar1" >
+                <Property Name="StepSize" Value="0.01" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="CurrentProgress" Value="0.33" />
+                <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.1,0},{0.98,0},{0.15,0}}" />
+            </Window>
+            <Window Type="TaharezLook/AlternateProgressBar" Name="Demo7/Window2/Progbar2" >
+                <Property Name="StepSize" Value="0.01" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="CurrentProgress" Value="0.7" />
+                <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.16,0},{0.98,0},{0.21,0}}" />
+            </Window>
+            <Window Type="TaharezLook/ItemListbox" Name="Demo7/Window2/Listbox" >
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.25,0},{0.46,0},{0.55,0}}" />
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 1" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 2" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 3" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 4" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 5" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 6" />
+                </Window>
+                <Window Type="TaharezLook/ListboxItem" >
+                    <Property Name="Text" Value="Listbox Item 7" />
+                </Window>
+            </Window>
+            <Window Type="TaharezLook/Combobox" Name="Demo7/Window2/Combobox" >
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.25,0},{0.92,0},{0.7,0}}" />
+                <Property Name="MaxEditTextLength" Value="1073741823" />
+            </Window>
+            <Window Type="TaharezLook/MultiColumnList" Name="Demo7/Window2/MultiColumnList" >
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.98,0}}" />
+                <Property Name="ColumnHeader" Value="text:Server Name width:{0.33,0} id:0" />
+                <Property Name="ColumnHeader" Value="text:Address width:{0.5,0} id:1" />
+                <Property Name="ColumnHeader" Value="text:Ping width:{0.2,0} id:2" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="Demo7/Window2/Image1" >
+                <Property Name="Image" Value="set:BackgroundImage image:full_image" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.56,0},{0.35,0},{0.86,0},{0.55,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+        </Window>
+        <Window Type="TaharezLook/FrameWindow" Name="Demo7/Window3" >
+            <Property Name="Text" Value="Demo 7 - Window 3" />
+            <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+            <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.4,0},{0.75,0},{0.9,0}}" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+            <Window Type="TaharezLook/MultiLineEditbox" Name="Demo7/Window3/MLEditbox" >
+                <Property Name="Text">This text is a multiline text:
+Line 1
+Line 2 
+Line 3</Property>
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.1,0},{0.98,0},{0.95,0}}" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/Demo8.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/Demo8.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/Demo8.layout	(revision 5646)
@@ -0,0 +1,132 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="root">
+    <Window Type="DefaultGUISheet" Name="Demo8">
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{2,0}}" />
+        <Property Name="UnifiedSize" Value="{{1,0},{2,0}}" />
+
+        <Window Type="TaharezLook/LargeVerticalScrollbar" Name="Demo8/ViewScroll">
+            <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
+            <Property Name="UnifiedSize" Value="{{0.03,0},{0.75,0}}" />
+            <Property Name="DocumentSize" Value="2" />
+            <Property Name="PageSize" Value="1" />
+            <Property Name="StepSize" Value="0.01" />
+            <Property Name="OverlapSize" Value="0.5" />
+            <Property Name="Tooltip" Value="This scrollbar will scroll the window layout." />
+        </Window>
+
+        <Window Type="TaharezLook/FrameWindow" Name="Demo8/Window1">
+            <Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}" />
+            <Property Name="UnifiedMaxSize" Value="{{0.5,0},{1,0}}" />
+            <Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+            <Property Name="UnifiedSize" Value="{{0.4,0},{0.3,0}}" />
+            <Property Name="Text" Value="Demo 8 - Listbox Demo" />
+            <Property Name="Tooltip" Value="Window shows a simple Listbox demo." />
+
+            <Window Type="TaharezLook/Listbox" Name="Demo8/Window1/Listbox">
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.9,0},{0.33,0}}" />
+                <Property Name="Tooltip" Value="Listbox containing the items you have added." />
+            </Window>
+
+            <Window Type="TaharezLook/StaticText" Name="Demo8/Window1/Controls">
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.45,0}}" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.9,0},{0.5,0}}" />
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Red">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.05,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="PageSize" Value="0.0625" />
+                    <Property Name="StepSize" Value="0.00392" />
+                    <Property Name="OverlapSize" Value="0.00392" />
+                    <Property Name="Tooltip" Value="Slider to adjust the red colour component." />
+                </Window>
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Green">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.12,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="PageSize" Value="0.0625" />
+                    <Property Name="StepSize" Value="0.00392" />
+                    <Property Name="OverlapSize" Value="0.00392" />
+                    <Property Name="Tooltip" Value="Slider to adjust the green colour component." />
+                </Window>
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Blue">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.19,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="PageSize" Value="0.0625" />
+                    <Property Name="StepSize" Value="0.00392" />
+                    <Property Name="OverlapSize" Value="0.00392" />
+                    <Property Name="Tooltip" Value="Slider to adjust the blue colour component." />
+                </Window>
+
+                <Window Type="TaharezLook/StaticImage" Name="Demo8/Window1/Controls/ColourSample">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.26,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.9,0},{0.1,0}}" />
+                    <Property Name="Image" Value="set:TaharezLook image:MultiListSelectionBrush" />
+                    <Property Name="ImageColours" Value="tl:0 tr:0 bl:0 br:0" />
+                    <Property Name="Tooltip" Value="Shows a sample of the selected colour." />
+                </Window>
+
+                <Window Type="TaharezLook/Editbox" Name="Demo8/Window1/Controls/Editbox">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.38,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.6,0},{0.15,0}}" />
+                    <Property Name="Tooltip" Value="Enter the text for a new Listbox item here." />
+                </Window>
+
+                <Window Type="TaharezLook/Button" Name="Demo8/Window1/Controls/Add">
+                    <Property Name="UnifiedPosition" Value="{{0.68,0},{0.38,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.3,0},{0.15,0}}" />
+                    <Property Name="Text" Value="Add" />
+                    <Property Name="Tooltip" Value="Adds a new item to the Listbox." />
+                </Window>
+
+                <Window Type="TaharezLook/StaticText" Name="Demo8/Window1/Controls/ins1">
+                    <Property Name="UnifiedPosition" Value="{{0.05,0},{0.55,0}}" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.9,0},{0.4,0}}" />
+                    <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                    <Property Name="Text" Value="Use this panel to add items.  The scrollbars change the selection colour." />
+                    <Property Name="Tooltip" Value="Information panel." />
+                </Window>
+            </Window>
+        </Window>
+
+        <Window Type="TaharezLook/FrameWindow" Name="Demo8/Window2">
+            <Property Name="UnifiedPosition" Value="{{0.55,0},{0.1,0}}" />
+            <Property Name="UnifiedMaxSize" Value="{{0.5,0},{1,0}}" />
+            <Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+            <Property Name="UnifiedSize" Value="{{0.4,0},{0.3,0}}" />
+            <Property Name="Text" Value="Demo 8 - Information Window" />
+            <Property Name="Tooltip" Value="Contains some StaticText information panels" />
+
+            <Window Type="TaharezLook/StaticText" Name="Demo8/Window2/Info">
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.9,0},{0.3,0}}" />
+                <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                <Property Name="Text" Value="The panel below gives some information about the item under the mouse." />
+            </Window>
+    
+            <Window Type="TaharezLook/StaticText" Name="Demo8/Window2/Tips">
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.5,0}}" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.9,0},{0.4,0}}" />
+                <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                <Property Name="Text" Value="We removed this, and now use proper Tooltips instead!" />
+            </Window>
+        </Window>
+    </Window>
+</Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/DragDropDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/DragDropDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/DragDropDemo.layout	(revision 5646)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="Root" >
+
+        <Window Type="WindowsLook/FrameWindow" Name="Root/MainWindow" >
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.25,0},{0.75,0},{0.75,0}" />
+            <Property Name="Text" Value="Drag and Drop Demo" />
+            <Property Name="RollUpEnabled" Value="False" />
+            <Property Name="SizingEnabled" Value="False" />
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot1" >
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.13,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+
+                <Window Type="DragContainer" Name="DragContainer1" >
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.05,0},{0.95,0},{0.95,0}" />
+
+                    <Window Type="WindowsLook/StaticImage" Name="DragContainer1/Image" >
+                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}" />
+                        <Property Name="Image" Value="set:DriveIcons image:Lime" />
+                        <Property Name="MousePassThroughEnabled" Value="True" />
+                    </Window>
+
+                </Window>
+
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot2" >
+                <Property Name="UnifiedPosition" Value="{{0.28,0},{0.13,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot3" >
+                <Property Name="UnifiedPosition" Value="{{0.51,0},{0.13,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot4" >
+                <Property Name="UnifiedPosition" Value="{{0.74,0},{0.13,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot5" >
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.36,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot6" >
+                <Property Name="UnifiedPosition" Value="{{0.28,0},{0.36,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+
+                <Window Type="DragContainer" Name="DragContainer2" >
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.05,0},{0.95,0},{0.95,0}" />
+
+                    <Window Type="WindowsLook/StaticImage" Name="DragContainer2/Image" >
+                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}" />
+                        <Property Name="Image" Value="set:DriveIcons image:GlobalDrive" />
+                        <Property Name="MousePassThroughEnabled" Value="True" />
+                    </Window>
+
+                </Window>
+
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot7" >
+                <Property Name="UnifiedPosition" Value="{{0.51,0},{0.36,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot8" >
+                <Property Name="UnifiedPosition" Value="{{0.74,0},{0.36,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot9" >
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.59,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot10" >
+                <Property Name="UnifiedPosition" Value="{{0.28,0},{0.59,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot11" >
+                <Property Name="UnifiedPosition" Value="{{0.51,0},{0.59,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+            <Window Type="WindowsLook/Static" Name="Root/MainWindow/Slot12" >
+                <Property Name="UnifiedPosition" Value="{{0.74,0},{0.59,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.2,0},{0.2,0}}" />
+            </Window>
+
+        </Window>
+
+    </Window>
+</GUILayout>
+
Index: code/branches/resource2/data/gui/layouts/FontDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/FontDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/FontDemo.layout	(revision 5646)
@@ -0,0 +1,58 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="root">
+    <Window Type="TaharezLook/FrameWindow" Name="FontDemo/Window">
+        <Property Name="UnifiedPosition" Value="{{0.1,0},{0.1,0}}" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+        <Property Name="UnifiedSize" Value="{{0.8,0},{0.8,0}}" />
+        <Property Name="Text" Value="Font Demo" />
+        <Property Name="Tooltip" Value="This is a simple demonstration of what the font subsystem can do." />
+
+        <Window Type="TaharezLook/MultiLineEditbox" Name="FontDemo/FontSample">
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.75,0},{0.5,0}}" />
+            <Property Name="Tooltip" Value="This window shows a sample of the selected font" />
+			<Property Name="WordWrap" Value="True" />
+        </Window>
+
+        <Window Type="TaharezLook/Listbox" Name="FontDemo/LangList">
+            <Property Name="UnifiedAreaRect" Value="{{0.8,0},{0.1,0},{0.95,0},{0.5,0}}" />
+            <Property Name="Tooltip" Value="Contains a list of languages to select sample text from" />
+        </Window>
+
+        <Window Type="TaharezLook/Listbox" Name="FontDemo/FontList">
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.55,0},{0.45,0},{0.95,0}}" />
+            <Property Name="Tooltip" Value="This listbox shows a list of available fonts to experiment with" />
+        </Window>
+
+        <Window Type="TaharezLook/StaticText" Name="FontDemo/FontDesc" >
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="HorzFormatting" Value="WordWrapCentred" />
+            <Property Name="VertFormatting" Value="CentreAligned" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.55,0},{0.95,0},{0.65,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+        </Window>
+
+        <Window Type="TaharezLook/Checkbox" Name="FontDemo/AutoScaled" >
+            <Property Name="Text" Value="Auto scale font to current resolution" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.7,0},{0.95,0},{0.75,0}}" />
+            <Property Name="Tooltip" Value="Choose between autoscaled/non-autoscaled font versions" />
+        </Window>
+
+        <Window Type="TaharezLook/Checkbox" Name="FontDemo/Antialiased" >
+            <Property Name="Text" Value="Antialias the font for smoother look" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.8,0},{0.95,0},{0.85,0}}" />
+            <Property Name="Tooltip" Value="Choose between antialiased/non-antialiased font versions" />
+        </Window>
+
+        <Window Type="TaharezLook/HorizontalScrollbar" Name="FontDemo/PointSize" >
+            <Property Name="DocumentSize" Value="72" />
+            <Property Name="PageSize" Value="1" />
+            <Property Name="StepSize" Value="1" />
+            <Property Name="OverlapSize" Value="0" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.9,0},{0.95,0},{0.9,12}}" />
+            <Property Name="Tooltip" Value="Changes font point size" />
+        </Window>
+    </Window>
+</Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/GUILayout.xsd
===================================================================
--- code/branches/resource2/data/gui/layouts/GUILayout.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/GUILayout.xsd	(revision 5646)
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+
+	<xsd:element name="GUILayout" type="GUILayoutType"/>
+	
+	<xsd:complexType name="GUILayoutType">
+		<xsd:sequence>
+			<xsd:element name="Window" type="WindowType" />
+		</xsd:sequence>
+		<xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/>
+	</xsd:complexType>
+	
+	<xsd:complexType name="WindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Type" type="xsd:string" use="required"/>
+		<xsd:attribute name="Name" type="xsd:string" use="optional" default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="AutoWindowType">
+		<xsd:sequence>
+			<xsd:element name="LayoutImport" type="LayoutImportType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:element name="Event" type="EventType"  minOccurs="0" maxOccurs="unbounded" />
+			<xsd:choice minOccurs="0" maxOccurs="unbounded">
+				<xsd:element name="Window" type="WindowType" />
+				<xsd:element name="AutoWindow" type="AutoWindowType" />
+			</xsd:choice>
+			<xsd:element name="Property" type="PropertyType"  minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="NameSuffix" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="PropertyType">
+		<xsd:simpleContent>
+			<xsd:extension base="xsd:string">
+				<xsd:attribute name="Name" type="xsd:string" use="required"/>
+				<xsd:attribute name="Value" type="xsd:string" use="optional"/>
+			</xsd:extension>
+		</xsd:simpleContent> 
+	</xsd:complexType>
+
+	<xsd:complexType name="LayoutImportType">
+		<xsd:attribute name="Filename" type="xsd:string" use="required"/>
+		<xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" />
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+
+	<xsd:complexType name="EventType">
+		<xsd:attribute name="Name" type="xsd:string" use="required"/>
+		<xsd:attribute name="Function" type="xsd:string" use="required"/>
+	</xsd:complexType>
+
+</xsd:schema>
+
Index: code/branches/resource2/data/gui/layouts/InGameTest.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/InGameTest.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/InGameTest.layout	(revision 5646)
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="DefaultGUISheet" Name="orxonox/TestWindow">
+    <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
+
+        <Window Type="TaharezLook/Button" Name="orxonox/TestButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="NoFunction"/>
+        </Window>
+
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/InstancingDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/InstancingDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/InstancingDemo.layout	(revision 5646)
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="root" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="DefaultWindow" Name="debug_overlay" >
+            <Property Name="Disabled" Value="True" />
+            <Property Name="AlwaysOnTop" Value="True" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+            <Window Type="TaharezLook/StaticText" Name="Panel 1" >
+                <Property Name="Alpha" Value="0.9" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0,0},{0.83,0},{0.23,0},{1,0}}" />
+                <Window Type="TaharezLook/StaticText" Name="OPCurrentFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Current FPS: " />
+                    <Property Name="TextColours" Value="tl:FF4FF06F tr:FF4FF06F bl:FF4FF06F br:FF4FF06F" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="HorzFormatting" Value="HorzCentred" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.12,0},{0.925,0},{0.37,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticImage" Name="OPBar1" >
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.27,0},{0.8,0},{0.295,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPAverageFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Average FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.32,0},{1.075,0},{0.57,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPWorstFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Worst FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.45,0},{1.075,0},{0.7,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPBestFPS" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Best FPS: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.58,0},{1.075,0},{0.83,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="OPTriCount" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="Triangle Count: " />
+                    <Property Name="TextColours" Value="tl:FFFFF5F0 tr:FFFFF5F0 bl:FFFFF510 br:FFFFF5F0" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.075,0},{0.71,0},{1.075,0},{0.96,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="OPDebugMsg" >
+                <Property Name="Font" Value="BlueHighway-10" />
+                <Property Name="TextColours" Value="tl:A0FFFFFF tr:A0FFFFFF bl:A0FFFFFF br:A0FFFFFF" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="HorzFormatting" Value="WordWrapCentred" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.93,0},{0.9,0},{1,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="OgreLogo" >
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.9,0},{0.95,0},{1,0},{1,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="CeguiLogo" >
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.9125,0},{0.9115,0},{0.9875,0},{0.95,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+        </Window>
+        <Window Type="DefaultWindow" Name="InstancingDemo" >
+            <Property Name="Font" Value="BlueHighway-12" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{2,0}}" />
+            <Window Type="TaharezLook/FrameWindow" Name="CompositorSelectorWin" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Techniques" />
+                <Property Name="Alpha" Value="0.75" />
+                <Property Name="TitlebarFont" Value="BlueHighway-12" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="TitlebarEnabled" Value="True" />
+                <Property Name="UnifiedAreaRect" Value="{{0,0},{0.00508906,0},{0.237344,0},{0.487022,0}}" />
+                <Property Name="CloseButtonEnabled" Value="False" />
+                <Window Type="TaharezLook/RadioButton" Name="tInstancing" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Instancing" />
+                    <Property Name="Selected" Value="True" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.0592397,0},{1.05,0},{0.140919,0}}" />
+                </Window>
+                <Window Type="TaharezLook/RadioButton" Name="tStaticGeometry" >
+                    <Property Name="ID" Value="1" />
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Static Geometry" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.118479,0},{1.05,0},{0.198839,0}}" />
+                </Window>
+                <Window Type="TaharezLook/RadioButton" Name="tIndependantEntities" >
+                    <Property Name="ID" Value="2" />
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Independant Entities" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.180359,0},{1.05,0},{0.260718,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Checkbox" Name="Shadows" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Shadows on/off" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.458078,0},{1.05,0},{0.545613,0}}" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Object Count Text" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Object Count:" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0458855,0},{0.242239,0},{0.480053,0},{0.324677,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Object Count Number" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="160" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.475313,0},{0.245588,0},{0.679954,0},{0.327894,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/Combobox" Name="Objects" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Choose an object" />
+                    <Property Name="ReadOnly" Value="True" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0541145,0},{0.561555,0},{0.954114,0},{0.821555,0}}" />
+                    <Property Name="MaxEditTextLength" Value="1073741823" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Object Count" >
+                    <Property Name="PageSize" Value="0" />
+                    <Property Name="StepSize" Value="1" />
+                    <Property Name="OverlapSize" Value="0" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.06,0},{0.33,0},{0.96,0},{0.382246,0}}" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Time Burner Text" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="CPU occupation:" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0664582,0},{0.650819,0},{0.571251,0},{0.750819,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Time Burner Value" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="0 ms" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.616458,0},{0.650819,0},{0.905365,0},{0.750819,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Time Burner" >
+                    <Property Name="PageSize" Value="0" />
+                    <Property Name="StepSize" Value="1" />
+                    <Property Name="OverlapSize" Value="0" />
+                    <Property Name="DocumentSize" Value="1" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.75,0},{0.962344,0},{0.804855,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Checkbox" Name="PostEffect" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Post Effect On/Off" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.813539,0},{0.918334,0},{0.895712,0}}" />
+                </Window>
+                <Window Type="TaharezLook/Button" Name="ExitDemoBtn" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Exit Demo" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{-0.0325521,0},{-0.0135575,0},{0.48346,0},{0.0739895,0}}" />
+                    <Property Name="VerticalAlignment" Value="Bottom" />
+                    <Property Name="HorizontalAlignment" Value="Centre" />
+                </Window>
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/MainMenu.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/MainMenu.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/MainMenu.layout	(revision 5646)
@@ -0,0 +1,47 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="TaharezLook/StaticImage" Name="orxonox/Background">
+    <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
+    <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
+    <Property Name="FrameEnabled" Value="set:true"/>
+    <Property Name="BackgroundEnabled" Value="set:false"/>
+ 
+        <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Standalone"/>
+            <Event Name="Clicked" Function="button_standalone_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox">
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Dedicated"/>
+            <Event Name="Clicked" Function="button_dedicated_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/ServerButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.452,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Server"/>
+            <Event Name="Clicked" Function="button_server_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/ClientButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Client"/>
+            <Event Name="Clicked" Function="button_client_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/QuitButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.604,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Quit"/>
+            <Event Name="Clicked" Function="button_quit_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/MainMenu_2.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/MainMenu_2.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/MainMenu_2.layout	(revision 5646)
@@ -0,0 +1,53 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="TaharezLook/StaticImage" Name="orxonox/Background">
+    <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
+    <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
+    <Property Name="FrameEnabled" Value="set:true"/>
+    <Property Name="BackgroundEnabled" Value="set:false"/>
+ 
+        <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Standalone"/>
+            <Property Name="Disabled" Value="true"/>
+            <Event Name="Clicked" Function="mainmenu_2.button_standalone_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox">
+            <Property Name="UnifiedPosition" Value="{{0.4,0},{0.3,0}}"/>
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedSize" Value="{{0.35,0},{0.33,0}}" />
+            <Property Name="Tooltip" Value="Available Levels." />
+            <Event Name="ItemSelectionChanged" Function="mainmenu_2.listbox_level_selectionchanged" />
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Dedicated"/>
+            <Event Name="Clicked" Function="mainmenu_2.button_dedicated_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/ServerButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.452,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Server"/>
+            <Event Name="Clicked" Function="mainmenu_2.button_server_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/ClientButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Client"/>
+            <Event Name="Clicked" Function="mainmenu_2.button_client_clicked"/>
+        </Window>
+        
+        <Window Type="TaharezLook/Button" Name="orxonox/QuitButton">
+            <Property Name="UnifiedPosition" Value="{{0.11,0},{0.604,0}}"/>
+            <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
+            <Property Name="Text" Value="Quit"/>
+            <Event Name="Clicked" Function="mainmenu_2.button_quit_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/PickupInventory.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/PickupInventory.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/PickupInventory.layout	(revision 5646)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<GUILayout>
+    <Window Type="TaharezLook/FrameWindow" Name="orxonox/Inventory">
+        <Property Name="UnifiedMinSize" Value="{{0.0,385},{0.0,200}}" />
+        <Property Name="UnifiedMaxSize" Value="{{0.0,385},{0.0,200}}" />
+        <Property Name="UnifiedPosition" Value="{{0.5,-100},{0.5,-85}}" />
+        <Property Name="UnifiedSize" Value="{{0.0,385},{0.0,200}}" />
+        <Property Name="Text" Value="Inventory" />
+        <Property Name="CloseButtonEnabled" Value="False" />
+
+        <Window Type="TaharezLook/TabControl" Name="orxonox/Inventory/TabControl" >
+            <Property Name="Tooltip" Value="Inventory" />
+            <Property Name="TabHeight" Value="{0,-1}" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="TabPanePosition" Value="Bottom" />
+            <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" />
+            
+            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabEquipment">
+                <Property Name="Text" Value="Equipment" />
+                <Property Name="UnifiedPosition" Value="{{0.0,3},{0.0,3}}"/>
+                <Property Name="UnifiedSize" Value="{{1.0,-6},{1.0,-6}}"/>
+            </Window>
+            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabUsable">
+                <Property Name="Text" Value="Usable" />
+                <Property Name="UnifiedPosition" Value="{{0.0,3},{0.0,3}}"/>
+                <Property Name="UnifiedSize" Value="{{1.0,-6},{1.0,-6}}"/>
+            </Window>
+        </Window>
+
+        <Event Name="WindowUpdate" Function="PickupInventory.update" />
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TabControlDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TabControlDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TabControlDemo.layout	(revision 5646)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="TaharezLook/FrameWindow" Name="Frame" >
+        <Property Name="Text" Value="Tab Control Demo" />
+        <Property Name="Tooltip" Value="This is a demonstration of TabControl abilities." />
+        <Property Name="TitlebarFont" Value="Commonwealth-10" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+        <Property Name="TitlebarEnabled" Value="True" />
+        <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.9,0}}" />
+        <Window Type="TaharezLook/TabControl" Name="Frame/TabControl" >
+            <Property Name="Tooltip" Value="This is the tab control" />
+            <Property Name="TabHeight" Value="{0,-1}" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="TabPanePosition" Value="Bottom" />
+            <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" />
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TabPage.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TabPage.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TabPage.layout	(revision 5646)
@@ -0,0 +1,34 @@
+<?xml version="1.0" ?>
+<GUILayout>
+
+<Window Type="DefaultGUISheet" Name="">
+    <Window Type="TaharezLook/StaticText" Name="Text">
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="HorzFormatting" Value="WordWrapCentred" />
+        <Property Name="VertFormatting" Value="CentreAligned" />
+        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.1,0},{0.9,0},{0.4,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+    </Window>
+
+    <Window Type="TaharezLook/Button" Name="Button1">
+        <Property Name="Text" Value="- One -" />
+        <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.3,0},{0.2,0}}" />
+    </Window>
+
+    <Window Type="TaharezLook/Button" Name="Button2">
+        <Property Name="Text" Value="- Two -" />
+        <Property Name="UnifiedAreaRect" Value="{{0.3,0},{0.3,0},{0.5,0},{0.4,0}}" />
+    </Window>
+
+    <Window Type="TaharezLook/Button" Name="Button3">
+        <Property Name="Text" Value="- Three -" />
+        <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0.5,0},{0.7,0},{0.6,0}}" />
+    </Window>
+
+    <Window Type="TaharezLook/Button" Name="Button4">
+        <Property Name="Text" Value="- Four -" />
+        <Property Name="UnifiedAreaRect" Value="{{0.7,0},{0.7,0},{0.9,0},{0.8,0}}" />
+    </Window>
+</Window>
+
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TabPage1.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TabPage1.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TabPage1.layout	(revision 5646)
@@ -0,0 +1,75 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="DefaultGUISheet" Name="Page1">
+        <Property Name="Text" Value="Page one" />
+
+        <Window Type="TaharezLook/RadioButton" Name="Page1/TabPaneTop" >
+            <Property Name="ID" Value="0" />
+            <Property Name="Text" Value="Tab pane at top" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.1,0},{0.45,0},{0.2,0}}" />
+        </Window>
+
+        <Window Type="TaharezLook/RadioButton" Name="Page1/TabPaneBottom" >
+            <Property Name="ID" Value="1" />
+            <Property Name="Text" Value="Tab pane at bottom" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.2,0},{0.45,0},{0.3,0}}" />
+        </Window>
+
+        <Window Type="TaharezLook/Button" Name="Page1/AddTab">
+            <Property Name="Text" Value="Add a new tab" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.35,0},{0.45,0},{0.45,0}}" />
+            <Property Name="Tooltip" Value="Switch active page to selected" />
+        </Window>
+
+        <Window Type="TaharezLook/Listbox" Name="Page1/PageList">
+            <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.1,0},{0.95,0},{0.48,0}}" />
+            <Property Name="Tooltip" Value="A list of available tabs to experiment with" />
+        </Window>
+
+        <Window Type="TaharezLook/Button" Name="Page1/Go">
+            <Property Name="Text" Value="Goto" />
+            <Property Name="UnifiedAreaRect" Value="{{0.55,0},{0.5,0},{0.67,0},{0.57,0}}" />
+            <Property Name="Tooltip" Value="Switch active page to selected" />
+        </Window>
+
+        <Window Type="TaharezLook/Button" Name="Page1/Show">
+            <Property Name="Text" Value="Show" />
+            <Property Name="UnifiedAreaRect" Value="{{0.69,0},{0.5,0},{0.81,0},{0.57,0}}" />
+            <Property Name="Tooltip" Value="Make the selected tab visible in the tab pane" />
+        </Window>
+
+        <Window Type="TaharezLook/Button" Name="Page1/Del">
+            <Property Name="Text" Value="Del" />
+            <Property Name="UnifiedAreaRect" Value="{{0.83,0},{0.5,0},{0.95,0},{0.57,0}}" />
+            <Property Name="Tooltip" Value="Delete the selected pane" />
+        </Window>
+
+        <Window Type="TaharezLook/StaticText" Name="Page1/TabHeightDesc" >
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.7,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+            <Property Name="Text" Value="Change the height of tab buttons in pixels" />
+        </Window>
+        <Window Type="TaharezLook/HorizontalScrollbar" Name="Page1/TabHeight">
+            <Property Name="DocumentSize" Value="64" />
+            <Property Name="PageSize" Value="4" />
+            <Property Name="StepSize" Value="1" />
+            <Property Name="OverlapSize" Value="0" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.7,0},{0.95,0},{0.7,12}}" />
+        </Window>
+
+        <Window Type="TaharezLook/StaticText" Name="Page1/TabPaddingDesc" >
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.8,0},{0.95,0},{0.9,0}}" />
+            <Property Name="BackgroundEnabled" Value="False" />
+            <Property Name="Text" Value="Change the padding of the text on buttons in pixels" />
+        </Window>
+        <Window Type="TaharezLook/HorizontalScrollbar" Name="Page1/TabPadding">
+            <Property Name="DocumentSize" Value="100" />
+            <Property Name="PageSize" Value="5" />
+            <Property Name="StepSize" Value="1" />
+            <Property Name="OverlapSize" Value="0" />
+            <Property Name="UnifiedAreaRect" Value="{{0.06,0},{0.9,0},{0.95,0},{0.9,12}}" />
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TabPage2.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TabPage2.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TabPage2.layout	(revision 5646)
@@ -0,0 +1,38 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="DefaultGUISheet" Name="Page2">
+        <Property Name="Text" Value="Page two" />
+        <Window Type="TaharezLook/Button" Name="Page2/Button1">
+            <Property Name="Text" Value="Push me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.1,0},{0.8,0},{0.2,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button2">
+            <Property Name="Text" Value="Press me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.2,0},{0.8,0},{0.3,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button3">
+            <Property Name="Text" Value="Kick me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.3,0},{0.8,0},{0.4,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button4">
+            <Property Name="Text" Value="Break me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.4,0},{0.8,0},{0.5,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button5">
+            <Property Name="Text" Value="Catch me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.5,0},{0.8,0},{0.6,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button6">
+            <Property Name="Text" Value="Kiss me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.6,0},{0.8,0},{0.7,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button7">
+            <Property Name="Text" Value="Lick me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.7,0},{0.8,0},{0.8,0}}" />
+        </Window>
+        <Window Type="TaharezLook/Button" Name="Page2/Button8">
+            <Property Name="Text" Value="Spit me" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.8,0},{0.8,0},{0.9,0}}" />
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TextDemo.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TextDemo.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TextDemo.layout	(revision 5646)
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="Root" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="TaharezLook/FrameWindow" Name="TextDemo" >
+            <Property Name="Text" Value="Text sample" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="TitlebarEnabled" Value="True" />
+            <Property Name="UnifiedAreaRect" Value="{{0.0160194,0},{0.0159533,0},{0.869175,0},{0.880739,0}}" />
+            <Window Type="TaharezLook/GroupBox" Name="TextDemo/StaticGroup" >
+                <Property Name="Text" Value="Static text" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.0173979,0},{0.078319,0},{0.986007,0},{0.404881,0}}" />
+            </Window>
+            <Window Type="TaharezLook/GroupBox" Name="TextDemo/SingleLineGroup" >
+                <Property Name="Text" Value="Single line editing" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.0184568,0},{0.415308,0},{0.984039,0},{0.570098,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/StaticText" >
+                <Property Name="Text" Value="Demonstrates static (non editable) text. Use the controls on your right for formatting options." />
+                <Property Name="HorzFormatting" Value="WordWrapLeftAligned" />
+		    <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.032217,0},{0.126344,0},{0.42415,0},{0.384995,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/lblHorzFormatting" >
+                <Property Name="Text" Value="Horz. formatting" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.436163,0},{0.124473,0},{0.634902,0},{0.173498,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/HorzLeft" >
+                <Property Name="Text" Value="Left aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.434561,0},{0.179757,0},{0.602889,0},{0.228783,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/HorzRight" >
+                <Property Name="Text" Value="Right aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.434561,0},{0.223715,0},{0.602889,0},{0.27274,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/HorzCentered" >
+                <Property Name="Text" Value="Center aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.434561,0},{0.267673,0},{0.602889,0},{0.316698,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/lblVertFormatting" >
+                <Property Name="Text" Value="Vert. formatting" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.612759,0},{0.124473,0},{0.787369,0},{0.173498,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/VertTop" >
+                <Property Name="Text" Value="Top aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.609555,0},{0.190256,0},{0.792699,0},{0.227283,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/VertBottom" >
+                <Property Name="Text" Value="Bottom aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.609555,0},{0.234214,0},{0.792699,0},{0.27124,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="TextDemo/VertCentered" >
+                <Property Name="Text" Value="Center aligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.609555,0},{0.276102,0},{0.792699,0},{0.313129,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Checkbox" Name="TextDemo/Wrap" >
+                <Property Name="Text" Value="Word wrap" />
+                <Property Name="Selected" Value="True" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.780252,0},{0.127429,0},{0.931853,0},{0.180953,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Editbox" Name="TextDemo/editName" >
+                <Property Name="Text" Value="Your name" />
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.032217,0},{0.497488,0},{0.282217,0},{0.548012,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Editbox" Name="TextDemo/editAge" >
+                <Property Name="Text" Value="18" />
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.309388,0},{0.497488,0},{0.361665,0},{0.548012,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Editbox" Name="TextDemo/editPasswd" >
+                <Property Name="Text" Value="Secret" />
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.386344,0},{0.497488,0},{0.576599,0},{0.548012,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/lblName" >
+                <Property Name="Text" Value="Name:" />
+                <Property Name="AlwaysOnTop" Value="True" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.0334283,0},{0.453505,0},{0.283428,0},{0.492031,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/lblAge" >
+                <Property Name="Text" Value="Age:" />
+                <Property Name="AlwaysOnTop" Value="True" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.312375,0},{0.453505,0},{0.562375,0},{0.492031,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="TextDemo/lblPassword" >
+                <Property Name="Text" Value="Password:" />
+                <Property Name="AlwaysOnTop" Value="True" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.389616,0},{0.452006,0},{0.639615,0},{0.490531,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/GroupBox" Name="TextDemo/MultiLineGroup" >
+                <Property Name="Text" Value="Multi line editing" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.018457,0},{0.583793,0},{0.984039,0},{0.932058,0}}" />
+            </Window>
+            <Window Type="TaharezLook/MultiLineEditbox" Name="TextDemo/editMulti" >
+                <Property Name="Text" >
+</Property>
+                <Property Name="MaxTextLength" Value="1073741823" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.032217,0},{0.651968,0},{0.579514,0},{0.910619,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Checkbox" Name="TextDemo/forceScroll" >
+                <Property Name="Text" Value="Force vertical scrollbar" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.585348,0},{0.651481,0},{0.832503,0},{0.688507,0}}" />
+            </Window>
+            <Window Type="TaharezLook/Button" Name="TextDemo/Quit" >
+                <Property Name="Text" Value="Quit" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.421905,0},{0.937908,0},{0.612162,0},{0.991433,0}}" />
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/TreeDemoTaharez.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/TreeDemoTaharez.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/TreeDemoTaharez.layout	(revision 5646)
@@ -0,0 +1,35 @@
+<?xml version="1.0" ?>
+<GUILayout>
+	<Window Type="TaharezLook/FrameWindow" Name="DemoWindow">
+		<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+		<Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+		<Property Name="UnifiedSize" Value="{{0.5,0},{0.8,0}}" />
+
+            <Property Name="Text" Value="Tree Demo" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+		<Property Name="SizingEnabled" Value="True" />
+		<Property Name="FrameEnabled" Value="True" />
+		<Property Name="RollUpEnabled" Value="True" />
+		<Property Name="SizingBorderThickness" Value="8.0" />
+
+    <Window Type="TaharezLook/Tree" Name="DemoWindow/Tree">
+			<Property Name="ID" Value="1" />
+			<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+		
+			<Property Name="UnifiedSize" Value="{{0.96,0},{0.75,0}}" />
+			<Property Name="UnifiedPosition" Value="{{0.02,0},{0.1,0}}" />
+		</Window>
+
+		<Window Type="TaharezLook/Editbox" Name="DemoWindow/Editbox">
+			<Property Name="ID" Value="2" />
+			<Property Name="VerticalAlignment" Value="Bottom" />
+			<Property Name="UnifiedMaxSize" Value="{{0.7,0},{0.05,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0.7,0},{0.05,0}}" />
+			<Property Name="UnifiedSize" Value="{{0.7,0},{0.05,0}}" />
+			<Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" />
+			<Property Name="ReadOnly" Value="True" />
+			<Property Name="Text" Value="" />
+			<Property Name="Tooltip" Value="World Location X" />
+		</Window>
+	</Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/VanillaConsole.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/VanillaConsole.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/VanillaConsole.layout	(revision 5646)
@@ -0,0 +1,51 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="Vanilla/FrameWindow" Name="Vanilla/Console">
+        <Property Name="AlwaysOnTop" Value="True" />
+        <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+        <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+        <Property Name="UnifiedPosition" Value="{{0.5,0},{0.5,0}}" />
+        <Property Name="UnifiedSize" Value="{{0.5,0},{0.45,0}}" />
+        <Property Name="Text" Value="Console" />
+        <Property Name="CloseButtonEnabled" Value="False" />
+
+        <Window Type="Vanilla/Button" Name="Vanilla/Console/Submit">
+            <Property Name="ID" Value="1" />
+            <Property Name="VerticalAlignment" Value="Bottom" />
+            <Property Name="HorizontalAlignment" Value="Right" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0,-7},{0,-7}}" />
+            <Property Name="UnifiedSize" Value="{{0.25,0},{0,30}}" />
+            <Property Name="Text" Value="Submit" />
+        </Window>
+
+        <Window Type="Vanilla/Editbox" Name="Vanilla/Console/Editbox">
+            <Property Name="ID" Value="2" />
+            <Property Name="VerticalAlignment" Value="Bottom" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" />
+            <Property Name="UnifiedSize" Value="{{0.75,-21},{0,30}}" />
+            <Property Name="Text" Value="" />
+        </Window>
+
+        <Window Type="Vanilla/MultiLineEditbox" Name="Vanilla/Console/History">
+            <Property Name="ID" Value="3" />
+            <Property Name="ReadOnly" Value="True" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" />
+            <Property Name="UnifiedSize" Value="{{1,-14},{1,-75}}" />
+            <Property Name="Text">
+CEGUI Demo Console - F12 toggles this window
+          
+It's now easy to add multiline text property.
+Line 1
+<![CDATA[
+You can now put <xml>stuff</xml> in your property easly " " " 
+]]>
+Line 2
+Line 3 
+</Property>
+              
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/VanillaWindows.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/VanillaWindows.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/VanillaWindows.layout	(revision 5646)
@@ -0,0 +1,85 @@
+<?xml version="1.0" ?>
+<GUILayout>
+    <Window Type="Vanilla/StaticImage" Name="root">
+        <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
+        <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" />
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Property Name="Image" Value="set:Backdrop-Images image:Magic" />
+
+        <Window Type="Vanilla/FrameWindow" Name="Demo/NewNode">
+            <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+            <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0.6,0},{0.1,0}}" />
+            <Property Name="UnifiedSize" Value="{{0.3,0},{0.5,0}}" />
+            <Property Name="Text" Value="New Node" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+
+            <Window Type="Vanilla/Listbox" Name="Demo7/Window2/Listbox">
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" />
+                <Property Name="UnifiedSize" Value="{{1,-14},{1,-108}}" />
+            </Window>
+
+            <Window Type="Vanilla/StaticText" Name="Demo/NewNode/label1">
+                <Property Name="BackgroundEnabled" Value="False" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="VerticalAlignment" Value="Bottom" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,7},{0,-45}}" />
+                <Property Name="UnifiedSize" Value="{{0,60},{0,30}}" />
+                <Property Name="Text" Value="Name:" />
+            </Window>
+
+            <Window Type="Vanilla/Editbox" Name="Demo/NewNode/Editbox">
+                <Property Name="VerticalAlignment" Value="Bottom" />
+                <Property Name="HorizontalAlignment" Value="Right" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,-7},{0,-40}}" />
+                <Property Name="UnifiedSize" Value="{{1,-74},{0,30}}" />
+                <Property Name="Text" Value="" />
+            </Window>
+
+            <Window Type="Vanilla/Button" Name="Demo/NewNode/Okay">
+                <Property Name="VerticalAlignment" Value="Bottom" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" />
+                <Property Name="UnifiedSize" Value="{{0,60},{0,30}}" />
+                <Property Name="Text" Value="Okay" />
+            </Window>
+
+            <Window Type="Vanilla/Button" Name="Demo/NewNode/Cancel">
+                <Property Name="VerticalAlignment" Value="Bottom" />
+                <Property Name="HorizontalAlignment" Value="Right" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,-7},{0,-7}}" />
+                <Property Name="UnifiedSize" Value="{{0,60},{0,30}}" />
+                <Property Name="Text" Value="Cancel" />
+            </Window>
+
+        </Window>
+
+        <Window Type="Vanilla/FrameWindow" Name="Demo/NamespaceViewer">
+            <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" />
+            <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" />
+            <Property Name="WindowPosition" Value="{{0.25,0},{0.48,0}}" />
+            <Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
+            <Property Name="Text" Value="Namespace Viewer" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+
+            <Window Type="Vanilla/StaticText" Name="Demo/NamespaceViewer/area1">
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" />
+                <Property Name="UnifiedSize" Value="{{1,-14},{0,65}}" />
+            </Window>
+
+            <Window Type="Vanilla/Listbox" Name="Demo/NamespaceViewer/area2">
+                <Property Name="VerticalAlignment" Value="Bottom" />
+                <Property Name="UnifiedMaxSize" Value="{{1.0,0},{1.0,0}}" />
+                <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" />
+                <Property Name="UnifiedSize" Value="{{1,-14},{1,-110}}" />
+            </Window>
+        </Window>
+
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/cegui8.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/cegui8.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/cegui8.layout	(revision 5646)
@@ -0,0 +1,130 @@
+<?xml version="1.0" ?>
+<!-- Layout file from CEGUI Demo8 -->
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="demo_root">
+
+	<Window Type="DefaultGUISheet" Name="Demo8">
+
+		<Property Name="UnifiedMaxSize" Value="{{1,0},{2,0}}" />
+		<Property Name="UnifiedSize" Value="{{1,0},{2,0}}"  />
+
+		<Window Type="TaharezLook/VerticalScrollbar" Name="Demo8/ViewScroll">
+			<Property Name="UnifiedPosition" Value="{{0.0,0},{0.0,0}}"  />
+			<Property Name="UnifiedSize" Value="{{0.03,0},{0.75,0}}"  />
+			<Property Name="DocumentSize" Value="2" />
+			<Property Name="PageSize" Value="1" />
+			<Property Name="StepSize" Value="0.01" />
+			<Property Name="OverlapSize" Value="0.5" />
+		</Window>
+
+        <Window Type="TaharezLook/FrameWindow" Name="Demo8/Window1">
+			<Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}"  />
+			<Property Name="UnifiedMaxSize" Value="{{0.5,0},{1,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+			<Property Name="UnifiedSize" Value="{{0.4,0},{0.35,0}}"  />
+			<Property Name="Text" Value="Demo 8 - Listbox Demo" />
+
+			<Window Type="TaharezLook/Listbox" Name="Demo8/Window1/Listbox">
+				<Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}"  />
+				<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.9,0},{0.33,0}}"  />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="Demo8/Window1/Controls">
+				<Property Name="UnifiedPosition" Value="{{0.05,0},{0.45,0}}"  />
+				<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.9,0},{0.5,0}}"  />
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Red">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.05,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}"  />
+					<Property Name="DocumentSize" Value="255" />
+					<Property Name="PageSize" Value="16" />
+					<Property Name="StepSize" Value="1" />
+					<Property Name="OverlapSize" Value="1" />
+				</Window>
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Green">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.12,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}"  />
+					<Property Name="DocumentSize" Value="256" />
+					<Property Name="PageSize" Value="16" />
+					<Property Name="StepSize" Value="1" />
+					<Property Name="OverlapSize" Value="1" />
+				</Window>
+
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Demo8/Window1/Controls/Blue">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.19,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.9,0},{0.06,0}}"  />
+					<Property Name="DocumentSize" Value="255" />
+					<Property Name="PageSize" Value="16" />
+					<Property Name="StepSize" Value="1" />
+					<Property Name="OverlapSize" Value="1" />
+				</Window>
+
+				<Window Type="TaharezLook/StaticImage" Name="Demo8/Window1/Controls/ColourSample">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.26,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.9,0},{0.1,0}}"  />
+					<Property Name="Image" Value="set:TaharezLook image:ListboxSelectionBrush" />
+					<Property Name="ImageColours" Value="tl:0 tr:0 bl:0 br:0" />
+				</Window>
+
+				<Window Type="TaharezLook/Editbox" Name="Demo8/Window1/Controls/Editbox">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.38,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.6,0},{0.15,0}}"  />
+				</Window>
+
+                <Window Type="TaharezLook/Button" Name="Demo8/Window1/Controls/Add">
+					<Property Name="UnifiedPosition" Value="{{0.68,0},{0.38,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.3,0},{0.15,0}}"  />
+					<Property Name="Text" Value="Add" />
+				</Window>
+
+                <Window Type="TaharezLook/StaticText" Name="Demo8/Window1/Controls/ins1">
+					<Property Name="UnifiedPosition" Value="{{0.05,0},{0.55,0}}"  />
+					<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedSize" Value="{{0.9,0},{0.4,0}}"  />
+					<Property Name="HorzFormatting" Value="WordWrapCentred" />
+					<Property Name="Text" Value="Use this panel to add items.  The scrollbars change the selection colour." />
+				</Window>
+
+			</Window>
+			
+		</Window>
+
+        <Window Type="TaharezLook/FrameWindow" Name="Demo8/Window2">
+			<Property Name="UnifiedPosition" Value="{{0.55,0},{0.1,0}}"  />
+			<Property Name="UnifiedMaxSize" Value="{{0.5,0},{1,0}}" />
+			<Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
+			<Property Name="UnifiedSize" Value="{{0.4,0},{0.3,0}}"  />
+			<Property Name="Text" Value="Demo 8 - Information Window" />
+
+            <Window Type="TaharezLook/StaticText" Name="Demo8/Window2/Info">
+				<Property Name="UnifiedPosition" Value="{{0.05,0},{0.1,0}}"  />
+				<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.9,0},{0.3,0}}"  />
+				<Property Name="HorzFormatting" Value="WordWrapCentred" />
+				<Property Name="Text" Value="The panel below gives some information about the item under the mouse." />
+			</Window>
+	
+            <Window Type="TaharezLook/StaticText" Name="Demo8/Window2/Tips">
+				<Property Name="UnifiedPosition" Value="{{0.05,0},{0.5,0}}"  />
+				<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+				<Property Name="UnifiedSize" Value="{{0.9,0},{0.4,0}}"  />
+				<Property Name="HorzFormatting" Value="WordWrapCentred" />
+			</Window>
+
+		</Window>
+
+
+	</Window>
+
+</Window>
+
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/facial.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/facial.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/facial.layout	(revision 5646)
@@ -0,0 +1,379 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="root">
+    <Window Type="DefaultGUISheet" Name="FacialDemo">
+		<Property Name="UnifiedSize" Value="{{0.25,0},{1,0}}" />
+
+		<Window Type="TaharezLook/FrameWindow" Name="OgreGuiDemo/WindowPropertiesWindow">
+
+			<Property Name="UnifiedSize" Value="{{0,200},{0,400}}" />
+            <Property Name="UnifiedPosition" Value="{{0,0},{0,0.52}}" />
+            <Property Name="TitlebarEnabled" Value="false" />
+            <Property Name="CloseButtonEnabled" Value="false" />
+			<Property Name="Text" Value="Editor Window" />
+			<Window Type="TaharezLook/RadioButton" Name="Facial/Radio/Play">
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,15},{0,5}}" />
+				<Property Name="UnifiedSize" Value="{{0,90},{0,40}}" />
+                <Property Name="Text" Value="Animation" />
+            </Window>
+			<Window Type="TaharezLook/RadioButton" Name="Facial/Radio/Manual">
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,110},{0,5}}" />
+				<Property Name="UnifiedSize" Value="{{0,90},{0,40}}" />
+                <Property Name="Text" Value="Manual" />
+			</Window>				
+			<Window Type="TaharezLook/StaticText" Name="Facial/Expressions">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,5},{0,35}}" />
+				<Property Name="UnifiedSize" Value="{{0,190},{0,40}}" />
+                <Property Name="Text" Value="Expressions" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/Happy_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,5},{0,55}}" />
+				<Property Name="UnifiedSize" Value="{{0,60},{0,40}}" />
+                <Property Name="Text" Value="Happy" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/Happy_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,75}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/Sad_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,5},{0,70}}" />
+				<Property Name="UnifiedSize" Value="{{0,60},{0,40}}" />
+                <Property Name="Text" Value="Sad" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/Sad_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,90}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/Angry_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,5},{0,85}}" />
+				<Property Name="UnifiedSize" Value="{{0,60},{0,40}}" />
+                <Property Name="Text" Value="Angry" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/Angry_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,105}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+			</Window>
+
+			<Window Type="TaharezLook/StaticText" Name="Facial/MouthShapes">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,5},{0,110}}" />
+				<Property Name="UnifiedSize" Value="{{0,150},{0,40}}" />
+                <Property Name="Text" Value="Mouth Shapes" />
+            </Window>
+
+			<Window Type="TaharezLook/StaticText" Name="Facial/A_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,135}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="A" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/A_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,150}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/E_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,25},{0,150}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="E" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/E_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,165}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/I_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,165}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="I" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/I_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,180}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/O_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,25},{0,180}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="O" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/O_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,195}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/U_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,195}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="U" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/U_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,210}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/C_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,210}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="C" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/C_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,225}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+			</Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/W_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+				<Property Name="UnifiedPosition" Value="{{0,25},{0,225}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="W" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/W_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,240}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/M_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,240}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="M" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/M_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,255}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/L_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,255}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="L" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/L_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,270}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/F_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,270}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="F" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/F_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,285}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/T_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,285}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="T" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/T_Scroll">
+
+				<Property Name="UnifiedPosition" Value="{{0,60},{0,300}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/P_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,300}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="P" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/P_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,315}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/R_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,315}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="R" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/R_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,330}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/S_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,330}}" />
+				<Property Name="UnifiedSize" Value="{{0,30},{0,40}}" />
+                <Property Name="Text" Value="S" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/S_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,345}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			<Window Type="TaharezLook/StaticText" Name="Facial/TH_Label">
+				<Property Name="FrameEnabled" Value="False"/>
+				<Property Name="BackgroundEnabled" Value="False"/>
+				<Property Name="Font" Value="BlueHighway-12"/>
+
+                <Property Name="UnifiedPosition" Value="{{0,25},{0,345}}" />
+				<Property Name="UnifiedSize" Value="{{0,35},{0,40}}" />
+                <Property Name="Text" Value="TH" />
+            </Window>
+			<Window Type="TaharezLook/HorizontalScrollbar" Name="Facial/TH_Scroll">
+
+                <Property Name="UnifiedPosition" Value="{{0,60},{0,360}}" />
+				<Property Name="UnifiedSize" Value="{{0,120},{0,10}}" />
+				<Property Name="DocumentSize" Value="1.1" />
+				<Property Name="PageSize" Value="0.1" />
+				<Property Name="StepSize" Value="0.05" />
+				<Property Name="OverlapSize" Value="0.05" />
+            </Window>
+			
+			<!-- A, U, O, E, I, C, W, M, L, F, T, P, R, S, TH -->
+
+        </Window>
+	</Window>
+</Window>
+
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/ogregui.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/ogregui.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/ogregui.layout	(revision 5646)
@@ -0,0 +1,79 @@
+<?xml version="1.0" ?>
+<GUILayout>
+<Window Type="DefaultGUISheet" Name="root">
+    <Window Type="DefaultGUISheet" Name="OgreGuiDemo">
+		<Property Name="UnifiedSize" Value="{{0.25,0},{1,0}}" />
+
+        <Window Type="TaharezLook/TabControl" Name="OgreGuiDemo/TabCtrl">
+            <Property Name="UnifiedPosition" Value="{{0.0,0},{0.0,0}}" />
+            <Property Name="UnifiedSize" Value="{{1,0},{0.5,0}}" />
+
+            <Window Type="DefaultGUISheet" Name="OgreGuiDemo/TabCtrl/Page1">
+                <Property Name="Text" Value="File" />
+                <Window Type="TaharezLook/Button" Name="OgreGuiDemo/TabCtrl/Page1/NewButton">
+                    <Property Name="UnifiedPosition" Value="{{0.1,0},{0.1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.8,0},{0.07,0}}" />
+                    <Property Name="Text" Value="New" />
+                </Window>
+                <Window Type="TaharezLook/Button" Name="OgreGuiDemo/TabCtrl/Page1/LoadButton">
+                    <Property Name="UnifiedPosition" Value="{{0.1,0},{0.2,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.8,0},{0.07,0}}" />
+                    <Property Name="Text" Value="Load Test Layout" />
+                </Window>
+                <Window Type="TaharezLook/Button" Name="OgreGuiDemo/TabCtrl/Page1/QuitButton">
+                    <Property Name="UnifiedPosition" Value="{{0.1,0},{0.3,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.8,0},{0.07,0}}" />
+                    <Property Name="Text" Value="Quit" />
+                </Window>
+            </Window>
+            <Window Type="DefaultGUISheet" Name="OgreGuiDemo/TabCtrl/Page2">
+                <Property Name="Text" Value="Objects" />
+                <Window Type="TaharezLook/Combobox" Name="OgreGuiDemo/TabCtrl/Page2/ObjectTypeList">
+                    <Property Name="UnifiedPosition" Value="{{0.1,0},{0.1,0}}" />
+                    <Property Name="UnifiedSize" Value="{{0.8,0},{0.5,0}}" />
+                    <Property Name="Text" Value="Select Type" />
+                    <Property Name="ClippedByParent" Value="false" />
+                    <Property Name="ReadOnly" Value="true" />
+                </Window>
+            </Window>
+        </Window>
+        <!--<Window Type="TaharezLook/FrameWindow" Name="OgreGuiDemo/WindowPropertiesWindow">
+            <Property Name="UnifiedSize" Value="{{1,0},{0.3,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0,0},{0.52,0}}" />
+            <Property Name="TitlebarEnabled" Value="false" />
+            <Property Name="CloseButtonEnabled" Value="false" />
+            <Property Name="Visible" Value="false" />
+            <Property Name="Text" Value="Editor Window" />
+            <Window Type="TaharezLook/StaticText" Name="OgreGuiDemo/WindowProperties/NameText">
+                <Property Name="UnifiedPosition" Value="{{0.05,0},{0.2,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.9,0},{0.4,0}}" />
+                <Property Name="Text" Value="Name:" />
+            </Window>
+
+            <Window Type="TaharezLook/Button" Name="OgreGuiDemo/WindowPropertiesWindow/OKButton">
+                <Property Name="UnifiedPosition" Value="{{0.15,0},{0.8,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.3,0},{0.1,0}}" />
+                <Property Name="Text" Value="OK" />
+            </Window>
+            <Window Type="TaharezLook/Button" Name="OgreGuiDemo/WindowPropertiesWindow/CancelButton">
+                <Property Name="UnifiedPosition" Value="{{0.55,0},{0.8,0}}" />
+                <Property Name="UnifiedSize" Value="{{0.3,0},{0.1,0}}" />
+                <Property Name="Text" Value="Cancel" />
+            </Window>
+        </Window>-->
+	</Window>
+    <Window Type="DefaultGUISheet" Name="OgreGuiDemo2">
+		<Property Name="UnifiedSize" Value="{{0.75,0},{1,0}}" />
+		<Property Name="UnifiedPosition" Value="{{0.25,0},{0,0}}" />
+        <Window Type="TaharezLook/FrameWindow" Name="OgreGuiDemo2/MainWindow">
+            <Property Name="UnifiedSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
+            <Property Name="DragMovingEnabled" Value="false" />
+            <Property Name="RollUpEnabled" Value="false" />
+            <Property Name="CloseButtonEnabled" Value="false" />
+            <Property Name="Text" Value="Editor Window" />
+        </Window>
+    </Window>
+</Window>
+
+</GUILayout>
Index: code/branches/resource2/data/gui/layouts/shadows.layout
===================================================================
--- code/branches/resource2/data/gui/layouts/shadows.layout	(revision 5646)
+++ code/branches/resource2/data/gui/layouts/shadows.layout	(revision 5646)
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="Shadows" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Window Type="TaharezLook/FrameWindow" Name="Shadows/Main" >
+            <Property Name="Font" Value="BlueHighway-12" />
+            <Property Name="Alpha" Value="0.5" />
+            <Property Name="FrameEnabled" Value="False" />
+            <Property Name="TitlebarFont" Value="BlueHighway-12" />
+            <Property Name="SizingEnabled" Value="False" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="TitlebarEnabled" Value="False" />
+            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.797107,0},{0.148408,0}}" />
+            <Property Name="DragMovingEnabled" Value="False" />
+            <Property Name="CloseButtonEnabled" Value="False" />
+            <Window Type="TaharezLook/RadioButton" Name="Shadows/Stencil" >
+                <Property Name="ID" Value="1" />
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Stencil shadows" />
+                <Property Name="GroupID" Value="1" />
+                <Property Name="Tooltip" Value="Stencil Shadows: Geometric shadow volumes are generated from mesh silhouettes and extruded, shadowed areas calculated in the stencil buffer. Good on lower end hardware but cannot handle alpha or vertex programs that deform shape, and is too expensive at high poly counts. Sharp edged shadows." />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.00465426,0},{0.167892,0},{0.192628,0},{0.344774,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Shadows/Texture" >
+                <Property Name="ID" Value="2" />
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Texture shadows" />
+                <Property Name="GroupID" Value="1" />
+                <Property Name="Tooltip" Value="Texture Shadows: Shadow casters are rendered to a texture and this is later projected onto shadow receivers. More flexible,  handles alpha and deforming vertex programs, and texture shadow can be used in shaders for more advanced effects. Uses more GPU memory and fixed size can cause aliasing (but see projection options)" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.00531136,0},{0.362541,0},{0.194019,0},{0.529099,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="Shadows/Label2" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Lighting:" />
+                <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.19234,0},{-0.0189824,0},{0.303863,0},{0.18662,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="Shadows/Label1" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Technique:" />
+                <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.00658522,0},{-0.00904641,0},{0.160622,0},{0.186908,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Shadows/Additive" >
+                <Property Name="ID" Value="3" />
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Additive" />
+                <Property Name="GroupID" Value="2" />
+                <Property Name="Tooltip" Value="Additive Lighting: Light is built up incrementally in the scene, and areas of shadow are masked out per light during the process. Much more realistic lighting model, taking into account multiple coloured lights and ambient contribution well, but more expensive since it can take more passes to render." />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.196723,0},{0.174711,0},{0.327724,0},{0.348675,0}}" />
+            </Window>
+            <Window Type="TaharezLook/RadioButton" Name="Shadows/Modulative" >
+                <Property Name="ID" Value="4" />
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="Text" Value="Modulative" />
+                <Property Name="GroupID" Value="2" />
+                <Property Name="Tooltip" Value="Modulative shadows: Shadowed areas are uniformly darkened by a shadow colour after rendering the scene normally. A simple but inaccurate model, it works best when there is one dominant light source (e.g. outdoor daylight). Multiple lights exhibit overdarkening artefacts." />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.195901,0},{0.36936,0},{0.334983,0},{0.532604,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticText" Name="Shadows/Desc" >
+                <Property Name="Font" Value="BlueHighway-10" />
+                <Property Name="Text" >
+</Property>
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="InheritsAlpha" Value="False" />
+                <Property Name="HorzFormatting" Value="WordWrapLeftAligned" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="VertFormatting" Value="TopAligned" />
+                <Property Name="UnifiedAreaRect" Value="{{-0.00124776,0},{0.534509,0},{0.998327,0},{1.00537,0}}" />
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="Shadows/ProjectionGroup" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.318294,0},{0.0269328,0},{0.547929,0},{0.488323,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+                <Window Type="TaharezLook/StaticText" Name="Shadows/Label21" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Projection:" />
+                    <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0242767,0},{-0.00538364,0},{0.514109,0},{0.300338,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/Combobox" Name="Shadows/Projection" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Tooltip" Value="Projection: This is the basis for the shadow projection. A uniform projection is the simplest but can also cause aliasing close to the camera due to the finite resolution of the shadow texture. You can plug new ShadowCameraSetup classes to change the projection basis and distribute the shadow texture differently to compensate for this." />
+                    <Property Name="ReadOnly" Value="True" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.0215161,0},{0.406132,0},{1.00682,0},{4,0}}" />
+                    <Property Name="MaxEditTextLength" Value="1073741823" />
+                </Window>
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="Shadows/MaterialGroup" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.554514,0},{0.0286934,0},{0.927227,0},{0.490084,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+                <Window Type="TaharezLook/StaticText" Name="Shadows/Label211" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Text" Value="Material Setup:" />
+                    <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.021516,0},{-0.158454,0},{0.862772,0},{0.387132,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/Combobox" Name="Shadows/Material" >
+                    <Property Name="Font" Value="BlueHighway-12" />
+                    <Property Name="Tooltip" Value="Material setup: You can customise materials texture shadows with material; you can modify the standard shadow passes, which are separate from the normal render, or you can use &apos;custom sequence&apos; shadows which allow you to incorporate shadow textures directly in your own materials, thus gaining complete control. Both can use shaders for effects like PCF / depth shadowmapping." />
+                    <Property Name="ReadOnly" Value="True" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.021516,0},{0.406132,0},{0.731289,0},{4,0}}" />
+                    <Property Name="MaxEditTextLength" Value="1073741823" />
+                </Window>
+            </Window>
+            <Window Type="TaharezLook/StaticImage" Name="Shadows/DepthShadowTweakGroup" >
+                <Property Name="Font" Value="BlueHighway-12" />
+                <Property Name="FrameEnabled" Value="False" />
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.825038,0},{0.0186838,0},{0.999281,0},{0.548657,0}}" />
+                <Property Name="BackgroundEnabled" Value="False" />
+                <Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/FixedBiasLabel" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="FixedBias:" />
+                    <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+					<Property Name="UnifiedAreaRect" Value="{{0.0316741,0},{0.0,0},{0.373716,0},{0.2,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Shadows/DepthShadowTweakGroup/FixedBias" >
+                    <Property Name="PageSize" Value="0.001" />
+                    <Property Name="StepSize" Value="0.0005" />
+                    <Property Name="OverlapSize" Value="0.0005" />
+                    <Property Name="DocumentSize" Value="0.021" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+					<Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.0,0},{1,0},{0.15,0}}" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/FixedBiasText" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+					<Property Name="Text" Value="" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedAreaRect" Value="{{0.70,0},{0.125,0},{0.943746,0},{0.3,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/SlopeBiasLabel" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+                    <Property Name="Text" Value="SlopeBias:" />
+                    <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+					<Property Name="UnifiedAreaRect" Value="{{0.0316741,0},{0.35,0},{0.373716,0},{0.55,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Shadows/DepthShadowTweakGroup/SlopeBias" >
+                    <Property Name="PageSize" Value="0.1" />
+                    <Property Name="StepSize" Value="0.05" />
+                    <Property Name="OverlapSize" Value="0.05" />
+                    <Property Name="DocumentSize" Value="2.1" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.35,0},{1,0},{0.5,0}}" />
+                </Window>
+				<Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/SlopeBiasText" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+					<Property Name="Text" Value="" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedAreaRect" Value="{{0.70,0},{0.475,0},{0.943746,0},{0.675,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+				<Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/SlopeClampLabel" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+					<Property Name="Text" Value="Clamp:" />
+                    <Property Name="TextColours" Value="tl:FFFFFF00 tr:FFFFFF00 bl:FFFFFF00 br:FFFFFF00" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+					<Property Name="UnifiedAreaRect" Value="{{0.0316741,0},{0.675,0},{0.472153,0},{0.85,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+                <Window Type="TaharezLook/HorizontalScrollbar" Name="Shadows/DepthShadowTweakGroup/SlopeClamp" >
+                    <Property Name="PageSize" Value="0.01" />
+                    <Property Name="StepSize" Value="0.005" />
+                    <Property Name="OverlapSize" Value="0.005" />
+                    <Property Name="DocumentSize" Value="0.11" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="ScrollPosition" Value="0" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="ClippedByParent" Value="False" />
+					<Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.7,0},{1,0},{0.85,0}}" />
+                </Window>
+				<Window Type="TaharezLook/StaticText" Name="Shadows/DepthShadowTweakGroup/SlopeClampText" >
+                    <Property Name="Font" Value="BlueHighway-10" />
+					<Property Name="Text" Value="" />
+                    <Property Name="FrameEnabled" Value="False" />
+                    <Property Name="InheritsAlpha" Value="False" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+					<Property Name="UnifiedAreaRect" Value="{{0.70,0},{0.825,0},{0.943746,0},{0.99,0}}" />
+                    <Property Name="BackgroundEnabled" Value="False" />
+                </Window>
+            </Window>
+        </Window>
+    </Window>
+</GUILayout>
Index: code/branches/resource2/data/gui/schemes/Demo8.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/Demo8.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/Demo8.scheme	(revision 5646)
@@ -0,0 +1,62 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="TaharezLook">
+	<Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
+	<Font Name="Commonwealth-10" Filename="Commonwealth-10.font" />
+	<LookNFeel Filename="TaharezLook.looknfeel" />
+	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+	
+	<FalagardMapping WindowType="TaharezLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
+
+	<FalagardMapping WindowType="TaharezLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping WindowType="TaharezLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
+
+	<FalagardMapping WindowType="TaharezLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
+
+	<FalagardMapping WindowType="TaharezLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping WindowType="TaharezLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="TaharezLook/MenuItem" />
+
+	<FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/VUMeter"              TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
+
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
+
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
+    <FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
+    <FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+
+	<FalagardMapping WindowType="TaharezLook/TabButtonPane"  TargetType="CEGUI/TabButton"  Renderer="Falagard/Default"  LookNFeel="TaharezLook/TabButtonPane" />
+	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
+    <FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
+    <FalagardMapping WindowType="TaharezLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabContentPane" />
+
+	<FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
+    <FalagardMapping WindowType="TaharezLook/ComboEditbox"  TargetType="CEGUI/Editbox"       Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
+    <FalagardMapping WindowType="TaharezLook/Combobox"      TargetType="CEGUI/Combobox"      Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
+
+	<FalagardMapping WindowType="TaharezLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping WindowType="TaharezLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="TaharezLook/ListHeader" />
+    <FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
+    <FalagardMapping WindowType="TaharezLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="TaharezLook/MultiColumnList" />
+
+	<FalagardMapping WindowType="TaharezLook/Slider"      TargetType="CEGUI/Slider"      Renderer="Falagard/Slider"  LookNFeel="TaharezLook/Slider" />
+    <FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/SliderThumb" Renderer="Falagard/Button"  LookNFeel="TaharezLook/SliderThumb" />
+
+	<FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
+	
+	<FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
+	
+	<FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
+
+	<FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
+    <FalagardMapping WindowType="TaharezLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="TaharezLook/StaticText" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/GUIScheme.xsd
===================================================================
--- code/branches/resource2/data/gui/schemes/GUIScheme.xsd	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/GUIScheme.xsd	(revision 5646)
@@ -0,0 +1,54 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+	<xsd:element name="GUIScheme" type="SchemeType" />
+	<xsd:complexType name="SchemeType">
+        <xsd:choice minOccurs="0" maxOccurs="unbounded">
+			<xsd:element name="Imageset" type="NamedDataType" />
+            <xsd:element name="ImagesetFromImage" type="NamedDataType" />
+			<xsd:element name="Font" type="NamedDataType" />
+            <xsd:element name="LookNFeel" type="FileDataType" />
+			<xsd:element name="WindowSet" type="WindowSetType" />
+			<xsd:element name="WindowRendererSet" type="WindowRendererSetType" />
+			<xsd:element name="WindowAlias" type="WindowAliasType" />
+            <xsd:element name="FalagardMapping" type="FalagardMapType" />
+		</xsd:choice>
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowFactory" type="WindowFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererSetType">
+		<xsd:sequence>
+            <xsd:element name="WindowRendererFactory" type="WindowRendererFactoryType" minOccurs="0" maxOccurs="unbounded" />
+		</xsd:sequence>
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FileDataType">
+        <xsd:attribute name="Filename" type="xsd:string" use="required" />
+        <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+    </xsd:complexType>
+	<xsd:complexType name="NamedDataType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+		<xsd:attribute name="Filename" type="xsd:string" use="required" />
+		<xsd:attribute name="ResourceGroup" type="xsd:string" use="optional"  default="" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowFactoryType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowRendererFactoryType">
+		<xsd:attribute name="Name" type="xsd:string" use="required" />
+	</xsd:complexType>
+	<xsd:complexType name="WindowAliasType">
+		<xsd:attribute name="Alias" type="xsd:string" use="required" />
+		<xsd:attribute name="Target" type="xsd:string" use="required" />
+	</xsd:complexType>
+    <xsd:complexType name="FalagardMapType">
+        <xsd:attribute name="WindowType" type="xsd:string" use="required" />
+        <xsd:attribute name="TargetType" type="xsd:string" use="required" />
+		<xsd:attribute name="Renderer" type="xsd:string" use="required" />
+        <xsd:attribute name="LookNFeel" type="xsd:string" use="required" />
+    </xsd:complexType>
+</xsd:schema>
Index: code/branches/resource2/data/gui/schemes/OrxonoxGUIScheme.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/OrxonoxGUIScheme.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/OrxonoxGUIScheme.scheme	(revision 5646)
@@ -0,0 +1,4 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="OrxonoxGUI">
+    <Imageset Name="MainMenuBackground" Filename="MainMenuBackground.imageset" ResourceGroup="General"/>
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/TaharezLook.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/TaharezLook.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/TaharezLook.scheme	(revision 5646)
@@ -0,0 +1,50 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="TaharezLook">
+	<Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
+	<Font Name="Commonwealth-10" Filename="Commonwealth-10.font" />
+	<LookNFeel Filename="TaharezLook.looknfeel" />
+	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+	<FalagardMapping WindowType="TaharezLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
+	<FalagardMapping WindowType="TaharezLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping WindowType="TaharezLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping WindowType="TaharezLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="TaharezLook/MenuItem" />
+	<FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/VUMeter"              TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
+	<FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
+	<FalagardMapping WindowType="TaharezLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabContentPane" />
+	<FalagardMapping WindowType="TaharezLook/TabButtonPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabButtonPane" />
+	<FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
+	<FalagardMapping WindowType="TaharezLook/ComboEditbox"  TargetType="CEGUI/Editbox"	 Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Combobox"	TargetType="CEGUI/Combobox"	 Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
+	<FalagardMapping WindowType="TaharezLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping WindowType="TaharezLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="TaharezLook/ListHeader" />
+	<FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
+	<FalagardMapping WindowType="TaharezLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="TaharezLook/MultiColumnList" />
+	<FalagardMapping WindowType="TaharezLook/Slider"      TargetType="CEGUI/Slider"      Renderer="Falagard/Slider"  LookNFeel="TaharezLook/Slider" />
+	<FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button"  LookNFeel="TaharezLook/SliderThumb" />
+	<FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
+	<FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
+	<FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
+	<FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
+	<FalagardMapping WindowType="TaharezLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="TaharezLook/StaticText" />
+	<FalagardMapping WindowType="TaharezLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="TaharezLook/ItemListbox" />
+	<FalagardMapping WindowType="TaharezLook/ListboxItem" TargetType="CEGUI/ItemEntry"   Renderer="Falagard/ItemEntry"   LookNFeel="TaharezLook/ListboxItem" />
+	<FalagardMapping WindowType="TaharezLook/GroupBox" TargetType="CEGUI/GroupBox"   Renderer="Falagard/Default"   LookNFeel="TaharezLook/GroupBox" />
+      <FalagardMapping WindowType="TaharezLook/Tree" TargetType="CEGUI/Tree"   Renderer="Falagard/Tree"   LookNFeel="TaharezLook/Tree" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/TaharezLookSkin.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/TaharezLookSkin.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/TaharezLookSkin.scheme	(revision 5646)
@@ -0,0 +1,48 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="TaharezLook">
+	<Imageset Name="TaharezLook" Filename="TaharezLook.imageset" />
+    <Font Name="BlueHighway-12" Filename="bluehighway-12.font" />
+    <Font Name="BlueHighway-10" Filename="bluehighway-10.font" />
+    <Font Name="BlueHighway-8" Filename="bluehighway-8.font" />
+	<LookNFeel Filename="TaharezLook.looknfeel" />
+	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+	<FalagardMapping WindowType="TaharezLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
+	<FalagardMapping WindowType="TaharezLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping WindowType="TaharezLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping WindowType="TaharezLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="TaharezLook/MenuItem" />
+	<FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/VUMeter"              TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
+	<FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
+	<FalagardMapping WindowType="TaharezLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabContentPane" />
+	<FalagardMapping WindowType="TaharezLook/TabButtonPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabButtonPane" />
+	<FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
+	<FalagardMapping WindowType="TaharezLook/ComboEditbox"  TargetType="CEGUI/Editbox"	 Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Combobox"	TargetType="CEGUI/Combobox"	 Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
+	<FalagardMapping WindowType="TaharezLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping WindowType="TaharezLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="TaharezLook/ListHeader" />
+	<FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
+	<FalagardMapping WindowType="TaharezLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="TaharezLook/MultiColumnList" />
+	<FalagardMapping WindowType="TaharezLook/Slider"      TargetType="CEGUI/Slider"      Renderer="Falagard/Slider"  LookNFeel="TaharezLook/Slider" />
+	<FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button"  LookNFeel="TaharezLook/SliderThumb" />
+	<FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
+	<FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
+	<FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
+	<FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
+	<FalagardMapping WindowType="TaharezLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="TaharezLook/StaticText" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/TaharezLookWidgetAliases.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/TaharezLookWidgetAliases.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/TaharezLookWidgetAliases.scheme	(revision 5646)
@@ -0,0 +1,36 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="TaharezLookWidgetAliases">
+	<WindowAlias Alias="Taharez AltProgressBar" Target="TaharezLook/AlternateProgressBar" />
+	<WindowAlias Alias="Taharez Button" Target="TaharezLook/Button" />
+	<WindowAlias Alias="Taharez Checkbox" Target="TaharezLook/Checkbox" />
+	<WindowAlias Alias="Taharez System Button" Target="TaharezLook/SystemButton" />
+	<WindowAlias Alias="Taharez Combobox" Target="TaharezLook/Combobox" />
+	<WindowAlias Alias="Taharez ComboDropList" Target="TaharezLook/ComboDropList" />
+	<WindowAlias Alias="Taharez ComboEditbox" Target="TaharezLook/ComboEditbox" />
+	<WindowAlias Alias="Taharez Editbox" Target="TaharezLook/Editbox" />
+	<WindowAlias Alias="Taharez Frame Window" Target="TaharezLook/FrameWindow" />
+	<WindowAlias Alias="Taharez Listbox" Target="TaharezLook/Listbox" />
+	<WindowAlias Alias="Taharez ListHeader" Target="TaharezLook/ListHeader" />
+	<WindowAlias Alias="Taharez ListHeaderSegment" Target="TaharezLook/ListHeaderSegment" />
+	<WindowAlias Alias="Taharez MiniHorzScrollbar" Target="TaharezLook/HorizontalScrollbar" />
+	<WindowAlias Alias="Taharez MiniHorzScrollbarThumb" Target="TaharezLook/HorizontalScrollbarThumb" />
+	<WindowAlias Alias="Taharez MiniVertScrollbar" Target="TaharezLook/VerticalScrollbar" />
+	<WindowAlias Alias="Taharez MiniVertScrollbarThumb" Target="TaharezLook/VerticalScrollbarThumb" />
+	<WindowAlias Alias="Taharez MultiColumnList" Target="TaharezLook/MultiColumnList" />
+	<WindowAlias Alias="Taharez MultiLineEditbox" Target="TaharezLook/MultiLineEditbox" />
+	<WindowAlias Alias="Taharez ProgressBar" Target="TaharezLook/ProgressBar" />
+	<WindowAlias Alias="Taharez RadioButton" Target="TaharezLook/RadioButton" />
+	<WindowAlias Alias="Taharez Slider" Target="TaharezLook/Slider" />
+	<WindowAlias Alias="Taharez Slider Thumb" Target="TaharezLook/SliderThumb" />
+	<WindowAlias Alias="Taharez StaticImage" Target="TaharezLook/StaticImage" />
+	<WindowAlias Alias="Taharez StaticText" Target="TaharezLook/StaticText" />
+	<WindowAlias Alias="Taharez Tab Button" Target="TaharezLook/TabButton" />
+	<WindowAlias Alias="Taharez Tab Pane" Target="TaharezLook/TabPane" />
+	<WindowAlias Alias="Taharez Tab Control" Target="TaharezLook/TabControl" />
+	<WindowAlias Alias="Taharez Titlebar" Target="TaharezLook/Titlebar" />
+	<WindowAlias Alias="Taharez VertScrollbar" Target="TaharezLook/LargeVerticalScrollbar" />
+	<WindowAlias Alias="Taharez VertScrollbarThumb" Target="TaharezLook/LargeVerticalScrollbarThumb" />
+	<WindowAlias Alias="Taharez GroupBox" Target="TaharezLook/GroupBox" />
+</GUIScheme>
+
+
Index: code/branches/resource2/data/gui/schemes/TaharezLookWidgets.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/TaharezLookWidgets.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/TaharezLookWidgets.scheme	(revision 5646)
@@ -0,0 +1,45 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="TaharezLookWidgets">
+	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+	<FalagardMapping WindowType="TaharezLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/Checkbox" />
+	<FalagardMapping WindowType="TaharezLook/ImageButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ImageButton" />
+	<FalagardMapping WindowType="TaharezLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="TaharezLook/RadioButton" />
+	<FalagardMapping WindowType="TaharezLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="TaharezLook/FrameWindow" />
+	<FalagardMapping WindowType="TaharezLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="TaharezLook/Titlebar" />
+	<FalagardMapping WindowType="TaharezLook/SystemButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="TaharezLook/Button" />
+	<FalagardMapping WindowType="TaharezLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="TaharezLook/Editbox" />
+	<FalagardMapping WindowType="TaharezLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="TaharezLook/MultiLineEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="TaharezLook/Menubar" />
+	<FalagardMapping WindowType="TaharezLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="TaharezLook/PopupMenu" />
+	<FalagardMapping WindowType="TaharezLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="TaharezLook/MenuItem" />
+	<FalagardMapping WindowType="TaharezLook/AlternateProgressBar" TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/AltProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/ProgressBar" />
+	<FalagardMapping WindowType="TaharezLook/VUMeter"              TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="TaharezLook/VUMeter" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/HorizontalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="TaharezLook/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbar"      TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="TaharezLook/LargeVerticalScrollbar" />
+	<FalagardMapping WindowType="TaharezLook/LargeVerticalScrollbarThumb" TargetType="CEGUI/Thumb"     Renderer="Falagard/Button"    LookNFeel="TaharezLook/LargeVerticalScrollbarThumb" />
+	<FalagardMapping WindowType="TaharezLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="TaharezLook/TabButton" />
+	<FalagardMapping WindowType="TaharezLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="TaharezLook/TabControl" />
+	<FalagardMapping WindowType="TaharezLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="TaharezLook/TabContentPane" />
+	<FalagardMapping WindowType="TaharezLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="TaharezLook/ComboDropList" />
+	<FalagardMapping WindowType="TaharezLook/ComboEditbox"  TargetType="CEGUI/Editbox"	 Renderer="Falagard/Editbox" LookNFeel="TaharezLook/ComboEditbox" />
+	<FalagardMapping WindowType="TaharezLook/Combobox"	TargetType="CEGUI/Combobox"	 Renderer="Falagard/Default" LookNFeel="TaharezLook/Combobox" />
+	<FalagardMapping WindowType="TaharezLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="TaharezLook/Listbox" />
+	<FalagardMapping WindowType="TaharezLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="TaharezLook/ListHeader" />
+	<FalagardMapping WindowType="TaharezLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="TaharezLook/ListHeaderSegment" />
+	<FalagardMapping WindowType="TaharezLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="TaharezLook/MultiColumnList" />
+	<FalagardMapping WindowType="TaharezLook/Slider"      TargetType="CEGUI/Slider" Renderer="Falagard/Slider"  LookNFeel="TaharezLook/Slider" />
+	<FalagardMapping WindowType="TaharezLook/SliderThumb" TargetType="CEGUI/Thumb"  Renderer="Falagard/Button"  LookNFeel="TaharezLook/SliderThumb" />
+	<FalagardMapping WindowType="TaharezLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="TaharezLook/ScrollablePane" />
+	<FalagardMapping WindowType="TaharezLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="TaharezLook/Spinner" />
+	<FalagardMapping WindowType="TaharezLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="TaharezLook/Tooltip" />
+	<FalagardMapping WindowType="TaharezLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="TaharezLook/StaticImage" />
+	<FalagardMapping WindowType="TaharezLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="TaharezLook/StaticText" />
+	<FalagardMapping WindowType="TaharezLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="TaharezLook/ItemListbox" />
+	<FalagardMapping WindowType="TaharezLook/ListboxItem" TargetType="CEGUI/ItemEntry"   Renderer="Falagard/ItemEntry"   LookNFeel="TaharezLook/ListboxItem" />
+    	<FalagardMapping WindowType="TaharezLook/GroupBox" TargetType="CEGUI/GroupBox"   Renderer="Falagard/Default"   LookNFeel="TaharezLook/GroupBox" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/VanillaSkin.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/VanillaSkin.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/VanillaSkin.scheme	(revision 5646)
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="VanillaSkin">
+	<Imageset Name="Vanilla-Images" Filename="Vanilla.imageset" />
+	<LookNFeel Filename="Vanilla.looknfeel" />
+	<WindowRendererSet Filename="CEGUIFalagardWRBase" />
+	<FalagardMapping WindowType="Vanilla/Titlebar" TargetType="CEGUI/Titlebar" Renderer="Falagard/Titlebar" LookNFeel="Vanilla/Titlebar" />
+	<FalagardMapping WindowType="Vanilla/Button" TargetType="CEGUI/PushButton" Renderer="Falagard/Button" LookNFeel="Vanilla/Button" />
+	<FalagardMapping WindowType="Vanilla/FrameWindow" TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow" LookNFeel="Vanilla/FrameWindow" />
+	<FalagardMapping WindowType="Vanilla/Editbox" TargetType="CEGUI/Editbox" Renderer="Falagard/Editbox" LookNFeel="Vanilla/Editbox" />
+	<FalagardMapping WindowType="Vanilla/VerticalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="Vanilla/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="Vanilla/VerticalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="Vanilla/VerticalScrollbar" />
+	<FalagardMapping WindowType="Vanilla/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="Vanilla/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="Vanilla/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="Vanilla/HorizontalScrollbar" />
+	<FalagardMapping WindowType="Vanilla/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="Vanilla/StaticImage" />
+	<FalagardMapping WindowType="Vanilla/StaticText" TargetType="DefaultWindow" Renderer="Falagard/StaticText" LookNFeel="Vanilla/StaticText" />
+	<FalagardMapping WindowType="Vanilla/Listbox" TargetType="CEGUI/Listbox" Renderer="Falagard/Listbox" LookNFeel="Vanilla/Listbox" />
+	<FalagardMapping WindowType="Vanilla/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="Vanilla/MultiLineEditbox" />
+<!--	
+	<FalagardMapping WindowType="Vanilla/ComboDropList" TargetType="Falagard/ComboDropList" LookNFeel="Vanilla/ComboDropList" />
+	<FalagardMapping WindowType="Vanilla/ComboboxButton" TargetType="Falagard/Button" LookNFeel="Vanilla/ComboboxButton" />
+	<FalagardMapping WindowType="Vanilla/Combobox" TargetType="Falagard/Combobox" LookNFeel="Vanilla/Combobox" />
+	<FalagardMapping WindowType="Vanilla/ProgressBar" TargetType="Falagard/ProgressBar" LookNFeel="Vanilla/ProgressBar" />
+	<FalagardMapping WindowType="Vanilla/ScrollablePane" TargetType="Falagard/ScrollablePane" LookNFeel="Vanilla/ScrollablePane" />
+	<FalagardMapping WindowType="Vanilla/Checkbox" TargetType="Falagard/Checkbox" LookNFeel="Vanilla/Checkbox" />
+	<FalagardMapping WindowType="Vanilla/RadioButton" TargetType="Falagard/RadioButton" LookNFeel="Vanilla/RadioButton" />
+	<FalagardMapping WindowType="Vanilla/ScrollablePane" TargetType="Falagard/ScrollablePane" LookNFeel="Vanilla/ScrollablePane" />
+-->
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/WindowsLook.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/WindowsLook.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/WindowsLook.scheme	(revision 5646)
@@ -0,0 +1,44 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="WindowsLookSkin">
+	<Imageset Name="WindowsLook" Filename="WindowsLook.imageset" />
+	<LookNFeel Filename="WindowsLook.looknfeel" />
+	<WindowSet Filename="CEGUIFalagardWRBase" />
+	<FalagardMapping WindowType="WindowsLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="WindowsLook/Button" />
+	<FalagardMapping WindowType="WindowsLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="WindowsLook/Checkbox" />
+	<FalagardMapping WindowType="WindowsLook/IconButton"  TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="WindowsLook/IconButton" />
+	<FalagardMapping WindowType="WindowsLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="WindowsLook/RadioButton" />
+	<FalagardMapping WindowType="WindowsLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="WindowsLook/FrameWindow" />
+	<FalagardMapping WindowType="WindowsLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="WindowsLook/Titlebar" />
+	<FalagardMapping WindowType="WindowsLook/SystemButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="WindowsLook/SystemButton" />
+	<FalagardMapping WindowType="WindowsLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="WindowsLook/Editbox" />
+	<FalagardMapping WindowType="WindowsLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="WindowsLook/MultiLineEditbox" />
+	<FalagardMapping WindowType="WindowsLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="WindowsLook/Menubar" />
+	<FalagardMapping WindowType="WindowsLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="WindowsLook/PopupMenu" />
+	<FalagardMapping WindowType="WindowsLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="WindowsLook/MenuItem" />
+	<FalagardMapping WindowType="WindowsLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="WindowsLook/ProgressBar" />
+	<FalagardMapping WindowType="WindowsLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="WindowsLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="WindowsLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="WindowsLook/HorizontalScrollbar" />
+	<FalagardMapping WindowType="WindowsLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="WindowsLook/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="WindowsLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="WindowsLook/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="WindowsLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="WindowsLook/TabButton" />
+	<FalagardMapping WindowType="WindowsLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="WindowsLook/TabControl" />
+	<FalagardMapping WindowType="WindowsLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="WindowsLook/TabContentPane" />
+	<FalagardMapping WindowType="WindowsLook/TabButtonPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="WindowsLook/TabButtonPane" />
+	<FalagardMapping WindowType="WindowsLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="WindowsLook/ComboDropList" />
+	<FalagardMapping WindowType="WindowsLook/Combobox"	TargetType="CEGUI/Combobox"	 Renderer="Falagard/Default" LookNFeel="WindowsLook/Combobox" />
+	<FalagardMapping WindowType="WindowsLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="WindowsLook/Listbox" />
+	<FalagardMapping WindowType="WindowsLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="WindowsLook/ListHeader" />
+	<FalagardMapping WindowType="WindowsLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="WindowsLook/ListHeaderSegment" />
+	<FalagardMapping WindowType="WindowsLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="WindowsLook/MultiColumnList" />
+	<FalagardMapping WindowType="WindowsLook/Slider"      TargetType="CEGUI/Slider" Renderer="Falagard/Slider"  LookNFeel="WindowsLook/Slider" />
+	<FalagardMapping WindowType="WindowsLook/SliderThumb" TargetType="CEGUI/Thumb"  Renderer="Falagard/Button"  LookNFeel="WindowsLook/SliderThumb" />
+	<FalagardMapping WindowType="WindowsLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="WindowsLook/ScrollablePane" />
+	<FalagardMapping WindowType="WindowsLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="WindowsLook/Spinner" />
+	<FalagardMapping WindowType="WindowsLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="WindowsLook/Tooltip" />
+	<FalagardMapping WindowType="WindowsLook/Static"      TargetType="DefaultWindow" Renderer="Falagard/Static"      LookNFeel="WindowsLook/Static" />
+	<FalagardMapping WindowType="WindowsLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="WindowsLook/StaticImage" />
+	<FalagardMapping WindowType="WindowsLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="WindowsLook/StaticText" />
+	<FalagardMapping WindowType="WindowsLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="WindowsLook/ItemListbox" />
+	<FalagardMapping WindowType="WindowsLook/ListboxItem" TargetType="CEGUI/ItemEntry"   Renderer="Falagard/ItemEntry"   LookNFeel="WindowsLook/ListboxItem" />
+	<FalagardMapping WindowType="WindowsLook/GroupBox" TargetType="CEGUI/GroupBox"   Renderer="Falagard/Default"   LookNFeel="WindowsLook/GroupBox" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/schemes/WindowsLookWidgets.scheme
===================================================================
--- code/branches/resource2/data/gui/schemes/WindowsLookWidgets.scheme	(revision 5646)
+++ code/branches/resource2/data/gui/schemes/WindowsLookWidgets.scheme	(revision 5646)
@@ -0,0 +1,41 @@
+<?xml version="1.0" ?>
+<GUIScheme Name="WindowsLookWidgets">
+	<WindowSet Filename="CEGUIFalagardWRBase" />
+    <FalagardMapping WindowType="WindowsLook/Button"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="WindowsLook/Button" />
+	<FalagardMapping WindowType="WindowsLook/Checkbox"    TargetType="CEGUI/Checkbox"    Renderer="Falagard/ToggleButton" LookNFeel="WindowsLook/Checkbox" />
+	<FalagardMapping WindowType="WindowsLook/IconButton"  TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="WindowsLook/IconButton" />
+	<FalagardMapping WindowType="WindowsLook/RadioButton" TargetType="CEGUI/RadioButton" Renderer="Falagard/ToggleButton" LookNFeel="WindowsLook/RadioButton" />
+	<FalagardMapping WindowType="WindowsLook/FrameWindow"  TargetType="CEGUI/FrameWindow" Renderer="Falagard/FrameWindow"  LookNFeel="WindowsLook/FrameWindow" />
+	<FalagardMapping WindowType="WindowsLook/Titlebar"     TargetType="CEGUI/Titlebar"    Renderer="Falagard/Titlebar"     LookNFeel="WindowsLook/Titlebar" />
+	<FalagardMapping WindowType="WindowsLook/CloseButton" TargetType="CEGUI/PushButton"  Renderer="Falagard/SystemButton" LookNFeel="WindowsLook/CloseButton" />
+	<FalagardMapping WindowType="WindowsLook/Editbox"          TargetType="CEGUI/Editbox"          Renderer="Falagard/Editbox"          LookNFeel="WindowsLook/Editbox" />
+	<FalagardMapping WindowType="WindowsLook/MultiLineEditbox" TargetType="CEGUI/MultiLineEditbox" Renderer="Falagard/MultiLineEditbox" LookNFeel="WindowsLook/MultiLineEditbox" />
+	<FalagardMapping WindowType="WindowsLook/Menubar"   TargetType="CEGUI/Menubar"   Renderer="Falagard/Menubar"   LookNFeel="WindowsLook/Menubar" />
+	<FalagardMapping WindowType="WindowsLook/PopupMenu" TargetType="CEGUI/PopupMenu" Renderer="Falagard/PopupMenu" LookNFeel="WindowsLook/PopupMenu" />
+	<FalagardMapping WindowType="WindowsLook/MenuItem"  TargetType="CEGUI/MenuItem"  Renderer="Falagard/MenuItem"  LookNFeel="WindowsLook/MenuItem" />
+	<FalagardMapping WindowType="WindowsLook/ProgressBar"          TargetType="CEGUI/ProgressBar" Renderer="Falagard/ProgressBar" LookNFeel="WindowsLook/ProgressBar" />
+	<FalagardMapping WindowType="WindowsLook/VerticalScrollbar"   TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="WindowsLook/VerticalScrollbar" />
+	<FalagardMapping WindowType="WindowsLook/HorizontalScrollbar" TargetType="CEGUI/Scrollbar" Renderer="Falagard/Scrollbar" LookNFeel="WindowsLook/HorizontalScrollbar" />
+	<FalagardMapping WindowType="WindowsLook/VerticalScrollbarThumb"   TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="WindowsLook/VerticalScrollbarThumb" />
+	<FalagardMapping WindowType="WindowsLook/HorizontalScrollbarThumb" TargetType="CEGUI/Thumb" Renderer="Falagard/Button" LookNFeel="WindowsLook/HorizontalScrollbarThumb" />
+	<FalagardMapping WindowType="WindowsLook/TabButton"  TargetType="CEGUI/TabButton"  Renderer="Falagard/TabButton"  LookNFeel="WindowsLook/TabButton" />
+	<FalagardMapping WindowType="WindowsLook/TabControl" TargetType="CEGUI/TabControl" Renderer="Falagard/TabControl" LookNFeel="WindowsLook/TabControl" />
+	<FalagardMapping WindowType="WindowsLook/TabContentPane"    TargetType="DefaultWindow"    Renderer="Falagard/Default"    LookNFeel="WindowsLook/TabContentPane" />
+	<FalagardMapping WindowType="WindowsLook/ComboDropList" TargetType="CEGUI/ComboDropList" Renderer="Falagard/Listbox" LookNFeel="WindowsLook/ComboDropList" />
+	<FalagardMapping WindowType="WindowsLook/Combobox"	TargetType="CEGUI/Combobox"	 Renderer="Falagard/Default" LookNFeel="WindowsLook/Combobox" />
+	<FalagardMapping WindowType="WindowsLook/Listbox"           TargetType="CEGUI/Listbox"           Renderer="Falagard/Listbox"           LookNFeel="WindowsLook/Listbox" />
+	<FalagardMapping WindowType="WindowsLook/ListHeader"        TargetType="CEGUI/ListHeader"        Renderer="Falagard/ListHeader"        LookNFeel="WindowsLook/ListHeader" />
+	<FalagardMapping WindowType="WindowsLook/ListHeaderSegment" TargetType="CEGUI/ListHeaderSegment" Renderer="Falagard/ListHeaderSegment" LookNFeel="WindowsLook/ListHeaderSegment" />
+	<FalagardMapping WindowType="WindowsLook/MultiColumnList"   TargetType="CEGUI/MultiColumnList"   Renderer="Falagard/MultiColumnList"   LookNFeel="WindowsLook/MultiColumnList" />
+	<FalagardMapping WindowType="WindowsLook/Slider"      TargetType="CEGUI/Slider" Renderer="Falagard/Slider"  LookNFeel="WindowsLook/Slider" />
+	<FalagardMapping WindowType="WindowsLook/SliderThumb" TargetType="CEGUI/Thumb"  Renderer="Falagard/Button"  LookNFeel="WindowsLook/SliderThumb" />
+	<FalagardMapping WindowType="WindowsLook/ScrollablePane" TargetType="CEGUI/ScrollablePane" Renderer="Falagard/ScrollablePane" LookNFeel="WindowsLook/ScrollablePane" />
+	<FalagardMapping WindowType="WindowsLook/Spinner" TargetType="CEGUI/Spinner" Renderer="Falagard/Default" LookNFeel="WindowsLook/Spinner" />
+	<FalagardMapping WindowType="WindowsLook/Tooltip" TargetType="CEGUI/Tooltip" Renderer="Falagard/Tooltip" LookNFeel="WindowsLook/Tooltip" />
+	<FalagardMapping WindowType="WindowsLook/Static"      TargetType="DefaultWindow" Renderer="Falagard/Static"      LookNFeel="WindowsLook/Static" />
+	<FalagardMapping WindowType="WindowsLook/StaticImage" TargetType="DefaultWindow" Renderer="Falagard/StaticImage" LookNFeel="WindowsLook/StaticImage" />
+	<FalagardMapping WindowType="WindowsLook/StaticText"  TargetType="DefaultWindow" Renderer="Falagard/StaticText"  LookNFeel="WindowsLook/StaticText" />
+	<FalagardMapping WindowType="WindowsLook/ItemListbox" TargetType="CEGUI/ItemListbox" Renderer="Falagard/ItemListbox" LookNFeel="WindowsLook/ItemListbox" />
+	<FalagardMapping WindowType="WindowsLook/ListboxItem" TargetType="CEGUI/ItemEntry"   Renderer="Falagard/ItemEntry"   LookNFeel="WindowsLook/ListboxItem" />
+	<FalagardMapping WindowType="WindowsLook/GroupBox" TargetType="CEGUI/GroupBox"   Renderer="Falagard/Default"   LookNFeel="WindowsLook/GroupBox" />
+</GUIScheme>
Index: code/branches/resource2/data/gui/scripts/IConsole.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/IConsole.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/IConsole.lua	(revision 5646)
@@ -0,0 +1,50 @@
+--- Event Handlers ---
+
+---------------------------------------------------------
+---	Event to handle when "Return" is hit in the edit box
+--- Input Window: Console/Frame/Input
+---------------------------------------------------------
+function handleEntryAccepted(args)
+	-- Get a pointer to the input editbox
+	local input = this:getWindow() 
+	-- Get a pointer to the output MLEditbox
+	local output = this:getWindow("Console/Frame/ConsoleText")
+	
+	-- Retrieve the Text from the edit box
+	local instr = input:getText()
+		
+	-- Set the Editbox text to an empty string to clear out the entry
+	input:setText("")
+	
+	-- set the text in the output box to its current text + the new text.
+	output:setText(string.format("%s%s",output:getText(),instr))
+	
+	--Done!
+end
+
+function update(args)
+   --Yatta! -- this is called every frame -- Put somthing interesting here!
+end
+
+--- End Event Handlers ---
+
+--- Entry Point ---
+local winMgr = CEGUI.WindowManager:getSingleton()
+
+--- Load the xml for the instanced window we want, specifying true
+--- indicates that we are making an instanced window and the system will
+--- autogenerate a prefix for us.
+local root = winMgr:loadWindowLayout("Console.wnd",true)
+
+--- Since we are just now creating this window, there is no 'this' pointer
+--- for us to use. Instead since now we want to set the events we will use
+--- the getChild function which will recursivly search from the given node down
+--- until it find the window... it will throw an exception.
+root:getChild("Console/Frame/Input"):subscribeEvent("TextAccepted",handleEntryAccepted)
+
+--- This event is the window update event, it is called every frame
+root:subscribeEvent("WindowUpdate",update)
+
+-- Add it to the default GUI sheet
+CEGUI.System:getSingleton():getGUISheet():addChildWindow(root)
+	
Index: code/branches/resource2/data/gui/scripts/InstancedInit.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/InstancedInit.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/InstancedInit.lua	(revision 5646)
@@ -0,0 +1,19 @@
+--- Init Script for Instanced Windows Demo ---
+local guiSystem = CEGUI.System:getSingleton()
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+local winMgr = CEGUI.WindowManager:getSingleton()
+
+-- Load a Scheme File
+schemeMgr:loadScheme("TaharezLook.scheme")
+-- Setup Mouse Pointer
+guiSystem:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+-- Setup a DefaultSheet
+local root = winMgr:createWindow("DefaultWindow","RootNode")
+local xx = CEGUI.UDim(1,0)
+local yy = CEGUI.UDim(1,0)
+local zz = CEGUI.UVector2(xx,yy)
+root:setSize(zz)
+guiSystem:setGUISheet(root)
+-- set the Tooltip type
+guiSystem:setDefaultTooltip("TaharezLook/Tooltip")
+-- Done!
Index: code/branches/resource2/data/gui/scripts/PickupInventory.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/PickupInventory.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/PickupInventory.lua	(revision 5646)
@@ -0,0 +1,63 @@
+gui = require("gui")
+local P = gui:new() --inherit everything from the gui package
+
+PickupInventory = P
+
+P.filename = "PickupInventory"
+P.layoutString = "PickupInventory.layout"
+
+P.lastEquipmentCount_ = 0
+P.lastUsableCount_ = 0
+P.currentUsableID_ = 0
+
+-- events
+function P:frmUpdate(e)
+    local equipCount = orxonox.PickupInventory:getEquipmentCount()
+    local usableCount = orxonox.PickupInventory:getUsableCount()
+    
+    if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
+        self:updateTabs()
+    end
+end
+
+function P.update(e)
+    loadedGUIs["PickupInventory"]:frmUpdate(e)
+end
+
+function P.itemClicked(e)
+    loadedGUIs["PickupInventory"]:mItemClicked(e)
+end
+
+function P:mItemClicked(e)
+    local w = CEGUI.toWindowEventArgs(e).window
+    local name = w:getName()
+    local t = name:sub(25, 27)
+    local i = name:sub(29)
+    
+    if t == "equ" then
+        
+    end
+    
+    if t == "use" then
+        if self.currentUsableID_ >= 0 then
+            winMgr:getWindow("orxonox/Inventory/Title/use/" .. self.currentUsableID_):setProperty("TextColours", "tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+        end
+        orxonox.PickupInventory:selectUsable(tonumber(i))
+        self.currentUsableID_ = tonumber(i)
+        winMgr:getWindow("orxonox/Inventory/Title/use/" .. i):setProperty("TextColours", "tl:FFFF4444 tr:FFFF4444 bl:FFFF4444 br:FFFF4444")
+    end
+end
+
+-- methods
+function P:updateTabs()
+    local eqWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabEquipment")
+    local usWin = winMgr:getWindow("orxonox/Inventory/TabControl/TabUsable")
+    orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin)
+    orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
+    
+    self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
+    self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
+    self.lastUsableCount_ = orxonox.PickupInventory:getUsableCount()
+end
+
+return PickupInventory
Index: code/branches/resource2/data/gui/scripts/demo8.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/demo8.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/demo8.lua	(revision 5646)
@@ -0,0 +1,83 @@
+-----------------------------------------
+-- Start of handler functions
+-----------------------------------------
+-----------------------------------------
+-- Alpha slider handler (not used!)
+-----------------------------------------
+function sliderHandler(args)
+    CEGUI.System:getSingleton():getGUISheet():setAlpha(CEGUI.toSlider(CEGUI.toWindowEventArgs(args).window):getCurrentValue())
+end
+
+-----------------------------------------
+-- Handler to slide pane
+--
+-- Here we move the 'Demo8' sheet window
+-- and re-position the scrollbar
+-----------------------------------------
+function panelSlideHandler(args)
+    local scroller = CEGUI.toScrollbar(CEGUI.toWindowEventArgs(args).window)
+    local demoWnd = CEGUI.WindowManager:getSingleton():getWindow("Demo8")
+
+    local relHeight = demoWnd:getHeight():asRelative(demoWnd:getParentPixelHeight())
+
+    scroller:setPosition(CEGUI.UVector2(CEGUI.UDim(0,0), CEGUI.UDim(scroller:getScrollPosition() / relHeight,0)))
+    demoWnd:setPosition(CEGUI.UVector2(CEGUI.UDim(0,0), CEGUI.UDim(-scroller:getScrollPosition(),0)))
+end
+
+-----------------------------------------
+-- Handler to set preview colour when
+-- colour selector scrollers change
+-----------------------------------------
+function colourChangeHandler(args)
+    local winMgr = CEGUI.WindowManager:getSingleton()
+    
+    local r = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Red")):getScrollPosition()
+    local g = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Green")):getScrollPosition()
+    local b = CEGUI.toScrollbar(winMgr:getWindow("Demo8/Window1/Controls/Blue")):getScrollPosition()
+    local col = CEGUI.colour:new_local(r, g, b, 1)
+    local crect = CEGUI.ColourRect(col)
+
+    winMgr:getWindow("Demo8/Window1/Controls/ColourSample"):setProperty("ImageColours", CEGUI.PropertyHelper:colourRectToString(crect))
+end
+
+
+-----------------------------------------
+-- Handler to add an item to the box
+-----------------------------------------
+function addItemHandler(args)
+    local winMgr = CEGUI.WindowManager:getSingleton()
+
+    local text = winMgr:getWindow("Demo8/Window1/Controls/Editbox"):getText()
+    local cols = CEGUI.PropertyHelper:stringToColourRect(winMgr:getWindow("Demo8/Window1/Controls/ColourSample"):getProperty("ImageColours"))
+
+    local newItem = CEGUI.createListboxTextItem(text, 0, nil, false, true)
+    newItem:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+    newItem:setSelectionColours(cols)
+
+    CEGUI.toListbox(winMgr:getWindow("Demo8/Window1/Listbox")):addItem(newItem)
+end
+
+-----------------------------------------
+-- Script Entry Point
+-----------------------------------------
+local guiSystem = CEGUI.System:getSingleton()
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+local winMgr = CEGUI.WindowManager:getSingleton()
+
+-- load our demo8 scheme
+schemeMgr:loadScheme("Demo8.scheme");
+-- load our demo8 window layout
+local root = winMgr:loadWindowLayout("Demo8.layout")
+-- set the layout as the root
+guiSystem:setGUISheet(root)
+-- set default mouse cursor
+guiSystem:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+-- set the Tooltip type
+guiSystem:setDefaultTooltip("TaharezLook/Tooltip")
+
+-- subscribe required events
+winMgr:getWindow("Demo8/ViewScroll"):subscribeEvent("ScrollPosChanged", "panelSlideHandler")
+winMgr:getWindow("Demo8/Window1/Controls/Blue"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
+winMgr:getWindow("Demo8/Window1/Controls/Red"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
+winMgr:getWindow("Demo8/Window1/Controls/Green"):subscribeEvent("ScrollPosChanged", "colourChangeHandler")
+winMgr:getWindow("Demo8/Window1/Controls/Add"):subscribeEvent("Clicked", "addItemHandler")
Index: code/branches/resource2/data/gui/scripts/gui.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/gui.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/gui.lua	(revision 5646)
@@ -0,0 +1,42 @@
+-- gui.lua
+
+local P = {}
+if _REQUIREDNAME == nil then
+    gui = P
+else
+    _G[_REQUIREDNAME] = P
+end
+
+P.overlay = nil
+
+-- constructor of the GUI
+function P:new (gui, fname)
+    local newElement = { window = gui, filename = fname, visible = false } or {}
+    setmetatable(newElement, self) -- connects new element with class
+    self.__index = self
+    return newElement
+end
+
+function P:init()
+-- this function is empty and intended for inheriting GUIs to use
+end
+
+-- hide function for the GUI
+function P:hide ()
+    self.window:hide()
+    self.visible = false
+end
+
+-- show function for the GUI
+function P:show ()
+    self.window:show()
+    self.visible = true
+end
+
+function P:load ()
+    self.window = winMgr:loadWindowLayout(self.layoutString)
+    self:init()
+    return self
+end
+
+return gui or _G[_REQUIREDNAME]
Index: code/branches/resource2/data/gui/scripts/inGameTest.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/inGameTest.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/inGameTest.lua	(revision 5646)
@@ -0,0 +1,1 @@
+layoutPath = "InGameTest.layout"
Index: code/branches/resource2/data/gui/scripts/loadGUI.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/loadGUI.lua	(revision 5646)
@@ -0,0 +1,106 @@
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+local winMgr = CEGUI.WindowManager:getSingleton()
+local logger = CEGUI.Logger:getSingleton()
+local system = CEGUI.System:getSingleton()
+
+schemeMgr:loadScheme("TaharezLookSkin.scheme")
+system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+system:setDefaultFont("BlueHighway-12")
+
+
+local rootSheet = winMgr:createWindow("DefaultGUISheet", "orxonox/Sheet")
+
+local leftOffset = 0.11
+local topOffset  = 0.3
+local distance   = 0.076
+local index      = 0
+
+local standalone = winMgr:createWindow("TaharezLook/Button", "orxonox/StandaloneButton")
+standalone:setText("Standalone")
+standalone:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
+standalone:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
+standalone:subscribeEvent("Clicked","button_standalone_clicked")
+index = index + 1
+
+local dedicated = winMgr:createWindow("TaharezLook/Button", "orxonox/DedicatedButton")
+dedicated:setText("Dedicated")
+dedicated:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
+dedicated:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
+dedicated:subscribeEvent("Clicked","button_dedicated_clicked")
+index = index + 1
+
+local server = winMgr:createWindow("TaharezLook/Button", "orxonox/ServerButton")
+server:setText("Server")
+server:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
+server:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
+server:subscribeEvent("Clicked","button_server_clicked")
+index = index + 1
+
+local client = winMgr:createWindow("TaharezLook/Button", "orxonox/ClientButton")
+client:setText("Client")
+client:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
+client:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
+client:subscribeEvent("Clicked","button_client_clicked")
+index = index + 1
+
+local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton")
+quit:setText("Quit")
+quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
+quit:setPosition(CEGUI.UVector2(CEGUI.UDim(leftOffset, 0), CEGUI.UDim(topOffset + index * distance, 0)))
+quit:subscribeEvent("Clicked","button_quit_clicked")
+index = index + 1
+
+local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "main_menu_1.jpg")
+local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background")
+background:setProperty("FrameEnabled", "set: true")
+background:setProperty("BackgroundEnabled", "set: false")
+background:setProperty("Image", "set: GUI/Background image:full_image")
+
+rootSheet:addChildWindow(quit)
+rootSheet:addChildWindow(standalone)
+rootSheet:addChildWindow(server)
+rootSheet:addChildWindow(dedicated)
+rootSheet:addChildWindow(client)
+background:addChildWindow(rootSheet)
+
+
+function button_quit_clicked(e)
+  hideGUI()
+  orxonox.CommandExecutor:execute("exit")
+end
+
+function button_standalone_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState standalone")
+  hideGUI()
+end
+
+function button_server_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState server")
+  hideGUI()
+end
+
+function button_dedicated_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState dedicated")
+  hideGUI()
+end
+
+function button_client_clicked(e)
+  orxonox.CommandExecutor:execute("selectGameState client")
+  hideGUI()
+end
+
+showBackground = false
+
+function showMainMenu()
+  if showBackground == true then
+    system:setGUISheet(background)
+  else
+    system:setGUISheet(rootSheet)
+  end
+  return 0;
+end
+
+function hideGUI()
+  system:setGUISheet(nil)
+  orxonox.GUIManager:getInstance():hideGUI()
+end
Index: code/branches/resource2/data/gui/scripts/loadGUI_2.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI_2.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/loadGUI_2.lua	(revision 5646)
@@ -0,0 +1,104 @@
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+local winMgr = CEGUI.WindowManager:getSingleton()
+local logger = CEGUI.Logger:getSingleton()
+local system = CEGUI.System:getSingleton()
+local cursor = CEGUI.MouseCursor:getSingleton()
+
+schemeMgr:loadScheme("TaharezLookSkin.scheme")
+-- load scheme with our own images
+schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
+
+system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+system:setDefaultFont("BlueHighway-12")
+
+local current = nil
+local loadedGUIs = {}
+-- a bit more complex: GUI is now a class
+GUI = {}
+GUI.__index = GUI
+
+-- hide function for the GUI
+GUI.hide = function (self)
+    self.window:hide()
+end
+
+-- show function for the GUI
+GUI.show = function (self)
+    self.window:show()
+end
+
+-- constructor of the GUI
+GUI.new = function (gui, fname)
+    local newElement = { window = gui, filename = fname }
+    setmetatable(newElement, GUI) -- connects new element with class
+    return newElement
+end
+
+datapath = "" -- points to media-folder (set after loading the script)
+
+-- loads the GUI with the specified filename
+-- be sure to set the global variable "filename" before calling this function
+function loadGUI(filename)
+    -- check if it already exists
+    --gui = loadedGUIs:getGUIbyName(filename)
+    gui = loadedGUIs[filename]
+    if gui == nil then
+        dofile(datapath .. "gui/scripts/" .. filename .. ".lua")
+        win = winMgr:loadWindowLayout(layoutPath)
+        gui = GUI.new(win, filename)
+        loadedGUIs[filename] = gui
+        -- if there has no GUI been loaded yet, set new GUI as current
+        if table.getn(loadedGUIs) == 1 then
+            current = loadedGUIs[1]
+            showing = false
+        end
+        -- hide new GUI as we do not want to show it accidentially
+        gui:hide()
+    end
+    return gui
+end
+
+-- shows the specified and loads it if not loaded already
+-- be sure to set the global variable "filename" before calling this function
+function showGUI(filename)
+    if current == nil or current.filename ~= filename then
+        if current ~= nil then
+        end
+        current = loadedGUIs[filename]
+        if current == nil then
+            current = loadGUI(filename)
+        end
+        system:setGUISheet(current.window)
+    end
+    current:show()
+    showing = true
+end
+
+function toggleGUI()
+    if showing == true then
+        current:hide()
+        cursor:hide()
+        showing = false
+    else
+        current:show()
+        cursor:show()
+        showing = true
+    end
+    return showing
+end
+
+function hideCursor()
+    cursor:hide()
+end
+
+function showCursor()
+    cursor:show()
+end
+
+function hideGUI(filename)
+    current = loadedGUIs[filename]
+    if current ~= nil then
+        current:hide()
+        showing = false
+    end
+end
Index: code/branches/resource2/data/gui/scripts/loadGUI_3.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/loadGUI_3.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/loadGUI_3.lua	(revision 5646)
@@ -0,0 +1,87 @@
+local schemeMgr = CEGUI.SchemeManager:getSingleton()
+winMgr = CEGUI.WindowManager:getSingleton()
+local logger = CEGUI.Logger:getSingleton()
+local system = CEGUI.System:getSingleton()
+local cursor = CEGUI.MouseCursor:getSingleton()
+
+schemeMgr:loadScheme("TaharezLookSkin.scheme")
+-- load scheme with our own images
+schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
+
+system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
+system:setDefaultFont("BlueHighway-12")
+system:setDefaultTooltip("TaharezLook/Tooltip")
+
+loadedGUIs = {}
+
+-- datapath is set before executing the script and points to media-folder
+package.path = package.path .. ";" .. datapath .. "gui/scripts/?.lua"
+
+-- loads the GUI with the specified filename
+-- be sure to set the global variable "filename" before calling this function
+function loadGUI(filename)
+    -- check if it already exists
+    loadedGui = loadedGUIs[filename]
+    if loadedGui == nil then
+        loadedGuiNS = require(filename)
+        loadedGui = loadedGuiNS:load()
+        loadedGUIs[filename] = loadedGui
+        -- if there has no GUI been loaded yet, set new GUI as current
+        if table.getn(loadedGUIs) == 1 then
+            current = loadedGUIs[1]
+            showing = false
+        end
+        -- hide new GUI as we do not want to show it accidentially
+        loadedGui:hide()
+    end
+    return loadedGui
+end
+
+function showGUI(filename, ptr)
+    gui = showGUI(filename)
+    gui.overlay = ptr
+end
+
+-- shows the specified and loads it if not loaded already
+-- be sure to set the global variable "filename" before calling this function
+function showGUI(filename)
+    if current == nil or current.filename ~= filename then
+        current = loadedGUIs[filename]
+        if current == nil then
+            current = loadGUI(filename)
+        end
+        system:setGUISheet(current.window)
+    end
+    current:show()
+    showing = true
+    return current
+end
+
+function toggleGUI()
+    if showing == true then
+        current:hide()
+        cursor:hide()
+        showing = false
+    else
+        current:show()
+        cursor:show()
+        showing = true
+    end
+    return showing
+end
+
+function hideCursor()
+    cursor:hide()
+end
+
+function showCursor()
+    cursor:show()
+end
+
+function hideGUI(filename)
+    current = loadedGUIs[filename]
+    if current ~= nil then
+        current:hide()
+        showing = false
+    end
+end
Index: code/branches/resource2/data/gui/scripts/mainmenu.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/mainmenu.lua	(revision 5646)
@@ -0,0 +1,27 @@
+layoutPath = "MainMenu.layout"
+
+-- events for mainmenu
+function button_quit_clicked(e)
+  hideGUI()
+  orxonox.CommandExecutor:execute("exit")
+end
+
+function button_standalone_clicked(e)
+  orxonox.CommandExecutor:execute("startGame")
+  toggleGUI()
+end
+
+function button_server_clicked(e)
+  orxonox.CommandExecutor:execute("echo Not yet supported!")
+  hideGUI()
+end
+
+function button_dedicated_clicked(e)
+  orxonox.CommandExecutor:execute("echo Not yet supported!")
+  hideGUI()
+end
+
+function button_client_clicked(e)
+  orxonox.CommandExecutor:execute("echo Not yet supported!")
+  hideGUI()
+end
Index: code/branches/resource2/data/gui/scripts/mainmenu_2.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_2.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/mainmenu_2.lua	(revision 5646)
@@ -0,0 +1,77 @@
+-- mainmenu_2.lua
+gui = require("gui")
+local P = gui:new() --inherit everything from the gui package
+
+mainmenu_2 = P
+
+P.filename = "mainmenu_2"
+P.layoutString = "MainMenu_2.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/LevelListbox")
+    preselect = orxonox.Game:getInstance():getLevel()
+    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
+    table.sort(levellist)
+    for k,v in pairs(levellist) do
+        item = CEGUI.createListboxTextItem(v)        
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listbox):addItem(item)
+        if v .. ".oxw" == preselect then
+            listbox:setItemSelectState(item, true)
+        end
+    end
+end
+
+
+-- events for mainmenu
+function P.button_quit_clicked(e)
+    hideGUI()
+    orxonox.CommandExecutor:execute("exit")
+end
+
+function P.button_standalone_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startGame")
+        toggleGUI()
+    end
+end
+
+function P.button_server_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startServer")
+        toggleGUI()
+    end
+end
+
+function P.button_dedicated_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startDedicated")
+        toggleGUI()
+    end
+end
+
+function P.button_client_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.Game:getInstance():setLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startClient")
+        toggleGUI()
+    end
+end
+
+function P.listbox_level_selectionchanged(e)
+    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
+        winMgr:getWindow("orxonox/StandaloneButton"):enable()
+    else
+        winMgr:getWindow("orxonox/StandaloneButton"):disable()
+    end
+end
+
+return mainmenu_2
+
Index: code/branches/resource2/data/gui/scripts/mainmenu_3.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_3.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/mainmenu_3.lua	(revision 5646)
@@ -0,0 +1,77 @@
+-- mainmenu_2.lua
+gui = require("gui")
+local P = gui:new() --inherit everything from the gui package
+
+mainmenu_2 = P
+
+P.filename = "mainmenu_2"
+P.layoutString = "MainMenu_2.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/LevelListbox")
+    preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
+    orxonox.GUIManager:getInstance():getLevelList() --levellist variable ist set now
+    table.sort(levellist)
+    for k,v in pairs(levellist) do
+        item = CEGUI.createListboxTextItem(v)        
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listbox):addItem(item)
+        if v .. ".oxw" == preselect then
+            listbox:setItemSelectState(item, true)
+        end
+    end
+end
+
+
+-- events for mainmenu
+function P.button_quit_clicked(e)
+    hideGUI()
+    orxonox.CommandExecutor:execute("exit")
+end
+
+function P.button_standalone_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startGame")
+        toggleGUI()
+    end
+end
+
+function P.button_server_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startServer")
+        toggleGUI()
+    end
+end
+
+function P.button_dedicated_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startDedicated")
+        toggleGUI()
+    end
+end
+
+function P.button_client_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startClient")
+        toggleGUI()
+    end
+end
+
+function P.listbox_level_selectionchanged(e)
+    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
+        winMgr:getWindow("orxonox/StandaloneButton"):enable()
+    else
+        winMgr:getWindow("orxonox/StandaloneButton"):disable()
+    end
+end
+
+return mainmenu_2
+
Index: code/branches/resource2/data/gui/scripts/mainmenu_4.lua
===================================================================
--- code/branches/resource2/data/gui/scripts/mainmenu_4.lua	(revision 5646)
+++ code/branches/resource2/data/gui/scripts/mainmenu_4.lua	(revision 5646)
@@ -0,0 +1,88 @@
+-- mainmenu_2.lua
+gui = require("gui")
+local P = gui:new() --inherit everything from the gui package
+
+mainmenu_2 = P
+
+P.filename = "mainmenu_2"
+P.layoutString = "MainMenu_2.layout"
+
+function P:init()
+    listbox = winMgr:getWindow("orxonox/LevelListbox")
+    preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
+    orxonox.LevelManager:getInstance():compileAvailableLevelList()
+    local levelList = {}
+    local index = 0
+    local level = ""
+    while true do
+      level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
+      if level == "" then
+        break
+      end
+      table.insert(levelList, level)
+      index = index + 1
+    end
+    table.sort(levelList)
+    for k,v in pairs(levelList) do
+        item = CEGUI.createListboxTextItem(v)        
+        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+        CEGUI.toListbox(listbox):addItem(item)
+        if v .. ".oxw" == preselect then
+            listbox:setItemSelectState(item, true)
+        end
+    end
+end
+
+
+-- events for mainmenu
+function P.button_quit_clicked(e)
+    hideGUI()
+    orxonox.CommandExecutor:execute("exit")
+end
+
+function P.button_standalone_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startGame")
+        toggleGUI()
+    end
+end
+
+function P.button_server_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startServer")
+        toggleGUI()
+    end
+end
+
+function P.button_dedicated_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startDedicated")
+        toggleGUI()
+    end
+end
+
+function P.button_client_clicked(e)
+    choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+    if choice then
+        orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
+        orxonox.CommandExecutor:execute("startClient")
+        toggleGUI()
+    end
+end
+
+function P.listbox_level_selectionchanged(e)
+    if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
+        winMgr:getWindow("orxonox/StandaloneButton"):enable()
+    else
+        winMgr:getWindow("orxonox/StandaloneButton"):disable()
+    end
+end
+
+return mainmenu_2
+
Index: code/branches/resource2/data/levels/empty_level.oxw
===================================================================
--- code/branches/resource2/data/levels/empty_level.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/empty_level.oxw	(revision 5646)
@@ -0,0 +1,22 @@
+<?lua
+  include("overlay/stats.oxo")
+  include("overlay/hudtemplates3.oxo")
+?>
+
+<?lua
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshippirate />
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/gametype_asteroids.oxw
===================================================================
--- code/branches/resource2/data/levels/gametype_asteroids.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/gametype_asteroids.oxw	(revision 5646)
@@ -0,0 +1,453 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Asteroids Race"
+ description  = "testmap for gametype asteroid race"
+ gametype     =  Asteroids
+>
+<Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox       = "Orxonox/Starbox"
+>
+
+<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+
+
+<SpawnPoint position="-300,300,0" name="playerstart" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+
+<?lua
+for i = 1, 250, 1
+do
+j = math.random()
+?>
+
+    <MovableEntity 
+     position="<?lua print(math.random()* 15000 - 1000) ?>,<?lua print(math.random() * 12000 - 4000) ?>,<?lua print(math.random() * 12000 - 4000) ?>"        collisionType=dynamic 
+     linearDamping=0.8
+     angularDamping=0
+     scale=<?lua print(j * 150)?> 
+     collisiondamage=1
+     enablecollisiondamage=true>
+      <attached>
+        <Model mass=<?lua print(j * 1000) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="<?lua print(j * 350) ?>" />
+      </collisionShapes>
+    </MovableEntity>
+<?lua
+end
+?>
+
+<!--
+<MovableEntity position="0,0,0" collisionType=dynamic scale=5 linearDamping=0.8 angularDamping=0  collisiondamage=0.005 enablecollisiondamage=true>
+  <attached>
+    <Model mass=100 mesh="ast1.mesh" />
+  </attached>
+    <collisionShapes>
+      <SphereCollisionShape radius=11.75 />
+    </collisionShapes>
+</MovableEntity>
+
+
+<MovableEntity position="0,300,0" scale=10 collisionType=dynamic linearDamping=0.8 angularDamping=0  collisiondamage=0.005 enablecollisiondamage=true>
+  <attached>
+    <Model mass=100 mesh="ast1.mesh" />
+  </attached>
+    <collisionShapes>
+      <SphereCollisionShape radius=22.5 />
+    </collisionShapes>
+</MovableEntity>
+
+
+<MovableEntity position="0,600,0"  scale=34  collisionType=dynamic linearDamping=0.8 angularDamping=0 collisiondamage=0.005 enablecollisiondamage=true>
+  <attached>
+    <Model mass=100 mesh="ast1.mesh" />
+  </attached>
+    <collisionShapes>
+      <SphereCollisionShape radius=76.5 />
+    </collisionShapes>
+</MovableEntity>
+
+<MovableEntity position="0,1200,0" scale=80 collisionType=dynamic linearDamping=0.8 angularDamping=0  collisiondamage=0.005 enablecollisiondamage=true>
+  <attached>
+    <Model mass=100 mesh="ast1.mesh" />
+  </attached>
+    <collisionShapes>
+      <SphereCollisionShape radius=200 />
+    </collisionShapes>
+</MovableEntity>
+-->
+
+<SpaceShip position="2000,200,0" lookat="0,0,0" >
+  <templates>
+    <Template link=spaceshipassff />
+  </templates>
+  <controller>
+    <AIController />
+  </controller>
+</SpaceShip>
+
+<SpaceShip position="8000,300,700" lookat="0,0,0" >
+  <templates>
+    <Template link=spaceshipassff />
+  </templates>
+  <controller>
+    <AIController />
+  </controller>
+</SpaceShip>
+
+<SpaceShip position="10200,400,-600" lookat="0,0,0" >
+  <templates>
+    <Template link=spaceshipassff />
+  </templates>
+  <controller>
+    <AIController />
+  </controller>
+</SpaceShip>
+
+<ForceField position="200,300,-500" direction="0,0,1" diameter=500 velocity=120>
+  <attached>
+    <ParticleEmitter source="Orxonox/ForceFieldPurpleSmall" startdelay=0 />
+  </attached>
+</ForceField>
+
+ <ForceField position="2200,-300,1200" direction="1,0.3,-0.7" diameter=800 velocity=200>
+  <attached>
+    <ParticleEmitter source="Orxonox/ForceFieldBlueBig" startdelay=0 />
+  </attached>
+</ForceField>
+
+ <ForceField position="8600,1400,500" direction="-1,-1,-1" diameter=500 velocity=400>
+  <attached>
+    <ParticleEmitter source="Orxonox/ForceFieldGreenSmall" startdelay=0 />
+  </attached>
+</ForceField>
+
+  <ForceField position="11800,500,-2600" direction="-1,0,1" diameter=900 velocity=300>
+  <attached>
+    <ParticleEmitter source="Orxonox/ForceFieldPurpleBig" startdelay=0 />
+  </attached>
+</ForceField>
+
+
+<CheckPoint name=trigger1 position="-300,300,0" scale=1 isdestination=false isfirst=true stayactive=true distance=10 addtime=13 />
+
+
+<CheckPoint name=trigger2 position="2200,600,0" scale=3 isdestination=false stayactive=true distance=100 addtime=10>
+  <events>
+    <activity>
+      <EventListener event=trigger1 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger1 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger1 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger2 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger2 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+
+
+<CheckPoint name=trigger3 position="4100,0,400" scale=3 isdestination=false stayactive=true distance=100 addtime=9>
+  <events>
+    <activity>
+      <EventListener event=trigger2 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger2 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger2 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger3 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger3 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+
+
+<CheckPoint name=trigger4 position="5600,400,0" scale=3 isdestination=false stayactive=true distance=100 addtime=9>
+  <events>
+    <activity>
+      <EventListener event=trigger3 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger3 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger3 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger4 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger4 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+
+
+<CheckPoint name=trigger5 position="7200,600,-200" scale=3 isdestination=false stayactive=true distance=100 addtime=8>
+  <events>
+    <activity>
+      <EventListener event=trigger4 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger4 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger4 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger5 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger5 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+
+
+<CheckPoint name=trigger6 position="9200, 800,-800" scale=3 isdestination=false stayactive=true distance=100 addtime=10>
+  <events>
+    <activity>
+      <EventListener event=trigger5 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger5 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger5 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger6 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger6 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+
+
+<Model position="11200,400,-1800" scale=10 pitch=-90  mesh="Carrier.mesh">
+  <attached>
+    <CheckPoint position="-10,0,0" name=trigger7 scale=0.6 isdestination=true stayactive=true distance=100>
+  <events>
+    <activity>
+      <EventListener event=trigger6 />
+    </activity>
+  </events>
+  <attached>
+    <Billboard material="Flares/lensflare" colour="1,0,0">
+      <events>
+        <visibility>
+          <EventTrigger invert=true>
+            <events>
+              <trigger>
+                <EventListener event=trigger6 />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </Billboard>
+    <BlinkingBillboard frequency=0.2 amplitude=1 material="Flares/lensflare" colour="1,1,0">
+      <events>
+        <visibility>
+          <EventTrigger>
+            <events>
+              <trigger>
+                <EventListener event=trigger6 />
+              </trigger>
+            </events>
+            <EventTrigger invert=true>
+              <events>
+                <trigger>
+                  <EventListener event=trigger7 />
+                </trigger>
+              </events>
+            </EventTrigger>
+          </EventTrigger>
+        </visibility>
+      </events>
+    </BlinkingBillboard>
+    <Billboard material="Flares/lensflare" colour="0,1,0">
+      <events>
+        <visibility>
+          <EventListener event=trigger7 />
+        </visibility>
+      </events>
+    </Billboard>
+  </attached>
+</CheckPoint>
+  </attached>
+</Model>
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/gametype_underattack.oxw
===================================================================
--- code/branches/resource2/data/levels/gametype_underattack.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/gametype_underattack.oxw	(revision 5646)
@@ -0,0 +1,161 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("overlay/underattackhud.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "UnderAttack testing"
+ description  = "A simple testlevel"
+ gametype     = UnderAttack
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <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" />
+
+    <?lua for i = 1, 30, 1 do ?>
+        <MovableEntity
+            position="<?lua print(math.random() * 10000 - 5000) ?>, <?lua print(math.random() * 10000 - 5000) ?>, <?lua print(math.random() * 10000 - 5000) ?>"
+            velocity="<?lua print(math.random() * 500 - 250) ?>, <?lua print(math.random() * 500 - 250) ?>, <?lua print(math.random() * 500 - 250) ?>"
+        >
+            <attached>
+                <Model
+                    <?lua x = math.random() * 150 + 30 ?>
+                    scale="<?lua print(x) ?>"
+                    mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh"
+                    position="0,0,0"
+                />
+            </attached>
+            <collisionShapes>
+                <SphereCollisionShape radius=<?lua print(x) ?> position="0,0,0" />
+            </collisionShapes>
+        </MovableEntity>
+    <?lua end ?>
+
+    <Destroyer
+        position          = "100,150,0"
+        collisionType     = dynamic
+        mass              = 100000
+        velocity          = "-35,0,0"
+        angularDamping    = 0.9999999
+        health            = 10000
+        maxhealth         = 10000
+        initialhealth     = 10000
+    >
+
+        <attached>
+            <TeamSpawnPoint team=1 position="150,0,7" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+            <TeamSpawnPoint team=1 position="0,0,7" lookat="-1,0,0" roll="90"  yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+            <TeamSpawnPoint team=1 position="-50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+            <TeamSpawnPoint team=1 position="100,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+            <TeamSpawnPoint team=1 position="50,0,7" lookat="-1,0,0" roll="90" yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff />
+            <?lua for i = 1, 100, 1 do ?>
+                <TeamSpawnPoint
+                    team=0
+                    position="<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
+                    lookat="0,0,0"
+                    spawnclass=SpaceShip
+                    pawndesign=spaceshipassff
+                />
+
+                <!--more spawnpoints for team1-->
+                <!--
+                <TeamSpawnPoint
+                    team=1 position="<?lua print((math.random() * 500 + 500)) ?>,<?lua print((math.random() * 500 + 500) ) ?>,<?lua print((math.random() * 500 + 500)) ?>"
+                    lookat="0,0,0"
+                    spawnclass=SpaceShip
+                    pawndesign=spaceshipassff
+                />-->
+            <?lua end ?>
+
+            <Model mesh="Carrier.mesh" scale="5" />
+            <Backlight
+                mainstate=activity
+                active=false
+                scale=0.4
+                name=bltest
+                position=" 7.6, 0, 6"
+                colour="0.2, 0.65, 1.0, 1.0"
+                width=15
+                length=1500
+                lifetime=2
+                elements=50
+                trailmaterial="Trail/backlighttrail"
+                turnontime=1
+                turnofftime=1
+                material="Flares/ThrusterFlare1"
+            />
+            <?lua for i=0,8,1 do ?>
+                <BlinkingBillboard
+                    position="<?lua print(200-270/8*i)?> ,15,2"
+                    material="Examples/Flare"
+                    colour="1.0, 0.5, 0.3"
+                    phase=<?lua print(-360/8*i)?>
+                    amplitude=0.1
+                    frequency=0.5
+                    quadratic=1
+                />
+
+                <BlinkingBillboard
+                    position="<?lua print(200-270/8*i)?>,-15,2"
+                    material="Examples/Flare"
+                    colour="1.0, 0.5, 0.3"
+                    phase=<?lua print(-360/8*i)?>
+                    amplitude=0.1
+                    frequency=0.5
+                    quadratic=1
+                />
+            <?lua end ?>
+
+            <Backlight
+                scale=1
+                position=" 169, 75, -15"
+                colour="1, 0.85, 0.5, 0.5"
+                width=40
+                length=1000
+                lifetime=5
+                elements=15
+                trailmaterial="Trail/backlighttrail"
+                material="Examples/Flare"
+            />
+            <Backlight
+                scale=1
+                position=" 169, -75, -15"
+                colour="1, 0.85, 0.5, 0.5"
+                width=40
+                length=1000
+                lifetime=5
+                elements=15
+                trailmaterial="Trail/backlighttrail"
+                material="Examples/Flare" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="70,0,-25"      halfExtents="150, 50, 25" />
+            <BoxCollisionShape position="95,75,-16"     halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="95,-75,-16"    halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="77,47,30"      halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,-47,30"     halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,0,50"       halfExtents="110, 45, 6" />
+            <BoxCollisionShape position="167,0,70"      halfExtents="17, 20, 20" />
+        </collisionShapes>
+    </Destroyer>
+
+    <GlobalShader compositor="Bloom" visible=false>
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+        </visibility>
+      </events>
+    </GlobalShader>
+
+    <Model position="0,0,0" scale=8 mesh="ast1.mesh" />
+    <StaticEntity position="0,0,0" collisionType=static>
+      <collisionShapes>
+        <SphereCollisionShape radius="20" />
+      </collisionShapes>
+    </StaticEntity>
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/includes/CuboidSpaceStation.lua
===================================================================
--- code/branches/resource2/data/levels/includes/CuboidSpaceStation.lua	(revision 5646)
+++ code/branches/resource2/data/levels/includes/CuboidSpaceStation.lua	(revision 5646)
@@ -0,0 +1,678 @@
+----------------------------------------------------------------------------------------------------
+-- This lua script creates a totally random generated space station for the orxonox computer game!--
+-- (c) Wallah 2008, published under GPL licence!												  --
+----------------------------------------------------------------------------------------------------
+
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- IMPORTANT: If you need more parameters, do the following: copy the actual function (just the headline and the end statement) to the end of the file,			  --
+-- like I did with createSpaceStation() and let that function call the new function where you can modify the parameters. For all parameters which the old function--
+-- doesn't have you just give the standard default values, which I have defined. This is to make sure, that anyone else who uses the old function can still use it--
+-- the same way he/she always did. If you want a function with less parameters, just create a new one at the end of the file and call this function with some	  --
+-- default values. REMEMBER: Function overloading is not possible, be sure to call your function differently from others already existing ones.					  --
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+-- This function creates a randomly generated space station.
+-- The first argument ranSeed, must be 0, or a positive Integer, if it is 0 your space station is always chosen randomly, if you give an integer,
+--	your space station will be generated randomly, but once you have the space station it will always be the same.
+-- The argument xLength defines how large the space station will be into the x-direction.
+-- The argument xVar defines how much the space station will vary at the ends in x-direction, this is so that the station is no cube.
+-- The argument yLength is the same as xLength, but for the y-direction.
+-- The argument yVar is the same as xLength, but for the y-direction.
+-- The argument zLength is the same as xLength, but for the z-direction.
+-- The argument zVar is the same as xLength, but for the z-direction.
+-- The argument sSScale scales the station proportionally in all directions.
+function createSpaceStationPar(ranSeed, xLength, xVar, yLength, yVar, zLength, zVar, sSScale)
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- This prints xml code, which creates a MovableEntity, which I need to attach all the parts of the space station.
+print("<MovableEntity scale=1 position=\"0,0,0\" >")
+-- End create Movable Entity.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Create a randomseed, so that the math.random() function is actually random.
+if ranSeed == 0 then
+	math.randomseed(os.time())
+else
+	math.randomseed(ranSeed)
+end
+-- End create randomseed.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Here you can define some global variables, with which you can modify the space station.
+
+-- Define the maximal size of the grid, this value is based on how large you define the area of bodyparts plus 20 gridpoints for attachparts.
+sSSize=30
+if xLength>=yLength and xLength>=zLength then
+	sSSize=xLength+20
+elseif yLength>=xLength and yLength>=zLength then
+	sSSize=yLength+20
+elseif zLength>=xLength and zLength>=yLength then
+	sSSize=zLength+20
+end
+-- Define how many parts the space station has, this value has to be exact, so be sure to increment it if you're adding a new part.
+sSParts=9
+-- Define how many body parts the space station has, this value has to be exact. Body part means a part, which has connections at least in two directions.
+sSBodyParts=3
+-- Define how many frontParts you have.
+frontParts=1
+-- Define how many backParts you have.
+backParts=1
+-- Define how many side parts for the left side you have.
+leftSideParts=1
+-- Define how many side parts for the right side you have.
+rightSideParts=1
+-- Define how many top parts you have.
+topParts=2
+-- Define how many connection parts you have.
+connParts=1
+-- Define the maximal dimension of a single part, be sure this value is big enough, better it's too big, it's only a matter of efficiency.
+-- It should be at least 1 bigger than the biggest part needs, because I guarantee that it works with odd numbers, to do so I use the math.floor function.
+pDim=6
+-- Define the griddimension, be sure this value matches the size of a single space station part plus the size of a connection part, which means your parts must be:
+--	integer*(gridDim-connectionSize), then integer tells you how many griddimensions your part is.
+gridDim=2.25
+-- End define global parameters.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- This creates a 4-dimensional grid, which tells us if there is a part or not, and in which direction it has connections.
+-- The parameters x,y,z are the axis of the space station, which iterate to sSSize, the maximal size of the space station.
+-- The griddimension, this word I will use later, means that the distance of a point to the next point is gridDim in the game, so the absolute x-axis is x*gridDim*sSScale,
+--	and so on for the other dimensions y and z.
+-- grid[x][y][z][0] contains 0 if there is no part at the position (x,y,z), otherwise 1.
+-- grid[x][y][z][1] contains 0 if there is no connection from (x,y,z) in x-direction, "+" if there is one in the positive x-direction,
+--	"-" if there is one in the negative x-direction, "+-" if there are in both x-directions.
+-- grid[x][y][z][2] contains 0 if there is no connection from (x,y,z) in y-direction, "+" if there is one in the positive y-direction,
+--	"-" if there is one in the negative y-direction, "+-" if there are in both y-directions.
+-- grid[x][y][z][3] contains 0 if there is no connection from (x,y,z) in z-direction, "+" if there is one in the positive z-direction,
+--	"-" if there is one in the negative z-direction, "+-" if there are in both z-directions.
+grid = {}
+for x=-math.floor(sSSize/2),math.floor(sSSize/2) do
+	grid[x] = {}
+	for y=-math.floor(sSSize/2),math.floor(sSSize/2) do
+		grid[x][y]= {}
+		for z=-math.floor(sSSize/2),math.floor(sSSize/2) do
+			grid[x][y][z]={}
+			for i=0,3 do
+				grid[x][y][z][i]=0
+			end
+		end
+	end
+end
+-- End create 4-dim grid.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- This creates an array which stores all the parts, it's size is depending on the global values pDim and sSParts.
+-- The first parameter i, tells us how many parts fit into the array, so it iterates from 1 to sSParts, each part has his own value i.
+-- The second, third and fourth parameters are the relative coordinates of the part, you have to start at (0,0,0) and be sure you fill the array into the right direction.
+--	A short example: your part is 2 griddimensions long and you place it in the game, that the relative coordinate point is at (0,0,0) and the part lies in the positive
+--	z-axis, then you have to use the coordinate point (0,0,1).
+-- The fifth parameter is an array with size 4, at index=0, you have to set 1 if your part covers the gridpoint at (x,y,z), otherwise 0.
+--	At index=1,2,3 you define the possible connection directions (1 for x, 2 for y and 3 for z), be sure to use the notation from above (0, "+-", "+", "-").
+bodyParts={}
+for i=1,sSParts do
+	bodyParts[i]={}
+	for x=-math.floor(pDim/2),math.floor(pDim/2) do
+		bodyParts[i][x]={}
+		for y=-math.floor(pDim/2),math.floor(pDim/2) do
+			bodyParts[i][x][y]={}
+			for z=-math.floor(pDim/2),math.floor(pDim/2) do
+				bodyParts[i][x][y][z]={}
+				for k=0,3 do
+					bodyParts[i][x][y][z][k]=0
+				end
+			end
+		end
+	end
+	-- This contains the name of the mesh file.
+	bodyParts[i][0][0][0][4]=""
+	-- This contains the first possible rotation of your part, pitch=... yaw=... roll=... .
+	bodyParts[i][0][0][0][5]=""
+	-- This contains the second possible rotation of your part, pitch=... yaw=... roll=... .
+	bodyParts[i][0][0][0][6]=""
+	-- This contains the third possible rotation of your part, pitch=... yaw=... roll=... .
+	bodyParts[i][0][0][0][7]=""
+	-- Contains the movement rotation, rotationaxis=... rotationrate=... .
+	bodyParts[i][0][0][0][8]=""
+	-- Contains the attachment, if your part has an attachment, e.g. <ParticleEmitter .../>.
+	bodyParts[i][0][0][0][9]=""
+	-- Contains how many of this part you want to attach to your space station.
+	bodyParts[i][0][0][0][10]=1
+end
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Here you can add a part to the space station, there are some examples here and how to describe your part is written above in the commentary.
+
+-- The part must be inserted so, that the center of reference is at position (0,0,0).
+-- At position bodyParts[i][0][0][0][4] you have to put the mesh name of your part.
+-- At bodyParts[i][0][0][0][5] you can rotate your part, with pitch=angle, yaw=angle or roll=angle (x,y or z). Positive angle means in screw direction.
+-- At bodyParts[i][0][0][0][6] you have another possibility to rotate your part in a different way, e.g. for left and right side parts.
+-- At bodyParts[i][0][0][0][7] you have a third possibility to rotate your part, e.g. connection parts must be rotated into 3 different ways.
+-- At bodyParts[i][0][0][0][8] you can rotate your part around his own axis, with rotationaxis="x,y,z" rotationrate=number.
+-- At bodyParts[i][0][0][0][9] you can attach something to your model, e.g. <ParticleEmitter .../>.
+
+-- Insert the CuboidBody, which is only one griddimension and can have connections in every direction.
+bodyParts[1][0][0][0][4]="CuboidBody.mesh"
+
+bodyParts[1][0][0][0][0]=1
+bodyParts[1][0][0][0][1]="+-"
+bodyParts[1][0][0][0][2]="+-"
+bodyParts[1][0][0][0][3]="+-"
+-- End insert CuboidBody.
+
+-- Insert the DoubleCuboidBody, which is two griddimensions long, and one wide and high and can have connections in every direction except in the middle.
+bodyParts[2][0][0][0][4]="DoubleCuboidBody.mesh"
+bodyParts[2][0][0][0][5]="pitch=-90"
+
+bodyParts[2][0][0][0][0]=1
+bodyParts[2][0][0][0][1]="+-"
+bodyParts[2][0][0][0][2]="+-"
+bodyParts[2][0][0][0][3]="-"
+
+bodyParts[2][0][0][1][0]=1
+bodyParts[2][0][0][1][1]="+-"
+bodyParts[2][0][0][1][2]="+-"
+bodyParts[2][0][0][1][3]="+"
+-- End insert DoubleCuboidBody.
+
+-- Insert the CuboidConnectionBody, it is three griddimensions long and one wide and high and can have only connections at griddimension 1
+--	(except the side in direction of griddimension 2) and griddimension 3 (except the side in direction of griddimension 2).
+bodyParts[3][0][0][0][4]="CuboidConnBody.mesh"
+bodyParts[3][0][0][0][5]="pitch=-90"
+
+bodyParts[3][0][0][0][0]=1
+bodyParts[3][0][0][0][1]="+-"
+bodyParts[3][0][0][0][2]="+-"
+bodyParts[3][0][0][0][3]="-"
+
+bodyParts[3][0][0][1][0]=1
+
+bodyParts[3][0][0][2][0]=1
+bodyParts[3][0][0][2][1]="+-"
+bodyParts[3][0][0][2][2]="+-"
+bodyParts[3][0][0][2][3]="+"
+-- End insert CuboidConnectionBody.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Insert the back parts.
+-- If you're space station has no back parts, be sure to set backPartsIndex[0]=false.
+backPartsIndex={}
+backPartsIndex[0]=""
+
+-- Insert the thruster, which is one griddimension long, two wide and high, it can only have a connection into the negative z-direction.
+backPartsIndex[1]=4
+bodyParts[backPartsIndex[1]][0][0][0][4]="Thruster.mesh"
+bodyParts[backPartsIndex[1]][0][0][0][5]="pitch=-90"
+bodyParts[backPartsIndex[1]][0][0][0][9]="<ParticleEmitter position=\"0,-0.5,0\" source=\"Orxonox/ThrusterFire\" />"
+bodyParts[backPartsIndex[1]][0][0][0][10]=5
+
+bodyParts[backPartsIndex[1]][0][0][0][0]=1
+bodyParts[backPartsIndex[1]][0][0][0][3]="-"
+bodyParts[backPartsIndex[1]][1][0][0][0]=1
+bodyParts[backPartsIndex[1]][-1][0][0][0]=1
+bodyParts[backPartsIndex[1]][0][1][0][0]=1
+bodyParts[backPartsIndex[1]][0][-1][0][0]=1
+-- End insert the thruster.
+
+-- End insert the back parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Insert the front parts. If your space station has no front parts, be sure to set frontPartsIndex[0]=false.
+frontPartsIndex={}
+frontPartsIndex[0]=""
+
+-- The SemiCircleCockpit is 3 x-griddimensions long, 3 y-griddimensions and 2 z-griddimensions, it can only have a connection in the positive z-direction.
+frontPartsIndex[1]=5
+bodyParts[frontPartsIndex[1]][0][0][0][4]="SemiCircleCockpit.mesh"
+bodyParts[frontPartsIndex[1]][0][0][0][5]="pitch=-90 yaw=180"
+bodyParts[frontPartsIndex[1]][0][0][0][9]="<Billboard scale=0.01 position=\"0,-0.1,2.2\" colour=\"1.0,1.0,1.0\" material=\"Examples/Flare\" /> <Billboard scale=0.01 position=\"0.5,-0.1,2.2\" colour=\"1.0,1.0,1.0\" material=\"Examples/Flare\" /> <Billboard scale=0.01 position=\"-0.5,-0.1,2.2\" colour=\"1.0,1.0,1.0\" material=\"Examples/Flare\" />"
+
+bodyParts[frontPartsIndex[1]][0][0][0][0]=1
+bodyParts[frontPartsIndex[1]][0][0][0][3]="+"
+
+bodyParts[frontPartsIndex[1]][-1][0][0][0]=1
+bodyParts[frontPartsIndex[1]][1][0][0][0]=1
+bodyParts[frontPartsIndex[1]][0][-1][0][0]=1
+bodyParts[frontPartsIndex[1]][0][1][0][0]=1
+bodyParts[frontPartsIndex[1]][-1][-1][0][0]=1
+bodyParts[frontPartsIndex[1]][1][-1][0][0]=1
+bodyParts[frontPartsIndex[1]][-1][1][0][0]=1
+bodyParts[frontPartsIndex[1]][1][1][0][0]=1
+bodyParts[frontPartsIndex[1]][0][0][-1][0]=1
+bodyParts[frontPartsIndex[1]][-1][0][-1][0]=1
+bodyParts[frontPartsIndex[1]][1][0][-1][0]=1
+bodyParts[frontPartsIndex[1]][0][-1][-1][0]=1
+bodyParts[frontPartsIndex[1]][0][1][-1][0]=1
+bodyParts[frontPartsIndex[1]][-1][-1][-1][0]=1
+bodyParts[frontPartsIndex[1]][1][-1][-1][0]=1
+bodyParts[frontPartsIndex[1]][-1][1][-1][0]=1
+bodyParts[frontPartsIndex[1]][1][1][-1][0]=1
+-- End insert SemiCircleCockpit.
+
+-- End insert the front parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Insert the side parts.
+-- If your space station has no left side parts, be sure to set leftsidePartsIndex[0]=false.
+-- If your space station has no right side parts, be sure to set rightsidePartsIndex[0]=false.
+leftSidePartsIndex={}
+leftSidePartsIndex[0]=""
+rightSidePartsIndex={}
+rightSidePartsIndex[0]=""
+
+-- Insert the solar panel, which i wanna use as left and right side part.
+leftSidePartsIndex[1]=6
+rightSidePartsIndex[1]=leftSidePartsIndex[1]
+bodyParts[leftSidePartsIndex[1]][0][0][0][4]="SolarPanel.mesh"
+bodyParts[leftSidePartsIndex[1]][0][0][0][5]="roll=90 pitch="..math.random(0,180)
+bodyParts[rightSidePartsIndex[1]][0][0][0][6]="roll=-90 pitch="..math.random(0,180)
+bodyParts[rightSidePartsIndex[1]][0][0][0][8]="rotationaxis=\"1,0,0\" rotationrate=2"
+bodyParts[leftSidePartsIndex[1]][0][0][0][0]=1
+bodyParts[leftSidePartsIndex[1]][0][0][1][0]=1
+bodyParts[leftSidePartsIndex[1]][0][0][-1][0]=1
+bodyParts[leftSidePartsIndex[1]][0][1][0][0]=1
+bodyParts[leftSidePartsIndex[1]][0][1][1][0]=1
+bodyParts[leftSidePartsIndex[1]][0][1][-1][0]=1
+bodyParts[leftSidePartsIndex[1]][0][-1][0][0]=1
+bodyParts[leftSidePartsIndex[1]][0][-1][1][0]=1
+bodyParts[leftSidePartsIndex[1]][0][-1][-1][0]=1
+-- End insert solar panel.
+
+-- End insert side parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Insert the top parts.
+-- If you have no top parts, be sure to set topPartsIndex[0]=false
+topPartsIndex={}
+topPartsIndex[0]=""
+
+-- Insert the CuboidLandingZone.
+topPartsIndex[1]=7
+bodyParts[topPartsIndex[1]][0][0][0][4]="CuboidLandingZone.mesh"
+bodyParts[topPartsIndex[1]][0][0][0][5]="pitch=-90"
+
+bodyParts[topPartsIndex[1]][0][0][0][0]=1
+bodyParts[topPartsIndex[1]][0][0][0][2]="+-"
+bodyParts[topPartsIndex[1]][1][0][0][0]=1
+bodyParts[topPartsIndex[1]][-1][0][0][0]=1
+bodyParts[topPartsIndex[1]][0][0][1][0]=1
+bodyParts[topPartsIndex[1]][1][0][1][0]=1
+bodyParts[topPartsIndex[1]][-1][0][1][0]=1
+bodyParts[topPartsIndex[1]][0][0][2][0]=1
+bodyParts[topPartsIndex[1]][1][0][2][0]=1
+bodyParts[topPartsIndex[1]][-1][0][2][0]=1
+bodyParts[topPartsIndex[1]][0][0][3][0]=1
+bodyParts[topPartsIndex[1]][1][0][3][0]=1
+bodyParts[topPartsIndex[1]][-1][0][3][0]=1
+-- End insert the CuboidLandingZone.
+
+-- Insert the SatelliteDish.
+topPartsIndex[2]=8
+bodyParts[topPartsIndex[2]][0][0][0][4]="SatelliteDish.mesh"
+bodyParts[topPartsIndex[2]][0][0][0][5]="pitch=-90"
+bodyParts[topPartsIndex[2]][0][0][0][8]="rotationaxis=\"0,1,0\" rotationrate=5"
+
+bodyParts[topPartsIndex[2]][0][0][0][0]=1
+bodyParts[topPartsIndex[2]][0][0][1][0]=1
+bodyParts[topPartsIndex[2]][0][0][-1][0]=1
+bodyParts[topPartsIndex[2]][1][0][0][0]=1
+bodyParts[topPartsIndex[2]][1][0][1][0]=1
+bodyParts[topPartsIndex[2]][1][0][-1][0]=1
+bodyParts[topPartsIndex[2]][-1][0][0][0]=1
+bodyParts[topPartsIndex[2]][-1][0][1][0]=1
+bodyParts[topPartsIndex[2]][-1][0][-1][0]=1
+-- End insert the SatelliteDish.
+
+-- End insert the top parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Insert the connection parts, which are used to connect all the bodyparts.
+-- If you're spacestation has no connection parts, be sure to set connPartsIndex[0]=false.
+connPartsIndex={}
+connPartsIndex[0]=""
+
+-- Insert the CuboidConnection.
+connPartsIndex[1]=9
+bodyParts[connPartsIndex[1]][0][0][0][4]="CuboidConnection.mesh"
+bodyParts[connPartsIndex[1]][0][0][0][5]="roll=90"
+bodyParts[connPartsIndex[1]][0][0][0][6]=""
+bodyParts[connPartsIndex[1]][0][0][0][7]="pitch=90"
+-- End insert the CuboidConnection.
+
+-- End insert the connection parts.
+
+-- End create array bodyParts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Here I define some functions which I will use later.
+
+--This function actualizes the grid, which I have to call always after I have added a new part to the space station.
+function actualizeGrid(Index,x,y,z)
+	for i=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+		for j=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+			for k=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+				if bodyParts[Index][i][j][k][0] == 1 then
+					for l=0,3 do
+						grid[x+i][y+j][z+k][l] = bodyParts[Index][i][j][k][l]
+					end
+				end
+			end
+		end
+	end
+end
+-- End actualizeGrid.
+
+-- This function checks wheter a given parts fits at that position or not.
+-- If the part fits there it returns 1, otherwise 0.
+function checkPart(Index,x,y,z)
+	check=1
+	for i=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+		for j=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+			for k=math.floor(-pDim/2)+1,math.floor(pDim/2) do
+				-- If the part occupies the position (i,j,k), the grid must be empty there ((x+i, y+j, z+k)==0), if not, check is zero,
+				--	which means that the part doesn't fit there.
+				if bodyParts[Index][i][j][k][0] == 1 and grid[x+i][y+j][z+k][0] == 1 then
+					check=0
+				end
+			end
+		end
+	end
+	return check
+end
+-- End checkPart function.
+
+-- This function prints the model with tempPartIndex in the bodyParts array at position lx,ly,lz.
+-- If you need to rotate the model around his own axis, then you have to set movEntity true and define the details of the rotation in
+--	bodyParts[tempPartIndex][0][0][0][8].
+-- If your model needs to be rotated like bodyParts[tempPartIndex][0][0][0][5], then side must be 1, for bodyParts[tempPartIndex][0][0][0][6] side must be 2,
+--	for bodyParts[tempPartIndex][0][0][0][7] side must be 3.
+function printModel(lx,ly,lz,tempPartIndex,movEntity,side)
+	if movEntity == true then
+		print("<MovableEntity scale=1 position=\"") print(lx*gridDim*sSScale) print(",") print(ly*gridDim*sSScale) print(",") print(lz*gridDim*sSScale) print("\" ")
+		print(bodyParts[tempPartIndex][0][0][0][8]) print(">")
+		print("<attached>")
+		lx=0 ly=0 lz=0
+	end
+
+	print("<Model position=\"") print(lx*gridDim*sSScale) print(",") print(ly*gridDim*sSScale) print(",") print(lz*gridDim*sSScale)
+	print("\" scale=") print(sSScale) print(" mesh= \"") print(bodyParts[tempPartIndex][0][0][0][4]) print("\"")
+
+		if side == 1 then
+			print(bodyParts[tempPartIndex][0][0][0][5]) print(">")
+		elseif side == 2 then
+			print(bodyParts[tempPartIndex][0][0][0][6]) print(">")
+		elseif side == 3 then
+			print(bodyParts[tempPartIndex][0][0][0][7]) print(">")
+		end
+
+		print("<attached>")
+			print(bodyParts[tempPartIndex][0][0][0][9])
+		print("</attached>")
+
+	print("</Model>")
+
+	if movEntity == true then
+		print("</attached>")
+		print("</MovableEntity>")
+	end
+end
+-- End function printModel().
+
+-- This function sets a part to a side of the space station.
+-- The arguments lx,ly,lz are the coordinates of the grid, where you want to set the part.
+-- The arguments xAxis,yAxis,zAxis can be 0 or 1, but only one argument out of the three can be 1. This means two of them must always be zero. You have to set xAxis to one,
+--	if your part is attached to a side, which faces into the x-direction (negative or positive, this is later specified with Dir), that means the x-Axis is a normal vector
+--	of the side to which you want to attach the part. The same for yAxis and zAxis.
+-- The argument Dir must be 1 if your side, where you want to attach the part, faces into the positive direction, -1 if the side faces into the negative direction. The side
+--	faces into the positive direction means, that the side of the side where the part will be attached is directed into the direction of the positive direction of the
+--	corresponding axis.
+-- The argument index is the index of the part for the bodyParts array.
+-- The argument printMovEnt must be false if your part doesn't need to be attached to an extra MovableEntity. If your part must be attached to an extra MovableEntity
+--	this argument must be true. The extra MovableEntity is used to rotate the part around his own axis, or something like that.
+-- The argument printSide is like the argument side of the printModel() function. It defines how your part will be rotated. Read the commentary there.
+-- The function returns 0 if the part couldn't be set, because it did not fit there or there was no side to attach the part. It returns 1 if the part is successfully set.
+function setPart(lx,ly,lz,xAxis,yAxis,zAxis,Dir,index,printMovEnt,printSide)
+
+	partSet=0
+	-- For the bodyParts array I use 1 as x-, 2 as y- and 3 as z-Axis for the definition in which directions a part can have connections.
+	coord=1*xAxis+2*yAxis+3*zAxis
+	-- If I try to attach the part from the positive direction to the side of the space station, the part of the station (where I want to attach the new part) must have
+	--	a connection into the positive direction. Otherwise I look from the negative side and so the part of the station must have a connection into the negative direction.
+	if Dir==1 then
+		conn="+"
+	elseif Dir==-1 then
+		conn="-"
+	end
+	-- I look from the direction defined through Dir, and here I check, whether I have reached a side of the space station, which means at position lx,ly,lz is nothing and
+	--	at the next position is a part which can have a connection into the direction from where I look.
+	if grid[lx][ly][lz][0] == 0 and grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][0] == 1 and (grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][coord]=="+-" or grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][coord]==conn) then
+		-- This checks whether the part fits at that position or not.
+		check=checkPart(index,lx,ly,lz)
+		if check == 1 then
+			-- This prints the part.
+			printModel(lx,ly,lz,index,printMovEnt,printSide)
+			partSet=1
+			-- This actualizes the grid array with the values of the array bodyParts at the position index.
+			actualizeGrid(index,lx,ly,lz)
+		end
+	end
+	return partSet
+end
+-- End function setPart().
+
+-- This function sets a part to a side of the space station. It is called spiralSet, because it starts in the middle of the side and goes out in a form of a spiral.
+-- The argument xAxis,yAxis,zAxis,Dir,printMovEnt,printSide are the same as the arguments from the setPart() function, please read the commentary there.
+-- The argument index here must be an array, where you define the index for your part for the bodyParts array. The first used index is 1 and goes up to parts.
+-- The argument parts is the number of different parts which you want to attach to a side.
+function spiralSet(xAxis,yAxis,zAxis,Dir,index,parts,printMovEnt,printSide)
+	if index[0] ~= false then
+		-- The array vector contains the actual position where you try to set the part. vector[0],vector[1] and vector[3] contains the x,y,z-coordinate.
+		vector={}
+		-- This must be done, because there are different sides from where I try to attach a part.
+		coord1=1*yAxis+2*zAxis
+		coord2=math.mod(coord1+1,3)
+		coord3=math.mod(coord2+1,3)
+
+		for pc=1,parts do
+			tempIndex = index[pc]
+			for eachPart=1,bodyParts[tempIndex][0][0][0][10] do
+				partSet=0
+				vector[coord1]=math.floor(Dir*sSSize/2)-2*Dir
+				while vector[coord1]~=math.floor(-1*Dir*sSSize/2)+2*Dir and partSet==0 do
+					round=0
+					while round<=math.floor(sSSize/2)-2 and partSet==0 do
+						vector[coord2]=round
+						vector[coord3]=-round
+						while vector[coord3]<=round and partSet==0 do
+							partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide)
+							vector[coord3]=vector[coord3]+1
+						end
+						while vector[coord2]>=-round and partSet==0 do
+							partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide)
+							vector[coord2]=vector[coord2]-1
+						end
+						while vector[coord3]>-round and partSet==0 do
+							partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide)
+							vector[coord3]=vector[coord3]-1
+						end
+						while vector[coord2]<=round and partSet==0 do
+							partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide)
+							vector[coord2]=vector[coord2]+1
+						end
+						round=round+1
+					end
+					vector[coord1]=vector[coord1]-Dir
+				end
+			end
+		end
+	end
+end
+-- End function spiralSet().
+
+-- End define functions.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- This is xml code, which means now we attach some parts to the MovableEntity.
+print("<attached>")
+-- End attach to the MovableEntity.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach all bodyparts.
+-- Define at which position in the x-direction you're space station will start.
+x=math.random(-math.floor(xLength/2),-math.floor(xLength/2)+xVar)
+-- Define at which position in the x-direction you're space station will end.
+xMax=math.random(math.floor(xLength/2),math.floor(xLength/2)+xVar)
+while x<xMax do
+	-- The same for the y- and z-direction.
+	y=math.random(-math.floor(yLength/2),-math.floor(yLength/2)+yVar)
+	yMax=math.random(math.floor(yLength/2),math.floor(yLength/2)+yVar)
+	while y<yMax do
+		yMax=math.random(math.floor(yLength/2),math.floor(yLength/2)+yVar)
+		z=math.random(-math.floor(zLength/2),-math.floor(zLength/2)+zVar)
+		zMax=math.random(math.floor(zLength/2),math.floor(zLength/2)+zVar)
+		while z<zMax do
+			-- This loop choses a bodypart, which fits at position (x,y,z).
+			-- If after the fifth time the part does still not fit we terminate the loop and set no part at postition (x,y,z).
+			partSet=0
+			counter=0
+			while counter<5 and partSet==0 do
+				-- This choses randomly a bodyPartIndex, which is the index used for the parts in the array bodyParts.
+				tempBodyPartIndex=math.random(1,sSBodyParts)
+				check=checkPart(tempBodyPartIndex,x,y,z)
+				-- If check == 1, this means that the part fits there, so we put it there and break the while true loop, to go on.
+				if check == 1 then
+					-- This prints the chosen part at position (x*gridDim*sSScale,y*gridDim*sSScale,z*gridDim*sSScale).
+					printModel(x,y,z,tempBodyPartIndex,false,1)
+					-- This actualizes the grid array with the values of the array bodyParts at the position tempBodyPartIndex, which is our randomly chosen part.
+					actualizeGrid(tempBodyPartIndex,x,y,z)
+					partSet=1
+				end
+				counter=counter+1
+			end
+			z=z+1
+		end
+		y=y+1
+	end
+	x=x+1
+end
+-- End attach all bodyparts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach backParts, if there are some.
+	spiralSet(0,0,1,1,backPartsIndex,backParts,false,1)
+-- End attach backParts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach frontParts, if there are.
+	spiralSet(0,0,1,-1,frontPartsIndex,frontParts,false,1)
+-- End attach frontParts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach parts on the left side of the space station.
+	spiralSet(1,0,0,-1,leftSidePartsIndex,leftSideParts,true,1)
+-- End attach left side parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach parts on the right side of the space station.
+	spiralSet(1,0,0,1,rightSidePartsIndex,rightSideParts,true,2)
+-- End attach right side parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach parts on top of the space station.
+	spiralSet(0,1,0,1,topPartsIndex,topParts,true,1)
+-- End attach top parts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- Attach all connectionparts.
+-- This iterates through the whole grid array.
+if connPartsIndex[0] ~= false then
+	for x=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do
+		for y=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do
+			for z=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do
+				tempConnPartIndex=connPartsIndex[math.random(1,connParts)]
+				-- This checks whether there has to be a connection part between (x,y,z) and (x+1,y,z) or not. First it checks if there is a part at (x,y,z) and
+				--	then it checks if that part can have a connection into the positive x-direction, if it can, it checks if there is a part at (x+1,y,z) and
+				--	if that part can have a connection into the negative x-direction, if both can, it prints the xml code to set a connection part.
+				if grid[x][y][z][0]==1 and (grid[x][y][z][1]=="+" or grid[x][y][z][1]=="+-") and grid[x+1][y][z][0]==1 and (grid[x+1][y][z][1]=="-" or grid[x+1][y][z][1]=="+-") then
+					-- This prints the connection part, the +1/2 is because the connection is set exactly in the middle of two gridpoints.
+					printModel(x+1/2,y,z,tempConnPartIndex,false,1)
+				end
+				-- The same as in the x-direction, but for the y-direction.
+				if grid[x][y][z][0]==1 and ( grid[x][y][z][2]=="+" or grid[x][y][z][2]=="+-" ) and grid[x][y+1][z][0]==1 and ( grid[x][y+1][z][2]=="-" or grid[x][y+1][z][2]=="+-" ) then
+					printModel(x,y+1/2,z,tempConnPartIndex,false,2)
+				end
+				-- The same as in the x-direction, but for the z-direction.
+				if grid[x][y][z][0]==1 and ( grid[x][y][z][3]=="+" or grid[x][y][z][3]=="+-" ) and grid[x][y][z+1][0]==1 and ( grid[x][y][z+1][3]=="-" or grid[x][y][z+1][3]=="+-" ) then
+					printModel(x,y,z+1/2,tempConnPartIndex,false,3)
+				end
+			end
+		end
+	end
+end
+-- End attach all connectionparts.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+-- This is xml code, which ends the attachment and the MovableEntity.
+print("</attached>")
+print("</MovableEntity>")
+-- End ends attachment and MovableEntity.
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
+
+
+end
+-- End createSpaceStationPar() function.
+
+
+
+-- This function is for the lazy guys, which do not care how the space station looks like, so I use some good standard values.
+function createSpaceStation()
+	createSpaceStationPar(0,4,1,2,1,6,1,100)
+end
+-- End createSpaceStaion() function.
+
+
+
Index: code/branches/resource2/data/levels/includes/weaponsettings1.oxi
===================================================================
--- code/branches/resource2/data/levels/includes/weaponsettings1.oxi	(revision 5646)
+++ code/branches/resource2/data/levels/includes/weaponsettings1.oxi	(revision 5646)
@@ -0,0 +1,39 @@
+    <weaponslots>
+      <WeaponSlot position="-15,-1.5,-25" yaw=0 pitch=0 roll=0 />
+      <WeaponSlot position="15,-1.5,-25" yaw=0 pitch=0 roll=0 />
+      <WeaponSlot position="0,0,-45" yaw=0 pitch=0 roll=0 />
+    </weaponslots>
+    <weaponsets>
+      <WeaponSet firemode=0 />
+      <WeaponSet firemode=1 />
+    </weaponsets>
+    <weapons>
+      <WeaponPack firemode=0>
+        <LaserGun
+            position="0,0,0"
+            munitionType="LaserGunMunition"
+            bulletLoadingTime="0.2"
+            magazineLoadingTime="5.0"
+            speed="1250"
+            unlimitedMunition=true
+        />
+        <LaserGun
+            position="0,0,0"
+            munitionType="LaserGunMunition"
+            bulletLoadingTime="0.2"
+            magazineLoadingTime="5.0"
+            speed="1250"
+            unlimitedMunition=true
+        />
+      </WeaponPack>
+      <WeaponPack firemode=1>
+        <Fusion
+            position="0,0,0"
+            munitionType="FusionMunition"
+            bulletLoadingTime="0.3"
+            magazineLoadingTime="3"
+            speed="600"
+            unlimitedMunition=true
+        />
+      </WeaponPack>
+    </weapons>
Index: code/branches/resource2/data/levels/includes/weaponsettings2.oxi
===================================================================
--- code/branches/resource2/data/levels/includes/weaponsettings2.oxi	(revision 5646)
+++ code/branches/resource2/data/levels/includes/weaponsettings2.oxi	(revision 5646)
@@ -0,0 +1,46 @@
+    <weaponslots>
+      <WeaponSlot position="-15,-0.5,0" yaw=0 pitch=0 roll=0 />
+      <WeaponSlot position="15,-.5,0" yaw=0 pitch=0 roll=0 />
+      <WeaponSlot position="0,0,-45" yaw=0 pitch=0 roll=0 />
+    </weaponslots>
+    <weaponsets>
+      <WeaponSet firemode=0 />
+      <WeaponSet firemode=1 />
+    </weaponsets>
+    <weapons>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+          <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+        </links>
+        <Weapon>
+          <attached>
+            <Model mesh="hs-w01.mesh" roll="195"/>
+            <Model mesh="hs-w01s.mesh" roll="195" position="0.1,-0.5,0"/>
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" muzzleoffset="-2,-0.2,-20" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="2,0.2,-20" />
+          <LaserFire mode=1 damage=1 munitionpershot=0 reloadtime=1 muzzleoffset="0,5,0" />
+          <LaserFire mode=1 damage=1 munitionpershot=0 reloadtime=1 muzzleoffset="0,-5,0" />
+        </Weapon>
+        <Weapon>
+          <attached>
+            <Model mesh="hs-w01.mesh" roll="165"/>
+            <Model mesh="hs-w01s.mesh" roll="165" position="-0.1,-0.5,0"/>
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-20" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-2,0.2,-20" />
+          <!--LaserFire mode=0 munitionpershot=0 muzzleoffset="0,0,-25" /-->
+          <LaserFire mode=1 damage=1 munitionpershot=0 reloadtime=1 muzzleoffset="0,5,0" />
+          <LaserFire mode=1 damage=1 munitionpershot=0 reloadtime=1 muzzleoffset="0,-5,0" />
+        </Weapon>
+      </WeaponPack>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
+        </links>
+        <Weapon>
+          <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-20" />
+        </Weapon>
+      </WeaponPack>
+    </weapons>
Index: code/branches/resource2/data/levels/includes/weaponsettings3.oxi
===================================================================
--- code/branches/resource2/data/levels/includes/weaponsettings3.oxi	(revision 5646)
+++ code/branches/resource2/data/levels/includes/weaponsettings3.oxi	(revision 5646)
@@ -0,0 +1,47 @@
+    <weaponslots>
+      <WeaponSlot position="-15.0,-1.5,0" />
+      <WeaponSlot position=" 15.0,-1.5,0" />
+      <WeaponSlot position="  0.0, 0.0,0" />
+    </weaponslots>
+    <weaponsets>
+      <WeaponSet firemode=0 />
+      <WeaponSet firemode=1 />
+    </weaponsets>
+    <weapons>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+          <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+        </links>
+        <Weapon>
+          <attached>
+            <Model mesh="LightningGun.mesh" pitch="78" roll="90" yaw="90" position="0,-1.3,0" />
+            <Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,0" />
+            <Model mesh="hs-w01.mesh" roll="195" position="0,1,0" scale=2 />
+            <Model mesh="hs-w01s.mesh" roll="195" position="0.1,0.5,0" scale=2 />
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.7, 1.5,-4" />
+          <HsW01 mode=0 munitionpershot=0 delay=0     material="Flares/point_lensflare" muzzleoffset="-0.9, 1.1,-4" />
+          <LightningGun mode=1 muzzleoffset="0,0,0" />
+        </Weapon>
+        <Weapon>
+          <attached>
+            <Model mesh="LightningGun.mesh" pitch="103" roll="90" yaw="90" position="0,-1.35,0" />
+            <Model mesh="LightningGun-s.mesh" pitch="103" roll="90" yaw="90" position="0.2,-1.35,0" />
+            <Model mesh="hs-w01.mesh" roll="165" position="0,1,0" scale=2 />
+            <Model mesh="hs-w01s.mesh" roll="165" position="-0.1,0.5,0" scale=2 />
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0     material="Flares/point_lensflare" muzzleoffset=" 0.9, 1.1, -4.0" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.7, 1.5, -4.0" />
+          <LightningGun mode=1 muzzleoffset="0,0,0" />
+        </Weapon>
+      </WeaponPack>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
+        </links>
+        <Weapon>
+          <!-- EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" / -->
+        </Weapon>
+      </WeaponPack>
+    </weapons>
Index: code/branches/resource2/data/levels/includes/weaponsettings_H2.oxi
===================================================================
--- code/branches/resource2/data/levels/includes/weaponsettings_H2.oxi	(revision 5646)
+++ code/branches/resource2/data/levels/includes/weaponsettings_H2.oxi	(revision 5646)
@@ -0,0 +1,45 @@
+    <weaponslots>
+      <WeaponSlot position="-7.5, 4, 8.5" />
+      <WeaponSlot position=" 7.5, 4, 8.5" />
+      <WeaponSlot position=" 0.0, 0,-13" />
+    </weaponslots>
+    <weaponsets>
+      <WeaponSet firemode=0 />
+      <WeaponSet firemode=1 />
+    </weaponsets>
+    <weapons>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+        </links>
+        <Weapon>
+          <attached>
+            <Model mesh="hs-w01.mesh"  roll="180" position="0.0, 0.5, 0.0" scale=2 />
+            <Model mesh="hs-w01s.mesh" roll="180" position="0.1, 0.0, 0.0" scale=2 />
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.8, 0.9,-4" />
+          <HsW01 mode=0 munitionpershot=0 delay=0     material="Flares/point_lensflare" muzzleoffset="-0.8, 0.9,-4" />
+        </Weapon>
+        <Weapon>
+          <attached>
+            <Model mesh="hs-w01.mesh"  roll="180" position=" 0.0, 0.5, 0.0" scale=2 />
+            <Model mesh="hs-w01s.mesh" roll="180" position="-0.1, 0.0, 0.0" scale=2 />
+          </attached>
+          <HsW01 mode=0 munitionpershot=0 delay=0     material="Flares/point_lensflare" muzzleoffset=" 0.8, 0.9, -4.0" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.8, 0.9, -4.0" />
+        </Weapon>
+      </WeaponPack>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
+        </links>
+        <Weapon>
+          <attached>
+            <Model mesh="LightningGun.mesh"   pitch="90" roll="90" yaw="90" position="0,  -1.3,0" />
+            <Model mesh="LightningGun-s.mesh" pitch="90" roll="90" yaw="90" position="0.2,-1.3,0" />
+          </attached>
+          <LightningGun mode=0 muzzleoffset="0,0,0" />
+        </Weapon>
+      </WeaponPack>
+    </weapons>
+
Index: code/branches/resource2/data/levels/includes/weaponsettings_pirate.oxi
===================================================================
--- code/branches/resource2/data/levels/includes/weaponsettings_pirate.oxi	(revision 5646)
+++ code/branches/resource2/data/levels/includes/weaponsettings_pirate.oxi	(revision 5646)
@@ -0,0 +1,24 @@
+    <weaponslots>
+      <WeaponSlot position=" 4.3,-6,-10" />
+      <WeaponSlot position="-4.3,-6,-10" />
+    </weaponslots>
+    <weaponsets>
+      <WeaponSet firemode=0 />
+      <WeaponSet firemode=1 />
+    </weaponsets>
+    <weapons>
+      <WeaponPack>
+        <links>
+          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+          <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+        </links>
+        <Weapon>
+          <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.5,0.6,1.7" />
+        </Weapon>
+        <Weapon>
+          <HsW01 mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare" />
+          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.5,0.6,1.7" />
+        </Weapon>
+      </WeaponPack>
+    </weapons>
Index: code/branches/resource2/data/levels/old/CuboidSpaceStation.oxw
===================================================================
--- code/branches/resource2/data/levels/old/CuboidSpaceStation.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/CuboidSpaceStation.oxw	(revision 5646)
@@ -0,0 +1,112 @@
+<?lua
+	include("overlay/hudtemplates3.oxo")
+?>
+
+<?lua
+	include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+	name = "SpaceStation test Space!"
+	description = "All the new SpaceStations are created here!"
+>
+	<Scene
+		ambientlight = "0.5, 0.5, 0.5"
+		skybox = "Orxonox/Starbox"
+	>
+
+
+
+<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
+<?lua
+	dofile("../../media/levels/includes/CuboidSpaceStation.lua")
+?>
+
+<!-- The following examples insert some space station in various ways, so I guess you will understand how to use my .lua file and the functions of it.
+--->
+
+<!-- Here I add a space station at position 0,0,0 without velocity and no rotation.
+--->
+<?lua
+	createSpaceStation()
+?>
+
+
+
+<!-- Here I add a space station at position 0,0,-5000 without velocity and no rotation.
+--->
+<PositionableEntity scale=1 position="0,0,-5000">
+	<attached>
+		<?lua
+			createSpaceStation()
+		?>
+	</attached>
+</PositionableEntity>
+
+
+
+<!-- Here I add a space station at position 5000,0,0 with velocity 50,0,0 and a rotation so that the space station faces into the positive x-axis.
+--->
+<MovableEntity scale=1 position="5000,0,0" velocity="50,0,0" yaw=-90>
+	<attached>
+		<?lua
+			createSpaceStation()
+		?>
+	</attached>
+</MovableEntity>
+
+
+
+<!-- Here I add a space station at position -5000,0,0 without velocity but rotation around his own y-axis.
+--->
+<MovableEntity scale=1 position="-5000,0,0" rotationaxis="0,1,0" rotationrate=5>
+	<attached>
+		<?lua
+			createSpaceStation()
+		?>
+	</attached>
+</MovableEntity>
+
+
+
+<!-- Here I add a space station at position 10000,0,0 which will rotate around the position 0,0,0 and around his own axis in flight direction.
+---- To do so, I create a MovableEntity at position 0,0,0 and attach another MovableEntity with relative coordinates to the first MovableEntity 10000,0,0.
+---- I rotate the first MovableEntity, so the second Entity rotates around 0,0,0 in the x-,z-area with a radius 10000, and so does the space station,
+---- because the space station is attached to the second MovableEntity with relative coordinates 0,0,0 (this is defined in the .lua file).
+---- Then I rotate also the second MovableEntity around his own z-axis, so the space station rotates also around its own axis.
+--->
+<MovableEntity scale=1 position="0,0,0" rotationaxis="0,1,0" rotationrate=3>
+	<attached>
+		<MovableEntity scale=1 position="10000,0,0" rotationaxis="0,0,1" rotationrate=2>
+			<attached>
+				<?lua
+					-- Here I use the createSpaceStationPar(...) function, which has 8 arguments, see the .lua file at the top to understand them.
+					createSpaceStationPar(0,2,1,2,1,2,1,50)
+				?>
+			</attached>
+		</MovableEntity>
+	</attached>
+</MovableEntity>
+
+
+
+<!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
+
+
+
+	<ParticleSpawner position="0,0,0" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/old/physicstest.oxw
===================================================================
--- code/branches/resource2/data/levels/old/physicstest.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/physicstest.oxw	(revision 5646)
@@ -0,0 +1,19 @@
+<Ambient colourvalue="0.8, 0.8, 0.8" />
+<Skybox src="Orxonox/Starbox" />
+<SpaceShip camera="true" position="50,0,0" scale="10" yawpitchroll="0,-90,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" />
+<Model position="2000,0,0" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,2000,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,0,2000" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="10000,16000,0" scale="100" mesh="DuBall1.mesh"/>
+<Model position="11400,16000,0" scale="60" mesh="DuBall2.mesh"/>
+
+<HelloBullet/>
+
+
+<?lua
+for i = 1, 226, 1 
+do ?>
+  <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 250 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" />
+<?lua 
+end
+?>
Index: code/branches/resource2/data/levels/old/physicstest2.oxw
===================================================================
--- code/branches/resource2/data/levels/old/physicstest2.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/physicstest2.oxw	(revision 5646)
@@ -0,0 +1,280 @@
+<?lua
+  include("levels/old/spaceshiptemplates_physics.oxw")
+?>
+<?lua
+  include("overlay/hudtemplates3.oxo")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/Starbox"
+   negativeWorldRange = "(-100000, -100000, -100000)"
+   positiveWorldRange = "( 100000,  100000,  100000)"
+   hasPhysics   = true
+  >
+      <!--SpawnPoint position="0,   0,  100"           spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0,   0, -700" yaw  =180 spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0, 300, -300" pitch=-90 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
+
+	<!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
+	<StaticEntity
+     position        = "0,0,0"
+     name            = "banana"
+     collisionType   = "static"
+     mass            = 1000
+    >
+      <attached>
+        <Model position="0,0,0" scale=100 mesh="plane.mesh" />
+        <Model position="0,-0.0001,0" roll=180 scale=100 mesh="plane.mesh" />
+      </attached>
+      <collisionShapes>
+        <PlaneCollisionShape name="thePlane" planeNormal="0,1,0" planeOffset=0 />
+      </collisionShapes>
+	</StaticEntity>
+
+	<!-- red sphere for phsics engine testing purposes-->
+	<!--StaticEntity position="40,0,0">
+		<attached>
+			<Model position="0,0,0" scale=1 mesh="sphere.mesh" />
+		</attached>
+	</StaticEntity-->
+
+	<!-- yellow cube for phsics engine testing purposes-->
+	<!--StaticEntity position="80,0,0">
+      <attached>
+        <Model position="0,0,0" scale=1 mesh="cube.mesh" />
+      </attached>
+	</StaticEntity-->
+
+    <MovableEntity
+     name            = "blubb"
+     position        = "-150, 20, -500"
+     collisionType   = "kinematic"
+     mass            = 10000
+     velocity        = "30, 0, 0"
+    >
+      <attached>
+        <Model name = "moedeli" position="0,0,0" scale=20 mesh="sphere.mesh" />
+        <StaticEntity name="hahaha" position="0,0,0" collisionType="static">
+          <collisionShapes>
+            <SphereCollisionShape name="firstSphere" radius=20/>
+          </collisionShapes>
+        </StaticEntity>
+      </attached>
+
+      <!--attached>
+        <SphereCollisionShape name = "secondSphere" radius=0.4 position="1,1,1"/>
+        <CompoundCollisionShape position="4,4,4">
+          <SphereCollisionShape name = "thirdSphere" radius=1.0/>
+        </CompoundCollisionShape>
+      </attached-->
+    </MovableEntity>
+
+    <MovableEntity
+     name            = "blubb2"
+     position        = "150, 30, -500"
+     collisionType   = "dynamic"
+     mass            = 10
+     velocity        = "-30, 0, 0"
+    >
+      <attached>
+        <Model position="0,0,0" scale=20 mesh="sphere.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="0,0,0"/>
+      </collisionShapes>
+    </MovableEntity>
+
+    <StaticEntity
+     name            = "blubbStatic"
+     position        = "0, 15, -500"
+     collisionType   = "Static"
+     mass            = 10
+    >
+      <attached>
+        <Model position="0,0,0" scale=20 mesh="sphere.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="0,0,0"/>
+      </collisionShapes>
+    </StaticEntity>
+
+    <!--SpawnPoint position="0,   0,  100"           spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0,   0, -700" yaw  =180 spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0, 300, -300" pitch=-90 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
+
+    <MovableEntity
+     name            = "apple1"
+     position        = "-150, 80, -500"
+     collisionType   = "dynamic"
+     mass            = 10
+     velocity        = "30, 0, 0"
+    >
+      <attached>
+        <Model position="0,0,0" scale=20 mesh="sphere.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="0,0,0"/>
+      </collisionShapes>
+    </MovableEntity>
+
+    <MovableEntity
+     name            = "apple2"
+     position        = "50, 80, -500"
+     collisionType   = "dynamic"
+     mass            = 10
+     velocity        = "-30, 0, 0"
+    >
+      <attached>
+        <Model position="0,0,0" scale=20 mesh="sphere.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="0,0,0"/>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="1,0,0"/>
+      </collisionShapes>
+    </MovableEntity>
+
+    <MovableEntity
+     name            = "apple3"
+     position        = "150, 80, -500"
+     collisionType   = "dynamic"
+     mass            = 10
+     velocity        = "-30, 0, 0"
+    >
+      <attached>
+        <Model position="0,0,0" scale=20 mesh="sphere.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape name = "secondSphere" radius=20 position="0,0,0"/>
+      </collisionShapes>
+    </MovableEntity>
+
+    <!--MovableEntity scale=1.5 position="0,0,-300" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=90>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,-300" distance=50 target="ControllableEntity" invert=1 />
+        </activity>
+      </events>
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="ast1.mesh" />
+        <StaticEntity position="0,0,100">
+          <attached>
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <MovableEntity position="0,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=500>
+              <attached>
+                <Model position="0,35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="0,-35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+                  </attached>
+                </Model>
+                <Model position="-35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+                  </attached>
+                </Model>
+              </attached>
+            </MovableEntity>
+          </attached>
+        </StaticEntity>
+        <MovableEntity position="0,0,-100" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=200>
+          <attached>
+            <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <Model position="0,0,-50" scale=3 mesh="ast1.mesh" />
+            <Model position="0,0,50" scale=3 mesh="ast1.mesh" />
+          </attached>
+        </MovableEntity>
+      </attached>
+    </MovableEntity-->
+
+
+    <!--ParticleSpawner position="-500,0,-200" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-300" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-400" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-500" source="Orxonox/BigExplosion1part1" lifetime=2.5 loop=1 />
+    <ParticleSpawner position="-500,0,-600" source="Orxonox/BigExplosion1part1" lifetime=2.5 loop=1 /-->
+
+
+    <ParticleSpawner position="0,20,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="0,20,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+
+
+    <!--ParticleEmitter name=fireright position="200,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger1 position="200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=fireleft position="-200,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger2 position="-200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <EventListener event=firetrigger1 />
+          <EventListener event=firetrigger2 />
+        </activity>
+      </events>
+    </ParticleEmitter-->
+
+
+    <!--EventDispatcher>
+      <targets>
+        <EventTarget name=fireright />
+        <EventTarget name=firecenter />
+        <EventTarget name=fireleft />
+      </targets>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,200" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </EventDispatcher-->
+
+
+    <!--Model position="0,50,0" scale=3 mesh="assff.mesh">
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,50,0" distance=50 target="ControllableEntity" invert=1 />
+        </visibility>
+      </events>
+    </Model-->
+
+
+    <Model position="0,0,200" scale=10 mesh="ast2.mesh" shadow=true />
+    <!--Model position="0,0,-200" scale=10 mesh="ast1.mesh" shadow=true /-->
+    <Model position="0,200,0" scale=10 mesh="ast3.mesh" shadow=true />
+    <Model position="0,-200,0" scale=10 mesh="ast4.mesh" shadow=true />
+    <Model position="200,0,0" scale=10 mesh="ast5.mesh" shadow=false />
+    <Model position="-200,0,0" scale=10 mesh="ast6.mesh" shadow=false />
+
+    <Model position="1000,-200,0" scale3D="1,100,100" mesh="ast1.mesh" />
+
+    <Model position="0, 0,-100" pitch=-90 roll=-90 scale=4 mesh="assff.mesh" />
+    <!--Model position="0,100,-100" pitch=-90 roll=-90 scale=4 mesh="pirate.mesh" />
+    <Model position="0,300,-100" pitch=-90 roll=-90 scale=4 mesh="spacecruiser.mesh" /-->
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/old/planettest.oxw
===================================================================
--- code/branches/resource2/data/levels/old/planettest.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/planettest.oxw	(revision 5646)
@@ -0,0 +1,38 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+?>
+
+<?lua
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/Starbox"
+  >
+
+    <ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+
+
+    <Planet position="2500,0,-9000" scale=1000 pitch=-90 mesh="earth.mesh" rotationaxis="0,0,1" rotationrate="0.1" atmospheresize=130.0f imagesize=1024.0f />
+    <Planet position="0,0,-5001" scale=1000 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="1,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+    <Model position="0, 0,-100" pitch=-90 roll=-90 scale=4 mesh="assff.mesh" />
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/old/presentation_physics.oxw
===================================================================
--- code/branches/resource2/data/levels/old/presentation_physics.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/presentation_physics.oxw	(revision 5646)
@@ -0,0 +1,109 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  math.randomseed(344)
+?>
+
+<Level
+ name         = "Physics"
+ description  = "Just a few tests"
+>
+  <Scene
+   ambientlight = "0.8, 0.8, 0.8"
+   skybox       = "Orxonox/skypanoramagen1"
+   gravity      = "0, -10, 0"
+  >
+    <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" />
+
+    <StaticEntity
+     position        = "0,0,0"
+     name            = "floor"
+     collisionType   = "static"
+     friction        = 1
+    >
+      <attached>
+        <Model position="0,0,0" scale=100 mesh="plane.mesh" />
+        <Model position="0,-0.0001,0" roll=180 scale=100 mesh="plane.mesh" />
+      </attached>
+      <collisionShapes>
+        <PlaneCollisionShape planeNormal="0,1,0" planeOffset=0 />
+      </collisionShapes>
+	</StaticEntity>
+
+	<MovableEntity
+     position        = "0,250,500"
+     rotationaxis    = "1, 1, 1"
+     rotationrate    = 360
+     velocity        = "0, 0, -80"
+     name            = "ship"
+     collisionType   = "dynamic"
+     friction        = 0.5
+     mass            = 500
+     restitution     = 0
+    >
+      <attached>
+        <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+        <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+        <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+
+        <!--Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+        <Model position="0,0,0" scale3D="10, 3, 5" mesh="cube.mesh" />
+        <Model position="13,-1.3,0" scale3D="3, 1, 2" mesh="cube.mesh" />
+        <Model position="-13,-1.3,0" scale3D="3, 1, 2" mesh="cube.mesh" />
+        <Model position="0,0,7" scale3D="3, 2, 2" mesh="cube.mesh" />
+        <Model position="0,0.1,-11" scale3D="2.2, 1.8, 6" mesh="cube.mesh" />
+        <Model position="0,0.1,-19" scale3D="1.4, 1, 2" mesh="cube.mesh" /-->
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
+        <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
+        <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+        <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
+        <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
+        <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
+      </collisionShapes>
+	</MovableEntity>
+
+    <?lua
+    for i = -20, 20, 8
+    do
+      for i2 = -20, 20, 8
+      do
+        for i3 = -20, 20, 8
+        do ?>
+        <MovableEntity
+         position="<?lua print(i)?>, <?lua print(i3 + 250)?>, <?lua print(i2) ?>"
+         collisionType = "dynamic"
+         mass = 1
+         restitution = 0
+         friction = 0.5
+        >
+          <attached>
+            <Model position="0,0,0" scale=2 mesh="cube.mesh" />
+          </attached>
+          <collisionShapes>
+            <BoxCollisionShape halfExtents="2, 2, 2" />
+          </collisionShapes>
+        </MovableEntity>
+    <?lua
+        end
+      end
+    end
+    ?>
+
+    <ParticleSpawner position="-100,170,30" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="-100,170,30" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/old/princessaeryn.oxw
===================================================================
--- code/branches/resource2/data/levels/old/princessaeryn.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/princessaeryn.oxw	(revision 5646)
@@ -0,0 +1,315 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<?lua
+	dofile("../../media/levels/includes/CuboidSpaceStation.lua")
+?>
+
+<NotificationQueue
+	name  = "notification"
+	position = "1.0, 1.0"
+	targets = "questsystem"
+/>
+
+<Level
+ name         = "The Tale of Princess Aeryn"
+ description  = "The Tale of Princess Aeryn"
+>
+    <Scene
+        ambientlight = "0.3, 0.3, 0.3"
+        skybox       = "Orxonox/skypanoramagen1"
+    >
+      <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" />
+
+        <Template name=turboitem baseclass=Turbo>
+          <Turbo
+            playerclass=SpaceShip
+            duration=15
+          />
+        </Template>
+
+        <ParticleSpawner position="200,0,-500" source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events>
+            <spawn>
+              <PickupSpawner position="200,0,-500" distance=50 respawntimer=25 item=turboitem>
+                <attached>
+                  <Model mesh="sphere.mesh" scale=3 />
+                  <Billboard material="Examples/Flare" colour="0.5, 1.0, 0.3" scale=0.5 />
+                </attached>
+              </PickupSpawner>
+            </spawn>
+          </events>
+        </ParticleSpawner>
+
+        <Template name=turboequipment baseclass=Turbo>
+          <Turbo
+            playerclass=SpaceShip
+            duration=0
+          />
+        </Template>
+
+        <ParticleSpawner position="400,0,-1000" source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events>
+            <spawn>
+              <PickupSpawner position="400,0,-1000" distance=50 respawntimer=25 item=turboequipment>
+                <attached>
+                  <Model mesh="sphere.mesh" scale=3 />
+                  <Billboard material="Examples/Flare" colour="1.0, 0.5, 0.3" scale=0.5 />
+                </attached>
+              </PickupSpawner>
+            </spawn>
+          </events>
+        </ParticleSpawner>
+
+        <!-- Quest: -->
+        <GlobalQuest id="b80c2c60-e62c-4637-80f8-5aa18dc93b34">
+            <QuestDescription title="The Tale of Princess Aeryn" description="Princess Aeryn has been kidnapped by evil Mr. M and you were just a little too late to save her.\nYou have to find and save her from her captors." failMessage="You cannot fail, how did you?" completeMessage="You did it John. You're a hero. Princess Aeryn however will still not marry you." />
+            <subquests>
+                <GlobalQuest id="43766602-7e2f-4d24-976a-3f9de1474d5b">
+                    <QuestDescription title="Find Aeryn's S.H.O.E.S." description="Oh, the kidnappers must have been in a hurry because they overlooked princess Aeryns S.H.O.E.S. (Super Heavily Organized Escape Ship) hidden in the asteroid field over there.\nFind it and look there for clues to Princess Aeryns whereabouts." completeMessage="You did it, Looking through her stuff you find an odd looking device - Could this be the receiver of Princess Aeryns locator beacon? - But it must be broken, the screen remains blank." />
+                    <complete-effects>
+                        <AddQuest questId="50845552-c8af-4091-947c-76bd850b224e" />
+                    </complete-effects>
+                </GlobalQuest>
+                <GlobalQuest id="50845552-c8af-4091-947c-76bd850b224e">
+                    <QuestDescription title="Repair the receiver." description="There is a space station called 'Serenity Station' near here. An engineer called Nathan Stark who shoud be able to help you lives there." completeMessage="'Yeah Nathan lives here, he'll shurely help you.'\nAnd he does, apparenty the device was just low on batteries so you're now able to locate your beloved Princess Aeryn." />
+                    <hints>
+                        <QuestHint id="b9b10841-b045-4797-b1d3-cfce760e1de6">
+                            <QuestDescription title="The Katratzi Station" description="'We ain't buying!'\n'What do you want?'\n'No there lives no Nathan here.'\n'Fuck off.''" />
+                        </QuestHint>
+                        <QuestHint id="1ee785f8-b71d-4b51-b080-42cec5be8e3c">
+                            <QuestDescription title="The Pegasus Station" description="'Hello friend.'\n'How can we help you?'\n'A Mr. Stark you say? Sorry no man with such a name lives here.'" />
+                        </QuestHint>
+                    </hints>
+                    <complete-effects>
+                        <AddQuest questId="97628524-b243-492c-b7b6-498f325b21d4" />
+                    </complete-effects>
+                </GlobalQuest>
+                <GlobalQuest id="97628524-b243-492c-b7b6-498f325b21d4">
+                    <QuestDescription title="Follow the dots" description="Just follow the dots, they'll lead you right to her." completeMessage="You found Princess Aeryn. Her captors give up at the shere sight ou you." />
+                    <complete-effects>
+                        <CompleteQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+                    </complete-effects>
+                </GlobalQuest>
+            </subquests>
+        </GlobalQuest>
+
+        <!-- Create spaceship spawner: -->
+        <ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+          <events>
+            <spawn>
+              <EventTrigger delay=1>
+                <events>
+                  <trigger>
+                    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+                  </trigger>
+                </events>
+              </EventTrigger>
+            </spawn>
+          </events>
+          <attached>
+            <QuestEffectBeacon position="0,0,0" times=1>
+                <effects>
+                    <AddQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+                    <AddQuest questId="43766602-7e2f-4d24-976a-3f9de1474d5b" />
+                </effects>
+                <events>
+                    <execute>
+                        <EventListener event=questbeacon1 />
+                    </execute>
+                </events>
+                <attached>
+                    <DistanceTrigger name=questbeacon1 position="0,0,0" distance=10 target="ControllableEntity" />
+                </attached>
+            </QuestEffectBeacon>
+          </attached>
+        </ParticleSpawner>
+
+        <!-- Create world -->
+
+            <!-- Kidnapper flying away -->
+            <MovableEntity position="200,0,0" velocity="-140,0,-140" yaw=45>
+                <attached>
+                    <Model position="0,0,0" scale=4 yaw=180 pitch=-90 roll=-90 mesh="pirate.mesh" />
+                    <ParticleSpawner position="0,0,10" source="Orxonox/fire3" lifetime=2.0 loop=0 autostart=1 />
+                    <QuestEffectBeacon position="0,0,0" times=1 active=false name=trail >
+                        <effects>
+                            <CompleteQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event=questbeacon7 />
+                            </execute>
+                        </events>
+                        <attached>
+                            <DistanceTrigger name=questbeacon7 position="0,0,0" distance=10 target="ControllableEntity" />
+                        </attached>
+                    </QuestEffectBeacon>
+                </attached>
+            </MovableEntity>
+
+            <!-- Asteroid field -->
+            <StaticEntity position="-500,0,-3000">
+                <attached>
+                    <?lua
+                        for i = 1, 200
+                        do ?>
+                        <MovableEntity position="<?lua print(math.random() * 2000 - 1000)?>, <?lua print(math.random() * 2000 - 1000) ?>, <?lua print(math.random() * 2000 - 1000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.abs(math.random() * 30 -10)) ?>">
+                            <attached>
+                                <Model scale="<?lua print(math.random() * 50) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+                            </attached>
+                        </MovableEntity>
+                    <?lua
+                        end
+                    ?>
+                    <!-- S.H.O.E.S -->
+                    <StaticEntity position="-300,0,0">
+                        <attached>
+                            <Model position="0,0,0" scale=4 yaw=180 pitch=-90 roll=-90 mesh="assff.mesh" />
+                            <QuestEffectBeacon position="0,0,0" times=-1>
+                                <effects>
+                                    <CompleteQuest questId="43766602-7e2f-4d24-976a-3f9de1474d5b" />
+                                </effects>
+                                <events>
+                                    <execute>
+                                        <EventListener event=questbeacon2 />
+                                    </execute>
+                                </events>
+                                <attached>
+                                    <DistanceTrigger name=questbeacon2 position="0,0,0" distance=50 target="ControllableEntity" />
+                                </attached>
+                            </QuestEffectBeacon>
+                        </attached>
+                    </StaticEntity>
+                </attached>
+            </StaticEntity>
+
+
+
+            <!-- Spacestations -->
+
+            <!-- Serenity Station -->
+            <StaticEntity scale=1 position="0,0,5000" yaw=30>
+                <attached>
+                    <?lua
+                        createSpaceStationPar(65461,2,1,2,1,2,1,100)
+                    ?>
+                    <QuestEffectBeacon position="0,450,0" times=1>
+                        <effects>
+                            <CompleteQuest questId="50845552-c8af-4091-947c-76bd850b224e" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event=questbeacon3 />
+                            </execute>
+                        </events>
+                        <attached>
+                            <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
+                            <DistanceTrigger name=questbeacon3 position="0,0,0" distance=100 target="ControllableEntity" />
+                        </attached>
+                    </QuestEffectBeacon>
+                </attached>
+            </StaticEntity>
+
+            <!-- Katratzi Station -->
+            <StaticEntity scale=1 position="0,5000,300" yaw=60>
+                <attached>
+                    <?lua
+                        createSpaceStationPar(9851,2,1,2,1,2,1,100)
+                    ?>
+                    <QuestEffectBeacon position="0,450,0" times=1>
+                        <effects>
+                            <AddQuestHint hintId="b9b10841-b045-4797-b1d3-cfce760e1de6" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event=questbeacon4 />
+                            </execute>
+                        </events>
+                        <attached>
+                            <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
+                            <DistanceTrigger name=questbeacon4 position="0,0,0" distance=100 target="ControllableEntity" />
+                        </attached>
+                    </QuestEffectBeacon>
+                </attached>
+            </StaticEntity>
+
+            <!-- Pegasus Station -->
+            <StaticEntity scale=1 position="-5000,100,1000" roll=30>
+                <attached>
+                    <?lua
+                        createSpaceStationPar(3574,2,1,2,1,2,1,100)
+                    ?>
+                    <QuestEffectBeacon position="200,450,0" times=1>
+                        <effects>
+                            <AddQuestHint hintId="1ee785f8-b71d-4b51-b080-42cec5be8e3c" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event=questbeacon5 />
+                            </execute>
+                        </events>
+                        <attached>
+                            <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
+                            <DistanceTrigger name=questbeacon5 position="0,0,0" distance=100 target="ControllableEntity" />
+                        </attached>
+                    </QuestEffectBeacon>
+                </attached>
+            </StaticEntity>
+
+            <!-- Trail -->
+            <EventDispatcher>
+                <targets>
+                    <EventTarget name=trail />
+                </targets>
+                <events>
+                    <visibility>
+                        <QuestListener questId="50845552-c8af-4091-947c-76bd850b224e" mode="complete" />
+                    </visibility>
+                    <activity>
+                        <QuestListener questId="50845552-c8af-4091-947c-76bd850b224e" mode="complete" />
+                    </activity>
+                </events>
+            </EventDispatcher>
+
+            <?lua
+                for i = 1, 25
+                do
+            ?>
+                <Billboard position="<?lua print(i*5000/25) ?>,<?lua print(450+i*(5000-450)/25) ?>,5000" colour="1.0,0,0" material="Examples/Flare" name=trail visible=false/>
+            <?lua
+                end
+            ?>
+
+            <!-- Hideout -->
+            <StaticEntity position="5000,5000,5000" >
+                <attached>
+                    <Model scale="100" mesh="ast2.mesh" shadow=false />
+                </attached>
+            </StaticEntity>
+
+            <StaticEntity position="5400,5400,5000" visible=false name=trail >
+                <attached>
+                    <Model position="0,0,0" scale=4 yaw=180 pitch=-90 roll=-90 mesh="pirate.mesh" visible=false name=trail />
+                    <QuestEffectBeacon position="0,0,0" times=1 active=false name=trail >
+                        <effects>
+                            <CompleteQuest questId="97628524-b243-492c-b7b6-498f325b21d4" />
+                        </effects>
+                        <events>
+                            <execute>
+                                <EventListener event=questbeacon6 />
+                            </execute>
+                        </events>
+                        <attached>
+                            <DistanceTrigger name=questbeacon6 position="0,0,0" distance=100 target="ControllableEntity" />
+                        </attached>
+                    </QuestEffectBeacon>
+                </attached>
+            </StaticEntity>
+
+    </Scene>
+</Level>
+
Index: code/branches/resource2/data/levels/old/questsystem.oxw
===================================================================
--- code/branches/resource2/data/levels/old/questsystem.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/questsystem.oxw	(revision 5646)
@@ -0,0 +1,115 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<NotificationQueue
+	name  = "notification"
+	position = "1.0, 1.0"
+	targets = "all"
+/>
+
+<Level
+ name         = "Questsystem"
+ description  = "Just a few tests"
+>
+    <Scene
+    ambientlight = "0.5, 0.5, 0.5"
+    skybox       = "Orxonox/Starbox"
+    >
+
+        <GlobalQuest id="b80c2c60-e62c-4637-80f8-5aa18dc93b34">
+            <QuestDescription title="The Main QUest" description="This is the main quest hooray. Solve it!" failMessage="You fail. Looser." completeMessage="You Win." />
+            <hints>
+                <QuestHint id="022a859d-08dd-4eac-a085-c28c29c06d48">
+                    <QuestDescription title="The super Hint." description="Be proud of yourself." />
+                </QuestHint>
+            </hints>
+        </GlobalQuest>
+
+				<ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+				  <events>
+				    <spawn>
+				      <EventTrigger delay=1>
+				        <events>
+				          <trigger>
+				            <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+				          </trigger>
+				        </events>
+				      </EventTrigger>
+				    </spawn>
+				  </events>
+				</ParticleSpawner>
+
+        <QuestEffectBeacon position="0,0,100" times=-1>
+            <effects>
+                <AddQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=qebdt1 />
+                </execute>
+            </events>
+            <attached>
+                <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Examples/Flare" />
+                <DistanceTrigger name=qebdt1 position="0,0,0" distance=10 target="ControllableEntity" />
+            </attached>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon position="-100,0,0" times=-1>
+            <effects>
+                <FailQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=qebdt2 />
+                </execute>
+            </events>
+            <attached>
+                <Billboard position="0,0,0" colour="1.0,0,0" material="Examples/Flare" />
+                <DistanceTrigger name=qebdt2 position="0,0,0" distance=10 target="ControllableEntity" />
+            </attached>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon position="100,0,0" times=-1>
+            <effects>
+                <CompleteQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=qebdt3 />
+                </execute>
+            </events>
+            <attached>
+                <Billboard position="0,0,0" colour="0,1.0,0" material="Examples/Flare" />
+                <DistanceTrigger name=qebdt3 position="0,0,0" distance=10 target="ControllableEntity" />
+            </attached>
+        </QuestEffectBeacon>
+
+        <QuestEffectBeacon position="0,100,0" times=-1>
+            <effects>
+                <AddQuestHint hintId="022a859d-08dd-4eac-a085-c28c29c06d48" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event=qebdt4 />
+                </execute>
+            </events>
+            <attached>
+                <Billboard position="0,0,0" colour="0,0,1.0" material="Examples/Flare" />
+                <DistanceTrigger name=qebdt4 position="0,0,0" distance=10 target="ControllableEntity" />
+            </attached>
+        </QuestEffectBeacon>
+
+        <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+            <events>
+                <activity>
+                    <QuestListener questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" mode="complete" />
+                </activity>
+            </events>
+        </ParticleEmitter>
+
+    </Scene>
+</Level>
+
Index: code/branches/resource2/data/levels/old/sample4.oxw
===================================================================
--- code/branches/resource2/data/levels/old/sample4.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/sample4.oxw	(revision 5646)
@@ -0,0 +1,160 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+?>
+
+<?lua
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/Starbox"
+  >
+    <!--SpawnPoint position="0,   0,  100"           spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0,   0, -700" yaw  =180 spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0, 300, -300" pitch=-90 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
+
+    <MovableEntity position="-300,200,-800" velocity="5,0,0" rotationaxis="1,0,0" rotationrate=0>
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
+        <MovableEntity position="-4,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
+	  <attached>
+            <Model position="4,0,0" scale=10 mesh="satellitedish.mesh"/>
+          </attached>
+	</MovableEntity>
+        <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=-45 roll=30 position="-14,-3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=45 roll=30 position="-14,-3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+      </attached>
+    </MovableEntity>
+
+    <MovableEntity scale=1.5 position="0,0,-300" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=90>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,-300" distance=50 target="ControllableEntity" invert=1 />
+        </activity>
+      </events>
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="ast1.mesh" />
+        <PositionableEntity position="0,0,100">
+          <attached>
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <MovableEntity position="0,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=500>
+              <attached>
+                <Model position="0,35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="0,-35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+                  </attached>
+                </Model>
+                <Model position="-35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+                  </attached>
+                </Model>
+              </attached>
+            </MovableEntity>
+          </attached>
+        </PositionableEntity>
+        <MovableEntity position="0,0,-100" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=200>
+          <attached>
+            <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <Model position="0,0,-50" scale=3 mesh="ast1.mesh" />
+            <Model position="0,0,50" scale=3 mesh="ast1.mesh" />
+          </attached>
+        </MovableEntity>
+      </attached>
+    </MovableEntity>
+
+
+    <ParticleSpawner position="-500,0,-200" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-300" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-400" source="Orxonox/BigExplosion1part1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-500" source="Orxonox/BigExplosion1part1" lifetime=2.5 loop=1 />
+    <ParticleSpawner position="-500,0,-600" source="Orxonox/BigExplosion1part1" lifetime=2.5 loop=1 />
+
+
+    <ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+
+
+    <ParticleEmitter name=fireright position="200,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger1 position="200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=fireleft position="-200,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger2 position="-200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <EventListener event=firetrigger1 />
+          <EventListener event=firetrigger2 />
+        </activity>
+      </events>
+    </ParticleEmitter>
+
+
+    <EventDispatcher>
+      <targets>
+        <EventTarget name=fireright />
+        <EventTarget name=firecenter />
+        <EventTarget name=fireleft />
+      </targets>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,200" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </EventDispatcher>
+
+
+    <Model position="0,50,0" scale=3 mesh="assff.mesh">
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,50,0" distance=50 target="ControllableEntity" invert=1 />
+        </visibility>
+      </events>
+    </Model>
+
+
+    <Model position="0,0,200" scale=10 mesh="ast2.mesh" shadow=true />
+    <!--Model position="0,0,-200" scale=10 mesh="ast1.mesh" shadow=true /-->
+    <Model position="0,200,0" scale=10 mesh="ast3.mesh" shadow=true />
+    <Model position="0,-200,0" scale=10 mesh="ast4.mesh" shadow=true />
+    <Model position="200,0,0" scale=10 mesh="ast5.mesh" shadow=false />
+    <Model position="-200,0,0" scale=10 mesh="ast6.mesh" shadow=false />
+
+    <Model position="1000,-200,0" scale3D="1,100,100" mesh="ast1.mesh" />
+
+    <Model position="0, 0,-100" pitch=-90 roll=-90 scale=4 mesh="assff.mesh" />
+    <!--Model position="0,100,-100" pitch=-90 roll=-90 scale=4 mesh="pirate.mesh" />
+    <Model position="0,300,-100" pitch=-90 roll=-90 scale=4 mesh="spacecruiser.mesh" /-->
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/old/spaceshiptemplates_physics.oxw
===================================================================
--- code/branches/resource2/data/levels/old/spaceshiptemplates_physics.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/spaceshiptemplates_physics.oxw	(revision 5646)
@@ -0,0 +1,87 @@
+<Template name=spaceshipassff>
+  <SpaceShip
+   camerapositiontemplate = spaceshipassffcameras
+
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   primaryThrust     = 100;
+   auxilaryThrust    = 30;
+   rotationThrust    = 10;
+   
+   collisionType     = "dynamic"
+   mass              = 100
+   linearDamping     = 0.7
+   angularDamping    = 0.999
+   name              = "blubbbeliblubb"
+  >
+    <attached>
+      <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+      <!--Light position="0,0,20" diffuse="0,0,1" specular="0,0,1" type=point /-->
+      <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+      <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+      <!--ParticleEmitter position="0,0,-100" source="Orxonox/smoke5" /-->
+    </attached>
+    <collisionShapes>
+      <!--SphereCollisionShape position="0,0,0"      radius=20 /-->
+      <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
+      <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
+      <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
+      <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
+    </collisionShapes>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras>
+  <SpaceShip>
+    <camerapositions>
+      <CameraPosition position="0,10,40" />
+      <CameraPosition position="0,150,-25" pitch=-90 />
+      <CameraPosition position="0,0,-30" yaw=180 />
+      <CameraPosition position="0,3,-14" yaw=0 />
+      <CameraPosition position="-50,5,-8" yaw=-90 />
+      <CameraPosition position="50,5,-8" yaw=90 />
+    </camerapositions>
+  </SpaceShip>
+</Template>
+
+<!--Template name=spaceshippirate>
+  <SpaceShip
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   maxspeed          = 250
+   maxsecondaryspeed = 50
+   maxrotation       = 100
+   transacc          = 200
+   rotacc            = 140
+   transdamp         = 75
+  >
+    <attached>
+      <Model position="0,-10,-45" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
+    </attached>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipspacecruiser>
+  <SpaceShip
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   maxspeed          = 250
+   maxsecondaryspeed = 50
+   maxrotation       = 100
+   transacc          = 200
+   rotacc            = 140
+   transdamp         = 75
+  >
+    <attached>
+      <Model position="8,-30,-120" yaw=90 pitch=-90 roll=0 scale=4 mesh="spacecruiser.mesh" />
+    </attached>
+  </SpaceShip>
+</Template-->
Index: code/branches/resource2/data/levels/old/tutorial_hs08.oxw
===================================================================
--- code/branches/resource2/data/levels/old/tutorial_hs08.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/old/tutorial_hs08.oxw	(revision 5646)
@@ -0,0 +1,26 @@
+<Ambient colourvalue="0.8, 0.8, 0.8" />
+<Skybox src="Orxonox/Starbox" />
+
+<!-- This is your own space ship. The complicated XML values are not important -->
+<TutorialShip
+    camera="true" position="0,0,0" scale="10" yawpitchroll="0,0,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0"
+
+SpecialEffects="true"
+
+/>
+
+<!-- A few models flying around -->
+<Model position="2000,0,0" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,2000,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,0,2000" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="10000,16000,0" scale="100" mesh="DuBall1.mesh"/>
+<Model position="11400,16000,0" scale="60" mesh="DuBall2.mesh"/>
+
+<!-- Embedded lua code (creates random asteroids) -->
+<?lua
+for i = 1, 226, 1 
+do ?>
+  <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 250 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" />
+<?lua 
+end
+?>
Index: code/branches/resource2/data/levels/pickuptest.oxw
===================================================================
--- code/branches/resource2/data/levels/pickuptest.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/pickuptest.oxw	(revision 5646)
@@ -0,0 +1,56 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+
+    <Template name="jumpTest" baseclass="Jump">
+        <Jump velocity="0,0,500" jumpsAvailable="1" guiImage="decal.jpg" guiText="TEST" />
+    </Template>
+    <Template name="jumpTest2" baseclass="Jump">
+        <Jump velocity="0,0,-500" jumpsAvailable="1" guiImage="dish.jpg" guiText="J2" />
+    </Template>
+    <Template name="jumpTest3" baseclass="Jump">
+        <Jump velocity="0,0,-500" jumpsAvailable="1" guiImage="sl_organic03.jpg" guiText="J3" />
+    </Template>
+    <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" />
+
+    <PickupSpawner item="jumpTest" triggerDistance="20" respawnTime="2" position="100, 0, 0">
+        <attached>
+            <Model mesh="sphere.mesh" scale="3.0" />
+            <Billboard material="Examples/Flare" colour="0.5, 1.0, 0.3" scale="0.5" />
+        </attached>
+    </PickupSpawner>
+    <PickupSpawner item="jumpTest2" triggerDistance="20" respawnTime="5" position="140, 140, 140">
+        <attached>
+            <Model mesh="sphere.mesh" scale="3.0" />
+            <Billboard material="Examples/Flare" colour="1.0, 0.5, 0.3" scale="0.5" />
+        </attached>
+    </PickupSpawner>
+    <PickupSpawner item="jumpTest3" triggerDistance="20" respawnTime="5" position="180, 180, 180">
+        <attached>
+            <Model mesh="sphere.mesh" scale="3.0" />
+            <Billboard material="Examples/Flare" colour="0.5, 0.3, 1.0" scale="0.5" />
+        </attached>
+    </PickupSpawner>
+
+    <SpawnPoint position="200,200,200" lookat="100,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+    <GlobalShader compositor="Bloom" visible=false>
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+        </visibility>
+      </events>
+    </GlobalShader>
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/presentation.oxw
===================================================================
--- code/branches/resource2/data/levels/presentation.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/presentation.oxw	(revision 5646)
@@ -0,0 +1,188 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Sample"
+ description  = "Just a few tests"
+>
+  <Scene
+   ambientlight = "0.3, 0.3, 0.3"
+   skybox       = "Orxonox/Starbox"
+  >
+    <Light type=directional position="0,0,0" direction="1, -0.3, 0.3" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+    <!--SpawnPoint position="0,   0,  100"           spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0,   0, -700" yaw  =180 spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint position="0, 300, -300" pitch=-90 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
+
+
+	<!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
+	<!--StaticEntity position="0,0,0">
+		<attached>
+			<Model position="0,0,0" scale=1 mesh="axes.mesh" />
+		</attached>
+	</StaticEntity -->
+
+	<!-- red sphere for phsics engine testing purposes-->
+	<!--StaticEntity position="40,0,0">
+		<attached>
+			<Model position="0,0,0" scale=1 mesh="sphere.mesh" />
+		</attached>
+	</StaticEntity-->
+
+	<!-- yellow cube for phsics engine testing purposes-->
+	<!--StaticEntity position="80,0,0">
+		<attached>
+			<Model position="0,0,0" scale=1 mesh="cube.mesh" />
+		</attached>
+	</StaticEntity-->
+
+	<!-- Carrier with guns not implemented yet -->
+	<MovableEntity position="-2000,-1000,-2000" pitch="-90" roll="90">
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="Carrier.mesh" />
+		<Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
+        <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
+      </attached>
+    </MovableEntity>
+
+    <MovableEntity position="-300,200,-800" velocity="5,0,0" rotationaxis="1,0,0" rotationrate=0>
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
+        <MovableEntity position="-4,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
+	  <attached>
+            <Model position="4,0,0" scale=10 mesh="satellitedish.mesh"/>
+          </attached>
+	</MovableEntity>
+        <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=-45 roll=30 position="-14,-3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+        <ParticleEmitter pitch=45 roll=30 position="-14,-3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+      </attached>
+    </MovableEntity>
+
+    <MovableEntity scale=1.5 position="0,0,-300" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=90>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,-300" distance=50 target="ControllableEntity" invert=1 />
+        </activity>
+      </events>
+      <attached>
+        <Model position="0,0,0" scale=10 mesh="ast1.mesh" />
+        <StaticEntity position="0,0,100">
+          <attached>
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <MovableEntity position="0,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=500>
+              <attached>
+                <Model position="0,35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="0,-35,0" scale=2 mesh="ast1.mesh" />
+                <Model position="35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/ExplosionComp4" />
+                  </attached>
+                </Model>
+                <Model position="-35,0,0" scale=2 mesh="ast1.mesh">
+                  <attached>
+                    <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+                  </attached>
+                </Model>
+              </attached>
+            </MovableEntity>
+          </attached>
+        </StaticEntity>
+        <MovableEntity position="0,0,-100" velocity="0,0,0" rotationaxis="0,1,0" rotationrate=200>
+          <attached>
+            <ParticleEmitter position="0,0,0" source="Orxonox/fire3" />
+            <Model position="0,0,0" scale=6 mesh="ast1.mesh" />
+            <Model position="0,0,-50" scale=3 mesh="ast1.mesh" />
+            <Model position="0,0,50" scale=3 mesh="ast1.mesh" />
+          </attached>
+        </MovableEntity>
+      </attached>
+    </MovableEntity>
+
+    <ExplosionChunk position="-500,0,-200" lifetime=3.0 loop=1/>
+
+    <ParticleSpawner position="-500,0,-200" source="Orxonox/ExplosionComp1" lifetime=3.0 loop=1 />
+    <ParticleSpawner position="-500,0,-200" source="Orxonox/ExplosionComp2" lifetime=3.0 loop=1 />
+
+    <ParticleSpawner position="0,0,100" source="Orxonox/ExplosionComp1" lifetime=2.0 loop=0 autostart=0>
+      <events>
+        <spawn>
+          <EventTrigger delay=1>
+            <events>
+              <trigger>
+                <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
+              </trigger>
+            </events>
+          </EventTrigger>
+        </spawn>
+      </events>
+    </ParticleSpawner>
+
+
+    <ParticleEmitter name=fireright position="200,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger1 position="200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=fireleft position="-200,0,0" source="Orxonox/fire3" active=true>
+      <events>
+        <activity>
+          <DistanceTrigger name=firetrigger2 position="-200,0,0" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </ParticleEmitter>
+    <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+      <events>
+        <activity>
+          <EventListener event=firetrigger1 />
+          <EventListener event=firetrigger2 />
+        </activity>
+      </events>
+    </ParticleEmitter>
+
+
+    <EventDispatcher>
+      <targets>
+        <EventTarget name=fireright />
+        <EventTarget name=firecenter />
+        <EventTarget name=fireleft />
+      </targets>
+      <events>
+        <activity>
+          <DistanceTrigger position="0,0,200" distance=100 target="ControllableEntity" />
+        </activity>
+      </events>
+    </EventDispatcher>
+
+
+    <Model position="0,50,0" scale=3 mesh="assff.mesh">
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,50,0" distance=50 target="ControllableEntity" invert=1 />
+        </visibility>
+      </events>
+    </Model>
+
+
+    <Model position="0,0,200" scale=10 mesh="ast2.mesh" shadow=true />
+    <!--Model position="0,0,-200" scale=10 mesh="ast1.mesh" shadow=true /-->
+    <Model position="0,200,0" scale=10 mesh="ast3.mesh" shadow=true />
+    <Model position="0,-200,0" scale=10 mesh="ast4.mesh" shadow=true />
+    <Model position="200,0,0" scale=10 mesh="ast5.mesh" shadow=false />
+    <Model position="-200,0,0" scale=10 mesh="ast6.mesh" shadow=false />
+
+    <Model position="1000,-200,0" scale3D="1,100,100" mesh="ast1.mesh" />
+
+    <Model position="0, 0,-100" pitch=-90 roll=-90 scale=4 mesh="assff.mesh" />
+    <!--Model position="0,100,-100" pitch=-90 roll=-90 scale=4 mesh="pirate.mesh" />
+    <Model position="0,300,-100" pitch=-90 roll=-90 scale=4 mesh="spacecruiser.mesh" /-->
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/presentation09.oxw
===================================================================
--- code/branches/resource2/data/levels/presentation09.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/presentation09.oxw	(revision 5646)
@@ -0,0 +1,52 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_H2.oxt")
+?>
+
+<Level
+ name         = "Presentation09"
+ description  = "presentation level for Orxonox Convention X"
+
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+
+<SpawnPoint position="<?lua print(math.sin(1.5) *40000) ?>,<?lua print(math.cos(1.5) *40000) ?>,<?lua print(500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+
+<?lua
+max = 20
+for i = 1, max, 1
+do 
+    x = math.sin(i/max*6)*40000
+    y = math.cos(i/max*6)*40000
+    z = i*100
+    ?>
+<?lua
+for k = 1, 25, 1 
+do
+j = math.random()
+?>
+    
+    <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
+      <attached>
+        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+      </attached>
+      <?lua if i == 5 then ?><collisionShapes>
+        <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+      </collisionShapes> <?lua end ?>
+    </MovableEntity>
+<?lua 
+end
+?>
+<?lua end ?>
+    <Planet position="0,0,0" scale=10000 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="1,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+    
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/presentation09b.oxw
===================================================================
--- code/branches/resource2/data/levels/presentation09b.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/presentation09b.oxw	(revision 5646)
@@ -0,0 +1,383 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_H2.oxt")
+  include("levels/templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Presentation09"
+ description  = "presentation level for Orxonox Convention X"
+ gametype     = TeamDeathmatch
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen2"
+  >
+    <Light type=directional position="0,0,0" direction="0.683, 0.289, 0.670" diffuse="1.0, 1.0, 1.0, 1.0" specular="1.0, 1.0, 1.0, 1.0" />
+
+    <Template name="JumpItem" baseclass="Jump">
+        <Jump velocity="0,0,-1000" jumpsAvailable="4" guiImage="jumpturbinepickup.jpg" guiText="Jump" />
+    </Template>
+    <Template name="HealthImmediateItem" baseclass="HealthImmediate">
+        <HealthImmediate recoveredHealth="100" guiImage="decal.jpg" guiText="Health" />
+    </Template>
+    <Template name="HealthUsableItem" baseclass="HealthUsable">
+        <HealthImmediate recoveredHealth="80" guiImage="goldwrenchpickup.jpg" guiText="Health" />
+    </Template>
+
+    <SpawnPoint position="-3800, 2500, 1500" direction="-0.683, -0.289, -0.670"  spawnclass=SpaceShip pawndesign=spaceshipassff2 />
+
+    <SpaceShip position="-3900,3000,1000">
+      <templates>
+        <Template link=spaceshipHtwo/>
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=100 team=0>
+          <waypoints>
+            <StaticEntity position="-3850,2800,1450" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="-4100,2600,1600">
+      <templates>
+        <Template link=spaceshipHtwo/>
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=100 team=0>
+          <waypoints>
+            <StaticEntity position="-3850,2800,1450" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="-4000,2500,1500">
+      <templates>
+        <Template link=spaceshipHtwo/>
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=100 team=0>
+          <waypoints>
+            <StaticEntity position="-3850,2800,1450" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="-4100,2700,1500">
+      <templates>
+        <Template link=spaceshipHtwo/>
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=100 team=0 />
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="-4150,2750,1550">
+      <templates>
+        <Template link=spaceshipHtwo/>
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=100 team=0 />
+      </controller>
+    </SpaceShip>
+    
+    <PickupSpawner item="JumpItem" triggerDistance="20" respawnTime="10000" position="-3800, 2500, 1500">
+        <attached>
+            <!--<Model mesh="jumpthrust.mesh" scale="1.0" />
+            <Billboard material="Examples/Flare" colour="0.5, 1.0, 0.3" scale="0.5" />-->
+        </attached>
+    </PickupSpawner>
+    
+    <PickupSpawner item="HealthUsableItem" triggerDistance="20" respawnTime="10000" position="-4150,2750,1550">
+        <attached>
+            <Model mesh="gwrench.mesh" scale="1.0" />
+            <Billboard material="Examples/Flare" colour="0.3, 0.8, 1.0" scale="0.5" />
+        </attached>
+    </PickupSpawner>
+    
+    <PickupSpawner item="HealthImmediateItem" triggerDistance="20" respawnTime="3" position="2300, 4300, 2400">
+        <attached>
+            <Model mesh="gwrench.mesh" scale="1.0" />
+            <Billboard material="Examples/Flare" colour="0.9, 1.0, 0.1" scale="0.5" />
+        </attached>
+    </PickupSpawner>
+
+    <Billboard position="-2500, 2400, 1500" material="Examples/Flare" />
+    <EventDispatcher>
+      <targets>
+        <EventTarget name=pirates />
+      </targets>
+      <events>
+        <activity>
+          <DistanceTrigger position="-2500, 2400, 1500" distance=250 target="SpaceShip" stayactive=true />
+        </activity>
+      </events>
+    </EventDispatcher>
+
+<?lua
+for i = 1, 10, 1 
+do
+?>
+    <SpaceShip position="<?lua print(5000 + math.random() * 4000 - 2000) ?>,<?lua print(0 + math.random() * 2000 - 1000) ?>,<?lua print(math.random() * 2000 - 1000) ?>">
+      <templates>
+        <Template link=spaceshippirate />
+      </templates>
+      <controller>
+        <WaypointPatrolController name=pirates alertnessradius=1000 team=1 active=false>
+          <waypoints>
+            <StaticEntity position="3100, 2000, 1500" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua 
+end
+?>
+
+<?lua
+for i = 1, 12, 1 
+do
+?>
+    <SpaceShip position="<?lua print(2800 + math.random() * 2000 - 1000) ?>,<?lua print(2500+ math.random() * 1000 - 500) ?>,<?lua print(2500 + math.random() * 1000 - 500) ?>" >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=0>
+          <waypoints>
+            <StaticEntity position="<?lua print(2800 + math.random() * 1000 - 500) ?>,<?lua print(2500 + math.random() * 1000 - 500) ?>,<?lua print(1500 + math.random() * 1000 - 500) ?>" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua 
+end
+?>
+
+    <Billboard position="2300, 4400, 2500" material="Examples/Flare" />
+    <EventDispatcher>
+      <targets>
+        <EventTarget name=attacker />
+      </targets>
+      <events>
+        <activity>
+          <DistanceTrigger position="2300, 4400, 2500" distance=50 target="SpaceShip" stayactive=true />
+        </activity>
+      </events>
+    </EventDispatcher>
+
+<?lua
+for i = 1, 12, 1 
+do
+?>
+    <SpaceShip position="<?lua print(2500 + math.random() * 500 - 250) ?>,<?lua print(4800 + math.random() * 500 - 250) ?>,<?lua print(2500 + math.random() * 500 - 250) ?>" >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController name=attacker alertnessradius=1000 team=0 active=false>
+          <waypoints>
+            <StaticEntity position="<?lua print(2800 + math.random() * 500 - 250) ?>,<?lua print(2500 + math.random() * 500 - 250) ?>,<?lua print(1500 + math.random() * 500 - 250) ?>" />
+            <StaticEntity position="<?lua print(5000 + math.random() * 500 - 250) ?>,<?lua print(0 + math.random() * 500 - 250) ?>,<?lua print(0 + math.random() * 500 - 250) ?>" />
+            <StaticEntity position="<?lua print(7500 + math.random() * 500 - 250) ?>,<?lua print(-2500 + math.random() * 500 - 250) ?>,<?lua print(-1500 + math.random() * 500 - 250) ?>" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua 
+end
+?>
+
+    <StaticEntity position="2800, 2500, 2500">
+        <attached>
+            <CheckPoint />
+            <Model position="400, 0, 0" scale="40" mesh="DuBall2.mesh"/>
+            <Model position="-400, 0, 0" scale="40" mesh="DuBall1.mesh"/>
+        </attached>
+    </StaticEntity>
+<!--
+    <Destroyer position="6500, -2000, -1000" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=500>
+        <attached>
+            <CheckPoint />
+            <Model position="0,0,0" scale="5" mesh="Carrier.mesh"/>
+            <Backlight
+                mainstate=activity
+                active=false
+                scale=0.4
+                name=bltest
+                position=" 7.6, 0, 6"
+                colour="0.2, 0.65, 1.0, 1.0"
+                width=15
+                length=1500
+                lifetime=2
+                elements=50
+                trailmaterial="Trail/backlighttrail"
+                turnontime=1
+                turnofftime=1
+                material="Flares/ThrusterFlare1"
+            />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="70,0,-25"      halfExtents="150, 50, 25" />
+            <BoxCollisionShape position="95,75,-16"     halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="95,-75,-16"    halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="77,47,30"      halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,-47,30"     halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,0,50"       halfExtents="110, 45, 6" />
+            <BoxCollisionShape position="167,0,70"      halfExtents="17, 20, 20" />
+        </collisionShapes>
+    </Destroyer>
+-->
+    <Destroyer
+        position          = "6500,-2000,-1000"
+        collisionType     = dynamic
+        mass              = 100000
+        angularDamping    = 0.9999999
+        health            = 1000
+        maxhealth         = 1000
+        initialhealth     = 1000
+    >
+        <controller>
+          <WaypointPatrolController team=1 />
+        </controller>
+        <attached>
+            <Model mesh="Carrier.mesh" scale="5" />
+            <Backlight
+                mainstate=activity
+                active=false
+                scale=0.4
+                name=bltest
+                position=" 7.6, 0, 6"
+                colour="0.2, 0.65, 1.0, 1.0"
+                width=15
+                length=1500
+                lifetime=2
+                elements=50
+                trailmaterial="Trail/backlighttrail"
+                turnontime=1
+                turnofftime=1
+                material="Flares/ThrusterFlare1"
+            />
+            <?lua for i=0,8,1 do ?>
+                <BlinkingBillboard
+                    position="<?lua print(200-270/8*i)?> ,15,2"
+                    material="Examples/Flare"
+                    colour="1.0, 0.5, 0.3"
+                    phase=<?lua print(-360/8*i)?>
+                    amplitude=0.1
+                    frequency=0.5
+                    quadratic=1
+                />
+
+                <BlinkingBillboard
+                    position="<?lua print(200-270/8*i)?>,-15,2"
+                    material="Examples/Flare"
+                    colour="1.0, 0.5, 0.3"
+                    phase=<?lua print(-360/8*i)?>
+                    amplitude=0.1
+                    frequency=0.5
+                    quadratic=1
+                />
+            <?lua end ?>
+
+            <Backlight
+                scale=1
+                position=" 169, 75, -15"
+                colour="1, 0.85, 0.5, 0.5"
+                width=40
+                length=1000
+                lifetime=5
+                elements=15
+                trailmaterial="Trail/backlighttrail"
+                material="Examples/Flare"
+            />
+            <Backlight
+                scale=1
+                position=" 169, -75, -15"
+                colour="1, 0.85, 0.5, 0.5"
+                width=40
+                length=1000
+                lifetime=5
+                elements=15
+                trailmaterial="Trail/backlighttrail"
+                material="Examples/Flare" />
+        </attached>
+        <collisionShapes>
+            <BoxCollisionShape position="70,0,-25"      halfExtents="150, 50, 25" />
+            <BoxCollisionShape position="95,75,-16"     halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="95,-75,-16"    halfExtents="70, 10, 12" />
+            <BoxCollisionShape position="77,47,30"      halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,-47,30"     halfExtents="110, 2, 30" />
+            <BoxCollisionShape position="77,0,50"       halfExtents="110, 45, 6" />
+            <BoxCollisionShape position="167,0,70"      halfExtents="17, 20, 20" />
+        </collisionShapes>
+    </Destroyer>
+
+<?lua
+for i = 1, 10, 1 
+do
+?>
+    <SpaceShip position="<?lua print(6200 + math.random() * 2000 - 1000) ?>,<?lua print(-1500 + math.random() * 1000 - 500) ?>,<?lua print(-700 + math.random() * 1000 - 500) ?>" >
+      <templates>
+        <Template link=spaceshippirate />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=1>
+          <waypoints>
+            <StaticEntity position="<?lua print(6000 + math.random() * 1000 - 500) ?>,<?lua print(-2000 + math.random() * 1000 - 500) ?>,<?lua print(-1000 + math.random() * 1000 - 500) ?>" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua 
+end
+?>
+
+<?lua
+for i = 1, 200, 1 
+do
+x = math.random() * 100  + (i-70) * 100
+y = math.random() * 3000 - 1500
+z = math.random() * 3000 - 1500 + (i-100) * 10
+s = math.random() * 60 + 30
+?>
+    
+    <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>"> 
+      <attached>
+        <Model position="0,0,0" scale=<?lua print(s) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+      </attached>
+    </MovableEntity>
+<?lua 
+end
+?>
+
+<?lua
+elements = {"BodyDebris1.mesh", "CockpitDebris.mesh", "LightningGun.mesh", "WingDebris1.mesh", "WingDebris2.mesh", "satellitedish.mesh", "Thruster.mesh"}
+sizes = {4, 4, 4, 4, 4, 10, 20}
+elements.length = function()
+    return table.getn(elements)
+end
+for i = 1, 150, 1 
+do
+x = math.random() * 750 - 4500
+y = math.random() * 1000 + 2000
+z = math.random() * 500 + 1000
+e = math.floor(math.random()*elements.length()+1)
+?>
+    
+    <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>"> 
+      <attached>
+        <Model position="0,0,0" scale="<?lua print(sizes[e]) ?>" mesh="<?lua print( elements[e]) ?>" />
+      </attached>
+    </MovableEntity>
+<?lua 
+end
+?>
+    
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/presentation_dm.oxw
===================================================================
--- code/branches/resource2/data/levels/presentation_dm.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/presentation_dm.oxw	(revision 5646)
@@ -0,0 +1,95 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_H2.oxt")
+?>
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <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" />
+
+
+<?lua
+for i = 1, 10, 1 
+do ?>
+    <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+<?lua 
+end
+?>
+
+    <GlobalShader compositor="Bloom" visible=false>
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+        </visibility>
+      </events>
+    </GlobalShader>
+
+
+<?lua
+for i = 1, 100, 1 
+do
+j = math.random()
+?>
+    
+    <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
+      <attached>
+        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="<?lua print(j * 70) ?>" />
+      </collisionShapes>
+    </MovableEntity>
+<?lua 
+end
+?>
+
+<!--
+<?lua
+for i = 1, 70, 1
+do ?>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 1000 + 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * -1000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 1000 + 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * -1000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 1000 + 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * -1000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+<?lua
+end
+?>
+-->
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/presentation_pong.oxw
===================================================================
--- code/branches/resource2/data/levels/presentation_pong.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/presentation_pong.oxw	(revision 5646)
@@ -0,0 +1,183 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("overlay/ponghud.oxo")
+?>
+
+<Template name=pongbatcameras defaults=0>
+  <PongBat>
+    <camerapositions>
+      <CameraPosition position="0,200,0" pitch=-90 absolute=true />
+      <CameraPosition position="0,50,160" drag=true mouselook=true />
+      <CameraPosition position="0,40,125" drag=true mouselook=true />
+      <CameraPosition position="0,30, 90" drag=true mouselook=true />
+    </camerapositions>
+  </PongBat>
+</Template>
+
+<Template name=pongbat>
+  <PongBat camerapositiontemplate=pongbatcameras>
+    <attached>
+      <Model position="0,0,3" mesh="cube.mesh" scale3D="14,2,2" />
+      <!--Model roll=180 mesh="pongbat.mesh" scale=0.045 /-->
+    </attached>
+  </PongBat>
+</Template>
+
+<Template name=pongball>
+  <PongBall>
+    <attached>
+      <Model mesh="sphere.mesh" scale=2 />
+      <!--Billboard scale=0.2 colour="1.0, 1.0, 0.5" material="Examples/Flare" /-->
+      <Backlight scale=0.2 colour="1.0, 1.0, 0.5" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" />
+      <Light type=point diffuse="1.0, 1.0, 0.5" specular="1.0, 1.0, 0.5" attenuation="1200, 1.0, 0.0035, 0.00005" />
+    </attached>
+  </PongBall>
+</Template>
+
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+ gametype     = Pong
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <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" />
+
+<?lua
+for i = 1, 10, 1
+do ?>
+    <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" />
+<?lua
+end
+?>
+
+  <MovableEntity rotationrate=5 rotationaxis="0,0,1">
+    <attached>
+      <PongCenterpoint name=pongcenter dimension="200,120" balltemplate=pongball battemplate=pongbat ballspeed=200 batspeed=130 batlength=0.25>
+        <attached>
+          <Model position="0,0,60" mesh="cube.mesh" scale3D="105,1,1" />
+          <Model position="0,0,-60" mesh="cube.mesh" scale3D="105,1,1" />
+<!--
+          <ParticleSpawner name=scoreeffect_R position=" 100,0, 60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position="  50,0, 60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position="   0,0, 60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position=" -50,0, 60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect_L position="-100,0, 60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect_R position=" 100,0,-60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position="  50,0,-60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position="   0,0,-60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect position=" -50,0,-60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+          <ParticleSpawner name=scoreeffect_L position="-100,0,-60" source="Orxonox/BigExplosion1part1" lifetime=3.0 autostart=0 />
+-->
+        </attached>
+      </PongCenterpoint>
+    </attached>
+  </MovableEntity>
+
+  <EventDispatcher>
+    <targets>
+      <EventTarget name=scoreeffect />
+    </targets>
+    <events>
+      <spawn>
+        <EventListener event=pongcenter />
+      </spawn>
+    </events>
+  </EventDispatcher>
+
+  <?lua
+    dofile("../../media/levels/includes/CuboidSpaceStation.lua")
+  ?>
+
+  <StaticEntity pitch=15>
+    <attached>
+      <MovableEntity rotationrate="-4.15786" rotationaxis="0,0,1">
+        <attached>
+          <StaticEntity position="-2500,0,0" yaw=90 pitch=90>
+            <attached>
+              <?lua
+                createSpaceStationPar(0,2,1,2,1,4,1,50)
+              ?>
+            </attached>
+          </StaticEntity>
+        </attached>
+      </MovableEntity>
+    </attached>
+  </StaticEntity>
+
+  <StaticEntity position="0,1200,-200" yaw=50 pitch=60 roll=45>
+    <attached>
+      <Model scale=10 mesh="Carrier.mesh" />
+      <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
+      <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
+    </attached>
+  </StaticEntity>
+
+  <StaticEntity pitch=70>
+    <attached>
+      <MovableEntity rotationaxis="0,0,1" rotationrate=8.5974>
+        <attached>
+          <StaticEntity yaw=-90 pitch=0 roll=90 position="800,0,0">
+            <attached>
+              <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
+              <MovableEntity position="-4,0,20" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
+                <attached>
+                  <Model position="0,0,0" scale=10 mesh="satellitedish.mesh"/>
+                </attached>
+              </MovableEntity>
+              <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+              <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+              <ParticleEmitter pitch=-45 roll=30 position="-14,-3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+              <ParticleEmitter pitch=45 roll=30 position="-14,-3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
+            </attached>
+          </StaticEntity>
+        </attached>
+      </MovableEntity>
+    </attached>
+  </StaticEntity>
+
+<?lua
+for i = 1, 10, 1
+do ?>
+  <MovableEntity position="<?lua print(math.random() * 600 - 300)?>, <?lua print(math.random() * 600 - 300) ?>, <?lua print(math.random() * 100 + 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 600 - 300)?>, <?lua print(math.random() * 600 - 300) ?>, <?lua print(math.random() * -100 - 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 600 - 300)?>, <?lua print(math.random() * 100 + 300) ?>, <?lua print(math.random() * 600 - 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 600 - 300)?>, <?lua print(math.random() * -100 - 300) ?>, <?lua print(math.random() * 600 - 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 100 + 300)?>, <?lua print(math.random() * 600 - 300) ?>, <?lua print(math.random() * 600 - 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * -100 - 300)?>, <?lua print(math.random() * 600 - 300) ?>, <?lua print(math.random() * 600 - 300) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 10 + 5) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+<?lua
+end
+?>
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/teambasematchlevel.oxw
===================================================================
--- code/branches/resource2/data/levels/teambasematchlevel.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/teambasematchlevel.oxw	(revision 5646)
@@ -0,0 +1,215 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("overlay/teambasematchhud.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+ gametype     = TeamBaseMatch
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <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" />
+
+    <TeamSpawnPoint team=0 position=" 900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <TeamSpawnPoint team=1 position="-900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+
+    <TeamBaseMatchBase
+     name              = "base 1"
+     position          = "1200, 0, 0"
+     pitch = -90
+
+     health            = 1000
+     maxhealth         = 1000
+     initialhealth     = 1000
+
+     collisionType     = "dynamic"
+     mass              = 10000
+     linearDamping     = 0.9
+     angularDamping    = 0.99999
+    >
+      <attached>
+        <Model scale=10 mesh="DuBall1.mesh" position = "-100,0,0"/>
+        <Model scale=10 mesh="DuBall2.mesh" position = "100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
+<?lua
+for i = 1, 10, 1 
+do ?>
+        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events><spawn><EventListener event="base 1" /></spawn></events>
+        </ParticleSpawner>
+<?lua 
+end
+?>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="80"            position = "-100,0,0" />
+        <SphereCollisionShape radius="120"           position = "100,0,0" />
+        <BoxCollisionShape    halfExtents="90,25,45" position = "-155,0,40" />
+      </collisionShapes>
+    </TeamBaseMatchBase>
+
+
+    <TeamBaseMatchBase
+     name              = "base 2"
+     position          = "-1200, 0, 0"
+     pitch = -90
+
+     health            = 1000
+     maxhealth         = 1000
+     initialhealth     = 1000
+
+     collisionType     = "dynamic"
+     mass              = 10000
+     linearDamping     = 0.9
+     angularDamping    = 0.99999
+    >
+      <attached>
+        <Model scale=10 mesh="DuBall1.mesh" position = "-100,0,0"/>
+        <Model scale=10 mesh="DuBall2.mesh" position = "100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
+<?lua
+for i = 1, 10, 1 
+do ?>
+        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events><spawn><EventListener event="base 2" /></spawn></events>
+        </ParticleSpawner>
+<?lua 
+end
+?>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="80"            position = "-100,0,0" />
+        <SphereCollisionShape radius="120"           position = "100,0,0" />
+        <BoxCollisionShape    halfExtents="90,25,45" position = "-155,0,40" />
+      </collisionShapes>
+    </TeamBaseMatchBase>
+
+
+    <TeamBaseMatchBase
+     name              = "base 3"
+     position          = "0, 0, 1200"
+     pitch = -90
+
+     health            = 1000
+     maxhealth         = 1000
+     initialhealth     = 1000
+
+     collisionType     = "dynamic"
+     mass              = 10000
+     linearDamping     = 0.9
+     angularDamping    = 0.99999
+    >
+      <attached>
+        <Model scale=10 mesh="DuBall1.mesh" position = "-100,0,0"/>
+        <Model scale=10 mesh="DuBall2.mesh" position = "100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
+<?lua
+for i = 1, 10, 1 
+do ?>
+        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events><spawn><EventListener event="base 3" /></spawn></events>
+        </ParticleSpawner>
+<?lua 
+end
+?>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="80"            position = "-100,0,0" />
+        <SphereCollisionShape radius="120"           position = "100,0,0" />
+        <BoxCollisionShape    halfExtents="90,25,45" position = "-155,0,40" />
+      </collisionShapes>
+    </TeamBaseMatchBase>
+
+    <TeamBaseMatchBase
+     name              = "base 4"
+     position          = "0, 0, -1200"
+
+     health            = 1000
+     maxhealth         = 1000
+     initialhealth     = 1000
+     pitch = -90
+
+     collisionType     = "dynamic"
+     mass              = 10000
+     linearDamping     = 0.9
+     angularDamping    = 0.99999
+    >
+      <attached>
+        <Model scale=10 mesh="DuBall1.mesh" position = "-100,0,0"/>
+        <Model scale=10 mesh="DuBall2.mesh" position = "100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
+<?lua
+for i = 1, 10, 1 
+do ?>
+        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events><spawn><EventListener event="base 4" /></spawn></events>
+        </ParticleSpawner>
+<?lua 
+end
+?>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="80"            position = "-100,0,0" />
+        <SphereCollisionShape radius="120"           position = "100,0,0" />
+        <BoxCollisionShape    halfExtents="90,25,45" position = "-155,0,40" />
+      </collisionShapes>
+    </TeamBaseMatchBase>
+
+
+    <TeamBaseMatchBase
+     name              = "base 5"
+     position          = "0, 0, 0"
+     pitch = -90
+
+     health            = 1000
+     maxhealth         = 1000
+     initialhealth     = 1000
+
+     collisionType     = "dynamic"
+     mass              = 10000
+     linearDamping     = 0.9
+     angularDamping    = 0.99999
+    >
+      <attached>
+        <Model scale=10 mesh="DuBall1.mesh" position = "-100,0,0"/>
+        <Model scale=10 mesh="DuBall2.mesh" position = "100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "-100,0,0"/>
+        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
+<?lua
+for i = 1, 10, 1 
+do ?>
+        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
+          <events><spawn><EventListener event="base 5" /></spawn></events>
+        </ParticleSpawner>
+<?lua 
+end
+?>
+      </attached>
+      <collisionShapes>
+        <SphereCollisionShape radius="80"            position = "-100,0,0" />
+        <SphereCollisionShape radius="120"           position = "100,0,0" />
+        <BoxCollisionShape    halfExtents="90,25,45" position = "-155,0,40" />
+      </collisionShapes>
+    </TeamBaseMatchBase>
+
+
+
+    <!--Model position="0,0,0" scale=8 mesh="ast1.mesh" />
+    <StaticEntity position="0,0,0" collisionType=static>
+      <collisionShapes>
+        <SphereCollisionShape radius="20" />
+      </collisionShapes>
+    </StaticEntity-->
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/teamdeathmatch.oxw
===================================================================
--- code/branches/resource2/data/levels/teamdeathmatch.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/teamdeathmatch.oxw	(revision 5646)
@@ -0,0 +1,76 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_H2.oxt")
+  include("levels/templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Waypoints"
+ description  = "Testing waypoings for AI controlled spaceships."
+ gametype     = TeamDeathmatch
+>
+  <Scene
+   ambientlight = "0.7, 0.6, 0.6"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <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" />
+
+    <TeamSpawnPoint team=0 position="0,  0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <TeamSpawnPoint team=0 position="0, 50,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <TeamSpawnPoint team=0 position="0,100,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <TeamSpawnPoint team=0 position="0,150,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+    <TeamSpawnPoint team=1 position="2000,  0,0" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+    <TeamSpawnPoint team=1 position="2000, 50,0" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+    <TeamSpawnPoint team=1 position="2000,100,0" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+    <TeamSpawnPoint team=1 position="2000,150,0" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+
+    <TeamSpawnPoint team=2 position="1000,  0,1500" direction="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipHtwo />
+    <TeamSpawnPoint team=2 position="1000, 50,1500" direction="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipHtwo />
+    <TeamSpawnPoint team=2 position="1000,100,1500" direction="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipHtwo />
+    <TeamSpawnPoint team=2 position="1000,150,1500" direction="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshipHtwo />
+
+
+<?lua
+for i = 1, 70, 1
+do ?>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 1000 + 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * -1000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 1000 + 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * -1000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 1000 + 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * -1000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 50 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+<?lua
+end
+?>
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/templates/spaceship_H2.oxt
===================================================================
--- code/branches/resource2/data/levels/templates/spaceship_H2.oxt	(revision 5646)
+++ code/branches/resource2/data/levels/templates/spaceship_H2.oxt	(revision 5646)
@@ -0,0 +1,87 @@
+<Template name=spaceshipHtwo>
+  <SpaceShip
+   hudtemplate            = spaceshiphud
+   camerapositiontemplate = spaceshipHtwocameras
+   engine                 = spaceshipHtwoengine
+   spawnparticlesource    = "Orxonox/fairytwirl"
+   spawnparticleduration  = 3
+   explosionchunks        = 6
+
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   primaryThrust     = 100;
+   auxilaryThrust    = 30;
+   rotationThrust    = 25;
+
+   collisionType     = "dynamic"
+   mass              = 100
+   linearDamping     = 0.7
+   angularDamping    = 0.9999999
+  >
+
+<?lua
+  include("levels/includes/weaponsettings_H2.oxi")
+?>
+
+    <attached>
+      <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale3D="3,0.833,0.833" mesh="h2_green.mesh" />
+      <BlinkingBillboard position=" 11.7,4.0,8.5" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+      <BlinkingBillboard position="-11.7,4.0,8.5" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
+      <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
+      <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
+      <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
+    </collisionShapes>
+
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipHtwocameras defaults=0>
+  <SpaceShip>
+    <camerapositions>
+      <CameraPosition position="0,10, 40" drag=true mouselook=true />
+      <CameraPosition position="0,20, 80" drag=true mouselook=true />
+      <CameraPosition position="0,30,120" drag=true mouselook=true />
+    </camerapositions>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipHtwoengine baseclass=MultiStateEngine>
+  <MultiStateEngine
+   boostfactor    = 2
+
+   speedfront     = 150
+   speedback      =  50
+   speedleftright =  50
+   speedupdown    =  50
+
+   accelerationfront     = 500
+   accelerationbrake     = 500
+   accelerationback      =  125
+   accelerationleftright =  125
+   accelerationupdown    =  125
+  >
+    <active>
+      <FadingBillboard mainstate=activity active=false scale=0.05 position=" 0.0, 2.0, 12.0" colour="0.0, 0.65, 0.0, 0.5" material="Examples/FlareZwei_1" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.05 position=" 3.8, 7.5, 11.0" colour="1.0, 1.00, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.05 position="-3.8, 7.5, 11.0" colour="1.0, 1.00, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.05 position=" 3.5, 0.0,-10.8" colour="1.0, 1.00, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.05 position="-3.5, 0.0,-10.8" colour="1.0, 1.00, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+    </active>
+    <forward>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.06, 1.66, 11.6" colour="0, 0.65, 0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.26, 1.66, 11.6" colour="0, 0.65, 0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+    </forward>
+    <boost>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.06, 1.66, 11.6" colour="0.5, 0.85, 0.5, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.26, 1.66, 11.6" colour="0.5, 0.85, 0.5, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+    </boost>
+  </MultiStateEngine>
+</Template>
+
Index: code/branches/resource2/data/levels/templates/spaceship_assff.oxt
===================================================================
--- code/branches/resource2/data/levels/templates/spaceship_assff.oxt	(revision 5646)
+++ code/branches/resource2/data/levels/templates/spaceship_assff.oxt	(revision 5646)
@@ -0,0 +1,132 @@
+<Template name=spaceshipassff>
+  <SpaceShip
+   hudtemplate            = spaceshiphud
+   camerapositiontemplate = spaceshipassffcameras
+   engine                 = spaceshipassffengine
+   spawnparticlesource    = "Orxonox/fairytwirl"
+   spawnparticleduration  = 3
+   explosionchunks        = 6
+
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   primaryThrust     = 100;
+   auxilaryThrust    = 30;
+   rotationThrust    = 25;
+
+   collisionType     = "dynamic"
+   mass              = 100
+   linearDamping     = 0.7
+   angularDamping    = 0.9999999
+  >
+    <attached>
+      <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+      <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+      <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
+      <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
+      <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
+      <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
+    </collisionShapes>
+<?lua
+  include("levels/includes/weaponsettings3.oxi")
+?>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras defaults=0>
+  <SpaceShip>
+    <camerapositions>
+      <CameraPosition position="0,10, 40" drag=true mouselook=true />
+      <CameraPosition position="0,20, 80" drag=true mouselook=true />
+      <CameraPosition position="0,30,120" drag=true mouselook=true />
+      <!--CameraPosition position="0,150,-25" pitch=-90 drag=true />
+      <CameraPosition position="0,0,-40" yaw=180 drag=true />
+      <CameraPosition position="0,3,-14" yaw=0 />
+      <CameraPosition position="-50,5,-8" yaw=-90 drag=true />
+      <CameraPosition position="50,5,-8" yaw=90 drag=true /-->
+    </camerapositions>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffengine baseclass=MultiStateEngine>
+  <MultiStateEngine
+   boostfactor    = 2
+
+   speedfront     = 150
+   speedback      =  50
+   speedleftright =  50
+   speedupdown    =  50
+
+   accelerationfront     = 500
+   accelerationbrake     = 500
+   accelerationback      =  125
+   accelerationleftright =  125
+   accelerationupdown    =  125
+  >
+    <active>
+      <FadingBillboard mainstate=activity active=false scale=0.1 position="0, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+<!--
+      <Light mainstate=visibility position=" 8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
+      <Light mainstate=visibility position="-8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
+-->
+    </active>
+    <forward>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+    </forward>
+    <boost>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+    </boost>
+    <brake>
+      <FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.15 position=" 8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.15 position="-8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+    </brake>
+  </MultiStateEngine>
+</Template>
+
+<!--Template name=spaceshippirate>
+  <SpaceShip
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   maxspeed          = 250
+   maxsecondaryspeed = 50
+   maxrotation       = 100
+   transacc          = 200
+   rotacc            = 140
+   transdamp         = 75
+  >
+    <attached>
+      <Model position="0,-10,-45" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
+    </attached>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshipspacecruiser>
+  <SpaceShip
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   maxspeed          = 250
+   maxsecondaryspeed = 50
+   maxrotation       = 100
+   transacc          = 200
+   rotacc            = 140
+   transdamp         = 75
+  >
+    <attached>
+      <Model position="8,-30,-120" yaw=90 pitch=-90 roll=0 scale=4 mesh="spacecruiser.mesh" />
+    </attached>
+  </SpaceShip>
+</Template-->
Index: code/branches/resource2/data/levels/templates/spaceship_pirate.oxt
===================================================================
--- code/branches/resource2/data/levels/templates/spaceship_pirate.oxt	(revision 5646)
+++ code/branches/resource2/data/levels/templates/spaceship_pirate.oxt	(revision 5646)
@@ -0,0 +1,88 @@
+<Template name=spaceshippirate>
+  <SpaceShip
+   hudtemplate            = spaceshiphud
+   camerapositiontemplate = spaceshippiratecameras
+   engine                 = spaceshippirateengine
+   spawnparticlesource    = "Orxonox/fairytwirl"
+   spawnparticleduration  = 3
+   explosionchunks        = 6
+
+   health            = 100
+   maxhealth         = 200
+   initialhealth     = 100
+
+   primaryThrust     = 100;
+   auxilaryThrust    = 30;
+   rotationThrust    = 25;
+
+   collisionType     = "dynamic"
+   mass              = 100
+   linearDamping     = 0.7
+   angularDamping    = 0.9999999
+  >
+    <attached>
+      <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
+      <BlinkingBillboard position=" 12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 />
+      <BlinkingBillboard position="-12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="90"/>
+      <BlinkingBillboard position=" 8.7,-0.5,2.5" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="30"/>
+      <BlinkingBillboard position="-8.7,-0.5,2.5" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 phase="60"/>
+    </attached>
+    <collisionShapes>
+      <BoxCollisionShape position="0,0,0"      halfExtents="10, 3, 5" />
+      <BoxCollisionShape position="13,-1.3,0"  halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+      <BoxCollisionShape position="0,0,7"      halfExtents="3, 2, 2" />
+      <BoxCollisionShape position="0,0.1,-11"  halfExtents="2.2, 1.8, 6" />
+      <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
+    </collisionShapes>
+
+<?lua
+  include("levels/includes/weaponsettings_pirate.oxi")
+?>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshippiratecameras defaults=0>
+  <SpaceShip>
+    <camerapositions>
+      <CameraPosition position="0,8, 60" drag=true mouselook=true />
+      <CameraPosition position="0,16, 120" drag=true mouselook=true />
+      <CameraPosition position="0,24,180" drag=true mouselook=true />
+      <CameraPosition position="0,60,10" pitch="-80" drag=true mouselook=true />
+    </camerapositions>
+  </SpaceShip>
+</Template>
+
+<Template name=spaceshippirateengine baseclass=MultiStateEngine>
+  <MultiStateEngine
+   boostfactor    = 2
+
+   speedfront     = 150
+   speedback      =  50
+   speedleftright =  50
+   speedupdown    =  50
+
+   accelerationfront     = 500
+   accelerationbrake     = 500
+   accelerationback      =  125
+   accelerationleftright =  125
+   accelerationupdown    =  125
+  >
+    <active>
+      <FadingBillboard mainstate=activity active=false scale=0.02 position=" 1.3, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.02 position=" 0, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.02 position="-1.3, -4, -15" colour="1.0, 0.65, 0.2, 1.0" material="Examples/FlareZwei" turnontime=0.5 turnofftime=0.5 />
+    </active>
+    <forward>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 13, -4,  9.5" colour="1.0, 0.65, 0.2, 1.0" width=8 length=800 lifetime=1 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-13, -4,  9.5" colour="1.0, 0.65, 0.2, 1.0" width=8 length=800 lifetime=1 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+    </forward>
+    <boost>
+      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="  0,  5, 15.5" colour="1.0, 0.65, 0.2, 1.0" width=16 length=1600 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+    </boost>
+    <brake>
+      <FadingBillboard mainstate=activity active=false scale=0.1 position=" 4.4, -5.5, 5" colour="0.8, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+      <FadingBillboard mainstate=activity active=false scale=0.1 position="-4.4, -5.5, 5" colour="0.8, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+    </brake>
+  </MultiStateEngine>
+</Template>
Index: code/branches/resource2/data/levels/tutorial.oxw
===================================================================
--- code/branches/resource2/data/levels/tutorial.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/tutorial.oxw	(revision 5646)
@@ -0,0 +1,93 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+?>
+
+<Level
+ name         = "Presentation"
+ description  = "A simple testlevel"
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+
+<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
+  <attached>
+    <Model scale="10" mesh="drone.mesh"/>
+  </attached>
+  <collisionShapes>
+    <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />
+  </collisionShapes>
+</Drone>
+
+
+    <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" />
+
+<Model mesh="hs-w01.mesh" scale=10 position="0,0,-100" />
+<Model mesh="hs-w01s.mesh" scale=10 position="0,0,-100" />
+
+<?lua
+for i = 1, 10, 1
+do ?>
+    <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+<?lua
+end
+?>
+
+    <GlobalShader compositor="Bloom" visible=false>
+      <events>
+        <visibility>
+          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+        </visibility>
+      </events>
+    </GlobalShader>
+    <Model position="0,0,0" scale=8 mesh="ast1.mesh" />
+    <StaticEntity position="0,0,0" collisionType=static>
+      <collisionShapes>
+        <SphereCollisionShape radius="20" />
+      </collisionShapes>
+    </StaticEntity>
+<!--
+<?lua
+for i = 1, 70, 1
+do ?>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 1000 + 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * -1000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 1000 + 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * -1000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+
+  <MovableEntity position="<?lua print(math.random() * 1000 + 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+  <MovableEntity position="<?lua print(math.random() * -1000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
+    <attached>
+      <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
+    </attached>
+  </MovableEntity>
+<?lua
+end
+?>
+-->
+  </Scene>
+</Level>
Index: code/branches/resource2/data/levels/waypoints.oxw
===================================================================
--- code/branches/resource2/data/levels/waypoints.oxw	(revision 5646)
+++ code/branches/resource2/data/levels/waypoints.oxw	(revision 5646)
@@ -0,0 +1,157 @@
+<?lua
+  include("overlay/hudtemplates3.oxo")
+  include("overlay/stats.oxo")
+  include("levels/templates/spaceship_assff.oxt")
+  include("levels/templates/spaceship_H2.oxt")
+  include("levels/templates/spaceship_pirate.oxt")
+?>
+
+<Level
+ name         = "Waypoints"
+ description  = "Testing waypoings for AI controlled spaceships."
+>
+  <Scene
+   ambientlight = "0.5, 0.5, 0.5"
+   skybox       = "Orxonox/skypanoramagen1"
+  >
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+    <SpawnPoint position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+    <SpaceShip position="0,2000,200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=10>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=8 position="  0,2000,-200" />
+            <Model mesh="cube.mesh" scale=8 position="  0,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="500,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="500,2000,-200" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="0,2000,400" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=10>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=8 position="  0,2000,-200" />
+            <Model mesh="cube.mesh" scale=8 position="  0,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="500,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="500,2000,-200" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="1500,2000,200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=11>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=8 position="1500,2000,-200" />
+            <Model mesh="cube.mesh" scale=8 position="1500,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="1000,2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="1000,2000,-200" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+    <SpaceShip position="1500,-2000,200" lookat="0,0,0" name=polonaise1>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=12>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-200" />
+<!--
+            <Attacher target=polonaise6 deletewithparent=false />
+            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="1000,-2000,-700" />
+            <Model mesh="cube.mesh" scale=8 position="1000,-2000,-200" />
+-->
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+<?lua
+for i = 1, 5, 1
+do ?>
+    <SpaceShip position="1500,<?lua print(-2000 + 50*i) ?>,200" lookat="0,0,0" name=polonaise<?lua print(i+1) ?> >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=12>
+          <waypoints>
+            <Attacher target=polonaise<?lua print(i) ?> deletewithparent=false />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua
+end
+?>
+
+
+    <SpaceShip position="-1500,-2000,200" lookat="0,0,0" name=attack1>
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=13>
+          <waypoints>
+            <Model mesh="cube.mesh" scale=8 position="1500,-2000,-200" />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+
+<?lua
+for i = 1, 5, 1
+do ?>
+    <SpaceShip position="-1500,<?lua print(-2000 + 50*i) ?>,200" lookat="0,0,0" name=attack<?lua print(i+1) ?> >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WaypointPatrolController alertnessradius=1000 team=13>
+          <waypoints>
+            <Attacher target=attack<?lua print(i) ?> deletewithparent=false />
+          </waypoints>
+        </WaypointPatrolController>
+      </controller>
+    </SpaceShip>
+<?lua
+end
+?>
+
+<!--
+<?lua
+for i = 1, 50, 1
+do ?>
+    <SpaceShip position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" >
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <AIController />
+      </controller>
+    </SpaceShip>
+<?lua
+end
+?>
+-->
+
+  </Scene>
+</Level>
Index: code/branches/resource2/data/overlay/OrxonoxLoading.overlay
===================================================================
--- code/branches/resource2/data/overlay/OrxonoxLoading.overlay	(revision 5646)
+++ code/branches/resource2/data/overlay/OrxonoxLoading.overlay	(revision 5646)
@@ -0,0 +1,13 @@
+Orxonox/LoadingScreenSample
+{
+   container Panel(Orxonox/LoadingScreenSample)
+   {
+      metrics_mode pixels
+      vert_align top
+      left 12
+      top 12
+      width 300
+      height 300
+      material Orxonox/LoadingScreenSample
+   }
+} 
Index: code/branches/resource2/data/overlay/debug.oxo
===================================================================
--- code/branches/resource2/data/overlay/debug.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/debug.oxo	(revision 5646)
@@ -0,0 +1,95 @@
+<!-- DEBUG OVERLAY -->
+<OverlayGroup
+ name    = "Debug"
+ scale   = "1.0, 1.0"
+ scroll  = "0, 0"
+ visible = false
+>
+  <OverlayText
+   name     = "FPSTextCaption"
+   position = "0.03, 0.05"
+   font     = "Monofur"
+   caption  = "Frames per second:"
+   textsize = 0.03
+  />
+
+  <DebugFPSText
+   name     = "FPSText"
+   position = "0.3, 0.05"
+   font     = "Monofur"
+   textsize = 0.03
+  />
+
+  <OverlayText
+   name     = "RTRTextCaption"
+   position = "0.03, 0.09"
+   font     = "Monofur"
+   caption  = "Tick time in ms: "
+   textsize = 0.03
+  />
+
+  <DebugRTRText
+   name     = "RTRText"
+   position = "0.3, 0.09"
+   font     = "Monofur"
+   textsize = 0.03
+  />
+  
+</OverlayGroup>
+
+<Template name="defaultHUD">
+  <OverlayGroup name = "defaultHUD" scale = "1, 1">
+    <ChatOverlay
+     name     = "chat"
+     position = "0.03, 0.08"
+     font     = "VeraMono"
+     caption  = ""
+     textsize = 0.025
+    />
+
+    <KillMessage
+     name     = "killmessage"
+     position = "0.5, 0.15"
+     font     = "VeraMono"
+     textsize = 0.035
+     colour   = "1.0, 1.0, 0.5, 1.0"
+     align    = "center"
+    />
+
+    <DeathMessage
+     name     = "deathmessage"
+     position = "0.5, 0.20"
+     font     = "VeraMono"
+     textsize = 0.035
+     colour   = "1.0, 0.3, 0.3, 1.0"
+     align    = "center"
+    />
+
+    <AnnounceMessage
+     name     = "announcemessage"
+     position = "0.5, 0.75"
+     font     = "VeraMono"
+     textsize = 0.05
+     colour   = "0.5, 0.5, 1.0, 1.0"
+     align    = "center"
+    />
+
+    <GametypeStatus
+     name     = "state"
+     position = "0.5, 0.85"
+     font     = "VeraMono"
+     textsize = 0.05
+     colour   = "1.0, 1.0, 0.0, 0.8"
+     align    = "center"
+    />
+
+    <NotificationQueue
+     name     = "notification"
+     position = "0.55, 0.05"
+     font     = "VeraMono"
+     textsize = 0.020
+     length   = 3
+     width    = 50
+    />
+  </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/overlay/hud.oxo
===================================================================
--- code/branches/resource2/data/overlay/hud.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/hud.oxo	(revision 5646)
@@ -0,0 +1,109 @@
+<!-- HUD OVERLAY -->
+<OverlayGroup name = "HUD" scale = "1, 1">
+
+  <HUDSpeedBar
+   name       = "SpeedBar1"
+   background = "Orxonox/BarBackground"
+   size       = "0.35, 0.05"
+   position   = "0.0 , 1.0 "
+   pickPoint  = "0, 1"
+   value      = 0
+  >
+    <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
+    <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
+    <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
+  </HUDSpeedBar>
+
+  <!--HUDSpeedBar
+   name       = "SpeedBar2"
+   background = "Orxonox/BarBackground"
+   size       = "0.35, 0.05"
+   position   = "1.0 , 1.0 "
+   pickPoint  = "1, 1"
+   value      = 0
+   rightToLeft = true
+  >
+    <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
+    <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
+    <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
+  </HUDSpeedBar>
+
+  <HUDSpeedBar
+   name       = "SpeedBar3"
+   background = "Orxonox/BarBackground"
+   size       = "0.35, 0.05"
+   position   = "1.0 , 0.0 "
+   pickPoint  = "1, 0"
+   value      = 0
+   rightToLeft = true
+  >
+    <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
+    <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
+    <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
+  </HUDSpeedBar>
+
+  <HUDSpeedBar
+   name       = "SpeedBar4"
+   background = "Orxonox/BarBackground"
+   size       = "0.35, 0.05"
+   position   = "0.0 , 0.0 "
+   pickPoint  = "0, 0"
+   rotation   = 0
+   value      = 0
+  >
+    <BarColour position = 0.7 colour = "0.2,0.7,0.2" />
+    <BarColour position = 0.4 colour = "0.7,0.5,0.2" />
+    <BarColour position = 0.1 colour = "0.7,0.2,0.2" />
+  </HUDSpeedBar-->
+
+  <HUDNavigation
+   name          = "Navigation"
+   correctAspect = true
+   font          = "Monofur"
+   textSize      = 0.05
+   navMarkerSize = 0.03
+   aimMarkerSize = 0.04
+  />
+
+  <HUDRadar
+   name          = "Radar"
+   background    = "Orxonox/Radar"
+   correctAspect = true
+   size          = "0.17, 0.17"
+   position      = "0.5, 1.0"
+   pickPoint     = "0.5, 1.0"
+   rotation      = 0
+   sensitivity   = 1.0
+   halfDotSizeDistance = 3000
+   maximumDotSize      = 0.1
+  />
+
+  <ChatOverlay
+   name     = "chat"
+   position = "0.03, 0.5"
+   font     = "VeraMono"
+   caption  = ""
+   textSize = 0.025
+  />
+</OverlayGroup>
+
+
+<!-- DEBUG OVERLAY -->
+<OverlayGroup name = "Debug" scale = "1.0, 1.0" scroll = "0, 0" visible=false>
+
+  <DebugFPSText
+   name     = "FPSText"
+   position = "0.03, 0.05"
+   font     = "Monofur"
+   caption  = "Frames per second: "
+   textSize = 0.03
+  />
+
+  <DebugRTRText
+   name     = "RTRText"
+   position = "0.03, 0.09"
+   font     = "Monofur"
+   caption  = "Tick time in ms: "
+   textSize = 0.03
+  />
+</OverlayGroup>
Index: code/branches/resource2/data/overlay/hudtemplates3.oxo
===================================================================
--- code/branches/resource2/data/overlay/hudtemplates3.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/hudtemplates3.oxo	(revision 5646)
@@ -0,0 +1,99 @@
+<!--
+<Template name="defaultHUD">
+  <OverlayGroup name = "defaultHUD" scale = "1, 1">
+    <ChatOverlay
+     name     = "chat"
+     position = "0.03, 0.5"
+     font     = "VeraMono"
+     caption  = ""
+     textsize = 0.025
+    />
+
+    <GametypeStatus
+     name     = "state"
+     position = "0.5, 0.85"
+     font     = "VeraMono"
+     textsize = 0.05
+     colour   = "1.0, 1.0, 0.0, 0.8"
+     align    = "center"
+    />
+  </OverlayGroup>
+</Template>
+-->
+
+<Template name="spectatorhud">
+  <OverlayGroup name = "spectatorhud" scale = "1, 1">
+  </OverlayGroup>
+</Template>
+
+<Template name="spaceshiphud">
+  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
+    <Map />
+
+    <HUDHealthBar
+     name              = "HealthBar1"
+     background        = "Orxonox/HealthBarBackground"
+     size              = "0.35, 0.0875"
+     position          = "0.0 , 0.95 "
+     pickpoint         = "0, 1"
+     bartexture        = "healthbar_bar.tga"
+     textfont          = "VeraMono"
+     textusebarcolour  = true
+     textsize          = 0.039
+     textoffset        = "0.315, 0.05"
+     textpickpoint     = "0, 0"
+     textalign         = "right"
+     correctaspect     = false
+     textcorrectaspect = false
+    >
+      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+    </HUDHealthBar>
+
+    <HUDSpeedBar
+     name          = "SpeedBar1"
+     background    = "Orxonox/BarBackground"
+     size          = "0.35, 0.05"
+     position      = "0.0 , 1.0 "
+     pickpoint     = "0, 1"
+     correctaspect = false
+    >
+      <BarColour position = 0.0 colour = "0.7,0.5,0.2" />
+      <BarColour position = 0.5 colour = "0.2,0.7,0.2" />
+      <BarColour position = 1.0 colour = "0.7,0.2,0.2" />
+    </HUDSpeedBar>
+
+    <HUDNavigation
+     name          = "Navigation"
+     correctaspect = true
+     font          = "Monofur"
+     textsize      = 0.05
+     navMarkerSize = 0.03
+     aimMarkerSize = 0.04
+    />
+
+    <HUDRadar
+     name          = "Radar"
+     background    = "Orxonox/Radar"
+     correctaspect = true
+     size          = "0.17, 0.17"
+     position      = "1.0, 1.0"
+     pickpoint     = "1.0, 1.0"
+     rotation      = 0
+     sensitivity   = 1.0
+     halfDotSizeDistance = 3000
+     maximumDotSize      = 0.1
+    />
+
+    <HUDTimer
+     name     = "Timer"
+     position = "0.5, 0.85"
+     font     = "VeraMono"
+     textsize = 0.1
+     colour   = "1.0, 1.0, 0.0, 0.8"
+     align    = "center"
+    />
+
+  </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/overlay/ponghud.oxo
===================================================================
--- code/branches/resource2/data/overlay/ponghud.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/ponghud.oxo	(revision 5646)
@@ -0,0 +1,70 @@
+<Template name="PongHUD">
+  <OverlayGroup name="PongHUD" scale = "1, 1">
+    <PongScore
+     position  = "0.05, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.06
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "left"
+
+     showleftplayer  = true
+     showrightplayer = false
+     showname        = true
+     showscore       = false
+    />
+
+    <PongScore
+     position  = "0.49, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.06
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "right"
+
+     showleftplayer  = true
+     showrightplayer = false
+     showname        = false
+     showscore       = true
+    />
+
+    <OverlayText
+     position  = "0.505, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.06
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "center"
+
+     caption   = ":"
+    />
+
+    <PongScore
+     position  = "0.51, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.06
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "left"
+
+     showleftplayer  = false
+     showrightplayer = true
+     showname        = false
+     showscore       = true
+    />
+
+    <PongScore
+     position  = "0.95, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.06
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "right"
+
+     showleftplayer  = false
+     showrightplayer = true
+     showname        = true
+     showscore       = false
+    />
+  </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/overlay/stats.oxo
===================================================================
--- code/branches/resource2/data/overlay/stats.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/stats.oxo	(revision 5646)
@@ -0,0 +1,56 @@
+<!-- Statistics Overlay -->
+<Template name=defaultScoreboard>
+    <OverlayGroup name = "Stats" scale = "1, 1" visible=false>
+
+      <!--OverlayText
+       name      = "Title"
+       position  = "0.79, 0.19"
+       pickpoint = "1, 1"	
+       font      = "Monofur"
+       caption   = "Scoreboard"
+       colour    = "0, 0.75, 0.2, 1"
+       textsize  = 0.04
+      /-->
+      
+      <OverlayText
+       name      = "descr1"
+       position  = "0.1, 0.20"
+       pickpoint = "0, 1"
+       font      = "Monofur"
+       caption   = "player name"
+       colour    = "0, 0.75, 0.2, 1"
+       textsize  = 0.04
+      />
+      <OverlayText
+       name      = "descr2"
+       position  = "0.6, 0.20"
+       pickpoint = "0, 1"	
+       font      = "Monofur"
+       caption   = "score"
+       colour    = "0, 0.75, 0.2, 1"
+       textsize  = 0.04
+      />
+      <OverlayText
+       name      = "descr3"
+       position  = "0.8, 0.20"
+       pickpoint = "0, 1"	
+       font      = "Monofur"
+       caption   = "deaths"
+       colour    = "0, 0.75, 0.2, 1"
+       textsize  = 0.04
+      />
+      
+      <!--Stats
+       name     = "Statistics"
+       position = "0.5, 0.7"
+       size = "0.85, 0.4"
+       correctaspect = false
+       pickpoint = "0.5, 0.5"
+      /-->
+
+      <Scoreboard
+       name     = "Scores"
+      />
+
+    </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/overlay/teambasematchhud.oxo
===================================================================
--- code/branches/resource2/data/overlay/teambasematchhud.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/teambasematchhud.oxo	(revision 5646)
@@ -0,0 +1,90 @@
+<Template name="TeamBaseMatchHUD">
+  <OverlayGroup name="TeamBaseMatchHUD" scale = "1, 1">
+    <OverlayText
+     position  = "0.2, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "1.0, 0.5, 0.5, 1.0"
+     align     = "left"
+     caption   = "Red team"
+    />
+
+    <TeamBaseMatchScore
+     position  = "0.37, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "1.0, 0.8, 0.8, 1.0"
+     align     = "left"
+
+     showleftteam  = true
+     showrightteam = false
+     showbases     = true
+     showscore     = false
+    />
+
+    <TeamBaseMatchScore
+     position  = "0.49, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "1.0, 0.8, 0.8, 1.0"
+     align     = "right"
+
+     showleftteam  = true
+     showrightteam = false
+     showbases     = false
+     showscore     = true
+    />
+
+    <OverlayText
+     position  = "0.505, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "0.8, 0.8, 0.8, 1.0"
+     align     = "center"
+
+     caption   = ":"
+    />
+
+    <TeamBaseMatchScore
+     position  = "0.51, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "0.8, 0.8, 1.0, 1.0"
+     align     = "left"
+
+     showleftteam  = false
+     showrightteam = true
+     showbases     = false
+     showscore     = true
+    />
+
+    <TeamBaseMatchScore
+     position  = "0.63, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "0.8, 0.8, 1.0, 1.0"
+     align     = "right"
+
+     showleftteam  = false
+     showrightteam = true
+     showbases     = true
+     showscore     = false
+    />
+
+    <OverlayText
+     position  = "0.8, 0.05"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "0.5, 0.5, 1.0, 1.0"
+     align     = "right"
+     caption   = "Blue team"
+    />
+  </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/overlay/underattackhud.oxo
===================================================================
--- code/branches/resource2/data/overlay/underattackhud.oxo	(revision 5646)
+++ code/branches/resource2/data/overlay/underattackhud.oxo	(revision 5646)
@@ -0,0 +1,26 @@
+<Template name="UnderAttackHUD">
+  <OverlayGroup name="UnderAttackHUD" scale = "1, 1">
+    <UnderAttackHealthBar
+     name                 = "HealthBar"
+     background           = "Orxonox/HealthBarBackground"
+     size                 = "0.45, 0.0875"
+     position             = "0.99 , 0.01"
+     pickpoint            = "1, 0"
+     bartexture           = "healthbar_bar.tga"
+     textfont             = "VeraMono"
+     textusebarcolour     = true
+     textsize             = 0.039
+     textoffset           = "0.315, 0.05"
+     textpickpoint        = "0, 0"
+     textalign            = "right"
+     correctaspect        = false
+     textcorrectaspect    = false
+     descriptionpickpoint = "0, 0"
+     descriptionoffset    = "0.5, 1"
+    >
+      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+    </UnderAttackHealthBar>
+  </OverlayGroup>
+</Template>
Index: code/branches/resource2/data/particle/Example-Water.particle
===================================================================
--- code/branches/resource2/data/particle/Example-Water.particle	(revision 5646)
+++ code/branches/resource2/data/particle/Example-Water.particle	(revision 5646)
@@ -0,0 +1,35 @@
+Examples/Water/Rain
+{
+    material        Examples/Droplet
+    particle_width  100
+    particle_height 300
+    cull_each       true
+    quota           100
+    // Make common direction straight down (faster than self oriented)
+    billboard_type  oriented_common
+    common_direction 0 -1 0
+    
+    // Area emitter
+    emitter Box
+    {
+        angle           0
+        emission_rate   20
+        time_to_live    5
+        direction       0 -1 0
+        velocity    	1000
+        colour_range_start  0.3 1 0.3
+        colour_range_end    0.7 1 0.7
+        width           3000
+        height          3000
+        depth           0
+    }
+
+    // Gravity
+    affector LinearForce
+    {
+        force_vector      0 -1000 0
+        force_application add
+    }
+
+}
+
Index: code/branches/resource2/data/particle/Example.particle
===================================================================
--- code/branches/resource2/data/particle/Example.particle	(revision 5646)
+++ code/branches/resource2/data/particle/Example.particle	(revision 5646)
@@ -0,0 +1,395 @@
+// Example particle systems
+
+// Exudes greeny particles which float upwards
+Examples/GreenyNimbus
+{
+    material        Examples/FlarePointSprite
+	point_rendering	true
+	// point rendering means size is controlled by material
+	// provide fallback sizes for hardware that doesn't support point sprite
+    particle_width  30
+    particle_height 30
+    cull_each       false
+	cull_each       false
+    quota           10000
+    billboard_type  point
+    
+    // Area emitter
+    emitter Box
+    {
+        angle           30
+        emission_rate   30
+        time_to_live    5
+        direction       0 1 0
+        velocity    	0
+        colour_range_start  1 1 0
+        colour_range_end    0.3 1 0.3
+        width           60
+        height          60
+        depth           60
+    }
+
+    // Make em float upwards
+    affector LinearForce
+    {
+        force_vector      0 100 0
+        force_application add
+    }
+
+    // Fader
+    affector ColourFader
+    {
+        red -0.25
+        green -0.25
+        blue -0.25
+    }
+
+
+}
+
+// A sparkly purple fountain
+Examples/PurpleFountain
+{
+    material        Examples/Flare2
+    particle_width  20
+    particle_height 40
+    cull_each       false
+    quota           10000
+    billboard_type  oriented_self
+    
+    // Area emitter
+    emitter Point
+    {
+        angle           15
+        emission_rate   75
+        time_to_live    3
+        direction       0 1 0
+        velocity_min    250
+        velocity_max    300
+        colour_range_start  0 0 0
+        colour_range_end    1 1 1
+    }
+
+    // Gravity
+    affector LinearForce
+    {
+        force_vector      0 -100 0
+        force_application add
+    }
+
+    // Fader
+    affector ColourFader
+    {
+        red -0.25
+        green -0.25
+        blue -0.25
+    }
+}
+
+
+// A downpour
+Examples/Rain
+{
+    material        Examples/Droplet
+    particle_width  20
+    particle_height 100
+    cull_each       true
+    quota           10000
+    // Make common direction straight down (faster than self oriented)
+    billboard_type  oriented_common
+    common_direction 0 -1 0
+    
+    // Area emitter
+    emitter Box
+    {
+        angle           0
+        emission_rate   100
+        time_to_live    5
+        direction       0 -1 0
+        velocity    	50
+        colour_range_start  0.3 1 0.3
+        colour_range_end    0.7 1 0.7
+        width           1000
+        height          1000
+        depth           0
+    }
+
+    // Gravity
+    affector LinearForce
+    {
+        force_vector      0 -200 0
+        force_application add
+    }
+
+}
+
+// A jet engine (of sorts)
+Examples/JetEngine1
+{
+	material 		Examples/Flare
+	particle_width 	25
+	particle_height	25
+	cull_each		false
+	quota			200
+	billboard_type	point
+
+	emitter Point
+	{
+		angle 5
+		emission_rate 100
+        time_to_live    1
+        direction       0 -1 0
+        velocity_min    250
+        velocity_max    300
+        colour_range_start  1 1 0.5
+        colour_range_end    1 0.8 0.3
+		
+	}
+	affector ColourFader
+	{
+		red -0.25
+		green -1
+		blue -1
+	}
+	
+}
+Examples/JetEngine2
+{
+	material 		Examples/Flare
+	particle_width 	15
+	particle_height	15
+	cull_each		false
+	quota			200
+	billboard_type	point
+
+	emitter Point
+	{
+		angle 3
+		emission_rate 100
+        time_to_live    1
+        direction       0 -1 0
+        velocity_min    350
+        velocity_max    400
+        colour_range_start  0.5 1 1
+        colour_range_end    0.3 0.8 1
+		
+	}
+	affector ColourFader
+	{
+		red -1
+		green -1
+		blue -0.5
+	}
+	
+}
+
+// Exudes aureola particles which around the model float upwards
+Examples/Aureola
+{
+    material        Examples/Aureola
+    particle_width  200
+    particle_height 200
+    cull_each       false
+    quota           100
+    billboard_type  perpendicular_common
+    common_direction 0 1 0
+    common_up_vector 0 0 1
+
+    // Area emitter
+    emitter Box
+    {
+        angle           30
+        emission_rate   4
+        time_to_live    5
+        position        0 -100 0
+        direction       0 1 0
+        velocity_min  	0
+        velocity_max  	30
+        colour_range_start  0.3 0.3 0.3 0.0
+        colour_range_end    0.8 0.8 0.8 0.0
+        width           10
+        height          10
+        depth           30
+    }
+
+    // Make em float upwards
+    affector LinearForce
+    {
+        force_vector      0 70 0
+        force_application add
+    }
+
+    // Fader
+    affector ColourFader2
+    {
+        red1 +0.4
+        green1 +0.4
+        blue1 +0.4
+        alpha1 +0.7
+
+        red2 -0.25
+        green2 -0.25
+        blue2 -0.25
+        alpha2 -0.3333
+
+        state_change 3.5
+    }
+
+    // Rotater
+    affector Rotator
+    {
+        rotation_range_start 0
+        rotation_range_end 360
+        rotation_speed_range_start 0
+        rotation_speed_range_end 180
+    }
+}
+
+
+Examples/Swarm
+{
+	quota	3000
+	material	Examples/Flare2
+	particle_width	12
+	particle_height	24
+	cull_each	true
+	renderer	billboard
+	sorted	true
+	local_space	false
+	billboard_type	oriented_self
+
+	emitter Box
+	{
+		angle	180
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	30
+		position	0 0 0
+		velocity	50
+		velocity_min	50
+		velocity_max	1
+		time_to_live	20
+		time_to_live_min	20
+		time_to_live_max	20
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	80
+		height	80
+		depth	80
+	}
+
+	affector ColourFader
+	{
+		red	-0.05
+		green	0
+		blue	0
+		alpha	0
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	0 -50 0
+		plane_normal	0 1 0
+		bounce	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	0 50 0
+		plane_normal	0 -1 0
+		bounce	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	50 0 0
+		plane_normal	-1 0 0
+		bounce	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	-50 0 0
+		plane_normal	1 0 0
+		bounce	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	0 0 50
+		plane_normal	0 0 -1
+		bounce	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	0 0 -50
+		plane_normal	0 0 1
+		bounce	1
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	60
+	}
+}
+
+
+Examples/Snow
+{
+	quota	2000
+	material	Examples/Flare
+	particle_width	4
+	particle_height	4
+	cull_each	true
+	renderer	billboard
+	sorted	true
+	local_space	false
+	billboard_type	point
+
+	emitter Box
+	{
+		angle	0
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 -1 0
+		emission_rate	100
+		position	0 200 0
+		velocity	20
+		velocity_min	20
+		velocity_max	20
+		time_to_live	20
+		time_to_live_min	20
+		time_to_live_max	20
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	200
+		height	200
+		depth	1
+	}
+
+	affector DeflectorPlane
+	{
+		plane_point	0 0 0
+		plane_normal	0 1 0
+		bounce	0
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	10
+	}
+}
+
+
Index: code/branches/resource2/data/particle/ExplosionComp1.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ExplosionComp1.particle	(revision 5646)
@@ -0,0 +1,66 @@
+
+Orxonox/ExplosionComp1
+{
+	quota	150
+	material	PE/explosion
+	particle_width	20
+	particle_height	40
+	cull_each	true
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Ellipsoid
+	{
+		angle	180
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	300
+		position	0 0 0
+		velocity	75
+		velocity_min	75
+		velocity_max	75
+		time_to_live	0.6
+		time_to_live_min	0.4
+		time_to_live_max	0.8
+		duration	0.4
+		duration_min	0.3
+		duration_max	0.6
+		repeat_delay	2.5
+		repeat_delay_min	2.5
+		repeat_delay_max	2.5
+		width		20
+		hight		20
+		depth		0
+	}
+
+	affector Scaler
+	{
+		rate	5
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	130.6
+		scope	0.4505
+		keep_velocity	false
+	}
+
+	affector ColourFader
+	{
+		red	1
+		green	1
+		blue	1
+		alpha	-0.06306
+	}
+}
Index: code/branches/resource2/data/particle/ExplosionComp2.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ExplosionComp2.particle	(revision 5646)
@@ -0,0 +1,56 @@
+
+Orxonox/ExplosionComp2
+{
+	quota	1000
+	material	PE/smoke
+	particle_width	10
+	particle_height	10
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	1 1 1 0.62963
+		colour_range_start	1 1 1 0.62963
+		colour_range_end	1 1 1 0.62963
+		direction	0 1 0
+		emission_rate	2000
+		position	0 0 0
+		velocity	80
+		velocity_min	80
+		velocity_max	80
+		time_to_live	0.8
+		time_to_live_min	0.8
+		time_to_live_max	0.8
+		duration	0.79
+		duration_min	0.79
+		duration_max	0.79
+		repeat_delay	1.5
+		repeat_delay_min	1.5
+		repeat_delay_max	1.5
+	}
+
+	affector Scaler
+	{
+		rate	12.07
+	}
+
+	affector ColourFader
+	{
+		red	-1
+		green	-1
+		blue	-1
+		alpha	-0.4234
+	}
+}
Index: code/branches/resource2/data/particle/ExplosionComp4.particle
===================================================================
--- code/branches/resource2/data/particle/ExplosionComp4.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ExplosionComp4.particle	(revision 5646)
@@ -0,0 +1,76 @@
+
+ExplosionComp4
+{
+	quota	10
+	material	BaseWhite
+	particle_width	100
+	particle_height	100
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+}
+
+Orxonox/ExplosionComp4
+{
+	quota	500
+	material	PE/explosion
+	particle_width	24.19
+	particle_height	25.08
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	9.73
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	2000
+		position	0 0 0
+		velocity	300
+		velocity_min	300
+		velocity_max	300
+		time_to_live	0.1802
+		time_to_live_min	0.1802
+		time_to_live_max	0.1802
+		duration	0.08
+		duration_min	0.08
+		duration_max	0.08
+		repeat_delay	0.1802
+		repeat_delay_min	0.1802
+		repeat_delay_max	0.1802
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	0
+		scope	0.2703
+		keep_velocity	false
+	}
+
+	affector LinearForce
+	{
+		force_vector	-16.8065 62.4805 6.57674
+		force_application	add
+	}
+}
Index: code/branches/resource2/data/particle/FireComp2.particle
===================================================================
--- code/branches/resource2/data/particle/FireComp2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/FireComp2.particle	(revision 5646)
@@ -0,0 +1,69 @@
+
+Orxonox/FireComp2
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	4
+	particle_height	4
+	cull_each	true
+	renderer	billboard
+	sorted	true
+	local_space	true
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	true
+
+	emitter HollowEllipsoid
+	{
+		angle	1.69
+		colour	1 1 1 0.506173
+		colour_range_start	1 1 1 0.506173
+		colour_range_end	1 1 1 0.506173
+		direction	0 1 0
+		emission_rate	1680
+		position	0 60 0
+		velocity	300
+		velocity_min	300
+		velocity_max	300
+		time_to_live	0.2
+		time_to_live_min	0.2
+		time_to_live_max	0.2
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	28.83
+		height	39.64
+		depth	88.29
+		inner_width	0.5
+		inner_height	0.5
+		inner_depth	0.5
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	250
+		scope	0.4865
+		keep_velocity	false
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector ColourFader
+	{
+		red	-1
+		green	-1
+		blue	-1
+		alpha	0.1351
+	}
+}
Index: code/branches/resource2/data/particle/LaserGun.particle
===================================================================
--- code/branches/resource2/data/particle/LaserGun.particle	(revision 5646)
+++ code/branches/resource2/data/particle/LaserGun.particle	(revision 5646)
@@ -0,0 +1,51 @@
+
+Orxonox/LaserGun
+{
+	quota	1000
+	material	PE/Streak
+	particle_width	1.892
+	particle_height	1.892
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	3.243
+		colour	1 0 0 1
+		colour_range_start	1 0 0 1
+		colour_range_end	1 0.0432099 0 1
+		direction	0 -1 0
+		emission_rate	1027
+		position	0 0 0
+		velocity	113.5
+		velocity_min	113.5
+		velocity_max	113.5
+		time_to_live	0.3604
+		time_to_live_min	0.3604
+		time_to_live_max	0.3604
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector ColourFader
+	{
+		red	-1
+		green	0.2613
+		blue	-0.1712
+		alpha	-1
+	}
+}
Index: code/branches/resource2/data/particle/ThrusterFire.particle
===================================================================
--- code/branches/resource2/data/particle/ThrusterFire.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ThrusterFire.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/ThrusterFire
+{
+	quota	50
+	material	PE/explosion3
+	particle_width	100
+	particle_height	100
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	50
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	20
+		time_to_live	1
+		time_to_live_min	1
+		time_to_live_max	1
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	40
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	0
+		rotation_speed_range_end	0
+		rotation_range_start	0
+		rotation_range_end	360
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.3 0.3 0.3 0
+		time1	0.1
+		colour2	0.2 0.2 0.2 0
+		time2	0.4
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/bigexplosion1part1.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/bigexplosion1part1.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/BigExplosion1part1
+{
+	quota	100
+	material	PE/Flare
+	particle_width	60
+	particle_height	60
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	top_center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	1000
+		position	0 0 0
+		velocity	50
+		velocity_min	50
+		velocity_max	100
+		time_to_live	1.3
+		time_to_live_min	1.3
+		time_to_live_max	1.6
+		duration	0.1
+		duration_min	0.1
+		duration_max	0.1
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+	}
+
+	affector Scaler
+	{
+		rate	40
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	1 1 1 0
+		time0	0
+		colour1	1 1 0.8 0
+		time1	0.1
+		colour2	0.1 0.1 0.1 0
+		time2	0.6
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/bigexplosion1part2.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/bigexplosion1part2.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/BigExplosion1part2
+{
+	quota	50
+	material	PE/ringflare
+	particle_width	60
+	particle_height	60
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	250
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	80
+		time_to_live	1.3
+		time_to_live_min	1.3
+		time_to_live_max	1.3
+		duration	0.2
+		duration_min	0.2
+		duration_max	0.2
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+	}
+
+	affector Scaler
+	{
+		rate	40
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0.5 0.5 0.5 0
+		time0	0
+		colour1	1 1 1 0
+		time1	0.1
+		colour2	0.1 0.1 0.1 0
+		time2	0.6
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/bigexplosion1part3.particle
===================================================================
--- code/branches/resource2/data/particle/bigexplosion1part3.particle	(revision 5646)
+++ code/branches/resource2/data/particle/bigexplosion1part3.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/BigExplosion1part3
+{
+	quota	120
+	material	PE/point_lensflare
+	particle_width	18
+	particle_height	18
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Ring
+	{
+		angle	0
+		colour	0 0 0 1
+		colour_range_start	0 0 0 1
+		colour_range_end	0 0 0 1
+		direction	0 1 0
+		emission_rate	1200
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	0
+		time_to_live	1
+		time_to_live_min	1
+		time_to_live_max	1
+		duration	0.1
+		duration_min	0.1
+		duration_max	0.1
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+		width	150
+		height	150
+		depth	0
+		inner_width	0.99
+		inner_height	0.99
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	1 1 1 0
+		time1	0.5
+		colour2	0 0 0 0
+		time2	1
+		colour3	0.5 0.5 0.5 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/emitted_emitter.particle
===================================================================
--- code/branches/resource2/data/particle/emitted_emitter.particle	(revision 5646)
+++ code/branches/resource2/data/particle/emitted_emitter.particle	(revision 5646)
@@ -0,0 +1,56 @@
+// Example emitted emitters
+Examples/Fireworks
+{
+     material Examples/Flare
+     point_rendering            false
+     particle_width             10
+     particle_height            10
+     cull_each                  false
+     quota                      1000
+     emit_emitter_quota         10
+     billboard_type             point
+     
+     // Emitter that emits multiple Point emitters with name 'explosion'
+     emitter Box
+     {
+         name                    mainEmitter
+         emit_emitter            explosion
+         angle                   30
+         emission_rate           1000
+         time_to_live            3
+         direction               0 1 0
+         velocity                200
+     }
+
+     // This Point emitter is emitted by the Box emitter and emits billboard particles itself
+     emitter Point
+     {
+         name                    explosion
+         angle                   360
+         emission_rate           1000
+         time_to_live            2
+         direction               0 1 0
+         velocity                80
+         duration                0.1
+         repeat_delay_min        2
+         repeat_delay_max        3
+     }
+
+     // Make em float downwards
+     affector LinearForce
+     {
+         force_vector            0 -100 0
+         force_application       add
+     } 
+
+     // Give em some nice colours
+     affector ColourInterpolator
+     {
+         time0                   0
+         colour0                 1 1 0
+         time1                   0.5
+         colour1                 1 0 0
+         time2                   0.9
+         colour2                 0 0 1
+     }
+} 
Index: code/branches/resource2/data/particle/engineglow.particle
===================================================================
--- code/branches/resource2/data/particle/engineglow.particle	(revision 5646)
+++ code/branches/resource2/data/particle/engineglow.particle	(revision 5646)
@@ -0,0 +1,40 @@
+
+Orxonox/engineglow
+{
+	quota	200
+	material	PE/bigFlame
+	particle_width	12
+	particle_height	12
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter HollowEllipsoid
+	{
+		angle	0
+		colour	0.46875 0.8125 0.93359375 1
+		colour_range_start	.6640625 .91796875 .92578125 1
+		colour_range_end	.08203125 .7578125 .98046875 1
+		direction	0 1 0
+		emission_rate	45
+		position	0 0 0
+		velocity	5
+		velocity_min	4
+		velocity_max	6
+		time_to_live	0.5
+		time_to_live_min	0.2
+		time_to_live_max	0.9
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	4
+		height	2.5
+		depth	1.3
+		inner_width	0.5
+		inner_height	0.3
+		inner_depth	0.2
+	}
+}
Index: code/branches/resource2/data/particle/explosion1.particle
===================================================================
--- code/branches/resource2/data/particle/explosion1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/explosion1.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/explosion1
+{
+	quota	200
+	material	PE/explosion
+	particle_width	100
+	particle_height	40
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	1 0.9 0.8 1
+		colour_range_start	1 0.9 0.8 1
+		colour_range_end	1 0.9 0.8 1
+		direction	0 1 0
+		emission_rate	2000
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	75
+		time_to_live	0.75
+		time_to_live_min	0.75
+		time_to_live_max	0.75
+		duration	0.1
+		duration_min	0.1
+		duration_max	0.1
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0.2 0.2 0.2 0
+		time0	0
+		colour1	0.4 0.3 0.2 0
+		time1	0.3
+		colour2	0.1 0.1 0.1 0
+		time2	0.5
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/explosion2.particle
===================================================================
--- code/branches/resource2/data/particle/explosion2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/explosion2.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/explosion2
+{
+	quota	150
+	material	PE/explosion
+	particle_width	50
+	particle_height	20
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	1 0.9 0.8 1
+		colour_range_start	1 0.9 0.8 1
+		colour_range_end	1 0.9 0.8 1
+		direction	0 1 0
+		emission_rate	300
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	75
+		time_to_live	0.75
+		time_to_live_min	0.75
+		time_to_live_max	0.75
+		duration	0.5
+		duration_min	0.5
+		duration_max	0.5
+		repeat_delay	5
+		repeat_delay_min	5
+		repeat_delay_max	5
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	1 1 1 0
+		time0	0
+		colour1	0.7 0.7 1 0
+		time1	0.5
+		colour2	0.2 0.3 0.5 0
+		time2	0.7
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/explosion2b.particle
===================================================================
--- code/branches/resource2/data/particle/explosion2b.particle	(revision 5646)
+++ code/branches/resource2/data/particle/explosion2b.particle	(revision 5646)
@@ -0,0 +1,67 @@
+
+Orxonox/explosion2b
+{
+	quota	150
+	material	PE/explosion
+	particle_width	20
+	particle_height	40
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Ellipsoid
+	{
+		angle	180
+		colour	0 0 0 1
+		colour_range_start	0 0 0 1
+		colour_range_end	0 0 0 1
+		direction	0 1 0
+		emission_rate	300
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	75
+		time_to_live	0.75
+		time_to_live_min	0.75
+		time_to_live_max	0.75
+		duration	0.5
+		duration_min	0.5
+		duration_max	0.5
+		repeat_delay	5
+		repeat_delay_min	5
+		repeat_delay_max	5
+		width	20
+		height	20
+		depth	0
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0.8 1 1 0
+		time0	0
+		colour1	0.5 0.7 1 0
+		time1	0.5
+		colour2	0.2 0.3 0.5 0
+		time2	0.7
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/explosion3.particle
===================================================================
--- code/branches/resource2/data/particle/explosion3.particle	(revision 5646)
+++ code/branches/resource2/data/particle/explosion3.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/explosion3
+{
+	quota	10
+	material	PE/explosion3
+	particle_width	7
+	particle_height	7
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	40
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	0
+		time_to_live	0.5
+		time_to_live_min	0.5
+		time_to_live_max	0.5
+		duration	0.1
+		duration_min	0.1
+		duration_max	0.1
+		repeat_delay	5
+		repeat_delay_min	5
+		repeat_delay_max	5
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	0
+		rotation_speed_range_end	0
+		rotation_range_start	0
+		rotation_range_end	360
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.5 0.5 0.5 0
+		time1	0.2
+		colour2	0.1 0.1 0.1 0
+		time2	0.6
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/fairytwirl.particle
===================================================================
--- code/branches/resource2/data/particle/fairytwirl.particle	(revision 5646)
+++ code/branches/resource2/data/particle/fairytwirl.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/fairytwirl
+{
+	quota	500
+	material	PE/lensflare
+	particle_width	2
+	particle_height	2
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Ring
+	{
+		angle	0
+		colour	0 0 0 1
+		colour_range_start	0 0 0 1
+		colour_range_end	0 0 0 1
+		direction	0 1 0
+		emission_rate	500
+		position	0 -10 0
+		velocity	15
+		velocity_min	15
+		velocity_max	15
+		time_to_live	1
+		time_to_live_min	1
+		time_to_live_max	1
+		duration	1
+		duration_min	1
+		duration_max	1
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+		width	35
+		height	35
+		depth	20
+		inner_width	0.99
+		inner_height	0.99
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	1 1 1 0
+		time1	0.5
+		colour2	0 0 0 0
+		time2	1
+		colour3	0.5 0.5 0.5 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/fire3.particle
===================================================================
--- code/branches/resource2/data/particle/fire3.particle	(revision 5646)
+++ code/branches/resource2/data/particle/fire3.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/fire3
+{
+	quota	50
+	material	PE/explosion3
+	particle_width	20
+	particle_height	20
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	50
+		position	0 0 0
+		velocity	0
+		velocity_min	0
+		velocity_max	20
+		time_to_live	1
+		time_to_live_min	1
+		time_to_live_max	1
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	40
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	0
+		rotation_speed_range_end	0
+		rotation_range_start	0
+		rotation_range_end	360
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.3 0.3 0.3 0
+		time1	0.1
+		colour2	0.2 0.2 0.2 0
+		time2	0.4
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/fire4.particle
===================================================================
--- code/branches/resource2/data/particle/fire4.particle	(revision 5646)
+++ code/branches/resource2/data/particle/fire4.particle	(revision 5646)
@@ -0,0 +1,67 @@
+
+Orxonox/fire4
+{
+	quota	25
+	material	PE/explosion3
+	particle_width	4
+	particle_height	4
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	35
+		position	0 0 0
+		velocity	5
+		velocity_min	5
+		velocity_max	10
+		time_to_live	0.25
+		time_to_live_min	0.25
+		time_to_live_max	0.25
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	0
+		rotation_speed_range_end	0
+		rotation_range_start	0
+		rotation_range_end	360
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	1 1 1 0
+		time0	0
+		colour1	0.6 0.6 0.6 0
+		time1	0.1
+		colour2	0.4 0.4 0.4 0
+		time2	0.4
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/forcefield.particle
===================================================================
--- code/branches/resource2/data/particle/forcefield.particle	(revision 5646)
+++ code/branches/resource2/data/particle/forcefield.particle	(revision 5646)
@@ -0,0 +1,554 @@
+Orxonox/ForceFieldPurpleBig
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0.744444 0 1 0.05
+		colour_range_end	0.533333 0 1 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 600
+		height 600
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0.3 0 0.3 0.05
+		colour_range_end	0.4 0 0.5 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 300
+		height 300
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	5
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 900
+		height 900
+	}
+}
+
+Orxonox/ForceFieldPurpleSmall
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0.744444 0 1 0.05
+		colour_range_end	0.533333 0 1 0.05
+		emission_rate	7
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 300
+		height 300
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0.3 0 0.3 0.05
+		colour_range_end	0.4 0 0.5 0.05
+		emission_rate	6
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 200
+		height 200
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	4
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 500
+		height 500
+	}
+}	
+
+Orxonox/ForceFieldGreenBig
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0.744444 1 0.05
+		colour_range_end	0 0.533333 1 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 600
+		height 600
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0.455556 0 0.05
+		colour_range_end	0 0.8 0 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 300
+		height 300
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	5
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 900
+		height 900
+	}
+}
+
+Orxonox/ForceFieldGreenSmall
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour	0 0.744444 1 0.05
+		colour_range_start	0 0.744444 1 0.05
+		colour_range_end	0 0.533333 1 0.05
+		emission_rate	7
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 300
+		height 300
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour	0 0.455556 0 0.05
+		colour_range_start	0 0.455556 0 0.05
+		colour_range_end	0 0.8 0 0.05
+		emission_rate	6
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 200
+		height 200
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	4
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 500
+		height 500
+	}
+}
+
+			
+Orxonox/ForceFieldBlueBig
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0 0.744444 0.05
+		colour_range_end	0.5 0 0.533333 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 600
+		height 600
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0.3 0.455556 0.05
+		colour_range_end	0 0.5 0.8 0.05
+		emission_rate	10
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 300
+		height 300
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	5
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 900
+		height 900
+	}
+}
+
+Orxonox/ForceFieldBlueSmall
+{
+	quota	10000
+	material	PE/smoke
+	particle_width	30
+	particle_height	500
+	cull_each	true
+	renderer	billboard
+	sorted		false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	1 0 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0 0.744444 0.05
+		colour_range_end	0.5 0 0.533333 0.05
+		emission_rate	7
+                direction 0 0 -1
+		velocity	87.1
+		velocity_min	87.1
+		velocity_max	87.1
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	1
+		width 300
+		height 300
+	}
+
+	emitter Cylinder
+	{
+		angle	0
+		colour_range_start	0 0.3 0.455556 0.05
+		colour_range_end	0 0.5 0.8 0.05
+		emission_rate	6
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 200
+		height 200
+	}
+	
+	emitter Cylinder
+	{
+		angle	1 1 1 0.05
+		colour_range_start	0.9 0.9 0.9 0.05
+		colour_range_end	1 1 1 0.05
+		emission_rate	4
+                direction 0 0 -1
+		velocity	77.42
+		velocity_min	77.42
+		velocity_max	77.42
+		time_to_live	30
+		time_to_live_min	30
+		time_to_live_max	30
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		depth	0
+		width 500
+		height 500
+	}
+}
Index: code/branches/resource2/data/particle/ray1.particle
===================================================================
--- code/branches/resource2/data/particle/ray1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ray1.particle	(revision 5646)
@@ -0,0 +1,30 @@
+
+Orxonox/ray1
+{
+	quota	1000
+	material	PE/lensflare
+	particle_width	4
+	particle_height	4
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter Point
+	{
+		angle	0
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	100
+		position	0 0 0
+		velocity	50
+		time_to_live	8
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+}
Index: code/branches/resource2/data/particle/ray2.particle
===================================================================
--- code/branches/resource2/data/particle/ray2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/ray2.particle	(revision 5646)
@@ -0,0 +1,38 @@
+
+Orxonox/ray2
+{
+	quota	1200
+	material	PE/lensflare
+	particle_width	4
+	particle_height	4
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter Ring
+	{
+		angle	0
+		colour	1 1 1 1
+		colour_range_start	1 1 1 1
+		colour_range_end	1 1 1 1
+		direction	0 1 0
+		emission_rate	7
+		position	0 0 0
+		velocity	20
+		velocity_min	20
+		velocity_max	50
+		time_to_live	10
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	15
+		height	15
+		depth	15
+		inner_width	0.5
+		inner_height	0.5
+	}
+
+}
Index: code/branches/resource2/data/particle/repairGold.particle
===================================================================
--- code/branches/resource2/data/particle/repairGold.particle	(revision 5646)
+++ code/branches/resource2/data/particle/repairGold.particle	(revision 5646)
@@ -0,0 +1,49 @@
+
+Orxonox/repairGold
+{
+	quota	200
+	material	PE/lensflare
+	particle_width	47.38
+	particle_height	47.38
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter HollowEllipsoid
+	{
+		angle	180
+		colour	0.91358 0.734568 0 1
+		colour_range_start	0.91358 0.734568 0 1
+		colour_range_end	0.91358 0.734568 0 1
+		direction	0 1 0
+		emission_rate	216.2
+		position	0 0 0
+		velocity	1
+		velocity_min	1
+		velocity_max	1
+		time_to_live	0.5405
+		time_to_live_min	0.5405
+		time_to_live_max	0.5405
+		duration	1.441
+		duration_min	1.441
+		duration_max	1.622
+		repeat_delay	0.7207
+		repeat_delay_min	0.7207
+		repeat_delay_max	0.7207
+		width	200
+		height	200
+		depth	200
+		inner_width	0.9
+		inner_height	0.9
+		inner_depth	0.9
+	}
+}
Index: code/branches/resource2/data/particle/repairSilver.particle
===================================================================
--- code/branches/resource2/data/particle/repairSilver.particle	(revision 5646)
+++ code/branches/resource2/data/particle/repairSilver.particle	(revision 5646)
@@ -0,0 +1,49 @@
+
+Orxonox/repairSilver
+{
+	quota	500
+	material	PE/lensflare
+	particle_width	47.38
+	particle_height	47.38
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter HollowEllipsoid
+	{
+		angle	0
+		colour	0.691358 0.814815 1 1
+		colour_range_start	0.691358 0.814815 1 1
+		colour_range_end	0.691358 0.814815 1 1
+		direction	0 1 0
+		emission_rate	342.3
+		position	0 0 0
+		velocity	1
+		velocity_min	1
+		velocity_max	1
+		time_to_live	0.4
+		time_to_live_min	0.4
+		time_to_live_max	0.4
+		duration	0.7
+		duration_min	0.7
+		duration_max	0.7
+		repeat_delay	0.7207
+		repeat_delay_min	0.7207
+		repeat_delay_max	0.7207
+		width	200
+		height	200
+		depth	200
+		inner_width	0.9
+		inner_height	0.9
+		inner_depth	0.9
+	}
+}
Index: code/branches/resource2/data/particle/shot1.particle
===================================================================
--- code/branches/resource2/data/particle/shot1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/shot1.particle	(revision 5646)
@@ -0,0 +1,36 @@
+Orxonox/shot1
+{
+	quota	5000
+	material	PE/lensflare
+	particle_width	3
+	particle_height	3
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter Cylinder
+	{
+		angle	0
+		colour	1 1 0 1
+		colour_range_start	1 1 0 1
+		colour_range_end	0.3 1 0.3 1
+		direction	0 1 0
+		emission_rate	260.9
+		position	0 0 0
+		velocity	120
+		velocity_min	120
+		velocity_max	120
+		time_to_live	2
+		time_to_live_min	2
+		time_to_live_max	2
+		duration	0.1
+		duration_min	0.1
+		duration_max	0.1
+		repeat_delay	0.5
+		repeat_delay_min	0.5
+		repeat_delay_max	0.5
+		width	0.5
+		height	0.5
+		depth	5
+	}
+}
Index: code/branches/resource2/data/particle/shot2.particle
===================================================================
--- code/branches/resource2/data/particle/shot2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/shot2.particle	(revision 5646)
@@ -0,0 +1,56 @@
+
+Orxonox/shot2
+{
+	quota	25
+	material	PE/point_lensflare
+	particle_width	40
+	particle_height	100
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	0
+		colour	0 0 0 1
+		colour_range_start	0 0 0 1
+		colour_range_end	0.5 0.5 0.7 1
+		direction	0 -1 0
+		emission_rate	40
+		position	0 0 0
+		velocity	200
+		velocity_min	200
+		velocity_max	300
+		time_to_live	0.5
+		time_to_live_min	0.5
+		time_to_live_max	0.5
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	-20
+	}
+
+	affector ColourFader
+	{
+		red	-0.8
+		green	-0.8
+		blue	-0.5
+		alpha	0
+	}
+}
Index: code/branches/resource2/data/particle/shot2_small.particle
===================================================================
--- code/branches/resource2/data/particle/shot2_small.particle	(revision 5646)
+++ code/branches/resource2/data/particle/shot2_small.particle	(revision 5646)
@@ -0,0 +1,56 @@
+
+Orxonox/shot2_small
+{
+	quota	25
+	material	PE/point_lensflare
+	particle_width	10
+	particle_height	25
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	true
+
+	emitter Point
+	{
+		angle	0
+		colour	0 0 0 1
+		colour_range_start	0.4 0.4 0.6 1
+		colour_range_end	0.5 0.5 0.7 1
+		direction	0 -1 0
+		emission_rate	80
+		position	0 0 0
+		velocity	1
+		velocity_min	1
+		velocity_max	1
+		time_to_live	0.25
+		time_to_live_min	0.25
+		time_to_live_max	0.25
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	-20
+	}
+
+	affector ColourFader
+	{
+		red	-1.6
+		green	-1.6
+		blue	-1.0
+		alpha	0
+	}
+}
Index: code/branches/resource2/data/particle/shot3_small.particle
===================================================================
--- code/branches/resource2/data/particle/shot3_small.particle	(revision 5646)
+++ code/branches/resource2/data/particle/shot3_small.particle	(revision 5646)
@@ -0,0 +1,56 @@
+
+Orxonox/shot3_small
+{
+	quota	25
+	material	PE/point_lensflare
+	particle_width	10
+	particle_height	25
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	true
+
+	emitter Point
+	{
+		angle	0
+		colour	0 0 0 1
+		colour_range_start	0.4 0.4 0.6 1
+		colour_range_end	0.5 0.5 0.7 1
+		direction	0 -1 0
+		emission_rate	80
+		position	0 0 0
+		velocity	1
+		velocity_min	1
+		velocity_max	1
+		time_to_live	0.25
+		time_to_live_min	0.25
+		time_to_live_max	0.25
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	-15
+	}
+
+	affector ColourFader
+	{
+		red	-1.6
+		green	-1.6
+		blue	-1.0
+		alpha	0
+	}
+}
Index: code/branches/resource2/data/particle/shotTest.particle
===================================================================
--- code/branches/resource2/data/particle/shotTest.particle	(revision 5646)
+++ code/branches/resource2/data/particle/shotTest.particle	(revision 5646)
@@ -0,0 +1,55 @@
+
+Orxonox/shotTest
+{
+	quota	3000
+	material	PE/bigFlame
+	particle_width	1
+	particle_height	10
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	true
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	7.2
+		colour	1 0 0 0.9
+		colour_range_start	1 0 0 0.9
+		colour_range_end	1 0.185185 0 0.9
+		direction	0 1 0
+		emission_rate	2000
+		position	0 0 0
+		velocity	300
+		velocity_min	300
+		velocity_max	300
+		time_to_live	0.2
+		time_to_live_min	0.2
+		time_to_live_max	0.2
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	500
+		scope	1
+		keep_velocity	false
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+}
Index: code/branches/resource2/data/particle/smoke1.particle
===================================================================
--- code/branches/resource2/data/particle/smoke1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke1.particle	(revision 5646)
@@ -0,0 +1,43 @@
+// Example particle systems
+
+// smoke
+Examples/Smoke
+{
+    	material        	Examples/Smoke
+    	particle_width  	55
+    	particle_height 	55
+    	cull_each       	true
+    	quota           	500
+    	billboard_type  	point
+		sorted				true
+    
+    	// Area emitter
+    	emitter Point
+    	{
+		angle               		11
+        	emission_rate       		15
+        	time_to_live        		4
+        	direction           		0 1 0
+        	velocity_min        		150
+        	velocity_max        		240    	
+	}
+
+	affector ColourImage
+	{
+		image		smokecolors.tga
+	}
+
+   	affector Rotator
+   	{
+        	rotation_range_start  		0
+        	rotation_range_end   	 	360
+        	rotation_speed_range_start  	-60
+        	rotation_speed_range_end    	200
+   	}
+
+   	affector Scaler
+   	{
+       	rate 	100
+   	}
+
+}
Index: code/branches/resource2/data/particle/smoke2.particle
===================================================================
--- code/branches/resource2/data/particle/smoke2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke2.particle	(revision 5646)
@@ -0,0 +1,45 @@
+
+Orxonox/smoke2
+{
+	quota	1000
+	material	PE/smoke
+	particle_width	4
+	particle_height	4
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter Ellipsoid
+	{
+		angle	150
+		colour	0.0547945 0.0547945 0.0547945 0.9
+		colour_range_start	0.0547945 0.0547945 0.0547945 0.9
+		colour_range_end	0.0547945 0.0547945 0.0547945 0.9
+		direction	0 1 0
+		emission_rate	40
+		position	0 0 0
+		velocity	2
+		velocity_min	2
+		velocity_max	2
+		time_to_live	3
+		time_to_live_min	3
+		time_to_live_max	5
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	0.2
+		height	0.2
+		depth	0.2
+	}
+
+	affector ColourFader
+	{
+		red	0.3
+		green	0.3
+		blue	0.3
+		alpha	-0.35
+	}
+}
Index: code/branches/resource2/data/particle/smoke3.particle
===================================================================
--- code/branches/resource2/data/particle/smoke3.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke3.particle	(revision 5646)
@@ -0,0 +1,79 @@
+
+Orxonox/smoke3
+{
+	quota	10
+	material	PE/smoke2
+	particle_width	30
+	particle_height	30
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	10
+		position	0 0 0
+		velocity	7
+		velocity_min	7
+		velocity_max	7
+		time_to_live	5
+		time_to_live_min	5
+		time_to_live_max	5
+		duration	1
+		duration_min	1
+		duration_max	1
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+	}
+
+	affector Scaler
+	{
+		rate	20
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	150
+		scope	1
+		keep_velocity	true
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	-20
+		rotation_speed_range_end	20
+		rotation_range_start	0
+		rotation_range_end	0
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.5 0.5 0.5 0.2
+		time1	0.2
+		colour2	0.5 0.5 0.5 0.5
+		time2	0.5
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/smoke4.particle
===================================================================
--- code/branches/resource2/data/particle/smoke4.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke4.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/smoke4
+{
+	quota	10
+	material	PE/smoke3
+	particle_width	7
+	particle_height	7
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	15
+		position	0 0 0
+		velocity	20
+		velocity_min	20
+		velocity_max	20
+		time_to_live	1.5
+		time_to_live_min	1.5
+		time_to_live_max	1.5
+		duration	0.3
+		duration_min	0.3
+		duration_max	0.3
+		repeat_delay	1000000
+		repeat_delay_min	1000000
+		repeat_delay_max	1000000
+	}
+
+	affector Scaler
+	{
+		rate	15
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	-50
+		rotation_speed_range_end	50
+		rotation_range_start	0
+		rotation_range_end	0
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.5 0.5 0.5 0.4
+		time1	0.2
+		colour2	0.5 0.5 0.5 0.8
+		time2	0.5
+		colour3	0 0 0 0
+		time3	1
+		colour4	0.5 0.5 0.5 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/smoke5.particle
===================================================================
--- code/branches/resource2/data/particle/smoke5.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke5.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/smoke5
+{
+	quota	80
+	material	PE/smoke3
+	particle_width	40
+	particle_height	40
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	20
+		position	0 0 0
+		velocity	7
+		velocity_min	7
+		velocity_max	7
+		time_to_live	3
+		time_to_live_min	3
+		time_to_live_max	3
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	30
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	-50
+		rotation_speed_range_end	50
+		rotation_range_start	0
+		rotation_range_end	0
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0 0 0 0
+		time0	0
+		colour1	0.5 0.5 0.5 0.4
+		time1	0.05
+		colour2	0.3 0.3 0.3 0.8
+		time2	0.5
+		colour3	0.1 0.1 0.1 0.4
+		time3	0.8
+		colour4	0 0 0 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/smoke6.particle
===================================================================
--- code/branches/resource2/data/particle/smoke6.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke6.particle	(revision 5646)
@@ -0,0 +1,64 @@
+
+Orxonox/smoke6
+{
+	quota	50
+	material	PE/smoke2
+	particle_width	25
+	particle_height	10
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	oriented_self
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 1
+		colour_range_start	0 0 0 1
+		colour_range_end	0 0 0 1
+		direction	0 1 0
+		emission_rate	50
+		position	0 0 0
+		velocity	40
+		velocity_min	40
+		velocity_max	60
+		time_to_live	1.5
+		time_to_live_min	1.5
+		time_to_live_max	1.5
+		duration	1
+		duration_min	1
+		duration_max	1
+		repeat_delay	5
+		repeat_delay_min	5
+		repeat_delay_max	5
+	}
+
+	affector Scaler
+	{
+		rate	100
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0.3 0.3 0.3 0.0
+		time0	0.1
+		colour1	0.2 0.2 0.2 0.2
+		time1	0.2
+		colour2	0.2 0.2 0.2 0.2
+		time2	0.6
+		colour3	0 0 0 0
+		time3	1
+		colour4	0 0 0 0
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/smoke7.particle
===================================================================
--- code/branches/resource2/data/particle/smoke7.particle	(revision 5646)
+++ code/branches/resource2/data/particle/smoke7.particle	(revision 5646)
@@ -0,0 +1,72 @@
+
+Orxonox/smoke7
+{
+	quota	25
+	material	PE/smoke2
+	particle_width	8
+	particle_height	8
+	cull_each	false
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	vertex
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Point
+	{
+		angle	180
+		colour	0 0 0 0
+		colour_range_start	0 0 0 0
+		colour_range_end	0 0 0 0
+		direction	0 1 0
+		emission_rate	25
+		position	0 0 0
+		velocity	5
+		velocity_min	5
+		velocity_max	10
+		time_to_live	1.0
+		time_to_live_min	1.0
+		time_to_live_max	1.0
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+	}
+
+	affector Scaler
+	{
+		rate	3
+	}
+
+	affector Rotator
+	{
+		rotation_speed_range_start	0
+		rotation_speed_range_end	0
+		rotation_range_start	0
+		rotation_range_end	360
+	}
+
+	affector ColourInterpolator
+	{
+		colour0	0.2 0.2 0.2 0
+		time0	0
+		colour1	0.15 0.15 0.15 0.7
+		time1	0.1
+		colour2	0.15 0.15 0.15 1
+		time2	0.6
+		colour3	0.1 0.1 0.1 0
+		time3	1
+		colour4	0.5 0.5 0.5 1
+		time4	1
+		colour5	0.5 0.5 0.5 0
+		time5	1
+	}
+}
Index: code/branches/resource2/data/particle/sparks.particle
===================================================================
--- code/branches/resource2/data/particle/sparks.particle	(revision 5646)
+++ code/branches/resource2/data/particle/sparks.particle	(revision 5646)
@@ -0,0 +1,61 @@
+
+Orxonox/sparks
+{
+	quota	100
+	material	PE/lensflare
+	particle_width	4
+	particle_height	4
+	cull_each	true
+	renderer	billboard
+	sorted	false
+	local_space	false
+	iteration_interval	0
+	nonvisible_update_timeout	0
+	billboard_type	point
+	billboard_origin	center
+	billboard_rotation_type	texcoord
+	common_up_vector	0 1 0
+	point_rendering	false
+	accurate_facing	false
+
+	emitter Ellipsoid
+	{
+		angle	180
+		colour	0.8 0.6 0.4 1
+		colour_range_start	0.8 0.6 0.4 1
+		colour_range_end	1 0.7 0.5 1
+		direction	0 -1 0
+		emission_rate	2000
+		position	0 0 0
+		velocity	1
+		velocity_min	1
+		velocity_max	1
+		time_to_live	4
+		time_to_live_min	4
+		time_to_live_max	4
+		duration	0.05
+		duration_min	0.05
+		duration_max	0.05
+		repeat_delay	5
+		repeat_delay_min	5
+		repeat_delay_max	5
+		width	75
+		height	75
+		depth	75
+	}
+
+	affector DirectionRandomiser
+	{
+		randomness	250
+		scope	0.1
+		keep_velocity	true
+	}
+
+	affector ColourFader
+	{
+		red	-0.25
+		green	-0.20
+		blue	-0.15
+		alpha	0
+	}
+}
Index: code/branches/resource2/data/particle/thruster1.particle
===================================================================
--- code/branches/resource2/data/particle/thruster1.particle	(revision 5646)
+++ code/branches/resource2/data/particle/thruster1.particle	(revision 5646)
@@ -0,0 +1,53 @@
+Orxonox/thruster1
+{
+	quota	100
+	material	PE/bigFlame
+	particle_width	15
+	particle_height	15
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter HollowEllipsoid
+	{
+		angle	0
+		colour	0.493151 0.246575 0.0410959 1
+		colour_range_start	0.493151 0.246575 0.0410959 1
+		colour_range_end	0.684932 0.547945 0.315068 1
+		direction	0 1 0
+		emission_rate	300
+		position	0 0 0
+		velocity	100
+		velocity_min	18
+		velocity_max	30
+		time_to_live	0.25
+		time_to_live_min	0
+		time_to_live_max	0.25
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	5
+		height	5
+		depth	2.8
+		inner_width	0.8
+		inner_height	0.8
+		inner_depth	0.8
+	}
+
+
+	affector ColourFader2
+	{
+		red1	0
+		green1	0
+		blue1	0
+		alpha1	0
+		red2	-0.3
+		green2	-0.6
+		blue2	-0.6
+		alpha2	0
+		state_change	0.25
+	}
+}
Index: code/branches/resource2/data/particle/thruster2.particle
===================================================================
--- code/branches/resource2/data/particle/thruster2.particle	(revision 5646)
+++ code/branches/resource2/data/particle/thruster2.particle	(revision 5646)
@@ -0,0 +1,47 @@
+Orxonox/thruster2
+{
+	quota	150
+	material	PE/bigFlame
+	particle_width	15
+	particle_height	15
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter HollowEllipsoid
+	{
+		angle	0
+		colour	0.4 0.3 0.8 1
+		colour_range_start	0.4 0.3 0.8 1
+		colour_range_end	0.5 0.4 0.9 1
+		direction	0 1 0
+		emission_rate	400
+		position	0 0 0
+		velocity	5
+		velocity_min	4
+		velocity_max	6
+		time_to_live	0.1
+		time_to_live_min	0.15
+		time_to_live_max	0.25
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	4
+		height	2.5
+		depth	1.3
+		inner_width	0.5
+		inner_height	0.3
+		inner_depth	0.2
+	}
+
+	affector ColourFader
+	{
+		red	-0.5
+		green	-0.5
+		blue	-0.6
+		alpha	-0.5
+	}
+}
Index: code/branches/resource2/data/particle/thruster3.particle
===================================================================
--- code/branches/resource2/data/particle/thruster3.particle	(revision 5646)
+++ code/branches/resource2/data/particle/thruster3.particle	(revision 5646)
@@ -0,0 +1,53 @@
+Orxonox/thruster3
+{
+	quota	100
+	material	PE/bigFlame
+	particle_width	2
+	particle_height	2
+	cull_each	false
+	renderer	billboard
+	billboard_type	point
+
+	emitter HollowEllipsoid
+	{
+		angle	0
+		colour	0.493151 0.246575 0.0410959 1
+		colour_range_start	0.493151 0.246575 0.0410959 1
+		colour_range_end	0.684932 0.547945 0.315068 1
+		direction	-1 0 0
+		emission_rate	300
+		position	0 0 0
+		velocity	6
+		velocity_min	5
+		velocity_max	7
+		time_to_live	0.125
+		time_to_live_min	0.100
+		time_to_live_max	0.125
+		duration	0
+		duration_min	0
+		duration_max	0
+		repeat_delay	0
+		repeat_delay_min	0
+		repeat_delay_max	0
+		width	1
+		height	1
+		depth	2.8
+		inner_width	0.8
+		inner_height	0.8
+		inner_depth	0.8
+	}
+
+
+	affector ColourFader2
+	{
+		red1	0
+		green1	0
+		blue1	0
+		alpha1	0
+		red2	-0.2
+		green2	-0.5
+		blue2	-0.5
+		alpha2	0
+		state_change	0.1
+	}
+}
Index: code/branches/resource2/data/resources.cfg
===================================================================
--- code/branches/resource2/data/resources.cfg	(revision 5646)
+++ code/branches/resource2/data/resources.cfg	(revision 5646)
@@ -0,0 +1,34 @@
+# Resource locations to be added to the 'boostrap' path 
+# This also contains the minimum you need to use the Ogre example framework
+[Bootstrap]
+Zip=packs/OgreCore.zip
+
+# Resource locations to be added to the default path
+[General]
+FileSystem=.
+FileSystem=fonts
+FileSystem=materials/programs
+FileSystem=materials/scripts
+FileSystem=materials/textures
+FileSystem=models
+FileSystem=overlay
+FileSystem=particle
+#FileSystem=../Media/levels
+#FileSystem=../Media/audio
+Zip=packs/cubemap.zip
+#Zip=../Media/packs/cubemapsJS.zip
+#Zip=../Media/packs/dragon.zip
+#Zip=../Media/packs/fresneldemo.zip
+#Zip=../Media/packs/ogretestmap.zip
+Zip=packs/skybox.zip
+FileSystem=gui/fonts
+
+# CEGUI files
+[GUI]
+FileSystem=gui/configs
+FileSystem=gui/fonts
+FileSystem=gui/imagesets
+FileSystem=gui/layouts
+FileSystem=gui/looknfeel
+FileSystem=gui/schemes
+FileSystem=gui/scripts
Index: code/branches/resource2/data/resources.oxr
===================================================================
--- code/branches/resource2/data/resources.oxr	(revision 5646)
+++ code/branches/resource2/data/resources.oxr	(revision 5646)
@@ -0,0 +1,19 @@
+<ResourceGroup name = "General" >
+    <ResourceLocation path = overlay />
+    <ResourceLocation path = particle />
+    <ResourceLocation path = defaultConfig />
+    <ResourceLocation path = levels />
+    <ResourceLocation path = tcl />
+    <ResourceLocation
+      path = test.zip
+      archive = Zip
+      recursive = true
+    />
+</ResourceGroup>
+
+<ResourceGroup name = "GUI" >
+    <ResourceLocation path = gui/configs />
+    <ResourceLocation path = gui/layouts />
+    <ResourceLocation path = gui/schemas />
+    <ResourceLocation path = gui/scripts />
+</ResourceGroup>
Index: code/branches/resource2/data/tcl/init.tcl
===================================================================
--- code/branches/resource2/data/tcl/init.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/init.tcl	(revision 5646)
@@ -0,0 +1,298 @@
+# Check if Tcl was properly initialized
+info library
+
+# Create orxonox namespace
+namespace eval orxonox {}
+
+# query --
+# Sends a query to the CommandExecutor of Orxonox and waits for the response.
+# This dummy procedure will be changed to it's real implementation by Orxonox itself.
+#
+# Arguments:
+# args - The command to send to Orxonox
+
+proc query args {
+    return -code error "Can't query Orxonox now"
+}
+
+
+# crossquery --
+# Sends a query to another Tcl-interpreter in Orxonox and waits for the response.
+# This dummy procedure will be changed to it's real implementation by Orxonox itself.
+#
+# Arguments:
+# id   - The ID of the other interpreter
+# args - The command to send to Orxonox
+
+proc crossquery {id args} {
+    return -code error "Can't query interpreter with ID $id now"
+}
+
+
+# execute --
+# Sends a command to the queue of Orxonox where it will be executed by the CommandExecutor after some time
+# This dummy procedure will be changed to it's real implementation by Orxonox itself.
+#
+# Arguments:
+# args - The command
+
+proc execute args {
+    return -code error "Can't execute a command now"
+}
+
+
+# crossexecute --
+# Sends a command to the queue of another Tcl-interpreter where it will be executed by after some time
+# This dummy procedure will be changed to it's real implementation by Orxonox itself.
+#
+# Arguments:
+# id   - The ID of the other interpreter
+# args - The command
+
+proc crossexecute {id args} {
+    return -code error "Can't execute a command now"
+}
+
+
+# running --
+# Returns true if the interpreter is still suposed to be running
+# This dummy procedure will be changed to it's real implementation by Orxonox itself.
+
+proc running {} {
+    return 1
+}
+
+
+# orxonox::while --
+# Works like while but breaks the loop if orxonox::running returns false
+
+proc ::orxonox::while {condition body} {
+    set condition_cmd [list expr $condition]
+    ::tcl::while {1} {
+        if {![uplevel 1 $condition_cmd] || ![::running]} {
+            break
+        }
+        uplevel 1 $body
+    }
+}
+
+
+# orxonox::for --
+# Works like for but breaks the loop if orxonox::running returns false
+
+proc ::orxonox::for {start condition step body} {
+    set condition_cmd [list expr $condition]
+    uplevel 1 $start
+    ::tcl::while {1} {
+        if {![uplevel 1 $condition_cmd] || ![::running]} {
+            break
+        }
+        uplevel 1 $body
+        uplevel 1 $step
+    }
+}
+
+
+# add the path to this file to the auto path
+
+set filepath [info script]
+#set ::orxonox::mediapath [string range $filepath 0 [string last "/" $filepath]]
+set ::orxonox::mediapath [file dirname $filepath]
+if {[lsearch $auto_path $::orxonox::mediapath] == -1} {
+    lappend auto_path $::orxonox::mediapath
+}
+unset filepath
+
+
+# save the start directory and the library directory
+
+proc psd {} "return [pwd]"
+proc pld {} "return $::orxonox::mediapath"
+
+set pwd [pwd]
+set psd [psd]
+set pld [pld]
+
+
+# modify cd to automatically set $pwd
+
+if {[llength [info command ::tcl::cd]] == 0} {
+    rename cd ::tcl::cd
+}
+proc cd {{path "~"}} {
+    global pwd
+    ::tcl::cd $path
+    set pwd [pwd]
+}
+
+
+# change the working directory to the media path
+
+cd $::orxonox::mediapath
+
+
+# Redefines puts to write directly into the Orxonox console if the channel is stdout or stderr.
+
+if {[llength [info command ::tcl::puts]] == 0} {
+    rename puts ::tcl::puts
+}
+proc puts args {
+    set argc [llength $args]
+    if {$argc < 1 || $argc > 3} {
+        error "wrong # args: should be \"puts ?-nonewline? ?channelId? string\""
+    }
+
+    set newline 1
+    set input $args
+
+    if {$argc > 1 && [lindex $input 0] == "-nonewline"} {
+        set newline 0
+        set input [lrange $input 1 end]
+    } elseif {$argc == 3} {
+        if {[lindex $input 2] == "nonewline"} {
+            set newline 0
+            set input [lrange $input 0 1]
+        } else {
+            error "bad argument \"[lindex $input 2]\": should be \"nonewline\""
+        }
+    }
+
+    if {[llength $input] == 1} {
+        set input [list stdout [join $input]]
+    }
+
+    foreach {channel s} $input break
+
+    if {$channel == "stdout" || $channel == "stderr"} {
+        execute puts $newline $s
+    } else {
+        eval [concat ::tcl::puts $args]
+    }
+}
+
+
+# Redefines unknown to send unknown commands back to orxonox
+
+if {[llength [info commands unknown]] != 0} {
+    # check if a command named "undefined_proc" exists, if yes rename it temporarily
+    set undefined_was_defined 0
+    if {[llength [info commands undefined_proc]] != 0} {
+        set undefined_was_defined 0
+        rename undefined_proc _undefined
+    }
+
+    # get the returned errormessage if an undefined_proc command is called
+    if {[llength [info commands ::tcl::unknown]] == 0} {
+        set errorcode [catch {unknown undefined_proc} result]
+    } else {
+        set errorcode [catch {::tcl::unknown undefined_proc} result]
+    }
+
+    if {$errorcode} {
+        set result_list [split $result]
+        set ::orxonox::errormessage_unknown [list]
+
+        # parse the error message (the original message was something like "invalid command name "undefined_proc"" but we just want "invalid command name")
+        foreach token $result_list {
+            if {![string match "*undefined_proc*" $token]} {
+                lappend ::orxonox::errormessage_unknown $token
+            }
+        }
+
+        unset result_list
+        unset token
+
+        set ::orxonox::errormessage_unknown_length [llength $::orxonox::errormessage_unknown]
+
+        # rename the original unknown procedure
+        if {[llength [info commands ::tcl::unknown]] == 0} {
+            rename unknown ::tcl::unknown
+        }
+
+        # define the modified version of unknown
+        # we implement two versions, because tcl8.4 complains if this fork is moved inside [unknown]
+        if {[info tclversion] >= 8.5} {
+            # version >= 8.5
+            proc unknown args {
+                global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
+
+                set cmd [concat ::tcl::unknown $args]
+                set errorcode [catch {eval $cmd} result options]
+                set resultlist [split $result]
+                set success 1
+
+                if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
+                    for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
+                        if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
+                            set success 0
+                            break
+                        }
+                    }
+                } else {
+                    set success 0
+                }
+
+                if {!$success} {
+                    return -code $errorcode -options $options $result
+                } else {
+                    return [query $args]
+                }
+            }
+        } else {
+            # version < 8.5
+            proc unknown args {
+                global ::orxonox::errormessage_unknown ::orxonox::errormessage_unknown_length
+
+                set cmd [concat ::tcl::unknown $args]
+                set errorcode [catch {eval $cmd} result]
+                set resultlist [split $result]
+                set success 1
+
+                if {$errorcode && [llength $resultlist] >= $::orxonox::errormessage_unknown_length} {
+                    for {set i 0} {$i < $::orxonox::errormessage_unknown_length} {incr i} {
+                        if {[lindex $::orxonox::errormessage_unknown $i] != [lindex $resultlist $i]} {
+                            set success 0
+                            break
+                        }
+                    }
+                } else {
+                    set success 0
+                }
+
+                if {!$success} {
+                    return -code $errorcode $result
+                } else {
+                    return [query $args]
+                }
+            }
+        }
+
+        set success 1
+    } else {
+        set success 0
+    }
+
+    unset errorcode
+    unset result
+
+    # if the "undefined_proc" command was renamed previously, undo this
+    if {$undefined_was_defined} {
+        rename _undefined undefined_proc
+    }
+
+    unset undefined_was_defined
+
+    if {!$success} {
+        unset success
+        # something went wrong, use the default method
+        proc unknown args {
+            return [query $args]
+        }
+    }
+    unset success
+} else {
+    # no original unknown procedure defined, use the default method
+    proc unknown args {
+        return [query $args]
+    }
+}
Index: code/branches/resource2/data/tcl/irc.tcl
===================================================================
--- code/branches/resource2/data/tcl/irc.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irc.tcl	(revision 5646)
@@ -0,0 +1,6 @@
+proc every {ms body} { eval $body; after $ms [list every $ms $body] }
+package require irk
+set conn [irk::connect orxonox $nickname]
+irk::join $conn #orxonox
+every 25 {}
+vwait termination
Index: code/branches/resource2/data/tcl/irk/README
===================================================================
--- code/branches/resource2/data/tcl/irk/README	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/README	(revision 5646)
@@ -0,0 +1,76 @@
+IRK README
+==========
+
+Welcome to IRK, a Tcl IRC client library. IRK is intended for Tcl
+programmers that want to use the IRC protocol for communication. It
+can be used to ease the creation of IRC "bots", as shown by the
+examples in the examples directory, and it can also serve as the basis
+for graphical chat clients. Finally, it can be used to allow IRKs to
+find each other without centralized coordination, by meeting on a
+designated IRC server and channel. It is therefore ideal for setting
+up the initial contact for P2P programs without requiring a central
+registry or server.
+
+LICENSE
+=======
+
+IRK is distributed under the BSD license, the same license as Tcl.
+
+INSTALLATION
+============
+
+IRK is written in pure Tcl, which means it requires no extensions. It
+works with Tcl 8.0 and all later releases of Tcl.
+
+IRK has been tested on Solaris 7, Red Hat Linux 7.2, Windows 98,
+Windows 2000 and FreeBSD 4.2. It should work on any platform that is
+able to support Tcl 8.0 or later.
+
+Just drop this directory into one of the directories in Tcl's auto
+path. In your Tcl scripts, add the line:
+
+	package require irk
+
+and the IRK package should load into your Tcl interpreter.
+
+USAGE
+=====
+
+Read docs/usage.txt for a short overview of the commands provided by
+IRK.
+
+RECENT CHANGES AND CURRENT VERSION
+==================================
+
+Please read docs/changes.txt to see a list of all changes, ordered
+chronologically by release.
+
+REQUIREMENTS
+============
+
+IRK is event driven, and it requires the event loop to be active. If
+you want to use IRK from tclsh or other programs embedding a Tcl
+interpreter where the event loop is inactive, enter the event loop by
+adding the following line somewhere in your program:
+
+	vwait infinitely
+
+If you are using IRK in Wish, you do not need to take any action.
+
+TODO
+====
+
+Please docs/todo.txt for a list of planned enhancements.
+
+CREDITS AND CONTACT
+===================
+
+IRK benefited from examination of the Zircon and savIRC code written
+by Lindsay Marshall and Saverio Castellano, respectively. The future
+OO wrapper API is based on an idea suggested by Dave N. Welton.
+
+You can contact Jacob Levy, the author of IRK, at jyl@best.com. Please
+do drop a note if you use IRK, or if you have suggestions for
+enhancements, or if you run into problems.
+
+
Index: code/branches/resource2/data/tcl/irk/docs/changes.txt
===================================================================
--- code/branches/resource2/data/tcl/irk/docs/changes.txt	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/docs/changes.txt	(revision 5646)
@@ -0,0 +1,22 @@
+IRK 0.01, 02/07/2002
+    This is the first release of IRK.
+
+    What's implemented:
+
+    * Connection management.
+    * Integrated support for SOCKS5 to get through firewalls.
+    * Rudimentary flow control and queueing. Needs more work.
+    * Ping, MOTD, and informational messages management.
+    * Channel and nick management.
+    * Users on channels tracking.
+    * CTCP and all its subcommands.
+    * Special CTCP TCL protocol for communication between IRKs. All Tcl code
+      received from remote IRKs is run in a safe interpreter.
+    * Generalized persistent authorization and password management mechanism.
+    * Two usage examples:
+      + tontalou.tcl: a "bot" modelled after SmallSaints on DalNet. This
+        bot is unfinished.
+      + fortunebot.tcl: a "bot" that demonstrates grabbing a page from
+        the web and presenting its information in IRC.
+      Unfortunately no documentation is provided for these bots but they do
+      provide excellent examples on how you can use IRK to write Tcl "bots".
Index: code/branches/resource2/data/tcl/irk/docs/todo.txt
===================================================================
--- code/branches/resource2/data/tcl/irk/docs/todo.txt	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/docs/todo.txt	(revision 5646)
@@ -0,0 +1,10 @@
+TODO LIST FOR IRK
+=================
+
+* Implement DCC.
+* Implement object based command structure.
+* Implement event bindings modelled after the Tk Text widget.
+* Improve flow control.
+* Implement the last remaining RFC1439 protocol elements.
+* Implement proxy IRK commands for CTCP TCL safe interpreters.
+* Implement /mode commands.
Index: code/branches/resource2/data/tcl/irk/docs/usage.txt
===================================================================
--- code/branches/resource2/data/tcl/irk/docs/usage.txt	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/docs/usage.txt	(revision 5646)
@@ -0,0 +1,59 @@
+A VERY ABBREVIATED INTRO TO IRK
+===============================
+
+All IRK commands are found within the ::irk namespace.
+
+To open a connection with an IRC server, use:
+
+   set conn [irk::connect twisted panda1]
+
+This opens a connection to the server named 'twisted' (This is
+actually the server twisted.ma.us.dal.net) with the nickname
+'panda1'. It also saves the connection token in the variable 'conn'
+for later use.
+
+If you're behind a SOCKS5 firewall, you can configure IRK to use a
+SOCKS5 proxy:
+
+   irk::config -sockproxy <proxyhost> -sockport <port>
+
+Do this before attempting to open connections to servers outside the
+firewall. After this step all communication with remote IRC servers
+goes through the SOCKS5 proxy. At present it is not possible to have
+connections simultaneously to IRC servers inside and outside the firewall.
+
+You can open any number of connections to different servers at the
+same time, limited only by the resources available on the host
+machine. Most IRC servers disallow opening two or more connections
+from the same user to a single server.
+
+Next, to join a channel, type:
+
+   irk::join $conn #mycoolchannel
+
+You can join any number of channels (no limits except those imposed by
+the server).
+
+To talk to a channel, do:
+
+   irk::say $conn #mycoolchannel {Wow, I'm on IRC!}
+
+The message "Wow, I'm on IRC!" (without the quotes) is sent to the
+channel #mycoolchannel.
+
+You can also send a private message to a specific nickname, via:
+
+   irk::say $conn somenick {Hey, I'm talking to you}
+
+To leave a channel use irk::leave. To close a connection with a server
+use irk::close. Read lib/irkcommand.tcl for all the commands
+provided. Full documentation will be provided eventually.
+
+The above API is likely to be subsumed by a more OO API that will look
+something like this:
+
+   set conn [irk::connect twisted panda1]
+   set mychan [$conn join #mycoolchannel]
+   $mychan say {Wow, I'm on IRC!}
+   set somenick [$conn user somenick]
+   $somenick say {Hey, I'm taling to you}
Index: code/branches/resource2/data/tcl/irk/examples/fortunebot.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/examples/fortunebot.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/examples/fortunebot.tcl	(revision 5646)
@@ -0,0 +1,151 @@
+# fortunebot.tcl --
+#
+# Demo bot using the irc TCL client library. This is a VERY simple bot that
+# demonstrates some simple uses of the irc TCL library.
+#
+# The bot sits on any number of channels and networks. It periodically grabs
+# a fortune from a web site and sends the fortune with appropriate delays
+# between each line to all channels on all networks it is on.
+
+# Example use in Tcl:
+#
+# % source fortunebot.tcl
+# % set token [irc::connect ....]
+# % fortune::join $token #mychannel
+# % fortune::start 120
+#
+# What this does:
+# * Loads the bot, which in turn will load the IRC library and HTTP.
+# * Connect to IRC
+# * Send the bot to join #mychannel
+# * Start the bot, with 120 seconds delay. Now it'll do its actions every
+#   120 seconds.
+#
+# To stop the bot:
+#
+# % fortune::stop
+#
+# Make him leave a channel:
+#
+# % fortune::leave $token #mychannel
+
+package require irk
+package require http
+
+namespace eval fortune {
+    variable state
+
+    array set state {
+	linedelay		2000
+	fortuneurl		http://www.earth.com/fortune
+    }
+}
+
+# Bot control:
+
+proc ::fortune::start {{delay 60}} {
+    variable state
+
+    # Compute the delay in milliseconds:
+
+    set state(delay) [expr $delay * 1000]
+
+    # Schedule the bot to run each $delay milliseconds:
+
+    set state(after) [after $state(delay) [list ::fortune::doquote]]
+}
+
+proc ::fortune::stop {} {
+    variable state
+
+    # Stop the bot if its running:
+
+    if {[info exists state(after)]} {
+	after cancel $state(after)
+	unset state(after)
+    }
+}
+
+
+# This is the actual body of the bot:
+#
+# Grab a quote from a web page and post it to all channels we're on:
+
+proc ::fortune::doquote {} {
+    variable state
+
+    # Grab the quote. The command callback does all the work:
+
+    http::geturl $state(fortuneurl) -command ::fortune::httpdone
+
+    # Finally reschedule ourselves, after events are one-shots
+
+    set state(after) [after $state(delay) [list ::fortune::doquote]]
+}
+
+proc ::fortune::httpdone {http} {
+    variable state
+    upvar #0 $http response
+
+    # Scrape the fortune off of the page:
+
+    set fortune [grabfortune $response(body)]
+
+    # Discard the HTTP array:
+
+    unset response
+
+    # Check if the quote is too long. If it is then punt.
+
+    if {[llength $fortune] > 3} {
+	return
+    }
+
+    # Say this quote on all channels on all connections we're on:
+
+    foreach conn [irk::connections] {
+	tell $fortune $conn
+    }
+}
+
+# This procedure scrapes the quote off of an HTML page:
+
+proc ::fortune::grabfortune {body} {
+    set body [split $body "\n"]
+    set beg [lsearch $body <PRE>]
+    set end [lsearch $body </PRE>]
+    return [lrange $body [expr $beg+1] [expr $end-1]]
+}
+
+# This procedure sends the quote to all channels we want the bot to be on:
+
+proc ::fortune::tell {fort conn} {
+    variable state
+
+    # Send the fortune to each channel we're on:
+
+    foreach chan [irk::onchannels $conn] {
+	tellchan $fort $conn $chan
+    }
+}
+
+# Asynchronously send lines to the channel:
+
+proc ::fortune::tellchan {fort conn channel} {
+    variable state
+
+    # Check if we are still on the channel:
+
+    if {![irk::onchannel $conn $channel]} {
+	return
+    }
+
+    # OK we're still on this channel, so say the current line and schedule
+    # the next line for later:
+
+    if {[llength $fort] > 0} {
+	irk::say $conn $channel [lindex $fort 0]
+	after $state(linedelay) \
+	    [list ::fortune::tellchan [lrange $fort 1 end] $conn $channel]
+    }
+}
Index: code/branches/resource2/data/tcl/irk/examples/mysaint.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/examples/mysaint.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/examples/mysaint.tcl	(revision 5646)
@@ -0,0 +1,277 @@
+# mysaint.tcl
+#
+# I got the inspiration to write this bot from the SmallSaints
+# bot on DalNet and the request of some Malay friends to create a clone.
+#
+# The bot sits on a channel and simply counts words that each user says.
+
+package require irk
+
+namespace eval ::mysaint {
+
+    variable state
+
+    set state(thisdir) [file dir [info script]]
+    set state(words,save) [file join $state(thisdir) savedwords.dat]
+    set state(save,interval) 30000
+
+    # For each identified user, there are several entries in the state array:
+    #
+    # state($user,words)	How many words they have total.
+    # state($user,session)	How many words they said this time.
+    # state($user,password)	What's their password
+    # state($user,ident)	What's their ident
+    #
+    # We also keep a mapping from nicknames to users:
+    #
+    # state($nick,user)		What's the user mask associated with this
+    #				nick name
+
+    proc initialize {} {
+	variable state
+	variable thisdir
+
+	# Set up a timer to save words:
+
+	set state(saver) [after $state(save,interval) ::mysaint::save]
+
+	# See if we have a saved words file. If so, read it in.
+
+	if {[file exists $state(words,save)]} {
+	    uplevel #0 source $state(words,save)
+	}
+    }
+
+    proc userSays {token nick user comm dest rest} {
+	if {[string match "!*" [lindex $rest 0]]} {
+	    userSaysCommand $token $dest $nick $user \
+		    [lindex $rest 0] [lrange $rest 1 end]
+	} else {
+	    userSaysWords $nick $user [llength $rest]
+	}
+    }
+
+    proc userSaysWords {nick user n} {
+	variable state
+
+	set seconds [clock seconds]
+	if {![info exists state($user,session,time)]} {
+	    set state($user,session,time) [clock seconds]
+	}
+	set state($user,time) $seconds
+
+	if {![info exists state($user,session)]} {
+	    set state($user,session) $n
+	} else {
+	    incr state($user,session) $n
+	}
+	if {![info exists state($user,words)]} {
+	    set state($user,words) $n
+	} else {
+	    incr state($user,words) $n
+	}
+
+	set state($nick,user) $user
+    }
+
+    proc userSaysCommand {token dest nick user cmd rest} {
+	variable state
+
+	# Determine destination of any reply we're going to send:
+
+	if {![string compare $dest $state(nick)]} {
+	    set dest $nick
+	}
+
+	switch -exact $cmd {
+	    "!help"	{userAsksHelp $token $nick}
+	    "!time"	{userAsksTime $token $nick $user $rest $dest}
+	    "!heard"	{userAsksHeard $token $nick $user $rest $dest}
+	    "!words"	{userAsksWords $token $nick $user $rest $dest}
+	    "!donate"	{userDonates $token $nick $user $rest $dest}
+	    "!pass"	{::irk::pass $token mysaint $nick $user $rest}
+	    "!ident"	{::irk::id $token mysaint $nick $user $rest}
+	    "!newpass"	{::irk::np $token mysaint $nick $user $rest}
+	}
+    }
+
+    proc userAsksHelp {token nick} {
+	::irk::say $token $nick \
+		[list Hello $nick, the following commands are supported: ]
+	::irk::say $token $nick "!help ---- prints this message"
+	::irk::say $token $nick "!words --- how many words you have"
+	::irk::say $token $nick "!donate -- to donate words to someone"
+	after 2000 [list ::irk::say $token $nick \
+				"!heard --- when did some speak last time"]
+	after 2500 [list ::irk::say $token $nick \
+				"!time ---- when someone connected"]
+	after 5000 [list ::irk::say $token $nick \
+		    "Note: To donate you have to have a password"]
+	after 7500 [list ::irk::say $token $nick \
+		    "Note: You can get a password with !pass"]
+    }
+
+    proc userAsksWords {token nick user rest dest} {
+	variable state
+
+	set target [lindex $rest 0]
+	if {[string compare $target ""]} {
+	    if {[catch {set user $state($target,user)}]} {
+		set who "The unknown user $target"
+		set target "The unknown user $target"
+	    } else {
+		set who $user
+	    }
+	} else {
+	    set who ""
+	}
+	if {[string compare $who ""]} {
+	    if {[catch {set words $state($who,words)}]} {
+		set words 0
+	    }
+	    if {[catch {set session $state($who,session)}]} {
+		set session 0
+	    }
+	    set reply \
+		    "$nick, $target has $session words now, total $words words"
+	} else {
+	    if {[catch {set words $state($user,words)}]} {
+		set words 0
+	    }
+	    if {[catch {set session $state($user,session)}]} {
+		set session 0
+	    }
+	    set reply \
+		    "$nick, you have $session words now, $words total words"
+	}
+	::irk::say $token $dest $reply
+    }
+
+    proc userAsksHeard {token nick user rest dest} {
+	variable state
+
+	set target [lindex $rest 0]
+	if {[string compare $target ""]} {
+	    if {[catch {set user $state($target,user)}]} {
+		set answer "I haven't heard $target speak recently."
+	    } else {
+		set time $state($user,time)
+		set time [clock format $time]
+		set answer "I heard $target speak last at $time"
+	    }
+	} else {
+	    set answer "I'm talking to you just now, $nick"
+	}
+
+	::irk::say $token $dest $answer
+    }
+
+    proc userAsksTime {token nick user rest dest} {
+	variable state
+
+	set target [lindex $rest 0]
+	if {[string compare $target ""]} {
+	    if {[catch {set user $state($target,user)}]} {
+		set answer "I don't know when $target connected"
+	    } else {
+		if {[catch {set time $state($user,session,time)}]} {
+		    set answer "I don't know when $target connected"
+		} else {
+		    set time [clock format $time]
+		    set answer \
+			    "I first noticed $target at $time"
+		}
+	    }
+	} else {
+	    if {[catch {set user $state($nick,user)}]} {
+		set answer "$nick, I don't know when you connected"
+	    } else {
+		if {[catch {set time $state($user,session,time)}]} {
+		    set answer "$nick, I don't know when you connected"
+		} else {
+		    set time [clock format $time]
+		    set answer \
+			    "$nick, I first noticed you at $time"
+		}
+	    }
+	}
+
+	::irk::say $token $dest $answer
+    }
+
+    # Start the bot:
+
+    proc start {token} {
+	variable state
+
+	set state($token,token) $token
+
+	set symsrv $::irk::state($token,symsrv)
+	set state(nick) $::irk::state(-$symsrv,nick)
+	set nick $state(nick)
+
+	foreach chan [::irk::onchannels $token] {
+	    ::irk::setaction2 $token PRIVMSG $chan ::mysaint::userSays
+	}
+	::irk::setaction2 $token PRIVMSG $nick ::mysaint::userSays
+
+	# Set up a timer to save the words info.
+
+	if {![info exists state(saver)]} {
+	    initialize
+	}
+
+	return ""
+    }
+
+    # Stop the bot:
+
+    proc stop {} {
+	variable state
+
+	foreach conn [array names state *,token] {
+	    stopcon $state($conn)
+	}
+
+	after cancel $state(saver)
+	catch {unset state(saver)}
+
+	return ""
+    }
+    proc stopcon {token} {
+	variable state
+
+	if {[catch {set symsrv $::irk::state($token,symsrv)}]} {
+	    return
+	}
+	set nick $state(nick)
+
+	foreach chan [::irk::onchannels $token] {
+	    ::irk::remaction2 $token PRIVMSG $chan ::mysaint::userSays
+	}
+	::irk::remaction2 $token PRIVMSG $nick ::mysaint::userSays
+
+	return ""
+    }
+
+    # Save words to a disk file:
+
+    proc save {} {
+	variable state
+
+	puts "Saving words in $state(words,save)"
+
+	# First of all reschedule ourselves:
+
+	set state(saver) [after $state(save,interval) ::mysaint::save]
+
+	# Save the words:
+
+	set pt "*,words"
+	if {![catch {set fd [open $state(words,save) w]}]} {
+	    puts $fd "array set ::mysaint::state [list [array get state $pt]]"
+
+	    catch {close $fd}
+	}
+    }	
+}
Index: code/branches/resource2/data/tcl/irk/irk.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/irk.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/irk.tcl	(revision 5646)
@@ -0,0 +1,24 @@
+# IRK: A client library for IRC programming written in Tcl.
+
+# We need the socks package to get through firewalls:
+
+package require socks
+
+# We provide the IRK package:
+
+package provide irk 0.1
+
+set thisdir [file dir [info script]]
+
+# Source the rest of the package:
+
+source [file join $thisdir lib irkstate.tcl]
+source [file join $thisdir lib irkconnect.tcl]
+source [file join $thisdir lib irkdispatch.tcl]
+source [file join $thisdir lib irkreceive.tcl]
+source [file join $thisdir lib irkcommand.tcl]
+source [file join $thisdir lib irkflow.tcl]
+source [file join $thisdir lib irkutil.tcl]
+source [file join $thisdir lib irkctcptcl.tcl]
+source [file join $thisdir lib irkauth.tcl]
+source [file join $thisdir lib irkservers.tcl]
Index: code/branches/resource2/data/tcl/irk/lib/irkauth.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkauth.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkauth.tcl	(revision 5646)
@@ -0,0 +1,303 @@
+# irkauth.tcl:
+#
+# Various procedures that deal with user authentication:
+
+namespace eval ::irk {
+
+    # The AUTH module keeps information about each user and facility ($fac)
+    # in the state array:
+    #
+    # auth(auth,$fac,$user)		If set, then $user has authenticated
+    #					successfully for the facility $fac.
+    # auth(user,$fac,$user,pass)	The password for this $user and $fac.
+    # auth(user,$fac,$user,ident)	The ident token for this $user & $fac.
+    #
+    # auth(ident,$fac,$ident,pass)	The password for this $ident and $fac.
+    # auth(ident,$fac,$ident,user)	The user for this $ident and $fac.
+    #
+    # auth(identcounter,$fac)		The ident token counter for $fac. This
+    #					is incremented each time a new user
+    #					establishes themselves with $fac.
+
+    # This procedure can be called by programs using the IRK library
+    # when a user sends a password.
+
+    proc pass {token fac nick user rest} {
+	variable auth
+
+	if {[llength $rest] != 1} {
+	    # Incorrect syntax:
+
+	    set reply "$nick, syntax is !pass <yourpass> (one word, no spaces)"
+	} elseif {[info exists auth(user,$fac,$user,pass)]} {
+
+	    # If this user has already established a password,
+	    # check that they're giving the right password.
+
+	    if {[string compare $auth(user,$fac,$user,pass) \
+				[lindex $rest 0]]} {
+		set reply "$nick, sorry, wrong password!"
+	    } else {
+		set reply "$nick, thanks for entering your password!"
+		set auth(auth,$fac,$user) 1
+	    }
+	} else {
+
+	    # This is the first time we're seeing this user. Accept
+	    # their password and send them an ident token. They can
+	    # use the ident token to reestablish themselves when their
+	    # user mask changes significantly.
+
+	    if {![info exists auth(identcounter,$fac)]} {
+		set auth(identcounter,$fac) 0
+	    }
+	    set ident $auth(identcounter,$fac)
+	    incr auth(identcounter,$fac)
+
+	    set auth(ident,$fac,$ident,user) $user
+	    set auth(ident,$fac,$ident,pass) [lindex $rest 0]
+
+	    set auth(user,$fac,$user,ident) $ident
+	    set auth(user,$fac,$user,pass) [lindex $rest 0]
+
+	    # Save the changes
+
+	    saveauth
+
+	    # Save them a step and also authorize them:
+
+	    set auth(ident,$fac,$user) 1
+
+	    set reply [list \
+	        $nick, your password is [lindex $rest 0]. Your ident is \
+	        $ident, write it down, you will need it later to \
+		reidentify yourself if your user mask changes. \
+		You user mask is currently $user. You are now authorised \
+		to use $fac.]
+	}
+
+	# Tell them what happened:
+
+	::irk::say $token $nick $reply
+
+	return ""
+    }
+
+    # This procedure can be called by programs when the user attempts to
+    # reestablish themselves with the existing ident and password.
+
+    proc id {token fac nick user rest} {
+	variable auth
+
+	set len [llength $rest]
+	set reply "Wrong syntax. Call !ident or !ident <ident> <pass>"
+
+	if {$len == 0} {
+
+	    # Calling ident with zero arguments. The user is trying to
+	    # retrieve their ident. Give it to them only if they did
+	    # identify successfully with the correct password.
+
+	    if {![info exists auth(user,$fac,$user,pass)]} {
+		set reply "$nick, first set a password"
+	    } elseif {[info exists auth(auth,$fac,$user)]} {
+		set reply \
+		    "$nick, your ident is $auth(user,$fac,$user,ident)"
+	    } else {
+		set reply \
+		   "$nick, identify with password before getting your ident!"
+	    }
+	} elseif {$len == 2} {
+
+	    # Calling ident with two arguments. The user is trying to
+	    # establish a new value for $user to associate with this
+	    # ident and password. If $auth($ident,pass) is the password
+	    # she gave, then they're the rightfull owner of the ident and
+	    # so we now recognize the new $user mask.
+
+	    set ident [lindex $rest 0]
+	    set pass [lindex $rest 1]
+
+	    if {[info exists auth(ident,$fac,$ident,pass)]} {
+		if {![string compare $auth(ident,$fac,$ident,pass) $pass]} {
+
+		    # Identify the old user mask they were using:
+
+		    set olduser $auth(ident,$fac,$ident,user)
+
+		    # Clean up the state associated with the old mask:
+
+		    array unset auth user,$fac,$olduser,*
+		    catch {unset auth(ident,$face,$olduser)}
+
+		    # Link up the new state:
+
+		    set auth(ident,$fac,$ident,user) $user
+
+		    set auth(user,$fac,$user,ident) $ident
+		    set auth(user,$fac,$user,pass) $pass
+
+		    # Save the changes
+
+		    saveauth
+
+		    # Save them a step and also treat them as authenticated:
+
+		    set auth(ident,$fac,$user) 1
+
+		    set reply \
+			    "OK, $nick, I'm now recognising you as $user.\
+			     You are now authorised to use $fac."
+		} else {
+		    set reply "$nick, sorry, wrong ident or password"
+		}
+	    } else {
+		set reply "$nick, sorry, wrong ident or password"
+	    }
+	}
+
+	# Tell them what happened:
+
+	::irk::say $token $nick $reply
+
+	return ""
+    }
+
+    # This procedure can be invoked by a program when a user tries to
+    # change her password.
+
+    proc np {token fac nick user rest} {
+	variable auth
+
+	set reply "Wrong syntax. Call !newpass <oldpass> <newpass>"
+
+	if {[llength $rest] == 2} {
+	    set opw [lindex $rest 0]
+	    set npw [lindex $rest 1]
+
+	    if {![info exists auth(user,$fac,$user,pass)]} {
+		# Unknown $user, probably their user mask changed. Help
+		# them reestablish the connection.
+
+		set reply \
+		   [list $nick, I don't have you in my database. Perhaps \
+			 your user mask changed drastically. If so, please \
+			 reestablish your user mask by using !ident <ident> \
+			 <oldpass>.]
+	    } elseif {[string compare $auth(user,$fac,$user,pass) $opw]} {
+		# Wrong old password!
+
+		set reply "$nick, sorry, wrong old password!"
+	    } else {
+		# Their user mask matches and they gave the correct old
+		# password, so we accept their new password:
+
+		set ident $auth(user,$fac,$user,ident)
+
+		set auth(ident,$fac,$ident,pass) $npw
+		set auth(user,$fac,$user,pass) $npw
+
+		# Save the changes:
+
+		saveauth
+
+		# Save them a step by also recording that they
+		# authenticated:
+
+		set auth(auth,$fac,$user) 1
+
+		set reply "OK, $nick, your new password is now $npw"
+	    }
+	}
+
+	# Tell them what happened:
+
+	::irk::say $token $nick $reply
+
+	return ""
+    }
+
+    # This procedure can be called by programs when the user wants to
+    # "log out" or lose her authentication with a given facility:
+
+    proc logout {token fac nick user rest} {
+	variable auth
+
+	set reply "You were not logged into $fac. Now you certainly aren't."
+
+	if {[info exists auth(auth,$fac,$user)]} {
+	    unset auth(auth,$fac,$user)
+
+	    set reply \
+		[list $nick, you logged out successfully from $fac. Thank you \
+		      for using $fac.]
+	}
+
+	# Tell them what happened:
+
+	::irk::say $token $nick $reply
+
+	return ""
+    }
+
+    # Is the user authenticated with the given facility?
+
+    proc userauthenticated {fac user} {
+	variable auth
+
+	# If auth(auth,$fac,$user) exists, then she is authenticated.
+
+	if {[info exists auth(auth,$fac,$user)]} {
+	    return 1
+	}
+	return 0
+    }
+
+    # This procedure automatically saves the authorization database:
+
+    proc saveauth {} {
+	variable state
+	variable auth
+
+	puts "Saving!"
+
+	# Define the patterns to save:
+
+	set p1 "identcounter,*"
+	set p2 "user,*"
+	set p3 "ident,*"
+
+	# Try to open the save file:
+
+	if {[info exists state(auth,save,file)]} {
+	    if {![catch {set fd [open $state(auth,save,file) w]}]} {
+		puts $fd "array set ::irk::auth [list [array get auth $p1]]"
+		puts $fd "array set ::irk::auth [list [array get auth $p2]]"
+		puts $fd "array set ::irk::auth [list [array get auth $p3]]"
+
+		catch {close $fd}
+	    }
+	}
+    }
+
+    # This procedure restores the authorization database:
+
+    proc restoreauth {} {
+	variable state
+
+	if {[info exists state(auth,save,file)]} {
+	    catch {uplevel #0 source $state(auth,save,file)}
+	}
+	set state(auth,restored) 1
+    }
+
+    # If this is the first time we're loading the IRK package, then
+    # restore the authorization database. Otherwise we'd be overwriting
+    # a potentially unsaved state.
+
+    variable state
+
+    if {![info exists state(auth,restored)]} {
+	restoreauth
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkcommand.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkcommand.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkcommand.tcl	(revision 5646)
@@ -0,0 +1,420 @@
+# irkcommand.tcl:
+#
+# Various commands that can be invoked by the user of the IRK library:
+
+namespace eval irk {
+
+    # Say something to a user or to a channel
+
+    proc say {token chan saying} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	if {![string compare "" $saying]} {
+	    return
+	}
+	sendit $sock "PRIVMSG $chan :[string trim $saying]"
+    }
+
+    # Send a NOTICE to a user or a channel
+
+    proc notice {token chan args} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	sendit $sock "NOTICE $chan :$args"
+    }
+
+    # Send a raw command to the server:
+
+    proc send {token args} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock $args
+    }
+
+    # Change your NICK
+
+    proc nick {token {newnick ""}} {
+	variable state
+
+	if {![string compare "" $newnick]} {
+	    return $state($token,nick)
+	}
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock "NICK $newnick"
+    }
+
+    # Join a channel
+
+    proc join {token chans {keys ""}} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock "JOIN $chans $keys"
+    }
+
+    # Leave a channel
+
+    proc leave {token chans {partmsg ""}} {
+	variable state
+
+	if {![string compare $partmsg ""]} {
+	    if {[info exists state(partmsg)]} {
+		set partmsg $state(partmsg)
+	    }
+	}
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock "PART $chans $partmsg"
+    }
+
+    # Return a list of all connections that are open:
+
+    proc connections {} {
+	variable state
+
+	if {![info exists state(connections)]} {
+	    return {}
+	}
+	return $state(connections)
+    }
+
+    # Return a list of channels we're on in a give connection:
+
+    proc onchannels {token} {
+	variable state
+
+	if {![info exists state($token,channels)]} {
+	    return {}
+	}
+	return $state($token,channels)
+    }
+
+    # Returns 1 if we are on the given channel.
+
+    proc onchannel {token channel} {
+	variable state
+
+	if {![info exists state($token,channels)]} {
+	    return 0
+	}
+
+	set idx [lsearch $state($token,channels) $channel]
+	if {$idx == -1} {
+	    return 0
+	}
+	return 1
+    }
+
+    # Return a list of users on a given channel (we must be on that channel).
+
+    proc whoison {token chan} {
+	variable state
+
+	if {![info exists state($token,$chan,NAMES)]} {
+	    return {}
+	}
+	return $state($token,$chan,NAMES)
+    }
+
+    # Ping a server
+
+    proc ping {token} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	set state($token,PINGSTART) [clock clicks -millis]
+	puts $sock "PING $state($token,host)"
+    }
+
+    # Quit this connection
+
+    proc quit {token} {
+	disconnect $token
+    }
+
+    # Query information about someone
+
+    proc whois {token nick} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock "WHOIS $nick"
+    }
+
+    # Set an away message
+
+    proc away {token args} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	puts $sock "AWAY :$args"
+    }
+
+    # This procedure lets the client do CTCP actions:
+
+    proc ctcp {token target action args} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	sendit $sock "PRIVMSG $target :\001$action $args\001"
+    }
+
+    # This command implements the TCL CTCP protocol:
+
+    proc tcl {token target args} {
+	variable state
+
+	# Send it to the channel:
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid irc connection"
+	}
+	sendit $sock "PRIVMSG $target :\001TCL $args\001"
+
+	# Apply it locally:
+
+	if {[info exists state($token,channel,ctcp,TCL,LOCAL)]} {
+	    $state($token,channel,ctcp,TCL,LOCAL) \
+		    $token $state($token,nick) $state($token,user) \
+		    PRIVMSG $target TCL $args
+	}
+    }
+
+    # These procedures add and remove action handlers:
+
+    # These procedures add actions that will be called when the user
+    # with the given nick causes the supplied comm(and) to be executed
+    # on the given dest(ination). This is the most specific form of action.
+
+    proc addaction3 {token nick comm dest cmd} {
+	variable state
+
+	if {![info exists state($token,$nick,$comm,$dest)]} {
+	    set state($token,$nick,$comm,$dest) [list $cmd]
+	} else {
+	    lappend state($token,$nick,$comm,$dest) $cmd
+	}
+    }
+
+    proc setaction3 {token nick comm dest cmd} {
+	variable state
+
+	set state($token,$nick,$comm,$dest) [list $cmd]
+    }
+
+    # This procedure removes an action set by either of the above two
+    # procedures.
+
+    proc remaction3 {token nick comm dest cmd} {
+	variable state
+
+	if {![info exists state($token,$nick,$comm,$dest)]} {
+	    return
+	}
+	set cmds $state($token,$nick,$comm,$dest)
+	set idx [lsearch $cmds $cmd]
+	if {$idx == -1} {
+	    return
+	}
+	set state($token,$nick,$comm,$dest) [lreplace $cmds $idx $idx]
+	if {![string compare "" $state($token,$nick,$comm,$dest)]} {
+	    unset state($token,$nick,$comm,$dest)
+	}
+    }
+
+    # These procedures add actions that will be called when the
+    # specific comm(and) is caused for the given dest(ination).
+
+    proc addaction2 {token comm dest cmd} {
+	variable state
+
+	if {![info exists state($token,$comm,$dest)]} {
+	    set state($token,$comm,$dest) [list $cmd]
+	} else {
+	    lappend state($token,$comm,$dest) $cmd
+	}
+    }
+
+    proc setaction2 {token comm dest cmd} {
+	variable state
+
+	set state($token,$comm,$dest) [list $cmd]
+    }
+
+    # This procedure removes an action set by either of the above two
+    # procedures.
+
+    proc remaction2 {token comm dest cmd} {
+	variable state
+
+	if {![info exists state($token,$comm,$dest)]} {
+	    return
+	}
+	set cmds $state($token,$comm,$dest)
+	set idx [lsearch $cmds $cmd]
+	if {$idx == -1} {
+	    return
+	}
+	set state($token,$comm,$dest) [lreplace $cmds $idx $idx]
+	if {![string compare "" $state($token,$comm,$dest)]} {
+	    unset state($token,$comm,$dest)
+	}
+    }
+
+    # These procedures add actions that will be called when the
+    # specific comm(and) is caused any dest(ination).
+
+    proc addaction1 {token comm cmd} {
+	variable state
+
+	if {![info exists state($token,$comm)]} {
+	    set state($token,$comm) [list $cmd]
+	} else {
+	    lappend state($token,$comm) $cmd
+	}
+    }
+
+    proc setaction1 {token comm cmd} {
+	variable state
+
+	set state($token,$comm) [list $cmd]
+    }
+
+    # This procedure removes an action set by either of the above two
+    # procedures.
+
+    proc remaction1 {token comm cmd} {
+	variable state
+
+	if {![info exists state($token,$comm)]} {
+	    return
+	}
+	set cmds $state($token,$comm)
+	set idx [lsearch $cmds $cmd]
+	if {$idx == -1} {
+	    return
+	}
+	set state($token,$comm) [lreplace $cmds $idx $idx]
+	if {![string compare "" $state($token,$comm)]} {
+	    unset state($token,$comm)
+	}
+    }
+
+    # These procedures add global actions that will be called
+    # when the specific comm(and) is caused on any dest(ination) and
+    # any irc connection. These are the lowest priority commands.
+
+    proc addactionglobal {comm cmd} {
+	variable state
+
+	if {![info exists state(cmd,$comm)]} {
+	    set state(cmd,$comm) [list $cmd]
+	} else {
+	    lappend state(cmd,$comm) $cmd
+	}
+    }
+
+    proc setactionglobal {comm cmd} {
+	variable state
+
+	set state(cmd,$comm) [list $cmd]
+    }
+
+    # This procedure removes an action set by either of the above two
+    # procedures.
+
+    proc remactionglobal {comm cmd} {
+	variable state
+
+	if {![info exists state(cmd,$comm)]} {
+	    return
+	}
+	set cmds $state(cmd,$comm)
+	set idx [lsearch $cmds $cmd]
+	if {$idx == -1} {
+	    return
+	}
+	set state(cmd,$comm) [lreplace $cmds $idx $idx]
+	if {![string compare "" $state(cmd,$comm)]} {
+	    unset state(cmd,$comm)
+	}
+    }
+
+    # This procedure manages configuration information for IRC:
+
+    proc config {args} {
+	if {$args == {}} {
+	    return [collectConfig]
+	}
+
+	if {[llength $args] == 1} {
+	    return [queryConfig [lindex $args 0]]
+	}
+
+	if {[expr [llength $args] % 2] != 0} {
+	    error "incorrect number of argument, must be multiple of 2"
+	}
+
+	setConfig $args
+    }
+
+    # Helper procedure to return a list with all important user settable
+    # configuration information.
+
+    proc collectConfig {} {
+	variable state
+
+	set config {}
+
+	foreach name [array names state "-*"] {
+	    lappend config [list $name $state($name)]
+	}
+	return $config
+    }
+
+    # Helper procedure to return the value of one option.
+
+    proc queryConfig {option} {
+	variable state
+
+	if {![info exists state($option)]} {
+	    return {}
+	}
+	return $state($option)
+    }
+
+    # Helper procedure to modify the configuration of a set of options.
+
+    proc setConfig {theargs} {
+	variable state
+
+	foreach {opt val} $theargs {
+	    if {![string match "-*" $opt]} {
+		continue
+	    }
+	    set state($opt) $val
+	}
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkconnect.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkconnect.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkconnect.tcl	(revision 5646)
@@ -0,0 +1,239 @@
+# irkconnect.tcl:
+#
+# This file provides the IRK commands to connect to remote servers
+# as well as some attendant utility procedures:
+
+namespace eval ::irk {
+
+    # The "connect" procedure returns a token
+    # for the connection to this server.
+    #
+    # symsrv		The symbolic name of the server to connect to.
+    # nick		The nick name to use.
+    # user		The user name to use.
+    # pass		The password to use. 
+    # disp		The command dispatcher expression to use.
+
+    proc connect {{symsrv ""} {nick ""} {user ""} {pass ""} {disp ""}} {
+	variable state
+
+	# Auto initialize the list of connections. We do this so that
+	# the list is not reset each time the irk.tcl file is sourced.
+
+	if {![info exists state(connections)]} {
+	    set state(connections) {}
+	}
+
+	# Try to convert the symbolic server name to a
+	# server description. This may throw an error,
+	# we propagate it.
+
+	set servdesc [locate $symsrv]
+
+	# If the nickname is not specified, there must be
+	# a nick setting in the state array; use that
+
+	if {![string compare $nick ""]} {
+	    if {![info exists state(-$symsrv,nick)]} {
+		error "No nick given or set in global state"
+	    }
+	    set nick $state(-$symsrv,nick)
+	}
+
+	# If a global nick is not set, save this nick for use
+	# as a global nick.
+
+	if {![info exists state(-$symsrv,nick)]} {
+	    set state(-$symsrv,nick) $nick
+	}
+
+	# If user is not supplied, see if there is a global
+	# user registered in the IRK package state. If not,
+	# invent a user.
+
+	if {![string compare $user ""]} {
+	    if {[info exists state(-$symsrv,user)]} {
+		set user $state(-$symsrv,user)
+	    } else {
+		set user $nick
+		set state(-$symsrv,user) $user
+	    }
+	}
+
+	# If a password is not supplied, see if there is a global
+	# one registered. If so, use that. Otherwise, do not
+	# use a password.
+
+	if {![string compare $pass ""]} {
+	    if {[info exists state(-$symsrv,pass)]} {
+		set pass $state(-$symsrv,pass)
+	    }
+	}
+
+	# If a dispatcher expression is not supplied, there must be a
+	# global dispatcher expression in the state array, and use that.
+
+	if {![string compare $disp ""]} {
+	    if {![info exists state(dispatcher)]} {
+		error "ERROR: o dispatch given or found in global state"
+	    }
+	    set disp $state(dispatcher)
+	}
+
+	# Try to connect to the given server.
+
+	set h [lindex $servdesc 0]
+	set p [randselect [lindex $servdesc 1]]
+
+	set s [opensocket $h $p]
+
+	# The socket is line buffered and consumed by the
+	# supplied consumer
+
+	fconfigure $s -translation auto -buffering line
+	fileevent $s readable [list ::irk::consumer $s]
+
+
+	# Identify ourselves to the IRK server: If a password is given
+	# send that first. Then send the nick name and user name.
+
+	if {[string compare $pass ""]} {
+	    puts $s "PASS $pass"
+	}
+
+	puts $s "NICK $nick"
+	puts $s "USER $user $h $h :$user"
+
+	# Make a connection token:
+
+	set contok [contok $s $symsrv]
+
+	# Save the state for this new connection
+
+	lappend state(connections) $contok
+
+	set state($contok,port) $p
+	set state($contok,host) $h
+	set state($contok,symsrv) $symsrv
+	set state($contok,nick) $nick
+	set state($contok,user) $user
+	set state($contok,pass) $pass
+	set state($contok,disp) $disp
+
+	# Set up some default behavior for the connection:
+
+	setupDefaultActions $contok $nick
+
+	# Collect information about who the server thinks we are
+
+	puts $s "WHOIS $nick"
+
+	# Finally return the token for this connection:
+
+	return $contok
+    }
+
+    # This procedure makes an easy to remember connection token. It takes
+    # the symbolic server's name and appends _<n> to it, where n is an
+    # integer starting at 0 and monotonically increasing for every new
+    # connection to that server.
+    #
+    # Once it figures out what the connection token is going to be,
+    # it associates it with the given socket so it can be used.
+
+    proc contok {sock symsrv} {
+	variable state
+
+	# Compute the symbolic name for this connection:
+
+	if {![info exists state($symsrv,counter)]} {
+	    set state($symsrv,counter) 0
+	}
+	set contok ${symsrv}_$state($symsrv,counter)
+	incr state($symsrv,counter)
+
+	# Associate the symbolic name with the socket:
+
+	set state($contok,socket) $sock
+	set state($sock,contok) $contok
+
+	return $contok
+    }
+
+    # The locate procedure tries to convert the symbolic name for
+    # a connection to a server/port specification.
+
+    proc locate {s} {
+	variable symsrv
+	variable state
+
+	# If the caller specified "" as the name of the server, select
+	# a random one from the list of known servers.
+
+	if {![string compare $s ""]} {
+	    set s [randselect $state(servers)]
+	}
+
+	# Now see if the requested server exists:
+
+	if {![info exists symsrv($s)]} {
+	    error \
+		"Could not find a match for symbolic IRK server name \"$s\""
+	}
+
+	# It does, return the server specification:
+
+	return $symsrv($s)
+    }
+
+    # opensocket connects to the requested server and port, either
+    # directly or through a SOCKS5 proxy.
+
+    proc opensocket {server port} {
+	variable state
+
+	if {[info exists state(-socksproxy)] \
+		&& [info exists state(-socksport)]} {
+	    set sock [socket $state(-socksproxy) $state(-socksport)]
+	    return [::socks::init $sock $server $port]
+	}
+
+	return [socket $server $port]
+    }
+
+    # The disconnect procedure disconnects from a given connection
+    # identified by its symbolic name, and cleans up state associated
+    # with the connection.
+
+    proc disconnect {contok} {
+	variable state
+
+	if {[catch {set s $state($contok,socket)} err]} {
+	    error "ERROR: $contok: No such IRC connection"
+	}
+
+	# Send a QUIT message.
+
+	if {[info exists state(quitmsg)]} {
+	    set q ":$state($contok,nick) $state(quitmsg)"
+	} else {
+	    set q ":$state($contok,nick) quit"
+	}
+	puts $s "QUIT $q"
+
+	# Try to close the connection with the server.
+
+	catch {close $s}
+
+	# And clean up all state associated with this connection:
+
+	array unset state $contok,*
+	
+	# Remove this connection from the list of active connections:
+
+	set i [lsearch $state(connections) $s]
+	set state(connections) [lreplace $state(connections) $i $i]
+
+	return ""
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkctcptcl.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkctcptcl.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkctcptcl.tcl	(revision 5646)
@@ -0,0 +1,45 @@
+# irkctcptcl.tcl:
+#
+# This file implements the IRK CTCP TCL protocol:
+
+namespace eval ::irk {
+
+    # This procedure sets up a safe interpreter for the channel in which
+    # the CTCP TCL action occurs:
+
+    proc setupInterp {token chan} {
+	variable state
+
+	if {![info exists state($token,$chan,interp)]} {
+	    catch {interp delete ${token}${chan}}
+	    set state($token,$chan,interp) [safe::interpCreate ${token}${chan}]
+	    safe::loadTk $state($token,$chan,interp)
+	}
+	if {![interp exists ${token}${chan}]} {
+	    set state($token,$chan,interp) [safe::interpCreate ${token}${chan}]
+	    safe::loadTk $state($token,$chan,interp)
+	}
+    }
+
+    # This procedure dispatches the Tcl command embedded within the
+    # CTCP TCL action to the associated interpreter:
+
+    proc RECV,CTCP,TCL {token nick user comm dest action rest} {
+	variable state
+
+	puts stderr "Tcl command is: $rest [llength $rest]"
+	setupInterp $token $dest
+	interp eval $state($token,$dest,interp) [::join $rest]
+    }
+
+    # This procedure dispatches the Tcl command embedded within the
+    # CTCP TCL action for local execution on the issuer's side:
+
+    proc RECV,CTCP,TCL,LOCAL {token nick user comm dest action rest} {
+	variable state
+
+	puts stderr "Tcl command is: $rest [llength $rest]"
+	setupInterp $token $dest
+	interp eval $state($token,$dest,interp) $rest
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkdispatch.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkdispatch.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkdispatch.tcl	(revision 5646)
@@ -0,0 +1,248 @@
+# irkdispatch.tcl:
+#
+# Based on the input received from the server, dispatch control to various
+# command procedures.
+
+namespace eval ::irk {
+
+    # This procedure sets up the default actions for a connection:
+
+    proc setupDefaultActions {s nick} {
+	variable state
+
+	# Catch any unexpected PRIVMSG actions:
+
+	set state($s,PRIVMSG,$nick)	$state(PRIVMSG,unsolicited)
+
+	# Set up CTCP global actions:
+
+	set state($s,cmd,ctcp,PING)	::irk::RECV,CTCP,PING
+	set state($s,cmd,ctcp,TIME)	::irk::RECV,CTCP,TIME
+	set state($s,cmd,ctcp,VERSION)	::irk::RECV,CTCP,VERSION
+	set state($s,cmd,ctcp,USERINFO) \
+					::irk::RECV,CTCP,USERINFO
+
+	# Set up CTCP channel specific actions:
+
+	set state($s,channel,ctcp,ACTION) \
+					::irk::RECV,CTCP,ACTION
+
+	# Set up the CTCP TCL protocol:
+
+	set state($s,channel,ctcp,TCL)	::irk::RECV,CTCP,TCL
+	set state($s,channel,ctcp,TCL,LOCAL) \
+					::irk::RECV,CTCP,TCL,LOCAL
+
+	# Deal with CTCP commands we do not understand:
+
+	set state($s,cmd,ctcp,error) 	::irk::RECV,CTCP,ERROR
+	set state($s,channel,ctcp,error) \
+					::irk::RECV,CTCP,ERROR
+    }
+
+    # The consumer procedure consumes input received from
+    # a connection. It calls the dispatcher for the given connection
+    # with each input line.
+
+    proc consumer {s} {
+	variable state
+
+	if {[eof $s]} {
+	    disconnect $s
+	} else {
+	    set l [gets $s]
+	    if {[info exists state($s,trace)]} {
+		$state($s,trace) $l
+	    }
+	    if {[string compare $l ""]} {
+		dissect $state($s,contok) $l
+	    }
+	}
+    }
+
+    # This procedure dissects the input into its parts:
+
+    proc dissect {token line} {
+	variable state
+
+	# Make a list out of the line:
+
+	set line [split $line " "]
+
+	# Split first token into nickname and user mask:
+
+	set nandu [split [lindex $line 0] \!]
+
+	# Call dispatcher for this connection:
+
+	$state($token,disp) \
+		$token \
+		[lindex $nandu 0] \
+		[lindex $nandu 1] \
+		[lindex $line 1] \
+		[lindex $line 2] \
+		[lrange $line 3 end]
+    }
+
+    # This procedure is the default command dispatcher:
+    
+    proc defaultDispatcher {token nick user comm dest rest} {
+	variable state
+
+	# Check if the nick starts with ':'. If not then this is
+	# a special action, handled by the built in actions.
+
+	if {![string match ":*" $nick]} {
+	    return [specialAction $token $nick $user $comm $dest $rest]
+	}
+
+	# Trim off the leading ':' on the $nick, if present.
+
+	if {[string match ":*" $nick]} {
+	    set nick [string range $nick 1 end]
+	}
+
+	# If a ':' is present in the $dest, trim that off too.
+
+	if {[string match ":*" $dest]} {
+	    set dest [string range $dest 1 end]
+	}
+
+	# If a ':' is present in the $rest, trim that off too.
+
+	set firstrest [lindex $rest 0]
+	if {[string match ":*" $firstrest]} {
+	    set firstrest [string range $firstrest 1 end]
+	    set rest [lreplace $rest 0 0 $firstrest]
+	}
+
+	# Clean up the payload:
+
+	set rest [split [string trim [eval concat $rest]] " "]
+
+	# Now try to dispatch to specific handlers.
+	#
+	# First see if there is a handler for the specific combination
+	# of $token, $nick, $comm and $dest. This is used for PRIVMSG.
+
+	if {[info exists state($token,$nick,$comm,$dest)]} {
+	    foreach cmd $state($token,$nick,$comm,$dest) {
+		if {[catch {set res [$cmd $token $nick $user \
+					  $comm $dest $rest]} err]} {
+		    if {[info exists state(errorhandler)]} {
+			$state(errorhandler) $err $token $comm $dest
+		    }
+		    return
+		}
+
+		# If this handler said to go on to a more general handler,
+		# then don't return. Otherwise return.
+
+		if {[string compare $res pass]} {
+		    return
+		}
+	    }
+	}
+
+	# If there's a handler for $token, $comm and $dest, use that.
+
+	if {[info exists state($token,$comm,$dest)]} {
+	    foreach cmd $state($token,$comm,$dest) {
+		if {[catch {set res [$cmd $token $nick $user \
+					  $comm $dest $rest]} err]} {
+		    if {[info exists state(errorhandler)]} {
+			$state(errorhandler) $err $token $comm $dest
+		    }
+		    return
+		}
+
+		# If this handler said to go on to a more general handler,
+		# then don't return. Otherwise return.
+
+		if {[string compare $res pass]} {
+		    return
+		}
+	    }
+	}
+
+	# See if there's a handler for $token and $comm. If so use that.
+
+	if {[info exists state($token,$comm)]} {
+	    foreach cmd $state($token,$comm) {
+		if {[catch {set res [$cmd $token $nick $user \
+					  $comm $dest $rest]} err]} {
+		    if {[info exists state(errorhandler)]} {
+			$state(errorhandler) $err $token $comm $dest
+		    }
+		    return
+		}
+
+		# If this handler said to go on to a more general handler,
+		# then don't return. Otherwise return.
+
+		if {[string compare $res pass]} {
+		    return
+		}
+	    }
+	}
+
+	# See if there's a global handler for the command. All the
+	# default handlers are defined here.
+
+	if {[info exists state(cmd,$comm)]} {
+	    foreach cmd $state(cmd,$comm) {
+		if {[catch {set res [$cmd $token $nick $user \
+					  $comm $dest $rest]} err]} {
+		    if {[info exists state(errorhandler)]} {
+			$state(errorhandler) $err $token $comm $dest
+		    }
+		    return
+		}
+
+		# If this handler said to go on to a more general handler,
+		# then don't return. Otherwise return.
+
+		if {[string compare $res pass]} {
+		    return
+		}
+	    }
+	}
+
+	# If all of the above fail, send this input to the default
+	# action handler:
+
+	if {[catch {set res [$state(action) \
+				$token $nick $user \
+				$comm $dest $rest]} err]} {
+	    if {[info exists state(errorhandler)]} {
+		$state(errorhandler) $err $token $comm $dest
+	    }
+	    return
+	}
+    }
+
+    # This procedure deals with special actions (built in, cannot
+    # easily be modified by users). I use this to e.g deal with
+    # PING, NOTICE, ERROR etc., automatically.
+
+    proc specialAction {token nick user comm dest rest} {
+	variable state
+
+	# The nick is the special action selector:
+
+	$state(special,$nick) $token $nick $user $comm $dest $rest
+    }
+
+    # This is the default error handler:
+
+    proc echoerror {args} {
+	puts stderr $args
+    }
+
+    # This procedure provides a default tracing facility (it just prints
+    # the lines received to stderr):
+
+    proc trace {args} {
+	puts stderr "Received: $args"
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkflow.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkflow.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkflow.tcl	(revision 5646)
@@ -0,0 +1,102 @@
+# irkflow.tcl
+#
+# Simple flow control management so as to avoid flooding.
+
+namespace eval ::irk {
+
+    # For each combination of destination+connection, we keep three items:
+    # 
+    # flowctl($dest,$conn,after)	The "after" token for the next time
+    #					we send anything to this destination.
+    # flowctl($dest,$conn,queue)	A list of items to send to this
+    #					destination on this connection.
+    # flowctl($dest,$conn,lastsend)	The time we last sent to this
+    #					destination on this connection.
+    #
+    # NOTE: We do not limit the length of each item to send. This
+    # would lead to extremely hard to diagnose bugs due to commands
+    # (e.g. ctcp's) getting cut up into chunks.
+
+    variable flowctl
+
+    # The following setting controls how often (in msecs) we can send
+    # to a given connection. It should not be modified by user code or
+    # flooding may occur.
+
+    set flowctl(floodlimit) 1500
+
+    # This procedure sends an item to a specific destination+connection.
+    # If possible, the item is sent right away. Otherwise it is enqueued
+    # for later sending.
+
+    proc sendit {conn item} {
+	variable flowctl
+
+	# If this connection has a backlog, append the new
+	# items. Otherwise, check if the previous send was
+	# less than flowctl(floodlimit) msecs ago. If so, enqueue
+	# it for later sending. Otherwise send it now and record
+	# the time we sent this item.
+
+	if {[info exists flowctl($conn,after)]} {
+	    lappend flowctl($conn,queue) $item
+	} else {
+	    if {[catch {set lastsend $flowctl($conn,lastsend)}]} {
+		set lastsend 0
+	    }
+	    set now [clock clicks -milliseconds]
+	    set lim $flowctl(floodlimit)
+	    if {[expr $now - $lastsend] < $lim} {
+		lappend flowctl($conn,queue) $item
+		set wait [expr ($lim - ($now - $lastsend))]
+		set flowctl($conn,after) \
+			[after $wait [list ::irk::sendlater $conn]]
+	    } else {
+		set flowctl($conn,lastsend) $now
+		puts $conn $item
+	    }
+	}
+
+	return ""
+    }
+
+    # This procedure does the sending when flow control for a connection
+    # is activated.
+
+    proc sendlater {conn} {
+	variable flowctl
+
+	# First of all clear the after entry.
+
+	unset flowctl($conn,after)
+
+	# Grab the first item on the queue:
+
+	if {[info exists flowctl($conn,queue)]} {
+	    set items $flowctl($conn,queue)
+	    if {[string compare $items ""]} {
+		set item [lindex $items 0]
+		set rest [lrange $items 1 end]
+		if {[string compare $rest ""]} {
+		    set flowctl($conn,queue) $rest
+		    set flowctl($conn,after) \
+			    [after $flowctl(floodlimit) \
+				[list ::irk::sendlater $conn]]
+		} else {
+		    unset flowctl($conn,queue)
+		}
+
+		# Record time we last sent to this destination.
+
+		set flowctl($conn,lastsend) [clock clicks -milliseconds]
+
+		# Send this item:
+
+		puts $conn $item
+	    } else {
+		unset flowctl($conn,queue)
+	    }
+	}
+    }
+}
+
Index: code/branches/resource2/data/tcl/irk/lib/irkqueue.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkqueue.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkqueue.tcl	(revision 5646)
@@ -0,0 +1,103 @@
+# irkenqueue.tcl
+#
+# Simple flow control management so as to avoid flooding.
+
+namespace eval ::irk {
+
+    # For each combination of destination+connection, we keep three items:
+    # 
+    # flowctl($dest,$conn,after)	The "after" token for the next time
+    #					we send anything to this destination.
+    # flowctl($dest,$conn,queue)	A list of items to send to this
+    #					destination on this connection.
+    # flowctl($dest,$conn,lastsend)	The time we last sent to this
+    #					destination on this connection.
+    #
+    # NOTE: We do not limit the length of each item to send. This
+    # would lead to extremely hard to diagnose bugs due to commands
+    # (e.g. ctcp's) getting cut up into chunks.
+
+    variable flowctl
+
+    # The following setting determines the number of seconds that must
+    # pass between sends to any one destination+connection. If fewer
+    # seconds have passed since the last send, then flow control is
+    # activated for this destination+connection.
+
+    set flowctl(sendlimit) 2
+
+    # This procedure sends an item to a specific destination+connection.
+    # If possible, the item is sent right away. Otherwise it is enqueued
+    # for later sending.
+
+    proc enqueue {dest conn item} {
+	variable flowctl
+
+	# If this destination has a backlog, append the new
+	# items. Otherwise, check if the previous send was
+	# less than 2 seconds ago. If so, enqueue it for
+	# later sending. Otherwise send it now and record
+	# the time we sent this item.
+
+	if {[info exists flowctl($dest,$conn,after)]} {
+	    lappend flowctl($dest,$conn,queue) $item
+	} else {
+	    if {[catch {set lastsend $flowctl($dest,$conn,lastsend)}]} {
+		set lastsend 0
+	    }
+	    set now [clock seconds]
+	    set lim $flowctl(sendlimit)
+	    if {[expr $now - $lastsend] < $lim} {
+		lappend flowctl($dest,$conn,queue) $item
+		set wait [expr ($lim - ($now - $lastsend)) * 1000]
+		set flowctl($dest,$conn,after) \
+			[after $wait [list ::irk::sender $dest $conn]]
+	    } else {
+		set flowctl($dest,$conn,lastsend) $now
+		puts $conn $item
+	    }
+	}
+
+	return ""
+    }
+
+    # This procedure does the sending when flow control for a connection
+    # is activated.
+
+    proc sender {dest conn} {
+	variable flowctl
+
+	# First of all clear the after entry.
+
+	unset flowctl($dest,$conn,after)
+
+	# Grab the first item on the queue:
+
+	if {[info exists flowctl($dest,$conn,queue)]} {
+	    set items $flowctl($dest,$conn,queue)
+	    if {[string compare $items ""]} {
+		set item [lindex $items 0]
+		set rest [lrange $items 1 end]
+		if {[string compare $rest ""]} {
+		    set lim [expr $flowctl(sendlimit) * 1000]
+		    set flowctl($dest,$conn,queue) $rest
+		    set flowctl($dest,$conn,after) \
+			    [after $lim [list ::irk::sender $dest $conn]]
+		} else {
+		    unset flowctl($dest,$conn,queue)
+		}
+
+		# Record time we last sent to this destination.
+
+		set flowctl($dest,$conn,lastsend) [clock seconds]
+
+		# Send this item:
+
+		puts $conn $item
+	    } else {
+		unset flowctl($dest,$conn,queue)
+	    }
+	}
+    }
+}
+
Index: code/branches/resource2/data/tcl/irk/lib/irkreceive.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkreceive.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkreceive.tcl	(revision 5646)
@@ -0,0 +1,618 @@
+# irkreceive.tcl:
+#
+# Various commands invoked in response to input received from the server:
+
+namespace eval irk {
+
+    # This procedure deals with the PING special action:
+
+    proc RECV,PING {token nick user comm dest rest} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRK connection"
+	}
+	puts $sock "PONG :$comm $rest"
+
+	return ""
+    }
+
+    # This procedure deals with the NOTICE special action:
+
+    proc RECV,NOTICE {token nick user comm dest rest} {
+	variable state
+
+	append state($token,GLOBALNOTICES) "$rest\n"
+
+	return ""
+    }
+
+
+    # This procedure deals with the ERROR special action:
+
+    proc RECV,ERROR {token nick user comm dest rest} {
+	variable state
+
+	set rest [eval concat $rest]
+	append state($token,ERRORS) "$nick $dest $rest\n"
+#	puts "Got ERROR: $token $nick ---> $dest: $rest"
+	orxonox::execute error "Got ERROR: $token $nick ---> $dest: $rest"
+
+	return ""
+    }
+
+    # This procedure deals with the AWAY response:
+
+    proc RECV,AWAY {token nick user comm dest rest} {
+	set id [lindex $rest 0]
+	set rest [lrange $rest 1 end]
+	set rest [lreplace $rest 0 0 [string range [lindex $rest 0] 1 end]]
+	set rest [eval concat $rest]
+	puts "$id is away: $rest"
+
+	return ""
+    }
+    
+    # This procedure deals with the WHOIS USER message:
+
+    proc RECV,WHOIS,NICK,USER {token nick user comm dest rest} {
+	variable state
+
+	# Split the rest of the line on space:
+
+	foreach {unick uuser uhost ustar urnm} [split $rest " "] break
+
+	# If the WHOIS information is about this user, save it specially:
+
+	if {[isus $token $unick]} {
+	    set state($token,uuser)	$uuser
+	    set state($token,uhost)	$uhost
+	    set state($token,urnm)	$urnm
+	}
+
+	# Save the information for a regular user:
+
+	set state($token,ident,$unick,uuser)	$uuser
+	set state($token,ident,$unick,uhost)	$uhost
+	set state($token,ident,$unick,urnm)	$urnm
+    }
+
+    # This procedure deals with the WHOIS SERVER message:
+
+    proc RECV,WHOIS,NICK,SERVER {token nick user comm dest rest} {
+	variable state
+
+	# Split the rest of the line on space:
+
+	foreach {unick userv} [split $rest " "] break
+
+	# If the WHOIS information is about this user, save it specially:
+
+	if {[isus $token $unick]} {
+	    set state($token,userv) $userv
+	}
+
+	# Save the information for a regular user:
+
+	set state($token,ident,$unick,userv) $userv
+    }
+
+    # This procedure deals with the WHOIS IDENT message
+
+    proc RECV,WHOIS,NICK,IDENT {token nick user comm dest rest} {
+	variable state
+
+	# Extract the nick of the user who has identified
+
+	set unick [lindex [split $rest " "] 0]
+
+	# If the WHOIS information is about this user, save it specially:
+
+	if {[isus $token $unick]} {
+	    set state($token,ident) 1
+	}
+
+	# Save the information for a regular user:
+
+	set state($token,ident,$unick,ident) 1
+    }	
+
+    # This procedure deals with the WHOIS CONNECTTIME message:
+
+    proc RECV,WHOIS,NICK,CONNECTTIME {token nick user comm dest rest} {
+	variable state
+
+	# Split the rest of the input on space:
+
+	foreach {unick idle connecttime} [split $rest " "] break
+
+	# Format the connect time for this user:
+
+	set connecttime [clock format $connecttime]
+
+	# If the WHOIS information is about this user, save it specially:
+
+	if {[isus $token $unick]} {
+	    set state($token,connecttime) $connecttime
+	}
+
+	# Save the information for a regular user:
+
+	set state($token,ident,$unick,connecttime) $connecttime
+    }
+
+    # Handle the WHOIS CHANNELS message:
+
+    proc RECV,WHOIS,NICK,CHANNELS {token nick user comm dest rest} {
+	variable state
+
+	# Split the rest on space.
+
+	set rest [split $rest " "]
+
+	# Get the nick for which this is the channel list:
+
+	set unick [lindex $rest 0]
+	set rest [lrange $rest 1 end]
+
+	# The first channel may have an extra ":", if it does get rid of it.
+
+	set firstchan [lindex $rest 0]
+	if {[string match ":*" $firstchan]} {
+	    set rest [lreplace $rest 0 0 [string range $firstchan 1 end]]
+	}
+
+	# If the WHOIS information is about this user, save it specially:
+
+	if {[isus $token $unick]} {
+	    set state($token,channels) $channels
+	}
+
+	# Save the information for a regular user:
+
+	set state($token,ident,$unick,channels) $rest
+    }
+
+    # This procedure deals with the WHOIS END message:
+
+    proc RECV,WHOIS,NICK,END {token nick user comm dest rest} {
+	variable state
+
+	set state($token,whois,done) 1
+    }
+
+    # This procedure deals with various MOTD actions:
+
+    proc RECV,MOTD {token nick user comm dest rest} {
+	variable state
+
+	append state($token,MOTD) "${rest}\n"
+
+	return ""
+    }
+
+    # This procedure deals with PONG actions:
+
+    proc RECV,PONG {token nick user comm dest rest} {
+	variable state
+
+	if {[info exists state($token,PINGSTART)]} {
+	    set elapsed \
+		[expr [clock clicks -millis] - $state($token,PINGSTART)]
+	    puts "$nick: $elapsed msecs"
+	    unset state($token,PINGSTART)
+	}
+
+	return ""
+    }
+
+    # This procedure deals with NOTICE received from a regular user:
+
+    proc RECV,NOTICE,USER {token nick user comm dest rest} {
+	if {[string match "\001*" [lindex $rest 0]]} {
+	    set rest [ctcpcleanup $rest]
+	    RECV,NOTICE,CTCP,USER $token $nick $user $comm $dest \
+		    [lindex $rest 0] [lrange $rest 1 end]
+	} else {
+	    set rest [eval concat $rest]
+	    puts "$nick sends $dest a notice: $rest"
+	}
+
+	return ""
+    }
+
+    # This procedure helps with CTCP notice actions:
+
+    proc RECV,NOTICE,CTCP,USER {token nick user comm dest action rest} {
+	variable state
+
+	if {[info exists state($token,response,ctcp,$action)]} {
+	    $state($token,response,ctcp,$action) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	} else {
+	    $state($token,response,ctcp,error) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	}
+
+	return ""
+    }
+
+    # This procedure deals with JOIN actions:
+
+    proc RECV,JOIN {token nick user comm dest rest} {
+	variable state
+
+	# Check if it's us that joined the channel or someone else.
+
+	if {[isus $token $nick]} {
+#	    puts "You joined $dest"
+          orxonox::irc::info $token "You joined $dest"
+
+	    addChannel $token $dest
+	} else {
+#	    puts "$nick joined $dest"
+          orxonox::irc::info $token "$nick joined $dest"
+
+	    addToChannel $token $nick $dest
+	}
+
+	return ""
+    }
+
+    # This procedure deals with PART actions:
+
+    proc RECV,PART {token nick user comm dest rest} {
+	variable state
+
+	set chan [string tolower $dest]
+
+	if {[isus $token $nick]} {
+#	    puts "You left channel $chan"
+          orxonox::irc::info $token "You left channel $chan"
+	} else {
+#	    puts "$nick left [string tolower $dest]"
+          orxonox::irc::info $token "$nick left [string tolower $dest]"
+	}	    
+	removeFromChannel $token $nick $chan
+	removeFromChannel $token @$nick $chan
+
+	return ""
+    }
+
+    # This procedure deals with MODE actions:
+
+    proc RECV,MODE {token nick user comm dest rest} {
+	set rest [eval concat $rest]
+#	puts "$nick sets mode $dest $rest"
+      orxonox::irc::info "$nick $token sets mode $dest $rest"
+
+	return ""
+    }
+
+    # This procedure deals with NICK actions:
+
+    proc RECV,NICK {token nick user comm dest rest} {
+	variable state
+
+	set newnick [string range $dest 0 end]
+
+	# If our nick changed, remember it as the nick associated with
+	# this connection:
+
+	if {[isus $token $nick]} {
+	    set state($token,nick) $newnick
+	    set state($token,$newnick,PRIVMSG)	$state(PRIVMSG,unsolicited)
+	    catch {unset state($token,$nick,PRIVMSG)}
+	}
+
+	# Replace the old nick with the new in all channels that we're on:
+
+	replaceAllChannels $token $nick $newnick
+
+#	puts "$nick ${user} ($token) changes his/her nickname to $newnick"
+      orxonox::irc::info $token "$nick changes his/her nickname to $newnick"
+
+	return ""
+    }
+
+    # This procedure deals with QUIT actions:
+
+    proc RECV,QUIT {token nick user comm dest rest} {
+	variable state
+
+	set rest [eval concat $rest]
+#	puts "Received QUIT $token $nick $rest"
+      orxonox::irc::info $token "Received QUIT $token $nick $rest"
+
+	if {[string match ":*" $dest]} {
+	    set dest [string range $dest 1 end]
+	}
+	if {[isus $token $nick]} {
+#	    puts "You left the server $state($token,host) ($dest $rest)"
+          orxonox::irc::info $token "You left the server $state($token,host) ($dest $rest)"
+	    forgetConnection $token
+	} else {
+	    puts "$nick quits IRK ($dest $rest)"
+	    removeFromAllChannels $token $nick
+	    removeFromAllChannels $token @$nick
+	}
+
+	return ""
+    }
+
+    # This procedure deals with expected PRIVMSG actions:
+
+    proc RECV,PRIVMSG {token nick user comm dest rest} {
+	if {[string match "\001*" [lindex $rest 0]]} {
+	    set rest [ctcpcleanup $rest]
+	    RECV,PRIVMSG,CTCP,CHANNEL $token $nick $user $comm $dest \
+		    [lindex $rest 0] [lrange $rest 1 end]
+	} else {
+#	    puts "$nick$dest: [eval concat $rest]"
+          orxonox::irc::say $token $nick [eval concat $rest]
+	}
+
+	return ""
+    }
+
+    # This procedure handles CTCP actions on the channel:
+
+    proc RECV,PRIVMSG,CTCP,CHANNEL {token nick user comm dest action rest} {
+	variable state
+
+	if {[info exists state($token,channel,ctcp,$action)]} {
+	    $state($token,channel,ctcp,$action) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	} else {
+	    $state($token,channel,ctcp,error) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	}
+
+	return ""
+    }
+
+    # This procedure stores the result of USERHOST actions:
+
+    proc RECV,USERHOST {token nick user comm dest rest} {
+	return ""
+    }
+
+    # This procedure stores the channel topic:
+
+    proc RECV,CHANNEL,TOPIC {token nick user comm dest rest} {
+	variable state
+
+	set chan [lindex $rest 0]
+	set rest [lrange $rest 1 end]
+	if {[string match ":*" [lindex $rest 0]]} {
+	    set rest [lreplace $rest 0 0 \
+			       [string range [lindex $rest 0] 1 end]]
+	}
+	set state($token,$chan,TOPIC) $rest
+	set state($token,$chan,TOPIC,SETBY) $nick
+	set state($token,$chan,TOPIC,SETAT) [clock format [clock seconds]]
+
+	return ""
+    }
+
+    # This procedure stores the channel byline:
+
+    proc RECV,CHANNEL,SETBY {token nick user comm dest rest} {
+	variable state
+
+	set chan [lindex $rest 0]
+	set rest [lrange $rest 1 end]
+	if {[string match ":*" [lindex $rest 0]]} {
+	    set rest [lreplace $rest 0 0 \
+			       [string range [lindex $rest 0] 1 end]]
+	}
+	set state($token,$chan,TOPIC,SETBY) [lindex $rest 0]
+	set state($token,$chan,TOPIC,SETAT) [clock format [lindex $rest 1]]
+
+	return ""
+    }
+
+    # This procedure deals with unsolicited PRIVMSG actions:
+
+    proc RECV,PRIVMSG,unsolicited {token nick user comm dest rest} {
+	if {[string match "\001*" [lindex $rest 0]]} {
+	    set rest [ctcpcleanup $rest]
+	    RECV,PRIVMSG,CTCP,USER $token $nick $user $comm $dest \
+		    [lindex $rest 0] [lrange $rest 1 end]
+	} else {
+#	    puts "$nick: [eval concat $rest]"
+          orxonox::irc::privmsg $nick $nick [eval concat $rest]
+	}
+
+	return ""
+    }
+
+    # This procedure helps with CTCP private messages:
+
+    proc RECV,PRIVMSG,CTCP,USER {token nick user comm dest action rest} {
+	variable state
+
+	if {[info exists state($token,cmd,ctcp,$action)]} {
+	    $state($token,cmd,ctcp,$action) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	} else {
+	    $state($token,cmd,ctcp,error) \
+					$token $nick $user $comm $dest \
+					$action $rest
+	}
+
+	return ""
+    }
+
+    # This procedure deals with a KICK action:
+
+    proc RECV,KICK {token nick user comm dest rest} {
+	set kicked [lindex $rest 0]
+	if {[string match ":*" $kicked]} {
+	    set kicked [string range $kicked 1 end]
+	}
+	set reason [eval concat [lrange $rest 1 end]]
+	if {[string match ":*" $reason]} {
+	    set reason [string range $reason 1 end]
+	}
+
+	if {[isus $token $kicked]} {
+#	    puts "$nick kicked you from $dest because $reason"
+          orxonox::irc::info $token "$nick kicked you from $dest because $reason"
+
+	    removeChannel $token $dest
+	} else {
+#	    puts "$nick kicks $kicked from $dest because $reason"
+          orxonox::irc::info $token "$nick kicks $kicked from $dest because $reason"
+
+	    removeFromChannel $token $kicked $dest
+	    removeFromChannel $token @$kicked $dest
+	}
+
+	return ""
+    }
+
+    # These procedures collect the name list for a channel:
+
+    proc RECV,CHANNEL,NAMELIST {token nick user comm dest rest} {
+	variable state
+
+	# Scan forward in $rest for the channel name:
+
+	for {set i 0; set l [llength $rest]} {$i < $l} {incr i} {
+	    if {[string match "#*" [lindex $rest $i]]} {
+		break
+	    }
+	}
+
+	# Didn't find it?
+
+	if {$i == $l} {
+	    return
+	}
+
+	# Extract the channel name and the rest of the input:
+
+	set chan [lindex $rest $i]
+	set rest [lrange $rest [expr $i + 1] end]
+	set rest [lreplace $rest 0 0 [string range [lindex $rest 0] 1 end]]
+	set rest [eval concat $rest]
+
+	if {![info exists state($token,$chan,NAMES)]} {
+	    set state($token,$chan,NAMES) ""
+	}
+	set state($token,$chan,NAMES) [concat $state($token,$chan,NAMES) $rest]
+
+	return ""
+    }
+
+    proc RECV,CHANNEL,NAMELIST,END {token nick user comm dest rest} {
+	variable state
+
+	set chan [lindex $rest 0]
+	set $state($token,$chan,NAMES) [split $state($token,$chan,NAMES) " "]
+    }
+
+    # This procedure deals with a request from the server to send a PONG
+    # with a given code.
+
+    proc RECV,PONG,REQUEST {token nick user comm dest rest} {
+	set pongcode [lindex $rest [expr [llength $rest] - 1]]
+	puts $token "PONG $pongcode"
+
+	return ""
+    }
+
+    # This procedure deals with a CTCP PING request:
+
+    proc RECV,CTCP,PING {token nick user comm dest action rest} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRK connection"
+	}
+	puts $sock "NOTICE $nick :\001PING ${rest}\001"
+
+	return ""
+    }
+
+    # This procedure deals with a CTCP TIME request:
+
+    proc RECV,CTCP,TIME {token nick user comm dest action rest} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRK connection"
+	}
+	puts $sock \
+	    "NOTICE $nick :\001TIME :[clock format [clock seconds]]\001"
+
+	return ""
+    }
+
+    # This procedure deals with a CTCP VERSION request:
+
+    proc RECV,CTCP,VERSION {token nick user comm dest action rest} {
+	variable state
+	global tcl_platform
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRK connection"
+	}
+	set version "$state(-useragent):$state(-version):$tcl_platform(os)"
+	puts $sock "NOTICE $nick :\001VERSION ${version}\001"
+    }
+
+    # This procedure deals with a CTCP USERINFO request:
+
+    proc RECV,CTCP,USERINFO {token nick user comm dest action rest} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRK connection"
+	}
+	puts $sock "NOTICE $nick :\001USERINFO $state(-$token,user)\001"
+    }
+
+    # This procedure deals with CTCP ACTION messages:
+
+    proc RECV,CTCP,ACTION {token nick user comm dest action rest} {
+#	puts "$nick $rest"
+      orxonox::irc::action $token $nick $rest
+
+	return ""
+    }
+
+    # This procedure is a catch all for CTCP actions that we do not
+    # understand:
+
+    proc RECV,CTCP,ERROR {token nick user comm dest action rest} {
+	variable state
+
+	if {[catch {set sock $state($token,socket)}]} {
+	    error "$token: not a valid IRC connection"
+	}
+	if {[llength $rest] > 0} {
+	    puts $sock \
+		"NOTICE $nick :\001ERRMSG $action $rest: unknown CTCP\001"
+	} else {
+	    puts $sock "NOTICE $nick :\001ERRMSG $action: unknown CTCP\001"
+	}
+    }
+
+    # This is the default action, used by the default dispatcher
+    # when no action can be found for the given $token, $nick, $user,
+    # $comm, and $dest.
+
+    proc defaultAction {token nick user comm dest rest} {
+#	puts "$token: $nick $user: $comm -> $dest ... [eval concat $rest]"
+      orxonox::execute log "$token: $nick $user: $comm -> $dest ... [eval concat $rest]"
+
+	return ""
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkservers.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkservers.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkservers.tcl	(revision 5646)
@@ -0,0 +1,57 @@
+# irkservers.tcl:
+#
+# This file defines the servers that are known to the Tcl IRK library.
+# It is actually a Tcl script and is source'd by the irk.tcl file.
+
+namespace eval ::irk {
+
+    # This procedure helps define a new server:
+
+    proc defineserver {symname host ports} {
+	variable state
+	variable symsrv
+
+	# Auto initialize the list of known (symbolic names for) servers:
+
+	if {![info exists state(servers)]} {
+	    set state(servers) {}
+	}
+
+	# Add an entry in the list of (symbolic names for) servers:
+
+	lappend state(servers) $symname
+
+	# Add an entry for the contact information of this symbolic server:
+
+	set symsrv($symname) [list $host $ports]
+    }
+
+    # OK, now define a bunch of servers. This is where you can add your
+    # own, or edit if things change:
+
+    defineserver twisted	twisted.ma.us.dal.net {6660 6661 6662 6663}
+    defineserver dalnet		irc.dal.net			6667
+    defineserver undernet	McLean.VA.us.undernet.org	{6667 6668}
+    defineserver efnet		irc.Prison.NET			6666
+    defineserver ircnet		irc.stealth.net			{6663 6664}
+    defineserver powersurf	irc.powersurfr.com		6667
+    defineserver coins		coins.dal.net	{6667 6668 6669 7000}
+    defineserver sodre		sodre.on.ca.dal.net {6667 6668 6669 7000}
+    defineserver austnet	au.austnet.org 6667
+    defineserver nznet		nz.austnet.org 6667
+    defineserver sgnet		sg.austnet.org 6667
+    defineserver us.efnet	us.rr.efnet.net 6667
+    defineserver eu.efnet	eu.rr.efnet.net 6667
+    defineserver ca.efnet	ca.rr.efnet.net 6667
+    defineserver au.efnet	au.rr.efnet.net 6667
+    defineserver us.ircnet	us.ircnet.org {6665 6666 6667 6668}
+    defineserver eu.ircnet	eu.ircnet.org {6665 6666 6667 6668}
+    defineserver ca.ircnet	ca.ircnet.org {6665 6666 6667 6668}
+    defineserver au.ircnet	au.ircnet.org {6665 6666 6667 6668}
+    defineserver us.undernet	us.undernet.org 6667
+    defineserver eu.undernet	eu.undernet.org 6667
+    defineserver othernet	irc.othernet.org 6667
+    defineserver de.quakenet  de.quakenet.org 6667
+    defineserver datacore     irc.datacore.ch 6667
+    defineserver orxonox      irc.orxonox.net 6667
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkstate.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkstate.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkstate.tcl	(revision 5646)
@@ -0,0 +1,134 @@
+# irkstate.tcl:
+#
+# This file defines the contents of the ::irk::state array
+
+namespace eval ::irk {
+
+    # The state array contains all the state for the IRK package:
+    #
+    # These options can be configured with irk::config:
+    #
+    # state(-useragent)		Name of this IRK user agent.
+    # state(-version)		Version of this IRK user agent.
+    #
+    # state(-sockproxy)		Name of SOCKS5 proxy to use (optional).
+    # state(-socksport)		Port on which SOCKS5 server accepts
+    #				connections (optional).
+    #
+    # state(-$symsrv,nick)	If set and connect is called without giving
+    #				a nick, use this as the nickname.
+    # state(-$symsrv,user)	If set and connect is called without giving
+    #				a user, this is used. Otherwise, if it's not
+    #				set when connect is called without a user,
+    #				it is set to the given nickname (and used).
+    # state(-$symsrv,pass)	If set, and connect is called without giving
+    #				a password, this is used.
+    #
+    # state(-quitmessage)	If set, the message is sent when a connection
+    #				is closed, as part of a QUIT command.
+    #
+    # These options cannot be configured with irk::config:
+    #
+    # state(connections)	A list of all active connections.
+    # state(dispatcher)		The default command dispatcher (must be set).
+    # state(action)		The default action (must be set).
+    # state(servers)		List of known servers (further described in
+    #				the symsrv array below).
+    #
+    # The following state is kept per connection (identified by $contok):
+    #
+    # state($contok,socket)	The socket for a given connection
+    # state($contok,port)	The port of a given connection
+    # state($contok,host)	The host of a given connection
+    # state($contok,symsrv)	The symbolic name of the server for
+    #				this connection.
+    # state($contok,nick)	The nick name used on a given connection
+    # state($contok,user)	The real user used on a given connection
+    # state($contok,pass)	The password used on a given connection
+    # state($contok,disp)	The command dispatcher for the connection
+    #
+    # Depending on the dispatcher associated with each connection, there
+    # may be many more settings of the general form:
+    #
+    # state($contok,action,...)
+    #
+    # System wide responses to common commands are handled by
+    # special actions, stored in the state array:
+    #
+    # state(PRIVMSG,unsolicited)
+    #				Action that responds to unsolicited private
+    #				messages directed at this user's nickname.
+    # state(special,PING)	Responds to PING messages.
+    # state(special,NOTICE)	Responds to NOTICE messages.
+    # state(special,ERROR)	Responds to ERROR messages.
+    #
+    # The IRK library provides a unified authorization mechanism, implemented
+    # in irkauth.tcl. The state array contains two settings that affect the
+    # behavior of the authorization mechanism:
+    #
+    # state(auth,save,file)	Name of a file to save the authorization
+    #				information in. Defaults to auth.dat in the
+    #				directory containing the IRK package.
+    # state(auth,save,interval)	The number of milliseconds that pass between
+    #				autosaves of the authorization data.
+    
+    variable state
+    array set state {
+	-useragent		"Tcl IRK Library"
+	-version		0.1
+	-quitmessage		"gives up the ghost"
+
+	dispatcher		::irk::defaultDispatcher
+	action			::irk::defaultAction
+
+	cmd,QUIT		::irk::RECV,QUIT
+	cmd,JOIN		::irk::RECV,JOIN
+	cmd,PART		::irk::RECV,PART
+	cmd,MODE		::irk::RECV,MODE
+	cmd,NICK		::irk::RECV,NICK
+	cmd,PONG		::irk::RECV,PONG
+	cmd,PRIVMSG		::irk::RECV,PRIVMSG
+	cmd,NOTICE		::irk::RECV,NOTICE,USER
+	cmd,KICK		::irk::RECV,KICK
+	cmd,001			::irk::RECV,MOTD
+	cmd,002			::irk::RECV,MOTD
+	cmd,003			::irk::RECV,MOTD
+	cmd,004			::irk::RECV,MOTD
+	cmd,005			::irk::RECV,MOTD
+	cmd,250			::irk::RECV,MOTD
+	cmd,251			::irk::RECV,MOTD
+	cmd,252			::irk::RECV,MOTD
+	cmd,253			::irk::RECV,MOTD
+	cmd,254			::irk::RECV,MOTD
+	cmd,255			::irk::RECV,MOTD
+	cmd,265			::irk::RECV,MOTD
+	cmd,266			::irk::RECV,MOTD
+	cmd,301			::irk::RECV,AWAY
+	cmd,307			::irk::RECV,WHOIS,NICK,IDENT
+	cmd,311			::irk::RECV,WHOIS,NICK,USER
+	cmd,312			::irk::RECV,WHOIS,NICK,SERVER
+	cmd,317			::irk::RECV,WHOIS,NICK,CONNECTTIME
+	cmd,318			::irk::RECV,WHOIS,NICK,END
+	cmd,319			::irk::RECV,WHOIS,NICK,CHANNELS
+	cmd,372			::irk::RECV,MOTD
+	cmd,375			::irk::RECV,MOTD
+	cmd,376			::irk::RECV,MOTD
+	cmd,332			::irk::RECV,CHANNEL,TOPIC
+	cmd,333			::irk::RECV,CHANNEL,SETBY
+	cmd,353			::irk::RECV,CHANNEL,NAMELIST
+	cmd,366			::irk::RECV,CHANNEL,NAMELIST,END
+
+	cmd,513			::irk::RECV,PONG,REQUEST
+
+	special,PING		::irk::RECV,PING
+	special,NOTICE		::irk::RECV,NOTICE
+	special,ERROR		::irk::RECV,ERROR
+
+	PRIVMSG,unsolicited	::irk::RECV,PRIVMSG,unsolicited
+
+	errorhandler		::irk::echoerror
+
+	auth,save,file		[file join [file dir [info script]] auth.dat]
+	auth,save,interval	300000
+    }
+}
Index: code/branches/resource2/data/tcl/irk/lib/irkutil.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/lib/irkutil.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/lib/irkutil.tcl	(revision 5646)
@@ -0,0 +1,144 @@
+# irkutil.tcl:
+#
+# Utility procedures used throughout the IRK package.
+
+namespace eval ::irk {
+
+    # The randselect randomly selects an element of a given list.
+
+    proc randselect {l} {
+	lindex $l [expr int(floor(rand() * [llength $l]))]
+    }
+
+    # Remove a user from the list of users on a channel
+
+    proc removeFromChannel {token user chan} {
+	variable state
+
+	# If it's us that left the channel, forget the channel:
+
+	if {![string compare $state($token,nick) $user]} {
+	    removeChannel $token $chan
+	    return
+	}
+
+	# Try to retrieve the channel's user list:
+
+	if {[catch {set users $state($token,$chan,NAMES)}]} {
+	    return
+	}
+	set idx [lsearch $users $user]
+	if {$idx == -1} {
+	    return
+	}
+
+	# Remove the user:
+
+	set state($token,$chan,NAMES) [lreplace $users $idx $idx]
+    }
+
+    # Remove a user from all the channels I am on (for QUIT etc.)
+
+    proc removeFromAllChannels {token user} {
+	variable state
+
+	foreach chan $state($token,channels) {
+	    removeFromChannel $token $user $chan
+	}
+    }
+
+    # Add a user to a channel I am on.
+
+    proc addToChannel {token user chan} {
+	variable state
+
+	lappend state($token,$chan,NAMES) $user
+    }
+
+    # Add a channel to the list of channels we're on:
+
+    proc addChannel {token chan} {
+	variable state
+
+	lappend state($token,channels) $chan
+    }
+
+    # Remove a channel from the list of channels we're on:
+
+    proc removeChannel {token chan} {
+	variable state
+
+	if {[catch {set channels $state($token,channels)}]} {
+	    return
+	}
+	set idx [lsearch $channels $chan]
+	if {$idx == -1} {
+	    return
+	}
+
+	# Remove this channel from the list of channels we're on:
+
+	set state($token,channels) [lreplace $channels $idx $idx]
+
+	# Forget all state for this channel:
+
+	array unset state $token,$chan,*
+    }
+
+    # This procedure cleans up all state associated with a connection:
+
+    proc forgetConnection {token} {
+	variable state
+
+	array unset state $token,*
+    }
+
+    # This procedure updates the channel names for all channels we're on
+    # due to a nick change.
+
+    proc replaceAllChannels {token nick newnick} {
+	variable state
+
+	# If we're not on any channels, then no need to replace.
+
+	if {![info exists state($token,channels)]} {
+	    return
+	}
+
+	# Replace the old nick with the new nick in all the channels I'm on.
+
+	foreach chan $state($token,channels) {
+	    if {[catch {set names $state($token,$chan,NAMES)}]} {
+		continue
+	    }
+	    set idx [lsearch $names $nick]
+	    if {$idx != -1} {
+		set state($token,$chan,NAMES) \
+			[lreplace $names $idx $idx $newnick]
+	    }
+	}
+    }
+
+    # This procedure determines whether a nick is our nick.
+    
+    proc isus {token nick} {
+	variable state
+
+	if {![string compare $nick $state($token,nick)]} {
+	    return 1
+	}
+	return 0
+    }
+
+    # This procedure cleans up input received as part of a CTCP action.
+
+    proc ctcpcleanup {l} {
+	if {[llength $l] > 1} {
+	    set h [string range [lindex $l 0] 1 end]
+	    set t [string range [lindex $l end] 0 end-1]
+	    return [lreplace [lreplace $l 0 0 $h] end end $t]
+	}
+	return [string range $l 1 end-1]
+    }
+	
+}
Index: code/branches/resource2/data/tcl/irk/pkgIndex.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/pkgIndex.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/pkgIndex.tcl	(revision 5646)
@@ -0,0 +1,12 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script.  It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands.  When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded socks 1.2 [list source [file join $dir socks socks.tcl]]
+package ifneeded irk 0.1 [list source [file join $dir irk.tcl]]
Index: code/branches/resource2/data/tcl/irk/socks/socks.tcl
===================================================================
--- code/branches/resource2/data/tcl/irk/socks/socks.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/irk/socks/socks.tcl	(revision 5646)
@@ -0,0 +1,347 @@
+# Socks5 Client Library v1.2
+#
+# Original author: (C)2000 Kerem 'Waster_' HADIMLI
+#
+# Author contact information:
+#   E-mail :  waster@iname.com
+#   ICQ#   :  27216346
+#   Jabber :  waster@jabber.org   (New IM System - http://www.jabber.org)
+#
+# Cleaned up a little by Jacob Levy, jyl@best.com (01/07/2001)
+#
+# * Moved everything into the ::socks:: namespace.
+# * Parameterized so that constants do not get reset for every connection.
+# * Uniform error handling and cleanup.
+# * Incremented the version number to 1.2.
+#
+# How to use:
+#
+# Step 1: Create your client socket connected to the SOCKS5 server.
+#
+# Step 2: Call socks::init sock host port ?auth? ?user? ?pass?
+#    where:
+#
+#	sock		The socket from step #1.
+#	host		The remote host to connect to through the proxy.
+#	port		The remote port to connect to through the proxy.
+#	auth		Optional. If 1, it means that we do an
+#			authentication with the proxy server.
+#	user		Optional. If present, the user name to use for
+#			authentication with the proxy server.
+#	pass		Optional. If present, the password for the user
+#			name to use for authentication with the
+#			proxy server.
+#
+# If auth == 1, user and pass are not present, and socks::state(username)
+# and socks::state(pass) are set, then socks::init uses the values from
+# socks::state(username) and socks::state(password) for user name and
+# password, respectively.
+#
+# If anything goes wrong during the attempt to connect through the
+# proxy server, socks::init throws an appropriate error and closes
+# the socket. If the operation succeeds, socks::init returns $sock.
+#
+# You can set up your socket with fconfigure before calling socks::init,
+# the socks::init procedure is careful to restore the state to what it
+# was before the call upon successful completion. Likewise, you can
+# have fileevent handlers installed for handling socket readable and
+# socket writable events. These will also be preserved.
+
+# This file provides the "socks" package:
+
+package provide socks 1.2
+
+# Global settings:
+
+namespace eval ::socks {
+    variable state
+
+    array set state {
+	protocolversion		"\x05"
+	cmdconnect		"\x01"
+	addresstype		"\x03"
+	reserved		"\x00"
+
+	noauthmethod		"\x00"
+	noauthlengthstr		"\x01"
+
+	authmethod		"\x00\x02"
+	authlengthstr		"\x02"
+
+	nomatchingmethod	"\xFF"
+	nomatchlengthstr	"\x01"
+
+	authenticationversion	"\x01"
+
+	errorheader		"Error: "
+	error1			"General SOCKS server failure"
+	error2			"Connection not allowed by ruleset"
+	error3			"Network unreachable"
+	error4			"Host unreachable"
+	error5			"Connection refused"
+	error6			"TTL expired"
+	error7			"Command not supported"
+	error8			"Address type not supported"
+	errorUnknown		"Unknown error"
+
+	errorDisconnect		"SOCKS server disconnected"
+	errorNotSOCKS5		"SOCKS server does not support SOCKS 5"
+	errorMustAuthenticate	"SOCKS server demands user/pass authentication"
+	errorAuthMethodNotSup	"SOCKS server doesn't support user/pass auth"
+	errorWrongUserPass	"Wrong user name or password"
+	errorIncorrectAuthVal	"Incorrect value for $auth, expecting 1 or 0"
+	errorMissingUserAndPass	"Missing user and pass, required for auth == 1"
+    }
+}
+
+# Error handling and cleanup:
+
+proc ::socks::Error {sock errorMsg} {
+    variable state
+
+    # Attempt to close the socket. This also cancels any installed
+    # fileevent handlers, so no need to do that explicitly.
+
+    catch {close $sock}
+
+    # Clean up the state we keep about this socket:
+
+    catch {array unset state $sock,*}
+
+    # Report the requested error:
+
+    error "$state(errorheader)$state($errorMsg)"
+}
+    
+# Main entry point: socks::init
+#
+# See comment at head of file for how to use.
+
+proc ::socks::init {sock addr port {auth 0} {user {}} {pass {}}} {
+    variable state
+
+    # Save current configuration state for $sock
+
+    set currentConfiguration [fconfigure $sock]
+
+    # We cannot configure -peername so if its present (it should be)
+    # then remove it from the list of options.
+
+    set idx [lsearch $currentConfiguration -peername]
+    if {$idx != -1} {
+	set currentConfiguration \
+	    [lreplace $currentConfiguration $idx [expr $idx + 1]]
+    }
+
+    # Same for -sockname.
+
+    set idx [lsearch $currentConfiguration -sockname]
+    if {$idx != -1} {
+	set currentConfiguration \
+	    [lreplace $currentConfiguration $idx [expr $idx + 1]]
+    }
+
+    # Save any currently installed handler for fileevent readable:
+
+    set currentReadableHandler [fileevent $sock readable]
+
+    # If the user has "set and forget" user name and password, and
+    # indicates that she wants to use them, use them now:
+
+    if {($auth == 1) && (![string compare {} $user]) \
+	    && (![string compare {} $pass])} {
+	if {[info exists state(username)] && [info exists state(password)]} {
+	    set auth 1
+	    set user $state(username)
+	    set pass $state(password)
+	} else {
+	    Error $sock errorMissingUserAndPass
+	}
+    }
+
+    # Figure out the authentication method to use:
+
+    if {$auth == 0} {
+	set nmethods $state(noauthlengthstr)
+	set method $state(noauthmethod)
+    } elseif {$auth == 1} {
+	set nmethods $state(authlengthstr)
+	set method $state(authmethod)
+    } else {
+	Error $sock errorIncorrectAuthVal
+    }
+
+    # Encode the length of the address given (binary 1 byte):
+
+    set domainlen "[binary format c [string length $addr]]"
+
+    # Encode the port (network byte order, 2 bytes):
+
+    set port [binary format S $port]
+
+    if {$auth == 1} {
+	# Encode the length of the user given (binary 1 byte):
+
+	set userlen "[binary format c [string length $user]]"
+
+	# Encode the length of the password given (binary 1 byte):
+
+	set passlen "[binary format c [string length $pass]]"
+    }
+
+    # Set up initial state for the given socket:
+
+    set state($sock,state) $sock
+    set state($sock,data) ""
+
+    # Prepare the socket:
+
+    fconfigure $sock -translation {binary binary} -blocking 0
+    fileevent $sock readable "::socks::readable $sock"
+
+    # Tell the server what version and authentication method we're using:
+
+    puts -nonewline $sock "$state(protocolversion)$nmethods$method"
+    flush $sock
+
+    # Wait for server response and retrieve the information sent by the
+    # server:
+
+    vwait ::socks::state($sock,state)
+    set serverReply $state($sock,data)
+
+    if {[eof $sock]} {
+	Error $sock errorDisconnect
+    }
+
+    # Analyze the server's reply:
+
+    set serverVersion ""
+    set serverMethod $state(nomatchingmethod)
+
+    binary scan $serverReply "cc" serverVersion serverMethod
+
+    # Check for various error conditions:
+
+    if {$serverVersion != 5} {
+
+	# Server does not support SOCKS5 protocol
+
+	Error $sock errorNotSOCKS5
+    }
+
+    # If server demands authentication, do that step now:
+
+    if {$serverMethod == 2} {
+
+	if {$auth == 0} {
+
+	    # We didn't supply user/pass but server wants us to authenticate:
+
+	    Error $sock errorMustAuthenticate
+	}
+
+	puts -nonewline $sock \
+	    "$state(authenticationversion)$userlen$user$passlen$pass"
+	flush $sock
+
+	# Wait again for server reply:
+
+	vwait ::socks::state($sock,state)
+	set serverReply $state($sock,data)
+
+	# Analyze the server reply:
+
+	set authenticationVersion ""
+	set serverStatus "\x00"
+
+	binary scan $serverReply "cc" authenticationVersion serverStatus
+
+	# Deal with errors:
+
+	if {$authenticationVersion != 1} {
+
+	    # Server does not support our user/pass authentication method:
+
+	    Error $sock errorAuthMethodNotSup
+	}
+
+	if {$serverStatus != 0} {
+
+	    # We supplied wrong user/pass combination:
+
+	    Error $Sock errorWrongUserPass
+	}
+    } elseif {$serverMethod != 0} {
+
+	# Unknown method. Clean up:
+
+	Error $sock errorUnsupportedMethod
+    }
+
+    # Finally tell the server to connect us to the requested host and port:
+
+    puts -nonewline $sock \
+	"$state(protocolversion)$state(cmdconnect)$state(reserved)"
+    puts -nonewline $sock "$state(addresstype)$domainlen$addr$port"
+    flush $sock
+
+    # Wait again for server response:
+
+    vwait ::socks::state($sock,state)
+    set serverReply $state($sock,data)
+
+    if {[eof $sock]} {
+	Error $sock errorDisconnect
+    }
+
+    # Analyze server reply:
+
+    set serverVersion ""
+    set serverReplyCode ""
+
+    binary scan $serverReply "cc" serverVersion serverReplyCode
+
+    # Deal with errors:
+
+    if {$serverVersion != 5} {
+	Error $sock errorNotSOCKS5
+    }
+
+    if {$serverReplyCode != 0} {
+	if {($serverReplyCode > 0) && ($serverReplyCode < 9)} {
+	    Error $sock error$serverReplyCode
+	}
+	Error $sock errorUnknown
+    }
+
+    # All done, clean up state, reconfigure $sock to its original state,
+    # remove our fileevent handler and potentially restore the original
+    # one if one was present.
+
+    fileevent $sock readable {}
+    if {[string compare $currentReadableHandler ""]} {
+	fileevent $sock readable $currentReadableHandler
+    }
+    catch {eval fconfigure $sock $currentConfiguration}
+    catch {array unset state $sock,*}
+
+    # For good measure return the socket:
+
+    return $sock
+}
+
+# This procedure reads input available from the server socket and then
+# changes a state variable so that the main program will be woken up.
+
+proc ::socks::readable {sock} {
+    variable state
+
+    # Wake up the vwait:
+
+    set state($sock,state) $sock
+
+    # Read the data:
+
+    set state($sock,data) [read $sock]
+}
Index: code/branches/resource2/data/tcl/remote.tcl
===================================================================
--- code/branches/resource2/data/tcl/remote.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/remote.tcl	(revision 5646)
@@ -0,0 +1,2 @@
+set telnetserverthreadid [TclThreadManager create]
+TclThreadManager execute $telnetserverthreadid source $pld/telnet_server.tcl
Index: code/branches/resource2/data/tcl/telnet_server.tcl
===================================================================
--- code/branches/resource2/data/tcl/telnet_server.tcl	(revision 5646)
+++ code/branches/resource2/data/tcl/telnet_server.tcl	(revision 5646)
@@ -0,0 +1,213 @@
+ #!/usr/bin/env tclsh
+ # Pseudo-telnet server.  Includes basic auth, but no separate identities
+ # or proper multi-threaded operation, so whoever runs this had better
+ # trust those he gives identities/passwords to and they had better trust
+ # each other too.  Note this script does not support command-line arguments.
+
+ ## The names of this array are IP addresses of hosts that are not permitted
+ ## to connect to any of our services.  Admin account(s) can change this
+ ## at run-time, though this info is not maintained across whole-server shutdowns.
+ array set denyHosts {}
+
+ ## Keep the Tcl-thread busy
+ proc every {ms body} { eval $body; after $ms [list every $ms $body] }
+ every 200 {}
+
+ ## Create a server on the given port with the given name/password map
+ ## and the given core interaction handler.
+ proc telnetServer {port {passmap} {handlerCmd remoteCommand}} {
+     if {$port == 0} {
+         return -code error "Only non-zero port numbers are supported"
+     }
+     set server [socket -server [list connect $port $handlerCmd] $port]
+     global passwords services
+     foreach {id pass} $passmap {set passwords($port,$id) $pass}
+     set services($server) $handlerCmd
+     return $server
+ }
+
+ ## Removes the server on the given port, cleaning up the extra state too.
+ proc closedownServer {server} {
+     global services passwords connections auth
+     set port [lindex [fconfigure $server -sockname] 2]
+     catch {close $server}
+     unset services($server)
+     foreach passmap [array names passwords $port,*] {
+         unset passwords($passmap)
+     }
+     # Hmph!  Have to remove unauthorized connections too, though any
+     # connection which has been authorized can continue safely.
+     foreach {client data} [array get connections] {
+         if {$port == [lindex $data 0] && !$auth($client)} {
+             disconnect $client
+         }
+     }
+ }
+
+ ## Handle an incoming connection to the given server
+ proc connect {serverport handlerCmd client clienthost clientport} {
+     global auth cmd denyHosts connections
+     if {[info exist denyHosts($clienthost)]} {
+         puts stdout "${clienthost}:${clientport} attempted connection"
+         catch {puts $client "Connection denied"}
+         catch {close $client}
+         return
+     }
+     puts stdout "${clienthost}:${clientport} connected on $client"
+     fileevent $client readable "handle $serverport $client"
+     set auth($client) 0
+     set cmd($client) $handlerCmd
+     set connections($client) [list $serverport $clienthost $clientport]
+     fconfigure $client -buffering none
+     catch {puts -nonewline $client "Login: "}
+ }
+
+ ## Disconnect the given client, cleaning up any connection-specific data
+ proc disconnect {client} {
+     catch {close $client}
+     global auth cmd connections
+     unset auth($client)
+     unset cmd($client)
+     unset connections($client)
+     puts stdout "$client disconnected"
+ }
+
+ ## Handle data sent from the client.  Log-in is handled directly by this
+ ## procedure, and requires the name and password on the same line
+ proc handle {serverport client} {
+     global passwords auth cmd
+     if {[gets $client line] < 0} {
+         disconnect $client
+         return
+     }
+     if {[string equal $line "logout"] || [string equal $line "quit"]} {
+         disconnect $client
+         return
+     }
+     if {[string equal $line "exit"]} {
+         set ::termination 1
+         return
+     }
+     if {$auth($client)} {
+         eval $cmd($client) [list $client $line 0]
+         eval $cmd($client) [list $client $line 1]
+         return
+     }
+     foreach {id pass} [split $line] {break}
+     if {![info exist pass]} {
+         catch {puts -nonewline $client "Login: "}
+         return
+     }
+     if {
+         [info exist passwords($serverport,$id)] &&
+         [string equal $passwords($serverport,$id) $pass]
+     } then {
+         set auth($client) 1
+         puts stdout "$id logged in on $client"
+         catch {puts $client "Welcome, $id!"}
+         eval $cmd($client) [list $client $line 1]
+         return
+     }
+     puts stdout "AUTH FAILURE ON $client"
+     catch {puts $client "Unknown name or password"}
+     disconnect $client
+ }
+
+ ## Standard handler for logged-in conversations and prompt-generation.
+ proc execCommand {client line prompt} {
+     global tcl_platform
+     if {$prompt} {
+         catch {puts -nonewline $client "\$ "}
+         return
+     }
+     switch $tcl_platform(platform) {
+         unix {
+             catch {exec sh -c $line <@$client >@$client 2>@$client}
+         }
+         default {
+             catch {exec $line} data
+             puts $client $data
+         }
+     }
+ }
+
+ ## Administration service handler.  Chains to the normal handler for
+ ## everything it doesn't recognise itself.
+ proc admin {client line prompt} {
+     if {$prompt} {
+         catch {puts -nonewline $client "# "}
+         return
+     }
+     set cmd [split $line]
+     global denyHosts connections services
+     if {[string equal $line "shutdown"]} {
+         set ::termination 1
+         puts stdout "Shutdown requested on $client"
+         catch {puts $client "System will shut down as soon as possible"}
+         return -code return "SHUTTING DOWN"
+     } elseif {[string equal [lindex $cmd 0] "deny"]} {
+         set denyHosts([lindex $cmd 1]) 1
+     } elseif {[string equal [lindex $cmd 0] "allow"]} {
+         catch {unset denyHosts([lindex $cmd 1])}
+     } elseif {[string equal $line "denied"]} {
+         foreach host [array names denyHosts] {
+             catch {puts $client $host}
+         }
+     } elseif {[string equal $line "connections"]} {
+         set len 0
+         foreach conn [array names connections] {
+             if {$len < [string length $conn]} {
+                 set len [string length $conn]
+             }
+         }
+         foreach {conn details} [array get connections] {
+             catch {puts $client [format "%-*s = %s" $len $conn $details]}
+         }
+     } elseif {[string equal [lindex $cmd 0] "close"]} {
+         set sock [lindex $cmd 1]
+         if {[info exist connections($sock)]} {
+             disconnect $sock
+         }
+     } elseif {[string equal $line "services"]} {
+         set len 0
+         foreach serv [array names services] {
+             if {$len < [string length $serv]} {
+                 set len [string length $serv]
+             }
+         }
+         foreach {serv handler} [array get services] {
+             set port [lindex [fconfigure $serv -sockname] 2]
+             catch {puts $client [format "%-*s (port %d) = handler %s" $len $serv $port $handler]}
+         }
+     } elseif {[string equal [lindex $cmd 0] "addService"]} {
+         set service [eval telnetServer [lrange $cmd 1 end]]
+         catch {puts $client "Created service as $service"}
+     } elseif {[string equal [lindex $cmd 0] "removeService"]} {
+         set service [lindex $cmd 1]
+         if {[info exist services($service)]} {
+             closedownServer $service
+         }
+     } else {
+         # CHAIN TO DEFAULT
+         execCommand $client $line 0
+     }
+ }
+ 
+ ## Executes a given command
+ proc remoteCommand {client line prompt} {
+     global tcl_platform
+     if {$prompt} {
+         catch {puts -nonewline $client "\$ "}
+         return
+     }
+     catch {eval $line} data
+     puts $client $data
+ }
+
+ telnetServer 2560 {orxonox rocks} remoteCommand
+ telnetServer 2561 {orxadmin *****} admin
+
+ puts stdout "Ready for service"
+
+ vwait termination
+ execute exit
