- use the backend's GameTicRate in the scripts where applicable.

This should replace TICRATE globally as it is the backend's actual ticking speed (still locked to 35, though.)
This commit is contained in:
Christoph Oelckers 2020-10-04 20:26:37 +02:00
parent aa16fefd88
commit e0d8241a50
9 changed files with 15 additions and 13 deletions

View File

@ -1011,6 +1011,7 @@ CCMD(undocolorpic)
DEFINE_GLOBAL(menuactive) DEFINE_GLOBAL(menuactive)
DEFINE_GLOBAL(BackbuttonTime) DEFINE_GLOBAL(BackbuttonTime)
DEFINE_GLOBAL(BackbuttonAlpha) DEFINE_GLOBAL(BackbuttonAlpha)
DEFINE_GLOBAL(GameTicRate)
DEFINE_FIELD(DMenu, mParentMenu) DEFINE_FIELD(DMenu, mParentMenu)
DEFINE_FIELD(DMenu, mMouseCapture); DEFINE_FIELD(DMenu, mMouseCapture);

View File

@ -49,6 +49,7 @@ struct _ native // These are the global variables, the struct is only here to av
native int LocalViewPitch; native int LocalViewPitch;
native readonly @MusPlayingInfo musplaying; native readonly @MusPlayingInfo musplaying;
native readonly bool generic_ui; native readonly bool generic_ui;
native readonly int GameTicRate;
// sandbox state in multi-level setups: // sandbox state in multi-level setups:

View File

@ -191,7 +191,7 @@ class Menu : Object native ui version("2.4")
} }
else if (ev.type == UIEvent.Type_MouseMove) else if (ev.type == UIEvent.Type_MouseMove)
{ {
BackbuttonTime = 4*Thinker.TICRATE; BackbuttonTime = 4*GameTicRate;
if (mMouseCapture || m_use_mouse == 1) if (mMouseCapture || m_use_mouse == 1)
{ {
res = MouseEventBack(MOUSE_Move, ev.MouseX, y); res = MouseEventBack(MOUSE_Move, ev.MouseX, y);

View File

@ -74,7 +74,7 @@ class ReadThisMenu : GenericMenu
} }
screen.Dim(0, 1.0, 0,0, screen.GetWidth(), screen.GetHeight()); screen.Dim(0, 1.0, 0,0, screen.GetWidth(), screen.GetHeight());
alpha = MIN((gametic - mInfoTic) * (3. / Thinker.TICRATE), 1.); alpha = MIN((gametic - mInfoTic) * (3. / GameTicRate), 1.);
if (alpha < 1. && prevpic.IsValid()) if (alpha < 1. && prevpic.IsValid())
{ {
screen.DrawTexture (prevpic, false, 0, 0, DTA_Fullscreen, true); screen.DrawTexture (prevpic, false, 0, 0, DTA_Fullscreen, true);

View File

@ -633,7 +633,7 @@ class StatusScreen abstract play version("2.5")
bool autoSkip() bool autoSkip()
{ {
return wi_autoadvance > 0 && bcnt > (wi_autoadvance * Thinker.TICRATE); return wi_autoadvance > 0 && bcnt > (wi_autoadvance * GameTicRate);
} }
//==================================================================== //====================================================================
@ -703,7 +703,7 @@ class StatusScreen abstract play version("2.5")
CurState = ShowNextLoc; CurState = ShowNextLoc;
acceleratestage = 0; acceleratestage = 0;
cnt = SHOWNEXTLOCDELAY * Thinker.TICRATE; cnt = SHOWNEXTLOCDELAY * GameTicRate;
noautostartmap = bg.LoadBackground(true); noautostartmap = bg.LoadBackground(true);
} }

View File

@ -23,7 +23,7 @@ class CoopStatusScreen : StatusScreen
FontScale = max(screen.GetHeight() / 400, 1); FontScale = max(screen.GetHeight() / 400, 1);
RowHeight = int(max((displayFont.GetHeight() + 1) * FontScale, 1)); RowHeight = int(max((displayFont.GetHeight() + 1) * FontScale, 1));
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
for (int i = 0; i < MAXPLAYERS; i++) for (int i = 0; i < MAXPLAYERS; i++)
{ {
@ -236,7 +236,7 @@ class CoopStatusScreen : StatusScreen
if (!--cnt_pause) if (!--cnt_pause)
{ {
ng_state++; ng_state++;
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
} }
} }
} }

View File

@ -33,7 +33,7 @@ class DeathmatchStatusScreen : StatusScreen
total_deaths = 0; total_deaths = 0;
ng_state = 1; ng_state = 1;
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
for (i=0 ; i<MAXPLAYERS ; i++) for (i=0 ; i<MAXPLAYERS ; i++)
{ {
@ -144,7 +144,7 @@ class DeathmatchStatusScreen : StatusScreen
if (!--cnt_pause) if (!--cnt_pause)
{ {
ng_state++; ng_state++;
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
} }
} }
} }

View File

@ -11,7 +11,7 @@ class DoomStatusScreen : StatusScreen
sp_state = 1; sp_state = 1;
cnt_kills[0] = cnt_items[0] = cnt_secret[0] = -1; cnt_kills[0] = cnt_items[0] = cnt_secret[0] = -1;
cnt_time = cnt_par = -1; cnt_time = cnt_par = -1;
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
cnt_total_time = -1; cnt_total_time = -1;
} }
@ -28,7 +28,7 @@ class DoomStatusScreen : StatusScreen
cnt_items[0] = Plrs[me].sitems; cnt_items[0] = Plrs[me].sitems;
cnt_secret[0] = Plrs[me].ssecret; cnt_secret[0] = Plrs[me].ssecret;
cnt_time = Thinker.Tics2Seconds(Plrs[me].stime); cnt_time = Thinker.Tics2Seconds(Plrs[me].stime);
cnt_par = wbs.partime / Thinker.TICRATE; cnt_par = wbs.partime / GameTicRate;
cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime); cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime);
} }
@ -100,7 +100,7 @@ class DoomStatusScreen : StatusScreen
if (!intermissioncounter || cnt_total_time >= tsec) if (!intermissioncounter || cnt_total_time >= tsec)
cnt_total_time = tsec; cnt_total_time = tsec;
int psec = wbs.partime / Thinker.TICRATE; int psec = wbs.partime / GameTicRate;
if (!intermissioncounter || cnt_par >= psec) if (!intermissioncounter || cnt_par >= psec)
{ {
cnt_par = psec; cnt_par = psec;
@ -126,7 +126,7 @@ class DoomStatusScreen : StatusScreen
if (!--cnt_pause) if (!--cnt_pause)
{ {
sp_state++; sp_state++;
cnt_pause = Thinker.TICRATE; cnt_pause = GameTicRate;
} }
} }
} }

View File

@ -800,7 +800,7 @@ class AltHud ui
if (showMillis) if (showMillis)
{ {
int millis = (Level.time % Thinker.TICRATE) * (1000 / Thinker.TICRATE); int millis = (Level.time % GameTicRate) * 1000 / GameTicRate;
timeString = String.Format("%02i:%02i:%02i.%03i", hours, minutes, seconds, millis); timeString = String.Format("%02i:%02i:%02i.%03i", hours, minutes, seconds, millis);
} }
else if (showSeconds) else if (showSeconds)