Skip to content

Commit

Permalink
Const-ify the max physics run frequency of 72Hz
Browse files Browse the repository at this point in the history
  • Loading branch information
vsonnier committed Jul 12, 2024
1 parent 03fee44 commit 248263d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Quake/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ CL_ResetTrail
*/
static void CL_ResetTrail (entity_t *ent)
{
ent->traildelay = 1.f / 72.f;
ent->traildelay = 1.f / MAX_PHYSICS_FREQ;
VectorCopy (ent->origin, ent->trailorg);
}

Expand All @@ -618,7 +618,7 @@ static void CL_RocketTrail (entity_t *ent, int type)
return;
R_RocketTrail (ent->trailorg, ent->origin, type);

ent->traildelay = q_max (0.f, ent->traildelay + 1.f / 72.f);
ent->traildelay = q_max (0.f, ent->traildelay + 1.f / MAX_PHYSICS_FREQ);
VectorCopy (ent->origin, ent->trailorg);
}

Expand Down
8 changes: 4 additions & 4 deletions Quake/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jmp_buf host_abortserver;
jmp_buf screen_error;

byte *host_colormap;
float host_netinterval = 1.0 / 72;
float host_netinterval = 1.0 / MAX_PHYSICS_FREQ;
cvar_t host_framerate = {"host_framerate", "0", CVAR_NONE}; // set for slow motion
cvar_t host_speeds = {"host_speeds", "0", CVAR_NONE}; // set for running times
cvar_t host_maxfps = {"host_maxfps", "200", CVAR_ARCHIVE}; // johnfitz
Expand Down Expand Up @@ -117,19 +117,19 @@ Max_Fps_f -- ericw
*/
static void Max_Fps_f (cvar_t *var)
{
if (var->value > 72 || var->value <= 0)
if (var->value > MAX_PHYSICS_FREQ || var->value <= 0)
{
if (!host_netinterval)
Con_Printf ("Using renderer/network isolation.\n");
host_netinterval = 1.0 / 72;
host_netinterval = 1.0 / MAX_PHYSICS_FREQ;
}
else
{
if (host_netinterval)
Con_Printf ("Disabling renderer/network isolation.\n");
host_netinterval = 0;

if (var->value > 72)
if (var->value > MAX_PHYSICS_FREQ)
Con_Warning ("host_maxfps above 72 breaks physics.\n");
}
}
Expand Down
2 changes: 2 additions & 0 deletions Quake/quakedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#define DIST_EPSILON (0.03125) // 1/32 epsilon to keep floating point happy (moved from world.c)

#define MAX_PHYSICS_FREQ (72.0) // Physics beyond 72Hz is broken

#define MAX_MSGLEN 64000 // max length of a reliable message //ericw -- was 32000
#define MAX_DATAGRAM 64000 // max length of unreliable message //johnfitz -- was 1024

Expand Down

0 comments on commit 248263d

Please sign in to comment.