Skip to content

Commit

Permalink
qcommon: never sleep with common.framerate.max -2
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Apr 27, 2024
1 parent 5a44a87 commit 5450acd
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 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,17 @@ 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).
else
{
minMsec = 0;
}
}
}
else
Expand Down

0 comments on commit 5450acd

Please sign in to comment.