// sample animation script
//
//
// commands:
//	Animate <panel name> <variable> <target value> <interpolator> <start time> <duration>
//		variables:
//			FgColor
//			BgColor
//			Position
//			Size
//			Blur		(hud panels only)
//			TextColor	(hud panels only)
//			Ammo2Color	(hud panels only)
//			Alpha		(hud weapon selection only)
//			SelectionAlpha  (hud weapon selection only)
//			TextScan	(hud weapon selection only)
//
//		interpolator:
//			Linear
//			Accel - starts moving slow, ends fast
//			Deaccel - starts moving fast, ends slow
//
//	RunEvent <event name> <start time>
//		starts another even running at the specified time
//
//	StopEvent <event name> <start time>
//		stops another event that is current running at the specified time
//
//	StopAnimation <panel name> <variable> <start time>
//		stops all animations refering to the specified variable in the specified panel
//
//	StopPanelAnimations <panel name> <start time>
//		stops all active animations operating on the specified panel
//
//
// Useful game console commands:
//	cl_Animationinfo <hudelement name> or <panelname> 
//		displays all the animatable variables for the hud element
//


event LevelInit
{
}

event WeaponPickup
{
	StopEvent OpenWeaponSelectionMenu	0.0
	StopEvent CloseWeaponSelectionMenu	0.0

	// make the display visible
	Animate HudWeaponSelection Alpha 		"255" Linear 0.0 0.01
	Animate HudWeaponSelection SelectionAlpha 	"255" Linear 0.0 0.01
	Animate HudWeaponSelection FgColor		"0 0 0 0" Linear 0.0 0.01
	Animate HudWeaponSelection TextColor	"0 0 0 0" Linear 0.0 0.01
	Animate HudWeaponSelection TextScan		"0" Linear 0.0 0.01

	// draw the weapon icon once the area has fully grown
	Animate HudWeaponSelection FgColor		"FgColor" Linear 0.4 0.1
	Animate HudWeaponSelection TextColor	"BrightFg" Linear 0.4 0.1
	Animate HudWeaponSelection TextScan		"1" 	  Linear 0.4 0.4
	
	// make the text all blinky
	Animate HudWeaponSelection TextColor	"FgColor" Accel 0.8 0.4
	Animate HudWeaponSelection TextColor	"BrightFg" Linear 1.2 0.1
	Animate HudWeaponSelection TextColor	"FgColor" Deaccel 1.3 0.4
	Animate HudWeaponSelection TextColor	"BrightFg" Linear 1.7 0.1
	Animate HudWeaponSelection TextColor	"0 0 0 0" Deaccel 1.8 1.5
	
	// hide the whole thing
	runevent CloseWeaponSelectionMenu	2.0
}

event OpenWeaponSelectionMenu
{
	StopEvent CloseWeaponSelectionMenu	0.0
	StopEvent WeaponPickup				0.0

	// make the display visible
	Animate HudWeaponSelection Alpha 		"128"		Linear 0.0 0.1
	Animate HudWeaponSelection SelectionAlpha 	"255"	Linear 0.0 0.1
	Animate HudWeaponSelection FgColor		"FgColor"	Linear 0.0 0.1
	Animate HudWeaponSelection TextColor	"BrightFg"	Linear 0.0 0.1
	Animate HudWeaponSelection TextScan		"1" 		Linear 0.0 0.1
}

event CloseWeaponSelectionMenu
{
	// hide the whole thing
	Animate HudWeaponSelection FgColor		"0 0 0 0"		Linear 0.4 0.8
	Animate HudWeaponSelection TextColor		"0 0 0 0"	Linear 0.4 0.8
	Animate HudWeaponSelection Alpha		"0" 			Linear 0.0 0.8
	Animate HudWeaponSelection SelectionAlpha 	"0" 		Linear 0.8 0.8
}

event SuitAuxPowerMax
{
	// hide the suit power
	Animate HudSuitPower BgColor		"0 0 0 0"		Linear 0.0 0.4
	Animate HudSuitPower AuxPowerColor	"0 0 0 0"		Linear 0.0 0.4
}

