Show vitality & defense on inventory screen
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
parent
64e3617544
commit
7957864f42
3 changed files with 15 additions and 3 deletions
|
@ -196,7 +196,7 @@ void InGameMenu::updateTabButtons() {
|
|||
}
|
||||
|
||||
void InGameMenu::openInventory() {
|
||||
_inventory->refreshPortraits();
|
||||
_inventory->update();
|
||||
changeTab(Tab::Inventory);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "inventory.h"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
@ -44,8 +46,6 @@ void InventoryMenu::load() {
|
|||
hideControl("BTN_CHARLEFT");
|
||||
hideControl("BTN_CHARRIGHT");
|
||||
hideControl("LBL_CREDITS_VALUE");
|
||||
hideControl("LBL_VIT");
|
||||
hideControl("LBL_DEF");
|
||||
|
||||
disableControl("BTN_USEITEM");
|
||||
disableControl("BTN_QUESTITEMS");
|
||||
|
@ -54,6 +54,16 @@ void InventoryMenu::load() {
|
|||
setControlFocusable("BTN_CHANGE2", false);
|
||||
}
|
||||
|
||||
void InventoryMenu::update() {
|
||||
refreshPortraits();
|
||||
auto partyLeader(_game->services().party().getLeader());
|
||||
|
||||
string vitalityString(str(boost::format("%d/\n%d") % partyLeader->currentHitPoints() % partyLeader->hitPoints()));
|
||||
setControlText("LBL_VIT", vitalityString);
|
||||
|
||||
setControlText("LBL_DEF", to_string(partyLeader->getDefense()));
|
||||
}
|
||||
|
||||
void InventoryMenu::refreshPortraits() {
|
||||
if (_game->gameId() != GameID::KotOR) return;
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
|
||||
void refreshPortraits();
|
||||
|
||||
void update();
|
||||
|
||||
private:
|
||||
void onClick(const std::string &control) override;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue