From 9376c4deb4b9f1bc29eae5c7f0ffb031e6819290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Thu, 22 Dec 2022 17:44:09 -0300 Subject: [PATCH] ticrate fixes in native code --- src/am_map.cpp | 13 ++++--------- src/common/utility/i_time.cpp | 3 ++- src/d_main.cpp | 4 ++-- src/doomdef.h | 6 +++++- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 72710bdde9..4f5cd70f1c 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -899,11 +899,6 @@ class DAutomap :public DAutomapBase { DECLARE_CLASS(DAutomap, DAutomapBase) - enum - { - F_PANINC = 140 / TICRATE, // how much the automap moves window per tic in frame-buffer coordinates moves 140 pixels at 320x200 in 1 second - }; - //FLevelLocals *Level; // scale on entry // used by MTOF to scale from map-to-frame-buffer coords @@ -3202,13 +3197,13 @@ void DAutomap::Drawer (int bottom) { m_paninc.x = m_paninc.y = 0; if (buttonMap.ButtonDown(Button_AM_PanLeft)) - m_paninc.x -= FTOM(F_PANINC) * delta * TICRATE; + m_paninc.x -= FTOM(140 / TICRATE /*F_PANINC*/) * delta * TICRATE; if (buttonMap.ButtonDown(Button_AM_PanRight)) - m_paninc.x += FTOM(F_PANINC) * delta * TICRATE; + m_paninc.x += FTOM(140 / TICRATE /*F_PANINC*/) * delta * TICRATE; if (buttonMap.ButtonDown(Button_AM_PanUp)) - m_paninc.y += FTOM(F_PANINC) * delta * TICRATE; + m_paninc.y += FTOM(140 / TICRATE /*F_PANINC*/) * delta * TICRATE; if (buttonMap.ButtonDown(Button_AM_PanDown)) - m_paninc.y -= FTOM(F_PANINC) * delta * TICRATE; + m_paninc.y -= FTOM(140 / TICRATE /*F_PANINC*/) * delta * TICRATE; } // Change the zoom if necessary diff --git a/src/common/utility/i_time.cpp b/src/common/utility/i_time.cpp index d9117d8ea3..e4c640d8da 100644 --- a/src/common/utility/i_time.cpp +++ b/src/common/utility/i_time.cpp @@ -37,6 +37,7 @@ #include #include #include "i_time.h" +#include "doomdef.h" //========================================================================== // @@ -49,7 +50,7 @@ static uint64_t FirstFrameStartTime; static uint64_t CurrentFrameStartTime; static uint64_t FreezeTime; static double lastinputtime; -int GameTicRate = 35; // make sure it is not 0, even if the client doesn't set it. +int GameTicRate = DEFAULT_TICRATE; // make sure it is not 0, even if the client doesn't set it. double TimeScale = 1.0; diff --git a/src/d_main.cpp b/src/d_main.cpp index a1b217f8ca..81ca56065f 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1336,7 +1336,7 @@ void D_DoStrifeAdvanceDemo () case 1: // [RH] Strife fades to black and then to the Rogue logo, but // I think it looks better if it doesn't fade. - pagetic = 10 * TICRATE/35; + pagetic = 10; pagename = ""; // PANEL0, but strife0.wad doesn't have it, so don't use it. PageBlank = true; S_Sound (CHAN_VOICE, CHANF_UI, "bishop/active", 1, ATTN_NORM); @@ -3706,7 +3706,7 @@ CCMD(debug_SetTicRate) int GameMain() { int ret = 0; - GameTicRate = TICRATE; + //GameTicRate = DEFAULT_TICRATE; I_InitTime(); ConsoleCallbacks cb = { diff --git a/src/doomdef.h b/src/doomdef.h index 6982fed064..9975b57471 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -58,7 +58,11 @@ typedef enum #endif // State updates, number of tics / second. -constexpr int TICRATE = 35; +constexpr int DEFAULT_TICRATE = 35; + +extern int GameTicRate; + +#define TICRATE GameTicRate // Global constants that were defines. enum