event SuitAuxPowerNotMax
{
	// show suit power
	Animate HudSuitPower BgColor		"BgColor"		Linear 0.0 0.4
	Animate HudSuitPower AuxPowerColor	"255 220 0 220"		Linear 0.0 0.4
}

event SuitAuxPowerDecreasedBelow25
{
	// make color red
	Animate HudSuitPower AuxPowerColor	"255 0 0 220"		Linear 0.0 0.4
}

event SuitAuxPowerIncreasedAbove25
{
	// make colr bright
	Animate HudSuitPower AuxPowerColor	"255 220 0 220"		Linear 0.0 0.4
}

event SuitFlashlightOn
{
	Animate HudFlashlight TextColor		"255 220 0 255"	Linear 0.0 0.1
	Animate HudFlashlight TextColor		"255 220 0 160"	Deaccel 0.1 0.75
	Animate HudFlashlight BgColor		"BgColor"	Linear 0.0 0.75
}

event SuitFlashlightOff
{
	StopEvent SuitFlashlightOn	0.0
	Animate HudFlashlight TextColor		"0 0 0 0"	Linear 0.0 0.4
	Animate HudFlashlight BgColor		"0 0 0 0"	Linear 0.0 0.4
}

event HudTakeDamageFront
{
}

event HudTakeDamageLeft
{
	Animate HudDamageIndicator DmgColorLeft		"255 88 0 200"	Linear 0.0 0.0
	Animate HudDamageIndicator DmgColorLeft		"255 0 0 200"	Linear 0.0 0.1
	Animate HudDamageIndicator DmgColorLeft		"255 0 0 0"		Deaccel 0.1 0.5
}

event HudTakeDamageRight
{
	Animate HudDamageIndicator DmgColorRight		"255 88 0 200"	Linear 0.0 0.0
	Animate HudDamageIndicator DmgColorRight		"255 0 0 200"	Linear 0.0 0.1
	Animate HudDamageIndicator DmgColorRight		"255 0 0 0"		Deaccel 0.1 0.5
}

event HudTakeDamageBehind
{
	RunEvent HudTakeDamageLeft	0.0
	RunEvent HudTakeDamageRight	0.0
}

event HealthIncreasedAbove20
{
	StopEvent	HealthLoop  0.0
	StopEvent	HealthPulse 0.0

	Animate	HudHealth	BgColor	"BgColor"	Linear	0.0	0.0
	
	Animate	HudHealth	TextColor "FgColor" Linear 0.0 0.04
	Animate	HudHealth	FgColor   "FgColor" Linear 0.0 0.03
	
	Animate	HudHealth		Blur		"3"			Linear	0.0		0.1
	Animate	HudHealth		Blur		"0"			Deaccel	0.1		2.0
}

event HealthIncreasedBelow20
{
	Animate HudHealth	FgColor		"BrightFg"	Linear	0.0		0.25
	Animate HudHealth	FgColor		"FgColor"		Linear	0.3		0.75
	
	Animate HudHealth		Blur		"3"			Linear	0.0		0.1
	Animate HudHealth		Blur		"0"			Deaccel	0.1		2.0
}

event SuitPowerIncreasedAbove20
{
	StopEvent	SuitLoop 0.0
	StopEvent	SuitPulse 0.0

	Animate	HudSuit	BgColor	"BgColor"	Linear	0.0	0.0
	
	Animate	HudSuit 	TextColor	"FgColor"	Linear 0.0 0.05
	Animate	HudSuit	FgColor	"FgColor"	Linear 0.0 0.05
	
	Animate	HudSuit		Blur		"3"			Linear	0.0		0.1
	Animate	HudSuit		Blur		"0"			Deaccel	0.1		2.0
}


