mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-07 21:59:49 -05:00
HUD: convert Containment zone and time to LUI
Containment: remove Containment zone HUD on 1 zone maps
This commit is contained in:
parent
5e11cf7002
commit
eb6fb4f409
@ -91,6 +91,9 @@ LANG_ENGLISH "HEALTH BAR"
|
||||
REFERENCE MENU_ZONE_NAME_CAPS
|
||||
LANG_ENGLISH "ZONE NAME"
|
||||
|
||||
REFERENCE MENU_CONTAINMENT_ZONE_TIME_CAPS
|
||||
LANG_ENGLISH "CONTAINMENT ZONE/TIME"
|
||||
|
||||
REFERENCE MENU_FOG_CAPS
|
||||
LANG_ENGLISH "FOG"
|
||||
|
||||
|
@ -197,6 +197,8 @@ precache_strings()
|
||||
precacheString(&"hud_update_health_bar");
|
||||
precacheString(&"hud_update_zone_name");
|
||||
precacheString(&"hud_update_quest_timer");
|
||||
precacheString(&"hud_update_containment_zone");
|
||||
precacheString(&"hud_update_containment_time");
|
||||
|
||||
precacheString(&"hud_fade_out_zone_name");
|
||||
precacheString(&"hud_fade_in_zone_name");
|
||||
@ -772,6 +774,16 @@ lui_notify_events()
|
||||
self luinotifyevent(&"hud_update_quest_timer", 1, level.quest_timer_hud_value);
|
||||
self luinotifyevent(&"hud_fade_in_quest_timer");
|
||||
}
|
||||
|
||||
if (isdefined(level.containment_zone_hud_value))
|
||||
{
|
||||
self luinotifyevent(&"hud_update_containment_zone", 1, level.containment_zone_hud_value);
|
||||
}
|
||||
|
||||
if (isdefined(level.containment_time_hud_value))
|
||||
{
|
||||
self luinotifyevent(&"hud_update_containment_time", 1, level.containment_time_hud_value);
|
||||
}
|
||||
}
|
||||
|
||||
enemy_counter_hud()
|
||||
|
@ -2410,51 +2410,9 @@ race_check_for_kills()
|
||||
|
||||
containment_init()
|
||||
{
|
||||
level.containment_zone_hud = newHudElem();
|
||||
level.containment_zone_hud.alignx = "left";
|
||||
level.containment_zone_hud.aligny = "top";
|
||||
level.containment_zone_hud.horzalign = "user_left";
|
||||
level.containment_zone_hud.vertalign = "user_top";
|
||||
level.containment_zone_hud.x += 7;
|
||||
level.containment_zone_hud.y += 2;
|
||||
level.containment_zone_hud.fontscale = 1.4;
|
||||
level.containment_zone_hud.alpha = 0;
|
||||
level.containment_zone_hud.color = (1, 1, 1);
|
||||
level.containment_zone_hud.hidewheninmenu = 1;
|
||||
level.containment_zone_hud.foreground = 1;
|
||||
level.containment_zone_hud.label = &"ZOMBIE_HUD_CONTAINMENT_ZONE";
|
||||
|
||||
level.containment_time_hud = newHudElem();
|
||||
level.containment_time_hud.alignx = "left";
|
||||
level.containment_time_hud.aligny = "top";
|
||||
level.containment_time_hud.horzalign = "user_left";
|
||||
level.containment_time_hud.vertalign = "user_top";
|
||||
level.containment_time_hud.x += 7;
|
||||
level.containment_time_hud.y += 17;
|
||||
level.containment_time_hud.fontscale = 1.4;
|
||||
level.containment_time_hud.alpha = 0;
|
||||
level.containment_time_hud.color = (1, 1, 1);
|
||||
level.containment_time_hud.hidewheninmenu = 1;
|
||||
level.containment_time_hud.foreground = 1;
|
||||
level.containment_time_hud.label = &"ZOMBIE_HUD_CONTAINMENT_TIME";
|
||||
|
||||
level thread containment_hud_destroy_on_end_game();
|
||||
level thread containment_think();
|
||||
}
|
||||
|
||||
containment_hud_destroy_on_end_game()
|
||||
{
|
||||
level waittill("end_game");
|
||||
|
||||
level.containment_zone_hud setText("");
|
||||
level.containment_time_hud setText("");
|
||||
|
||||
level waittill("intermission");
|
||||
|
||||
level.containment_zone_hud destroy();
|
||||
level.containment_time_hud destroy();
|
||||
}
|
||||
|
||||
containment_think()
|
||||
{
|
||||
level endon("end_game");
|
||||
@ -2464,11 +2422,18 @@ containment_think()
|
||||
ind = 0;
|
||||
containment_zones = containment_get_zones();
|
||||
|
||||
level.containment_zone_hud.alpha = 1;
|
||||
|
||||
if (containment_zones.size > 1)
|
||||
{
|
||||
level.containment_time_hud.alpha = 1;
|
||||
players = get_players();
|
||||
|
||||
level.containment_zone_hud_value = &"";
|
||||
level.containment_time_hud_value = -1;
|
||||
|
||||
foreach (player in players)
|
||||
{
|
||||
player luinotifyevent(&"hud_update_containment_zone", 1, level.containment_zone_hud_value);
|
||||
player luinotifyevent(&"hud_update_containment_time", 1, level.containment_time_hud_value);
|
||||
}
|
||||
}
|
||||
|
||||
level waittill("restart_round_start");
|
||||
@ -2540,8 +2505,17 @@ containment_think()
|
||||
player thread show_grief_hud_msg(&"ZOMBIE_NEW_CONTAINMENT_ZONE");
|
||||
}
|
||||
|
||||
level.containment_zone_hud setText(zone_display_name);
|
||||
level.containment_time_hud setTimer(60);
|
||||
if (containment_zones.size > 1)
|
||||
{
|
||||
level.containment_zone_hud_value = zone_display_name;
|
||||
|
||||
foreach (player in players)
|
||||
{
|
||||
player luinotifyevent(&"hud_update_containment_zone", 1, level.containment_zone_hud_value);
|
||||
}
|
||||
|
||||
level thread containment_time_hud_countdown(60);
|
||||
}
|
||||
|
||||
zone_time = 60000;
|
||||
next_obj_waypoint_time = 10000;
|
||||
@ -3108,6 +3082,33 @@ containment_set_obj_waypoint_icon(icon, next_obj = false)
|
||||
}
|
||||
}
|
||||
|
||||
containment_time_hud_countdown(time)
|
||||
{
|
||||
level notify("containment_time_hud_countdown");
|
||||
level endon("containment_time_hud_countdown");
|
||||
|
||||
level.containment_time_hud_value = time;
|
||||
|
||||
while (1)
|
||||
{
|
||||
players = get_players();
|
||||
|
||||
foreach (player in players)
|
||||
{
|
||||
player luinotifyevent(&"hud_update_containment_time", 1, level.containment_time_hud_value);
|
||||
}
|
||||
|
||||
if (level.containment_time_hud_value <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wait 1;
|
||||
|
||||
level.containment_time_hud_value--;
|
||||
}
|
||||
}
|
||||
|
||||
print_containment_msg(hint_string)
|
||||
{
|
||||
self iprintln(hint_string);
|
||||
|
@ -657,6 +657,12 @@ CoD.OptionsSettings.CreateModTab = function(ModTab, LocalClientIndex)
|
||||
|
||||
ModTabButtonList:addSpacer(CoD.CoD9Button.Height / 2)
|
||||
|
||||
local ContainmentSelector = ModTabButtonList:addDvarLeftRightSelector(LocalClientIndex, Engine.Localize("MENU_CONTAINMENT_ZONE_TIME_CAPS"), "ui_hud_containment")
|
||||
ContainmentSelector:addChoice(LocalClientIndex, Engine.Localize("MENU_DISABLED_CAPS"), 0, nil, CoD.OptionsSettings.Button_ApplyDvarChanged)
|
||||
ContainmentSelector:addChoice(LocalClientIndex, Engine.Localize("MENU_ENABLED_CAPS"), 1, nil, CoD.OptionsSettings.Button_ApplyDvarChanged)
|
||||
|
||||
ModTabButtonList:addSpacer(CoD.CoD9Button.Height / 2)
|
||||
|
||||
local FogSelector = ModTabButtonList:addDvarLeftRightSelector(LocalClientIndex, Engine.Localize("MENU_FOG_CAPS"), "r_fog_settings")
|
||||
FogSelector:addChoice(LocalClientIndex, Engine.Localize("MENU_DISABLED_CAPS"), 0, nil, CoD.OptionsSettings.Button_ApplyDvarChangedFog)
|
||||
FogSelector:addChoice(LocalClientIndex, Engine.Localize("MENU_ENABLED_CAPS"), 1, nil, CoD.OptionsSettings.Button_ApplyDvarChangedFog)
|
||||
|
@ -199,6 +199,10 @@ CoD.InitCustomDvars = function()
|
||||
Engine.Exec(nil, "seta ui_hud_zone_name 1")
|
||||
end
|
||||
|
||||
if UIExpression.DvarString(nil, "ui_hud_containment") == "" then
|
||||
Engine.Exec(nil, "seta ui_hud_containment 1")
|
||||
end
|
||||
|
||||
if UIExpression.DvarString(nil, "r_fog_settings") == "" then
|
||||
Engine.Exec(nil, "seta r_fog_settings 0")
|
||||
end
|
||||
|
@ -238,6 +238,47 @@ LUI.createMenu.ReimaginedArea = function(LocalClientIndex)
|
||||
questTimerWidget:registerEventHandler("hud_fade_out_quest_timer", CoD.Reimagined.QuestTimerArea.FadeOutQuestTimer)
|
||||
questTimerWidget:registerEventHandler("hud_fade_in_quest_timer", CoD.Reimagined.QuestTimerArea.FadeInQuestTimer)
|
||||
|
||||
local containmentWidget = LUI.UIElement.new()
|
||||
containmentWidget:setLeftRight(true, true, 7, 7)
|
||||
containmentWidget:setTopBottom(true, false, 3, 3)
|
||||
containmentWidget:setAlpha(0)
|
||||
safeArea:addElement(containmentWidget)
|
||||
|
||||
local containmentZoneText = LUI.UIText.new()
|
||||
containmentZoneText:setLeftRight(true, true, 0, 0)
|
||||
containmentZoneText:setTopBottom(true, false, 0, CoD.textSize.Default)
|
||||
containmentZoneText:setFont(CoD.fonts.Big)
|
||||
containmentZoneText:setAlignment(LUI.Alignment.Left)
|
||||
containmentWidget:addElement(containmentZoneText)
|
||||
containmentWidget.containmentZoneText = containmentZoneText
|
||||
|
||||
local containmentTimeText = LUI.UIText.new()
|
||||
containmentTimeText:setLeftRight(true, true, 0, 0)
|
||||
containmentTimeText:setTopBottom(true, false, 0 + 23, CoD.textSize.Default + 23)
|
||||
containmentTimeText:setFont(CoD.fonts.Big)
|
||||
containmentTimeText:setAlignment(LUI.Alignment.Left)
|
||||
containmentWidget:addElement(containmentTimeText)
|
||||
containmentWidget.containmentTimeText = containmentTimeText
|
||||
|
||||
containmentWidget:registerEventHandler("hud_update_refresh", CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_HUD_VISIBLE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_EMP_ACTIVE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_VEHICLE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_GUIDED_MISSILE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_AMMO_COUNTER_HIDE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_FLASH_BANGED, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_UI_ACTIVE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_SPECTATING_CLIENT, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_SCOREBOARD_OPEN, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_PLAYER_DEAD, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_SCOPED, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_PLAYER_ZOMBIE, CoD.Reimagined.ContainmentArea.UpdateVisibility)
|
||||
containmentWidget:registerEventHandler("hud_update_containment_zone", CoD.Reimagined.ContainmentArea.UpdateContainmentZone)
|
||||
containmentWidget:registerEventHandler("hud_update_containment_time", CoD.Reimagined.ContainmentArea.UpdateContainmentTime)
|
||||
|
||||
return safeArea
|
||||
end
|
||||
|
||||
@ -371,6 +412,7 @@ end
|
||||
|
||||
CoD.Reimagined.ZoneNameArea.UpdateZoneName = function(Menu, ClientInstance)
|
||||
local zoneName = Engine.Localize(Engine.GetIString(ClientInstance.data[1], "CS_LOCALIZED_STRINGS"))
|
||||
|
||||
Menu.zoneNameText:setText(zoneName)
|
||||
end
|
||||
|
||||
@ -427,6 +469,37 @@ CoD.Reimagined.QuestTimerArea.FadeInQuestTimer = function(Menu, ClientInstance)
|
||||
end
|
||||
end
|
||||
|
||||
CoD.Reimagined.ContainmentArea = {}
|
||||
CoD.Reimagined.ContainmentArea.UpdateVisibility = function(Menu, ClientInstance)
|
||||
local controller = ClientInstance.controller
|
||||
if UIExpression.DvarBool(nil, "ui_hud_containment") == 1 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_HUD_VISIBLE) == 1 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_EMP_ACTIVE) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IN_VEHICLE) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IN_GUIDED_MISSILE) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_AMMO_COUNTER_HIDE) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IS_FLASH_BANGED) == 0 and (UIExpression.IsVisibilityBitSet(controller, CoD.BIT_UI_ACTIVE) == 0 or UIExpression.IsVisibilityBitSet(controller, CoD.BIT_SCOREBOARD_OPEN) == 1) and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IN_KILLCAM) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IS_SCOPED) == 0 and UIExpression.IsVisibilityBitSet(controller, CoD.BIT_IS_PLAYER_ZOMBIE) == 0 and (not CoD.IsShoutcaster(controller) or CoD.ExeProfileVarBool(controller, "shoutcaster_scorestreaks") and Engine.IsSpectatingActiveClient(controller)) and CoD.FSM_VISIBILITY(controller) == 0 then
|
||||
if Menu.visible ~= true then
|
||||
Menu:setAlpha(1)
|
||||
Menu.visible = true
|
||||
end
|
||||
elseif Menu.visible == true then
|
||||
Menu:setAlpha(0)
|
||||
Menu.visible = nil
|
||||
end
|
||||
end
|
||||
|
||||
CoD.Reimagined.ContainmentArea.UpdateContainmentZone = function(Menu, ClientInstance)
|
||||
local zoneName = Engine.Localize(Engine.GetIString(ClientInstance.data[1], "CS_LOCALIZED_STRINGS"))
|
||||
|
||||
Menu.containmentZoneText:setText(Engine.Localize("ZOMBIE_HUD_CONTAINMENT_ZONE") .. zoneName)
|
||||
end
|
||||
|
||||
CoD.Reimagined.ContainmentArea.UpdateContainmentTime = function(Menu, ClientInstance)
|
||||
local timeNum = ClientInstance.data[1]
|
||||
local time = ""
|
||||
|
||||
if timeNum >= 0 then
|
||||
time = CoD.Reimagined.ConvertNumToTime(timeNum)
|
||||
end
|
||||
|
||||
Menu.containmentTimeText:setText(Engine.Localize("ZOMBIE_HUD_CONTAINMENT_TIME") .. time)
|
||||
end
|
||||
|
||||
CoD.Reimagined.ConvertNumToTime = function(num)
|
||||
local time = ""
|
||||
local hrs = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user