NANCY: Fix items and inventory box in The Vampire Diaries

Items now show up in TVD's inventory box, and displaying their
cursor in the viewport no longer crashes the game.
This commit is contained in:
Kaloyan Chehlarski 2021-04-26 18:26:39 +03:00
parent 954954a85a
commit 2a8512925a
4 changed files with 10 additions and 8 deletions

View File

@ -83,17 +83,19 @@ void CursorManager::setCursor(CursorType type, int16 itemID) {
case kHotspotArrow:
_curCursorID = 6;
break;
default:
default: {
uint itemsOffset = 0;
if (itemID == -1) {
// No item held, set to eyeglass
itemID = 0;
} else {
// Item held
itemID += 3;
itemsOffset = g_nancy->getConstants().numNonItemCursors;
hasItem = true;
}
_curCursorID = itemID * 4 + type;
_curCursorID = itemID * 4 + itemsOffset + type;
}
}
Graphics::ManagedSurface *surf;

View File

@ -65,7 +65,6 @@ private:
Common::Point _primaryVideoInitialPos;
Graphics::ManagedSurface _invCursorsSurface;
Graphics::ManagedSurface _object0Copy;
CursorType _curCursorType;
int16 _curItemID;

View File

@ -81,12 +81,13 @@ void InventoryBox::init() {
stream.skip(8);
readRect(stream, _emptySpace);
char itemName[0x14];
char itemName[20];
uint itemNameLength = g_nancy->getGameType() == kGameTypeVampire ? 15 : 20;
_itemDescriptions.reserve(g_nancy->getConstants().numItems);
for (uint i = 0; i < g_nancy->getConstants().numItems; ++i) {
stream.read(itemName, 0x14);
itemName[0x13] = '\0';
stream.read(itemName, itemNameLength);
itemName[itemNameLength - 1] = '\0';
_itemDescriptions.push_back(ItemDescription());
ItemDescription &desc = _itemDescriptions.back();
desc.name = Common::String(itemName);

View File

@ -102,7 +102,7 @@ private:
Common::Rect hotspot; // in screen coordinates
};
Graphics::Surface _iconsSurface;
Graphics::ManagedSurface _iconsSurface;
Graphics::ManagedSurface _fullInventorySurface;
Scrollbar *_scrollbar;