aboutsummaryrefslogtreecommitdiff
path: root/engines/dm/inventory.cpp
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-28 01:13:52 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitebdcac50734b4a1e297e40af6d096c52b183e4d9 (patch)
tree10c53bca4225f16c840443c67d980d2d3b8ad021 /engines/dm/inventory.cpp
parent49aae8932bcb4698c37516f00ae2f6728044b0bd (diff)
downloadscummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.tar.gz
scummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.tar.bz2
scummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.zip
DM: Add F0333_INVENTORY_OpenAndDrawChest
Diffstat (limited to 'engines/dm/inventory.cpp')
-rw-r--r--engines/dm/inventory.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index eb3192aae1..a64c489f45 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -31,6 +31,7 @@
#include "menus.h"
#include "gfx.h"
#include "text.h"
+#include "objectman.h"
namespace DM {
@@ -254,7 +255,7 @@ void InventoryMan::drawPanelScroll(Scroll* scroll) {
_vm->_dungeonMan->decodeText(stringFirstLine, Thing(scroll->getTextStringThingIndex()), (TextType)(kTextTypeScroll | kDecodeEvenIfInvisible));
char *charRed = stringFirstLine;
while (*charRed && (*charRed != '\n')) {
- charRed++;
+ charRed++;
}
*charRed = '\0';
dispMan.blitToScreen(dispMan.getBitmap(kPanelOpenScrollIndice), 144, 0, 0, gBoxPanel, kColorRed, gDungeonViewport);
@@ -265,7 +266,7 @@ void InventoryMan::drawPanelScroll(Scroll* scroll) {
warning("BUG0_47");
/* BUG0_47 Graphical glitch when you open a scroll. If there is a single line of text in a scroll
(with no carriage return) then charGreen points to undefined data. This may result in a graphical
- glitch and also corrupt other memory. This is not an issue in the original dungeons where all
+ glitch and also corrupt other memory. This is not an issue in the original dungeons where all
scrolls contain at least one carriage return character */
if (*charGreen == '\n') {
lineCount++;
@@ -294,4 +295,39 @@ void InventoryMan::drawPanelScroll(Scroll* scroll) {
}
}
+void InventoryMan::openAndDrawChest(Thing thingToOpen, Container* chest, bool isPressingEye) {
+ DisplayMan &dispMan = *_vm->_displayMan;
+ ObjectMan &objMan = *_vm->_objectMan;
+
+ if (_openChest == thingToOpen)
+ return;
+
+ warning("CHANGE8_09_FIX");
+ if (_openChest != Thing::_thingNone)
+ closeChest(); // CHANGE8_09_FIX
+
+ _openChest = thingToOpen;
+ if (!isPressingEye) {
+ objMan.drawIconInSlotBox(kSlotBoxInventoryActionHand, kIconIndiceContainerChestOpen);
+ }
+ dispMan.blitToScreen(dispMan.getBitmap(kPanelOpenChestIndice), 144, 0, 0, gBoxPanel, kColorRed);
+
+ int16 chestSlotIndex = 0;
+ Thing thing = chest->getSlot();
+ int16 thingCount = 0;
+ while (thing != Thing::_thingEndOfList) {
+ warning("CHANGE8_08_FIX");
+ if (++thingCount > 8)
+ break; // CHANGE8_08_FIX, make sure that no more than the first 8 objects in a chest are drawn
+
+ objMan.drawIconInSlotBox(chestSlotIndex + kSlotBoxChestFirstSlot, objMan.getIconIndex(thing));
+ _chestSlots[chestSlotIndex++] = thing;
+ thing = _vm->_dungeonMan->getNextThing(thing);
+ }
+ while (chestSlotIndex < 8) {
+ objMan.drawIconInSlotBox(chestSlotIndex + kSlotBoxChestFirstSlot, kIconIndiceNone);
+ _chestSlots[chestSlotIndex++] = Thing::_thingNone;
+ }
+}
+
}