enhanced no_pogo_stick control

This commit is contained in:
Bill Currie 2002-09-13 04:30:18 +00:00
parent 2a8896d4a1
commit a6318a3baf
6 changed files with 23 additions and 2 deletions

View file

@ -67,6 +67,7 @@ typedef struct player_state_s {
float waterjumptime;
int onground; // -1 = in air, else pmove entity number
int oldbuttons;
int oldonground;
// QSG2
byte glow_size;

View file

@ -73,6 +73,7 @@ typedef struct
vec3_t angles;
vec3_t velocity;
int oldbuttons;
int oldonground;;
float waterjumptime;
qboolean dead;
qboolean flying;

View file

@ -166,6 +166,7 @@ typedef struct client_s
usercmd_t lastcmd; // for filling in big drops and partial predictions
double localtime; // of last message
int oldbuttons;
int oldonground;
float maxspeed; // localized maxspeed
float entgravity; // localized ent gravity

View file

@ -78,6 +78,7 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
VectorCopy (from->velocity, pmove.velocity);
pmove.oldbuttons = from->oldbuttons;
pmove.oldonground = from->oldonground;
pmove.waterjumptime = from->waterjumptime;
pmove.dead = cl.stats[STAT_HEALTH] <= 0;
if (clientplayer)
@ -91,6 +92,7 @@ CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
PlayerMove ();
to->waterjumptime = pmove.waterjumptime;
to->oldbuttons = pmove.oldbuttons; // Tonik
to->oldonground = pmove.oldonground;
VectorCopy (pmove.origin, to->origin);
VectorCopy (pmove.angles, to->viewangles);
VectorCopy (pmove.velocity, to->velocity);

View file

@ -33,6 +33,7 @@ static const char rcsid[] =
#include <math.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qtypes.h"
@ -69,7 +70,9 @@ void
Pmove_Init_Cvars (void)
{
no_pogo_stick = Cvar_Get ("no_pogo_stick", "0", CVAR_SERVERINFO, Cvar_Info,
"disable the ability to pogo stick");
"disable the ability to pogo stick: 0 pogo "
"alowed, 1 no pogo, 2 pogo but high friction, 3 "
"high friction and no pogo");
}
#define STEPSIZE 18
@ -641,7 +644,7 @@ JumpButton (void)
}
if (onground == -1) {
if (no_pogo_stick->int_val)
if (no_pogo_stick->int_val & 1)
pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until
// released
return; // in air, so no effect
@ -824,6 +827,17 @@ PlayerMove (void)
// set onground, watertype, and waterlevel
PM_CategorizePosition ();
if (no_pogo_stick->int_val & 2) {
if (onground != -1 && pmove.oldonground == -1) { // just landed
float save = movevars.friction;
pmove.waterjumptime = 0;
movevars.friction *= 3;
PM_Friction ();
movevars.friction = save;
}
}
pmove.oldonground = onground;
if (waterlevel == 2)
CheckWaterJump ();

View file

@ -1500,6 +1500,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
pmove.cmd = *ucmd;
pmove.dead = SVfloat (sv_player, health) <= 0;
pmove.oldbuttons = host_client->oldbuttons;
pmove.oldonground = host_client->oldonground;
movevars.entgravity = host_client->entgravity;
movevars.maxspeed = host_client->maxspeed;
@ -1532,6 +1533,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
#endif
host_client->oldbuttons = pmove.oldbuttons;
host_client->oldonground = pmove.oldonground;
SVfloat (sv_player, teleport_time) = pmove.waterjumptime;
SVfloat (sv_player, waterlevel) = waterlevel;
SVfloat (sv_player, watertype) = watertype;