mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-04-22 02:40:57 +00:00
- implement ability to change GameTicRate
This commit is contained in:
parent
adfef56fd8
commit
a90bc82959
4 changed files with 47 additions and 1 deletions
|
@ -13,6 +13,7 @@ struct FStartupInfo
|
|||
FString def;
|
||||
FString DiscordAppId = nullptr;
|
||||
FString SteamAppId = nullptr;
|
||||
int TicRate = -1;
|
||||
int Type;
|
||||
int LoadLights = -1;
|
||||
int LoadBrightmaps = -1;
|
||||
|
|
|
@ -255,6 +255,12 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
|
|||
sc.MustGetString();
|
||||
iwad->SteamAppId = sc.String;
|
||||
}
|
||||
else if (sc.Compare("TicRate"))
|
||||
{
|
||||
sc.MustGetStringName("=");
|
||||
sc.MustGetNumber();
|
||||
iwad->TicRate = sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Unknown keyword '%s'", sc.String);
|
||||
|
@ -859,6 +865,7 @@ const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *i
|
|||
if (GameStartupInfo.Song.IsEmpty()) GameStartupInfo.Song = iwad_info->Song;
|
||||
if (GameStartupInfo.DiscordAppId.IsEmpty()) GameStartupInfo.DiscordAppId = iwad_info->DiscordAppId;
|
||||
if (GameStartupInfo.SteamAppId.IsEmpty()) GameStartupInfo.SteamAppId = iwad_info->SteamAppId;
|
||||
if (GameStartupInfo.TicRate == -1) GameStartupInfo.TicRate = iwad_info->TicRate;
|
||||
I_SetIWADInfo();
|
||||
return iwad_info;
|
||||
}
|
||||
|
|
|
@ -1876,6 +1876,11 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
|
|||
sc.MustGetString();
|
||||
GameStartupInfo.SteamAppId = sc.String;
|
||||
}
|
||||
else if (!nextKey.CompareNoCase("TICRATE"))
|
||||
{
|
||||
sc.MustGetNumber();
|
||||
GameStartupInfo.TicRate = sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Silently ignore unknown properties
|
||||
|
@ -3654,9 +3659,16 @@ static int D_DoomMain_Internal (void)
|
|||
delete iwad_man; // now we won't need this anymore
|
||||
iwad_man = NULL;
|
||||
if (ret != 0) return ret;
|
||||
|
||||
if ((GameStartupInfo.TicRate) != -1)
|
||||
{
|
||||
if (((GameStartupInfo.TicRate) < TICRATEMIN) || ((GameStartupInfo.TicRate) > TICRATEMAX))
|
||||
I_FatalError("TicRate can only be in the range of %i to %i! (Default TicRate for Doom engine games: 35)", TICRATEMIN, TICRATEMAX);
|
||||
else
|
||||
GameTicRate = GameStartupInfo.TicRate;
|
||||
}
|
||||
D_DoAnonStats();
|
||||
I_UpdateWindowTitle();
|
||||
|
||||
D_DoomLoop (); // this only returns if a 'restart' CCMD is given.
|
||||
//
|
||||
// Clean up after a restart
|
||||
|
@ -3669,6 +3681,28 @@ static int D_DoomMain_Internal (void)
|
|||
while (1);
|
||||
}
|
||||
|
||||
CCMD(debug_SetTicRate)
|
||||
{
|
||||
if (argv.argc() < 2)
|
||||
Printf("Current game ticrate is: %i\n", GameTicRate);
|
||||
else
|
||||
{
|
||||
uint32_t value = atoi(argv[1]);
|
||||
if (netgame)
|
||||
Printf("Time scale cannot be changed in net games.\n");
|
||||
else if (value < TICRATEMIN)
|
||||
Printf("TicRate must be at least %i!\n", TICRATEMIN);
|
||||
else if (value > TICRATEMAX)
|
||||
Printf("TicRate must be at most %i!\n", TICRATEMAX);
|
||||
else
|
||||
{
|
||||
GameTicRate = value;
|
||||
I_ResetFrameTime();
|
||||
Printf("Testing game tic rate: %i\n", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int GameMain()
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include "startupinfo.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
#define TICRATEMIN 25
|
||||
#define TICRATEMAX 50
|
||||
|
||||
extern bool advancedemo;
|
||||
extern bool hud_toggled;
|
||||
void D_ToggleHud();
|
||||
|
@ -95,6 +98,7 @@ struct FIWADInfo
|
|||
int LoadLights = -1;
|
||||
FString DiscordAppId = nullptr;
|
||||
FString SteamAppId = nullptr;
|
||||
int TicRate = -1;
|
||||
};
|
||||
|
||||
struct FFoundWadInfo
|
||||
|
|
Loading…
Reference in a new issue