Skip to content

Commit

Permalink
Merge pull request #4 from InsultingPros/dev
Browse files Browse the repository at this point in the history
Fix the mod to work with Scrn Balance v9.69.16 and higher.
  • Loading branch information
Shtoyan authored Aug 30, 2022
2 parents 775f0c8 + 318638b commit 86eece5
Show file tree
Hide file tree
Showing 17 changed files with 5,415 additions and 5,421 deletions.
52 changes: 26 additions & 26 deletions Classes/KF2DamageMessage.uc
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ var localized float MessageShowTime;

static function string GetNameOf( class<Monster> M )
{
if( Len(M.Default.MenuName)==0 )
return string(M.Name);
return M.Default.MenuName;
if( Len(M.Default.MenuName)==0 )
return string(M.Name);
return M.Default.MenuName;
}

static function ClientReceive(PlayerController P, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
{
local KF2HUD H;
if( Class<Monster>(OptionalObject)==None || HudBase(P.myHud)==None || (RelatedPRI_1==None && Switch==1) )
return;
// Change this to the proper class
H = KF2HUD(P.myHud);
local KF2HUD H;

if( Class<Monster>(OptionalObject)==None || HudBase(P.myHud)==None || (RelatedPRI_1==None && Switch==1) )
return;

// Change this to the proper class
H = KF2HUD(P.myHud);
if(H != none)
{
if (!H.UpdateDamageMessage(OptionalObject,RelatedPRI_1,Switch))
H.LocalizedMessage(Default.Class,Switch,RelatedPRI_1,,OptionalObject);
H.LocalizedMessage(Default.Class,Switch,RelatedPRI_1,,OptionalObject);
}

}

static function float GetLifeTime(int Switch)
{
return default.MessageShowTime;
return default.MessageShowTime;
}

static function string GetString(
Expand All @@ -39,26 +39,26 @@ static function string GetString(
optional Object OptionalObject
)
{
return GetNameOf(Class<Monster>(OptionalObject))@"-"[email protected];
return GetNameOf(Class<Monster>(OptionalObject))@"-"[email protected];
}
// Fade color: Green (0-99 damage) > Yellow (100-499 damage) > Red (500-999 damage) > Dark Red (999+ damage).
static function color GetColor(
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2
)
optional int Switch,
optional PlayerReplicationInfo RelatedPRI_1,
optional PlayerReplicationInfo RelatedPRI_2
)
{
local color C;
local color C;
C.A = 255;
if( Switch<800 )
{
C.G = Clamp(512-Switch,0,255);
C.R = Clamp((Switch * 2.5f),0,255);
}
else C.R = Clamp(1256-Switch,150,255);
return C;
C.A = 255;
if( Switch<800 )
{
C.G = Clamp(512-Switch,0,255);
C.R = Clamp((Switch * 2.5f),0,255);
}
else C.R = Clamp(1256-Switch,150,255);
return C;
}
defaultproperties
Expand Down
118 changes: 59 additions & 59 deletions Classes/KF2GUILabel.uc
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
class KF2GUILabel extends GUILabel;

var() byte AlignMode;
var() font KF2Font;
var() bool bKorean;
var() float KoreanScale;
var() byte AlignMode;
var() font KF2Font;
var() bool bKorean;
var() float KoreanScale;

function bool InternalDraw(Canvas canvas)
{
local float AW, AH, AL, AT, SS, TW, TH;
local float TempX, TempY;
local Font F;
if (bVisible)
{
AW = ActualWidth();
AH = ActualHeight();
AL = ActualLeft();
AT = ActualTop();
SS = canvas.ClipY / 1080.0;

F = Canvas.Font;
// if (default.bKorean)
// Canvas.Font = Class'FHLang_Core'.default.KoreanFont;
// else
Canvas.Font = KF2Font;

Canvas.FontScaleX = 1.0;
Canvas.FontScaleY = 1.0;
Canvas.TextSize(Caption, TW, TH);

Canvas.FontScaleX = (AH / TH) * SS;
Canvas.FontScaleY = (AH / TH) * SS;
if (default.bKorean)
{
Canvas.FontScaleX *= KoreanScale;
Canvas.FontScaleY *= KoreanScale;
}

Canvas.TextSize(Caption, TW, TH);
TempY = (AT + (AH*0.5)) - (TH*0.5);

if (AlignMode == 0)
TempX = AL;
else if (AlignMode == 1)
TempX = ( AL+ (AW*0.5) ) - (TW*0.5);
else if (AlignMode == 2)
TempX = (AL+AW) - TW;

Canvas.SetPos(TempX, TempY);
Canvas.DrawColor = TextColor;
Canvas.DrawText(Caption);

Canvas.Font = F;
Canvas.FontScaleX = 1.0;
Canvas.FontScaleY = 1.0;
}
return true;
local float AW, AH, AL, AT, SS, TW, TH;
local float TempX, TempY;
local Font F;

if (bVisible)
{
AW = ActualWidth();
AH = ActualHeight();
AL = ActualLeft();
AT = ActualTop();

SS = canvas.ClipY / 1080.0;

F = Canvas.Font;

// if (default.bKorean)
// Canvas.Font = Class'FHLang_Core'.default.KoreanFont;
// else
Canvas.Font = KF2Font;

Canvas.FontScaleX = 1.0;
Canvas.FontScaleY = 1.0;

Canvas.TextSize(Caption, TW, TH);

Canvas.FontScaleX = (AH / TH) * SS;
Canvas.FontScaleY = (AH / TH) * SS;

if (default.bKorean)
{
Canvas.FontScaleX *= KoreanScale;
Canvas.FontScaleY *= KoreanScale;
}

Canvas.TextSize(Caption, TW, TH);

TempY = (AT + (AH*0.5)) - (TH*0.5);

if (AlignMode == 0)
TempX = AL;
else if (AlignMode == 1)
TempX = ( AL+ (AW*0.5) ) - (TW*0.5);
else if (AlignMode == 2)
TempX = (AL+AW) - TW;

Canvas.SetPos(TempX, TempY);
Canvas.DrawColor = TextColor;
Canvas.DrawText(Caption);

Canvas.Font = F;
Canvas.FontScaleX = 1.0;
Canvas.FontScaleY = 1.0;
}

return true;
}

defaultproperties
Expand Down
Loading

0 comments on commit 86eece5

Please sign in to comment.