From 629cab8d573bc8269c9b91cbd88904bcad51aaef Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 31 Mar 2007 09:56:59 +0000 Subject: [PATCH] patch from div0 to fix the fixangle logic (my fix apparently didn't work properly either) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7035 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 4 ++++ sv_main.c | 20 ++++++++++++++------ sv_phys.c | 14 +++++++++++--- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/server.h b/server.h index dff58cac..02d76f87 100644 --- a/server.h +++ b/server.h @@ -198,6 +198,10 @@ typedef struct client_s int download_expectedposition; // next position the client should ack qboolean download_started; char download_name[MAX_QPATH]; + + // fixangle data + qboolean fixangle_angles_set; + vec3_t fixangle_angles; } client_t; diff --git a/sv_main.c b/sv_main.c index e3234ab4..8ebe87e0 100644 --- a/sv_main.c +++ b/sv_main.c @@ -1090,15 +1090,23 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t SV_SetIdealPitch (); // how much to look up / down ideally // a fixangle might get lost in a dropped packet. Oh well. - if ( ent->fields.server->fixangle ) + if(ent->fields.server->fixangle) + { + // angle fixing was requested by global thinking code... + // so store the current angles for later use + memcpy(host_client->fixangle_angles, ent->fields.server->angles, sizeof(host_client->fixangle_angles)); + host_client->fixangle_angles_set = TRUE; + + // and clear fixangle for the next frame + ent->fields.server->fixangle = 0; + } + + if (host_client->fixangle_angles_set) { MSG_WriteByte (msg, svc_setangle); for (i=0 ; i < 3 ; i++) - MSG_WriteAngle (msg, ent->fields.server->angles[i], sv.protocol); - // LordHavoc: moved fixangle = 0 to the physics code so it is - // repeatedly sent to predicted clients even though they don't always - // move each frame - //ent->fields.server->fixangle = 0; + MSG_WriteAngle (msg, host_client->fixangle_angles[i], sv.protocol); + host_client->fixangle_angles_set = FALSE; } // stuff the sigil bits into the high bits of items for sbar, or else diff --git a/sv_phys.c b/sv_phys.c index 4dbf089a..6ce4f9e1 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -2001,9 +2001,6 @@ static void SV_Physics_Entity (prvm_edict_t *ent) void SV_Physics_ClientEntity (prvm_edict_t *ent) { - // LordHavoc: clear fixangle here rather than on send, because input is - // not always received every frame from predicted clients - ent->fields.server->fixangle = 0; SV_ApplyClientMove(); // make sure the velocity is sane (not a NaN) SV_CheckVelocity(ent); @@ -2094,6 +2091,17 @@ void SV_Physics_ClientEntity (prvm_edict_t *ent) prog->globals.server->time = sv.time; prog->globals.server->self = PRVM_EDICT_TO_PROG(ent); PRVM_ExecuteProgram (prog->globals.server->PlayerPostThink, "QC function PlayerPostThink is missing"); + + if(ent->fields.server->fixangle) + { + // angle fixing was requested by physics code... + // so store the current angles for later use + memcpy(host_client->fixangle_angles, ent->fields.server->angles, sizeof(host_client->fixangle_angles)); + host_client->fixangle_angles_set = TRUE; + + // and clear fixangle for the next frame + ent->fields.server->fixangle = 0; + } } /* -- 2.39.2