From 3d542ec50790d9aedec76a9580ba83575f47b2fd Mon Sep 17 00:00:00 2001 From: LostTrackpad Date: Wed, 7 Aug 2024 22:51:14 +0700 Subject: [PATCH] Some other enhancements? --- .../beatrun/gamemode/sh/Checkpoints.lua | 29 +++++++++++++++++-- .../gamemodes/beatrun/gamemode/sh/Replay.lua | 4 +-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua index a1ed074..dda0459 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua @@ -240,6 +240,8 @@ function CourseHUD() local vpz = vp.z local incourse = Course_Name ~= "" local totaltime = CheckpointNumber ~= -1 and math.max(0, CurTime() - Course_StartTime) or Course_EndTime + + local text_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor")) if GetConVar("Beatrun_ShowSpeedometer"):GetBool() then local speed = math.Round(ply:GetVelocity():Length2D() * 0.06858125) @@ -300,21 +302,42 @@ function CourseHUD() end end - if incourse then + if incourse and !ply.InReplay then local text = string.FormattedTime(totaltime, "%02i:%02i:%02i") local w, _ = surface.GetTextSize(text) surface.SetFont("BeatrunHUD") + surface.SetTextColor(text_color) surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz) surface.DrawText(text) end - if incourse and pbtimes then + if incourse and pbtimes and !ply.InReplay then local text = string.FormattedTime(pbtotal, "%02i:%02i:%02i") local w, h = surface.GetTextSize(text) + + pbcolor = text_color + pbcolor.r = text_color.r * 0.6 + pbcolor.g = text_color.g * 0.6 + pbcolor.b = text_color.b * 0.6 surface.SetFont("BeatrunHUD") surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + h + vpz) - surface.SetTextColor(255, 255, 255, 125) + surface.SetTextColor(pbcolor) + surface.DrawText(text) + end + + if incourse and ply.InReplay then + local text = string.FormattedTime(tickcount * engine.TickInterval(), "%02i:%02i:%02i") .. " / " .. string.FormattedTime(#ply.ReplayTicks * engine.TickInterval(), "%02i:%02i:%02i") + local w, _ = surface.GetTextSize(text) + surface.SetFont("BeatrunHUD") + surface.SetTextColor(text_color) + surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz) + surface.DrawText(text) + + local text = "REPLAY MODE - MAY BE INACCURATE" + local w, h = surface.GetTextSize(text) + surface.SetTextColor(text_color) + surface.SetTextPos(ScrW() * 0.87 - w + vpx, ScrH() * 0.075 + vpz + h) surface.DrawText(text) end diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Replay.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Replay.lua index d394a86..b534afb 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Replay.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Replay.lua @@ -133,6 +133,7 @@ end function ReplaySendToClient(ply, args) --if not game.SinglePlayer() then return end + ply.InReplay = true ply:Spawn() local replaydata = util.JSONToTable(util.Decompress(file.Read("beatrun/replays/" .. game.GetMap() .. "/"..Course_Name.."/"..args..".txt", "DATA"))) @@ -152,7 +153,6 @@ function ReplaySendToClient(ply, args) net.WriteData(compressedreplay, #compressedreplay) net.Send(ply) - ply.InReplay = true ply:SetPos(ply.ReplayStartPos) ply:SetVelocity(vector_origin) @@ -197,7 +197,7 @@ if CLIENT then RFF = CurTime() + 1 hook.Add("StartCommand", "ReplayPlay", ReplayPlayback) - hook.Add("RenderScreenspaceEffects", "BeatrunReplayVision", BeatrunReplayVision) + --hook.Add("RenderScreenspaceEffects", "BeatrunReplayVision", BeatrunReplayVision) hook.Add("HUDPaint", "BeatrunReplayHUD", BeatrunReplayHUD) surface.PlaySound("friends/friend_join.wav")