()
| 38 | * =================== CL_CheckPredictionError =================== |
| 39 | */ |
| 40 | static void CheckPredictionError() { |
| 41 | int frame; |
| 42 | int[] delta = new int[3]; |
| 43 | int i; |
| 44 | int len; |
| 45 | |
| 46 | if (ClientGlobals.cl_predict.value == 0.0f |
| 47 | || (ClientGlobals.cl.frame.playerstate.pmove.pm_flags & Defines.PMF_NO_PREDICTION) != 0) |
| 48 | return; |
| 49 | |
| 50 | // calculate the last usercmd_t we sent that the server has processed |
| 51 | frame = ClientGlobals.cls.netchan.incoming_acknowledged; |
| 52 | frame &= (Defines.CMD_BACKUP - 1); |
| 53 | |
| 54 | // compare what the server returned with what we had predicted it to be |
| 55 | Math3D.VectorSubtract(ClientGlobals.cl.frame.playerstate.pmove.origin, |
| 56 | ClientGlobals.cl.predicted_origins[frame], delta); |
| 57 | |
| 58 | // save the prediction error for interpolation |
| 59 | len = Math.abs(delta[0]) + Math.abs(delta[1]) + Math.abs(delta[2]); |
| 60 | if (len > 640) // 80 world units |
| 61 | { // a teleport or something |
| 62 | Math3D.VectorClear(ClientGlobals.cl.prediction_error); |
| 63 | } else { |
| 64 | if (ClientGlobals.cl_showmiss.value != 0.0f |
| 65 | && (delta[0] != 0 || delta[1] != 0 || delta[2] != 0)) |
| 66 | Com.Printf("prediction miss on " + ClientGlobals.cl.frame.serverframe |
| 67 | + ": " + (delta[0] + delta[1] + delta[2]) + "\n"); |
| 68 | |
| 69 | Math3D.VectorCopy(ClientGlobals.cl.frame.playerstate.pmove.origin, |
| 70 | ClientGlobals.cl.predicted_origins[frame]); |
| 71 | |
| 72 | // save for error itnerpolation |
| 73 | for (i = 0; i < 3; i++) |
| 74 | ClientGlobals.cl.prediction_error[i] = delta[i] * 0.125f; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | /* |
| 79 | * ==================== CL_ClipMoveToEntities |
no test coverage detected