aboutsummaryrefslogtreecommitdiff
path: root/engines/dm
diff options
context:
space:
mode:
authorStrangerke2016-09-25 22:33:40 +0200
committerStrangerke2016-09-25 22:33:40 +0200
commite114e9a47fd21f45c1193328124be7542c3be111 (patch)
tree50c9d44b794ab24cb35636ab25bd0637938221a4 /engines/dm
parent804c6ab7130ac88ad66e2424f79f9cc48c0689f1 (diff)
downloadscummvm-rg350-e114e9a47fd21f45c1193328124be7542c3be111.tar.gz
scummvm-rg350-e114e9a47fd21f45c1193328124be7542c3be111.tar.bz2
scummvm-rg350-e114e9a47fd21f45c1193328124be7542c3be111.zip
DM: Some more work on dereferencing
Diffstat (limited to 'engines/dm')
-rw-r--r--engines/dm/champion.cpp76
-rw-r--r--engines/dm/inventory.cpp65
-rw-r--r--engines/dm/movesens.cpp9
3 files changed, 85 insertions, 65 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index f95b775aa5..538b3d753b 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -1395,6 +1395,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
Champion *championPtr = _champions;
EventManager &evtMan = *_vm->_eventMan;
TextMan &txtMan = *_vm->_textMan;
+ DisplayMan &display = *_vm->_displayMan;
for (uint16 championIndex = kDMChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) {
int16 pendingWounds = _championPendingWounds[championIndex];
@@ -1432,7 +1433,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
blitBox._rect.bottom = 28;
blitBox._rect.left = textPosX + 7;
blitBox._rect.right = blitBox._rect.left + 31; /* Box is over the champion portrait in the status box */
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxDamageToChampionBig), &blitBox, k16_byteWidth, kDMColorFlesh, 29);
+ display.blitToScreen(display.getNativeBitmapOrGraphic(kDMGraphicIdxDamageToChampionBig), &blitBox, k16_byteWidth, kDMColorFlesh, 29);
// Check the number of digits and sets the position accordingly.
if (pendingDamage < 10) // 1 digit
textPosX += 21;
@@ -1446,7 +1447,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
blitBox._rect.bottom = 6;
blitBox._rect.left = textPosX;
blitBox._rect.right = blitBox._rect.left + 47; /* Box is over the champion name in the status box */
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxDamageToChampionSmall), &blitBox, k24_byteWidth, kDMColorFlesh, 7);
+ display.blitToScreen(display.getNativeBitmapOrGraphic(kDMGraphicIdxDamageToChampionSmall), &blitBox, k24_byteWidth, kDMColorFlesh, 7);
// Check the number of digits and sets the position accordingly.
if (pendingDamage < 10) // 1 digit
textPosX += 19;
@@ -1481,6 +1482,7 @@ void ChampionMan::championKill(uint16 champIndex) {
DungeonMan &dungeon = *_vm->_dungeonMan;
Champion *curChampion = &_champions[champIndex];
EventManager &evtMan = *_vm->_eventMan;
+ DisplayMan &display = *_vm->_displayMan;
curChampion->_currHealth = 0;
setFlag(curChampion->_attributes, kDMAttributeStatusBox);
@@ -1525,8 +1527,8 @@ void ChampionMan::championKill(uint16 champIndex) {
if (curChampion->_poisonEventCount)
unpoison(champIndex);
- _vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->fillScreenBox(_boxChampionIcons[curChampionIconIndex], kDMColorBlack);
+ display._useByteBoxCoordinates = false;
+ display.fillScreenBox(_boxChampionIcons[curChampionIconIndex], kDMColorBlack);
drawChampionState((ChampionIndex)champIndex);
ChampionIndex aliveChampionIndex;
@@ -1909,12 +1911,14 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
return;
DungeonMan &dungeon = *_vm->_dungeonMan;
+ DisplayMan &display = *_vm->_displayMan;
+
uint16 previousPartyChampionCount = _partyChampionCount;
Champion *championPtr = &_champions[previousPartyChampionCount];
championPtr->resetToZero();
// Strangerke - TODO: Check if the new code is possible to run on the older version (example: the portraits could be missing in the data)
- _vm->_displayMan->_useByteBoxCoordinates = true;
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxChampionPortraits), championPtr->_portrait, _boxChampionPortrait, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kDMColorNoTransparency, 87, 29);
+ display._useByteBoxCoordinates = true;
+ display.blitToBitmap(display.getNativeBitmapOrGraphic(kDMGraphicIdxChampionPortraits), championPtr->_portrait, _boxChampionPortrait, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kDMColorNoTransparency, 87, 29);
championPtr->_actionIndex = kDMActionNone;
championPtr->_enableActionEventIndex = -1;
championPtr->_hideDamageReceivedIndex = -1;
@@ -2076,6 +2080,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) {
Champion *champ = &_champions[champIndex];
EventManager &evtMan = *_vm->_eventMan;
+ DisplayMan &display = *_vm->_displayMan;
int16 barGraphHeights[3];
int16 barGraphIdx = 0;
@@ -2114,12 +2119,12 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) {
if (barGraphHeight < 25) {
box._rect.top = 2;
box._rect.bottom = 27 - barGraphHeight;
- _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray);
+ display.fillScreenBox(box, kDMColorDarkestGray);
}
if (barGraphHeight) {
box._rect.top = 27 - barGraphHeight;
box._rect.bottom = 26;
- _vm->_displayMan->fillScreenBox(box, _championColor[champIndex]);
+ display.fillScreenBox(box, _championColor[champIndex]);
}
box._rect.left += 7;
box._rect.right += 7;
@@ -2161,13 +2166,14 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
Champion *curChampion = &_champions[champIndex];
EventManager &evtMan = *_vm->_eventMan;
TextMan &txtMan = *_vm->_textMan;
+ DisplayMan &display = *_vm->_displayMan;
uint16 championAttributes = curChampion->_attributes;
if (!getFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand))
return;
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal);
- _vm->_displayMan->_useByteBoxCoordinates = false;
+ display._useByteBoxCoordinates = false;
evtMan.showMouse();
if (getFlag(championAttributes, kDMAttributeStatusBox)) {
Box box;
@@ -2176,7 +2182,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
box._rect.left = championStatusBoxX;
box._rect.right = box._rect.left + 66;
if (curChampion->_currHealth) {
- _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray);
+ display.fillScreenBox(box, kDMColorDarkestGray);
int16 nativeBitmapIndices[3];
for (uint16 i = 0; i < 3; ++i)
nativeBitmapIndices[i] = 0;
@@ -2192,7 +2198,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
nativeBitmapIndices[borderCount++] = kDMGraphicIdxBorderPartyShield;
while (borderCount--)
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndices[borderCount]), &box, k40_byteWidth, kDMColorFlesh, 29);
+ display.blitToScreen(display.getNativeBitmapOrGraphic(nativeBitmapIndices[borderCount]), &box, k40_byteWidth, kDMColorFlesh, 29);
if (isInventoryChampion) {
_vm->_inventoryMan->drawStatusBoxPortrait(champIndex);
@@ -2200,7 +2206,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
} else
setFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeWounds | kDMAttributeActionHand);
} else {
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxStatusBoxDeadChampion), &box, k40_byteWidth, kDMColorNoTransparency, 29);
+ display.blitToScreen(display.getNativeBitmapOrGraphic(kDMGraphicIdxStatusBoxDeadChampion), &box, k40_byteWidth, kDMColorNoTransparency, 29);
txtMan.printToLogicalScreen(championStatusBoxX + 1, 5, kDMColorLightestGray, kDMColorDarkGary, curChampion->_name);
_vm->_menuMan->drawActionIcon(champIndex);
@@ -2233,7 +2239,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
box._rect.bottom = 6;
box._rect.left = championStatusBoxX;
box._rect.right = box._rect.left + 42;
- _vm->_displayMan->fillScreenBox(box, kDMColorDarkGary);
+ display.fillScreenBox(box, kDMColorDarkGary);
txtMan.printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, kDMColorDarkGary, curChampion->_name);
}
}
@@ -2247,7 +2253,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
else
nativeBitmapIndex = kDMGraphicIdxSlotBoxNormal;
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, kDMColorDarkestGray, 18);
+ display.blitToViewport(display.getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, kDMColorDarkestGray, 18);
nativeBitmapIndex = kDMGraphicIdxSlotBoxNormal;
for (int i = kDMStatStrength; i <= kDMStatAntifire; i++) {
if ((curChampion->_statistics[i][kDMStatCurrent] < curChampion->_statistics[i][kDMStatMaximum])) {
@@ -2255,7 +2261,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
break;
}
}
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, kDMColorDarkestGray, 18);
+ display.blitToViewport(display.getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, kDMColorDarkestGray, 18);
setFlag(championAttributes, kDMAttributeViewport);
}
}
@@ -2311,8 +2317,8 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
DungeonMan &dungeon = *_vm->_dungeonMan;
uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, dungeon._partyDir);
if (getFlag(championAttributes, kDMAttributeIcon) && (evtMan._useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) {
- _vm->_displayMan->fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]);
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, dungeon._partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, kDMColorDarkestGray, 14, k200_heightScreen);
+ display.fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]);
+ display.blitToBitmap(display.getNativeBitmapOrGraphic(kDMGraphicIdxChampionIcons), display._bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, dungeon._partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, kDMColorDarkestGray, 14, k200_heightScreen);
}
if (getFlag(championAttributes, kDMAttributePanel) && isInventoryChampion) {
if (_vm->_pressingMouth)
@@ -2332,7 +2338,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
setFlag(championAttributes, kDMAttributeViewport);
}
if (getFlag(championAttributes, kDMAttributeViewport))
- _vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
+ display.drawViewport(k0_viewportNotDungeonView);
clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
evtMan.hideMouse();
@@ -2351,6 +2357,7 @@ void ChampionMan::drawHealthStaminaManaValues(Champion *champ) {
void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {
Champion *champ = &_champions[champIndex];
EventManager &evtMan = *_vm->_eventMan;
+ DisplayMan &display = *_vm->_displayMan;
int16 nativeBitmapIndex = -1;
bool isInventoryChamp = (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex));
@@ -2412,15 +2419,15 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {
nativeBitmapIndex = kDMGraphicIdxSlotBoxActingHand;
if (nativeBitmapIndex != -1) {
- _vm->_displayMan->_useByteBoxCoordinates = false;
+ display._useByteBoxCoordinates = false;
if (isInventoryChamp) {
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex),
- _vm->_displayMan->_bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport,
- kDMColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
+ display.blitToBitmap(display.getNativeBitmapOrGraphic(nativeBitmapIndex),
+ display._bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport,
+ kDMColorDarkestGray, display.getPixelHeight(nativeBitmapIndex), k136_heightViewport);
} else {
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex),
- _vm->_displayMan->_bitmapScreen, box, 0, 0, 16, k160_byteWidthScreen,
- kDMColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
+ display.blitToBitmap(display.getNativeBitmapOrGraphic(nativeBitmapIndex),
+ display._bitmapScreen, box, 0, 0, 16, k160_byteWidthScreen,
+ kDMColorDarkestGray, display.getPixelHeight(nativeBitmapIndex), k136_heightViewport);
}
}
@@ -2439,6 +2446,7 @@ void ChampionMan::renameChampion(Champion *champ) {
EventManager &evtMan = *_vm->_eventMan;
TextMan &txtMan = *_vm->_textMan;
+ DisplayMan &display = *_vm->_displayMan;
Box displayBox;
displayBox._rect.top = 3;
@@ -2446,12 +2454,12 @@ void ChampionMan::renameChampion(Champion *champ) {
displayBox._rect.left = 3;
displayBox._rect.right = displayBox._rect.left + 167;
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, displayBox, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelRenameChampion), _vm->_inventoryMan->_boxPanel, k72_byteWidth, kDMColorCyan, 73);
+ display.fillBoxBitmap(display._bitmapViewport, displayBox, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
+ display.blitToViewport(display.getNativeBitmapOrGraphic(kDMGraphicIdxPanelRenameChampion), _vm->_inventoryMan->_boxPanel, k72_byteWidth, kDMColorCyan, 73);
txtMan.printToViewport(177, 58, kDMColorLightestGray, "_______");
txtMan.printToViewport(105, 76, kDMColorLightestGray, "___________________");
evtMan.showMouse();
- _vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
+ display.drawViewport(k0_viewportNotDungeonView);
evtMan.setMousePointerToNormal(k0_pointerArrow);
evtMan.hideMouse();
uint16 curCharacterIndex = 0;
@@ -2466,7 +2474,7 @@ void ChampionMan::renameChampion(Champion *champ) {
bool championTitleIsFull = ((renamedChampionStringMode == kDMRenameChampionTitle) && (curCharacterIndex == 19));
if (!championTitleIsFull) {
evtMan.showMouse();
- txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorGold, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ txtMan.printTextToBitmap(display._bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorGold, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
evtMan.hideMouse();
}
@@ -2474,10 +2482,10 @@ void ChampionMan::renameChampion(Champion *champ) {
while (curCharacter == 256) {
Common::Event event;
Common::EventType eventType = evtMan.processInput(&event, &event);
- _vm->_displayMan->updateScreen();
+ display.updateScreen();
if (_vm->_engineShouldQuit)
return;
- _vm->_displayMan->updateScreen();
+ display.updateScreen();
//_vm->f22_delay(1);
if (eventType == Common::EVENT_LBUTTONDOWN) {
@@ -2551,7 +2559,7 @@ void ChampionMan::renameChampion(Champion *champ) {
if (!championTitleIsFull) {
renameChampionInputCharacterString[0] = curCharacter;
evtMan.showMouse();
- txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen);
+ txtMan.printTextToBitmap(display._bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen);
evtMan.hideMouse();
renamedChampionString[curCharacterIndex++] = curCharacter;
renamedChampionString[curCharacterIndex] = '\0';
@@ -2568,7 +2576,7 @@ void ChampionMan::renameChampion(Champion *champ) {
} else if (curCharacter == '\r') { // Carriage return
if ((renamedChampionStringMode == kDMRenameChampionName) && (curCharacterIndex > 0)) {
evtMan.showMouse();
- txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ txtMan.printTextToBitmap(display._bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
evtMan.hideMouse();
renamedChampionStringMode = kDMRenameChampionTitle;
renamedChampionString = champ->_title;
@@ -2582,7 +2590,7 @@ void ChampionMan::renameChampion(Champion *champ) {
if (!championTitleIsFull) {
evtMan.showMouse();
- txtMan.printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ txtMan.printTextToBitmap(display._bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
evtMan.hideMouse();
}
if (curCharacterIndex == 0) {
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index a375494d35..184ece7efa 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -87,6 +87,8 @@ InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) {
void InventoryMan::toggleInventory(ChampionIndex championIndex) {
static Box boxFloppyZzzCross(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross
+ DisplayMan &display = *_vm->_displayMan;
+
if ((championIndex != kDMChampionCloseInventory) && !_vm->_championMan->_champions[championIndex]._currHealth)
return;
@@ -118,19 +120,19 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
_vm->_eventMan->_secondaryMouseInput = _vm->_eventMan->_secondaryMouseInputMovement;
_vm->_eventMan->_secondaryKeyboardInput = _vm->_eventMan->_secondaryKeyboardInputMovement;
_vm->_eventMan->discardAllInput();
- _vm->_displayMan->drawFloorAndCeiling();
+ display.drawFloorAndCeiling();
return;
}
}
- _vm->_displayMan->_useByteBoxCoordinates = false;
+ display._useByteBoxCoordinates = false;
_inventoryChampionOrdinal = _vm->indexToOrdinal(championIndex);
if (!inventoryChampionOrdinal)
- _vm->_displayMan->shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, kDMColorBlack);
+ display.shadeScreenBox(&display._boxMovementArrows, kDMColorBlack);
Champion *champion = &_vm->_championMan->_champions[championIndex];
- _vm->_displayMan->loadIntoBitmap(kDMGraphicIdxInventory, _vm->_displayMan->_bitmapViewport);
+ display.loadIntoBitmap(kDMGraphicIdxInventory, display._bitmapViewport);
if (_vm->_championMan->_candidateChampionOrdinal)
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, boxFloppyZzzCross, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
+ display.fillBoxBitmap(display._bitmapViewport, boxFloppyZzzCross, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
switch (_vm->getGameLanguage()) { // localized
default:
@@ -164,6 +166,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
void InventoryMan::drawStatusBoxPortrait(ChampionIndex championIndex) {
DisplayMan &dispMan = *_vm->_displayMan;
+
dispMan._useByteBoxCoordinates = false;
Box box;
box._rect.top = 0;
@@ -174,13 +177,14 @@ void InventoryMan::drawStatusBoxPortrait(ChampionIndex championIndex) {
}
void InventoryMan::drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) {
+ DisplayMan &display = *_vm->_displayMan;
Box box;
box._rect.left = x;
box._rect.right = box._rect.left + pixelWidth;
box._rect.top = y;
box._rect.bottom = box._rect.top + 6;
- _vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, box, color, k112_byteWidthViewport, k136_heightViewport);
+ display._useByteBoxCoordinates = false;
+ display.fillBoxBitmap(display._bitmapViewport, box, color, k112_byteWidthViewport, k136_heightViewport);
}
void InventoryMan::drawPanelFoodOrWaterBar(int16 amount, int16 y, Color color) {
@@ -206,26 +210,27 @@ void InventoryMan::drawPanelFoodWaterPoisoned() {
Champion &champ = _vm->_championMan->_champions[_inventoryChampionOrdinal];
closeChest();
DisplayMan &dispMan = *_vm->_displayMan;
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty), _boxPanel, k72_byteWidth, kDMColorRed, 73);
+
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty), _boxPanel, k72_byteWidth, kDMColorRed, 73);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k24_byteWidth, kDMColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k24_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::DE_DEU:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k32_byteWidth, kDMColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k32_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k32_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k32_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::FR_FRA:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k48_byteWidth, kDMColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxFoodLabel), boxFood, k48_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxWaterLabel), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
}
if (champ._poisonEventCount)
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPoisionedLabel),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxPoisionedLabel),
boxPoisoned, k48_byteWidth, kDMColorDarkestGray, 15);
drawPanelFoodOrWaterBar(champ._food, 69, kDMColorLightBrown);
@@ -233,8 +238,10 @@ void InventoryMan::drawPanelFoodWaterPoisoned() {
}
void InventoryMan::drawPanelResurrectReincarnate() {
+ DisplayMan &display = *_vm->_displayMan;
+
_panelContent = kDMPanelContentResurrectReincarnate;
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelResurectReincarnate),
+ display.blitToViewport(display.getNativeBitmapOrGraphic(kDMGraphicIdxPanelResurectReincarnate),
_boxPanel, k72_byteWidth, kDMColorDarkGreen, 73);
}
@@ -315,7 +322,7 @@ void InventoryMan::drawPanelScroll(Scroll *scroll) {
charRed++;
*charRed = '\0';
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelOpenScroll),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxPanelOpenScroll),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 lineCount = 1;
charRed++;
@@ -367,7 +374,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is
if (!isPressingEye) {
objMan.drawIconInSlotBox(kDMSlotBoxInventoryActionHand, kDMIconIndiceContainerChestOpen);
}
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelOpenChest),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxPanelOpenChest),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 chestSlotIndex = 0;
Thing thing = chest->getSlot();
@@ -470,7 +477,7 @@ void InventoryMan::drawPanelArrowOrEye(bool pressingEye) {
static Box boxArrowOrEye(83, 98, 57, 65); // @ G0033_s_Graphic562_Box_ArrowOrEye
DisplayMan &dispMan = *_vm->_displayMan;
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(pressingEye ? kDMGraphicIdxEyeForObjectDescription : kDMGraphicIdxArrowForChestContent),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(pressingEye ? kDMGraphicIdxEyeForObjectDescription : kDMGraphicIdxArrowForChestContent),
boxArrowOrEye, k8_byteWidth, kDMColorRed, 9);
}
@@ -495,9 +502,9 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
openAndDrawChest(thingToDraw, (Container *)rawThingPtr, pressingEye);
else {
IconIndice iconIndex = objMan.getIconIndex(thingToDraw);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxObjectDescCircle),
+ dispMan.blitToViewport(dispMan.getNativeBitmapOrGraphic(kDMGraphicIdxObjectDescCircle),
boxObjectDescCircle, k16_byteWidth, kDMColorDarkestGray, 27);
Common::String descString;
@@ -679,9 +686,10 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
void InventoryMan::setDungeonViewPalette() {
static const int16 palIndexToLightAmmount[6] = {99, 75, 50, 25, 1, 0}; // @ G0040_ai_Graphic562_PaletteIndexToLightAmount
+ DisplayMan &display = *_vm->_displayMan;
if (_vm->_dungeonMan->_currMap->_difficulty == 0) {
- _vm->_displayMan->_dungeonViewPaletteIndex = 0; /* Brightest color palette index */
+ display._dungeonViewPaletteIndex = 0; /* Brightest color palette index */
} else {
/* Get torch light power from both hands of each champion in the party */
int16 counter = 4; /* BUG0_01 Coding error without consequence. The hands of four champions are inspected even if there are less champions in the party. No consequence as the data in unused champions is set to 0 and _vm->_objectMan->f32_getObjectType then returns -1 */
@@ -743,10 +751,10 @@ void InventoryMan::setDungeonViewPalette() {
} else {
paletteIndex = 5; /* Darkest color palette index */
}
- _vm->_displayMan->_dungeonViewPaletteIndex = paletteIndex;
+ display._dungeonViewPaletteIndex = paletteIndex;
}
- _vm->_displayMan->_refreshDungeonViewPaleteRequested = true;
+ display._refreshDungeonViewPaleteRequested = true;
}
void InventoryMan::decreaseTorchesLightPower() {
@@ -784,6 +792,7 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
static const char *statisticNamesDE[7] = {"L", "STAERKE", "FLINKHEIT", "WEISHEIT", "VITALITAET", "ANTI-MAGIE", "ANTI-FEUER"};
static const char *statisticNamesFR[7] = {"L", "FORCE", "DEXTERITE", "SAGESSE", "VITALITE", "ANTI-MAGIE", "ANTI-FEU"};
+ DisplayMan &display = *_vm->_displayMan;
const char **statisticNames;
switch (_vm->getGameLanguage()) { // localized
@@ -801,7 +810,7 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
closeChest();
uint16 championIndex = _vm->ordinalToIndex(_inventoryChampionOrdinal);
Champion *curChampion = &_vm->_championMan->_champions[championIndex];
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty), _boxPanel, k72_byteWidth, kDMColorRed, 73);
+ display.blitToViewport(display.getNativeBitmapOrGraphic(kDMGraphicIdxPanelEmpty), _boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 textPosY = 58;
for (uint16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
int16 skillLevel = MIN((uint16)16, _vm->_championMan->getSkillLevel(championIndex, idx | kDMIgnoreTemporaryExperience));
@@ -876,6 +885,8 @@ void InventoryMan::clickOnMouth() {
1400 /* Dragon steak */
};
+ DisplayMan &display = *_vm->_displayMan;
+
if (_vm->_championMan->_leaderEmptyHanded) {
if (_panelContent == kDMPanelContentFoodWaterPoisoned)
return;
@@ -890,7 +901,7 @@ void InventoryMan::clickOnMouth() {
_vm->_eventMan->showMouse();
_vm->_eventMan->_hideMousePointerRequestCount = 1;
drawPanelFoodWaterPoisoned();
- _vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
+ display.drawViewport(k0_viewportNotDungeonView);
}
return;
}
@@ -1011,7 +1022,7 @@ void InventoryMan::clickOnMouth() {
_vm->_eventMan->discardAllInput();
if (_vm->_engineShouldQuit)
return;
- _vm->_displayMan->updateScreen();
+ display.updateScreen();
}
} else {
_vm->_championMan->drawChangedObjectIcons();
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index eeafc4d951..3fb477cbbc 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -210,6 +210,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16
bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destMapX, int16 destMapY) {
DungeonMan &dungeon = *_vm->_dungeonMan;
+ DisplayMan &display = *_vm->_displayMan;
ThingType thingType = kDMThingTypeParty;
int16 traversedPitCount = 0;
@@ -311,12 +312,12 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
drawDungeonViewWhileFalling = true;
if (traversedPitCount) {
dungeon.setCurrentMapAndPartyMap(mapIndexDestination);
- _vm->_displayMan->loadCurrentMapGraphics();
+ display.loadCurrentMapGraphics();
}
traversedPitCount++;
- _vm->_displayMan->drawDungeon(dungeon._partyDir, destMapX, destMapY); /* BUG0_28 When falling through multiple pits the dungeon view is updated to show each traversed map but the graphics used for creatures, wall and floor ornaments may not be correct. The dungeon view is drawn for each map by using the graphics loaded for the source map. Therefore the graphics for creatures, wall and floor ornaments may not look like what they should */
- /* BUG0_71 Some timings are too short on fast computers. When the party falls in a series of pits, the dungeon view is refreshed too quickly because the execution speed is not limited */
- /* BUG0_01 While drawing creatures the engine will read invalid ACTIVE_GROUP data in _vm->_groupMan->_g375_activeGroups because the data is for the creatures on the source map and not the map being drawn. The only consequence is that creatures may be drawn with incorrect bitmaps and/or directions */
+ display.drawDungeon(dungeon._partyDir, destMapX, destMapY); /* BUG0_28 When falling through multiple pits the dungeon view is updated to show each traversed map but the graphics used for creatures, wall and floor ornaments may not be correct. The dungeon view is drawn for each map by using the graphics loaded for the source map. Therefore the graphics for creatures, wall and floor ornaments may not look like what they should */
+ /* BUG0_71 Some timings are too short on fast computers. When the party falls in a series of pits, the dungeon view is refreshed too quickly because the execution speed is not limited */
+ /* BUG0_01 While drawing creatures the engine will read invalid ACTIVE_GROUP data in _vm->_groupMan->_g375_activeGroups because the data is for the creatures on the source map and not the map being drawn. The only consequence is that creatures may be drawn with incorrect bitmaps and/or directions */
}
mapIndexDestination = dungeon.getLocationAfterLevelChange(mapIndexDestination, 1, &destMapX, &destMapY);
dungeon.setCurrentMap(mapIndexDestination);