fix: make choice options the only clickable area in dialogue choices

This commit is contained in:
vottozi committed 2026-04-17 02:04:36 +06:00
1 parent 2494a44e4a
commit be4dcd4cf9
8 files changed
+112 -29

No files matched your search

+21 -5
View File
@@ -185,10 +185,26 @@ void DialogueRuntime::moveSelection(int delta) {
}
const int count = static_cast<int>(visibleChoices.size());
selectedChoice = (selectedChoice + delta) % count;
if (selectedChoice < 0) {
selectedChoice += count;
if (selectedChoice < 0 || selectedChoice >= count) {
selectedChoice = (delta >= 0) ? 0 : (count - 1);
}
else {
selectedChoice = (selectedChoice + delta) % count;
if (selectedChoice < 0) {
selectedChoice += count;
}
}
presentation.selectedChoice = selectedChoice;
}
void DialogueRuntime::selectChoice(int index) {
if (mode != Mode::WaitingForChoice || visibleChoices.empty()) {
return;
}
if (index < 0 || index >= static_cast<int>(visibleChoices.size())) {
return;
}
selectedChoice = index;
presentation.selectedChoice = selectedChoice;
}
@@ -346,14 +362,14 @@ void DialogueRuntime::presentChoices(const Node& node) {
}
mode = Mode::WaitingForChoice;
selectedChoice = 0;
selectedChoice = -1;
presentation.mode = PresentationMode::Choice;
presentation.speaker = node.speaker;
presentation.fullText = node.text;
presentation.visibleText = node.text;
presentation.portraitPath = node.portrait;
presentation.backgroundPath.clear();
presentation.selectedChoice = 0;
presentation.selectedChoice = -1;
presentation.revealCompleted = true;
presentation.showCutsceneSubtitle = false;
presentation.cutsceneCamera = {};