rott/kf_sources/HideMut/Classes.backup/stub_HUD.uc
2026-07-14 20:27:09 +07:00

139 lines
3.2 KiB
Ucode

class stub_HUD extends HUD_StoryMode;
// functions to replace
struct MsgStruct
{
var string Msg;
var int count;
var float time;
};
var transient array<MsgStruct> MsgArray;
simulated function DrawHudPassC(Canvas C)
{
DrawFadeEffect(C);
if (bShowScoreBoard && ScoreBoard != none)
{
ScoreBoard.DrawScoreboard(C);
}
// portrait
if (bShowPortrait && Portrait != none)
{
DrawPortrait(C);
}
// Comment Out for Release
if (Level.NetMode == NM_StandAlone)
{
DrawCrosshair(C);
}
// TEST
DrawPointSphere();
// Slow, for debugging only
// if ( bDebugPlayerCollision && (class'ROEngine.ROLevelInfo'.static.RODebugMode() || Level.NetMode == NM_StandAlone) )
// {
// }
}
simulated function Message(PlayerReplicationInfo PRI, coerce string Msg, name MsgType)
{
local class<LocalMessage> LocalMessageClass;
// portrait switch
if (!class'Settings'.default.bHidePortraits && PRI != none && MsgType == 'Say' || MsgType == 'TeamSay')
DisplayPortrait(PRI);
if (class'Settings'.default.bHideNoPRImessages && PRI == none)
return;
// do not allow spam bullshit
// if (!class'stub_HUD'.static.AllowMessage(class'stub_HUD'.default.MsgArray, PlayerOwner.Level.TimeSeconds, PRI, Msg, MsgType))
// return;
switch (MsgType)
{
case 'Trader':
Msg = TraderString$":" @ Msg;
LocalMessageClass = class'SayMessagePlus';
break;
case 'Voice':
case 'Say':
if (PRI == none)
{
return;
}
Msg = PRI.PlayerName $ ":" @ Msg;
LocalMessageClass = class'SayMessagePlus';
break;
case 'TeamSay':
if (PRI == none)
{
return;
}
Msg = PRI.PlayerName $ "(" $ PRI.GetLocationName() $ "):" @ Msg;
LocalMessageClass = class'TeamSayMessagePlus';
break;
case 'CriticalEvent':
LocalMessageClass = class'KFCriticalEventPlus';
LocalizedMessage(LocalMessageClass, 0, None, None, None, Msg);
return;
case 'DeathMessage':
LocalMessageClass = class'xDeathMessage';
break;
default:
LocalMessageClass = class'StringMessagePlus';
break;
}
AddTextMessage(Msg, LocalMessageClass, PRI);
}
// final static function bool AllowMessage(array<MsgStruct> MsgArray, float TimeSeconds, PlayerReplicationInfo PRI, coerce string Msg, name MsgType)
// {
// local int i, idx, len, nonPRI_limit, PRI_limit;
// local bool bFoundEntry;
// len = MsgArray.length;
// // at first search string in DB array
// if (len > 0)
// {
// for (i = 0; i < len; i++)
// {
// if (Msg ~= MsgArray[i].Msg)
// {
// idx = i;
// bFoundEntry = true;
// break;
// }
// }
// }
// else
// {
// MsgArray[0].Msg = Msg;
// MsgArray[0].count = 0;
// MsgArray[0].time = TimeSeconds;
// return true;
// }
// // add to DB array if its unique string
// if (!bFoundEntry)
// {
// MsgArray[len].Msg = Msg;
// MsgArray[len].count = 0;
// MsgArray[len].time = TimeSeconds;
// log("Message : " $ Msg $ " added at " $ TimeSeconds);
// // break here, this is an unique msg
// return true;
// }
// }