TSAGE: Added code to make newly added inventory items immediately visible

This commit is contained in:
Paul Gilbert 2013-08-24 21:04:51 -04:00
parent 19e970e9e0
commit 54eb4c26ed
3 changed files with 15 additions and 3 deletions

View File

@ -972,7 +972,8 @@ void Ringworld2InvObjectList::setObjectScene(int objectNum, int sceneNumber) {
R2_GLOBALS._events.setCursor(CURSOR_USE);
// Update the user interface if necessary
T2_GLOBALS._uiElements.updateInventory();
T2_GLOBALS._uiElements.updateInventory(
(sceneNumber == R2_GLOBALS._player._characterIndex) ? objectNum : 0);
}
/**

View File

@ -454,7 +454,7 @@ void UIElements::add(UIElement *obj) {
/**
* Handles updating the visual inventory in the user interface
*/
void UIElements::updateInventory() {
void UIElements::updateInventory(int objectNumber) {
switch (g_vm->getGameID()) {
case GType_BlueForce:
// Update the score
@ -483,6 +483,17 @@ void UIElements::updateInventory() {
else if (_slotStart > (lastPage - 1))
_slotStart = 0;
// Handle changing the page, if necessary, to ensure an optionally supplied
// object number will be on-screen
if (objectNumber != 0) {
for (int idx = 0; idx < _itemList.size(); ++idx) {
if (_itemList[idx] == objectNumber) {
_slotStart = idx / 4;
break;
}
}
}
// Handle refreshing slot graphics
UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 };

View File

@ -137,7 +137,7 @@ public:
virtual void process(Event &event);
void setup(const Common::Point &pt);
void updateInventory();
void updateInventory(int objectNumber = 0);
void addScore(int amount);
void scrollInventory(bool isLeft);