diff options
-rw-r--r-- | engines/dm/objectman.cpp | 83 | ||||
-rw-r--r-- | engines/dm/objectman.h | 15 |
2 files changed, 96 insertions, 2 deletions
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index c237b914a2..87d6992907 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -4,6 +4,55 @@ namespace DM { +SlotBox gSlotBoxes[46] = { +/* 8 for champion hands in status boxes, 30 for champion inventory, 8 for chest */ + SlotBox(4, 10, 0), /* Champion Status Box 0 Ready Hand */ + SlotBox(24, 10, 0), /* Champion Status Box 0 Action Hand */ + SlotBox(73, 10, 0), /* Champion Status Box 1 Ready Hand */ + SlotBox(93, 10, 0), /* Champion Status Box 1 Action Hand */ + SlotBox(142, 10, 0), /* Champion Status Box 2 Ready Hand */ + SlotBox(162, 10, 0), /* Champion Status Box 2 Action Hand */ + SlotBox(211, 10, 0), /* Champion Status Box 3 Ready Hand */ + SlotBox(231, 10, 0), /* Champion Status Box 3 Action Hand */ + SlotBox(6, 53, 0), /* Ready Hand */ + SlotBox(62, 53, 0), /* Action Hand */ + SlotBox(34, 26, 0), /* Head */ + SlotBox(34, 46, 0), /* Torso */ + SlotBox(34, 66, 0), /* Legs */ + SlotBox(34, 86, 0), /* Feet */ + SlotBox(6, 90, 0), /* Pouch 2 */ + SlotBox(79, 73, 0), /* Quiver Line2 1 */ + SlotBox(62, 90, 0), /* Quiver Line1 2 */ + SlotBox(79, 90, 0), /* Quiver Line2 2 */ + SlotBox(6, 33, 0), /* Neck */ + SlotBox(6, 73, 0), /* Pouch 1 */ + SlotBox(62, 73, 0), /* Quiver Line1 1 */ + SlotBox(66, 33, 0), /* Backpack Line1 1 */ + SlotBox(83, 16, 0), /* Backpack Line2 2 */ + SlotBox(100, 16, 0), /* Backpack Line2 3 */ + SlotBox(117, 16, 0), /* Backpack Line2 4 */ + SlotBox(134, 16, 0), /* Backpack Line2 5 */ + SlotBox(151, 16, 0), /* Backpack Line2 6 */ + SlotBox(168, 16, 0), /* Backpack Line2 7 */ + SlotBox(185, 16, 0), /* Backpack Line2 8 */ + SlotBox(202, 16, 0), /* Backpack Line2 9 */ + SlotBox(83, 33, 0), /* Backpack Line1 2 */ + SlotBox(100, 33, 0), /* Backpack Line1 3 */ + SlotBox(117, 33, 0), /* Backpack Line1 4 */ + SlotBox(134, 33, 0), /* Backpack Line1 5 */ + SlotBox(151, 33, 0), /* Backpack Line1 6 */ + SlotBox(168, 33, 0), /* Backpack Line1 7 */ + SlotBox(185, 33, 0), /* Backpack Line1 8 */ + SlotBox(202, 33, 0), /* Backpack Line1 9 */ + SlotBox(117, 59, 0), /* Chest 1 */ + SlotBox(106, 76, 0), /* Chest 2 */ + SlotBox(111, 93, 0), /* Chest 3 */ + SlotBox(128, 98, 0), /* Chest 4 */ + SlotBox(145, 101, 0), /* Chest 5 */ + SlotBox(162, 103, 0), /* Chest 6 */ + SlotBox(179, 104, 0), /* Chest 7 */ + SlotBox(196, 105, 0)}; /* Chest 8 */ + int16 gIconGraphicHeight[7] = {32, 32, 32, 32, 32, 32, 32}; // @ K0077_ai_IconGraphicHeight int16 gIconGraphicFirstIndex[7] = { // G0026_ai_Graphic562_IconGraphicFirstIconIndex @@ -34,7 +83,7 @@ IconIndice ObjectMan::getIconIndex(Thing thing) { IconIndice iconIndex = getObjectType(thing); if ((iconIndex != kIconIndiceNone) && - ((iconIndex < kIconIndiceWeaponDagger) &&(iconIndex >= kIconIndiceJunkCompassNorth)) || // < instead of <= is no error + ((iconIndex < kIconIndiceWeaponDagger) && (iconIndex >= kIconIndiceJunkCompassNorth)) || // < instead of <= is no error ((iconIndex >= kIconIndicePotionMaPotionMonPotion) && (iconIndex <= kIconIndicePotionWaterFlask)) || (iconIndex == kIconIndicePotionEmptyFlask) ) { @@ -91,4 +140,34 @@ void ObjectMan::extractIconFromBitmap(uint16 iconIndex, byte *destBitmap) { } -}
\ No newline at end of file +void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { + SlotBox *slotBox = &gSlotBoxes[slotBoxIndex]; + slotBox->_iconIndex = iconIndex; // yes, this modifies the global array + if (slotBox->_iconIndex == kIconIndiceNone) { + return; + } + Box box; + box._x1 = slotBox->_x; + box._y1 = slotBox->_y; + box._x2 = box._x1 + 15; // no need to add +1, comes from a global array + box._y2 = box._y1 + 15; // no need to add +1, comes from a global array + + uint16 iconGraphicIndex; + for (iconGraphicIndex = 0; iconGraphicIndex < 7; ++iconGraphicIndex) { + if (gIconGraphicFirstIndex[iconGraphicIndex] > iconIndex) { + break; + } + } + iconGraphicIndex--; + byte *iconsBitmap = _vm->_displayMan->getBitmap(iconGraphicIndex + kObjectIcons_000_TO_031); + iconIndex -= gIconGraphicFirstIndex[iconGraphicIndex]; + + _vm->_displayMan->_useByteBoxCoordinates = false; + if (slotBoxIndex >= kSlotBoxInventoryFirstSlot) { + _vm->_displayMan->blitToScreen(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, box, kColorNoTransparency, gDungeonViewport); + } else { + _vm->_displayMan->blitToScreen(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, box, kColorNoTransparency, gDefultViewPort); + } +} + +} diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h index dd0150d747..fd0f5a1b6f 100644 --- a/engines/dm/objectman.h +++ b/engines/dm/objectman.h @@ -4,6 +4,20 @@ namespace DM { +#define kSlotBoxInventoryFirstSlot 8 // @ C08_SLOT_BOX_INVENTORY_FIRST_SLOT +#define kSlotBoxInventoryActionHand 9 // @ C09_SLOT_BOX_INVENTORY_ACTION_HAND +#define kSlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT + +class SlotBox { +public: + int16 _x; + int16 _y; + int16 _iconIndex; + SlotBox(int16 x, int16 y, int16 iconIndex): _x(x), _y(y), _iconIndex(iconIndex) {} +}; // @ SLOT_BOX + +extern SlotBox gSlotBoxes[46]; // @ G0030_as_Graphic562_SlotBoxes; + class ObjectMan { DMEngine *_vm; public: @@ -12,6 +26,7 @@ public: IconIndice getObjectType(Thing thing); // @ F0032_OBJECT_GetType IconIndice getIconIndex(Thing thing); // @ F0033_OBJECT_GetIconIndex void extractIconFromBitmap(uint16 iconIndex, byte *srcBitmap); // F0036_OBJECT_ExtractIconFromBitmap + void drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex); // @ F0038_OBJECT_DrawIconInSlotBox }; } |