[Scummvm-git-logs] scummvm master -> e070485169da6331db0ebe63b19db9234c352ddc
sev-
sev at scummvm.org
Sun Aug 28 11:43:43 CEST 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0f0fee3add FULLPIPE: Implement Inventory2::removeItem()
e070485169 FULLPIPE: Fix inventory items rebuilding
Commit: 0f0fee3add3dcff4740bb3c68765c109331573bc
https://github.com/scummvm/scummvm/commit/0f0fee3add3dcff4740bb3c68765c109331573bc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-28T11:43:25+02:00
Commit Message:
FULLPIPE: Implement Inventory2::removeItem()
Changed paths:
engines/fullpipe/fullpipe.cpp
engines/fullpipe/fullpipe.h
engines/fullpipe/inventory.cpp
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 22f2050..b41d0ed 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -55,6 +55,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
DebugMan.addDebugChannel(kDebugBehavior, "behavior", "Behavior");
DebugMan.addDebugChannel(kDebugMemory, "memory", "Memory management");
DebugMan.addDebugChannel(kDebugEvents, "events", "Event handling");
+ DebugMan.addDebugChannel(kDebugInventory, "inventory", "Inventory");
// Setup mixer
if (!_mixer->isReady()) {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 2012d7a..e4e2e47 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -55,7 +55,8 @@ enum {
kDebugAnimation = 1 << 3,
kDebugMemory = 1 << 4,
kDebugEvents = 1 << 5,
- kDebugBehavior = 1 << 6
+ kDebugBehavior = 1 << 6,
+ kDebugInventory = 1 << 7
};
class BehaviorManager;
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index aa229d5..70ad19c 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -35,7 +35,7 @@ Inventory::~Inventory() {
}
bool Inventory::load(MfcArchive &file) {
- debugC(5, kDebugLoading, "Inventory::load()");
+ debugC(5, kDebugLoading | kDebugInventory, "Inventory::load()");
_sceneId = file.readUint16LE();
int numInvs = file.readUint32LE();
@@ -119,12 +119,36 @@ void Inventory2::addItem2(StaticANIObject *obj) {
}
void Inventory2::removeItem(int itemId, int count) {
- warning("STUB: Inventory2::removeItem(%d, %d)", itemId, count);
+ debugC(2, kDebugInventory, "Inventory2::removeItem(%d, %d)", itemId, count);
+
+ while (count) {
+ int i;
+ for (i = _inventoryItems.size() - 1; i >= 0; i--) {
+ if (_inventoryItems[i]->itemId == itemId) {
+ if (_selectedId == itemId)
+ unselectItem(false);
+
+ if (_inventoryItems[i]->count > count) {
+ _inventoryItems[i]->count -= count;
+ } else {
+ count -= _inventoryItems[i]->count;
+ _inventoryItems.remove_at(i);
+ }
+
+ if (getCountItemsWithId(itemId) < 0)
+ getInventoryPoolItemFieldCById(itemId);
+
+ break;
+ }
+ }
+ }
}
void Inventory2::removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority) {
int idx = getInventoryItemIndexById(itemId);
+ debugC(2, kDebugInventory, "removeItem2(*, %d, %d, %d, %d)", itemId, x, y, priority);
+
if (idx >= 0) {
if (_inventoryItems[idx]->count) {
removeItem(itemId, 1);
Commit: e070485169da6331db0ebe63b19db9234c352ddc
https://github.com/scummvm/scummvm/commit/e070485169da6331db0ebe63b19db9234c352ddc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-28T11:43:25+02:00
Commit Message:
FULLPIPE: Fix inventory items rebuilding
Changed paths:
engines/fullpipe/inventory.cpp
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 70ad19c..f1dafeb 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -211,11 +211,15 @@ int Inventory2::getItemFlags(int itemId) {
}
void Inventory2::rebuildItemRects() {
+ debugC(2, kDebugInventory, "rebuildItemRects()");
+
_scene = g_fp->accessScene(_sceneId);
if (!_scene)
return;
+ _inventoryIcons.clear();
+
_picture = _scene->getBigPicture(0, 0);
_picture->setAlpha(50);
More information about the Scummvm-git-logs
mailing list