Updated to allow users to change many aspects of the HUD ingame

This commit is contained in:
ForrestMarkX 2020-01-17 12:46:21 -06:00
parent fa676956ba
commit ae9901ae11
6 changed files with 988 additions and 228 deletions

View File

@ -1,5 +1,7 @@
class ClassicHUD extends KFMutator;
const GFxListenerPriority = 80000;
var KFPawn LastHitZed;
var int LastHitHP;
var KFPlayerController LastDamageDealer;
@ -13,9 +15,17 @@ struct RepInfoS
};
var array<RepInfoS> DamageReplicationInfos;
function PostBeginPlay()
var transient KFPlayerController KFPC;
var transient KFGFxHudWrapper HUD;
var transient GFxClikWidget HUDChatInputField, PartyChatInputField;
simulated function PostBeginPlay()
{
Super.PostBeginPlay();
if( WorldInfo.NetMode != NM_DedicatedServer )
InitializeHUD();
if( WorldInfo.Game != None )
WorldInfo.Game.HUDType = class'ClassicKFHUD';
}
@ -100,3 +110,108 @@ function DestroyReplicationInfo(KFPlayerController C)
DamageReplicationInfos.RemoveItem(DamageReplicationInfos[i]);
}
}
// Peelz fam, thanks for this
simulated function InitializeHUD()
{
KFPC = KFPlayerController(GetALocalPlayerController());
HUD = KFGFxHudWrapper(KFPC.myHUD);
if( HUD == None )
{
SetTimer(0.5f, false, nameof(InitializeHUD));
return;
}
WriteToChat("<Classic HUD> Initialized!", "FFFF00");
WriteToChat("<Classic HUD> Type !settings or use OpenSettingsMenu in console to configure!", "00FF00");
InitializePartyChatHook();
InitializeHUDChatHook();
}
simulated delegate OnPartyChatInputKeyDown(GFxClikWidget.EventData Data)
{
OnChatKeyDown(PartyChatInputField, Data);
}
simulated delegate OnHUDChatInputKeyDown(GFxClikWidget.EventData Data)
{
if (OnChatKeyDown(HUDChatInputField, Data))
HUD.HUDMovie.HudChatBox.ClearAndCloseChat();
}
simulated function bool OnChatKeyDown(GFxClikWidget InputField, GFxClikWidget.EventData Data)
{
local GFXObject InputDetails;
local int KeyCode;
local string EventType;
local string KeyEvent;
local string Text;
InputDetails = Data._this.GetObject("details");
KeyCode = InputDetails.GetInt("code");
EventType = InputDetails.GetString("type");
KeyEvent = InputDetails.GetString("value");
if (EventType != "key") return false;
if (KeyCode == 13 && (KeyEvent == "keyHold" || KeyEvent == "keyDown"))
{
Text = InputField.GetText();
switch (Locs(Text))
{
case "!settings":
ClassicKFHUD(KFPC.MyHUD).OpenSettingsMenu();
break;
default:
return false;
}
InputField.SetText("");
return true;
}
return false;
}
simulated function InitializePartyChatHook()
{
if (KFPC.MyGFxManager == None || KFPC.MyGFxManager.PartyWidget == None || KFPC.MYGFxManager.PartyWidget.PartyChatWidget == None)
{
SetTimer(1.f, false, nameof(InitializePartyChatHook));
return;
}
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.SetVisible(true);
PartyChatInputField = GFxClikWidget(KFPC.MyGFxManager.PartyWidget.PartyChatWidget.GetObject("ChatInputField", class'GFxClikWidget'));
PartyChatInputField.AddEventListener('CLIK_input', OnPartyChatInputKeyDown, false, GFxListenerPriority, false);
}
simulated function InitializeHUDChatHook()
{
if (HUD == None || HUD.HUDMovie == None || HUD.HUDMovie.HudChatBox == None)
{
SetTimer(1.f, false, nameof(InitializeHUDChatHook));
return;
}
HUDChatInputField = GFxClikWidget(HUD.HUDMovie.HudChatBox.GetObject("ChatInputField", class'GFxClikWidget'));
HUDChatInputField.AddEventListener('CLIK_input', OnHUDChatInputKeyDown, false, GFxListenerPriority, false);;
}
simulated function WriteToChat(string Message, string HexColor)
{
if (KFPC.MyGFxManager.PartyWidget != None && KFPC.MyGFxManager.PartyWidget.PartyChatWidget != None)
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.AddChatMessage(Message, HexColor);
if (HUD != None && HUD.HUDMovie != None && HUD.HUDMovie.HudChatBox != None)
HUD.HUDMovie.HudChatBox.AddChatMessage(Message, HexColor);
}
defaultproperties
{
Role=ROLE_Authority
RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=true
}

View File

