Better cpusleep

- Default to 1, which means potential for a 1-frame loss every once in a while but no longer a complete cpu hog
- New minimum is 0, since -1 just did the exact same thing as 0.
This commit is contained in:
Sally Cochenour 2019-01-28 14:12:08 -05:00
parent 6e9f689443
commit 1e61cc6152
5 changed files with 6 additions and 6 deletions

View File

@ -214,7 +214,7 @@ static CV_PossibleValue_t autobalance_cons_t[] = {{0, "MIN"}, {4, "MAX"}, {0, NU
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Random"}, {2, "Teleports"},
{3, "None"}, {0, NULL}};
@ -447,7 +447,7 @@ consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL
consvar_t cv_pause = {"pausepermission", "Server", CV_NETVAR, pause_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL};
consvar_t cv_sleep = {"cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL};
INT16 gametype = GT_RACE; // SRB2kart
boolean forceresetplayers = false;

View File

@ -3018,7 +3018,7 @@ void I_StartupTimer(void)
void I_Sleep(void)
{
if (cv_sleep.value != -1)
if (cv_sleep.value > 0)
SDL_Delay(cv_sleep.value);
}

View File

@ -2914,7 +2914,7 @@ void I_StartupTimer(void)
void I_Sleep(void)
{
#if !(defined (_arch_dreamcast) || defined (_XBOX))
if (cv_sleep.value != -1)
if (cv_sleep.value > 0)
SDL_Delay(cv_sleep.value);
#endif
}

View File

@ -261,7 +261,7 @@ tic_t I_GetTime(void)
void I_Sleep(void)
{
if (cv_sleep.value != -1)
if (cv_sleep.value > 0)
Sleep(cv_sleep.value);
}

View File

@ -265,7 +265,7 @@ tic_t I_GetTime(void)
void I_Sleep(void)
{
if (cv_sleep.value != -1)
if (cv_sleep.value > 0)
Sleep(cv_sleep.value);
}