]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
change threshold of prediction error compensation; add debug code
authorRudolf Polzer <divverent@alientrap.org>
Tue, 17 Jan 2012 10:26:29 +0000 (11:26 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 17 Jan 2012 10:26:29 +0000 (11:26 +0100)
qcsrc/csqcmodellib/cl_player.qc

index 404a29a474d78ccd3fee0d2ccd295f8fa5cdba9a..3c75b399f7b31a310979443620a048a6c1301655 100644 (file)
@@ -54,19 +54,32 @@ vector CSQCPlayer_GetPredictionErrorV()
        return csqcplayer_predictionerrorv * (csqcplayer_predictionerrortime - time) * csqcplayer_predictionerrorfactor;
 }
 
-void CSQCPlayer_SetPredictionError(vector o, vector v)
+void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff)
 {
-       if(!autocvar_cl_movement_errorcompensation)
+       // error too big to compensate, we LIKELY hit a teleport or a
+       // jumppad, or it's a jump time disagreement that'll get fixed
+       // next frame
+
+       // FIXME we sometimes have disagreement in order of jump velocity. Do not act on them!
+       /*
+       // commented out as this one did not help
+       if(onground_diff)
        {
-               csqcplayer_predictionerrorfactor = 0;
+               print(sprintf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v));
+               return;
+       }
+       */
+       if(vlen(o) > 32 || vlen(v) > 192)
+       {
+               //print(sprintf("TOO BIG: x=%v v=%v\n", o, v));
                return;
        }
 
-       // error too big to compensate, we LIKELY hit a teleport or a
-       // jumppad, or it's a jump time disagreement that'll get fixed
-       // next frame
-       if(vlen(o) > 32 || vlen(v) > 128)
+       if(!autocvar_cl_movement_errorcompensation)
+       {
+               csqcplayer_predictionerrorfactor = 0;
                return;
+       }
 
        csqcplayer_predictionerroro = CSQCPlayer_GetPredictionErrorO() + o;
        csqcplayer_predictionerrorv = CSQCPlayer_GetPredictionErrorV() + v;
@@ -210,7 +223,7 @@ void CSQCPlayer_SetCamera()
                                v = v0;
                                csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
                                CSQCPlayer_PredictTo(servercommandframe + 1, FALSE);
-                               CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v);
+                               CSQCPlayer_SetPredictionError(self.origin - o, self.velocity - v, pmove_onground - !!(self.pmove_flags & PMF_ONGROUND));
                                self.origin = o;
                                self.velocity = v;