rendered paste bodyvoid doPredCalc(int player) {
trajectory_t tr_tmp;
int delta_time;
int eFlags = eth.cg_entities[player].currentState->eFlags;
// tr_tmp.trType = history[player][0].trType;
tr_tmp.trTime = eth.cg_time;
VectorCopy(history[player][0].trPos, tr_tmp.trBase);
VectorCopy(history[player][0].trDelta, tr_tmp.trDelta);
VectorNormalize(tr_tmp.trDelta);
if( VectorLength(history[player][0].trDelta) > 100 )
tr_tmp.trDelta[0] = tr_tmp.trDelta[0];
int tmp_dt = history[player][0].t - history[player][1].t;
if (tmp_dt > 0 && tmp_dt < 600)
delta_time = history[player][0].t - history[player][1].t;
else if(eth.cg_snap->ping > 0)
delta_time = eth.cg_snap->ping;
else
delta_time = eth.cg_snap->serverTime - eth.cg_time;
//delta_time *= 0.5;
tr_tmp.trTime = eth.cg_snap->serverTime;
tr_tmp.trDuration = delta_time;
// check for bird
if(history[player][0].air_state == ENTITYNUM_NONE ) {
tr_tmp.trType = TR_GRAVITY;
eth_BG_EvaluateTrajectoryDelta(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),tr_tmp.trDelta,qfalse,-1);
} else {
tr_tmp.trType = TR_GRAVITY_FLOAT;
eth_BG_EvaluateTrajectoryDelta(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),tr_tmp.trDelta,qfalse,-1);
}
// and for crouchersopr0nners
if( (eFlags & EF_PRONE) || (eFlags & EF_PRONE_MOVING) || (eFlags & EF_CROUCHING)) {
tr_tmp.trType = TR_LINEAR;
eth_BG_EvaluateTrajectoryDelta(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),tr_tmp.trDelta,qfalse,-1);
// acceleration
} else if(history[player][0].t > 0 && history[player][1].t > 0 && history[player][2].t > 0) {
if((VectorDistance(history[player][2].trPos,history[player][1].trPos)/(history[player][1].t-history[player][2].t)) < (VectorDistance(history[player][1].trPos,history[player][0].trPos)/(history[player][0].t-history[player][1].t))) {
tr_tmp.trType = TR_ACCELERATE;
eth_BG_EvaluateTrajectoryDelta(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),tr_tmp.trDelta,qfalse,-1);
} else {
tr_tmp.trType = TR_DECCELERATE;
eth_BG_EvaluateTrajectoryDelta(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),tr_tmp.trDelta,qfalse,-1);
}
}
VectorCopy(history[player][0].prPos,tr_tmp.trDelta);
tr_tmp.trType = TR_SINE;
eth.BG_EvaluateTrajectory(&tr_tmp,eth.cg_time + (int)(delta_time * seth.value[VAR_PRED_C]),history[player][0].prPos,qfalse,-1);
if(VectorDistance(history[player][0].prPos,history[player][0].trPos) < 100)
VectorSubtract(history[player][0].trPos,history[player][0].prPos,history[player][0].prPos);
else
VectorCopy(history[player][0].trDelta,history[player][0].prPos);
vec3_t distance;
VectorAdd(history[player][1].trPos,history[player][1].prPos,distance);
eth.predMissed = VectorDistance(distance,history[player][0].trPos);
}