From a6318a3baf38237ce384ca27536d3a8bd9898da3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 13 Sep 2002 04:30:18 +0000 Subject: [PATCH] enhanced no_pogo_stick control --- qw/include/client.h | 1 + qw/include/pmove.h | 1 + qw/include/server.h | 1 + qw/source/cl_pred.c | 2 ++ qw/source/pmove.c | 18 ++++++++++++++++-- qw/source/sv_user.c | 2 ++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/qw/include/client.h b/qw/include/client.h index 0f6c30838..756f3e0df 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -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; diff --git a/qw/include/pmove.h b/qw/include/pmove.h index ad0567385..4dec647c8 100644 --- a/qw/include/pmove.h +++ b/qw/include/pmove.h @@ -73,6 +73,7 @@ typedef struct vec3_t angles; vec3_t velocity; int oldbuttons; + int oldonground;; float waterjumptime; qboolean dead; qboolean flying; diff --git a/qw/include/server.h b/qw/include/server.h index 2e1fe7d93..b12600be4 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -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 diff --git a/qw/source/cl_pred.c b/qw/source/cl_pred.c index 09d4b0b0c..171b67839 100644 --- a/qw/source/cl_pred.c +++ b/qw/source/cl_pred.c @@ -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); diff --git a/qw/source/pmove.c b/qw/source/pmove.c index 9dc3075c8..eef8904f5 100644 --- a/qw/source/pmove.c +++ b/qw/source/pmove.c @@ -33,6 +33,7 @@ static const char rcsid[] = #include +#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 (); diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index de257f0bc..f9eb271e8 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -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;