From 1120786c44c149d350826c663aea9558a795231d Mon Sep 17 00:00:00 2001 From: Molgrum Date: Mon, 8 Oct 2007 12:23:55 +0000 Subject: [PATCH] A better botclient movement code, hopefully fully operational this time. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2726 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/server/sv_phys.c | 15 ++++++++------- engine/server/sv_user.c | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index f484aad4f..6581b8b13 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -2030,9 +2030,11 @@ qboolean SV_Physics (void) host_client = &svs.clients[i-1]; sv_player = host_client->edict; - oldmovement[0] = sv_player->xv->movement[0]; - oldmovement[1] = sv_player->xv->movement[1]; - oldmovement[2] = sv_player->xv->movement[2]; + //oldmovement[0] = sv_player->xv->movement[0]; + //oldmovement[1] = sv_player->xv->movement[1]; + //oldmovement[2] = sv_player->xv->movement[2]; + + SV_PreRunCmd(); ucmd.msec = host_frametime*1000; ucmd.angles[0] = (unsigned short)(sv_player->v->angles[0] * (65535/360.0f)); @@ -2045,13 +2047,12 @@ qboolean SV_Physics (void) svs.clients[i-1].lastcmd = ucmd; //allow the other clients to predict this bot. - SV_PreRunCmd(); SV_RunCmd(&ucmd, false); SV_PostRunCmd(); - sv_player->xv->movement[0] = oldmovement[0]; - sv_player->xv->movement[1] = oldmovement[1]; - sv_player->xv->movement[2] = oldmovement[2]; + //sv_player->xv->movement[0] = oldmovement[0]; + //sv_player->xv->movement[1] = oldmovement[1]; + //sv_player->xv->movement[2] = oldmovement[2]; host_client = oldhost; sv_player = oldplayer; diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 3e44970cf..1b7c0acdf 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -4612,9 +4612,12 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse) sv_player->v->button0 = 0; } - sv_player->xv->movement[0] = ucmd->forwardmove * host_frametime; - sv_player->xv->movement[1] = ucmd->sidemove * host_frametime; - sv_player->xv->movement[2] = ucmd->upmove * host_frametime; + if (host_client->state && host_client->protocol != SCP_BAD) + { + sv_player->xv->movement[0] = ucmd->forwardmove * host_frametime; + sv_player->xv->movement[1] = ucmd->sidemove * host_frametime; + sv_player->xv->movement[2] = ucmd->upmove * host_frametime; + } SV_CheckVelocity(sv_player); @@ -5920,9 +5923,12 @@ void SV_ClientThink (void) cmd = host_client->lastcmd; sv_player = host_client->edict; - sv_player->xv->movement[0] = cmd.forwardmove; - sv_player->xv->movement[1] = cmd.sidemove; - sv_player->xv->movement[2] = cmd.upmove; + if (host_client->state && host_client->protocol != SCP_BAD) + { + sv_player->xv->movement[0] = cmd.forwardmove; + sv_player->xv->movement[1] = cmd.sidemove; + sv_player->xv->movement[2] = cmd.upmove; + } if (SV_PlayerPhysicsQC) {