Skip to content

Commit 663651b

Browse files
committed
feat: show coop slot on trace hover
1 parent 30e4fe3 commit 663651b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Features/PlayerTrace.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ static void drawTraceInfo(int tick, int slot, const Trace &trace, std::function<
102102
struct TraceHoverInfo {
103103
size_t tick;
104104
std::string trace_name;
105+
bool coop;
106+
int slot;
105107
Vector pos;
106108
float speed;
107109
float dist;
@@ -251,6 +253,7 @@ void PlayerTrace::DrawInWorld() const {
251253
std::string trace_name = it->first;
252254
const Trace &trace = it->second;
253255
if (!trace.draw) continue;
256+
bool coop = trace.positions[0].size() >= 2 && trace.positions[1].size() >= 2;
254257
for (int slot = 0; slot < 2; slot++) {
255258
if (trace.positions[slot].size() < 2) continue;
256259

@@ -344,7 +347,7 @@ void PlayerTrace::DrawInWorld() const {
344347
RenderCallback::constant({255, 0, 255, 255}, draw_through_walls)
345348
);
346349
}
347-
hovers.push_back({closest_id, trace_name, closest_pos, closest_vel, closest_dist});
350+
hovers.push_back({closest_id, trace_name, coop, slot, closest_pos, closest_vel, closest_dist});
348351
}
349352
}
350353
}
@@ -946,6 +949,9 @@ ON_EVENT(RENDER) {
946949
if (playerTrace->GetTraceCount() > 1) {
947950
hover_str += Utils::ssprintf("trace: %s\n", h.trace_name.c_str());
948951
}
952+
if (h.coop) {
953+
hover_str += Utils::ssprintf("slot: %s\n", h.slot == 0 ? "blue" : "orange");
954+
}
949955
hover_str += Utils::ssprintf("pos: %.1f %.1f %.1f\n", h.pos.x, h.pos.y, h.pos.z);
950956
hover_str += Utils::ssprintf("horiz. speed: %.2f\n", h.speed);
951957

0 commit comments

Comments
 (0)