iw6-lui/lui/mp_hud/helicopterpilotoverlayhud.dec.lua
2024-09-12 17:25:45 +02:00

752 lines
18 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = 512
f0_local1 = 128
f0_local2 = 512
local f0_local3 = 128
local f0_local4 = 64
local f0_local5 = 64
local f0_local6 = 32
local f0_local7 = 64
local f0_local8 = 32
local f0_local9 = 64
local f0_local10 = 192
local f0_local11 = 192
local f0_local12 = 16
local f0_local13 = 16
local f0_local14 = 256
local f0_local15 = 256
local f0_local16 = 192
local f0_local17 = 192
local f0_local18 = 192
local f0_local19 = 192
local f0_local20 = function ( f1_arg0, f1_arg1 )
if f1_arg1.value > 0 then
f1_arg0:animateToState( "active", 0 )
if not f1_arg0.played_flash then
local f1_local0 = f1_arg0:getFirstDescendentById( "heli_pilot_flash_image_id" )
local f1_local1 = MBh.AnimateSequence( {
{
"active",
0
},
{
"closing",
500
}
} )
f1_local1( f1_local0 )
f1_arg0.played_flash = true
end
local f1_local0 = f1_arg0:getFirstDescendentById( "heli_pilot_reticle_image_id" )
local f1_local1 = f1_arg0:getFirstDescendentById( "heli_pilot_altitude_back_image_id" )
local f1_local2 = f1_arg0:getFirstDescendentById( "heli_pilot_speed_back_image_id" )
local f1_local3 = f1_arg0:getFirstDescendentById( "heli_pilot_reticle_zoomed_image_id" )
local f1_local4 = f1_arg0:getFirstDescendentById( "heli_pilot_flare_back_image_id" )
local f1_local5 = f1_arg0:getFirstDescendentById( "heli_pilot_mg_back_image_id" )
if f1_arg1.value == 1 then
f1_local3:animateToState( "default", 0 )
local f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
150
},
{
"active",
250
}
} )
f1_local6( f1_local0 )
f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
400
},
{
"active",
250
}
} )
f1_local6( f1_local1 )
f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
350
},
{
"active",
250
}
} )
f1_local6( f1_local2 )
f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
250
},
{
"active",
250
}
} )
f1_local6( f1_local4 )
f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
250
},
{
"active",
250
}
} )
f1_local6( f1_local5 )
elseif f1_arg1.value == 2 then
f1_local0:animateToState( "default", 350 )
f1_local1:animateToState( "default", 350 )
f1_local2:animateToState( "default", 350 )
f1_local4:animateToState( "default", 0 )
f1_local5:animateToState( "default", 0 )
local f1_local6 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
150
},
{
"active",
250
}
} )
f1_local6( f1_local3 )
end
else
f1_arg0.played_flash = false
f1_arg0:animateToState( "default", 0 )
end
end
local f0_local21 = function ()
local f2_local0 = RegisterMaterial( "apache_ammo_mp" )
local self = LUI.UIElement.new()
self.id = "flare_ammo_container"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = -5,
height = f0_local12 * 2,
width = f0_local13,
spacing = 0
} )
self:animateToState( "default", 0 )
local f2_local2 = LUI.UIImage.new()
f2_local2.id = "flare_ammo1"
f2_local2:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 2,
right = 0,
height = f0_local12,
width = f0_local13,
material = f2_local0,
alpha = 1
} )
f2_local2:animateToState( "default", 0 )
f2_local2:registerAnimationState( "inactive", {
alpha = 0
} )
local f2_local3 = LUI.UIImage.new()
f2_local3.id = "flare_ammo2"
f2_local3:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 12,
right = 0,
height = f0_local12,
width = f0_local13,
material = f2_local0,
alpha = 1
} )
f2_local3:animateToState( "default", 0 )
f2_local3:registerAnimationState( "inactive", {
alpha = 0
} )
self:addElement( f2_local2 )
self:addElement( f2_local3 )
return self
end
local f0_local22 = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg0:getChildById( "flare_ammo_container" )
if f3_arg1.value < 2 then
local f3_local1 = f3_local0:getChildById( "flare_ammo" .. f3_arg1.value + 1 )
local f3_local2 = MBh.AnimateSequence( {
{
"inactive",
50
},
{
"inactive",
50
},
{
"default",
0
},
{
"default",
50
},
{
"inactive",
50
},
{
"inactive",
50
},
{
"default",
0
},
{
"default",
50
},
{
"inactive",
150
}
} )
f3_local2( f3_local1 )
f3_local1:animateToState( "inactive", 250 )
else
local f3_local1 = f3_local0:getChildById( "flare_ammo1" )
f3_local1:animateToState( "default", 0 )
local f3_local2 = f3_local0:getChildById( "flare_ammo2" )
f3_local2:animateToState( "default", 0 )
end
end
local f0_local23 = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg0:getChildById( "heli_pilot_warn_left_image_id" )
local f4_local1 = f4_arg0:getChildById( "heli_pilot_warn_right_image_id" )
local f4_local2 = MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
250
},
{
"default",
250
},
{
"active",
250
},
{
"default",
250
},
{
"active",
250
},
{
"default",
250
}
} )
if f4_arg1.value == 1 then
f4_local2( f4_local0 )
f4_local2( f4_local1 )
elseif f4_arg1.value == 2 then
f4_local2( f4_local1 )
elseif f4_arg1.value == 3 then
f4_local2( f4_local0 )
end
end
local f0_local24 = function ( f5_arg0, f5_arg1 )
local f5_local0 = f5_arg0:getChildById( "heli_pilot_flare_back_image_id" )
local f5_local1 = f5_local0:getChildById( "heli_pilot_flare_text_id" )
local f5_local2 = f5_local0:getChildById( "heli_pilot_zoom_text_id" )
local f5_local3 = f5_arg0:getChildById( "heli_pilot_mg_back_image_id" )
local f5_local4 = f5_local3:getChildById( "heli_pilot_mg_text_id" )
f5_local1:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_POP_FLARE" ) )
f5_local2:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_ZOOM" ) )
f5_local4:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_FIRE" ) )
end
LUI.MenuBuilder.registerType( "heliPilotOverlayDef", function ()
local f6_local0 = RegisterMaterial( "apache_altitude_back_mp" )
local f6_local1 = RegisterMaterial( "apache_speed_back_mp" )
local f6_local2 = RegisterMaterial( "apache_reticle_mp" )
local f6_local3 = RegisterMaterial( "apache_flare_back_mp" )
local f6_local4 = RegisterMaterial( "apache_mg_back_mp" )
local f6_local5 = RegisterMaterial( "apache_zoom_overlay_mp" )
local f6_local6 = RegisterMaterial( "apache_warn_lock_left_mp" )
local f6_local7 = RegisterMaterial( "apache_warn_lock_right_mp" )
local f6_local8 = RegisterMaterial( "apache_visor_mp" )
local f6_local9 = RegisterMaterial( "pointflash" )
local self = LUI.UIElement.new()
self.id = "heli_pilot_overlay_container_id"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 0
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerOmnvarHandler( "ui_heli_pilot", f0_local20 )
self:registerEventHandler( "init_overlay", f0_local20 )
self:registerEventHandler( "refresh_controls", f0_local24 )
local f6_local11 = LUI.UIImage.new()
f6_local11.id = "heli_pilot_visor_image_id"
f6_local11:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = f6_local8,
alpha = 1
} )
f6_local11:animateToState( "default", 0 )
local f6_local12 = LUI.UIImage.new()
f6_local12.id = "heli_pilot_flash_image_id"
f6_local12:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local14,
left = -f0_local15,
bottom = f0_local14,
right = f0_local15,
material = f6_local9,
alpha = 0
} )
f6_local12:animateToState( "default", 0 )
f6_local12:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local14,
left = -f0_local15,
bottom = f0_local14,
right = f0_local15,
alpha = 1
} )
f6_local12:registerAnimationState( "closing", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local14 * -2,
left = -f0_local15 * 100,
bottom = f0_local14 * -2,
right = f0_local15 * 100,
alpha = 0
} )
local f6_local13 = LUI.UIImage.new()
f6_local13.id = "heli_pilot_reticle_image_id"
f6_local13:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f6_local2,
alpha = 0
} )
f6_local13:animateToState( "default", 0 )
f6_local13:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local4 * 0.5) - 40,
left = -(f0_local5 * 0.5) - 40,
bottom = f0_local4 * 0.5 + 40,
right = f0_local5 * 0.5 + 40,
alpha = 0
} )
f6_local13:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local4 * 0.5,
left = -f0_local5 * 0.5,
bottom = f0_local4 * 0.5,
right = f0_local5 * 0.5,
alpha = 1
} )
local f6_local14 = LUI.UIImage.new()
f6_local14.id = "heli_pilot_reticle_zoomed_image_id"
f6_local14:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f6_local5,
alpha = 0
} )
f6_local14:animateToState( "default", 0 )
f6_local14:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local10 * 0.5) - 40,
left = -(f0_local11 * 0.5) - 40,
bottom = f0_local10 * 0.5 + 40,
right = f0_local11 * 0.5 + 40,
zRot = 180,
alpha = 0
} )
f6_local14:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local10 * 0.5,
left = -f0_local11 * 0.5,
bottom = f0_local10 * 0.5,
right = f0_local11 * 0.5,
zRot = 0,
alpha = 1
} )
local f6_local15 = LUI.UIImage.new()
f6_local15.id = "heli_pilot_altitude_back_image_id"
f6_local15:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local0 * 0.5) + 500,
left = -500,
bottom = f0_local0 * 0.5 - 500,
width = f0_local1,
material = f6_local0,
alpha = 0
} )
f6_local15:animateToState( "default", 0 )
f6_local15:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local0 * 0.5) - 10,
left = 110,
bottom = f0_local0 * 0.5 + 10,
width = f0_local1,
alpha = 1
} )
f6_local15:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local0 * 0.5),
left = 100,
bottom = f0_local0 * 0.5,
width = f0_local1,
alpha = 1
} )
local f6_local16 = LUI.UIImage.new()
f6_local16.id = "heli_pilot_speed_back_image_id"
f6_local16:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = -(f0_local2 * 0.5) + 500,
right = 500,
bottom = f0_local2 * 0.5 - 500,
width = f0_local3,
material = f6_local1,
alpha = 0
} )
f6_local16:animateToState( "default", 0 )
f6_local16:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = -(f0_local2 * 0.5) - 10,
right = -110,
bottom = f0_local2 * 0.5 + 10,
width = f0_local3,
alpha = 1
} )
f6_local16:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = -(f0_local2 * 0.5),
right = -100,
bottom = f0_local2 * 0.5,
width = f0_local3,
alpha = 1
} )
local f6_local17 = LUI.UIImage.new()
f6_local17.id = "heli_pilot_flare_back_image_id"
f6_local17:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 100,
left = 250,
bottom = 100,
width = f0_local7,
material = f6_local3,
alpha = 0
} )
f6_local17:animateToState( "default", 0 )
f6_local17:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 100 - f0_local6 * 0.5 - 40,
left = 210,
bottom = 100 + f0_local6 * 0.5 + 40,
width = f0_local7,
alpha = 0
} )
f6_local17:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 100 - f0_local6 * 0.5,
left = 250,
bottom = 100 + f0_local6 * 0.5,
width = f0_local7,
alpha = 1
} )
f6_local17:registerOmnvarHandler( "ui_heli_pilot_flare_ammo", f0_local22 )
local f6_local18 = LUI.UIText.new()
f6_local18.id = "heli_pilot_flare_text_id"
f6_local18:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_POP_FLARE" ) )
f6_local18:setTextStyle( CoD.TextStyle.Shadowed )
f6_local18:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = 30,
left = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 256,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f6_local18:animateToState( "default", 0 )
local f6_local19 = LUI.UIText.new()
f6_local19.id = "heli_pilot_zoom_text_id"
f6_local19:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_ZOOM" ) )
f6_local19:setTextStyle( CoD.TextStyle.Shadowed )
f6_local19:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = 50,
left = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 256,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f6_local19:animateToState( "default", 0 )
f6_local17:addElement( f0_local21() )
f6_local17:addElement( f6_local18 )
f6_local17:addElement( f6_local19 )
local f6_local20 = LUI.UIImage.new()
f6_local20.id = "heli_pilot_mg_back_image_id"
f6_local20:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 100,
right = -250,
bottom = 100,
width = f0_local9,
material = f6_local4,
alpha = 0
} )
f6_local20:animateToState( "default", 0 )
f6_local20:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 100 - f0_local8 * 0.5 - 40,
right = -210,
bottom = 100 + f0_local8 * 0.5 + 40,
width = f0_local9,
alpha = 0
} )
f6_local20:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 100 - f0_local8 * 0.5,
right = -250,
bottom = 100 + f0_local8 * 0.5,
width = f0_local9,
alpha = 1
} )
local f6_local21 = LUI.UIText.new()
f6_local21.id = "heli_pilot_mg_text_id"
f6_local21:setText( Engine.Localize( "@PLATFORM_HELI_PILOT_FIRE" ) )
f6_local21:setTextStyle( CoD.TextStyle.Shadowed )
f6_local21:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = 30,
right = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
width = 256,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Right
} )
f6_local21:animateToState( "default", 0 )
f6_local20:addElement( f6_local21 )
local f6_local22 = LUI.UIElement.new()
f6_local22.id = "heli_pilot_warn_container"
f6_local22:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f0_local16 / 2,
left = -440,
bottom = f0_local16 / 2,
right = 440
} )
f6_local22:animateToState( "default", 0 )
f6_local22:registerOmnvarHandler( "ui_heli_pilot_warn", f0_local23 )
local f6_local23 = LUI.UIImage.new()
f6_local23.id = "heli_pilot_warn_left_image_id"
f6_local23:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f0_local16,
width = f0_local17,
material = f6_local6,
red = 1,
green = 1,
blue = 1,
alpha = 0
} )
f6_local23:animateToState( "default", 0 )
f6_local23:registerAnimationState( "active", {
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alpha = 1
} )
local f6_local24 = LUI.UIImage.new()
f6_local24.id = "heli_pilot_warn_right_image_id"
f6_local24:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = 0,
height = f0_local18,
width = f0_local19,
material = f6_local7,
red = 1,
green = 1,
blue = 1,
alpha = 0
} )
f6_local24:animateToState( "default", 0 )
f6_local24:registerAnimationState( "active", {
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alpha = 1
} )
f6_local22:addElement( f6_local23 )
f6_local22:addElement( f6_local24 )
self:addElement( f6_local11 )
self:addElement( f6_local12 )
self:addElement( f6_local13 )
self:addElement( f6_local14 )
self:addElement( f6_local15 )
self:addElement( f6_local16 )
self:addElement( f6_local17 )
self:addElement( f6_local20 )
self:addElement( f6_local22 )
return self
end )
LockTable( _M )