@ -1,4 +1,5 @@
class ClassicKFHUD extends KFGFxHudWrapper;
class ClassicKFHUD extends KFGFxHudWrapper
config(ClassicHUD);
const MAX_WEAPON_GROUPS = 4;
const HUDBorderSize = 3;
@ -72,7 +73,6 @@ struct FKillMessageType
};
var transient array<FKillMessageType> KillMessages;
var Color HudMainColor, HudOutlineColor, FontColor;
var Color DefaultHudMainColor, DefaultHudOutlineColor, DefaultFontColor;
var transient float LevelProgressBar, VisualProgressBar;
var transient bool bInterpolating, bDisplayingProgress;
@ -95,8 +95,6 @@ var Color WeaponIconColor,WeaponOverweightIconColor;
var int MaxNonCriticalMessages;
var float NonCriticalMessageDisplayTime,NonCriticalMessageFadeInTime,NonCriticalMessageFadeOutTime;
var int HealthBarFullVisDist, HealthBarCutoffDist;
struct PopupDamageInfo
{
var int Damage;
@ -273,16 +271,60 @@ var transient OnlineSubsystem OnlineSub;
var transient bool bLoadedInitItems;
var array<Color> DamageMsgColors;
var UIP_ColorSettings ColorSettingMenu;
var config Color HudMainColor, HudOutlineColor, FontColor;
var config bool bEnableDamagePopups, bLightHUD, bHideWeaponInfo, bHidePlayerInfo, bHideDosh, bDisableHiddenPlayers, bShowSpeed, bDisableLastZEDIcons, bDisablePickupInfo, bDisableLockOnUI, bDisableRechargeUI, bShowXPEarned, bShowDoshEarned, bNewScoreboard, bDisableHUD;
var config int HealthBarFullVisDist, HealthBarCutoffDist;
var config int iConfigVersion;
var config enum PlayerInfo
{
INFO_CLASSIC,
INFO_LEGACY,
INFO_MODERN
} PlayerInfoType;
simulated function PostBeginPlay()
{
local bool bSaveConfig;
Super.PostBeginPlay();
SetupHUDTextures();
if( iConfigVersion <= 0 )
{
HudMainColor = DefaultHudMainColor;
HudOutlineColor = DefaultHudOutlineColor;
FontColor = DefaultFontColor;
bLightHUD = false;
bHideWeaponInfo = false;
bHidePlayerInfo = false;
bHideDosh = false;
bDisableHiddenPlayers = false;
bEnableDamagePopups = true;
bShowSpeed = false;
bDisableLastZEDIcons = false;
bDisablePickupInfo = false;
bDisableLockOnUI = false;
bDisableRechargeUI = false;
bShowXPEarned = true;
bShowDoshEarned = true;
bNewScoreboard = true;
bDisableHUD = false;
PlayerInfoType = ClassicPlayerInfo ? INFO_LEGACY : INFO_MODERN;
HealthBarFullVisDist = 350.f;
HealthBarCutoffDist = 3500.f;
iConfigVersion++;
bSaveConfig = true;
}
if( bSaveConfig )
SaveConfig();
SetupHUDTextures();
SetTimer(0.1, true, 'SetupFontBlur');
SetTimer(0.1f, true, 'CheckForWeaponPickup');
SetTimer(0.1f, true, 'BuildCacheItems');
@ -299,6 +341,22 @@ simulated function PostBeginPlay()
}
SetTimer(300 + FRand()*120.f, false, 'CheckForItems');
if( bDisableHUD )
{
RemoveMovies();
HUDClass = class'KFGFxHudWrapper'.default.HUDClass;
CreateHUDMovie();
}
}
function ResetHUDColors()
{
HudMainColor = DefaultHudMainColor;
HudOutlineColor = DefaultHudOutlineColor;
FontColor = DefaultFontColor;
SaveConfig();
SetupHUDTextures();
}
function BuildCacheItems()
@ -516,26 +574,28 @@ function DrawHUD()
Canvas.EnableStencilTest(true);
if( WeaponPickup != None )
if( !bDisablePickupInfo && WeaponPickup != None )
{
DrawWeaponPickupInfo();
}
if( bEnableDamagePopups )
DrawDamage();
if( KFPlayerOwner != None && KFPlayerOwner.Pawn != None )
{
if( KFWeap_MedicBase(KFPlayerOwner.Pawn.Weapon) != None )
if( !bDisableLockOnUI && KFWeap_MedicBase(KFPlayerOwner.Pawn.Weapon) != None )
{
DrawMedicWeaponLockOn(KFWeap_MedicBase(KFPlayerOwner.Pawn.Weapon));
}
if( !KFPlayerOwner.bCinematicMode )
if( !bDisableRechargeUI && !KFPlayerOwner.bCinematicMode )
DrawMedicWeaponRecharge();
}
Canvas.EnableStencilTest(false);
if( !bDisableHUD )
DrawTraderIndicator();
if( KFGRI == None )
@ -615,6 +675,9 @@ function DrawHUD()
}
}
if( bDisableHUD )
return;
if( KillMessages.Length > 0 )
{
RenderKillMsg();
@ -881,12 +944,6 @@ function DrawPopupInfo()
Canvas.DrawText(MessageQueue[0].Body,, FontScalar, FontScalar);
}
exec function SetShowScores(bool bNewValue)
{
if( Scoreboard!=None )
Scoreboard.SetVisibility(bNewValue);
}
function string GetGameInfoText()
{
if( KFGRI != None )
@ -968,6 +1025,8 @@ function DrawHUDBox
TextColor.A = byte(HBRI.Alpha);
}
if( !bLightHUD )
{
if( HBRI.bUseRounded )
{
if( HBRI.bHighlighted )
@ -992,6 +1051,7 @@ function DrawHUDBox
}
}
else GUIStyle.DrawOutlinedBox(X, Y, Width, Height, ScaledBorderSize, BoxColor, OutlineColor);
}
if( HBRI.IconTex != None )
{
@ -1102,7 +1162,7 @@ function RenderKFHUD(KFPawn_Human KFPH)
local HUDBoxRenderInfo HBRI;
local KFInterface_MapObjective MapObjective;
if( KFPlayerOwner.bCinematicMode )
if( bDisableHUD || KFPlayerOwner.bCinematicMode )
return;
FRI.bClipText = true;
@ -1132,12 +1192,15 @@ function RenderKFHUD(KFPawn_Human KFPH)
FontScalar = OriginalFontScalar + GUIStyle.ScreenScale(KFGRI.IsEndlessWave() ? 0.75 : 0.3);
DrawCircleSize = GUIStyle.ScreenScale(128);
if( !bLightHUD )
{
if( HudOutlineColor != DefaultHudOutlineColor )
Canvas.SetDrawColor(HudOutlineColor.R, HudOutlineColor.G, HudOutlineColor.B, 255);
else Canvas.SetDrawColor(255, 255, 255, 255);
Canvas.SetPos(Canvas.ClipX - DrawCircleSize, 2);
Canvas.DrawRect(DrawCircleSize, DrawCircleSize, (KFGRI != None && KFGRI.bWaveIsActive) ? BioCircle : WaveCircle);
}
Canvas.TextSize(CircleText, XL, YL, FontScalar, FontScalar);
@ -1145,8 +1208,13 @@ function RenderKFHUD(KFPawn_Human KFPH)
YPos = SubCircleText != "" ? DrawCircleSize/2 - (YL / 1.5) : DrawCircleSize/2 - YL / 2;
Canvas.DrawColor = FontColor;
if( bLightHUD )
GUIStyle.DrawTextShadow(CircleText, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(CircleText, , FontScalar, FontScalar, FRI);
}
if( SubCircleText != "" )
{
@ -1158,11 +1226,16 @@ function RenderKFHUD(KFPawn_Human KFPH)
XPos = Canvas.ClipX - DrawCircleSize/2 - (XL / 2);
YPos = DrawCircleSize/2 + (YL / 2.5);
if( bLightHUD )
GUIStyle.DrawTextShadow(SubCircleText, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(SubCircleText, , FontScalar, FontScalar, FRI);
}
}
}
}
if( !bShowHUD || KFPH == None )
return;
@ -1175,8 +1248,10 @@ function RenderKFHUD(KFPawn_Human KFPH)
HBRI.IconScale = scale_w2;
HBRI.Justification = HUDA_Right;
HBRI.TextColor = FontColor;
HBRI.bUseOutline = false;
HBRI.bUseOutline = bLightHUD;
if( !bHidePlayerInfo )
{
// Health
HealthFontColor = FontColor;
if ( KFPH.Health < 50 )
@ -1206,9 +1281,12 @@ function RenderKFHUD(KFPawn_Human KFPH)
}
BoxSW = SizeX * 0.0625;
}
MyKFPRI = KFPlayerReplicationInfo(KFPlayerOwner.PlayerReplicationInfo);
if( MyKFPRI != None )
{
if( !bHideDosh )
{
FontScalar = OriginalFontScalar + GUIStyle.ScreenScale(0.625);
@ -1255,8 +1333,9 @@ function RenderKFHUD(KFPawn_Human KFPH)
Canvas.DrawColor = FontColor;
GUIStyle.DrawTextShadow(PlayerScore, DoshXL + (DoshXL * 0.035), DoshYL + (scale_w / 2) - (YL / 2), 1, FontScalar);
if( DoshPopups.Length > 0 )
if( bShowDoshEarned && DoshPopups.Length > 0 )
DrawDoshEarned((DoshXL + (DoshXL * 0.035)) + ((scale_w-XL) / 2), DoshYL);
}
// Draw Perk Info
if( MyKFPRI.CurrentPerkClass != None )
@ -1342,7 +1421,7 @@ function RenderKFHUD(KFPawn_Human KFPH)
bDisplayingProgress = true;
LevelProgressBar = KFPlayerOwner.GetPerkLevelProgressPercentage(KFPlayerOwner.CurrentPerk.Class) / 100.f;
DrawProgressBar(PerkProgressX,PerkProgressY-PerkProgressSize*0.12f,PerkProgressSize*2.f,PerkProgressSize*0.125f,VisualProgressBar);
if( XPPopups.Length > 0 )
if( bShowXPEarned && XPPopups.Length > 0 )
DrawXPEarned(PerkProgressX + (PerkProgressSize/2), PerkProgressY-(PerkProgressSize*0.125f)-(ScaledBorderSize*2));
}
}
@ -1389,6 +1468,7 @@ function RenderKFHUD(KFPawn_Human KFPH)
ObjectiveTitle = Localize("Objectives", "ObjectiveTitle", "KFGame");
Canvas.TextSize(ObjectiveTitle, XL, ObjYL, FontScalar, FontScalar);
if( !bLightHUD )
GUIStyle.DrawRoundedBoxOutlined(ScaledBorderSize, ObjX, ObjY, ObjectiveSize, ObjectiveH, HudMainColor, HudOutlineColor);
// Objective Title
@ -1405,8 +1485,13 @@ function RenderKFHUD(KFPawn_Human KFPH)
}
Canvas.DrawColor = FontColor;
if( bLightHUD )
GUIStyle.DrawTextShadow(ObjectiveTitle, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(ObjectiveTitle,, FontScalar, FontScalar, FRI);
}
// Objective Progress
if( MapObjective.IsComplete() )
@ -1428,8 +1513,13 @@ function RenderKFHUD(KFPawn_Human KFPH)
XPos = ObjX + (ObjectiveSize - XL - ObjectivePadding);
if( bLightHUD )
GUIStyle.DrawTextShadow(ObjectiveProgress, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(ObjectiveProgress,, FontScalar, FontScalar, FRI);
}
// Objective Reward
Canvas.SetDrawColor(0, 255, 0, 255);
@ -1441,8 +1531,13 @@ function RenderKFHUD(KFPawn_Human KFPH)
XPos = ObjX + (ObjectiveSize - XL - ObjectivePadding);
YPos = ObjY + ((ObjectiveH-ObjYL)/2) + (YL/2);
if( bLightHUD )
GUIStyle.DrawTextShadow(ObjectiveReward, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(ObjectiveReward,, FontScalar, FontScalar, FRI);
}
// Objective Description
ObjectiveDesc = MapObjective.GetLocalizedShortDescription();
@ -1453,8 +1548,13 @@ function RenderKFHUD(KFPawn_Human KFPH)
YPos = ObjY + ((ObjectiveH-ObjYL)/1.5f) - (YL/1.5f) - (ScaledBorderSize*2);
XPos = ObjX + ObjectivePadding;
if( bLightHUD )
GUIStyle.DrawTextShadow(ObjectiveDesc, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(ObjectiveDesc,, FontScalar, FontScalar, FRI);
}
// Status Message for the Objective
MapObjective.GetLocalizedStatus(ObjectiveStatusMessage, bStatusWarning, bStatusNotification);
@ -1469,15 +1569,22 @@ function RenderKFHUD(KFPawn_Human KFPH)
XPos = ObjX + ObjectivePadding;
YPos += YL;
if( bLightHUD )
GUIStyle.DrawTextShadow(ObjectiveStatusMessage, XPos, YPos, 1, FontScalar);
else
{
Canvas.SetPos(XPos, YPos);
Canvas.DrawText(ObjectiveStatusMessage,, FontScalar, FontScalar, FRI);
}
}
Canvas.Font = GUIStyle.PickFont(OriginalFontScalar, true);
}
}
CurrentWeapon = KFWeapon(KFPH.Weapon);
if( CurrentWeapon != None )
{
if( !bHideWeaponInfo )
{
FontScalar = OriginalFontScalar + GUIStyle.ScreenScale(0.1);
@ -1576,8 +1683,10 @@ function RenderKFHUD(KFPawn_Human KFPH)
DrawHUDBox(BoxXL, BoxYL, BoxSW, BoxSH, string(int(KFPH.BatteryCharge)), FontScalar, HBRI);
}
}
}
// Speed
if( bShowSpeed )
DrawSpeedMeter();
// Inventory
@ -1679,7 +1788,7 @@ function DrawInventory()
HBRI.JustificationPadding = 24;
HBRI.TextColor = FontColor;
HBRI.Alpha = OrgFadeAlpha;
HBRI.bUseOutline = false;
HBRI.bUseOutline = bLightHUD;
DrawHUDBox(TempX, TempY, TempWidth, TempHeight * 0.25, GetWeaponCatagoryName(i), CatagoryFontScalar, HBRI);
@ -2146,7 +2255,7 @@ function DrawNonCritialMessage( int Index, FCritialMessage Message, float X, flo
HBRI.TextColor = TextColor;
HBRI.Alpha = FadeAlpha;
HBRI.bUseOutline = false;
HBRI.bUseOutline = bLightHUD;
HBRI.bUseRounded = true;
HBRI.bHighlighted = Message.bHighlight;
@ -2765,17 +2874,18 @@ function DrawMedicWeaponRecharge()
{
local KFWeapon KFWMB;
local float IconBaseX, IconBaseY, IconHeight, IconWidth;
local float IconRatioY, ChargePct, ChargeBaseY, WeaponBaseX;
local float IconRatioX, IconRatioY, ChargePct, ChargeBaseY, WeaponBaseX;
local color ChargeColor;
if (PlayerOwner.Pawn.InvManager == None)
return;
IconRatioX = Canvas.ClipX / 1920.0;
IconRatioY = Canvas.ClipY / 1080.0;
IconHeight = MedicWeaponHeight * IconRatioY;
IconWidth = IconHeight / 2.0;
IconBaseX = (Canvas.ClipX * 0.85) - IconWidth;
IconBaseX = bDisableHUD ? 300 * IconRatioX : (Canvas.ClipX * 0.85) - IconWidth;
IconBaseY = Canvas.ClipY * 0.8125;
WeaponBaseX = IconBaseX;
@ -2783,10 +2893,7 @@ function DrawMedicWeaponRecharge()
Canvas.EnableStencilTest(false);
foreach PlayerOwner.Pawn.InvManager.InventoryActors(class'KFWeapon', KFWMB)
{
if ((KFWeap_HealerBase(KFWMB) == None && KFWeap_MedicBase(KFWMB) == None) || KFWMB == PlayerOwner.Pawn.Weapon || (KFWeap_MedicBase(KFWMB) != None && !KFWeap_MedicBase(KFWMB).bRechargeHealAmmo))
continue;
if( KFWeap_HealerBase(KFWMB) != None && float(KFWMB.AmmoCount[0]) == float(KFWMB.MagazineCapacity[0]) )
if ((bDisableHUD && KFWeap_HealerBase(KFWMB) != None) || (KFWeap_HealerBase(KFWMB) == None && KFWeap_MedicBase(KFWMB) == None) || KFWMB == PlayerOwner.Pawn.Weapon || (KFWeap_MedicBase(KFWMB) != None && !KFWeap_MedicBase(KFWMB).bRechargeHealAmmo) || (KFWeap_HealerBase(KFWMB) != None && float(KFWMB.AmmoCount[0]) == float(KFWMB.MagazineCapacity[0])))
continue;
GUIStyle.DrawRoundedBox(ScaledBorderSize*2, WeaponBaseX, IconBaseY, IconWidth, IconHeight, MedicWeaponBGColor);
@ -2803,7 +2910,9 @@ function DrawMedicWeaponRecharge()
Canvas.SetPos(WeaponBaseX + IconWidth, IconBaseY);
Canvas.DrawRotatedTile(KFWMB.WeaponSelectTexture, MedicWeaponRot, IconHeight, IconWidth, 0, 0, KFWMB.WeaponSelectTexture.GetSurfaceWidth(), KFWMB.WeaponSelectTexture.GetSurfaceHeight(), 0, 0);
WeaponBaseX -= IconWidth * 1.2;
if( bDisableHUD )
WeaponBaseX += IconWidth * 1.2;
else WeaponBaseX -= IconWidth * 1.2;
}
Canvas.EnableStencilTest(true);
}
@ -2860,7 +2969,7 @@ function DrawTraderIndicator()
T = KFGRI.OpenedTrader != None ? KFGRI.OpenedTrader : KFGRI.NextTrader;
if( T != None )
DrawDirectionalIndicator(T.Location, TraderArrow, Canvas.ClipY/33.f,, HudOutlineColor, class'KFGFxHUD_TraderCompass'.default.TraderString, true);
DrawDirectionalIndicator(T.Location, bLightHUD ? TraderArrowLight : TraderArrow, Canvas.ClipY/33.f,, HudOutlineColor, class'KFGFxHUD_TraderCompass'.default.TraderString, !bLightHUD);
}
final function Vector DrawDirectionalIndicator(Vector Loc, Texture Mat, float IconSize, optional float FontMult=1.f, optional Color DrawColor=WhiteColor, optional string Text, optional bool bDrawBackground)
@ -3306,8 +3415,21 @@ simulated function bool DrawFriendlyHumanPlayerInfo( KFPawn_Human KFPH )
GUIStyle.DrawTextShadow(KFPRI.PlayerName, ScreenPos.X - (BarLength * 0.5f), ScreenPos.Y - 3.5f, 1, FontScale);
//Info Color
CurrentArmorColor = ClassicPlayerInfo ? ClassicArmorColor : ArmorColor;
CurrentHealthColor = ClassicPlayerInfo ? ClassicHealthColor : HealthColor;
switch(PlayerInfoType)
{
case INFO_CLASSIC:
CurrentArmorColor = BlueColor;
CurrentHealthColor = RedColor;
break;
case INFO_LEGACY:
CurrentArmorColor = ClassicArmorColor;
CurrentHealthColor = ClassicHealthColor;
break;
case INFO_MODERN:
CurrentArmorColor = ArmorColor;
CurrentHealthColor = HealthColor;
break;
}
CurrentArmorColor.A = FadeAlpha;
CurrentHealthColor.A = FadeAlpha;
@ -3315,13 +3437,13 @@ simulated function bool DrawFriendlyHumanPlayerInfo( KFPawn_Human KFPH )
//Draw armor bar
Percentage = FMin(float(KFPH.Armor) / float(KFPH.MaxArmor), 100);
DrawPlayerInfo(KFPH, Percentage, BarLength, BarHeight, ScreenPos.X - (BarLength * 0.5f), BarY, CurrentArmorColor, true);
DrawPlayerInfo(KFPH, Percentage, BarLength, BarHeight, ScreenPos.X - (BarLength * 0.5f), BarY, CurrentArmorColor, PlayerInfoType == INFO_CLASSIC);
BarY += BarHeight + 5;
//Draw health bar
Percentage = FMin(float(KFPH.Health) / float(KFPH.HealthMax), 100);
DrawPlayerInfo(KFPH, Percentage, BarLength, BarHeight, ScreenPos.X - (BarLength * 0.5f), BarY, CurrentHealthColor, true, true);
DrawPlayerInfo(KFPH, Percentage, BarLength, BarHeight, ScreenPos.X - (BarLength * 0.5f), BarY, CurrentHealthColor, PlayerInfoType == INFO_CLASSIC, true);
BarY += BarHeight;
@ -3478,6 +3600,30 @@ function DrawZedIcon( Pawn ZedPawn, vector PawnLocation, float NormalizedAngle )
DrawDirectionalIndicator(PawnLocation + (ZedPawn.CylinderComponent.CollisionHeight * vect(0, 0, 1)), GenericZedIconTexture, PlayerStatusIconSize * (WorldInfo.static.GetResolutionBasedHUDScale() * FriendlyHudScale) * 0.5f,,, GetNameOf(ZedPawn.Class));
}
function CheckAndDrawRemainingZedIcons()
{
if( !bDisableLastZEDIcons )
Super.CheckAndDrawRemainingZedIcons();
}
simulated function CheckAndDrawHiddenPlayerIcons( array<PlayerReplicationInfo> VisibleHumanPlayers, array<sHiddenHumanPawnInfo> HiddenHumanPlayers )
{
if( !bDisableHiddenPlayers )
Super.CheckAndDrawHiddenPlayerIcons(VisibleHumanPlayers, HiddenHumanPlayers);
}
exec function OpenSettingsMenu()
{
GUIController.OpenMenu(class'KFClassicHUD.UI_MidGameMenu');
}
exec function SetShowScores(bool bNewValue)
{
if( bNewScoreboard && Scoreboard != None )
Scoreboard.SetVisibility(bNewValue);
else Super.SetShowScores(bNewValue);
}
defaultproperties
{
DefaultHudMainColor=(R=0,B=0,G=0,A=195)
@ -3535,9 +3681,6 @@ defaultproperties
NonCriticalMessageFadeInTime=0.65
NonCriticalMessageFadeOutTime=0.5
HealthBarFullVisDist=350.0;
HealthBarCutoffDist=3500.0;
RepObject=ObjectReferencer'KFClassicMode_Assets.ObjectRef.MainObj_List'
HUDClass=class'KF1_HUDWrapper'
PerkStarIcon=Texture2D'KFClassicMode_Assets.HUD.Hud_Perk_Star'

View File

@ -987,7 +987,7 @@ defaultproperties
CurrentCursorIndex=`CURSOR_DEFAULT
DefaultStyle=class'ClassicStyle'
bAbsorbInput=false
bAbsorbInput=true
bAlwaysTick=true
bHideCursor=true
}

View File

@ -0,0 +1,129 @@
Class UIP_ColorSettings extends KFGUI_MultiComponent;
var KFGUI_ComponentList SettingsBox;
var KFGUI_ColorSlider MainHudSlider,OutlineSlider,FontSlider;
function InitMenu()
{
Super.InitMenu();
// Client settings
SettingsBox = KFGUI_ComponentList(FindComponentID('SettingsBox'));
MainHudSlider = AddColorSlider('HUDColorSlider', "Main HUD Color", ClassicKFHUD(GetPlayer().myHUD).HudMainColor);
OutlineSlider = AddColorSlider('OutlineColorSlider', "HUD Outline Color", ClassicKFHUD(GetPlayer().myHUD).HudOutlineColor);
FontSlider = AddColorSlider('FontCSlider', "Font Color", ClassicKFHUD(GetPlayer().myHUD).FontColor);
}
function ShowMenu()
{
Super.ShowMenu();
ClassicKFHUD(GetPlayer().myHUD).ColorSettingMenu = self;
}
final function KFGUI_ColorSlider AddColorSlider( name IDN, string Caption, Color DefaultColor )
{
local KFGUI_MultiComponent MC;
local KFGUI_ColorSlider SL;
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
MC.XSize = 0.65;
MC.XPosition = 0.15;
MC.InitMenu();
SL = new(MC) class'KFGUI_ColorSlider';
SL.CaptionText = Caption;
SL.DefaultColor = DefaultColor;
SL.ID = IDN;
SL.OnColorSliderValueChanged = CheckColorSliderChange;
MC.AddComponent(SL);
return SL;
}
function CheckColorSliderChange(KFGUI_ColorSlider Sender, KFGUI_Slider Slider, int Value)
{
local ClassicKFHUD HUD;
HUD = ClassicKFHUD(GetPlayer().myHUD);
if( HUD == None )
return;
switch(Sender.ID)
{
case 'HUDColorSlider':
switch( Slider.ID )
{
case 'ColorSliderR':
HUD.HudMainColor.R = Value;
break;
case 'ColorSliderG':
HUD.HudMainColor.G = Value;
break;
case 'ColorSliderB':
HUD.HudMainColor.B = Value;
break;
case 'ColorSliderA':
HUD.HudMainColor.A = Value;
break;
}
HUD.SaveConfig();
break;
case 'OutlineColorSlider':
switch( Slider.ID )
{
case 'ColorSliderR':
HUD.HudOutlineColor.R = Value;
break;
case 'ColorSliderG':
HUD.HudOutlineColor.G = Value;
break;
case 'ColorSliderB':
HUD.HudOutlineColor.B = Value;
break;
case 'ColorSliderA':
HUD.HudOutlineColor.A = Value;
break;
}
HUD.SaveConfig();
break;
case 'FontCSlider':
switch( Slider.ID )
{
case 'ColorSliderR':
HUD.FontColor.R = Value;
break;
case 'ColorSliderG':
HUD.FontColor.G = Value;
break;
case 'ColorSliderB':
HUD.FontColor.B = Value;
break;
case 'ColorSliderA':
HUD.FontColor.A = Value;
break;
}
HUD.SaveConfig();
break;
}
}
function DrawMenu()
{
Canvas.SetDrawColor(250,250,250,255);
Canvas.SetPos(0.f,0.f);
Canvas.DrawTileStretched(Owner.CurrentStyle.BorderTextures[`BOX_INNERBORDER],CompPos[2],CompPos[3],0,0,128,128);
}
defaultproperties
{
Begin Object Class=KFGUI_ComponentList Name=ClientSettingsBox
XPosition=0.05
YPosition=0.05
XSize=0.95
YSize=0.95
ID="SettingsBox"
ListItemsPerPage=3
End Object
Components.Add(ClientSettingsBox)
}

