- removed all vid_fps offsetting.
To compensate there is now also a "stat fps" which displays the FPS rate in the lower left corner. This had to go because unconditionally altering positions was causing problems with custom HUDs.
This commit is contained in:
parent
24a275804c
commit
e266fb1c16
5 changed files with 49 additions and 55 deletions
|
|
@ -293,13 +293,14 @@ CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL)
|
|||
}
|
||||
|
||||
// Controlled by startup dialog
|
||||
CVAR (Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, r_debug_disable_vis_filter, false, 0)
|
||||
CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, r_debug_disable_vis_filter, false, 0)
|
||||
CVAR(Bool, vid_fps, false, 0)
|
||||
CVAR(Int, vid_showpalette, 0, 0)
|
||||
|
||||
CUSTOM_CVAR (Bool, i_discordrpc, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
I_UpdateWindowTitle();
|
||||
|
|
@ -765,7 +766,34 @@ static void DrawPaletteTester(int paletteno)
|
|||
// Draws the fps counter, dot ticker, and palette debug.
|
||||
//
|
||||
//==========================================================================
|
||||
uint64_t LastCount;
|
||||
uint64_t LastFPS, LastMSCount;
|
||||
|
||||
void CalcFps()
|
||||
{
|
||||
static uint64_t LastMS = 0, LastSec = 0, FrameCount = 0, LastTic = 0;
|
||||
|
||||
uint64_t ms = screen->FrameTime;
|
||||
uint64_t howlong = ms - LastMS;
|
||||
if ((signed)howlong > 0) // do this only once per frame.
|
||||
{
|
||||
uint32_t thisSec = (uint32_t)(ms / 1000);
|
||||
if (LastSec < thisSec)
|
||||
{
|
||||
LastFPS = FrameCount / (thisSec - LastSec);
|
||||
LastSec = thisSec;
|
||||
FrameCount = 0;
|
||||
}
|
||||
FrameCount++;
|
||||
LastMS = ms;
|
||||
LastMSCount = howlong;
|
||||
}
|
||||
}
|
||||
|
||||
ADD_STAT(fps)
|
||||
{
|
||||
CalcFps();
|
||||
return FStringf("%2llu ms (%3llu fps)", (unsigned long long)LastMSCount , (unsigned long long)LastFPS);
|
||||
}
|
||||
|
||||
static void DrawRateStuff()
|
||||
{
|
||||
|
|
@ -774,34 +802,19 @@ static void DrawRateStuff()
|
|||
// Draws frame time and cumulative fps
|
||||
if (vid_fps)
|
||||
{
|
||||
uint64_t ms = screen->FrameTime;
|
||||
uint64_t howlong = ms - LastMS;
|
||||
if ((signed)howlong >= 0)
|
||||
{
|
||||
char fpsbuff[40];
|
||||
int chars;
|
||||
int rate_x;
|
||||
CalcFps();
|
||||
char fpsbuff[40];
|
||||
int chars;
|
||||
int rate_x;
|
||||
int textScale = active_con_scale(twod);
|
||||
|
||||
int textScale = active_con_scale(twod);
|
||||
|
||||
chars = mysnprintf(fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)howlong, (unsigned long long)LastCount);
|
||||
rate_x = screen->GetWidth() / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]);
|
||||
ClearRect(twod, rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, GPalette.BlackIndex, 0);
|
||||
DrawText(twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char*)&fpsbuff[0],
|
||||
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||
DTA_KeepRatio, true, TAG_DONE);
|
||||
|
||||
uint32_t thisSec = (uint32_t)(ms / 1000);
|
||||
if (LastSec < thisSec)
|
||||
{
|
||||
LastCount = FrameCount / (thisSec - LastSec);
|
||||
LastSec = thisSec;
|
||||
FrameCount = 0;
|
||||
}
|
||||
FrameCount++;
|
||||
}
|
||||
LastMS = ms;
|
||||
chars = mysnprintf(fpsbuff, countof(fpsbuff), "%2llu ms (%3llu fps)", (unsigned long long)LastMSCount, (unsigned long long)LastFPS);
|
||||
rate_x = screen->GetWidth() / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]);
|
||||
ClearRect(twod, rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, GPalette.BlackIndex, 0);
|
||||
DrawText(twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char*)&fpsbuff[0],
|
||||
DTA_VirtualWidth, screen->GetWidth() / textScale,
|
||||
DTA_VirtualHeight, screen->GetHeight() / textScale,
|
||||
DTA_KeepRatio, true, TAG_DONE);
|
||||
}
|
||||
|
||||
int Height = screen->GetHeight();
|
||||
|
|
@ -2740,7 +2753,7 @@ FString System_GetLocationDescription()
|
|||
auto& vp = r_viewpoint;
|
||||
auto Level = vp.ViewLevel;
|
||||
return Level == nullptr ? FString() : FStringf("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n%llu fps\n\n",
|
||||
Level->MapName.GetChars(), Level->LevelName.GetChars(), vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw.Degrees, vp.Angles.Pitch.Degrees, (unsigned long long)LastCount);
|
||||
Level->MapName.GetChars(), Level->LevelName.GetChars(), vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw.Degrees, vp.Angles.Pitch.Degrees, (unsigned long long)LastFPS);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue