[Scummvm-cvs-logs] scummvm master -> 54eb4c26ed9f38e7c7791348a42719bfc34a7eff
dreammaster
dreammaster at scummvm.org
Sun Aug 25 03:07:48 CEST 2013
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
54eb4c26ed TSAGE: Added code to make newly added inventory items immediately visible
Commit: 54eb4c26ed9f38e7c7791348a42719bfc34a7eff
https://github.com/scummvm/scummvm/commit/54eb4c26ed9f38e7c7791348a42719bfc34a7eff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-08-24T18:04:51-07:00
Commit Message:
TSAGE: Added code to make newly added inventory items immediately visible
Changed paths:
engines/tsage/ringworld2/ringworld2_logic.cpp
engines/tsage/user_interface.cpp
engines/tsage/user_interface.h
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 0f8d587..d25c0d7 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -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);
}
/**
diff --git a/engines/tsage/user_interface.cpp b/engines/tsage/user_interface.cpp
index c0ebb80..43072c8 100644
--- a/engines/tsage/user_interface.cpp
+++ b/engines/tsage/user_interface.cpp
@@ -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 };
diff --git a/engines/tsage/user_interface.h b/engines/tsage/user_interface.h
index 0fbfc5a..d06dccd 100644
--- a/engines/tsage/user_interface.h
+++ b/engines/tsage/user_interface.h
@@ -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);
More information about the Scummvm-git-logs
mailing list