View File

@ -0,0 +1,239 @@
Class UIP_Settings extends KFGUI_MultiComponent;
var KFGUI_ComponentList SettingsBox;
var KFGUI_TextLable ResetColorLabel,PerkStarsLabel,PerkStarsRowLabel,ControllerTypeLabel,PlayerInfoTypeLabel;
var KFGUI_EditBox PerkStarsBox, PerkRowsBox;
var KFGUI_ComboBox ControllerBox;
var ClassicKFHUD HUD;
var KFPlayerController PC;
function InitMenu()
{
local string S;
PC = KFPlayerController(GetPlayer());
HUD = ClassicKFHUD(PC.myHUD);
Super.InitMenu();
// Client settings
SettingsBox = KFGUI_ComponentList(FindComponentID('SettingsBox'));
AddCheckBox("Disable HUD","Disables the HUD entirely.",'bDisableHUD',HUD.bDisableHUD);
AddCheckBox("Light HUD","Show a light version of the HUD.",'bLight',HUD.bLightHUD);
AddCheckBox("Show weapon info","Show current weapon ammunition status.",'bWeapons',!HUD.bHideWeaponInfo);
AddCheckBox("Show personal info","Display health and armor on the HUD.",'bPersonal',!HUD.bHidePlayerInfo);
AddCheckBox("Show score","Check to show scores on the HUD.",'bScore',!HUD.bHideDosh);
AddCheckBox("Show hidden player icons","Shows the hidden player icons.",'bDisableHiddenPlayers',!HUD.bDisableHiddenPlayers);
AddCheckBox("Show damage messages","Shows the damage popups when damaging ZEDs.",'bEnableDamagePopups',HUD.bEnableDamagePopups);
AddCheckBox("Show player speed","Shows how fast you are moving.",'bShowSpeed',HUD.bShowSpeed);
AddCheckBox("Show pickup information","Shows a UI with infromation on pickups.",'bDisablePickupInfo',!HUD.bDisablePickupInfo);
AddCheckBox("Show lockon target","Shows who you have targeted with a medic gun.",'bDisableLockOnUI',!HUD.bDisableLockOnUI);
AddCheckBox("Show medicgun recharge info","Shows what the recharge info is on various medic weapons.",'bDisableRechargeUI',!HUD.bDisableRechargeUI);
AddCheckBox("Show last remaining ZED icons","Shows the last remaining ZEDs as icons.",'bDisableLastZEDIcons',!HUD.bDisableLastZEDIcons);
AddCheckBox("Show XP earned","Shows when you earn XP.",'bShowXPEarned',HUD.bShowXPEarned);
AddCheckBox("Show Dosh earned","Shows when you earn Dosh.",'bShowDoshEarned',HUD.bShowDoshEarned);
AddCheckBox("Enable Modern Scoreboard","Makes the scoreboard look more modern.",'bNewScoreboard',HUD.bNewScoreboard);
switch(HUD.PlayerInfoType)
{
case INFO_CLASSIC:
S = "Classic";
break;
case INFO_LEGACY:
S = "Legacy";
break;
case INFO_MODERN:
S = "Modern";
break;
}
ControllerBox = AddComboBox("Player Info Type","What style to draw the player info system in.",'PlayerInfo',PlayerInfoTypeLabel);
ControllerBox.Values.AddItem("Classic");
ControllerBox.Values.AddItem("Legacy");
ControllerBox.Values.AddItem("Modern");
ControllerBox.SetValue(S);
AddButton("Reset","Reset HUD Colors","Resets the color settings for the HUD.",'ResetColors',ResetColorLabel);
}
final function KFGUI_CheckBox AddCheckBox( string Cap, string TT, name IDN, bool bDefault )
{
local KFGUI_CheckBox CB;
CB = KFGUI_CheckBox(SettingsBox.AddListComponent(class'KFGUI_CheckBox'));
CB.LableString = Cap;
CB.ToolTip = TT;
CB.bChecked = bDefault;
CB.InitMenu();
CB.ID = IDN;
CB.OnCheckChange = CheckChange;
return CB;
}
final function KFGUI_Button AddButton( string ButtonText, string Cap, string TT, name IDN, out KFGUI_TextLable Label )
{
local KFGUI_Button CB;
local KFGUI_MultiComponent MC;
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
MC.InitMenu();
Label = new(MC) class'KFGUI_TextLable';
Label.SetText(Cap);
Label.XSize = 0.60;
Label.FontScale = 1;
Label.AlignY = 1;
MC.AddComponent(Label);
CB = new(MC) class'KFGUI_Button';
CB.XPosition = 0.77;
CB.XSize = 0.15;
CB.ButtonText = ButtonText;
CB.ToolTip = TT;
CB.ID = IDN;
CB.OnClickLeft = ButtonClicked;
CB.OnClickRight = ButtonClicked;
MC.AddComponent(CB);
return CB;
}
final function KFGUI_ComboBox AddComboBox( string Cap, string TT, name IDN, out KFGUI_TextLable Label )
{
local KFGUI_ComboBox CB;
local KFGUI_MultiComponent MC;
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
MC.InitMenu();
Label = new(MC) class'KFGUI_TextLable';
Label.SetText(Cap);
Label.XSize = 0.60;
Label.FontScale = 1;
Label.AlignY = 1;
MC.AddComponent(Label);
CB = new(MC) class'KFGUI_ComboBox';
CB.XPosition = 0.77;
CB.XSize = 0.15;
CB.ToolTip = TT;
CB.ID = IDN;
CB.OnComboChanged = OnComboChanged;
MC.AddComponent(CB);
return CB;
}
function OnComboChanged(KFGUI_ComboBox Sender)
{
switch( Sender.ID )
{
case 'PlayerInfo':
switch(Sender.GetCurrent())
{
case "Classic":
HUD.PlayerInfoType = INFO_CLASSIC;
break;
case "Legacy":
HUD.PlayerInfoType = INFO_LEGACY;
break;
case "Modern":
HUD.PlayerInfoType = INFO_MODERN;
break;
}
break;
}
HUD.SaveConfig();
}
function CheckChange( KFGUI_CheckBox Sender )
{
switch( Sender.ID )
{
case 'bDisableHUD':
HUD.bDisableHUD = Sender.bChecked;
HUD.RemoveMovies();
if( HUD.bDisableHUD )
{
HUD.HUDClass = class'KFGFxHudWrapper'.default.HUDClass;
HUD.CreateHUDMovie();
}
else
{
HUD.HUDClass = HUD.default.HUDClass;
HUD.CreateHUDMovie();
}
break;
case 'bLight':
HUD.bLightHUD = Sender.bChecked;
break;
case 'bWeapons':
HUD.bHideWeaponInfo = !Sender.bChecked;
break;
case 'bPersonal':
HUD.bHidePlayerInfo = !Sender.bChecked;
break;
case 'bScore':
HUD.bHideDosh = !Sender.bChecked;
break;
case 'bDisableHiddenPlayers':
HUD.bDisableHiddenPlayers = !Sender.bChecked;
break;
case 'bEnableDamagePopups':
HUD.bEnableDamagePopups = Sender.bChecked;
break;
case 'bShowSpeed':
HUD.bShowSpeed = Sender.bChecked;
break;
case 'bDisableLastZEDIcons':
HUD.bDisableLastZEDIcons = !Sender.bChecked;
break;
case 'bDisablePickupInfo':
HUD.bDisablePickupInfo = !Sender.bChecked;
break;
case 'bDisableLockOnUI':
HUD.bDisableLockOnUI = !Sender.bChecked;
break;
case 'bDisableRechargeUI':
HUD.bDisableRechargeUI = !Sender.bChecked;
break;
case 'bNewScoreboard':
HUD.bNewScoreboard = Sender.bChecked;
HUD.Scoreboard.SetVisibility(false);
if( HUD.HUDMovie.GfxScoreBoardPlayer != None )
HUD.HUDMovie.GfxScoreBoardPlayer.ShowScoreboard(false);
break;
case 'bShowXPEarned':
HUD.bShowXPEarned = Sender.bChecked;
break;
case 'bShowDoshEarned':
HUD.bShowDoshEarned = Sender.bChecked;
break;
}
HUD.SaveConfig();
}
function ButtonClicked( KFGUI_Button Sender )
{
switch( Sender.ID )
{
case 'ResetColors':
HUD.ResetHUDColors();
if( HUD.ColorSettingMenu != None )
{
HUD.ColorSettingMenu.MainHudSlider.SetDefaultColor(HUD.HudMainColor);
HUD.ColorSettingMenu.OutlineSlider.SetDefaultColor(HUD.HudOutlineColor);
HUD.ColorSettingMenu.FontSlider.SetDefaultColor(HUD.FontColor);
}
break;
}
}
defaultproperties
{
Begin Object Class=KFGUI_ComponentList Name=ClientSettingsBox
ID="SettingsBox"
ListItemsPerPage=16
End Object
Components.Add(ClientSettingsBox)
}

