Enable prediction on SP

isolation_bkp/dynres
Dominik Madarász 2021-10-27 00:32:40 +02:00
parent 6f57fb178a
commit 4be5ee9b61
2 changed files with 122 additions and 115 deletions

View File

@ -69,13 +69,19 @@ void predict_receive_update(entity_view *d, entity_view *data) {
data->tran_time = d->tran_time; data->tran_time = d->tran_time;
} }
#define ENTITY_DO_LERP_SP 1
void lerp_entity_positions(uint64_t key, entity_view *data) { void lerp_entity_positions(uint64_t key, entity_view *data) {
(void)key; (void)key;
world_view *view = game_world_view_get_active(); world_view *view = game_world_view_get_active();
if (data->flag == EFLAG_INTERP) { if (data->flag == EFLAG_INTERP) {
if (game_get_kind() == GAMEKIND_CLIENT) { #if ENTITY_DO_LERP_SP==0
if (game_get_kind() == GAMEKIND_CLIENT)
#else
if (1)
#endif
{
data->x = smooth_val(data->x, data->tx, view->delta_time[data->layer_id]); data->x = smooth_val(data->x, data->tx, view->delta_time[data->layer_id]);
data->y = smooth_val(data->y, data->ty, view->delta_time[data->layer_id]); data->y = smooth_val(data->y, data->ty, view->delta_time[data->layer_id]);
data->heading = smooth_val_spherical(data->heading, data->theading, view->delta_time[data->layer_id]); data->heading = smooth_val_spherical(data->heading, data->theading, view->delta_time[data->layer_id]);

View File

@ -173,7 +173,8 @@ void VehicleHandling(ecs_iter_t *it) {
{ {
float dx = zpl_sin(car->heading); float dx = zpl_sin(car->heading);
float dy = -zpl_cos(car->heading); float dy = -zpl_cos(car->heading);
debug_push_circle((debug_v2){p[i].x+dx*car->steer*-20, p[i].y+dy*car->steer*-20}, 5.0f, 0x00FFAAFF); float steer_mult = -80.0f;
debug_push_circle((debug_v2){p[i].x+dx*car->steer*steer_mult, p[i].y+dy*car->steer*steer_mult}, 5.0f, 0x00FFAAFF);
} }
} }
} }