<?xml version="1.0" encoding="UTF-8" ?>
<sector name="MenuScreen" >
    <tMenuScreen prototype="ScreenEntity">

      <iArrowIndex>0</iArrowIndex>
      <pSprite> 0 </pSprite>
      
      <Init>
        <sFilename> Murderball8000.dds </sFilename>
        
        <tCreateSprite prototype ="ActionCreateSprite">
          <rFile> sFilename </rFile>
          <rTexture> pSprite </rTexture>
        </tCreateSprite>
        
        <!-- Load menu theme -->
        <tLoadTheme prototype="ActionLoadAudio">
          <sFilename> ballblazer.wav </sFilename>
          <iLooping> 1 </iLooping>
          <i3D> 0 </i3D>
        </tLoadTheme>
        
        <!-- Play menu theme -->
        <tPlayTheme prototype="ActionPlaySound">
          <sFilename> ballblazer.wav </sFilename>
        </tPlayTheme> 
      </Init>
      
		
        <Render>
            <!--Render Text for Screen-->
            <sText index="0"> Play Online </sText>
            <sText index="1"> Credits </sText>
            <sText index="2"> Quit </sText>
            <vPosition> {280,260,0,0} </vPosition>
            <vColor> {1,1,1,1} </vColor>
            <sFont> Courier New </sFont>
            <iSize> 20 </iSize>
			
            <sArrow> ---> </sArrow>
            <vArrowColor> {1,1,1,1} </vArrowColor>
            <sArrowFont> Courier New </sArrowFont>
            <iArrowSize> 20 </iArrowSize>
            <vArrowPos1> {220,260,0,0} </vArrowPos1>
            <vArrowPos2> {220,280,0,0} </vArrowPos2>
            <vArrowPos3> {220,300,0,0} </vArrowPos3>

          <vSpriteCenter> {0, 0, 0, 0} </vSpriteCenter>
          <vSpriteTranslate> {70, 0, 0, 0} </vSpriteTranslate>
          <iSpriteColor> 0xFFFFFFFF </iSpriteColor>
          <pSquare> 0 </pSquare>

          <tSpriteRender prototype="ActionRenderSprite">
            <rSpriteFile> pSprite </rSpriteFile>
            <rColor> iSpriteColor </rColor>
            <rCenter> vSpriteCenter </rCenter>
            <rTranslate> vSpriteTranslate </rTranslate>
            <rSquare> pSquare </rSquare>
          </tSpriteRender>
            
            <tTextRender prototype="ActionRenderText">
                <rText>sText</rText>
                <rPosition> vPosition </rPosition>
                <rColor> vColor </rColor>
                <rFont> sFont </rFont>
                <rSize> iSize </rSize>
            </tTextRender>

            <iCondition0> 0 </iCondition0>
            <iCondition1> 0 </iCondition1>
	
			<expr> iCondition0 = ( iArrowIndex == 0 ) </expr>
			<if>
				<rCondition> iCondition0 </rCondition>
				<then>
					<tArrowRender1 prototype="ActionRenderText">
						<rPosition> vArrowPos1 </rPosition>
						<rText>sArrow</rText>
						<rColor> vArrowColor </rColor>
						<rFont> sArrowFont </rFont>
						<rSize> iArrowSize </rSize>
					</tArrowRender1>
				</then>
				<else>
					<expr> iCondition1 = ( iArrowIndex == 1 ) </expr>
					<if>
						<rCondition> iCondition1 </rCondition>
						<then>
							<tArrowRender2 prototype="ActionRenderText">
								<rPosition> vArrowPos2 </rPosition>
								<rText>sArrow</rText>
								<rColor> vArrowColor </rColor>
								<rFont> sArrowFont </rFont>
								<rSize> iArrowSize </rSize>
							</tArrowRender2>
						</then>
						<else>
							<tArrowRender3 prototype="ActionRenderText">
								<rPosition> vArrowPos3 </rPosition>
								<rText>sArrow</rText>
								<rColor> vArrowColor </rColor>
								<rFont> sArrowFont </rFont>
								<rSize> iArrowSize </rSize>
							</tArrowRender3>
						</else>
					</if>
				</else>
			</if>
			
        </Render>
		
		
    <!-- Reactions-->
    
        <!-- Secret Single Player mode. -->
        <tSAction prototype="ReactionInput">
            <iSoughtInputs>btns</iSoughtInputs>
            
            <tStopTheme prototype="ActionStopSound">
              <sFilename> ballblazer.wav </sFilename>
            </tStopTheme>
            
			<tUnload prototype="ActionUnloadSector">
				<sSectorName>MenuScreen</sSectorName>
			</tUnload>
			<tUnload2 prototype="ActionUnloadSector">
				<sSectorName>VirtualKeyboard</sSectorName>
			</tUnload2>
			<tLoad prototype="ActionLoad">
				<sFilename>CleanXML.xml</sFilename>
				<iSynch>0</iSynch>
			</tLoad>
			<tLoad2 prototype="ActionLoad">
				<sFilename>GeneralInput.xml</sFilename>
				<iSynch>0</iSynch>
			</tLoad2>
			<!--<tLoad3 prototype="ActionLoad">
				<sFilename>Obstacle.xml</sFilename>
				<iSynch>0</iSynch>
			</tLoad3>-->
        </tSAction>
	
		<tUpReaction prototype="ReactionInput">
	        <iSoughtInputs>btup</iSoughtInputs>
			<iMask>-1</iMask>
			
			<iCondition> 0 </iCondition>

			
			<expr> iCondition = ( iArrowIndex == 0 ) </expr>
			<if>
				<rCondition> iCondition </rCondition>
                <then>
					<expr> iArrowIndex = 2 </expr>
				</then>
				<else>
					<expr> iArrowIndex = ( iArrowIndex - 1 )</expr>
				</else>
			</if>
		</tUpReaction>
		
		<tDownReaction prototype="ReactionInput">
	        <iSoughtInputs>btdn</iSoughtInputs>
			<iMask>-1</iMask>
			
			<iCondition> 0 </iCondition>
			<iArrowNewIndex> 0 </iArrowNewIndex>
			
			<expr> iCondition = ( iArrowIndex == 2 ) </expr>
			<if>
				<rCondition> iCondition </rCondition>
                <then>
					<expr> iArrowIndex = 0 </expr>
				</then>
				<else>
					<expr> iArrowIndex = ( iArrowIndex + 1 )  </expr>
				</else>
			</if>
		</tDownReaction>
		
		<!-- Escape key handling. -->
		<tEscapeReaction prototype="ReactionInput">
		    <iSoughtInputs>escp</iSoughtInputs>
		    
		    <tQuit prototype="ActionQuit" />
		</tEscapeReaction>
		
		<tEnterReaction prototype="ReactionInput">
	        <iSoughtInputs>entr</iSoughtInputs>
			<iMask>-1</iMask>
			
			<iCondition0> 0 </iCondition0>
			<iCondition1> 0 </iCondition1>
			
			<expr> iCondition0 = ( iArrowIndex == 0 ) </expr>
			<if>
                <rCondition> iCondition0 </rCondition>
                <then>
                <expr> iSinglePlayer = 0 </expr>
                <tUnload prototype="ActionUnloadSector">
                    <sSectorName>MenuScreen</sSectorName>
                </tUnload>
                <tLoad0 prototype="ActionLoad">
                    <sFilename>NetworkData.xml</sFilename>
                    <!-- Important to be synchronous. -->
                    <iSynch>1</iSynch>
                </tLoad0>
                <tLoad1 prototype="ActionLoad">
                    <sFilename>ServerConnect.xml</sFilename>
                    <iSynch>0</iSynch>
                </tLoad1>
                </then>
                <else>
                <expr> iCondition1 = ( iArrowIndex == 1 ) </expr>
                <if>
                    <rCondition> iCondition1 </rCondition>
                    <then>
                    <tLoad prototype="ActionLoad">
                        <sFilename>CreditScreen.xml</sFilename>
                        <iSynch>0</iSynch>
                    </tLoad>

                    <tFreeSprite prototype ="ActionReleaseSprite">
                        <rSprite> pSprite </rSprite>
                    </tFreeSprite>
                      
                    <tUnload prototype="ActionUnloadSector">
                        <sSectorName>MenuScreen</sSectorName>
                    </tUnload>
                    </then>
                    <else>
                    <tQuit prototype="ActionQuit" />
                    </else>
                </if>
                </else>
            </if>
		</tEnterReaction>
		
    </tMenuScreen>
</sector>
