Skip to content

Commit fe76f3c

Browse files
author
Shtoyan
committed
initial commit
1 parent 49947cb commit fe76f3c

22 files changed

Lines changed: 7683 additions & 2 deletions

Classes/AssetLoader.#uc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class AssetLoader extends Actor
2+
notplaceable;
3+
4+
//we need to do this shit or custom font won't load client side
5+
//also added true KF2 font instead of 'Elegance' font that Zedek had originally
6+
#exec OBJ LOAD FILE="KF2Font.utx" package="KF2HUD"
7+
8+
defaultproperties
9+
{
10+
}

Classes/KF2DamageMessage.uc

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
Class KF2DamageMessage extends LocalMessage;
2+
3+
var localized string HPString;
4+
var localized float MessageShowTime;
5+
6+
static function string GetNameOf( class<Monster> M )
7+
{
8+
if( Len(M.Default.MenuName)==0 )
9+
return string(M.Name);
10+
return M.Default.MenuName;
11+
}
12+
13+
static function ClientReceive(PlayerController P, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
14+
{
15+
local KF2HUD H;
16+
17+
if( Class<Monster>(OptionalObject)==None || HudBase(P.myHud)==None || (RelatedPRI_1==None && Switch==1) )
18+
return;
19+
20+
// Change this to the proper class
21+
H = KF2HUD(P.myHud);
22+
if(H != none)
23+
{
24+
if (!H.UpdateDamageMessage(OptionalObject,RelatedPRI_1,Switch))
25+
H.LocalizedMessage(Default.Class,Switch,RelatedPRI_1,,OptionalObject);
26+
}
27+
28+
}
29+
30+
static function float GetLifeTime(int Switch)
31+
{
32+
return default.MessageShowTime;
33+
}
34+
35+
static function string GetString(
36+
optional int Switch,
37+
optional PlayerReplicationInfo RelatedPRI_1,
38+
optional PlayerReplicationInfo RelatedPRI_2,
39+
optional Object OptionalObject
40+
)
41+
{
42+
return GetNameOf(Class<Monster>(OptionalObject))@"-"$Switch@Default.HPString;
43+
}
44+
45+
// Fade color: Green (0-99 damage) > Yellow (100-499 damage) > Red (500-999 damage) > Dark Red (999+ damage).
46+
static function color GetColor(
47+
optional int Switch,
48+
optional PlayerReplicationInfo RelatedPRI_1,
49+
optional PlayerReplicationInfo RelatedPRI_2
50+
)
51+
{
52+
local color C;
53+
54+
C.A = 255;
55+
if( Switch<800 )
56+
{
57+
C.G = Clamp(512-Switch,0,255);
58+
C.R = Clamp((Switch * 2.5f),0,255);
59+
}
60+
else C.R = Clamp(1256-Switch,150,255);
61+
return C;
62+
}
63+
64+
defaultproperties
65+
{
66+
HPString="HP"
67+
MessageShowTime=4.000000
68+
bIsConsoleMessage=False
69+
bFadeMessage=True
70+
DrawColor=(B=0,G=0,R=150)
71+
DrawPivot=DP_UpperLeft
72+
StackMode=SM_Down
73+
PosX=0.020000
74+
PosY=0.650000
75+
FontSize=-2
76+
}

Classes/KF2GUILabel.uc

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
class KF2GUILabel extends GUILabel;
2+
3+
var() byte AlignMode;
4+
var() font KF2Font;
5+
var() bool bKorean;
6+
var() float KoreanScale;
7+
8+
function bool InternalDraw(Canvas canvas)
9+
{
10+
local float AW, AH, AL, AT, SS, TW, TH;
11+
local float TempX, TempY;
12+
local Font F;
13+
14+
if (bVisible)
15+
{
16+
AW = ActualWidth();
17+
AH = ActualHeight();
18+
AL = ActualLeft();
19+
AT = ActualTop();
20+
21+
SS = canvas.ClipY / 1080.0;
22+
23+
F = Canvas.Font;
24+
25+
// if (default.bKorean)
26+
// Canvas.Font = Class'FHLang_Core'.default.KoreanFont;
27+
// else
28+
Canvas.Font = KF2Font;
29+
30+
Canvas.FontScaleX = 1.0;
31+
Canvas.FontScaleY = 1.0;
32+
33+
Canvas.TextSize(Caption, TW, TH);
34+
35+
Canvas.FontScaleX = (AH / TH) * SS;
36+
Canvas.FontScaleY = (AH / TH) * SS;
37+
38+
if (default.bKorean)
39+
{
40+
Canvas.FontScaleX *= KoreanScale;
41+
Canvas.FontScaleY *= KoreanScale;
42+
}
43+
44+
Canvas.TextSize(Caption, TW, TH);
45+
46+
TempY = (AT + (AH*0.5)) - (TH*0.5);
47+
48+
if (AlignMode == 0)
49+
TempX = AL;
50+
else if (AlignMode == 1)
51+
TempX = ( AL+ (AW*0.5) ) - (TW*0.5);
52+
else if (AlignMode == 2)
53+
TempX = (AL+AW) - TW;
54+
55+
Canvas.SetPos(TempX, TempY);
56+
Canvas.DrawColor = TextColor;
57+
Canvas.DrawText(Caption);
58+
59+
Canvas.Font = F;
60+
Canvas.FontScaleX = 1.0;
61+
Canvas.FontScaleY = 1.0;
62+
}
63+
64+
return true;
65+
}
66+
67+
defaultproperties
68+
{
69+
KF2Font=Font'KF2HUD.KF2Font'
70+
KoreanScale=0.900000
71+
OnDraw=KF2GUILabel.InternalDraw
72+
}

0 commit comments

Comments
 (0)