mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-05 14:34:00 +00:00
Merge branch 'super-frame-skip' into 'master'
SUPER FRAME SKIP (QOL for My Shitty PC) See merge request KartKrew/Kart!2172
This commit is contained in:
commit
e55748a1b2
5 changed files with 90 additions and 14 deletions
|
|
@ -395,6 +395,11 @@ void ItemFinder_OnChange(void);
|
|||
consvar_t cv_itemfinder = Player("itemfinder", "Off").flags(CV_NOSHOWHELP).on_off().onchange(ItemFinder_OnChange).dont_save();
|
||||
|
||||
consvar_t cv_maxportals = Player("maxportals", "2").values({{0, "MIN"}, {12, "MAX"}}); // lmao rendering 32 portals, you're a card
|
||||
consvar_t cv_menuframeskip = Player("menuframeskip", "Off").values({
|
||||
{35, "MIN"},
|
||||
{144, "MAX"},
|
||||
{0, "Off"},
|
||||
});
|
||||
consvar_t cv_mindelay = Player("mindelay", "2").min_max(0, 30);
|
||||
consvar_t cv_movebob = Player("movebob", "1.0").floating_point().min_max(0, 4*FRACUNIT);
|
||||
consvar_t cv_netstat = Player("netstat", "Off").on_off().dont_save(); // show bandwidth statistics
|
||||
|
|
@ -439,7 +444,6 @@ consvar_t cv_scr_y = Player("scr_y", "0.0").floating_point();
|
|||
|
||||
consvar_t cv_seenames = Player("seenames", "On").on_off();
|
||||
consvar_t cv_shadow = Player("shadow", "On").on_off();
|
||||
consvar_t cv_shittyscreen = Player("televisionsignal", "Okay").flags(CV_NOSHOWHELP).values({{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}}).dont_save();
|
||||
consvar_t cv_showfocuslost = Player("showfocuslost", "Yes").yes_no();
|
||||
|
||||
void R_SetViewSize(void);
|
||||
|
|
@ -468,8 +472,6 @@ consvar_t cv_tutorialprompt = Player("tutorialprompt", "On").on_off();
|
|||
void I_StartupMouse(void);
|
||||
consvar_t cv_usemouse = Player("use_mouse", "Off").values({{0, "Off"}, {1, "On"}, {2, "Force"}}).onchange(I_StartupMouse);
|
||||
|
||||
consvar_t cv_vhseffect = Player("vhspause", "On").on_off();
|
||||
|
||||
// synchronize page flipping with screen refresh
|
||||
extern "C++"
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@
|
|||
#include "k_bans.h"
|
||||
#include "k_credits.h"
|
||||
#include "r_debug.hpp"
|
||||
#include "k_director.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
|
|
@ -99,7 +100,7 @@
|
|||
|
||||
#include "lua_profile.h"
|
||||
|
||||
extern "C" consvar_t cv_lua_profile;
|
||||
extern "C" consvar_t cv_lua_profile, cv_menuframeskip;
|
||||
|
||||
/* Manually defined asset hashes
|
||||
*/
|
||||
|
|
@ -354,7 +355,7 @@ gamestate_t wipegamestate = GS_LEVEL;
|
|||
INT16 wipetypepre = -1;
|
||||
INT16 wipetypepost = -1;
|
||||
|
||||
static bool D_Display(void)
|
||||
static bool D_Display(bool world)
|
||||
{
|
||||
bool ranwipe = false;
|
||||
boolean forcerefresh = false;
|
||||
|
|
@ -533,7 +534,7 @@ static bool D_Display(void)
|
|||
// see if the border needs to be initially drawn
|
||||
if (G_GamestateUsesLevel() == true)
|
||||
{
|
||||
if (!automapactive && !dedicated && cv_renderview.value)
|
||||
if (!automapactive && !dedicated && cv_renderview.value && (world || forcerefresh))
|
||||
{
|
||||
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
|
||||
|
||||
|
|
@ -787,9 +788,6 @@ static bool D_Display(void)
|
|||
//
|
||||
if (!wipe)
|
||||
{
|
||||
if (cv_shittyscreen.value)
|
||||
V_DrawVhsEffect(cv_shittyscreen.value == 2);
|
||||
|
||||
if (cv_netstat.value)
|
||||
{
|
||||
char s[50];
|
||||
|
|
@ -840,6 +838,13 @@ void D_SRB2Loop(void)
|
|||
boolean interp = false;
|
||||
boolean doDisplay = false;
|
||||
int frameskip = 0;
|
||||
bool skiplaggyworld = false;
|
||||
double sincelastworld = 0.0;
|
||||
double minworldfps = 0.5;
|
||||
|
||||
double worldfpsrun = 0.0;
|
||||
int worldfpscount = 0;
|
||||
int worldfpsavg = 0;
|
||||
|
||||
if (dedicated)
|
||||
server = true;
|
||||
|
|
@ -893,6 +898,7 @@ void D_SRB2Loop(void)
|
|||
}
|
||||
|
||||
bool ranwipe = false;
|
||||
bool world = false;
|
||||
|
||||
I_UpdateTime();
|
||||
|
||||
|
|
@ -993,7 +999,37 @@ void D_SRB2Loop(void)
|
|||
if (!renderisnewtic)
|
||||
P_ResetInterpHudRandSeed(false);
|
||||
|
||||
ranwipe = D_Display();
|
||||
world = true;
|
||||
|
||||
// TODO: skipping 3D rendering does not work in
|
||||
// Legacy GL -- the screen gets filled with a
|
||||
// single color.
|
||||
// In software, the last frame is preserved,
|
||||
// which is the intended effect.
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
auto none_freecam = []
|
||||
{
|
||||
for (UINT8 i = 0; i <= r_splitscreen; ++i)
|
||||
{
|
||||
if (camera[i].freecam || (players[displayplayers[i]].spectator && !K_DirectorIsAvailable(i)))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
// 3D rendering is stopped ENTIRELY if the game is paused.
|
||||
// - In single player, opening the menu pauses the game, so it's perfect.
|
||||
// - One exception: freecam is allowed to move when the game is paused.
|
||||
if (((paused || P_AutoPause()) && none_freecam()) ||
|
||||
// 3D framerate is always allowed to at least drop if the menu is open.
|
||||
// Does not affect replay menu because that one is more like a HUD.
|
||||
(skiplaggyworld && menuactive && currentMenu != &PAUSE_PlaybackMenuDef))
|
||||
{
|
||||
world = false;
|
||||
}
|
||||
}
|
||||
|
||||
ranwipe = D_Display(world);
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
|
@ -1051,6 +1087,43 @@ void D_SRB2Loop(void)
|
|||
frameskip = 0;
|
||||
}
|
||||
|
||||
if (world)
|
||||
{
|
||||
sincelastworld = 0.0;
|
||||
|
||||
worldfpsrun += deltasecs;
|
||||
worldfpscount++;
|
||||
if (worldfpsrun > 1.0)
|
||||
{
|
||||
worldfpsavg = worldfpscount;
|
||||
worldfpsrun = 0.0;
|
||||
worldfpscount = 0;
|
||||
}
|
||||
}
|
||||
else if (skiplaggyworld)
|
||||
{
|
||||
sincelastworld += deltasecs;
|
||||
}
|
||||
|
||||
// Try to skip 3D rendering if the theoretical framerate drops below 60.
|
||||
// This measures the time spent rendering a single frame.
|
||||
// If the framrate is capped at a lower value than 60,
|
||||
// the time spent on each frame will not artificially increase.
|
||||
// So this measurement is accurate regardless of fpscap.
|
||||
if (sincelastworld <= minworldfps)
|
||||
{
|
||||
double goal = cv_menuframeskip.value;
|
||||
if (worldfpsavg < goal)
|
||||
{
|
||||
skiplaggyworld = true;
|
||||
minworldfps = 1.0 / std::max(worldfpsavg * worldfpsavg / goal, 2.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skiplaggyworld = false;
|
||||
}
|
||||
|
||||
if (!singletics)
|
||||
{
|
||||
INT64 elapsed = (INT64)(finishprecise - enterprecise);
|
||||
|
|
|
|||
|
|
@ -2033,9 +2033,6 @@ void HU_Drawer(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
|
||||
V_DrawVhsEffect(demo.rewinding);
|
||||
|
||||
// draw desynch text
|
||||
if (hu_redownloadinggamestate)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "../r_main.h" // cv_skybox
|
||||
#include "../hardware/hw_main.h" // gl consvars
|
||||
|
||||
extern consvar_t cv_menuframeskip;
|
||||
|
||||
menuitem_t OPTIONS_VideoAdvanced[] =
|
||||
{
|
||||
{IT_HEADER, "Performance...", NULL,
|
||||
|
|
@ -22,6 +24,9 @@ menuitem_t OPTIONS_VideoAdvanced[] =
|
|||
{IT_STRING | IT_CVAR, "Parallel Software", "Uses multiple CPU cores for the software renderer if available, for a FPS boost.",
|
||||
NULL, {.cvar = &cv_parallelsoftware}, 0, 0},
|
||||
|
||||
{IT_STRING | IT_CVAR, "Extra Frame Skipping", "Skip 3D rendering frames while the menu is open.",
|
||||
NULL, {.cvar = &cv_menuframeskip}, 0, 0},
|
||||
|
||||
|
||||
{IT_HEADER, "Rendering Backend...", "Watch people get confused anyway!!",
|
||||
NULL, {NULL}, 0, 0},
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
|||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_renderhitbox, cv_fullscreen;
|
||||
extern consvar_t cv_scr_effect;
|
||||
extern consvar_t cv_vhseffect, cv_shittyscreen;
|
||||
extern consvar_t cv_parallelsoftware;
|
||||
|
||||
// wait for page flipping to end or not
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue