]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
patch from div0 to fix the fixangle logic (my fix apparently didn't work properly...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 31 Mar 2007 09:56:59 +0000 (09:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 31 Mar 2007 09:56:59 +0000 (09:56 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7035 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_main.c
sv_phys.c

index dff58cac4c8a503441191e46052db61029655a86..02d76f87cc646e53890ba152eb4cce677ce60ca0 100644 (file)
--- 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;
 
 
index e3234ab4c7759a514ae7bc0913d893f3f7abdacd..8ebe87e0ca9e42afc0e257e98ecc2c79678f0fe0 100644 (file)
--- 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
index 4dbf089a1b2a6c69a41f90598b412336ab72a85d..6ce4f9e11c0c418eaff7ba952aada09ccc1fe0ff 100644 (file)
--- 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;
+       }
 }
 
 /*