add toggle for old fps counter behaviour
idk people hate the new one so brap
This commit is contained in:
1 parent
b5ac5fe26c
commit
d1c75dd4b0
2 files changed
+29
-7
No files matched your search
+27
-5
@@ -72,6 +72,8 @@ static void SCR_ChangeFullscreen (void);
|
||||
|
||||
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_accuratefps = {"accuratefpscounter", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// =========================================================================
|
||||
// SCREEN VARIABLES
|
||||
// =========================================================================
|
||||
@@ -177,6 +179,7 @@ void SCR_Startup(void)
|
||||
|
||||
V_Init();
|
||||
CV_RegisterVar(&cv_ticrate);
|
||||
CV_RegisterVar(&cv_accuratefps);
|
||||
CV_RegisterVar(&cv_menucaps);
|
||||
CV_RegisterVar(&cv_constextsize);
|
||||
|
||||
@@ -346,9 +349,13 @@ double averageFPS = 0.0f;
|
||||
#ifdef USE_FPS_SAMPLES
|
||||
#define MAX_FRAME_TIME 0.05
|
||||
#define NUM_FPS_SAMPLES (16) // Number of samples to store
|
||||
#define NUM_FPS_SAMPLES2 (32) // Number of samples to store for inaccurate counter
|
||||
|
||||
static double total_frame_time = 0.0;
|
||||
static int frame_index;
|
||||
|
||||
static double fps_samples[NUM_FPS_SAMPLES2];
|
||||
static int fps_index;
|
||||
#endif
|
||||
|
||||
static boolean fps_init = false;
|
||||
@@ -357,6 +364,7 @@ static precise_t fps_enter = 0;
|
||||
void SCR_CalculateFPS(void)
|
||||
{
|
||||
precise_t fps_finish = 0;
|
||||
int i;
|
||||
|
||||
double frameElapsed = 0.0;
|
||||
|
||||
@@ -371,12 +379,26 @@ void SCR_CalculateFPS(void)
|
||||
fps_enter = fps_finish;
|
||||
|
||||
#ifdef USE_FPS_SAMPLES
|
||||
total_frame_time += frameElapsed;
|
||||
if (frame_index++ >= NUM_FPS_SAMPLES || total_frame_time >= MAX_FRAME_TIME)
|
||||
|
||||
if (cv_accuratefps.value)
|
||||
{
|
||||
averageFPS = 1.0 / (total_frame_time / frame_index);
|
||||
total_frame_time = 0.0;
|
||||
frame_index = 0;
|
||||
total_frame_time += frameElapsed;
|
||||
if (frame_index++ >= NUM_FPS_SAMPLES || total_frame_time >= MAX_FRAME_TIME)
|
||||
{
|
||||
averageFPS = 1.0 / (total_frame_time / frame_index);
|
||||
total_frame_time = 0.0;
|
||||
frame_index = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fps_samples[fps_index] = frameElapsed / NUM_FPS_SAMPLES2;
|
||||
fps_index = (fps_index + 1) % NUM_FPS_SAMPLES2;
|
||||
|
||||
averageFPS = 0.0;
|
||||
for (i = 0; i < NUM_FPS_SAMPLES2; i++)
|
||||
averageFPS += fps_samples[i];
|
||||
averageFPS = 1.0 / averageFPS;
|
||||
}
|
||||
#else
|
||||
// Direct, unsampled counter.
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@
|
||||
|
||||
extern UINT8 *screens[5];
|
||||
|
||||
extern consvar_t cv_ticrate, cv_allcaps, cv_constextsize, cv_menucaps,\
|
||||
cv_globalgamma, cv_globalsaturation, \
|
||||
extern consvar_t cv_ticrate, cv_accuratefps, cv_allcaps, cv_constextsize, cv_menucaps,\
|
||||
cv_globalgamma, cv_globalsaturation,\
|
||||
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,\
|
||||
cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, \
|
||||
cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation;
|
||||
|
||||
Reference in new issue
Block a user