mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Improve targeting, minimap, and bridge collisions
This commit is contained in:
parent
a7c0b4320b
commit
38c9fdad6b
10 changed files with 142 additions and 24 deletions
|
|
@ -3591,6 +3591,12 @@ void GameScreen::renderSettingsWindow() {
|
|||
}
|
||||
}
|
||||
pendingUiOpacity = static_cast<int>(uiOpacity_ * 100.0f + 0.5f);
|
||||
pendingMinimapRotate = minimapRotate_;
|
||||
if (renderer) {
|
||||
if (auto* minimap = renderer->getMinimap()) {
|
||||
minimap->setRotateWithCamera(minimapRotate_);
|
||||
}
|
||||
}
|
||||
settingsInit = true;
|
||||
}
|
||||
|
||||
|
|
@ -3659,8 +3665,10 @@ void GameScreen::renderSettingsWindow() {
|
|||
|
||||
ImGui::Text("Interface");
|
||||
ImGui::SliderInt("UI Opacity", &pendingUiOpacity, 20, 100, "%d%%");
|
||||
ImGui::Checkbox("Rotate Minimap", &pendingMinimapRotate);
|
||||
if (ImGui::Button("Restore Interface Defaults", ImVec2(-1, 0))) {
|
||||
pendingUiOpacity = 65;
|
||||
pendingMinimapRotate = true;
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
|
@ -3669,12 +3677,16 @@ void GameScreen::renderSettingsWindow() {
|
|||
|
||||
if (ImGui::Button("Apply", ImVec2(-1, 0))) {
|
||||
uiOpacity_ = static_cast<float>(pendingUiOpacity) / 100.0f;
|
||||
minimapRotate_ = pendingMinimapRotate;
|
||||
saveSettings();
|
||||
window->setVsync(pendingVsync);
|
||||
window->setFullscreen(pendingFullscreen);
|
||||
window->applyResolution(kResolutions[pendingResIndex][0], kResolutions[pendingResIndex][1]);
|
||||
if (renderer) {
|
||||
renderer->setShadowsEnabled(pendingShadows);
|
||||
if (auto* minimap = renderer->getMinimap()) {
|
||||
minimap->setRotateWithCamera(minimapRotate_);
|
||||
}
|
||||
if (auto* music = renderer->getMusicManager()) {
|
||||
music->setVolume(pendingMusicVolume);
|
||||
}
|
||||
|
|
@ -3782,8 +3794,6 @@ void GameScreen::renderQuestMarkers(game::GameHandler& gameHandler) {
|
|||
|
||||
void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
||||
const auto& statuses = gameHandler.getNpcQuestStatuses();
|
||||
if (statuses.empty()) return;
|
||||
|
||||
auto* renderer = core::Application::getInstance().getRenderer();
|
||||
auto* camera = renderer ? renderer->getCamera() : nullptr;
|
||||
auto* minimap = renderer ? renderer->getMinimap() : nullptr;
|
||||
|
|
@ -3805,10 +3815,37 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
|||
glm::vec3 playerRender = core::coords::canonicalToRender(glm::vec3(mi.x, mi.y, mi.z));
|
||||
|
||||
// Camera bearing for minimap rotation
|
||||
glm::vec3 fwd = camera->getForward();
|
||||
float bearing = std::atan2(-fwd.x, fwd.y);
|
||||
float cosB = std::cos(bearing);
|
||||
float sinB = std::sin(bearing);
|
||||
float bearing = 0.0f;
|
||||
float cosB = 1.0f;
|
||||
float sinB = 0.0f;
|
||||
if (minimapRotate_) {
|
||||
glm::vec3 fwd = camera->getForward();
|
||||
bearing = std::atan2(-fwd.x, fwd.y);
|
||||
cosB = std::cos(bearing);
|
||||
sinB = std::sin(bearing);
|
||||
}
|
||||
|
||||
// Draw north indicator when rotating (points to world north on screen).
|
||||
if (minimapRotate_) {
|
||||
auto* drawList = ImGui::GetForegroundDrawList();
|
||||
ImU32 fill = IM_COL32(0, 0, 0, 230);
|
||||
ImU32 outline = IM_COL32(0, 0, 0, 220);
|
||||
float tipDist = mapRadius - 8.0f;
|
||||
float baseDist = tipDist - 10.0f;
|
||||
float nAng = -bearing; // map rotated by bearing; north rotates opposite
|
||||
float cN = std::cos(nAng);
|
||||
float sN = std::sin(nAng);
|
||||
|
||||
auto rot = [&](float x, float y) -> ImVec2 {
|
||||
return ImVec2(centerX + x * cN - y * sN, centerY + x * sN + y * cN);
|
||||
};
|
||||
|
||||
ImVec2 textPos = rot(0.0f, -(baseDist + 9.0f));
|
||||
drawList->AddText(ImVec2(textPos.x - 4.0f, textPos.y), outline, "N");
|
||||
drawList->AddText(ImVec2(textPos.x - 4.0f, textPos.y), fill, "N");
|
||||
}
|
||||
|
||||
if (statuses.empty()) return;
|
||||
|
||||
auto* drawList = ImGui::GetForegroundDrawList();
|
||||
|
||||
|
|
@ -3895,6 +3932,7 @@ void GameScreen::saveSettings() {
|
|||
}
|
||||
|
||||
out << "ui_opacity=" << pendingUiOpacity << "\n";
|
||||
out << "minimap_rotate=" << (pendingMinimapRotate ? 1 : 0) << "\n";
|
||||
LOG_INFO("Settings saved to ", path);
|
||||
}
|
||||
|
||||
|
|
@ -3918,6 +3956,12 @@ void GameScreen::loadSettings() {
|
|||
uiOpacity_ = static_cast<float>(v) / 100.0f;
|
||||
}
|
||||
} catch (...) {}
|
||||
} else if (key == "minimap_rotate") {
|
||||
try {
|
||||
int v = std::stoi(val);
|
||||
minimapRotate_ = (v != 0);
|
||||
pendingMinimapRotate = minimapRotate_;
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
LOG_INFO("Settings loaded from ", path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue