Skip to content

Commit

Permalink
Difficulty meter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiskster committed Aug 24, 2024
1 parent 092efd4 commit b92f806
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 4 deletions.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA0.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA1.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA10.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA11.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA12.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA13.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA2.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA3.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA4.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA5.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA6.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA7.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA8.lmp
Binary file not shown.
Binary file added src/Graphics/DifficultyFire/PTSR_DIFF_FIREA9.lmp
Binary file not shown.
24 changes: 21 additions & 3 deletions src/Lua/HUD/hud_tooltips.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
local tooltips_hud = function(v, player)
if not PTSR.IsPTSR() then return end
local gm_metadata = PTSR.currentModeMetadata()

local count = PTSR_COUNT()
--local practicemodetext = "\x84\* PRACTICE MODE *"
local infinitelapstext = tostring(player.ptsr.laps)
Expand Down Expand Up @@ -58,12 +60,28 @@ local tooltips_hud = function(v, player)
local lapflag_name = "PTSR_LAPFLAG"
lapflag_name = $ .. "_A" .. tostring((leveltime/2)%12)
local lapflag_patch = v.cachePatch(lapflag_name)
v.drawScaled(148*FU, ese-(FU*12), FU/2, lapflag_patch, V_PERPLAYER|V_SNAPTOBOTTOM)
local lapflag_patch_x = 148*FU
local lapflag_text_x = lapflag_patch_x + 17*FU

-- Lap Count Flag Graphic
v.drawScaled(lapflag_patch_x, ese-(FU*12), FU/2, lapflag_patch, V_PERPLAYER|V_SNAPTOBOTTOM)

if gm_metadata.core_endurance then
-- Difficulty
local difficulty_name = "PTSR_DIFF_FIRE"
difficulty_name = $ .. "A" .. tostring((leveltime/2)%14)
local difficulty_patch = v.cachePatch(difficulty_name)
local difficulty_string = string.format("%.2f", PTSR.difficulty)
v.drawScaled(lapflag_patch_x+(40*FU), ese-(FU*14), FU/2, difficulty_patch, V_PERPLAYER|V_SNAPTOBOTTOM)
customhud.CustomFontString(v, lapflag_text_x+(40*FU), ese-(FU*6), difficulty_string, "PTFNT", V_PERPLAYER|V_SNAPTOBOTTOM, "center", FU/3, SKINCOLOR_PURPLE)
end


if CV_PTSR.default_maxlaps.value then
v.drawString(165*FU, ese-(FU*4), lapstext, V_PERPLAYER|V_SNAPTOBOTTOM, "thin-fixed-center")
v.drawString(lapflag_text_x, ese-(FU*4), lapstext, V_PERPLAYER|V_SNAPTOBOTTOM, "thin-fixed-center")
else -- infinite laps
customhud.CustomFontString(v, 165*FU, ese-(FU*6), infinitelapstext, "SMNPT", V_PERPLAYER|V_SNAPTOBOTTOM, "center", FRACUNIT/2, SKINCOLOR_YELLOW)
customhud.CustomFontString(v, 165*FU, ese-(FU*6), infinitelapstext, "SMNPT", V_PERPLAYER|V_SNAPTOBOTTOM, "center", FU/2, SKINCOLOR_YELLOW)

--v.drawString(165*FU, ese-(FU*4), infinitelapstext, V_PERPLAYER|V_SNAPTOBOTTOM, "thin-fixed-center")
end
end
Expand Down
2 changes: 2 additions & 0 deletions src/Lua/Init/initmap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ local function InitMap()
PTSR.untilend = 0
PTSR.dustdeviltimer = 0
PTSR.aipf = nil
PTSR.difficulty = FRACUNIT
PTSR.pizzaface_speed_multi = FRACUNIT

PTSR.vote_maplist = {}

Expand Down
9 changes: 9 additions & 0 deletions src/Lua/PlayerScripts/player_lapend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ end

PTSR.DoLapBonus = function(player)
local gm_metadata = PTSR.currentModeMetadata()
local count = PTSR_COUNT()

PTSR.ChatLapStatus(player)

Expand All @@ -24,6 +25,14 @@ PTSR.DoLapBonus = function(player)
local ringbonus = player.rings * (gm_metadata.ringlapbonus or PTSR.ringlapbonus)
local combobonus = player.ptsr.combo_count * (gm_metadata.combobonus or PTSR.combobonus)

if gm_metadata.core_endurance then
if not PTSR.isOvertime() then
PTSR.difficulty = $ + FixedDiv((FU/10), count.peppinos*FU)
else
PTSR.difficulty = $ + FixedDiv((FU/10)*3, count.peppinos*FU)
end
end

if PTSR_DoHook("onbonus", player) == true then
escapebonus = false
end
Expand Down
18 changes: 17 additions & 1 deletion src/Lua/main_game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ addHook("NetVars", function(net)
"dustdeviltimer",

"nextgamemode",

"difficulty",

"pizzaface_speed_multi",
}

for i,v in ipairs(sync_list) do
Expand Down Expand Up @@ -317,12 +321,24 @@ local RANKMUS = {
PTSR.RANKMUS = RANKMUS

addHook("ThinkFrame", do
local gm_metadata = PTSR.currentModeMetadata()
local count = PTSR_COUNT()

if PTSR.pizzatime then
P_StartQuake(FRACUNIT*4, 1)
PTSR.pizzatime_tics = $ + 1


if gm_metadata.core_endurance then
if (PTSR.pizzatime_tics % TICRATE) == 0 then

if not PTSR.isOvertime() then
PTSR.difficulty = $ + FRACUNIT/128
else
PTSR.difficulty = $ + FRACUNIT/32
end
end
end

if CV_PTSR.timelimit.value then
if not (PTSR.timeleft) then
PTSR.timeover_tics = $ + 1
Expand Down

0 comments on commit b92f806

Please sign in to comment.