mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Support jumping off pretty much anything.
See http://forums.inside3d.com/viewtopic.php?t=1675 for inspiration. As this might break the gameplay of certain maps, the new sv_jump_any cvar can be used to disable this feature (bringing back the old behavior).
This commit is contained in:
parent
628bd1367e
commit
3061270d3a
4 changed files with 19 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue