Skip to content

Commit

Permalink
Fix speedometer in multiplayer
Browse files Browse the repository at this point in the history
The existing check for when we have to fallback to the inaccurate client
speed is flawed.

Checking the coop cvar makes sure that the host falls back to showing
client-side speed when they are hosting a coop server. But in other
multiplayer scenarios like deathmatch, their speedometer will be broken.
Also when just playing singleplayer but coincidentally having set the
coop cvar to 1, they will get the less accurate speed display for no
good reason.

Non-host clients of multiplayer games on the other hand will have no
speed display at all, unless their unused coop cvar happens to be 1 by
chance.

We really only need to choose the fallback method if either we are
not hosting and just connected to a server (!sv.active) or if we are
hosting a game with multiple players (sv.maxplayers != 1).
  • Loading branch information
kugelrund committed Aug 25, 2024
1 parent 6832301 commit 1f4ed30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trunk/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ void SCR_DrawSpeed (void)
maxspeed = 0;
}

if (cls.demoplayback || coop.value)
if (cls.demoplayback || !sv.active || svs.maxclients != 1)
VectorCopy(cl.velocity, vel);
else
VectorCopy (sv_velocity, vel);
Expand Down

0 comments on commit 1f4ed30

Please sign in to comment.