DM: Add F0333_INVENTORY_OpenAndDrawChest

This commit is contained in:
Bendegúz Nagy 2016-06-28 01:13:52 +02:00
parent 49aae8932b
commit ebdcac5073
4 changed files with 44 additions and 5 deletions

View File

@ -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

View File

@ -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];

View File

@ -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;
}
}
}

View File

@ -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
};