diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index c61556795..87b20ee47 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2436,12 +2436,18 @@ static void G_PrintFPS(void) { // adapted from ZDoom because I like it better than what we had // applicable ZDoom code available under GPL from csDoom - static int32_t FrameCount = 0; - static int32_t LastCount = 0; - static int32_t LastSec = 0; - static int32_t LastMS = 0; + static int32_t FrameCount = 0, LastCount = 0, LastSec = 0, LastMS = 0; + static int32_t MinFrames = INT32_MAX, MaxFrames = 0; + int32_t ms = getticks(); int32_t howlong = ms - LastMS; + + if (g_player[0].ps->player_par < 2) + { + MinFrames = INT32_MAX; + MaxFrames = 0; + } + if (howlong >= 0) { int32_t thisSec = ms/1000; @@ -2455,14 +2461,29 @@ static void G_PrintFPS(void) printext256(windowx2-(chars<<(3-x)),windowy1+1, (LastCount < LOW_FPS) ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); + if (ud.tickrate > 1) + { + chars = Bsprintf(tempbuf, "max fps: %3u", MaxFrames); + + printext256(windowx2-(chars<<(3-x))+1, windowy1+10+2, 0, -1, tempbuf, x); + printext256(windowx2-(chars<<(3-x)), windowy1+10, + (MaxFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); + + chars = Bsprintf(tempbuf, "min fps: %3u", MinFrames); + + printext256(windowx2-(chars<<(3-x))+1, windowy1+20+2, 0, -1, tempbuf, x); + printext256(windowx2-(chars<<(3-x)), windowy1+20, + (MinFrames < LOW_FPS) ? COLOR_RED : COLOR_WHITE, -1, tempbuf, x); + } + // lag meter if (g_netClientPeer) { chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2, (g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2); - printext256(windowx2-(chars<<(3-x))+1,windowy1+10+2,0,-1,tempbuf,x); - printext256(windowx2-(chars<<(3-x)),windowy1+10+1,g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); + printext256(windowx2-(chars<<(3-x))+1,windowy1+30+2,0,-1,tempbuf,x); + printext256(windowx2-(chars<<(3-x)),windowy1+30+1,g_netClientPeer->lastRoundTripTime > 200 ? COLOR_RED : COLOR_WHITE,-1,tempbuf,x); } } @@ -2471,6 +2492,12 @@ static void G_PrintFPS(void) g_currentFrameRate = LastCount = FrameCount / (thisSec - LastSec); LastSec = thisSec; FrameCount = 0; + + if (!osdshown) + { + if (LastCount > MaxFrames) MaxFrames = LastCount; + if (LastCount < MinFrames) MinFrames = LastCount; + } } FrameCount++; } @@ -8422,7 +8449,9 @@ FOUNDCHEAT: return; case CHEAT_RATE: - ud.tickrate = !ud.tickrate; + if (ud.tickrate++ > 2) + ud.tickrate = 0; + end_cheat(); return; diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index fc1bcdcad..b78e8309d 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1569,11 +1569,11 @@ int32_t registerosdcommands(void) { "mus_volume", "controls volume of midi music", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 }, { "osdhightile", "enable/disable hires art replacements for console text", (void *)&osdhightile, CVAR_BOOL, 0, 1 }, - { "osdscale", "adjust console text size", (void *)&osdscale, CVAR_FLOAT|CVAR_FUNCPTR, 1.f, 4.f }, + { "osdscale", "adjust console text size", (void *)&osdscale, CVAR_FLOAT|CVAR_FUNCPTR, 1, 4 }, { "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 }, { "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 }, - { "r_showfps", "show the frame rate counter", (void *)&ud.tickrate, CVAR_BOOL, 0, 1 }, + { "r_showfps", "show the frame rate counter", (void *)&ud.tickrate, CVAR_INT, 0, 2 }, { "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 }, { "r_size", "change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 }, { "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index 1a60ff8c0..d8a8cc6f8 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "premap.h" int32_t osdhightile = 1; +int32_t osdshown = 0; + #ifdef __ANDROID__ float osdscale = 2.f; #else @@ -127,7 +129,8 @@ void GAME_onshowosd(int32_t shown) { G_UpdateScreenArea(); - UNREFERENCED_PARAMETER(shown); + osdshown = shown; + // XXX: it's weird to fake a keypress like this. // if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on))) // KB_KeyDown[sc_Pause] = 1; diff --git a/polymer/eduke32/source/osdfuncs.h b/polymer/eduke32/source/osdfuncs.h index ebc997464..88c69253b 100644 --- a/polymer/eduke32/source/osdfuncs.h +++ b/polymer/eduke32/source/osdfuncs.h @@ -29,6 +29,7 @@ void GAME_onshowosd(int32_t shown); void GAME_clearbackground(int32_t numcols, int32_t numrows); extern int32_t osdhightile; +extern int32_t osdshown; extern float osdscale; #define OSDCHAR_WIDTH 8