From e2f6ee3b7a4c6344b1796b179370c10d138aadba Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Sun, 13 Jun 2021 10:14:07 +0700 Subject: [PATCH] Refactor Dialog and Computer GUI to use control binding --- src/engine/game/gui/computer.cpp | 83 ++++++++++++++++++++-------- src/engine/game/gui/computer.h | 43 +++++++++++++- src/engine/game/gui/conversation.cpp | 23 ++------ src/engine/game/gui/conversation.h | 31 +++++------ src/engine/game/gui/dialog.cpp | 63 +++++++++++++-------- src/engine/game/gui/dialog.h | 26 ++++++--- 6 files changed, 181 insertions(+), 88 deletions(-) diff --git a/src/engine/game/gui/computer.cpp b/src/engine/game/gui/computer.cpp index e7e7adb0..caf640df 100644 --- a/src/engine/game/gui/computer.cpp +++ b/src/engine/game/gui/computer.cpp @@ -17,8 +17,6 @@ #include "computer.h" -#include "../../gui/control/listbox.h" - #include "../game.h" #include "../gameidutil.h" @@ -33,13 +31,9 @@ namespace reone { namespace game { -static const char kControlTagMessage[] = "LB_MESSAGE"; -static const char kControlTagReplies[] = "LB_REPLIES"; - ComputerGUI::ComputerGUI(Game *game) : Conversation(game) { _resRef = getResRef("computer"); _scaling = ScalingMode::Stretch; - _repliesControlTag = kControlTagReplies; if (isTSL(game->gameId())) { _resolutionX = 800; @@ -49,36 +43,79 @@ ComputerGUI::ComputerGUI(Game *game) : Conversation(game) { void ComputerGUI::load() { Conversation::load(); - + bindControls(); configureMessage(); configureReplies(); } -void ComputerGUI::configureMessage() { - auto &message = getControl(kControlTagMessage); - message.setProtoMatchContent(true); +void ComputerGUI::bindControls() { + _binding.lblCompSkill = getControlPtr