diff --git a/nq/include/server.h b/nq/include/server.h index 085c7f463..5e283a23b 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -212,6 +212,7 @@ extern struct cvar_s *timelimit; extern struct cvar_s *sv_maxvelocity; extern struct cvar_s *sv_gravity; +extern struct cvar_s *sv_jump_any; extern struct cvar_s *sv_nostep; extern struct cvar_s *sv_friction; extern struct cvar_s *sv_edgefriction; @@ -264,6 +265,7 @@ void SV_ClientPrintf (const char *fmt, ...) __attribute__((format(printf,1,2))); void SV_BroadcastPrintf (const char *fmt, ...) __attribute__((format(printf,1,2))); struct trace_s SV_PushEntity (edict_t *ent, vec3_t push); +int SV_EntCanSupportJump (edict_t *ent); int SV_FlyMove (edict_t *ent, float time, struct trace_s *steptrace); void SV_CheckVelocity (edict_t *ent); qboolean SV_RunThink (edict_t *ent); diff --git a/nq/source/sv_cl_phys.c b/nq/source/sv_cl_phys.c index d07cd3753..c30d35cc6 100644 --- a/nq/source/sv_cl_phys.c +++ b/nq/source/sv_cl_phys.c @@ -291,7 +291,7 @@ SV_WalkMove (edict_t *ent) downtrace = SV_PushEntity (ent, downmove); // FIXME: don't link? if (downtrace.plane.normal[2] > 0.7) { - if (SVfloat (ent, solid) == SOLID_BSP) { + if (SV_EntCanSupportJump (ent)) { SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_ONGROUND; SVfloat (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, downtrace.ent); diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index f870c9fff..e6f230e39 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -87,6 +87,7 @@ SV_Init (void) "None"); sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_SERVERINFO, Cvar_Info, "None"); + sv_jump_any = Cvar_Get ("sv_jump_any", "1", CVAR_NONE, NULL, "None"); sv_friction = Cvar_Get ("sv_friction", "4", CVAR_SERVERINFO, Cvar_Info, "None"); sv_edgefriction = Cvar_Get ("edgefriction", "2", CVAR_NONE, NULL, "None"); diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index 7c195c264..e65c8bc76 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -61,6 +61,7 @@ static __attribute__ ((used)) const char rcsid[] = cvar_t *sv_friction; cvar_t *sv_gravity; +cvar_t *sv_jump_any; cvar_t *sv_stopspeed; cvar_t *sv_maxvelocity; cvar_t *sv_nostep; @@ -224,6 +225,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 /* @@ -284,7 +298,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,