diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 5315c22c4..2ae84704c 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -378,6 +378,13 @@ class Thinker : Object native play virtual native void Tick(); virtual native void PostBeginPlay(); virtual native void ChangeStatNum(int stat); + + static int Tics2Seconds(int tics) + { + // This compensates for one tic being slightly less than 1/35 of a second. + return int(tics * (0.98 * TICRATE)); + } + } class ThinkerIterator : Object native diff --git a/wadsrc/static/zscript/statscreen/statscreen_dm.txt b/wadsrc/static/zscript/statscreen/statscreen_dm.txt index 430c5f4ce..a8c7119ee 100644 --- a/wadsrc/static/zscript/statscreen/statscreen_dm.txt +++ b/wadsrc/static/zscript/statscreen/statscreen_dm.txt @@ -229,7 +229,7 @@ class DeathmatchStatusScreen : StatusScreen // Draw game time y += height + CleanYfac; - int seconds = Plrs[me].stime * Thinker.TICRATE; + int seconds = Thinker.Tics2Seconds(Plrs[me].stime); int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; seconds = seconds % 60; diff --git a/wadsrc/static/zscript/statscreen/statscreen_sp.txt b/wadsrc/static/zscript/statscreen/statscreen_sp.txt index 2f6c23bcb..c0af25990 100644 --- a/wadsrc/static/zscript/statscreen/statscreen_sp.txt +++ b/wadsrc/static/zscript/statscreen/statscreen_sp.txt @@ -27,9 +27,9 @@ class DoomStatusScreen : StatusScreen cnt_kills[0] = Plrs[me].skills; cnt_items[0] = Plrs[me].sitems; cnt_secret[0] = Plrs[me].ssecret; - cnt_time = Plrs[me].stime / Thinker.TICRATE; - cnt_par = wbs.partime / Thinker.TICRATE; - cnt_total_time = wbs.totaltime / Thinker.TICRATE; + cnt_time = Thinker.Tics2Seconds(Plrs[me].stime); + cnt_par = Thinker.Tics2Seconds(wbs.partime); + cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime); } if (sp_state == 2) @@ -92,17 +92,18 @@ class DoomStatusScreen : StatusScreen cnt_total_time += 3; } - int sec = Plrs[me].stime / Thinker.TICRATE; + int sec = Thinker.Tics2Seconds(Plrs[me].stime); if (!intermissioncounter || cnt_time >= sec) cnt_time = sec; - int tsec = wbs.totaltime / Thinker.TICRATE; + int tsec = Thinker.Tics2Seconds(wbs.totaltime); if (!intermissioncounter || cnt_total_time >= tsec) cnt_total_time = tsec; - if (!intermissioncounter || cnt_par >= wbs.partime / Thinker.TICRATE) + int psec = Thinker.Tics2Seconds(wbs.partime); + if (!intermissioncounter || cnt_par >= psec) { - cnt_par = wbs.partime / Thinker.TICRATE; + cnt_par = psec; if (cnt_time >= sec) {