From: Mario Date: Tue, 14 Jul 2015 02:22:23 +0000 (+1000) Subject: Allow prediction of other movetypes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2FMario%2Fcombined_downgrades;p=xonotic%2Fdarkplaces.git Allow prediction of other movetypes --- diff --git a/sv_phys.c b/sv_phys.c index c84f0c15..0a1d7f02 100644 --- 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; diff --git a/sv_user.c b/sv_user.c index 5f8bf86a..9093a70b 100644 --- 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