From 1139c58e27c1327a8493ba97fa272c2e19a57832 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 1 Nov 2016 01:35:24 +0000 Subject: [PATCH] Add menu option to control r_maxfps, default r_maxfps to 60, add cvar for pixel doubling (r_pixeldoubling). git-svn-id: https://svn.eduke32.com/eduke32@5922 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/config.c | 2 +- polymer/eduke32/source/game.c | 4 ++-- polymer/eduke32/source/menus.c | 12 ++++++++++++ polymer/eduke32/source/osdcmds.c | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 4a9c5a08e..353a31055 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -207,7 +207,7 @@ void CONFIG_SetDefaults(void) ud.crosshairscale = 50; ud.obituaries = 1; ud.democams = 1; - ud.detail = 1; + ud.detail = 0; ud.drawweapon = 1; ud.idplayers = 1; ud.levelstats = 0; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9b78c0838..0a673e272 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -119,7 +119,7 @@ int32_t hud_showmapname = 1; int32_t g_levelTextTime = 0; -int32_t r_maxfps = 0; +int32_t r_maxfps = 60; uint32_t g_frameDelay = 0; #if defined(RENDERTYPEWIN) && defined(USE_OPENGL) @@ -886,7 +886,7 @@ void G_DrawRooms(int playerNum, int smoothRatio) #endif pPlayer->orotscrnang = pPlayer->rotscrnang; } - else if (!ud.detail && getrendermode()==REND_CLASSIC) + else if (ud.detail && getrendermode()==REND_CLASSIC) { pixelDoubling = 1; g_halveScreenArea = 1; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 3a6e8702a..ffa21f920 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -466,6 +466,13 @@ static MenuOptionSet_t MEOS_VIDEOSETUP_VSYNC = MAKE_MENUOPTIONSET(MEOSN_VIDEOSET static MenuOption_t MEO_VIDEOSETUP_VSYNC = MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_VSYNC, &newvsync); static MenuEntry_t ME_VIDEOSETUP_VSYNC = MAKE_MENUENTRY("VSync:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_VSYNC, Option); +static char const *MEOSN_VIDEOSETUP_FRAMELIMIT [] ={ "None", "30 fps", "60 fps", "120 fps", "144 fps", }; +static int32_t MEOSV_VIDEOSETUP_FRAMELIMIT [] ={ 0, 30, 60, 120, 144 }; +static MenuOptionSet_t MEOS_VIDEOSETUP_FRAMELIMIT = MAKE_MENUOPTIONSET(MEOSN_VIDEOSETUP_FRAMELIMIT, MEOSV_VIDEOSETUP_FRAMELIMIT, 0x2); +static MenuOption_t MEO_VIDEOSETUP_FRAMELIMIT= MAKE_MENUOPTION(&MF_Redfont, &MEOS_VIDEOSETUP_FRAMELIMIT, &r_maxfps); +static MenuEntry_t ME_VIDEOSETUP_FRAMELIMIT = MAKE_MENUENTRY("Framerate limit:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_VIDEOSETUP_FRAMELIMIT, Option); + + static MenuEntry_t ME_VIDEOSETUP_APPLY = MAKE_MENUENTRY( "Apply Changes", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_NULL, Link ); @@ -630,6 +637,7 @@ static MenuEntry_t *MEL_VIDEOSETUP[] = { #endif &ME_VIDEOSETUP_FULLSCREEN, &ME_VIDEOSETUP_VSYNC, + &ME_VIDEOSETUP_FRAMELIMIT, &ME_Space6, &ME_VIDEOSETUP_APPLY, }; @@ -2871,6 +2879,10 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption) } } } + else if (entry == &ME_VIDEOSETUP_FRAMELIMIT) + { + g_frameDelay = newOption ? Blrintf(1000.f/(float) newOption) : 0; + } switch (g_currentMenu) { diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index ca3c7ab19..d546e9666 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1614,6 +1614,7 @@ int32_t registerosdcommands(void) { "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 }, + { "r_pixeldoubling", "enable/disable pixel doubling in the software renderer", (void *) &ud.detail, CVAR_BOOL, 0, 1 }, { "r_precache", "enable/disable the pre-level caching routine", (void *)&ud.config.useprecache, CVAR_BOOL, 0, 1 }, { "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },