Qcommon_Frame(): Make pfps and rfps floats

should be more precise when converting to microseconds
This commit is contained in:
Daniel Gibson 2022-05-09 01:58:09 +02:00
parent 502ff345c3
commit f95b5e7725

View file

@ -428,10 +428,10 @@ Qcommon_Frame(int usec)
int time_after; int time_after;
// Target packetframerate. // Target packetframerate.
int pfps; float pfps;
//Target renderframerate. // Target renderframerate.
int rfps; float rfps;
// Time since last packetframe in microsec. // Time since last packetframe in microsec.
static int packetdelta = 1000000; static int packetdelta = 1000000;
@ -553,7 +553,7 @@ Qcommon_Frame(int usec)
// use vid_maxfps if it looks like the user really means it to be different from refreshRate // use vid_maxfps if it looks like the user really means it to be different from refreshRate
if (vid_maxfps->value < refreshrate - 2 ) if (vid_maxfps->value < refreshrate - 2 )
{ {
rfps = (int)vid_maxfps->value; rfps = vid_maxfps->value;
// we can't have more packet frames than render frames, so limit pfps to rfps // we can't have more packet frames than render frames, so limit pfps to rfps
pfps = (cl_maxfps->value > rfps) ? rfps : cl_maxfps->value; pfps = (cl_maxfps->value > rfps) ? rfps : cl_maxfps->value;
} }
@ -574,7 +574,7 @@ Qcommon_Frame(int usec)
} }
else else
{ {
rfps = (int)vid_maxfps->value; rfps = vid_maxfps->value;
// we can't have more packet frames than render frames, so limit pfps to rfps // we can't have more packet frames than render frames, so limit pfps to rfps
pfps = (cl_maxfps->value > rfps) ? rfps : cl_maxfps->value; pfps = (cl_maxfps->value > rfps) ? rfps : cl_maxfps->value;
} }
@ -586,7 +586,7 @@ Qcommon_Frame(int usec)
// packet framerates between about 45 and 90 should be ok, // packet framerates between about 45 and 90 should be ok,
// with other values the game (esp. movement/clipping) can become glitchy // with other values the game (esp. movement/clipping) can become glitchy
// as pfps must be <= rfps, for rfps < 90 just use that as pfps // as pfps must be <= rfps, for rfps < 90 just use that as pfps
if (rfps < 90) if (rfps < 90.0f)
{ {
pfps = rfps; pfps = rfps;
} }