//===========================================================================
// 
// Just another Warcraft III map
// 
//   Warcraft III map script
//   Generated by the Warcraft III World Editor
//   Date: Sat Jan 07 07:16:40 2012
//   Map Author: Unknown
// 
//===========================================================================

//***************************************************************************
//*
//*  Global Variables
//*
//***************************************************************************

globals
	// Generated
	trigger				 gg_trg_Entity			  = null
	trigger				 gg_trg_Static_Escaper_Data = null
	trigger				 gg_trg_Escaper			 = null
	trigger				 gg_trg_ObjectSystem		= null
	trigger				 gg_trg_Vector3			 = null
	trigger				 gg_trg_OptimizedMaths	  = null
endglobals

function InitGlobals takes nothing returns nothing
endfunction

//***************************************************************************
//*
//*  Unit Creation
//*
//***************************************************************************

//===========================================================================
function CreateUnitsForPlayer0 takes nothing returns nothing
	local player p = Player(0)
	local unit u
	local integer unitID
	local trigger t
	local real life

	set u = CreateUnit( p, 'Hmkg', 70.3, -173.2, 221.381 )
	call SetHeroLevel( u, 10, false )
	set u = CreateUnit( p, 'Hmkg', -136.8, -237.4, 9.152 )
	call SetHeroLevel( u, 10, false )
endfunction

//===========================================================================
function CreateUnitsForPlayer1 takes nothing returns nothing
	local player p = Player(1)
	local unit u
	local integer unitID
	local trigger t
	local real life

	set u = CreateUnit( p, 'Hblm', -1194.9, -1227.8, 337.690 )
	set u = CreateUnit( p, 'hpea', -294.4, 140.4, 311.373 )
	set u = CreateUnit( p, 'hpea', -395.9, 32.9, 331.523 )
	set u = CreateUnit( p, 'hpea', -450.7, -2.3, 102.044 )
	set u = CreateUnit( p, 'hfoo', 343.3, 227.5, 6.570 )
	set u = CreateUnit( p, 'hpea', -488.7, 29.8, 270.733 )
	set u = CreateUnit( p, 'hpea', -448.4, 132.1, 102.561 )
	set u = CreateUnit( p, 'hpea', -326.9, 259.4, 149.869 )
	set u = CreateUnit( p, 'hpea', -262.2, 227.5, 313.296 )
	set u = CreateUnit( p, 'hpea', -217.1, 125.5, 30.884 )
	set u = CreateUnit( p, 'hpea', -168.6, 96.2, 125.182 )
	set u = CreateUnit( p, 'hpea', -109.9, 172.3, 91.486 )
	set u = CreateUnit( p, 'hpea', -102.7, 270.2, 357.319 )
	set u = CreateUnit( p, 'hfoo', 384.4, 168.9, 213.163 )
	set u = CreateUnit( p, 'hfoo', 424.5, 105.9, 56.570 )
	set u = CreateUnit( p, 'hfoo', 466.2, 11.4, 97.144 )
	set u = CreateUnit( p, 'hrif', 465.7, -788.2, 71.930 )
	set u = CreateUnit( p, 'hrif', 423.8, -847.9, 350.387 )
	set u = CreateUnit( p, 'hrif', 346.0, -911.1, 327.820 )
	set u = CreateUnit( p, 'hrif', 235.6, -956.3, 337.730 )
	set u = CreateUnit( p, 'hrif', 154.7, -980.7, 359.945 )
	set u = CreateUnit( p, 'hrif', 85.9, -995.5, 308.451 )
endfunction

//===========================================================================
function CreatePlayerBuildings takes nothing returns nothing
endfunction

//===========================================================================
function CreatePlayerUnits takes nothing returns nothing
	call CreateUnitsForPlayer0(  )
	call CreateUnitsForPlayer1(  )
endfunction

//===========================================================================
function CreateAllUnits takes nothing returns nothing
	call CreatePlayerBuildings(  )
	call CreatePlayerUnits(  )
endfunction

//***************************************************************************
//*
//*  Triggers
//*
//***************************************************************************

//===========================================================================
// Trigger: Entity
//===========================================================================
//TESH.scrollpos=0
//TESH.alwaysfold=0
package Test
	
	function fooo()
		ExecuteFunc( "blub" )
		
	function blub()
		int i = 0
			
	function foo()
		
		for int i = 0 to 4
			ExecuteFunc( "blah" + I2S(i))
			
	function blah1()
		ExecuteFunc( "blub" )
		
	function blah2()
		ExecuteFunc( "blub" )
		
	function blah3214()
		ExecuteFunc( "blub" )
		
	init
		fooo()

endpackage


//===========================================================================
function InitCustomTriggers takes nothing returns nothing
	call InitTrig_Entity(  )
	call InitTrig_Escaper(  )
	call InitTrig_Vector3(  )
endfunction

//***************************************************************************
//*
//*  Players
//*
//***************************************************************************

function InitCustomPlayerSlots takes nothing returns nothing

	// Player 0
	call SetPlayerStartLocation( Player(0), 0 )
	call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
	call SetPlayerRacePreference( Player(0), RACE_PREF_HUMAN )
	call SetPlayerRaceSelectable( Player(0), true )
	call SetPlayerController( Player(0), MAP_CONTROL_USER )

endfunction

function InitCustomTeams takes nothing returns nothing
	// Force: TRIGSTR_002
	call SetPlayerTeam( Player(0), 0 )

endfunction

//***************************************************************************
//*
//*  Main Initialization
//*
//***************************************************************************

//===========================================================================
function main takes nothing returns nothing
	call SetCameraBounds( -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
	call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl" )
	call NewSoundEnvironment( "Default" )
	call SetAmbientDaySound( "LordaeronSummerDay" )
	call SetAmbientNightSound( "LordaeronSummerNight" )
	call SetMapMusic( "Music", true, 0 )
	call CreateAllUnits(  )
	call InitBlizzard(  )
	call InitGlobals(  )
	call InitCustomTriggers(  )

endfunction

//***************************************************************************
//*
//*  Map Configuration
//*
//***************************************************************************

function config takes nothing returns nothing
	call SetMapName( "Just another Warcraft III map" )
	call SetMapDescription( "Nondescript" )
	call SetPlayers( 1 )
	call SetTeams( 1 )
	call SetGamePlacement( MAP_PLACEMENT_USE_MAP_SETTINGS )

	call DefineStartLocation( 0, 0.0, -256.0 )

	// Player setup
	call InitCustomPlayerSlots(  )
	call SetPlayerSlotAvailable( Player(0), MAP_CONTROL_USER )
	call InitGenericPlayerSlots(  )
endfunction

