]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Allow prediction of other movetypes Mario/combined_downgrades
authorMario <zacjardine@y7mail.com>
Tue, 14 Jul 2015 02:22:23 +0000 (12:22 +1000)
committerMario <zacjardine@y7mail.com>
Tue, 14 Jul 2015 02:22:23 +0000 (12:22 +1000)
sv_phys.c
sv_user.c

index c84f0c159650a1ceda860bd51858df958a3fc8cb..0a1d7f020a1f411ca7870547386235c68ddae0fc 100644 (file)
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -2888,6 +2888,64 @@ static void SV_Physics_Entity (prvm_edict_t *ent)
        }
 }
 
+static void SV_Physics_ClientMove_Move(prvm_edict_t *ent)
+{
+       prvm_prog_t *prog = SVVM_prog;
+       // don't do physics on disconnected clients, FrikBot relies on this
+       if (!host_client->begun)
+       {
+               memset(&host_client->cmd, 0, sizeof(host_client->cmd));
+               return;
+       }
+
+       // make sure the velocity is sane (not a NaN)
+       SV_CheckVelocity(ent);
+
+       switch ((int) PRVM_serveredictfloat(ent, movetype))
+       {
+       case MOVETYPE_PUSH:
+       case MOVETYPE_FAKEPUSH:
+               SV_Physics_Pusher (ent);
+               break;
+       case MOVETYPE_NONE:
+               break;
+       case MOVETYPE_FOLLOW:
+               SV_Physics_Follow (ent);
+               break;
+       case MOVETYPE_NOCLIP:
+               break;
+       case MOVETYPE_STEP:
+               SV_Physics_Step (ent);
+               break;
+       case MOVETYPE_WALK:
+               SV_WalkMove (ent);
+               break;
+       case MOVETYPE_TOSS:
+       case MOVETYPE_BOUNCE:
+       case MOVETYPE_BOUNCEMISSILE:
+       case MOVETYPE_FLYMISSILE:
+               // regular thinking
+               SV_Physics_Toss (ent);
+               break;
+       case MOVETYPE_FLY:
+       case MOVETYPE_FLY_WORLDONLY:
+               SV_WalkMove (ent);
+               break;
+       case MOVETYPE_PHYSICS:
+               break;
+       default:
+               Con_Printf ("SV_Physics_ClientEntity: bad movetype %i\n", (int)PRVM_serveredictfloat(ent, movetype));
+               break;
+       }
+
+       SV_CheckVelocity (ent);
+
+       SV_LinkEdict(ent);
+       //SV_LinkEdict_TouchAreaGrid(ent);
+
+       SV_CheckVelocity (ent);
+}
+
 void SV_Physics_ClientMove(void)
 {
        prvm_prog_t *prog = SVVM_prog;
@@ -2909,7 +2967,8 @@ void SV_Physics_ClientMove(void)
        SV_CheckVelocity(ent);
 
        // perform MOVETYPE_WALK behavior
-       SV_WalkMove (ent);
+       //SV_WalkMove (ent);
+       SV_Physics_ClientMove_Move(ent);
 
        // call standard player post-think, with frametime = 0
        PRVM_serverglobalfloat(time) = sv.time;
index 5f8bf86a02d65be8e0d1fbdda6d3b97849859265..9093a70bcd120d675e3dd306bce88536f4e30610 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -599,7 +599,7 @@ static void SV_ExecuteClientMoves(void)
        if (ceil(max(sv_readmoves[sv_numreadmoves-1].receivetime - sv_readmoves[sv_numreadmoves-1].time, 0) * 1000.0) < sv_clmovement_minping.integer)
                host_client->clmovement_disabletimeout = realtime + sv_clmovement_minping_disabletime.value / 1000.0;
        // several conditions govern whether clientside movement prediction is allowed
-       if (sv_readmoves[sv_numreadmoves-1].sequence && sv_clmovement_enable.integer && sv_clmovement_inputtimeout.value > 0 && host_client->clmovement_disabletimeout <= realtime && PRVM_serveredictfloat(host_client->edict, movetype) == MOVETYPE_WALK && (!PRVM_serveredictfloat(host_client->edict, disableclientprediction)))
+       if (sv_readmoves[sv_numreadmoves-1].sequence && sv_clmovement_enable.integer && sv_clmovement_inputtimeout.value > 0 && host_client->clmovement_disabletimeout <= realtime && (!PRVM_serveredictfloat(host_client->edict, disableclientprediction)))
        {
                // process the moves in order and ignore old ones
                // but always trust the latest move