add debug scoreboard
This commit is contained in:
parent
746ef6913b
commit
fa96c54104
@ -1560,11 +1560,13 @@ void P_StepFrame(P_Frame *frame)
|
||||
|
||||
|
||||
for (P_Ent *ent0 = P_FirstEnt(frame); !P_IsEntNil(ent0); ent0 = P_NextEnt(ent0))
|
||||
{
|
||||
if (ent0->is_guy)
|
||||
{
|
||||
P_Shape shape0 = P_WorldShapeFromEnt(ent0);
|
||||
for (P_Ent *ent1 = P_FirstEnt(frame); !P_IsEntNil(ent1); ent1 = P_NextEnt(ent1))
|
||||
{
|
||||
if (ent1 > ent0)
|
||||
if (ent1->is_guy && ent1 > ent0)
|
||||
{
|
||||
P_Shape shape1 = P_WorldShapeFromEnt(ent1);
|
||||
|
||||
@ -1693,6 +1695,7 @@ void P_StepFrame(P_Frame *frame)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- Prune constraints
|
||||
@ -1973,7 +1976,7 @@ void P_StepFrame(P_Frame *frame)
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- Spawn new bullets
|
||||
//- Fire bullets
|
||||
|
||||
// TODO: Remove this
|
||||
|
||||
@ -1981,7 +1984,7 @@ void P_StepFrame(P_Frame *frame)
|
||||
P_EntList bullets_to_spawn = Zi;
|
||||
for (P_Ent *firer = P_FirstEnt(frame); !P_IsEntNil(firer); firer = P_NextEnt(firer))
|
||||
{
|
||||
if (firer->control.fire_held)
|
||||
if (firer->is_guy && firer->control.fire_held)
|
||||
// if (firer->fire_presses)
|
||||
{
|
||||
// i64 fire_delta_ns = frame->time_ns - firer->last_fire_ns;
|
||||
|
||||
@ -622,9 +622,12 @@ void S_TickForever(WaveLaneCtx *lane)
|
||||
{
|
||||
// TODO: Real reset
|
||||
for (P_Ent *ent = P_FirstEnt(world_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent))
|
||||
{
|
||||
if (!ent->is_player)
|
||||
{
|
||||
ent->exists = 0;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
//- Edit entity
|
||||
case P_MsgKind_EntEdit:
|
||||
@ -919,10 +922,13 @@ void S_TickForever(WaveLaneCtx *lane)
|
||||
String snapshot = Zi;
|
||||
snapshot.text = BB_GetWrittenRaw(&packer_bbw) + snapshot_start;
|
||||
snapshot.len = snapshot_end - snapshot_start;
|
||||
NET_Send(net_pipe, client->net_key, snapshot, NET_SendFlag_Raw);
|
||||
|
||||
// FIXME: Send raw snapshots
|
||||
// NET_Send(net_pipe, client->net_key, snapshot, NET_SendFlag_Raw);
|
||||
NET_Send(net_pipe, client->net_key, snapshot, NET_SendFlag_None);
|
||||
// Sanity check to catch whenever we end up packing too much information
|
||||
// into a single raw snapshot, causing it to drop. Not an actual error,
|
||||
// but signals we may have botched the packing code or need tighter
|
||||
// compression
|
||||
Assert(snapshot.len <= NET_PacketSize);
|
||||
}
|
||||
}
|
||||
delta_node = next_delta_node;
|
||||
|
||||
@ -2379,6 +2379,73 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
UI_PopCP(UI_TopCP());
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- Build scoreboard UI
|
||||
|
||||
if (frame->held_buttons[Button_Tab])
|
||||
{
|
||||
Struct(BoardRow)
|
||||
{
|
||||
BoardRow *next;
|
||||
String name;
|
||||
};
|
||||
i64 players_count = 0;
|
||||
i64 board_rows_count = 0;
|
||||
BoardRow *first_board_row = 0;
|
||||
BoardRow *last_board_row = 0;
|
||||
|
||||
for (P_Ent *player = P_FirstEnt(sim_world->last_frame); !P_IsEntNil(player); player = P_NextEnt(player))
|
||||
{
|
||||
if (player->is_player)
|
||||
{
|
||||
players_count += 1;
|
||||
BoardRow *row = PushStruct(frame->arena, BoardRow);
|
||||
{
|
||||
SllQueuePush(first_board_row, last_board_row, row);
|
||||
board_rows_count += 1;
|
||||
}
|
||||
String name = P_StringFromEnt(player);
|
||||
row->name= name;
|
||||
}
|
||||
}
|
||||
|
||||
UI_Key board_key = UI_KeyF("scoreboard");
|
||||
|
||||
Vec4 board_bg = VEC4(0, 0, 0, 0.50);
|
||||
|
||||
UI_Size board_width = UI_FNT(50, 0);
|
||||
UI_Size board_height = UI_FNT(20, 0);
|
||||
|
||||
Vec2 pos = VEC2(frame->ui_dims.x / 2, 50);
|
||||
UI_SetNext(Anchor, UI_Region_Top);
|
||||
UI_SetNext(Width, board_width);
|
||||
UI_SetNext(Height, board_height);
|
||||
UI_SetNext(FloatingPos, pos);
|
||||
UI_SetNext(BackgroundColor, board_bg);
|
||||
UI_SetNext(Flags, UI_BoxFlag_Floating);
|
||||
UI_PushCP(UI_BuildColumnEx(board_key));
|
||||
{
|
||||
for (BoardRow *board_row = first_board_row; board_row; board_row = board_row->next)
|
||||
{
|
||||
String name = board_row->name;
|
||||
|
||||
UI_SetNext(Tint, 0);
|
||||
UI_PushCP(UI_BuildRow());
|
||||
{
|
||||
UI_SetNext(FontSize, UI_Top(FontSize) * theme.h2);
|
||||
UI_BuildLabelF("Player: \"%F\"", FmtString(name));
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
|
||||
if (board_row->next)
|
||||
{
|
||||
UI_BuildDivider(UI_PIX(1, 1), theme.col.divider, Axis_Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
UI_PopCP(UI_TopCP());
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- Build console UI
|
||||
|
||||
@ -2656,10 +2723,6 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
P_Msg *msg = P_PushMsg(P_MsgKind_EntEdit, Lit("guy"));
|
||||
msg->key = local_guy->key;
|
||||
msg->pos = guy_pos;
|
||||
if (P_IsKeyNil(msg->key))
|
||||
{
|
||||
msg->key = P_RandKey();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -3088,10 +3151,13 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
String snapshot = Zi;
|
||||
snapshot.text = BB_GetWrittenRaw(&packer_bbw) + snapshot_start;
|
||||
snapshot.len = snapshot_end - snapshot_start;
|
||||
NET_Send(net_pipe, frame->sim_key, snapshot, NET_SendFlag_Raw);
|
||||
|
||||
// FIXME: Send raw snapshots
|
||||
// NET_Send(net_pipe, frame->sim_key, snapshot, NET_SendFlag_Raw);
|
||||
NET_Send(net_pipe, frame->sim_key, snapshot, NET_SendFlag_None);
|
||||
// Sanity check to catch whenever we end up packing too much information
|
||||
// into a single raw snapshot, causing it to drop. Not an actual error,
|
||||
// but signals we may have botched the packing code or need tighter
|
||||
// compression
|
||||
Assert(snapshot.len <= NET_PacketSize);
|
||||
}
|
||||
}
|
||||
delta_node = next_delta_node;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user