From a0f6e13ac79ecb2f37b4ce90a52b3e518bc28a51 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Mon, 7 Jun 2021 21:27:29 -0600 Subject: [PATCH] Use binding struct in Character menu --- src/engine/game/gui/ingame/character.cpp | 181 ++++++++++++++++------- src/engine/game/gui/ingame/character.h | 86 ++++++++++- src/engine/game/gui/ingame/ingame.cpp | 2 +- 3 files changed, 212 insertions(+), 57 deletions(-) diff --git a/src/engine/game/gui/ingame/character.cpp b/src/engine/game/gui/ingame/character.cpp index 2234cba2..250dcf36 100644 --- a/src/engine/game/gui/ingame/character.cpp +++ b/src/engine/game/gui/ingame/character.cpp @@ -19,11 +19,12 @@ #include -#include "../../../gui/scenebuilder.h" #include "../../../graphics/model/models.h" +#include "../../../gui/scenebuilder.h" #include "../../d20/classes.h" #include "../../game.h" +#include "../../gameidutil.h" #include "../colorutil.h" @@ -39,7 +40,7 @@ namespace reone { namespace game { -CharacterMenu::CharacterMenu(Game *game) : GameGUI(game) { +CharacterMenu::CharacterMenu(Game *game, InGameMenu &inGameMenu) : GameGUI(game), _inGameMenu(inGameMenu) { _resRef = getResRef("character"); initForGame(); @@ -48,30 +49,103 @@ CharacterMenu::CharacterMenu(Game *game) : GameGUI(game) { void CharacterMenu::load() { GUI::load(); + bindControls(); - hideControl("BTN_CHARLEFT"); - hideControl("BTN_CHARRIGHT"); - hideControl("LBL_GOOD0"); - hideControl("LBL_GOOD1"); - hideControl("LBL_GOOD2"); - hideControl("LBL_GOOD3"); - hideControl("LBL_GOOD4"); - hideControl("LBL_GOOD5"); - hideControl("LBL_GOOD6"); - hideControl("LBL_GOOD7"); - hideControl("LBL_GOOD8"); - hideControl("LBL_GOOD9"); - hideControl("LBL_GOOD10"); - hideControl("LBL_MORE"); + _binding.btnAuto->setDisabled(true); + if (!isTSL(_game->gameId())) { + _binding.btnCharLeft->setVisible(false); + _binding.btnCharRight->setVisible(false); - disableControl("BTN_AUTO"); - disableControl("BTN_SCRIPTS"); + for (auto &control : _binding.lblGood) { + control->setVisible(false); + } + + _binding.lblMore->setVisible(false); + _binding.btnScripts->setDisabled(true); + } +} + +void CharacterMenu::bindControls() { + _binding.lbl3dChar = getControlPtr