Compare commits
6 commits
master
...
character-
Author | SHA1 | Date | |
---|---|---|---|
701b1f4f2a | |||
5fcafb49bc | |||
3455288faa | |||
f6e98e2964 | |||
b95f4197a3 | |||
04e41db927 |
12 changed files with 330 additions and 95 deletions
|
@ -350,6 +350,7 @@ set(GUI_HEADERS
|
|||
src/engine/gui/control/panel.h
|
||||
src/engine/gui/control/progressbar.h
|
||||
src/engine/gui/control/scrollbar.h
|
||||
src/engine/gui/control/slider.h
|
||||
src/engine/gui/control/togglebutton.h
|
||||
src/engine/gui/gui.h
|
||||
src/engine/gui/scenebuilder.h
|
||||
|
@ -364,6 +365,7 @@ set(GUI_SOURCES
|
|||
src/engine/gui/control/listbox.cpp
|
||||
src/engine/gui/control/panel.cpp
|
||||
src/engine/gui/control/progressbar.cpp
|
||||
src/engine/gui/control/slider.cpp
|
||||
src/engine/gui/control/scrollbar.cpp
|
||||
src/engine/gui/control/togglebutton.cpp
|
||||
src/engine/gui/gui.cpp
|
||||
|
|
|
@ -37,6 +37,10 @@ GameID determineGameID(const fs::path &gameDir) {
|
|||
return GameID::TSL;
|
||||
}
|
||||
|
||||
bool isKotOR(GameID gameId) {
|
||||
return gameId == GameID::KotOR;
|
||||
}
|
||||
|
||||
bool isTSL(GameID gameId) {
|
||||
switch (gameId) {
|
||||
case GameID::TSL:
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace game {
|
|||
*/
|
||||
GameID determineGameID(const boost::filesystem::path &gameDir);
|
||||
|
||||
bool isKotOR(GameID gameId);
|
||||
|
||||
bool isTSL(GameID gameId);
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#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 (isKotOR(_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<Label>("LBL_3DCHAR");
|
||||
_binding.btn3dChar = getControlPtr<Button>("BTN_3DCHAR");
|
||||
_binding.sldAlign = getControlPtr<Slider>("SLD_ALIGN");
|
||||
_binding.lblStr = getControlPtr<Label>("LBL_STR");
|
||||
_binding.lblFortitudeStat = getControlPtr<Label>("LBL_FORTITUDE_STAT");
|
||||
_binding.lblReflexStat = getControlPtr<Label>("LBL_REFLEX_STAT");
|
||||
_binding.lblWillStat = getControlPtr<Label>("LBL_WILL_STAT");
|
||||
_binding.lblDefenseStat = getControlPtr<Label>("LBL_DEFENSE_STAT");
|
||||
_binding.lblForceStat = getControlPtr<Label>("LBL_FORCE_STAT");
|
||||
_binding.lblVitalityStat = getControlPtr<Label>("LBL_VITALITY_STAT");
|
||||
_binding.lblDex = getControlPtr<Label>("LBL_DEX");
|
||||
_binding.lblCon = getControlPtr<Label>("LBL_CON");
|
||||
_binding.lblInt = getControlPtr<Label>("LBL_INT");
|
||||
_binding.lblCha = getControlPtr<Label>("LBL_CHA");
|
||||
_binding.lblWis = getControlPtr<Label>("LBL_WIS");
|
||||
_binding.lblStrMod = getControlPtr<Label>("LBL_STR_MOD");
|
||||
_binding.lblDexMod = getControlPtr<Label>("LBL_DEX_MOD");
|
||||
_binding.lblConMod = getControlPtr<Label>("LBL_CON_MOD");
|
||||
_binding.lblIntMod = getControlPtr<Label>("LBL_INT_MOD");
|
||||
_binding.lblWisMod = getControlPtr<Label>("LBL_WIS_MOD");
|
||||
_binding.lblChaMod = getControlPtr<Label>("LBL_CHA_MOD");
|
||||
_binding.lblExperienceStat = getControlPtr<Label>("LBL_EXPERIENCE_STAT");
|
||||
_binding.lblNeededXp = getControlPtr<Label>("LBL_NEEDED_XP");
|
||||
_binding.lblStrength = getControlPtr<Label>("LBL_STRENGTH");
|
||||
_binding.lblDexterity = getControlPtr<Label>("LBL_DEXTERITY");
|
||||
_binding.lblConstitution = getControlPtr<Label>("LBL_CONSTITUTION");
|
||||
_binding.lblIntelligence = getControlPtr<Label>("LBL_INTELLIGENCE");
|
||||
_binding.lblCharisma = getControlPtr<Label>("LBL_CHARISMA");
|
||||
_binding.lblReflex = getControlPtr<Label>("LBL_REFLEX");
|
||||
_binding.lblWill = getControlPtr<Label>("LBL_WILL");
|
||||
_binding.lblExperience = getControlPtr<Label>("LBL_EXPERIENCE");
|
||||
_binding.lblNextLevel = getControlPtr<Label>("LBL_NEXT_LEVEL");
|
||||
_binding.lblForce = getControlPtr<Label>("LBL_FORCE");
|
||||
_binding.lblVitality = getControlPtr<Label>("LBL_VITALITY");
|
||||
_binding.lblDefense = getControlPtr<Label>("LBL_DEFENSE");
|
||||
_binding.lblFortitude = getControlPtr<Label>("LBL_DEFENSE");
|
||||
_binding.lblBevel = getControlPtr<Label>("LBL_BEVEL");
|
||||
_binding.lblWisdom = getControlPtr<Label>("LBL_WISDOM");
|
||||
_binding.lblBevel2 = getControlPtr<Label>("LBL_BEVEL2");
|
||||
_binding.lblLight = getControlPtr<Label>("LBL_LIGHT");
|
||||
_binding.lblDark = getControlPtr<Label>("LBL_DARK");
|
||||
_binding.btnExit = getControlPtr<Button>("BTN_EXIT");
|
||||
_binding.btnAuto = getControlPtr<Button>("BTN_AUTO");
|
||||
_binding.btnLevelup = getControlPtr<Button>("BTN_LEVELUP");
|
||||
if (isKotOR(_game->gameId())) {
|
||||
_binding.lblAdorn = getControlPtr<Label>("LBL_ADORN");
|
||||
_binding.btnScripts = getControlPtr<Button>("BTN_SCRIPTS");
|
||||
_binding.lblClass = getControlPtr<Label>("LBL_CLASS");
|
||||
_binding.lblClass1 = getControlPtr<Label>("LBL_CLASS1");
|
||||
_binding.lblClass2 = getControlPtr<Label>("LBL_CLASS2");
|
||||
for (int i = 0; i < kNumControlsGood; ++i) {
|
||||
_binding.lblGood[i] = getControlPtr<Label>("LBL_GOOD" + to_string(i + 1));
|
||||
}
|
||||
_binding.lblLevel = getControlPtr<Label>("LBL_LEVEL");
|
||||
_binding.lblLevel1 = getControlPtr<Label>("LBL_LEVEL1");
|
||||
_binding.lblLevel2 = getControlPtr<Label>("LBL_LEVEL2");
|
||||
_binding.lblMore = getControlPtr<Label>("LBL_MORE");
|
||||
_binding.lblName = getControlPtr<Label>("LBL_NAME");
|
||||
_binding.btnChange1 = getControlPtr<Button>("BTN_CHANGE1");
|
||||
_binding.btnChange2 = getControlPtr<Button>("BTN_CHANGE2");
|
||||
_binding.btnCharLeft = getControlPtr<Button>("BTN_CHARLEFT");
|
||||
_binding.btnCharRight = getControlPtr<Button>("BTN_CHARRIGHT");
|
||||
} else {
|
||||
_binding.lblForceMastery = getControlPtr<Label>("LBL_FORCEMASTERY");
|
||||
_binding.lblMoreBack = getControlPtr<Label>("LBL_FORCEMASTERY");
|
||||
_binding.lblStatsBorder = getControlPtr<Label>("LBL_STATSBORDER");
|
||||
_binding.lblTitle = getControlPtr<Label>("LBL_TITLE");
|
||||
_binding.lblXpBack = getControlPtr<Label>("LBL_XP_BACK");
|
||||
for (int i = 0; i < kNumControlsBar; ++i) {
|
||||
_binding.lblBar[i] = getControlPtr<Label>("LBL_BAR" + to_string(i + 1));
|
||||
}
|
||||
_binding.btnChange1 = _inGameMenu.getBtnChange2();
|
||||
_binding.btnChange2 = _inGameMenu.getBtnChange3();
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterMenu::update(float dt) {
|
||||
shared_ptr<Creature> leader(_game->services().party().getLeader());
|
||||
setControlVisible("BTN_LEVELUP", leader->isLevelUpPending());
|
||||
setControlVisible("BTN_AUTO", leader->isLevelUpPending());
|
||||
_binding.btnLevelup->setVisible(leader->isLevelUpPending());
|
||||
_binding.btnAuto->setVisible(leader->isLevelUpPending());
|
||||
GUI::update(dt);
|
||||
}
|
||||
|
||||
|
@ -87,35 +161,37 @@ void CharacterMenu::refreshControls() {
|
|||
shared_ptr<Creature> partyLeader(_game->services().party().getLeader());
|
||||
CreatureAttributes &attributes = partyLeader->attributes();
|
||||
|
||||
setControlText("LBL_CLASS1", describeClass(attributes.getClassByPosition(1)));
|
||||
setControlText("LBL_CLASS2", describeClass(attributes.getClassByPosition(2)));
|
||||
setControlText("LBL_LEVEL1", toStringOrEmptyIfZero(attributes.getLevelByPosition(1)));
|
||||
setControlText("LBL_LEVEL2", toStringOrEmptyIfZero(attributes.getLevelByPosition(2)));
|
||||
if (isKotOR(_game->gameId())) {
|
||||
_binding.lblClass1->setTextMessage(describeClass(attributes.getClassByPosition(1)));
|
||||
_binding.lblClass2->setTextMessage(describeClass(attributes.getClassByPosition(2)));
|
||||
_binding.lblLevel1->setTextMessage(toStringOrEmptyIfZero(attributes.getLevelByPosition(1)));
|
||||
_binding.lblLevel2->setTextMessage(toStringOrEmptyIfZero(attributes.getLevelByPosition(2)));
|
||||
}
|
||||
|
||||
setControlText("LBL_VITALITY_STAT", str(boost::format("%d/%d") % partyLeader->currentHitPoints() % partyLeader->hitPoints()));
|
||||
setControlText("LBL_DEFENSE_STAT", to_string(attributes.getDefense()));
|
||||
setControlText("LBL_FORCE_STAT", "");
|
||||
_binding.lblVitalityStat->setTextMessage(str(boost::format("%d/%d") % partyLeader->currentHitPoints() % partyLeader->hitPoints()));
|
||||
_binding.lblDefenseStat->setTextMessage(to_string(attributes.getDefense()));
|
||||
_binding.lblForceStat->setTextMessage("");
|
||||
|
||||
setControlText("LBL_STR", to_string(attributes.strength()));
|
||||
setControlText("LBL_STR_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Strength)));
|
||||
setControlText("LBL_DEX", to_string(attributes.dexterity()));
|
||||
setControlText("LBL_DEX_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Dexterity)));
|
||||
setControlText("LBL_CON", to_string(attributes.constitution()));
|
||||
setControlText("LBL_CON_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Constitution)));
|
||||
setControlText("LBL_INT", to_string(attributes.intelligence()));
|
||||
setControlText("LBL_INT_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Intelligence)));
|
||||
setControlText("LBL_WIS", to_string(attributes.wisdom()));
|
||||
setControlText("LBL_WIS_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Wisdom)));
|
||||
setControlText("LBL_CHA", to_string(attributes.charisma()));
|
||||
setControlText("LBL_CHA_MOD", describeAbilityModifier(attributes.getAbilityModifier(Ability::Charisma)));
|
||||
_binding.lblStr->setTextMessage(to_string(attributes.strength()));
|
||||
_binding.lblStrMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Strength)));
|
||||
_binding.lblDex->setTextMessage(to_string(attributes.dexterity()));
|
||||
_binding.lblDexMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Dexterity)));
|
||||
_binding.lblCon->setTextMessage(to_string(attributes.constitution()));
|
||||
_binding.lblConMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Constitution)));
|
||||
_binding.lblInt->setTextMessage(to_string(attributes.intelligence()));
|
||||
_binding.lblIntMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Intelligence)));
|
||||
_binding.lblWis->setTextMessage(to_string(attributes.wisdom()));
|
||||
_binding.lblWisMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Wisdom)));
|
||||
_binding.lblCha->setTextMessage(to_string(attributes.charisma()));
|
||||
_binding.lblChaMod->setTextMessage(describeAbilityModifier(attributes.getAbilityModifier(Ability::Charisma)));
|
||||
|
||||
SavingThrows savingThrows(attributes.getAggregateSavingThrows());
|
||||
setControlText("LBL_FORTITUDE_STAT", to_string(savingThrows.fortitude));
|
||||
setControlText("LBL_REFLEX_STAT", to_string(savingThrows.reflex));
|
||||
setControlText("LBL_WILL_STAT", to_string(savingThrows.will));
|
||||
_binding.lblFortitudeStat->setTextMessage(to_string(savingThrows.fortitude));
|
||||
_binding.lblReflexStat->setTextMessage(to_string(savingThrows.reflex));
|
||||
_binding.lblWillStat->setTextMessage(to_string(savingThrows.will));
|
||||
|
||||
setControlText("LBL_EXPERIENCE_STAT", to_string(partyLeader->xp()));
|
||||
setControlText("LBL_NEEDED_XP", to_string(partyLeader->getNeededXP()));
|
||||
_binding.lblExperienceStat->setTextMessage(to_string(partyLeader->xp()));
|
||||
_binding.lblNeededXp->setTextMessage(to_string(partyLeader->getNeededXP()));
|
||||
|
||||
refreshPortraits();
|
||||
refresh3D();
|
||||
|
@ -134,18 +210,15 @@ void CharacterMenu::refreshPortraits() {
|
|||
shared_ptr<Creature> partyMember1(party.getMember(1));
|
||||
shared_ptr<Creature> partyMember2(party.getMember(2));
|
||||
|
||||
Control &btnChange1 = getControl("BTN_CHANGE1");
|
||||
btnChange1.setBorderFill(partyMember1 ? partyMember1->portrait() : nullptr);
|
||||
btnChange1.setHilightFill(partyMember1 ? partyMember1->portrait() : nullptr);
|
||||
_binding.btnChange1->setBorderFill(partyMember1 ? partyMember1->portrait() : nullptr);
|
||||
_binding.btnChange1->setHilightFill(partyMember1 ? partyMember1->portrait() : nullptr);
|
||||
|
||||
Control &btnChange2 = getControl("BTN_CHANGE2");
|
||||
btnChange2.setBorderFill(partyMember2 ? partyMember2->portrait() : nullptr);
|
||||
btnChange2.setHilightFill(partyMember2 ? partyMember2->portrait() : nullptr);
|
||||
_binding.btnChange2->setBorderFill(partyMember2 ? partyMember2->portrait() : nullptr);
|
||||
_binding.btnChange2->setHilightFill(partyMember2 ? partyMember2->portrait() : nullptr);
|
||||
}
|
||||
|
||||
void CharacterMenu::refresh3D() {
|
||||
Control &control3d = getControl("LBL_3DCHAR");
|
||||
float aspect = control3d.extent().width / static_cast<float>(control3d.extent().height);
|
||||
float aspect = _binding.lbl3dChar->extent().width / static_cast<float>(_binding.lbl3dChar->extent().height);
|
||||
|
||||
auto scene = SceneBuilder(_options, _game->services().graphics())
|
||||
.aspect(aspect)
|
||||
|
@ -156,7 +229,7 @@ void CharacterMenu::refresh3D() {
|
|||
.lightingRefFromModelNode("charmain_light")
|
||||
.build();
|
||||
|
||||
control3d.setScene(move(scene));
|
||||
_binding.lbl3dChar->setScene(move(scene));
|
||||
}
|
||||
|
||||
shared_ptr<ModelSceneNode> CharacterMenu::getSceneModel(SceneGraph &sceneGraph) const {
|
||||
|
|
|
@ -18,16 +18,21 @@
|
|||
#pragma once
|
||||
|
||||
#include "../gui.h"
|
||||
|
||||
#include "../../../gui/control/button.h"
|
||||
#include "../../../gui/control/label.h"
|
||||
#include "../../../gui/control/listbox.h"
|
||||
#include "../../../gui/control/slider.h"
|
||||
#include "../../../scene/node/modelnode.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace game {
|
||||
|
||||
class InGameMenu;
|
||||
|
||||
class CharacterMenu : public GameGUI {
|
||||
public:
|
||||
CharacterMenu(Game *game);
|
||||
CharacterMenu(Game *game, InGameMenu &inGameMenu);
|
||||
|
||||
void load() override;
|
||||
void update(float dt) override;
|
||||
|
@ -35,6 +40,86 @@ public:
|
|||
void refreshControls();
|
||||
|
||||
private:
|
||||
static constexpr int kNumControlsGood = 10;
|
||||
static constexpr int kNumControlsBar = 6;
|
||||
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Label> lbl3dChar;
|
||||
std::shared_ptr<gui::Button> btn3dChar;
|
||||
std::shared_ptr<gui::Slider> sldAlign;
|
||||
std::shared_ptr<gui::Label> lblStr;
|
||||
std::shared_ptr<gui::Label> lblFortitudeStat;
|
||||
std::shared_ptr<gui::Label> lblReflexStat;
|
||||
std::shared_ptr<gui::Label> lblWillStat;
|
||||
std::shared_ptr<gui::Label> lblDefenseStat;
|
||||
std::shared_ptr<gui::Label> lblForceStat;
|
||||
std::shared_ptr<gui::Label> lblVitalityStat;
|
||||
std::shared_ptr<gui::Label> lblDex;
|
||||
std::shared_ptr<gui::Label> lblCon;
|
||||
std::shared_ptr<gui::Label> lblInt;
|
||||
std::shared_ptr<gui::Label> lblCha;
|
||||
std::shared_ptr<gui::Label> lblWis;
|
||||
std::shared_ptr<gui::Label> lblStrMod;
|
||||
std::shared_ptr<gui::Label> lblDexMod;
|
||||
std::shared_ptr<gui::Label> lblConMod;
|
||||
std::shared_ptr<gui::Label> lblIntMod;
|
||||
std::shared_ptr<gui::Label> lblWisMod;
|
||||
std::shared_ptr<gui::Label> lblChaMod;
|
||||
std::shared_ptr<gui::Label> lblExperienceStat;
|
||||
std::shared_ptr<gui::Label> lblNeededXp;
|
||||
std::shared_ptr<gui::Label> lblStrength;
|
||||
std::shared_ptr<gui::Label> lblDexterity;
|
||||
std::shared_ptr<gui::Label> lblConstitution;
|
||||
std::shared_ptr<gui::Label> lblIntelligence;
|
||||
std::shared_ptr<gui::Label> lblCharisma;
|
||||
std::shared_ptr<gui::Label> lblReflex;
|
||||
std::shared_ptr<gui::Label> lblWill;
|
||||
std::shared_ptr<gui::Label> lblExperience;
|
||||
std::shared_ptr<gui::Label> lblNextLevel;
|
||||
std::shared_ptr<gui::Label> lblForce;
|
||||
std::shared_ptr<gui::Label> lblVitality;
|
||||
std::shared_ptr<gui::Label> lblDefense;
|
||||
std::shared_ptr<gui::Label> lblFortitude;
|
||||
std::shared_ptr<gui::Label> lblBevel;
|
||||
std::shared_ptr<gui::Label> lblWisdom;
|
||||
std::shared_ptr<gui::Label> lblBevel2;
|
||||
std::shared_ptr<gui::Label> lblLight;
|
||||
std::shared_ptr<gui::Label> lblDark;
|
||||
std::shared_ptr<gui::Button> btnExit;
|
||||
std::shared_ptr<gui::Button> btnAuto;
|
||||
std::shared_ptr<gui::Button> btnLevelup;
|
||||
std::shared_ptr<gui::Button> btnChange1;
|
||||
std::shared_ptr<gui::Button> btnChange2;
|
||||
|
||||
// KOTOR only
|
||||
std::shared_ptr<gui::Label> lblAdorn;
|
||||
std::shared_ptr<gui::Button> btnScripts;
|
||||
std::shared_ptr<gui::Label> lblClass;
|
||||
std::shared_ptr<gui::Label> lblClass1;
|
||||
std::shared_ptr<gui::Label> lblClass2;
|
||||
std::shared_ptr<gui::Label> lblGood[kNumControlsGood];
|
||||
std::shared_ptr<gui::Label> lblLevel;
|
||||
std::shared_ptr<gui::Label> lblLevel1;
|
||||
std::shared_ptr<gui::Label> lblLevel2;
|
||||
std::shared_ptr<gui::Label> lblMore;
|
||||
std::shared_ptr<gui::Label> lblName;
|
||||
std::shared_ptr<gui::Button> btnCharLeft;
|
||||
std::shared_ptr<gui::Button> btnCharRight;
|
||||
// End KOTOR only
|
||||
|
||||
// TSL only
|
||||
std::shared_ptr<gui::Label> lblForceMastery;
|
||||
std::shared_ptr<gui::Label> lblMoreBack;
|
||||
std::shared_ptr<gui::Label> lblStatsBorder;
|
||||
std::shared_ptr<gui::Label> lblTitle;
|
||||
std::shared_ptr<gui::Label> lblXpBack;
|
||||
std::shared_ptr<gui::Label> lblBar[kNumControlsBar];
|
||||
// End TSL only
|
||||
} _binding;
|
||||
|
||||
InGameMenu &_inGameMenu;
|
||||
|
||||
void bindControls();
|
||||
void refreshPortraits();
|
||||
void refresh3D();
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Equipment::Equipment(Game *game, InGameMenu &inGameMenu) : GameGUI(game), _inGam
|
|||
|
||||
void Equipment::bindControls() {
|
||||
_binding.lblCantEquip = getControlPtr<Label>("LBL_CANTEQUIP");
|
||||
if (!isTSL(_game->gameId())) {
|
||||
if (isKotOR(_game->gameId())) {
|
||||
_binding.lblAttackInfo = getControlPtr<Label>("LBL_ATTACK_INFO");
|
||||
_binding.lblPortBord = getControlPtr<Label>("LBL_PORT_BORD");
|
||||
_binding.lblPortrait = getControlPtr<Label>("LBL_PORTRAIT");
|
||||
|
@ -97,7 +97,7 @@ void Equipment::bindControls() {
|
|||
} else {
|
||||
_binding.lblBack1 = getControlPtr<Label>("LBL_BACK1");
|
||||
_binding.lblDefBack = getControlPtr<Label>("LBL_DEF_BACK");
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int i = 0; i < kNumControlsBar; ++i) {
|
||||
_binding.lblBar[i] = getControlPtr<Label>("LBL_BAR" + to_string(i + 1));
|
||||
}
|
||||
_binding.lblAttackMod = getControlPtr<Label>("LBL_ATTACKMOD");
|
||||
|
@ -114,7 +114,7 @@ void Equipment::bindControls() {
|
|||
_binding.lblToHitR = getControlPtr<Label>("LBL_TOHITR");
|
||||
_binding.lbItems = getControlPtr<ListBox>("LB_ITEMS");
|
||||
for (auto &slotName : g_slotNames) {
|
||||
if ((slotName.first == Slot::WeapL2 || slotName.first == Slot::WeapR2) && !isTSL(_game->gameId())) continue;
|
||||
if ((slotName.first == Slot::WeapL2 || slotName.first == Slot::WeapR2) && isKotOR(_game->gameId())) continue;
|
||||
_binding.lblInv[slotName.first] = getControlPtr<Label>("LBL_INV_" + slotName.second);
|
||||
_binding.btnInv[slotName.first] = getControlPtr<Button>("BTN_INV_" + slotName.second);
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ void Equipment::update() {
|
|||
|
||||
auto partyLeader(_game->services().party().getLeader());
|
||||
|
||||
if (!isTSL(_game->gameId())) {
|
||||
if (isKotOR(_game->gameId())) {
|
||||
string vitalityString(str(boost::format("%d/\n%d") % partyLeader->currentHitPoints() % partyLeader->hitPoints()));
|
||||
_binding.lblVitality->setTextMessage(vitalityString);
|
||||
}
|
||||
|
|
|
@ -55,48 +55,50 @@ public:
|
|||
void update();
|
||||
|
||||
private:
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Label> lblCantEquip { nullptr };
|
||||
std::shared_ptr<gui::Label> lblAttackInfo { nullptr };
|
||||
std::shared_ptr<gui::Label> lblToHitR { nullptr };
|
||||
std::shared_ptr<gui::Label> lblPortBord { nullptr };
|
||||
std::shared_ptr<gui::Label> lblPortrait { nullptr };
|
||||
std::shared_ptr<gui::ListBox> lbItems { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDefInfo { nullptr };
|
||||
static constexpr int kNumControlsBar = 5;
|
||||
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Label> lblCantEquip;
|
||||
std::shared_ptr<gui::Label> lblAttackInfo;
|
||||
std::shared_ptr<gui::Label> lblToHitR;
|
||||
std::shared_ptr<gui::Label> lblPortBord;
|
||||
std::shared_ptr<gui::Label> lblPortrait;
|
||||
std::shared_ptr<gui::ListBox> lbItems;
|
||||
std::shared_ptr<gui::Label> lblDefInfo;
|
||||
std::unordered_map<Equipment::Slot, std::shared_ptr<gui::Label>> lblInv;
|
||||
std::unordered_map<Equipment::Slot, std::shared_ptr<gui::Button>> btnInv;
|
||||
std::shared_ptr<gui::Label> lblAtkL { nullptr };
|
||||
std::shared_ptr<gui::Label> lblAtkR { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDef { nullptr };
|
||||
std::shared_ptr<gui::Label> lblTitle { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDamage { nullptr };
|
||||
std::shared_ptr<gui::Label> lblToHitL { nullptr };
|
||||
std::shared_ptr<gui::Label> lblToHit { nullptr };
|
||||
std::shared_ptr<gui::Label> lblSlotName { nullptr };
|
||||
std::shared_ptr<gui::Button> btnBack { nullptr };
|
||||
std::shared_ptr<gui::Button> btnEquip{ nullptr };
|
||||
std::shared_ptr<gui::ListBox> lbDesc { nullptr };
|
||||
std::shared_ptr<gui::Label> lblAtkL;
|
||||
std::shared_ptr<gui::Label> lblAtkR;
|
||||
std::shared_ptr<gui::Label> lblDef;
|
||||
std::shared_ptr<gui::Label> lblTitle;
|
||||
std::shared_ptr<gui::Label> lblDamage;
|
||||
std::shared_ptr<gui::Label> lblToHitL;
|
||||
std::shared_ptr<gui::Label> lblToHit;
|
||||
std::shared_ptr<gui::Label> lblSlotName;
|
||||
std::shared_ptr<gui::Button> btnBack;
|
||||
std::shared_ptr<gui::Button> btnEquip;
|
||||
std::shared_ptr<gui::ListBox> lbDesc;
|
||||
|
||||
// KOTOR only
|
||||
std::shared_ptr<gui::Label> lblVitality { nullptr };
|
||||
std::shared_ptr<gui::Label> lblTxtBar { nullptr };
|
||||
std::shared_ptr<gui::Button> btnCharLeft { nullptr };
|
||||
std::shared_ptr<gui::Button> btnCharRight { nullptr };
|
||||
std::shared_ptr<gui::Label> lblSelectTitle { nullptr };
|
||||
std::shared_ptr<gui::Button> btnChange1 { nullptr };
|
||||
std::shared_ptr<gui::Button> btnChange2 { nullptr };
|
||||
std::shared_ptr<gui::Label> lblVitality;
|
||||
std::shared_ptr<gui::Label> lblTxtBar;
|
||||
std::shared_ptr<gui::Button> btnCharLeft;
|
||||
std::shared_ptr<gui::Button> btnCharRight;
|
||||
std::shared_ptr<gui::Label> lblSelectTitle;
|
||||
std::shared_ptr<gui::Button> btnChange1;
|
||||
std::shared_ptr<gui::Button> btnChange2;
|
||||
// End KOTOR only
|
||||
|
||||
// TSL only
|
||||
std::shared_ptr<gui::Label> lblBack1 { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDefBack { nullptr };
|
||||
std::shared_ptr<gui::Label> lblBar[5];
|
||||
std::shared_ptr<gui::Label> lblAttackMod { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDamText { nullptr };
|
||||
std::shared_ptr<gui::Button> btnSwapWeapons { nullptr };
|
||||
std::shared_ptr<gui::Button> btnPrevNpc { nullptr };
|
||||
std::shared_ptr<gui::Button> btnNextNpc { nullptr };
|
||||
std::shared_ptr<gui::Label> lblDefText { nullptr };
|
||||
std::shared_ptr<gui::Label> lblBack1;
|
||||
std::shared_ptr<gui::Label> lblDefBack;
|
||||
std::shared_ptr<gui::Label> lblBar[kNumControlsBar];
|
||||
std::shared_ptr<gui::Label> lblAttackMod;
|
||||
std::shared_ptr<gui::Label> lblDamText;
|
||||
std::shared_ptr<gui::Button> btnSwapWeapons;
|
||||
std::shared_ptr<gui::Button> btnPrevNpc;
|
||||
std::shared_ptr<gui::Button> btnNextNpc;
|
||||
std::shared_ptr<gui::Label> lblDefText;
|
||||
// End TSL only
|
||||
} _binding;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ void InGameMenu::loadInventory() {
|
|||
}
|
||||
|
||||
void InGameMenu::loadCharacter() {
|
||||
_character = make_unique<CharacterMenu>(_game);
|
||||
_character = make_unique<CharacterMenu>(_game, *this);
|
||||
_character->load();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "panel.h"
|
||||
#include "progressbar.h"
|
||||
#include "scrollbar.h"
|
||||
#include "slider.h"
|
||||
#include "togglebutton.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -81,6 +82,9 @@ unique_ptr<Control> Control::of(GUI *gui, ControlType type, const string &tag) {
|
|||
case ControlType::ToggleButton:
|
||||
control = make_unique<ToggleButton>(gui);
|
||||
break;
|
||||
case ControlType::Slider:
|
||||
control = make_unique<Slider>(gui);
|
||||
break;
|
||||
case ControlType::ScrollBar:
|
||||
control = make_unique<ScrollBar>(gui);
|
||||
break;
|
||||
|
|
29
src/engine/gui/control/slider.cpp
Normal file
29
src/engine/gui/control/slider.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021 The reone project contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "slider.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace gui {
|
||||
|
||||
Slider::Slider(GUI *gui) : Control(gui, ControlType::Slider) {
|
||||
}
|
||||
|
||||
} // namespace gui
|
||||
|
||||
} // namespace reone
|
33
src/engine/gui/control/slider.h
Normal file
33
src/engine/gui/control/slider.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021 The reone project contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "control.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace gui {
|
||||
|
||||
class Slider : public Control {
|
||||
public:
|
||||
Slider(GUI *gui);
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
} // namespace reone
|
|
@ -28,6 +28,7 @@ enum class ControlType {
|
|||
ImageButton = 5,
|
||||
Button = 6,
|
||||
ToggleButton = 7,
|
||||
Slider = 8,
|
||||
ScrollBar = 9,
|
||||
ProgressBar = 10,
|
||||
ListBox = 11
|
||||
|
|
Loading…
Reference in a new issue