Add Ctrl+click minimap ping sending

Ctrl+clicking on the minimap converts screen position to world coordinates
and sends MSG_MINIMAP_PING to the server. A local ping is also added
immediately so the sender sees their own ping.
This commit is contained in:
Kelsi 2026-03-11 23:00:03 -07:00
parent 97662800d5
commit ae8f900410
3 changed files with 48 additions and 0 deletions

View file

@ -10654,6 +10654,28 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
}
}
// Ctrl+click on minimap → send minimap ping to party
if (ImGui::IsMouseClicked(0) && ImGui::GetIO().KeyCtrl) {
ImVec2 mouse = ImGui::GetMousePos();
float mdx = mouse.x - centerX;
float mdy = mouse.y - centerY;
float distSq = mdx * mdx + mdy * mdy;
if (distSq <= mapRadius * mapRadius) {
// Invert projectToMinimap: px=mdx, py=mdy → rx=px*viewRadius/mapRadius
float rx = mdx * viewRadius / mapRadius;
float ry = mdy * viewRadius / mapRadius;
// rx/ry are in rotated frame; unrotate to get world dx/dy
// rx = -(dx*cosB + dy*sinB), ry = dx*sinB - dy*cosB
// Solving: dx = -(rx*cosB - ry*sinB), dy = -(rx*sinB + ry*cosB)
float wdx = -(rx * cosB - ry * sinB);
float wdy = -(rx * sinB + ry * cosB);
// playerRender is in render coords; add delta to get render position then convert to canonical
glm::vec3 clickRender = playerRender + glm::vec3(wdx, wdy, 0.0f);
glm::vec3 clickCanon = core::coords::renderToCanonical(clickRender);
gameHandler.sendMinimapPing(clickCanon.x, clickCanon.y);
}
}
auto applyMuteState = [&]() {
auto* activeRenderer = core::Application::getInstance().getRenderer();
float masterScale = soundMuted_ ? 0.0f : static_cast<float>(pendingMasterVolume) / 100.0f;