ping testing
This commit is contained in:
parent
db7cbad4b3
commit
8bae9d0da2
@ -240,7 +240,11 @@ void S_TickForever(WaveLaneCtx *lane)
|
|||||||
b32 allow = 0;
|
b32 allow = 0;
|
||||||
if (cmd->kind == P_CmdKind_ResetWorld)
|
if (cmd->kind == P_CmdKind_ResetWorld)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO: Real reset
|
||||||
|
for (P_Ent *ent = P_FirstEnt(world_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
|
||||||
|
{
|
||||||
|
ent->exists = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (cmd->kind == P_CmdKind_EntEdit)
|
if (cmd->kind == P_CmdKind_EntEdit)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -879,8 +879,11 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
look_ratio.y = 0.25;
|
look_ratio.y = 0.25;
|
||||||
look_ratio.x = look_ratio.y / (16.0 / 9.0);
|
look_ratio.x = look_ratio.y / (16.0 / 9.0);
|
||||||
P_Ent *player = P_EntFromKey(blend_world->last_frame, V.player_key);
|
P_Ent *player = P_EntFromKey(blend_world->last_frame, V.player_key);
|
||||||
target_camera_pos = P_WorldShapeFromEnt(player).centroid;
|
Vec2 player_center = P_WorldShapeFromEnt(player).centroid;
|
||||||
target_camera_pos = AddVec2(target_camera_pos, MulVec2Vec2(player->look, look_ratio));
|
Vec2 ui_center = MulVec2(frame->ui_dims, 0.5);
|
||||||
|
Vec2 look = MulXformBasisV2(prev_frame->xf.ui_to_world, SubVec2(ui_frame->cursor_pos, ui_center));
|
||||||
|
target_camera_pos = player_center;
|
||||||
|
target_camera_pos = AddVec2(target_camera_pos, MulVec2Vec2(look, look_ratio));
|
||||||
target_camera_zoom = 1;
|
target_camera_zoom = 1;
|
||||||
}
|
}
|
||||||
target_camera_pos.x = ClampF32(target_camera_pos.x, -world_pitch / 2, world_pitch / 2);
|
target_camera_pos.x = ClampF32(target_camera_pos.x, -world_pitch / 2, world_pitch / 2);
|
||||||
@ -2653,10 +2656,6 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
// FIXME: Only apply latest snapshot
|
// FIXME: Only apply latest snapshot
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME: Real ping
|
|
||||||
i64 ping_ns = NsFromSeconds(0.250);
|
|
||||||
|
|
||||||
// TODO: Remove this (testing)
|
// TODO: Remove this (testing)
|
||||||
|
|
||||||
|
|
||||||
@ -2710,7 +2709,13 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Submit sim commands
|
//- Submit sim commands
|
||||||
|
|
||||||
frame->predict_to = sim_world->last_frame->tick + 1;
|
// FIXME: Real ping
|
||||||
|
f64 ping = 0.250;
|
||||||
|
// f64 ping = 0;
|
||||||
|
i64 ping_ns = NsFromSeconds(ping);
|
||||||
|
|
||||||
|
frame->predict_to = sim_world->last_frame->tick + MaxF64(CeilF64(ping * SIM_TICKS_PER_SECOND), 1.0);
|
||||||
|
|
||||||
if (frame->predict_to != prev_frame->predict_to)
|
if (frame->predict_to != prev_frame->predict_to)
|
||||||
{
|
{
|
||||||
// Push control cmd
|
// Push control cmd
|
||||||
@ -2752,6 +2757,10 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//- Predict
|
//- Predict
|
||||||
|
|
||||||
@ -2787,7 +2796,8 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
// prev_predict_frame = stepped;
|
// prev_predict_frame = stepped;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
predict_frame = sim_world->last_frame;
|
P_ClearFrames(predict_world, I64Min, I64Max);
|
||||||
|
predict_frame = P_PushFrame(predict_world, sim_world->last_frame, sim_world->last_frame->tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2803,7 +2813,7 @@ void V_TickForever(WaveLaneCtx *lane)
|
|||||||
P_Frame *blend_frame = 0;
|
P_Frame *blend_frame = 0;
|
||||||
{
|
{
|
||||||
P_ClearFrames(blend_world, I64Min, I64Max);
|
P_ClearFrames(blend_world, I64Min, I64Max);
|
||||||
blend_frame = P_PushFrame(blend_world, sim_world->last_frame, sim_world->last_frame->tick);
|
blend_frame = P_PushFrame(blend_world, predict_world->last_frame, predict_world->last_frame->tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user