Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never sleep with common.framerate.max -2 #1102

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/engine/qcommon/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,11 +907,10 @@ void Com_Frame()
max = maxfps.Get();
}

// A positive maxfps caps the fps to the given number, with an implicit
// cap at 333fps to avoid bugs. Above 333fps minMsec is less than 3.
// At 1 or 2 minMsec, the game still runs but exhibits various issues
// such as first-person weapon model flickering, or client having
// connection issues with server.
/* A positive maxfps caps the fps to the given number, with an implicit
cap at 333fps to avoid bugs. Above 333fps minMsec is less than 3 and with
minMsec being 2 or less some variables may become zero and some code may
experience division by zero. */
if ( max > 0 )
{
minMsec = std::max( 1000 / max, 3 );
Expand All @@ -921,11 +920,18 @@ void Com_Frame()
{
minMsec = 3;
}
// A negative maxfps really unlocks fps (and bugs).
else
/* A negative maxfps unlocks fps more (and unfortunate bugs) but cap
it to 1000 (because of a remaining sleep it's a bit less than that). */
else if ( max == -1 )
{
minMsec = 1;
}
/* A maxfps smaller than -1 unlocks all remaining fps (and expected bugs).
Cheats should be allowed. */
else
{
minMsec = Com_AreCheatsAllowed() ? 0 : 1;
}
}
}
else
Expand Down