<gui>
	<xdefine name="model_scale" value="70 10" />
	<xdefine name="base_color" value="29 137 151" />
	<xdefine name="highlight_hud_color" value="255 108 0" />
	<xdefine name="base_alpha" value="100" />
	
	<!-- ammo_at should be for a 800 600 layout and it is aligned 1 1 -->	
	<xdefine name="ammo_at" value="790 593 0" />
	<xdefine name="ammo_at2" value="1590 1193 0" />
	<xdefine name="ammo_size" value="193 51" />
	
	<xdefine name="div( nr1, nr2 )" expression="$nr1/$nr2" />
	
	<xdefine name="common_objects">		
		<!--<unit name="ammo_frame" unit="hud_r_dframe_80x25" scale="@model_scale" detach="true" color="@base_color" alpha="@base_alpha" >
			<connect_material material="interface_items" color="color" alpha="opacity"/>
		</unit>-->
		
		<xi:include href="hud_interface_items.xml"/>
		<xi:include href="menu_fonts.xml"/>
		
		<bitmap name="weapon_frame" texture="data\textures\atlas_gui\hud" uv_rect="@div(318, 512) @div(459, 512) @div(193, 512) @div(51, 512)" size="@ammo_size" material="hud_techpattern_back_box" />

		<!--
		<unit unit="hud_mode_auto" name="auto" scale="@model_scale" detach="true" color="255 255 255" alpha="150">
			<connect_material material="interface_items" color="color" alpha="opacity"/>
		</unit>
		<unit unit="hud_mode_single" name="semi" scale="@model_scale" detach="true" color="255 255 255" alpha="150"> 
			<connect_material material="interface_items" color="color" alpha="opacity"/>
		</unit>
		<unit unit="hud_mode_burst" name="burst" scale="@model_scale" detach="true" color="255 255 255" alpha="150">
			<connect_material material="interface_items" color="color" alpha="opacity"/>
		</unit>
		<unit unit="hud_mode_safe" name="safe" scale="@model_scale" detach="true" color="255 255 255" alpha="150">
			<connect_material material="interface_items" color="color" alpha="opacity"/>
		</unit>
		-->
		<!--
		<sprite name="fade_out_anim">
			<frame name="start_anim">								
				<tween_start object="../ammo_spr/ammo_frame" /> 
				<tween_start object="../ammo_spr/clip_spr/text_clip_spr/text_clip" alpha="@base_alpha" />
				<tween_start object="../ammo_spr/clip_spr/text_tot_spr/text_tot" alpha="@base_alpha" />
				<tween_start object="../ammo_spr/fire_rate_spr/fire_rate" alpha="@base_alpha" />
			</frame>
			<frame skip="@fade_out_time">
				<tween_end object="../ammo_spr/ammo_frame" />
				<tween_end object="../ammo_spr/clip_spr/text_clip_spr/text_clip" alpha="@fade_out_less_alpha" />
				<tween_end object="../ammo_spr/clip_spr/text_tot_spr/text_tot" alpha="@fade_out_less_alpha" />
				<tween_end object="../ammo_spr/fire_rate_spr/fire_rate" alpha="@fade_out_less_alpha" />
			</frame>
		</sprite>	
		-->
		
		<sprite name="flash_anim">
			<frame>
				<pause/>
			</frame>
			<frame name="start_anim">								
				<tween_start object="../ammo_spr/ammo_frame" color="@base_color" />	
			</frame>
			<frame skip="2">								
				<tween_middle object="../ammo_spr/ammo_frame" color="@highlight_hud_color" /> 	
			</frame>
			<frame skip="2">
				<tween_end object="../ammo_spr/ammo_frame" color="@base_color" />
			</frame>
		</sprite>
	</xdefine>

	<xdefine name="hud_weapons(name)">		
		<movie name="ammo_$name" materials="/data/objects/gui/hud_new/materials.xml">		
			@common_objects		
			<unit unit="hud_$name" name="weapon_unit" scale="70 20" color="255 255 255" alpha="150">		
				<connect_material material="aimlines" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight_gl" color="color" alpha="opacity" start_alpha="255" />
			</unit>
				
			<sprite name="fire_rate_auto" size="@model_scale">
				<frame>	
					<place object="icon_full_auto" at="0 0 0" align="0 0" />
				</frame>
			</sprite>
			
			<sprite name="fire_rate_burst" size="@model_scale">
				<frame>
					<place object="icon_burst" at="0 0 0" align="0 0" />
				</frame>
			</sprite>
			
			<sprite name="fire_rate_semi" size="@model_scale">
				<frame>
					<place object="icon_single_shot" at="0 0 0" align="0 0" />
				</frame>
			</sprite>
			
			<sprite name="fire_rate">
				<frame>
				</frame>
			</sprite>
	
			<sprite name="text_clip_spr">
				<slot name="set_warning">
					<set_material object="text_clip" material="txt_pos12" />
				</slot>
				<slot name="set_regular">
					<set_material object="text_clip" material="txt_white" />
				</slot>
				<frame>
					<clone object="header_text" name="text_clip" />
					<place object="text_clip" at="3 3 0" align="0.5 0.5" />
					<set_text object="text_clip"  text="6" />	
					<set_material object="text_clip" material="txt_white" />
				</frame>
			</sprite>
			<sprite name="text_tot_spr">
				<frame>
					<clone object="normal_text" name="text_tot" />
					<place object="text_tot" at="3 3 0" align="0.5 0.5"	/>	
					<set_text object="text_tot" text="6" />
					<set_material object="text_tot" material="txt_white" />
				</frame>
			</sprite>
			<sprite name="clip_spr">
				<frame>
					<place object="text_clip_spr" at="0 0 0" align="0.5 0.5" size="10" />
					
					<clone object="header_text" name="text_sep" />
					<place object="text_sep" at="13 -3 0" align="0.5 0.5" />	
					<set_text object="text_sep" text="/" />
					<set_material object="text_sep" material="txt_white" />
					
					<place object="text_tot_spr" at="25 0 0" align="0.5 0.5" size="10" />
				</frame>
			</sprite>
			
			<sprite name="fire_rate_spr">
				<frame>
					<place object="fire_rate" size="@model_scale" at="0 0 -1" />
				</frame>
			</sprite>
			
			<sprite name="weapon_spr">
				<frame>					
					<place object="weapon_unit" at="10 10 -1" align="0.5 0.5" />
					<remove object="weapon_unit" />				
				</frame>
			</sprite>
			
			<sprite name="ammo_anim">
				<frame>
					<pause/>
				</frame>
				<frame name="anim_start">					
					<callback function="set_fire_rate" />	
					<callback function="show_weapon_mods" />
				</frame>	
			</sprite>

			<sprite name="ammo_spr">
				<frame>				
					<place object="clip_spr" at="20 30 0" size="50 50" />				
					<place object="fire_rate_spr" at="10 50 0" align="0 1" size="@model_scale" />
					<place object="weapon_spr" at="120 32 0" align="0.5 0.5" size="10 10" />				
					<place object="weapon_frame" at="1 0 1" />
				</frame>
			</sprite>
			
			<layout name="ammo_layout" size="800 600">
				<put object="ammo_spr" at="@ammo_at" at2="@ammo_at2" />
				<put object="ammo_anim" at="@ammo_at" at2="@ammo_at2" />
			</layout>

			<frame>
				<place object="ammo_spr" size="@ammo_size" align="1 1" />	
				<place object="ammo_anim" size="@ammo_size" align="1 1" />	
				<place object="ammo_layout" />
				<!--<place object="flash_anim" size="0.16 0.05" align="1 1" />-->
			</frame>		
		</movie>
	</xdefine>
	
	@hud_weapons( scar_l )
	@hud_weapons( scar_h )
	@hud_weapons( masada )
	@hud_weapons( masada_cqbr )
	@hud_weapons( masada_ak )
	@hud_weapons( masada_ak_cqbr )
	@hud_weapons( masada_spr )
	@hud_weapons( meusoc )
	@hud_weapons( m8 )
	@hud_weapons( crye )
	@hud_weapons( mp5 )
	@hud_weapons( mp5a4 )
	@hud_weapons( m8_compact )
	@hud_weapons( glock )
	@hud_weapons( beretta )	
	@hud_weapons( saw )	
	@hud_weapons( barrett )
	@hud_weapons( rx4 )
	@hud_weapons( g36 )
	@hud_weapons( g36_compact )
	@hud_weapons( m14 )
	@hud_weapons( msg90 )
	@hud_weapons( m416 )
	@hud_weapons( hk21e )
	@hud_weapons( predator )
	@hud_weapons( rpg7 )
	@hud_weapons( m32 )
	@hud_weapons( mk45 )
	@hud_weapons( m240 )

	<!----------------------------------------------------------------------------------------------------------------------------------->	
	<xdefine name="hud_weapons_gl(name)">
		<movie name="ammo_gl_$name" materials="/data/objects/gui/hud_new/materials.xml">		
			@common_objects		
			<unit unit="hud_$name" name="weapon_unit" scale="70 20" color="255 255 255" alpha="150">		
				<connect_material material="aimlines" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight_gl" color="color" alpha="opacity" start_alpha="255" />
			</unit>
					
			<sprite name="text_clip_spr">
				<frame>
					<clone object="header_text" name="text_clip" />
					<place object="text_clip" at="3 3 0" align="0.5 0.5" />
					<set_text object="text_clip" font_size="14" text="6" />	
					<set_material object="text_clip" material="txt_white" />
				</frame>
			</sprite>
			<sprite name="text_tot_spr">
				<frame>
					<clone object="normal_text" name="text_tot" />
					<place object="text_tot" at="3 3 0" align="0.5 0.5"	/>	
					<set_text object="text_tot" text="6" />
					<set_material object="text_tot" material="txt_white" />
				</frame>
			</sprite>
			<sprite name="clip_spr">
				<frame>
					<place object="text_clip_spr" at="0 0 0" align="0.5 0.5" size="10" />
					
					<clone object="header_text" name="text_sep" />
					<place object="text_sep" at="10 -3 0" align="0.5 0.5" />	
					<set_text object="text_sep" text="/" />
					<set_material object="text_sep" material="txt_white" />
					
					<place object="text_tot_spr" at="25 0 0" align="0.5 0.5" size="10" />
				</frame>
			</sprite>
			
			<sprite name="weapon_spr">
				<frame>					
					<place object="weapon_unit" at="10 10 -1" align="0.5 0.5" />
					<remove object="weapon_unit" />						
				</frame>
			</sprite>
			
			<sprite name="ammo_anim">
				<frame>
					<pause/>
				</frame>
				<frame name="anim_start">					
					<callback function="show_weapon_mods" />
				</frame>	
			</sprite>

			<sprite name="ammo_spr">
				<frame>				
					<place object="clip_spr" at="20 30 0" size="50 50" />				
					<place object="weapon_spr" at="120 32 0" align="0.5 0.5" size="10 10" />				
					<place object="weapon_frame" at="1 0 1" />
				</frame>
			</sprite>
			
			<layout name="ammo_layout" size="800 600">
				<put object="ammo_spr" at="@ammo_at" at2="@ammo_at2" />
				<put object="ammo_anim" at="@ammo_at" at2="@ammo_at2" />
			</layout>
			
			<frame>
				<place object="ammo_spr" size="@ammo_size" align="1 1" />	
				<place object="ammo_anim" size="@ammo_size" align="1 1" />	
				<place object="ammo_layout" />
				<!--<place object="flash_anim" size="0.16 0.05" align="1 1" />-->
			</frame>		
		</movie>
	</xdefine>
	
	@hud_weapons_gl(crye)
	@hud_weapons_gl(m8)
	@hud_weapons_gl(scar_l)
	@hud_weapons_gl(scar_h)
	@hud_weapons_gl(rx4)
	@hud_weapons_gl(masada)
	@hud_weapons_gl(masada_ak)
	
	
	<xdefine name="hud_weapons_grenade( name )">		
		<movie name="ammo_$name_grenade" materials="/data/objects/gui/hud_new/materials.xml">		
			@common_objects		
			<unit unit="hud_$name_grenade" name="weapon_unit" scale="36 18" color="255 255 255" alpha="150">		
				<connect_material material="aimlines" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight" color="color" alpha="opacity" start_alpha="255" />
				<connect_material material="aimlines_highlight_gl" color="color" alpha="opacity" start_alpha="255" />
			</unit>
			
			<sprite name="text_tot_spr">
				<frame>
					<clone object="header_text" name="text_tot" />
					<place object="text_tot" at="3 3 0" align="0.5 0.5"	/>	
					<set_text object="text_tot" text="6" />
					<set_material object="text_tot" material="txt_white" />
				</frame>
			</sprite>
			<sprite name="clip_spr">
				<frame>
					<!--<place object="text_clip_spr" at="0 0 0" align="0.5 0.5" size="10" />-->
					<place object="text_tot_spr" at="0 0 0" align="0.5 0.5" size="10" />
				</frame>
			</sprite>
			
			<sprite name="weapon_spr">
				<frame>					
					<place object="weapon_unit" at="10 10 -1" align="0.5 0.5" />					
				</frame>
			</sprite>
			
			<sprite name="ammo_anim">
				<frame>
					<pause/>
				</frame>
				<frame name="anim_start">					
					<callback function="show_weapon_mods" />
				</frame>	
			</sprite>

			<sprite name="ammo_spr">
				<frame>				
					<place object="clip_spr" at="20 30 0" size="50 50" />				
					<place object="weapon_spr" at="120 32 0" align="0.5 0.5" size="10 10" />				
					<place object="weapon_frame" at="1 0 1" />
				</frame>
			</sprite>
			
			<layout name="ammo_layout" size="800 600">
				<put object="ammo_spr" at="@ammo_at" at2="@ammo_at2" />
				<put object="ammo_anim" at="@ammo_at" at2="@ammo_at2" />
			</layout>
			
			<frame>
				<place object="ammo_spr" size="@ammo_size" align="1 1" />	
				<place object="ammo_anim" size="@ammo_size" align="1 1" />	
				<place object="ammo_layout" />
				<!--<place object="flash_anim" size="0.16 0.05" align="1 1" />-->
			</frame>		
		</movie>
	</xdefine>
	
	@hud_weapons_grenade( frag )
	@hud_weapons_grenade( smoke )
			
</gui>
