engine: server: for entities physics code directly use cvar values rather than movevars. Leave movevars to player movement only

This commit is contained in:
Alibek Omarov 2024-12-08 01:39:24 +03:00
parent 45787a87b3
commit 75adb2e686
6 changed files with 13 additions and 8 deletions

View file

@ -430,6 +430,7 @@ extern convar_t sv_wateramp;
extern convar_t sv_voiceenable;
extern convar_t sv_voicequality;
extern convar_t sv_maxvelocity;
extern convar_t sv_stepsize;
extern convar_t sv_skyname;
extern convar_t sv_skycolor_r;
extern convar_t sv_skycolor_g;

View file

@ -3813,8 +3813,12 @@ static void GAME_EXPORT pfnSetClientMaxspeed( const edict_t *pEdict, float fNewM
if(( cl = SV_ClientFromEdict( pEdict, false )) == NULL )
return;
// GoldSrc doesn't bound the value to the movevar here
fNewMaxspeed = bound( -svgame.movevars.maxspeed, fNewMaxspeed, svgame.movevars.maxspeed );
// There isn't any reference to "maxspd" anywhere except some commented-out code in SDK
Info_SetValueForKeyf( cl->physinfo, "maxspd", MAX_INFO_STRING, "%.f", fNewMaxspeed );
cl->edict->v.maxspeed = fNewMaxspeed;
}

View file

@ -90,7 +90,7 @@ CVAR_DEFINE_AUTO( sv_friction, "4", FCVAR_SERVER|FCVAR_MOVEVARS, "how fast you s
static CVAR_DEFINE( sv_edgefriction, "edgefriction", "2", FCVAR_SERVER|FCVAR_MOVEVARS, "how much you slow down when nearing a ledge you might fall off" );
static CVAR_DEFINE_AUTO( sv_waterfriction, "1", FCVAR_SERVER|FCVAR_MOVEVARS, "how fast you slow down in water" );
static CVAR_DEFINE_AUTO( sv_bounce, "1", FCVAR_SERVER|FCVAR_MOVEVARS, "bounce factor for entities with MOVETYPE_BOUNCE" );
static CVAR_DEFINE_AUTO( sv_stepsize, "18", FCVAR_SERVER|FCVAR_MOVEVARS, "how high you and NPS's can step up" );
CVAR_DEFINE_AUTO( sv_stepsize, "18", FCVAR_SERVER|FCVAR_MOVEVARS, "how high you and NPC's can step up" );
CVAR_DEFINE_AUTO( sv_maxvelocity, "2000", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "max velocity for all things in the world" );
static CVAR_DEFINE_AUTO( sv_zmax, "4096", FCVAR_MOVEVARS|FCVAR_SPONLY, "maximum viewable distance" );
CVAR_DEFINE_AUTO( sv_wateramp, "0", FCVAR_MOVEVARS|FCVAR_UNLOGGED, "world waveheight factor" );

View file

@ -66,12 +66,12 @@ realcheck:
start[2] = mins[2];
if( !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
start[2] += svgame.movevars.stepsize;
start[2] += sv_stepsize.value;
// the midpoint must be within 16 of the bottom
start[0] = stop[0] = (mins[0] + maxs[0]) * 0.5f;
start[1] = stop[1] = (mins[1] + maxs[1]) * 0.5f;
stop[2] = start[2] - 2.0f * svgame.movevars.stepsize;
stop[2] = start[2] - 2.0f * sv_stepsize.value;
if( iMode == WALKMOVE_WORLDONLY )
trace = SV_MoveNoEnts( start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, ent );
@ -96,7 +96,7 @@ realcheck:
if( trace.fraction != 1.0f && trace.endpos[2] > bottom )
bottom = trace.endpos[2];
if( trace.fraction == 1.0f || mid - trace.endpos[2] > svgame.movevars.stepsize )
if( trace.fraction == 1.0f || mid - trace.endpos[2] > sv_stepsize.value )
return false;
}
}
@ -283,7 +283,7 @@ qboolean SV_MoveStep( edict_t *ent, vec3_t move, qboolean relink )
}
else
{
dz = svgame.movevars.stepsize;
dz = sv_stepsize.value;
neworg[2] += dz;
VectorCopy( neworg, end );
end[2] -= dz * 2.0f;
@ -348,7 +348,7 @@ qboolean SV_MoveTest( edict_t *ent, vec3_t move, qboolean relink )
VectorCopy( ent->v.origin, oldorg );
VectorAdd( ent->v.origin, move, neworg );
temp = svgame.movevars.stepsize;
temp = sv_stepsize.value;
neworg[2] += temp;
VectorCopy( neworg, end );

View file

@ -571,7 +571,7 @@ static void SV_SetupPMove( playermove_t *pmove, sv_client_t *cl, usercmd_t *ucmd
if( pmove->multiplayer ) pmove->onground = -1;
pmove->waterlevel = clent->v.waterlevel;
pmove->watertype = clent->v.watertype;
pmove->maxspeed = svgame.movevars.maxspeed;
pmove->maxspeed = svgame.movevars.maxspeed; // GoldSrc uses sv_maxspeed here?
pmove->clientmaxspeed = clent->v.maxspeed;
pmove->iuser1 = clent->v.iuser1;
pmove->iuser2 = clent->v.iuser2;

View file

@ -1478,7 +1478,7 @@ trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore )
VectorCopy( tossent->v.velocity, original_velocity );
VectorCopy( tossent->v.angles, original_angles );
VectorCopy( tossent->v.avelocity, original_avelocity );
gravity = tossent->v.gravity * svgame.movevars.gravity * 0.05f;
gravity = tossent->v.gravity * sv_gravity.value * 0.05f;
for( i = 0; i < 200; i++ )
{