diff options
author | Matthew Hoops | 2011-09-08 13:11:38 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-09-08 13:11:38 -0400 |
commit | 715c95ecfc30f53bdf2f35ab883654ea80ee154b (patch) | |
tree | 71529c87489ab7a3f3ed8fd8c17907e38e02b6d6 /engines | |
parent | ecd81a9a6d84e74fa89b0905620bcc342ef68da5 (diff) | |
download | scummvm-rg350-715c95ecfc30f53bdf2f35ab883654ea80ee154b.tar.gz scummvm-rg350-715c95ecfc30f53bdf2f35ab883654ea80ee154b.tar.bz2 scummvm-rg350-715c95ecfc30f53bdf2f35ab883654ea80ee154b.zip |
PEGASUS: Fix stupid bugs in the item code
Diffstat (limited to 'engines')
-rwxr-xr-x | engines/pegasus/items/biochips/biochipitem.cpp | 2 | ||||
-rwxr-xr-x | engines/pegasus/items/inventory/inventoryitem.cpp | 2 | ||||
-rwxr-xr-x | engines/pegasus/items/item.cpp | 19 |
3 files changed, 13 insertions, 10 deletions
diff --git a/engines/pegasus/items/biochips/biochipitem.cpp b/engines/pegasus/items/biochips/biochipitem.cpp index a291a53d91..71065f1efe 100755 --- a/engines/pegasus/items/biochips/biochipitem.cpp +++ b/engines/pegasus/items/biochips/biochipitem.cpp @@ -34,7 +34,7 @@ namespace Pegasus { BiochipItem::BiochipItem(const tItemID id, const tNeighborhoodID neighborhood, const tRoomID room, const tDirectionConstant direction) : Item(id, neighborhood, room, direction) { - PegasusEngine *vm = (PegasusEngine *)vm; + PegasusEngine *vm = (PegasusEngine *)g_engine; Common::SeekableReadStream *biochipInfo = vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id); if (biochipInfo) { diff --git a/engines/pegasus/items/inventory/inventoryitem.cpp b/engines/pegasus/items/inventory/inventoryitem.cpp index 868291109d..ffa745acef 100755 --- a/engines/pegasus/items/inventory/inventoryitem.cpp +++ b/engines/pegasus/items/inventory/inventoryitem.cpp @@ -33,7 +33,7 @@ namespace Pegasus { InventoryItem::InventoryItem(const tItemID id, const tNeighborhoodID neighborhood, const tRoomID room, const tDirectionConstant direction) : Item(id, neighborhood, room, direction) { - PegasusEngine *vm = (PegasusEngine *)vm; + PegasusEngine *vm = (PegasusEngine *)g_engine; Common::SeekableReadStream *leftInfo = vm->_resFork->getResource(MKTAG('L', 'e', 'f', 't'), kItemBaseResID + id); if (leftInfo) { diff --git a/engines/pegasus/items/item.cpp b/engines/pegasus/items/item.cpp index cdd81293cc..126bbfec63 100755 --- a/engines/pegasus/items/item.cpp +++ b/engines/pegasus/items/item.cpp @@ -48,8 +48,8 @@ Item::Item(const tItemID id, const tNeighborhoodID neighborhood, const tRoomID r _itemInfo.infoLeftTime = info->readUint32BE(); _itemInfo.infoRightStart = info->readUint32BE(); _itemInfo.infoRightStop = info->readUint32BE(); - _itemInfo.dragSpriteNormalID = info->readUint32BE(); - _itemInfo.dragSpriteUsedID = info->readUint32BE(); + _itemInfo.dragSpriteNormalID = info->readUint16BE(); + _itemInfo.dragSpriteUsedID = info->readUint16BE(); if (vm->isDemo()) { // Adjust info right times to account for the stuff that was chopped out of the @@ -95,18 +95,20 @@ Item::Item(const tItemID id, const tNeighborhoodID neighborhood, const tRoomID r } Common::SeekableReadStream *middleAreaInfo = vm->_resFork->getResource(kMiddleAreaInfoResType, kItemBaseResID + id); - if (!middleAreaInfo) - error("Middle area info not found for item %d", id); - - _sharedAreaInfo = readItemState(middleAreaInfo); - - delete middleAreaInfo; + if (middleAreaInfo) { + _sharedAreaInfo = readItemState(middleAreaInfo); + delete middleAreaInfo; + } else { + // Only kArgonPickup does not have this + memset(&_sharedAreaInfo, 0, sizeof(_sharedAreaInfo)); + } Common::SeekableReadStream *extraInfo = vm->_resFork->getResource(kItemExtraInfoResType, kItemBaseResID + id); if (!extraInfo) error("Extra info not found for item %d", id); _itemExtras.numEntries = extraInfo->readUint16BE(); + _itemExtras.entries = new ItemExtraEntry[_itemExtras.numEntries]; for (uint16 i = 0; i < _itemExtras.numEntries; i++) { _itemExtras.entries[i].extraID = extraInfo->readUint32BE(); _itemExtras.entries[i].extraArea = extraInfo->readUint16BE(); @@ -255,6 +257,7 @@ ItemStateInfo Item::readItemState(Common::SeekableReadStream *stream) { ItemStateInfo info; info.numEntries = stream->readUint16BE(); + info.entries = new ItemStateEntry[info.numEntries]; for (uint16 i = 0; i < info.numEntries; i++) { info.entries[i].itemState = stream->readSint16BE(); info.entries[i].itemTime = stream->readUint32BE(); |