event SuitPowerIncreasedBelow20
{
	Animate HudSuit		FgColor		"BrightFg"	Linear	0.0		0.25
	Animate HudSuit		FgColor		"FgColor"		Linear	0.3		0.75
	
	Animate HudSuit		Blur		"3"			Linear	0.0		0.1
	Animate HudSuit		Blur		"0"			Deaccel	0.1		2.0
}

event TestMovement
{
	Animate HudHealth	Position	"256 120"	Linear	0.0		2.0
	Animate HudHealth	Size		"128 24"	Linear	0.0		1.5
}

event HealthDamageTaken
{
	Animate HudHealth	FgColor		"BrightFg"	Linear	0.0		0.25
	Animate HudHealth	FgColor		"FgColor"		Linear	0.3		0.75
	
	Animate HudHealth		Blur		"3"			Linear	0.0		0.1
	Animate HudHealth		Blur		"0"			Deaccel	0.1		2.0
	
	Animate HudHealth TextColor		"BrightFg"	Linear	0.0		0.1
	Animate HudHealth	TextColor		"FgColor"		Deaccel	0.1		1.2
}

event SuitDamageTaken
{
	Animate HudSuit		FgColor	"BrightFg"	Linear	0.0		0.25
	Animate HudSuit		FgColor	"FgColor"		Linear	0.3		0.75
	
	Animate HudSuit		Blur		"3"			Linear	0.0		0.1
	Animate HudSuit		Blur		"0"			Deaccel	0.1		2.0
	
	Animate HudSuit		TextColor	"BrightFg"	Linear	0.0		0.1
	Animate HudSuit		TextColor	"FgColor"		Deaccel	0.1		1.2
}

// health has been damaged to below 20%
event HealthLow
{
	StopEvent HealthDamageTaken	0.0
	StopEvent HealthPulse	0.0
	StopEvent HealthLoop	0.0	
	
	Animate HudHealth	BgColor		"DamagedBg"		Linear	0.0		0.1
	Animate HudHealth	BgColor		"BgColor"		Deaccel	0.1		1.75
	
	Animate HudHealth	FgColor		"BrightFg"	Linear	0.0		0.2
	Animate HudHealth	FgColor		"DamagedFg"		Linear	0.2		1.2
	
	Animate HudHealth TextColor		"BrightFg"	Linear	0.0		0.1
	Animate HudHealth	TextColor		"DamagedFg"		Linear	0.1		1.2
	
	Animate HudHealth		Blur		"5"			Linear	0.0		0.1
	Animate HudHealth		Blur		"3"			Deaccel	0.1		0.9

	RunEvent HealthPulse	1.0
}

event HealthPulse
{
	Animate HudHealth		Blur		"5"			Linear	0.0		0.1
	Animate HudHealth		Blur		"2"			Deaccel	0.1		0.8
	Animate HudHealth		TextColor	"BrightDamagedFg"	Linear	0.0		0.1
	Animate HudHealth		TextColor	"DamagedFg"		Deaccel	0.1		0.8
	Animate HudHealth		BgColor	"100 0 0 80"		Linear	0.0		0.1
	Animate HudHealth		BgColor	"BgColor"		Deaccel	0.1		0.8

	RunEvent HealthLoop	0.8
}

// call to loop HealthPulse
event HealthLoop
{
	RunEvent HealthPulse 0.0
}


// suit armor has been damaged to below 20%
event SuitArmorLow
{
	StopEvent SuitDamageTaken 0.0
	StopEvent SuitPulse	0.0
	StopEvent SuitLoop	0.0
	
	Animate HudSuit	BgColor		"DamagedBg"		Linear	0.0		0.1
	Animate HudSuit	BgColor		"BgColor"		Deaccel	0.1		1.75
	
	Animate HudSuit	FgColor		"BrightFg"	Linear	0.0		0.2
	Animate HudSuit	FgColor		"DamagedFg"		Linear	0.2		1.2
	
	Animate HudSuit	TextColor		"BrightFg"	Linear	0.0		0.1
	Animate HudSuit	TextColor		"DamagedFg"		Linear	0.1		1.2
	
	Animate HudSuit		Blur		"5"			Linear	0.0		0.1
	Animate HudSuit		Blur		"3"			Deaccel	0.1		0.9
	
	RunEvent SuitPulse	1.0
}

