Skip to content

Commit

Permalink
EMERGENCY FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Saxashitter committed Sep 7, 2024
1 parent 873a4e5 commit 87e27e3
Showing 1 changed file with 50 additions and 29 deletions.
79 changes: 50 additions & 29 deletions src/Lua/HUD/hud_score.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,38 @@ local toppingsOnScore = {
[5] = "SCOREPEPPER"
}

local displayValues = {}

function PTSR.add_wts_score(player, mobj, score, delay, color)
local x = 0
local y = 0
local s = FU
local score = score or 100
local delay = delay or 0

if player == displayplayer then
player.ptsr.score_objects[#player.ptsr.score_objects+1] = {
score = score,
tics = -delay,
color = color or SKINCOLOR_WHITE,
}

if player == consoleplayer then
local wts = SG_ObjectTracking(fakeV,player,camera,mobj)

if wts.onScreen then
x = wts.x
y = wts.y
s = wts.scale/2
end
displayValues[#displayValues+1] = {
x = x,
y = y,
s = GO_TO_S,
tics = -delay,
score = score,
color = color or SKINCOLOR_WHITE
}
end

player.ptsr.score_objects[#player.ptsr.score_objects+1] = {
x = x,
y = y,
s = GO_TO_S,
score = score,
tics = -delay,
color = color or SKINCOLOR_WHITE,
}
end

function PTSR.add_xy_score(player, x, y, score, delay, color)
Expand All @@ -86,13 +93,20 @@ function PTSR.add_xy_score(player, x, y, score, delay, color)
local delay = delay or 0

player.ptsr.score_objects[#player.ptsr.score_objects+1] = {
x = x,
y = y,
s = GO_TO_S,
score = score,
tics = -delay,
color = color or SKINCOLOR_WHITE,
}
if player == consoleplayer then
displayValues[#displayValues+1] = {
x = x,
y = y,
s = GO_TO_S,
tics = -delay,
score = score,
color = color or SKINCOLOR_WHITE
}
end
end

addHook("PlayerThink", function(p)
Expand All @@ -113,6 +127,15 @@ addHook("PlayerThink", function(p)
end
end)

addHook("ThinkFrame", do
for k,data in pairs(displayValues) do
data.tics = $+1
if data.tics > MAX_TICS
table.remove(displayValues, k)
end
end
end)

local score_hud = function(v, player)
if not player.ptsr then return end

Expand Down Expand Up @@ -162,22 +185,20 @@ local score_hud = function(v, player)
ox = ($-320)*(FU/2)
oy = ($-200)*(FU/2)

if player.ptsr then
for k,data in pairs(player.ptsr.score_objects) do
local t = FixedDiv(max(0, data.tics), MAX_TICS)
local drawX = ease.incubic(t, data.x, GO_TO_X-ox)
local drawY = ease.incubic(t, data.y, GO_TO_Y-oy)

customhud.CustomFontString(v,
drawX,
drawY,
tostring(data.score),
"PTFNT",
V_PERPLAYER,
"center",
data.s,
data.color)
end
for k,data in pairs(displayValues) do
local t = FixedDiv(max(0, data.tics), MAX_TICS)
local drawX = ease.incubic(t, data.x, GO_TO_X-ox)
local drawY = ease.incubic(t, data.y, GO_TO_Y-oy)

customhud.CustomFontString(v,
drawX,
drawY,
tostring(data.score),
"PTFNT",
V_PERPLAYER,
"center",
data.s,
data.color)
end
end

Expand Down

0 comments on commit 87e27e3

Please sign in to comment.