aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-23 03:16:36 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit94bd6db7a61af0d5552f86eac06c785a027041bc (patch)
treecd7bf5d525ac34189a68fe631f43074d04c004ea /engines
parent2f6e8a8e64ac2e5bc641532f0dd2ff10915cc469 (diff)
downloadscummvm-rg350-94bd6db7a61af0d5552f86eac06c785a027041bc.tar.gz
scummvm-rg350-94bd6db7a61af0d5552f86eac06c785a027041bc.tar.bz2
scummvm-rg350-94bd6db7a61af0d5552f86eac06c785a027041bc.zip
DM: Add F0291_CHAMPION_DrawSlot, G0425_aT_ChestSlots and constructor to Viewport, swap some warnings for code
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/champion.cpp91
-rw-r--r--engines/dm/champion.h1
-rw-r--r--engines/dm/gfx.cpp4
-rw-r--r--engines/dm/gfx.h9
-rw-r--r--engines/dm/inventory.cpp6
-rw-r--r--engines/dm/inventory.h1
-rw-r--r--engines/dm/objectman.cpp10
7 files changed, 111 insertions, 11 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 79f4267c7d..2899f9093c 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -492,7 +492,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
if (champAttributes & kChampionAttributeWounds) {
for (int16 AL_0_slotIndex = isInventoryChamp ? kChampionSlotFeet : kChampionSlotActionHand; AL_0_slotIndex >= kChampionSlotReadyHand; AL_0_slotIndex--) {
- warning("MISSING CODE: F0291_CHAMPION_DrawSlot");
+ drawSlot(champIndex, (ChampionSlot)AL_0_slotIndex);
}
if (isInventoryChamp) {
champAttributes |= kChampionAttributeViewport;
@@ -531,7 +531,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
}
if (champAttributes & kChampionAttributeActionHand) {
- warning("MISSING CODE: F0291_CHAMPION_DrawSlot");
+ drawSlot(champIndex, kChampionSlotActionHand);
menuMan.drawActionIcon(champIndex);
if (isInventoryChamp) {
champAttributes |= kChampionAttributeViewport;
@@ -560,4 +560,91 @@ void ChampionMan::drawHealthStaminaManaValues(Champion* champ) {
drawHealthOrStaminaOrManaValue(132, champ->_currMana, champ->_maxMana);
}
+void ChampionMan::drawSlot(uint16 champIndex, ChampionSlot slotIndex) {
+ int16 nativeBitmapIndex = -1;
+ Champion *champ = &_champions[champIndex];
+ bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == indexToOrdinal(champIndex));
+
+ uint16 slotBoxIndex;
+ if (!isInventoryChamp) { /* If drawing a slot for a champion other than the champion whose inventory is open */
+ if ((slotIndex > kChampionSlotActionHand) || (_candidateChampionOrdinal == indexToOrdinal(champIndex))) {
+ return;
+ }
+ slotBoxIndex = (champIndex << 1) + slotIndex;
+ } else {
+ slotBoxIndex = kSlotBoxInventoryFirstSlot + slotIndex;
+ }
+
+ Thing thing;
+ if (slotIndex >= kChampionSlotChest_1) {
+ thing = _vm->_inventoryMan->_chestSlots[slotIndex - kChampionSlotChest_1];
+ } else {
+ thing = champ->getSlot(slotIndex);
+ }
+
+ SlotBox *slotBox = &gSlotBoxes[slotBoxIndex];
+ Box box;
+ box._x1 = slotBox->_x - 1;
+ box._y1 = slotBox->_y - 1;
+ box._x2 = box._x1 + 17 + 1;
+ box._y2 = box._y1 + 17 + 1;
+
+
+ if (!isInventoryChamp) {
+ warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE");
+ }
+
+ int16 iconIndex;
+ if (thing == Thing::_thingNone) {
+ if (slotIndex <= kChampionSlotFeet) {
+ iconIndex = kIconIndiceReadyHand + (slotIndex << 1);
+ if (champ->getWoundsFlag((ChampionWound)(1 << slotIndex))) {
+ iconIndex++;
+ nativeBitmapIndex = kSlotBoxWoundedIndice;
+ } else {
+ nativeBitmapIndex = kSlotBoxNormalIndice;
+ }
+ } else {
+ if ((slotIndex >= kChampionSlotNeck) && (slotIndex <= kChampionSlotBackpackLine_1_1)) {
+ iconIndex = kIconIndiceNeck + (slotIndex - kChampionSlotNeck);
+ } else {
+ iconIndex = kIconIndiceEmptyBox;
+ }
+ }
+ } else {
+ warning("BUG0_35");
+ iconIndex = _vm->_objectMan->getIconIndex(thing); // BUG0_35
+ if (isInventoryChamp && (slotIndex == kChampionSlotActionHand) && ((iconIndex == kIconIndiceContainerChestClosed) || (iconIndex == kIconIndiceScrollOpen))) {
+ warning("BUG2_00");
+ iconIndex++;
+ } // BUG2_00
+ if (slotIndex <= kChampionSlotFeet) {
+ if (champ->getWoundsFlag((ChampionWound)(1 << slotIndex))) {
+ nativeBitmapIndex = kSlotBoxWoundedIndice;
+ } else {
+ nativeBitmapIndex = kSlotBoxNormalIndice;
+ }
+ }
+ }
+
+ if ((slotIndex == kChampionSlotActionHand) && (indexToOrdinal(champIndex) == _actingChampionOrdinal)) {
+ nativeBitmapIndex = kSlotBoxActingHandIndice;
+ }
+
+ if (nativeBitmapIndex != -1) {
+ _vm->_displayMan->_useByteBoxCoordinates = false;
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getBitmap(nativeBitmapIndex), 32, 0, 0,
+ box, kColorDarkestGray, isInventoryChamp ? gDungeonViewport : gDefultViewPort);
+ }
+
+ _vm->_objectMan->drawIconInSlotBox(slotBoxIndex, iconIndex);
+
+ if (!isInventoryChamp) {
+ warning("MISSING CODE: F0078_MOUSE_ShowPointer");
+ }
}
+
+
+}
+
+
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 4cc32c51f4..2b2aaf9cb1 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -416,6 +416,7 @@ public:
void drawChampionState(ChampionIndex champIndex); // @ F0292_CHAMPION_DrawState
uint16 championIconIndex(int16 val, direction dir); // @ M26_CHAMPION_ICON_INDEX
void drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues
+ void drawSlot(uint16 champIndex, ChampionSlot slotIndex); // @ F0291_CHAMPION_DrawSlot
};
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index f430a6f769..8c38f4bb25 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -544,9 +544,9 @@ byte gPalChangesCreature_D2[16] = {0, 10, 20, 30, 40, 30, 60, 70, 50, 0, 0, 110,
-Viewport gDefultViewPort = {0, 0, 320, 200};
+Viewport gDefultViewPort(0, 0, 320, 200);
// TODO: I guessed the numbers
-Viewport gDungeonViewport = {0, 33, 224, 126}; // @ G0296_puc_Bitmap_Viewport
+Viewport gDungeonViewport(0, 33, 224, 126); // @ G0296_puc_Bitmap_Viewport
byte gPalChangesNoChanges[16] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150}; // @ G0017_auc_Graphic562_PaletteChanges_NoChanges
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index ed246de912..5e0307e7df 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -42,7 +42,8 @@ enum GraphicIndice {
kSlotBoxNormalIndice = 33, // @ C033_GRAPHIC_SLOT_BOX_NORMAL
kSlotBoxWoundedIndice = 34, // @ C034_GRAPHIC_SLOT_BOX_WOUNDED
kChampionIcons = 28, // @ C028_GRAPHIC_CHAMPION_ICONS
- kFontGraphicIndice = 557 // @ C557_GRAPHIC_FONT
+ kFontGraphicIndice = 557, // @ C557_GRAPHIC_FONT
+ kSlotBoxActingHandIndice = 35 // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND
};
extern uint16 gPalSwoosh[16];
@@ -146,9 +147,13 @@ enum Color {
};
-struct Viewport {
+class Viewport {
+public:
uint16 _posX, _posY;
uint16 _width, _height;
+ Viewport() {}
+ Viewport(uint16 posX, uint16 posY, uint16 width, uint16 height)
+ :_posX(posX), _posY(posY), _width(width), _height(height) {}
};
struct CreatureAspect {
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 271fd3b879..31b495ca2b 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -17,6 +17,8 @@ Box gBoxPoisoned = Box(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned
InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) {
_panelContent = kPanelContentFoodWaterPoisoned;
+ for (uint16 i = 0; i < 8; ++i)
+ _chestSlots[i] = Thing::_thingNone;
}
void InventoryMan::toggleInventory(ChampionIndex championIndex) {
@@ -73,7 +75,9 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
_vm->_textMan->printToViewport(5, 124, kColorLightestGray, "STAMINA");
_vm->_textMan->printToViewport(5, 132, kColorLightestGray, "MANA");
- warning("MISSING CODE: F0291_CHAMPION_DrawSlot in LOOOOOOOOOOOOP");
+ for (uint16 slotIndex = kChampionSlotReadyHand; slotIndex < kChampionSlotChest_1; slotIndex++) {
+ _vm->_championMan->drawSlot(championIndex, (ChampionSlot)slotIndex);
+ }
champion->setAttributeFlag(kChampionAttributeViewport, true);
champion->setAttributeFlag(kChampionAttributeStatusBox, true);
diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h
index b8fbe516a5..45bc3e9007 100644
--- a/engines/dm/inventory.h
+++ b/engines/dm/inventory.h
@@ -25,6 +25,7 @@ public:
int16 _inventoryChampionOrdinal; // @ G0423_i_InventoryChampionOrdinal
PanelContent _panelContent; // @ G0424_i_PanelContent
+ Thing _chestSlots[8]; // @ G0425_aT_ChestSlots
void toggleInventory(ChampionIndex championIndex); // @ F0355_INVENTORY_Toggle_CPSE
void drawStatusBoxPortrait(ChampionIndex championIndex); // @ F0354_INVENTORY_DrawStatusBoxPortrait
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp
index 87d6992907..96f95798f7 100644
--- a/engines/dm/objectman.cpp
+++ b/engines/dm/objectman.cpp
@@ -149,8 +149,8 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
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
+ box._x2 = box._x1 + 15 + 1;
+ box._y2 = box._y1 + 15 + 1;
uint16 iconGraphicIndex;
for (iconGraphicIndex = 0; iconGraphicIndex < 7; ++iconGraphicIndex) {
@@ -164,9 +164,11 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
_vm->_displayMan->_useByteBoxCoordinates = false;
if (slotBoxIndex >= kSlotBoxInventoryFirstSlot) {
- _vm->_displayMan->blitToScreen(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, box, kColorNoTransparency, gDungeonViewport);
+ _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);
+ _vm->_displayMan->blitToScreen(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0,
+ box, kColorNoTransparency, gDefultViewPort);
}
}