]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
1. network sv_gameplayfix_gravityunaffectedbyticrate to the client, and predict properly
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Apr 2010 13:47:58 +0000 (13:47 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 5 Apr 2010 13:47:58 +0000 (13:47 +0000)
2. new cvar sv_gameplayfix_nogravityonground (also supported by cl_movement)

When that cvar is activated, walking on downward slopes is a little bumpy.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10069 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
quakedef.h
server.h
sv_main.c
sv_phys.c

index 6aaf8139353171031b46ee7c500bd42a8c41a237..4c94d38e61f6c210b45a90cb6c6797cad2d72f3f 100644 (file)
@@ -1260,6 +1260,7 @@ void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
        vec_t addspeed;
        vec_t accelspeed;
        vec_t f;
+       vec_t gravity;
        vec3_t forward;
        vec3_t right;
        vec3_t up;
@@ -1332,11 +1333,20 @@ void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
                        accelspeed = min(cl.movevars_accelerate * s->cmd.frametime * wishspeed, addspeed);
                        VectorMA(s->velocity, accelspeed, wishdir, s->velocity);
                }
-               s->velocity[2] -= cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
+               if(cl.moveflags & MOVEFLAG_NOGRAVITYONGROUND)
+                       gravity = 0;
+               else
+                       gravity = cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
+               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                       s->velocity[2] -= gravity * 0.5f;
+               else
+                       s->velocity[2] -= gravity;
                if (cls.protocol == PROTOCOL_QUAKEWORLD)
                        s->velocity[2] = 0;
                if (VectorLength2(s->velocity))
                        CL_ClientMovement_Move(s);
+               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                       s->velocity[2] -= gravity * 0.5f;
        }
        else
        {
@@ -1395,8 +1405,14 @@ void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
                        if(cl.movevars_aircontrol)
                                CL_ClientMovement_Physics_CPM_PM_Aircontrol(s, wishdir, wishspeed2);
                }
-               s->velocity[2] -= cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
+               gravity = cl.movevars_gravity * cl.movevars_entgravity * s->cmd.frametime;
+               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                       s->velocity[2] -= gravity * 0.5f;
+               else
+                       s->velocity[2] -= gravity;
                CL_ClientMovement_Move(s);
+               if(cl.moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
+                       s->velocity[2] -= gravity * 0.5f;
        }
 }
 
index b308f60eaded7de4dc79baf3b2dd761d708692fb..55e8e6ac2df480303d9a0d6802e43e0614eace9c 100644 (file)
@@ -264,6 +264,8 @@ extern char engineversion[128];
 // moveflags values
 #define MOVEFLAG_VALID 0x80000000
 #define MOVEFLAG_Q2AIRACCELERATE 0x00000001
+#define MOVEFLAG_NOGRAVITYONGROUND 0x00000002
+#define MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE 0x00000004
 
 // stock defines
 
index 62d11f0d21669cd686975499313ae59c75b96411..0d597762a661c610a8e0400fedeed72d537ea27f 100644 (file)
--- a/server.h
+++ b/server.h
@@ -424,6 +424,7 @@ extern cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect;
 extern cvar_t sv_gameplayfix_easierwaterjump;
 extern cvar_t sv_gameplayfix_findradiusdistancetobox;
 extern cvar_t sv_gameplayfix_gravityunaffectedbyticrate;
+extern cvar_t sv_gameplayfix_nogravityonground;
 extern cvar_t sv_gameplayfix_grenadebouncedownslopes;
 extern cvar_t sv_gameplayfix_multiplethinksperframe;
 extern cvar_t sv_gameplayfix_noairborncorpse;
index 1112d5c6453731d9eada1abeea59cb38d964ee5c..e1330214f43ddec39920509273a658bb3e1b8ef8 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -100,6 +100,7 @@ cvar_t sv_gameplayfix_noairborncorpse_allowsuspendeditems = {0, "sv_gameplayfix_
 cvar_t sv_gameplayfix_nudgeoutofsolid = {0, "sv_gameplayfix_nudgeoutofsolid", "1", "attempts to fix physics errors (where an object ended up in solid for some reason)"};
 cvar_t sv_gameplayfix_nudgeoutofsolid_bias = {0, "sv_gameplayfix_nudgeoutofsolid_bias", "0", "over-correction on nudgeoutofsolid logic, to prevent constant contact"};
 cvar_t sv_gameplayfix_q2airaccelerate = {0, "sv_gameplayfix_q2airaccelerate", "0", "Quake2-style air acceleration"};
+cvar_t sv_gameplayfix_nogravityonground = {0, "sv_gameplayfix_nogravityonground", "0", "Quake2-style air acceleration"};
 cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};
 cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojectiles", "1", "allows MOVETYPE_FLY/FLYMISSILE/TOSS/BOUNCE/BOUNCEMISSILE entities to finish their move in a frame even if they hit something, fixes 'gravity accumulation' bug for grenades on steep slopes"};
 cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "0", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"};
@@ -412,6 +413,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid);
        Cvar_RegisterVariable (&sv_gameplayfix_nudgeoutofsolid_bias);
        Cvar_RegisterVariable (&sv_gameplayfix_q2airaccelerate);
+       Cvar_RegisterVariable (&sv_gameplayfix_nogravityonground);
        Cvar_RegisterVariable (&sv_gameplayfix_setmodelrealbox);
        Cvar_RegisterVariable (&sv_gameplayfix_slidemoveprojectiles);
        Cvar_RegisterVariable (&sv_gameplayfix_stepdown);
@@ -517,7 +519,6 @@ void SV_Init (void)
        }
        if (gamemode == GAME_NEXUIZ)
        {
-               // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
                Cvar_SetValueQuick (&sv_gameplayfix_q2airaccelerate, 1);
        }
 
@@ -1932,6 +1933,8 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t
        // note: these are not sent in protocols with lower MAX_CL_STATS limits
        stats[STAT_MOVEFLAGS] = MOVEFLAG_VALID
                | (sv_gameplayfix_q2airaccelerate.integer ? MOVEFLAG_Q2AIRACCELERATE : 0)
+               | (sv_gameplayfix_nogravityonground.integer ? MOVEFLAG_NOGRAVITYONGROUND : 0)
+               | (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0)
        ;
        statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value;
        statsf[STAT_MOVEVARS_TIMESCALE] = slowmo.value;
index d7ae93f4daf8d6f73d6d7259d6a427764993384a..7863325352bb26b74021443293213d284c7e6e5e 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1230,6 +1230,11 @@ static int SV_FlyMove (prvm_edict_t *ent, float time, qboolean applygravity, flo
        if (time <= 0)
                return 0;
        gravity = 0;
+
+       if(sv_gameplayfix_nogravityonground.integer)
+               if((int)ent->fields.server->flags & FL_ONGROUND)
+                       applygravity = false;
+
        if (applygravity)
        {
                if (sv_gameplayfix_gravityunaffectedbyticrate.integer)