event SuitPulse
{
	Animate HudSuit		Blur		"5"			Linear	0.0		0.1
	Animate HudSuit		Blur		"2"			Deaccel	0.1		0.8
	Animate HudSuit		TextColor	"BrightDamagedFg"	Linear	0.0		0.1
	Animate HudSuit		TextColor	"DamagedFg"		Deaccel	0.1		0.8
	Animate HudSuit		BgColor	"100 0 0 80"	Linear	0.0		0.1
	Animate HudSuit		BgColor	"BgColor"		Deaccel	0.1		0.8
	RunEvent SuitLoop	0.8
}

event SuitLoop
{
	RunEvent SuitPulse 0.0
}

// ammo has been picked up
event AmmoIncreased
{
	Animate HudAmmo		FgColor	"BrightFg"		Linear	0.0	0.15
	Animate HudAmmo		FgColor	"FgColor"		Deaccel	0.15	1.5
	Animate HudAmmo		Blur		"5"			Linear	0.0	0.0 
	Animate HudAmmo		Blur		"0"			Accel		0.01	1.5 
}

// ammo has been decreased, but there is still some remaining
event AmmoDecreased
{
	StopEvent AmmoIncreased	0.0
	
	Animate HudAmmo		Blur		"7"			Linear	0.0	0.0
	Animate HudAmmo		Blur		"0"			Deaccel	0.1	1.5
	
	Animate HudAmmo		TextColor	"BrightFg"		Linear	0.0	0.1
	Animate HudAmmo		TextColor	"FgColor"		Deaccel	0.1	0.75
}

// primary ammo is zero
event AmmoEmpty
{
	Animate Hudammo	FgColor		"BrightDamagedFg"	Linear	0.0	0.2
	Animate Hudammo	FgColor		"DamagedFg"		Accel		0.2	1.2		
}

// ammo2 is the total ammo for a weapon that uses clip ammo
event Ammo2Increased
{
	Animate Hudammo	ammo2color		"BrightFg"		Linear	0.0	0.2
	Animate Hudammo	ammo2color		"FgColor"		Accel		0.2	1.2		
}

// total ammo has been decreased, but there is still some remaining
event Ammo2Decreased
{
	Animate Hudammo	ammo2color		"BrightFg"		Linear	0.0	0.2
	Animate Hudammo	ammo2color		"FgColor"		Accel		0.2	1.2		
}

// total ammo is zero
event Ammo2Empty
{
	Animate Hudammo	ammo2color		"BrightDamagedFg"	Linear	0.0	0.2
	Animate Hudammo	ammo2color		"DamagedFg"		Accel		0.2	1.2		
}

event AmmoSecondaryIncreased
{
	Animate HudAmmoSecondary		FgColor	"BrightFg"		Linear	0.0	0.15
	Animate HudAmmoSecondary		FgColor	"FgColor"		Deaccel	0.15	1.5
	Animate HudAmmoSecondary		Blur		"5"			Linear	0.0	0.0 
	Animate HudAmmoSecondary		Blur		"0"			Accel		0.01	1.5 	
}

event AmmoSecondaryDecreased
{
	StopEvent AmmoSecondaryIncreased	0.0
	
	Animate HudAmmoSecondary		Blur		"7"			Linear	0.0	0.0
	Animate HudAmmoSecondary		Blur		"0"			Deaccel	0.1	1.5
	
	Animate HudAmmoSecondary		TextColor	"BrightFg"		Linear	0.0	0.1
	Animate HudAmmoSecondary		TextColor	"FgColor"		Deaccel	0.1	0.75
}