View File

@ -0,0 +1,134 @@
Class UI_MidGameMenu extends KFGUI_FloatingWindow;
struct FPageInfo
{
var class<KFGUI_Base> PageClass;
var string Caption,Hint;
};
var KFGUI_SwitchMenuBar PageSwitcher;
var() array<FPageInfo> Pages;
var transient KFGUI_Button PrevButton;
var transient int NumButtons,NumButtonRows;
var KFPlayerReplicationInfo KFPRI;
function InitMenu()
{
local int i;
local KFGUI_Button B;
PageSwitcher = KFGUI_SwitchMenuBar(FindComponentID('Pager'));
Super(KFGUI_Page).InitMenu();
AddMenuButton('Close',"Close","Close this menu");
for( i=0; i<Pages.Length; ++i )
{
PageSwitcher.AddPage(Pages[i].PageClass,Pages[i].Caption,Pages[i].Hint,B).InitMenu();
}
}
function Timer()
{
local PlayerReplicationInfo PRI;
PRI = GetPlayer().PlayerReplicationInfo;
if( PRI==None )
return;
if( KFPlayerController(GetPlayer()).IsBossCameraMode() )
{
DoClose();
return;
}
}
function ShowMenu()
{
Super.ShowMenu();
PlayMenuSound(MN_DropdownChange);
// Update spectate button info text.
Timer();
SetTimer(0.5,true);
Owner.bHideCursor = false;
}
function CloseMenu()
{
Super.CloseMenu();
Owner.bHideCursor = true;
}
function PreDraw()
{
local KFGfxMoviePlayer_Manager MovieManager;
Super.PreDraw();
MovieManager = KFPlayerController(GetPlayer()).MyGFxManager;
if( CaptureMouse() )
MovieManager.SetMovieCanReceiveInput(false);
else MovieManager.SetMovieCanReceiveInput(true);
}
function ButtonClicked( KFGUI_Button Sender )
{
DoClose();
}
final function KFGUI_Button AddMenuButton( name ButtonID, string Text, optional string ToolTipStr )
{
local KFGUI_Button B;
B = new (Self) class'KFGUI_Button';
B.ButtonText = Text;
B.ToolTip = ToolTipStr;
B.OnClickLeft = ButtonClicked;
B.OnClickRight = ButtonClicked;
B.ID = ButtonID;
B.XPosition = 0.05+NumButtons*0.1;
B.XSize = 0.099;
B.YPosition = 0.92+NumButtonRows*0.04;
B.YSize = 0.0399;
PrevButton = B;
if( ++NumButtons>8 )
{
++NumButtonRows;
NumButtons = 0;
}
AddComponent(B);
return B;
}
defaultproperties
{
WindowTitle="Classic HUD - Menu"
XPosition=0.2
YPosition=0.1
XSize=0.6
YSize=0.8
bAlwaysTop=true
bOnlyThisFocus=true
Pages.Add((PageClass=Class'UIP_Settings',Caption="Settings",Hint="Show additional Classic Mode settings"))
Pages.Add((PageClass=Class'UIP_ColorSettings',Caption="Colors",Hint="Settings to adjust the hud colors"))
Begin Object Class=KFGUI_SwitchMenuBar Name=MultiPager
ID="Pager"
XPosition=0.015
YPosition=0.04
XSize=0.975
YSize=0.8
BorderWidth=0.05
ButtonAxisSize=0.1
End Object
Components.Add(MultiPager)
}