diff --git a/qw/include/server.h b/qw/include/server.h index 24b1b3a8b..0a17f8af2 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -537,6 +537,7 @@ void SV_SetMoveVars(void); struct trace_s; int SV_FlyMove (struct edict_s *ent, float time, struct trace_s *steptrace); struct trace_s SV_PushEntity (struct edict_s *ent, vec3_t push); +int SV_EntCanSupportJump (struct edict_s *ent); // // sv_send.c @@ -621,6 +622,7 @@ extern struct cvar_s *sv_timefmt; extern struct cvar_s *sv_phs; extern struct cvar_s *sv_maxvelocity; extern struct cvar_s *sv_gravity; +extern struct cvar_s *sv_jump_any; extern struct cvar_s *sv_aim; extern struct cvar_s *sv_stopspeed; extern struct cvar_s *sv_spectatormaxspeed; diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index fb1a77db9..b7bd606b0 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -2131,6 +2131,7 @@ SV_InitLocal (void) "clients"); sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_NONE, NULL, "Sets the global value for the amount of gravity"); + sv_jump_any = Cvar_Get ("sv_jump_any", "1", CVAR_NONE, NULL, "None"); sv_stopspeed = Cvar_Get ("sv_stopspeed", "100", CVAR_NONE, NULL, "Sets the value that determines how fast the " "player should come to a complete stop"); diff --git a/qw/source/sv_phys.c b/qw/source/sv_phys.c index 940dcc080..48b39b3ae 100644 --- a/qw/source/sv_phys.c +++ b/qw/source/sv_phys.c @@ -58,6 +58,7 @@ static __attribute__ ((used)) const char rcsid[] = */ cvar_t *sv_gravity; +cvar_t *sv_jump_any; cvar_t *sv_stopspeed; cvar_t *sv_maxspeed; cvar_t *sv_maxvelocity; @@ -211,6 +212,19 @@ ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) return blocked; } +int +SV_EntCanSupportJump (edict_t *ent) +{ + int solid = SVfloat (ent, solid); + if (solid == SOLID_BSP) + return 1; + if (!sv_jump_any->int_val) + return 0; + if (solid == SOLID_NOT || solid == SOLID_SLIDEBOX) + return 0; + return 1; +} + #define MAX_CLIP_PLANES 5 /* @@ -271,7 +285,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) if (trace.plane.normal[2] > 0.7) { blocked |= 1; // floor - if (SVfloat (trace.ent, solid) == SOLID_BSP) { + if (SV_EntCanSupportJump (trace.ent)) { SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND; SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state,