event AmmoSecondaryEmpty
{
	Animate HudAmmoSecondary		FgColor		"BrightDamagedFg"	Linear	0.0	0.2
	Animate HudAmmoSecondary		FgColor		"DamagedFg"		Accel		0.2	1.2
	Animate HudAmmoSecondary		Blur		"7"			Linear	0.0	0.0
	Animate HudAmmoSecondary		Blur		"0"			Deaccel	0.1	1.5

}

// current weapon has been changed
event WeaponChanged
{
	StopEvent AmmoIncreased	0.0
	StopEvent AmmoDecreased	0.0
	
	Animate HudAmmo		BgColor		"250 220 0 80"	Linear	0.0		0.1
	Animate HudAmmo		BgColor		"BgColor"		Deaccel	0.1		1.0
	Animate HudAmmo		FgColor		"BrightFg"		Linear	0.0		0.1
	Animate HudAmmo		FgColor		"FgColor"		Linear	0.2		1.5
}

// current weapon has been changed (during restore, so no blinky)
event WeaponChangedRestore
{
	StopEvent AmmoIncreased	0.0
	StopEvent AmmoDecreased	0.0
	
	Animate HudAmmo		BgColor		"BgColor"		Deaccel	0.0	0.0
	Animate HudAmmo		FgColor		"FgColor"		Linear	0.0	0.0
}

// ran if we just changed to a weapon that needs clip ammo
event WeaponUsesClips
{
	Animate HudAmmo		Position	"r150 432"	Deaccel	0.0		0.4
	Animate HudAmmo		Size		"132 36"	Deaccel	0.0		0.4
}

// ran if we just changed to a weapon that does not use clip ammo
event WeaponDoesNotUseClips
{
	Animate HudAmmo		Position	"r118 432"	Deaccel	0.0		0.4
	Animate HudAmmo		Size		"100 36"	Deaccel	0.0		0.4
}

event WeaponUsesSecondaryAmmo
{
	StopAnimation 	HudAmmo Position 0.0
	StopAnimation 	HudAmmo Size 0.0
	StopPanelAnimations HudAmmoSecondary 0.0

	Animate HudAmmoSecondary	BgColor		"250 220 0 60"	Linear	0.0		0.1
	Animate HudAmmoSecondary	BgColor		"BgColor"		Deaccel	0.1		1.0
	Animate HudAmmoSecondary	FgColor		"BrightFg"	Linear	0.0		0.1
	Animate HudAmmoSecondary	FgColor		"FgColor"		Linear	0.2		1.5

	Animate HudAmmo		Position	"r222 432"	Deaccel	0.0		0.5
	Animate HudAmmo		Size		"132 36"	Deaccel	0.0		0.4
}

event WeaponUsesSecondaryAmmoRestore
{
	StopAnimation 	HudAmmo Position 0.0
	StopAnimation 	HudAmmo Size 0.0
	StopPanelAnimations HudAmmoSecondary 0.0

	Animate HudAmmoSecondary	BgColor		"BgColor"		Deaccel	0.0	0.0
	Animate HudAmmoSecondary	FgColor		"FgColor"		Linear	0.0	0.0

	Animate HudAmmo		Position	"r222 432"	Deaccel	0.0	0.0
	Animate HudAmmo		Size		"132 36"	Deaccel	0.0	0.0
}

event WeaponDoesNotUseSecondaryAmmo
{
	StopPanelAnimations	HudAmmoSecondary 	0.0
	Animate HudAmmoSecondary	FgColor		"0 0 0 0"	Linear	0.0		0.4
	Animate HudAmmoSecondary	BgColor		"0 0 0 0"	Linear	0.0		0.4
//	Animate HudAmmo		Position	"r150 432"	Deaccel	0.0		0.5
}

event WeaponDoesNotUseSecondaryAmmoRestore
{
	StopPanelAnimations	HudAmmoSecondary 	0.0
	Animate HudAmmoSecondary	FgColor		"0 0 0 0"	Linear	0.0	0.0
	Animate HudAmmoSecondary	BgColor		"0 0 0 0"	Linear	0.0	0.0
}
