mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
Restructure inventory UI, add vendor selling, camera intro on all spawns, and quest log
Split inventory into bags-only (B key) and character screen (C key). Vendor window auto-opens bags with sell prices on hover and right-click to sell. Add camera intro pan on all login/spawn/teleport/hearthstone events and idle orbit after 2 minutes. Add quest log UI, SMSG_MONSTER_MOVE handling, deferred creature spawn queue, and creature fade-in/movement interpolation for online mode.
This commit is contained in:
parent
a4a39c7f0f
commit
7128ea1417
21 changed files with 1092 additions and 149 deletions
90
src/ui/quest_log_screen.cpp
Normal file
90
src/ui/quest_log_screen.cpp
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#include "ui/quest_log_screen.hpp"
|
||||
#include "core/application.hpp"
|
||||
#include "core/input.hpp"
|
||||
#include <imgui.h>
|
||||
|
||||
namespace wowee { namespace ui {
|
||||
|
||||
void QuestLogScreen::render(game::GameHandler& gameHandler) {
|
||||
// L key toggle (edge-triggered)
|
||||
bool uiWantsKeyboard = ImGui::GetIO().WantCaptureKeyboard;
|
||||
bool lDown = !uiWantsKeyboard && core::Input::getInstance().isKeyPressed(SDL_SCANCODE_L);
|
||||
if (lDown && !lKeyWasDown) {
|
||||
open = !open;
|
||||
}
|
||||
lKeyWasDown = lDown;
|
||||
|
||||
if (!open) return;
|
||||
|
||||
auto* window = core::Application::getInstance().getWindow();
|
||||
float screenW = window ? static_cast<float>(window->getWidth()) : 1280.0f;
|
||||
float screenH = window ? static_cast<float>(window->getHeight()) : 720.0f;
|
||||
|
||||
float logW = 380.0f;
|
||||
float logH = std::min(450.0f, screenH - 120.0f);
|
||||
float logX = (screenW - logW) * 0.5f;
|
||||
float logY = 80.0f;
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(logX, logY), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(logW, logH), ImGuiCond_FirstUseEver);
|
||||
|
||||
bool stillOpen = true;
|
||||
if (ImGui::Begin("Quest Log", &stillOpen)) {
|
||||
const auto& quests = gameHandler.getQuestLog();
|
||||
|
||||
if (quests.empty()) {
|
||||
ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "No active quests.");
|
||||
} else {
|
||||
// Left panel: quest list
|
||||
ImGui::BeginChild("QuestList", ImVec2(0, -ImGui::GetFrameHeightWithSpacing() - 4), true);
|
||||
for (size_t i = 0; i < quests.size(); i++) {
|
||||
const auto& q = quests[i];
|
||||
ImGui::PushID(static_cast<int>(i));
|
||||
|
||||
ImVec4 color = q.complete
|
||||
? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) // Green for complete
|
||||
: ImVec4(1.0f, 0.82f, 0.0f, 1.0f); // Gold for active
|
||||
|
||||
bool selected = (selectedIndex == static_cast<int>(i));
|
||||
if (ImGui::Selectable("##quest", selected, 0, ImVec2(0, 20))) {
|
||||
selectedIndex = static_cast<int>(i);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored(color, "%s%s",
|
||||
q.title.c_str(),
|
||||
q.complete ? " (Complete)" : "");
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
// Details panel for selected quest
|
||||
if (selectedIndex >= 0 && selectedIndex < static_cast<int>(quests.size())) {
|
||||
const auto& sel = quests[static_cast<size_t>(selectedIndex)];
|
||||
|
||||
if (!sel.objectives.empty()) {
|
||||
ImGui::Separator();
|
||||
ImGui::TextWrapped("%s", sel.objectives.c_str());
|
||||
}
|
||||
|
||||
// Abandon button
|
||||
if (!sel.complete) {
|
||||
ImGui::Separator();
|
||||
if (ImGui::Button("Abandon Quest")) {
|
||||
gameHandler.abandonQuest(sel.questId);
|
||||
if (selectedIndex >= static_cast<int>(quests.size())) {
|
||||
selectedIndex = static_cast<int>(quests.size()) - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
if (!stillOpen) {
|
||||
open = false;
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace wowee::ui
|
||||
Loading…
Add table
Add a link
Reference in a new issue