diff options
author | Bendegúz Nagy | 2016-06-28 01:13:52 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | ebdcac50734b4a1e297e40af6d096c52b183e4d9 (patch) | |
tree | 10c53bca4225f16c840443c67d980d2d3b8ad021 /engines/dm | |
parent | 49aae8932bcb4698c37516f00ae2f6728044b0bd (diff) | |
download | scummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.tar.gz scummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.tar.bz2 scummvm-rg350-ebdcac50734b4a1e297e40af6d096c52b183e4d9.zip |
DM: Add F0333_INVENTORY_OpenAndDrawChest
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/TODOs/methodtree.txt | 4 | ||||
-rw-r--r-- | engines/dm/gfx.h | 3 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 40 | ||||
-rw-r--r-- | engines/dm/inventory.h | 2 |
4 files changed, 44 insertions, 5 deletions
diff --git a/engines/dm/TODOs/methodtree.txt b/engines/dm/TODOs/methodtree.txt index a672a8a9f3..a352403ccb 100644 --- a/engines/dm/TODOs/methodtree.txt +++ b/engines/dm/TODOs/methodtree.txt @@ -48,9 +48,9 @@ F0280_CHAMPION_AddCandidateChampionToParty // done, so-so F0351_INVENTORY_DrawChampionSkillsAndStatistics // skip ----------------- F0347_INVENTORY_DrawPanel // done F0342_INVENTORY_DrawPanel_Object - F0341_INVENTORY_DrawPanel_Scroll + F0341_INVENTORY_DrawPanel_Scroll // done F0340_INVENTORY_DrawPanel_ScrollTextLine // done - F0333_INVENTORY_OpenAndDrawChest + F0333_INVENTORY_OpenAndDrawChest // done F0303_CHAMPION_GetSkillLevel F0332_INVENTORY_DrawIconToViewport F0336_INVENTORY_DrawPanel_BuildObjectAttributesString diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 3ff4bf5c33..25ffbb220e 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -75,7 +75,8 @@ enum GraphicIndice { kMenuActionAreaIndice = 10, // @ C010_GRAPHIC_MENU_ACTION_AREA kMenuSpellAreLinesIndice = 11, // @ C011_GRAPHIC_MENU_SPELL_AREA_LINES kMenuSpellAreaBackground = 9, // @ C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND - kPanelOpenScrollIndice = 23 // @ C023_GRAPHIC_PANEL_OPEN_SCROLL + kPanelOpenScrollIndice = 23, // @ C023_GRAPHIC_PANEL_OPEN_SCROLL + kPanelOpenChestIndice = 25 // @ C025_GRAPHIC_PANEL_OPEN_CHEST }; extern uint16 gPalSwoosh[16]; 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; + } +} + } diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h index 3f6783b37c..3232ab5d1d 100644 --- a/engines/dm/inventory.h +++ b/engines/dm/inventory.h @@ -35,6 +35,7 @@ namespace DM { #define kChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING +#define kSlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT extern Box gBoxPanel; // @ G0032_s_Graphic562_Box_Panel @@ -68,6 +69,7 @@ public: void closeChest(); // @ F0334_INVENTORY_CloseChest void drawPanelScrollTextLine(int16 yPos, char *text); // @ F0340_INVENTORY_DrawPanel_ScrollTextLine void drawPanelScroll(Scroll *scoll); // @ F0341_INVENTORY_DrawPanel_Scroll + void openAndDrawChest(Thing thingToOpen, Container *chest, bool isPressingEye); // @ F0333_INVENTORY_OpenAndDrawChest }; |