<?xml version="1.0" ?>

<Scene name="Dam" zbase="328" zfactor="0.4000" width="730">
	<Object type="LBAMap" name="Dam_walk" filename="Dam.lba" x="0" y="0"/>

	<Audio source="jama_map"/>
	
	<Action type="StopSound" sound="wrag" fade_time="2"/>

	<!-- Images -->
	<Object type="ImageBox" image="Dam" x="0" y="0" />
    <Object type="ImageBox" image="Dam_Bg2" x="506" y="0" />
    <!-- <if t="$rowboat_on_dam"> <Object type="ImageBox" image="Dam-Rowboat" x="301" y="238" />  </if> -->
	<if t="$rowboat_on_dam">
		<Object type="ImageBox" image="Dam-Rowboat" x="301" y="238" />
	</if>

	<Object type="Character2D" chr="brawe" x="0" y="0">
		<Property name="position_if:$prev_scene == None" value="306,242,W"/> <!-- test -->
		<Property name="position_if:$prev_scene == jama_spacea.Pier" value="306,242,W"/>
		<Property name="position_if:$prev_scene == jama_spacea.JamaMap" value="306,242,W"/>
		<Property name="position_if:$prev_scene == jama_spacea.Clearing" value="299,227,SW"/>
		<Property name="position_if:$prev_scene == jama_spacea.Undergrave" value="83,259,SE"/>
		<Property name="position_if:$prev_scene == jama_spacea.Cemetary" value="201,201,S"/>
	</Object>

	<Object type="ImageBox" image="Foreground-Bridge" x="338" y="116" />
	<if t="$explosives_placed"> <Object type="ImageBox" image="Explosives" x="407" y="168" /> </if>
    <Object type="ImageBox" image="Dam-Foreground_2" x="575" y="120" />
    <Object type="ImageBox" image="Dam-Foreground_1" x="0" y="121" />

	<Action condition="not $brawe_visited_dam" type="Composite">		
		<Action type="SetVar" var="brawe_visited_dam" value="1" reset="0"/>
	</Action>

	<!-- Actions -->
	<Action color="0000FF" type="CommandCharacter" chr="brawe" rollover="RO_GOTO_CEMETARY|u">
		<Job type="Move" x="201" y="201"/>
		<Job type="SetOrientation" direction="NW"/>
		<Job type="SwitchScene" scene="Cemetary"/>
	</Action>

	<Action color="FFFF00" type="CommandCharacter" chr="brawe" rollover="RO_GOTO_CLEARING|r">
		<Job type="Move" x="690" y="148"/>
		<Job type="SetOrientation" direction="NE"/>
		<Job type="SwitchScene" scene="Clearing"/>
	</Action>

	<Action color="0066FF" type="CommandCharacter" chr="brawe" rollover="RO_GOTO_UNDERGRAVE|l">
		<Job type="Move" x="83" y="259"/>
		<Job type="SetOrientation" direction="NW"/>
		<Job type="SwitchScene" scene="Undergrave"/>
	</Action>

	<!--
	<Action color="FF6600" type="ItemAction" rollover="RO_DAM">
		<Action itemaction="noitem" type="Multiple">
			<Action multiple="look" type="CommandCharacter" chr="brawe">
				<Job type="Move" x="445" y="175"/>
				<Job type="SetOrientation" direction="S"/>
				<Job type="Say" key="DAM_LOOK_01"/>
			</Action>
			<Action multiple="use" type="CommandCharacter" chr="brawe">
				<Job type="Move" x="445" y="175"/>
				<Job type="SetOrientation" direction="NE"/>
				<Job type="Say" key="DAM_USE_01"/>
			</Action>
		</Action>
		<Action itemaction="explosives" type="CommandCharacter" chr="brawe">
			<Job type="Move" x="425" y="180"/>
			<Job type="SetOrientation" direction="S"/>
			<Job type="LockScene"/>
			<Job type="Animate" ani="Take"/>
			<Job type="RemoveItem" item="explosives"/>
			<Job type="Pause" time="1"/>
			<Job type="SetVar" var="explosives_placed" value="1"/>
			<Job type="Animate" ani="TakeBack"/>
			<Job type="DebugPrint" text="Showing 'glued' comment"/>
			<Job type="Say" key="EXPLOSIVES_GLUED"/>
			<Job type="UnlockScene"/>
		</Action>
		<Action itemaction="fused_explosives" type="Composite">
			<Action type="RemoveItem" item="fused_explosives"/>
			<Action type="Reference" ref="M::blow_dam_up"/>
		</Action>
	</Action>
	-->

	<if t="$explosives_placed">
		<Action color="CC33CC" type="ItemAction" rollover="RO_EXPLOSIVES_ON_DAM">
			<Action itemaction="noitem" type="Multiple">
				<Action multiple="look" type="CommandCharacter" chr="brawe">
					<Job type="Move" x="445" y="175"/>
					<Job type="SetOrientation" direction="S"/>
					<Job type="Say" key="EXPLOSIVES_ON_DAM_LOOK_01"/>
				</Action>
				<Action multiple="use" type="CommandCharacter" chr="brawe">
					<Job type="Move" x="445" y="175"/>
					<Job type="SetOrientation" direction="S"/>
					<Job type="Say" key="EXPLOSIVES_ON_DAM_USE_01"/>
				</Action>
			</Action>
			<Action itemaction="fuses" type="Composite">
				<Action type="RemoveItem" item="fuses"/>
				<Action type="Reference" ref="M::blow_dam_up"/>
			</Action>
		</Action>

	<else> <!-- if not explosives placed -->
		<Action color="CC33CC" type="ItemAction" rollover="RO_DAM">
			<Action itemaction="noitem" type="Multiple">
				<Action multiple="look" type="CommandCharacter" chr="brawe">
					<Job type="Move" x="445" y="175"/>
					<Job type="SetOrientation" direction="S"/>
					<Job type="Say" key="DAM_LOOK_01"/>
				</Action>
				<Action multiple="use" type="CommandCharacter" chr="brawe">
					<Job type="Move" x="445" y="175"/>
					<Job type="SetOrientation" direction="S"/>
					<Job type="Say" key="DAM_USE_01"/>
				</Action>
			</Action>
			<Action itemaction="explosives" type="CommandCharacter" chr="brawe">
				<Job type="Move" x="425" y="180"/>
				<Job type="SetOrientation" direction="S"/>
				<Job type="LockScene"/>
				<Job type="Animate" ani="Take"/>
				<Job type="RemoveItem" item="explosives"/>
				<Job type="Pause" time="1"/>
				<Job type="SetVar" var="explosives_placed" value="1"/>
				<Job type="Animate" ani="TakeBack"/>
				<Job type="Say" key="EXPLOSIVES_GLUED"/>
				<Job type="UnlockScene"/>
			</Action>
			<Action itemaction="fused_explosives" type="Composite">
				<Action type="RemoveItem" item="fused_explosives"/>
				<Action type="Reference" ref="M::blow_dam_up"/>
			</Action>

		</Action>
	</else>
	</if>

	<Action name="M::blow_dam_up" type="CommandCharacter" chr="brawe">
		<Job type="LockScene"/>
		<Job type="Move" x="425" y="180"/>
		<Job type="SetOrientation" direction="S"/>
		<Job type="Animate" ani="Take"/>
		<Job type="Pause" time="1"/>
		<Job type="SetVar" var="explosives_placed" value="1"/>
		<Job type="Animate" ani="TakeBack"/>
		<Job type="Say" key="FUSES_IGNITE"/>

		<Job type="Move" x="305" y="245"/>
		<Job type="SetOrientation" direction="SE"/>
		<Job type="Pause" time="0.5"/>
		<Job type="SetVar" var="placing_fuse" value="1"/>
		<Job type="SwitchScene" scene="Pier"/>
	</Action>

	<if t="$rowboat_on_dam">
		<Action color="6666CC" type="Multiple" rollover="RO_ROWBOAT_ON_DAM">
			<Action multiple="look" type="CommandCharacter" chr="brawe">
				<Job type="Move" x="305" y="245"/>
				<Job type="SetOrientation" direction="SE"/>
				<Job type="Say" key="ROWBOAT_ON_DAM_LOOK_01"/>
			</Action>

			<Action multiple="use" type="CommandCharacter" chr="brawe" rollover="ui.casual_use_only">
				<Job type="Move" x="305" y="245"/>
				<Job type="SetOrientation" direction="SE"/>
				<Job type="SetVar" var="rowboat_on_dam" value="0" reset="0"/>
				<Job type="SwitchScene" scene="Pier"/>
			</Action>
		</Action>
	</if>

	<Action color="FF0000" type="ItemAction" rollover="RO_DAM_MECHANISM">
		<Action itemaction="noitem" type="Multiple">
			<Action multiple="look" type="CommandCharacter" chr="brawe">
				<Job type="Move" x="229" y="205"/>
				<Job type="SetOrientation" direction="NE"/>
				<Job type="Say" key="DAM_MECHANISM_LOOK_01"/>
			</Action>
			<Action multiple="use" type="CommandCharacter" chr="brawe" rollover="ui.casual_use_only">
				<Job type="Move" x="229" y="205"/>
				<Job type="SetOrientation" direction="NE"/>
				<Job type="Say" key="DAM_MECHANISM_USE_01"/>
			</Action>
		</Action>
		<Action itemaction="dam_key" type="CommandCharacter" chr="brawe">
			<Job type="Move" x="229" y="205"/>
			<Job type="SetOrientation" direction="NE"/>
			<Job type="Animate" ani="Take"/>
			<Job type="PlaySound" sound="unlock"/>
			<Job type="Pause" time="1"/>
			<Job type="Animate" ani="TakeBack"/>			
			<Job type="Say" key="DAM_KEY_FAIL"/>
			<Job type="SetVar" var="hint12_dam" value="1" reset="0"/>
		</Action>
	</Action>

</Scene>