Give QW NQ's explode-box jumping code.

It seems that QW already allowed explode-box jumping, but this makes code a
little more consistent. Still need to figure out what to do about the
player physics code: the client prediction is wrong, though the server gets
it right (before the change).
This commit is contained in:
Bill Currie 2011-09-05 11:30:04 +09:00
parent f0a145a537
commit 937ea854d6
3 changed files with 18 additions and 1 deletions

View file

@ -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;

View file

@ -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");

View file

@ -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,