From 6e5e74b25f796a8f280faa902dc078e1795b436d Mon Sep 17 00:00:00 2001 From: Sally Coolatta <tehrealsalt@gmail.com> Date: Sat, 16 Apr 2022 12:36:40 -0400 Subject: [PATCH] Allow FPS cap values --- src/command.c | 3 ++- src/r_fps.c | 33 ++++++++++++++------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/command.c b/src/command.c index 50310f1125..7233880584 100644 --- a/src/command.c +++ b/src/command.c @@ -2076,9 +2076,10 @@ void CV_AddValue(consvar_t *var, INT32 increment) { increment = 0; currentindice = max; + break; // The value we definitely want, stop here. } else if (var->PossibleValue[max].value == var->value) - currentindice = max; + currentindice = max; // The value we maybe want. } if (increment) diff --git a/src/r_fps.c b/src/r_fps.c index 9c3a9db53d..136cdfe9e7 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -27,38 +27,33 @@ #endif static CV_PossibleValue_t fpscap_cons_t[] = { - {-1, "Match refresh rate"}, - {0, "Unlimited"}, #ifdef DEVELOP // Lower values are actually pretty useful for debugging interp problems! - {1, "One Singular Frame"}, - {10, "10"}, - {20, "20"}, - {25, "25"}, - {30, "30"}, + {1, "MIN"}, +#else + {TICRATE, "MIN"}, #endif - {35, "35"}, - {50, "50"}, - {60, "60"}, - {70, "70"}, - {75, "75"}, - {90, "90"}, - {100, "100"}, - {120, "120"}, - {144, "144"}, - {200, "200"}, - {240, "240"}, + {300, "MAX"}, + {-1, "Unlimited"}, + {0, "Match refresh rate"}, {0, NULL} }; consvar_t cv_fpscap = CVAR_INIT ("fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL); UINT32 R_GetFramerateCap(void) { - if (cv_fpscap.value < 0) + if (cv_fpscap.value == 0) { + // 0: Match refresh rate return I_GetRefreshRate(); } + if (cv_fpscap.value < 0) + { + // -1: Unlimited + return 0; + } + return cv_fpscap.value; } -- GitLab