aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-10 17:14:22 +0000
committerJohannes Schickel2009-08-10 17:14:22 +0000
commitf9b657c9f4b318952b1f867b511562afc20b198e (patch)
tree4a0fff2f81da845fb1fb85a16604ca15be22d08d /engines
parent8ac9752f8f098afb494e9066cd45a20cfaab070d (diff)
downloadscummvm-rg350-f9b657c9f4b318952b1f867b511562afc20b198e.tar.gz
scummvm-rg350-f9b657c9f4b318952b1f867b511562afc20b198e.tar.bz2
scummvm-rg350-f9b657c9f4b318952b1f867b511562afc20b198e.zip
Implement item to item name list index mapping for Kyrandia 1 Amiga.
svn-id: r43210
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/gui_lok.cpp8
-rw-r--r--engines/kyra/items_lok.cpp60
-rw-r--r--engines/kyra/kyra_lok.cpp2
-rw-r--r--engines/kyra/kyra_lok.h2
4 files changed, 65 insertions, 7 deletions
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 2301b1e290..1dbd226790 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -59,7 +59,7 @@ int KyraEngine_LoK::buttonInventoryCallback(Button *caller) {
_screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, _flags.platform == Common::kPlatformAmiga ? 19 : 12);
snd_playSoundEffect(0x35);
setMouseItem(inventoryItem);
- updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
_itemInHand = inventoryItem;
_screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = 0xFF;
@@ -73,9 +73,9 @@ int KyraEngine_LoK::buttonInventoryCallback(Button *caller) {
setMouseItem(inventoryItem);
// TODO: Proper support for both taken strings in Amiga version
if (_flags.platform == Common::kPlatformAmiga)
- updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[0], 179);
else
- updateSentenceCommand(_itemList[inventoryItem], _takenList[1], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(inventoryItem)], _takenList[1], 179);
_screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
_itemInHand = inventoryItem;
@@ -84,7 +84,7 @@ int KyraEngine_LoK::buttonInventoryCallback(Button *caller) {
_screen->hideMouse();
_screen->drawShape(0, _shapes[216+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0);
_screen->setMouseCursor(1, 1, _shapes[0]);
- updateSentenceCommand(_itemList[_itemInHand], _placedList[0], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _placedList[0], 179);
_screen->showMouse();
_currentCharacter->inventoryItems[itemOffset] = _itemInHand;
_itemInHand = -1;
diff --git a/engines/kyra/items_lok.cpp b/engines/kyra/items_lok.cpp
index 83817becf8..0dd854c582 100644
--- a/engines/kyra/items_lok.cpp
+++ b/engines/kyra/items_lok.cpp
@@ -414,7 +414,7 @@ int KyraEngine_LoK::processItemDrop(uint16 sceneId, uint8 item, int x, int y, in
if (unk1 == 0 && unk2 != 0) {
assert(_itemList && _droppedList);
- updateSentenceCommand(_itemList[item], _droppedList[0], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(item)], _droppedList[0], 179);
}
return 1;
@@ -434,7 +434,7 @@ void KyraEngine_LoK::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
setMouseItem(_itemInHand);
assert(_itemList && _takenList);
- updateSentenceCommand(_itemList[_itemInHand], _takenList[1], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(_itemInHand)], _takenList[1], 179);
_screen->showMouse();
clickEventHandler2();
}
@@ -910,5 +910,61 @@ void KyraEngine_LoK::restoreItemRect1(int xpos, int ypos) {
_screen->copyBlockToPage(_screen->_curPage, xpos, ypos, 4<<3, 32, _itemBkgBackUp[1]);
}
+int KyraEngine_LoK::getItemListIndex(uint16 item) {
+ if (_flags.platform != Common::kPlatformAmiga)
+ return item;
+
+ // "Unkown item" is at 81.
+ if (item == 0xFFFF || item == 0xFF)
+ return 81;
+ // The first item names are mapped directly
+ else if (item <= 28)
+ return item;
+ // There's only one string for all "Fireberries"
+ else if (item >= 29 && item <= 33)
+ return 29;
+ // Correct offsets
+ else if (item >= 34 && item <= 59)
+ return item - 4;
+ // There's only one string for all "Red Potion"
+ else if (item >= 60 && item <= 61)
+ return 56;
+ // There's only one string for all "Blue Potion"
+ else if (item >= 62 && item <= 63)
+ return 57;
+ // There's only one string for all "Yellow Potion"
+ else if (item >= 64 && item <= 65)
+ return 58;
+ // Correct offsets
+ else if (item >= 66 && item <= 69)
+ return item - 7;
+ // There's only one string for "Fresh Water"
+ else if (item >= 70 && item <= 71)
+ return 63;
+ // There's only one string for "Salt Water"
+ else if (item >= 72 && item <= 73)
+ return 64;
+ // There's only one string for "Mineral Water"
+ else if (item >= 74 && item <= 75)
+ return 65;
+ // There's only one string for "Magical Water"
+ else if (item >= 76 && item <= 77)
+ return 66;
+ // There's only one string for "Empty Flask"
+ else if (item >= 78 && item <= 79)
+ return 67;
+ // There's only one string for "Scroll"
+ else if (item >= 80 && item <= 89)
+ return 68;
+ // There's only one string for "Parchment scrap"
+ else if (item >= 90 && item <= 94)
+ return 69;
+ // Correct offsets
+ else if (item >= 95)
+ return item - 25;
+
+ return 81;
+}
+
} // end of namespace Kyra
diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp
index a3a249de18..0499b5ca4b 100644
--- a/engines/kyra/kyra_lok.cpp
+++ b/engines/kyra/kyra_lok.cpp
@@ -664,7 +664,7 @@ int KyraEngine_LoK::processInputHelper(int xpos, int ypos) {
currentRoom->itemsTable[item] = 0xFF;
setMouseItem(item2);
assert(_itemList && _takenList);
- updateSentenceCommand(_itemList[item2], _takenList[0], 179);
+ updateSentenceCommand(_itemList[getItemListIndex(item2)], _takenList[0], 179);
_itemInHand = item2;
_screen->showMouse();
clickEventHandler2();
diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h
index a905c5521b..b7fd56010f 100644
--- a/engines/kyra/kyra_lok.h
+++ b/engines/kyra/kyra_lok.h
@@ -289,6 +289,8 @@ protected:
void removeHandItem();
void setMouseItem(uint16 item);
+ int getItemListIndex(uint16 item);
+
// -> graphics effects
void wipeDownMouseItem(int xpos, int ypos);
void itemSpecialFX(int x, int y, int item);