diff options
author | Strangerke | 2016-09-16 21:17:02 +0200 |
---|---|---|
committer | Strangerke | 2016-09-16 22:05:59 +0200 |
commit | f6039153ec37211600355fc71dfb62cbf8da4b68 (patch) | |
tree | 5e96e8e17a053e9e0917c44b85904ac43ad53a16 | |
parent | 60e3b9fd646a3ea7c3fb783ea5b249929b5f289f (diff) | |
download | scummvm-rg350-f6039153ec37211600355fc71dfb62cbf8da4b68.tar.gz scummvm-rg350-f6039153ec37211600355fc71dfb62cbf8da4b68.tar.bz2 scummvm-rg350-f6039153ec37211600355fc71dfb62cbf8da4b68.zip |
DM: Refactor Box()
-rw-r--r-- | engines/dm/champion.cpp | 66 | ||||
-rw-r--r-- | engines/dm/dialog.cpp | 66 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 20 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 18 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 129 | ||||
-rw-r--r-- | engines/dm/gfx.h | 30 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 16 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 16 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 8 | ||||
-rw-r--r-- | engines/dm/text.cpp | 6 |
10 files changed, 185 insertions, 190 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 3712fae0af..bc613df4d8 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -1394,13 +1394,13 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { int16 textPosY; Box blitBox; - blitBox._y1 = 0; + blitBox._rect.top = 0; _vm->_eventMan->showMouse(); if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) { - blitBox._y2 = 28; - blitBox._x1 = textPosX + 7; - blitBox._x2 = blitBox._x1 + 31; /* Box is over the champion portrait in the status box */ + 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(k16_damageToChampionBig), &blitBox, k16_byteWidth, kDMColorFlesh, 29); // Check the number of digits and sets the position accordingly. if (pendingDamage < 10) // 1 digit @@ -1412,9 +1412,9 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() { textPosY = 16; } else { - blitBox._y2 = 6; - blitBox._x1 = textPosX; - blitBox._x2 = blitBox._x1 + 47; /* Box is over the champion name in the status box */ + 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(k15_damageToChampionSmallIndice), &blitBox, k24_byteWidth, kDMColorFlesh, 7); // Check the number of digits and sets the position accordingly. if (pendingDamage < 10) // 1 digit @@ -2064,24 +2064,24 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) { // Strangerke - TO CHECK: if portraits, maybe the old (assembly) code is required for older versions Box box; - box._x1 = champIndex * k69_ChampionStatusBoxSpacing + 46; - box._x2 = box._x1 + 3; - box._y1 = 2; - box._y2 = 26; + box._rect.left = champIndex * k69_ChampionStatusBoxSpacing + 46; + box._rect.right = box._rect.left + 3; + box._rect.top = 2; + box._rect.bottom = 26; for (int16 barGraphIndex = 0; barGraphIndex < 3; barGraphIndex++) { int16 barGraphHeight = barGraphHeights[barGraphIndex]; if (barGraphHeight < 25) { - box._y1 = 2; - box._y2 = 27 - barGraphHeight; + box._rect.top = 2; + box._rect.bottom = 27 - barGraphHeight; _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray); } if (barGraphHeight) { - box._y1 = 27 - barGraphHeight; - box._y2 = 26; + box._rect.top = 27 - barGraphHeight; + box._rect.bottom = 26; _vm->_displayMan->fillScreenBox(box, _championColor[champIndex]); } - box._x1 += 7; - box._x2 += 7; + box._rect.left += 7; + box._rect.right += 7; } _vm->_eventMan->hideMouse(); } @@ -2127,10 +2127,10 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { _vm->_eventMan->showMouse(); if (getFlag(championAttributes, kDMAttributeStatusBox)) { Box box; - box._y1 = 0; - box._y2 = 28; - box._x1 = championStatusBoxX; - box._x2 = box._x1 + 66; + box._rect.top = 0; + box._rect.bottom = 28; + box._rect.left = championStatusBoxX; + box._rect.right = box._rect.left + 66; if (curChampion->_currHealth) { _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray); int16 nativeBitmapIndices[3]; @@ -2185,10 +2185,10 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) { setFlag(championAttributes, kDMAttributeViewport); } else { Box box; - box._y1 = 0; - box._y2 = 6; - box._x1 = championStatusBoxX; - box._x2 = box._x1 + 42; + box._rect.top = 0; + box._rect.bottom = 6; + box._rect.left = championStatusBoxX; + box._rect.right = box._rect.left + 42; _vm->_displayMan->fillScreenBox(box, kDMColorDarkGary); _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, kDMColorDarkGary, curChampion->_name); } @@ -2319,10 +2319,10 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { SlotBox *slotBox = &_vm->_objectMan->_slotBoxes[slotBoxIndex]; Box box; - box._x1 = slotBox->_x - 1; - box._y1 = slotBox->_y - 1; - box._x2 = box._x1 + 17; - box._y2 = box._y1 + 17; + box._rect.left = slotBox->_x - 1; + box._rect.top = slotBox->_y - 1; + box._rect.right = box._rect.left + 17; + box._rect.bottom = box._rect.top + 17; if (!isInventoryChamp) _vm->_eventMan->hideMouse(); @@ -2385,10 +2385,10 @@ void ChampionMan::renameChampion(Champion *champ) { static const char reincarnateSpecialCharacters[6] = {',', '.', ';', ':', ' '}; Box displayBox; - displayBox._y1 = 3; - displayBox._y2 = 8; - displayBox._x1 = 3; - displayBox._x2 = displayBox._x1 + 167; + displayBox._rect.top = 3; + displayBox._rect.bottom = 8; + 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(k27_PanelRenameChampionIndice), _vm->_inventoryMan->_boxPanel, k72_byteWidth, kDMColorCyan, 73); diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp index e982219839..af38bcd0ee 100644 --- a/engines/dm/dialog.cpp +++ b/engines/dm/dialog.cpp @@ -119,11 +119,7 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic } } if (screenDialog) { - Box displayBox; - displayBox._y1 = 33; - displayBox._y2 = 168; - displayBox._x1 = 47; - displayBox._x2 = 270; + Box displayBox(47, 270, 33, 168); _vm->_eventMan->showMouse(); _vm->_displayMan->blitToScreen(_vm->_displayMan->_bitmapViewport, &displayBox, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport); _vm->_eventMan->hideMouse(); @@ -187,62 +183,62 @@ int16 DialogMan::getChoice(uint16 choiceCount, uint16 dialogSetIndex, int16 driv } while (_selectedDialogChoice == 99); _vm->_displayMan->_useByteBoxCoordinates = false; Box boxA = _vm->_eventMan->_primaryMouseInput[_selectedDialogChoice - 1]._hitbox; - boxA._x1 -= 3; - boxA._x2 += 3; - boxA._y1 -= 3; - boxA._y2 += 4; + boxA._rect.left -= 3; + boxA._rect.right += 3; + boxA._rect.top -= 3; + boxA._rect.bottom += 4; _vm->_eventMan->showMouse(); _vm->_displayMan->_drawFloorAndCeilingRequested = true; - Box boxB(0, 0, boxA._x2 - boxA._x1 + 3, boxA._y2 - boxA._y1 + 3); + Box boxB(0, 0, boxA._rect.right - boxA._rect.left + 3, boxA._rect.bottom - boxA._rect.top + 3); _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _vm->_displayMan->_bitmapViewport, - boxB, boxA._x1, boxA._y1, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 25); + boxB, boxA._rect.left, boxA._rect.top, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 25); _vm->delay(1); boxB = boxA; - boxB._y2 = boxB._y1; + boxB._rect.bottom = boxB._rect.top; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; - boxB._x2 = boxB._x1; - boxB._y2--; + boxB._rect.right = boxB._rect.left; + boxB._rect.bottom--; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; - boxB._y2--; - boxB._y1 = boxB._y2; - boxB._x1 -= 2; + boxB._rect.bottom--; + boxB._rect.top = boxB._rect.bottom; + boxB._rect.left -= 2; _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); boxB = boxA; - boxB._x1 = boxB._x2; + boxB._rect.left = boxB._rect.right; _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); _vm->delay(2); boxB = boxA; - boxB._y1++; - boxB._y2 = boxB._y1; - boxB._x2 -= 2; + boxB._rect.top++; + boxB._rect.bottom = boxB._rect.top; + boxB._rect.right -= 2; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; - boxB._x1++; - boxB._x2 = boxB._x1; - boxB._y2--; + boxB._rect.left++; + boxB._rect.right = boxB._rect.left; + boxB._rect.bottom--; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown); boxB = boxA; - boxB._x2--; - boxB._x1 = boxB._x2; + boxB._rect.right--; + boxB._rect.left = boxB._rect.right; _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); boxB = boxA; - boxB._y1 = boxB._y2 = boxB._y2 - 2; - boxB._x1++; + boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom - 2; + boxB._rect.left++; _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack); boxB = boxA; - boxB._y1 = boxB._y2 = boxB._y2 + 2; - boxB._x1--; - boxB._x2 += 2; + boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom + 2; + boxB._rect.left--; + boxB._rect.right += 2; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray); boxB = boxA; - boxB._x1 = boxB._x2 = boxB._x2 + 3; - boxB._y2 += 2; + boxB._rect.left = boxB._rect.right = boxB._rect.right + 3; + boxB._rect.bottom += 2; _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray); _vm->delay(2); - boxA._x2 += 3; - boxA._y2 += 3; + boxA._rect.right += 3; + boxA._rect.bottom += 3; _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapScreen, boxA, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 25, k200_heightScreen); _vm->_eventMan->hideMouse(); diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 475950c5b9..4355355d48 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -520,11 +520,11 @@ void DMEngine::processEntrance() { Box displayBox(0, 100, 0, 160); for (uint16 idx = 1; idx < 4; idx++) { _displayMan->blitToBitmap(_entranceDoorAnimSteps[0], _entranceDoorAnimSteps[idx], displayBox, idx << 2, 0, k64_byteWidth, k64_byteWidth, kDMColorNoTransparency, 161, 161); - displayBox._x2 -= 4; + displayBox._rect.right -= 4; } - displayBox._x2 = 127; + displayBox._rect.right = 127; for (uint16 idx = 5; idx < 8; idx++) { - displayBox._x1 += 4; + displayBox._rect.left += 4; _displayMan->blitToBitmap(_entranceDoorAnimSteps[4], _entranceDoorAnimSteps[idx], displayBox, 0, 0, k64_byteWidth, k64_byteWidth, kDMColorNoTransparency, 161, 161); } @@ -643,10 +643,10 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) { Common::String displStr = Common::String::format("%s %s", _inventoryMan->_skillLevelNames[skillLevel - 2], _championMan->_baseSkillName[idx]); _textMan->printEndGameString(105, textPosY = textPosY + 8, kDMColorLightestGray, displStr.c_str()); } - championMirrorBox._y1 += 48; - championMirrorBox._y2 += 48; - championPortraitBox._y1 += 48; - championPortraitBox._y1 += 48; + championMirrorBox._rect.top += 48; + championMirrorBox._rect.bottom += 48; + championPortraitBox._rect.top += 48; + championPortraitBox._rect.top += 48; } _displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen); _engineShouldQuit = true; @@ -798,9 +798,9 @@ void DMEngine::openEntranceDoors() { _eventMan->discardAllInput(); _displayMan->updateScreen(); - leftDoorBox._x2 -= 4; + leftDoorBox._rect.right -= 4; leftDoorBlitFrom += 4; - rightDoorBox._x1 += 4; + rightDoorBox._rect.left += 4; delay(3); } @@ -869,7 +869,7 @@ void DMEngine::drawTittle() { delay(1); for (int16 i = 0; i < 18; i++) { delay(2); - Box box(blitCoordinates[i]); + Box box(blitCoordinates[i][0], blitCoordinates[i][1], blitCoordinates[i][2], blitCoordinates[i][3]); _displayMan->blitToBitmap(shrinkedTitle[i], _displayMan->_bitmapScreen, box, 0, 0, blitCoordinates[i][4], k160_byteWidthScreen, kDMColorNoTransparency, blitCoordinates[i][3] - blitCoordinates[i][2] + 1, k200_heightScreen); } delay(25); diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index e5b860d9c8..ffdb62c9cc 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -976,7 +976,7 @@ void EventManager::commandMoveParty(CommandType cmdType) { } uint16 movementArrowIdx = cmdType - kDMCommandMoveForward; Box *highlightBox = &boxMovementArrows[movementArrowIdx]; - commandHighlightBoxEnable(highlightBox->_x1, highlightBox->_x2, highlightBox->_y1, highlightBox->_y2); + commandHighlightBoxEnable(highlightBox->_rect.left, highlightBox->_rect.right, highlightBox->_rect.top, highlightBox->_rect.bottom); int16 partyMapX = _vm->_dungeonMan->_partyMapX; int16 partyMapY = _vm->_dungeonMan->_partyMapY; @@ -1255,10 +1255,10 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane } champMan._partyChampionCount--; Box box; - box._y1 = 0; - box._y2 = 28; - box._x1 = championIndex * k69_ChampionStatusBoxSpacing; - box._x2 = box._x1 + 66; + box._rect.top = 0; + box._rect.bottom = 28; + box._rect.left = championIndex * k69_ChampionStatusBoxSpacing; + box._rect.right = box._rect.left + 66; dispMan._useByteBoxCoordinates = false; dispMan.fillScreenBox(box, kDMColorBlack); dispMan.fillScreenBox(_vm->_championMan->_boxChampionIcons[champMan.getChampionIconIndex(champ->_cell, dunMan._partyDir) * 2], kDMColorBlack); @@ -1479,9 +1479,9 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ memset(tmpBitmap, 0, 32 * 18); Box *curChampionIconBox = &_vm->_championMan->_boxChampionIcons[champIconIndex]; - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_x1, curChampionIconBox->_y1, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); + _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); _vm->_displayMan->blitToBitmapShrinkWithPalChange(tmpBitmap, _mousePointerOriginalColorsChampionIcon, 32, 18, 32, 18, mousePointerIconShadowBox); - _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_x1, curChampionIconBox->_y1, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); + _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18); _vm->_displayMan->fillScreenBox(*curChampionIconBox, kDMColorBlack); _useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(champIconIndex); } else { @@ -1587,7 +1587,7 @@ void EventManager::commandProcessTypes101To108_clickInSpellSymbolsArea(CommandTy uint16 symbolIndex = cmdType - kDMCommandClickInSpellAreaSymbol1; Box *highlightBox = &spellSymbolsAndDelete[symbolIndex]; - commandHighlightBoxEnable(highlightBox->_x1, highlightBox->_x2, highlightBox->_y1, highlightBox->_y2); + commandHighlightBoxEnable(highlightBox->_rect.left, highlightBox->_rect.right, highlightBox->_rect.top, highlightBox->_rect.bottom); _vm->delay(1); highlightBoxDisable(); @@ -1665,7 +1665,7 @@ void EventManager::commandHighlightBoxEnable(int16 x1, int16 x2, int16 y1, int16 void EventManager::highlightBoxDisable() { if (_highlightBoxEnabled == true) { - highlightScreenBox(_highlightScreenBox._x1, _highlightScreenBox._x2, _highlightScreenBox._y1, _highlightScreenBox._y2); + highlightScreenBox(_highlightScreenBox._rect.left, _highlightScreenBox._rect.right, _highlightScreenBox._rect.top, _highlightScreenBox._rect.bottom); _highlightBoxEnabled = false; } } diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 7481f6c726..e7267bff67 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -769,10 +769,10 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton) if (doorButton == kDMDoorButtonD1C) { bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex); - _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._x1 = coordSetRedEagle[0]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._x2 = coordSetRedEagle[1]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._y1 = coordSetRedEagle[2]; - _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._y2 = coordSetRedEagle[3]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.left = coordSetRedEagle[0]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.right = coordSetRedEagle[1]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.top = coordSetRedEagle[2]; + _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.bottom = coordSetRedEagle[3]; } else { doorButtonOrdinal = kDMDerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1); if (!isDerivedBitmapInCache(doorButtonOrdinal)) { @@ -862,27 +862,27 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, byte *destBitmap, const Box &box, uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight) { uint16 srcWidth = srcByteWidth * 2; uint16 destWidth = destByteWidth * 2; - for (uint16 y = 0; y < box._y2 + 1 - box._y1; ++y) { // + 1 for inclusive boundaries - for (uint16 x = 0; x < box._x2 + 1 - box._x1; ++x) { // + 1 for inclusive boundaries + for (uint16 y = 0; y < box._rect.bottom + 1 - box._rect.top; ++y) { // + 1 for inclusive boundaries + for (uint16 x = 0; x < box._rect.right + 1 - box._rect.left; ++x) { // + 1 for inclusive boundaries if (srcX + x < srcWidth && y + srcY < srcHeight - && box._x1 + x < destWidth && y + box._y1 < destHight) { + && box._rect.left + x < destWidth && y + box._rect.top < destHight) { byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; if (srcPixel != transparent) - destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel; + destBitmap[destWidth * (y + box._rect.top) + box._rect.left + x] = srcPixel; } } } } void DisplayMan::fillScreenBox(Box &box, Color color) { - uint16 width = box._x2 + 1 - box._x1; // + 1 for inclusive boundaries - for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries - memset(_bitmapScreen + y * _screenWidth + box._x1, color, sizeof(byte) * width); + uint16 width = box._rect.right + 1 - box._rect.left; // + 1 for inclusive boundaries + for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries + memset(_bitmapScreen + y * _screenWidth + box._rect.left, color, sizeof(byte) * width); } void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height) { - for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries - memset(destBitmap + y * byteWidth * 2 + box._x1, color, sizeof(byte) * (box._x2 - box._x1 + 1)); // + 1 for inclusive boundaries + for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries + memset(destBitmap + y * byteWidth * 2 + box._rect.left, color, sizeof(byte) * (box._rect.right - box._rect.left + 1)); // + 1 for inclusive boundaries } void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box, @@ -894,8 +894,8 @@ void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask byte nextUnitIndex = firstUnitIndex; bool useMask = !(transparent & k0x0080_BlitDoNotUseMask); transparent = (Color)(transparent & ~(k0x0080_BlitDoNotUseMask)); // clear flag 0x0080 - for (byte next_y = box._y1; next_y <= box._y2; next_y++) { // '<=' for inclusive boundaries - for (byte next_x = box._x1; next_x <= box._x2; next_x++) { // '<=' for inclusive boundaries + for (byte next_y = box._rect.top; next_y <= box._rect.bottom; next_y++) { // '<=' for inclusive boundaries + for (byte next_x = box._rect.left; next_x <= box._rect.right; next_x++) { // '<=' for inclusive boundaries byte *nextDestPixel = dest + next_y * destByteWidth * 2 + next_x; byte nextSrcPixel = src[nextUnitIndex]; @@ -1930,7 +1930,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) { if (_vm->_championMan->_party._event73Count_ThievesEye) { isDerivedBitmapInCache(kDMDerivedBitmapThievesEyeVisibleArea); blitToBitmap(_bitmapViewport, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), - boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._x1, _boxThievesEyeViewPortVisibleArea._y1, + boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._rect.left, _boxThievesEyeViewPortVisibleArea._rect.top, k112_byteWidthViewport, 48, kDMColorNoTransparency, 136, 95); byte *bitmap = getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice); blitToBitmap(bitmap, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea), @@ -2061,7 +2061,7 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) { if (_vm->_championMan->_party._event73Count_ThievesEye) { memmove(_tmpBitmap, _bitmapWallSetDoorFrameFront, 32 * 123); blitToBitmap(getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice), - _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._x1 - _boxThievesEyeViewPortVisibleArea._x1, + _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._rect.left - _boxThievesEyeViewPortVisibleArea._rect.left, 0, 48, 16, kDMColorGold, 95, 123); drawWallSetBitmap(_tmpBitmap, doorFrameD0C); } else @@ -2099,7 +2099,7 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->_dungeonViewClickableBoxes[i].setToZero(); for (uint16 i = 0; i < 6; ++i) - _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._x1 = 255; + _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._rect.left = 255; _useFlippedWallAndFootprintsBitmap = (posX + posY + dir) & 1; if (_useFlippedWallAndFootprintsBitmap) { @@ -2530,7 +2530,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex 46, 57, 68 /* D1L Right, D1R Left */ }; - static byte g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets + static byte wallOrnamentCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets /* { X1, X2, Y1, Y2, ByteWidth, Height } */ { {80, 83, 41, 45, 8, 5}, /* D3L */ @@ -2662,7 +2662,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex int16 wallOrnamentIndex = wallOrnOrd; int16 ornNativeBitmapIndex = _currMapWallOrnInfo[wallOrnamentIndex].nativeIndice; int16 wallOrnamentCoordinateSetIndex = _currMapWallOrnInfo[wallOrnamentIndex].coordinateSet; - byte *ornCoordSet = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex]; + byte *ornCoordSet = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex]; bool isAlcove = _vm->_dungeonMan->isWallOrnAnAlcove(wallOrnamentIndex); unsigned char inscriptionString[70]; bool isInscription = (wallOrnamentIndex == _vm->_dungeonMan->_currMapInscriptionWallOrnIndex); @@ -2686,18 +2686,18 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex characterCount++; } Frame blitFrame; - blitFrame._box._x2 = (blitFrame._box._x1 = 112 - (characterCount << 2)) + 7; - blitFrame._box._y1 = (blitFrame._box._y2 = inscriptionLineY[textLineIndex++]) - 7; + blitFrame._box._rect.right = (blitFrame._box._rect.left = 112 - (characterCount << 2)) + 7; + blitFrame._box._rect.top = (blitFrame._box._rect.bottom = inscriptionLineY[textLineIndex++]) - 7; while (characterCount--) { blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, kDMColorFlesh, 8, k136_heightViewport); - blitFrame._box._x1 += 8; - blitFrame._box._x2 += 8; + blitFrame._box._rect.left += 8; + blitFrame._box._rect.right += 8; } } while (*inscrString++ != 129); /* Hexadecimal: 0x81 (Megamax C does not support hexadecimal character constants) */ return isAlcove; } ornNativeBitmapIndex++; - Box tmpBox(ornCoordSet); + Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]); _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn] = tmpBox; _vm->_dungeonMan->_isFacingAlcove = isAlcove; _vm->_dungeonMan->_isFacingViAltar = @@ -2720,12 +2720,12 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex int16 coordinateSetOffset = 0; bool flipHorizontal = (viewWallIndex == kDMViewWallD2RLeft) || (viewWallIndex == kDMViewWallD3RLeft); if (flipHorizontal) - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft]; else if ((viewWallIndex == kDMViewWallD2LRight) || (viewWallIndex == kDMViewWallD3LRight)) - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight]; else { ornNativeBitmapIndex++; - ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront]; + ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront]; if (viewWallIndex == kDMViewWallD2LFront) coordinateSetOffset = 6; else if (viewWallIndex == kDMViewWallD2RFront) @@ -2767,9 +2767,8 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex } } - Box tmpBox(ornCoordSet); - blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox, - blitPosX, 0, + Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]); + blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox, blitPosX, 0, ornCoordSet[4], k112_byteWidthViewport, kDMColorFlesh, ornCoordSet[5], k136_heightViewport); if ((viewWallIndex == kDMViewWallD1CFront) && _championPortraitOrdinal--) { @@ -3209,10 +3208,10 @@ T0115015_DrawProjectileAsObject: } } AL_4_xPos = coordinateSet[0]; - boxByteGreen._y2 = coordinateSet[1]; + boxByteGreen._rect.bottom = coordinateSet[1]; if (!drawProjectileAsObject) { /* If drawing an object that is not a projectile */ AL_4_xPos += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][0]]; - boxByteGreen._y2 += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]]; + boxByteGreen._rect.bottom += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]]; objectShiftIndex++; /* The next object drawn will use the next shift values */ if (L0135_B_DrawAlcoveObjects) { if (objectShiftIndex >= 14) @@ -3220,13 +3219,13 @@ T0115015_DrawProjectileAsObject: } else objectShiftIndex &= 0x000F; } - boxByteGreen._y1 = boxByteGreen._y2 - (heightRedEagle - 1); - if (boxByteGreen._y2 > 135) - boxByteGreen._y2 = 135; + boxByteGreen._rect.top = boxByteGreen._rect.bottom - (heightRedEagle - 1); + if (boxByteGreen._rect.bottom > 135) + boxByteGreen._rect.bottom = 135; - boxByteGreen._x2 = MIN(223, AL_4_xPos + byteWidth); - boxByteGreen._x1 = MAX(0, AL_4_xPos - byteWidth + 1); - if (boxByteGreen._x1) { + boxByteGreen._rect.right = MIN(223, AL_4_xPos + byteWidth); + boxByteGreen._rect.left = MAX(0, AL_4_xPos - byteWidth + 1); + if (boxByteGreen._rect.left) { if (flipHorizontal) AL_4_xPos = paddingPixelCount; else @@ -3239,19 +3238,19 @@ T0115015_DrawProjectileAsObject: Box *AL_6_box = &_vm->_dungeonMan->_dungeonViewClickableBoxes[AL_2_viewCell]; - if (AL_6_box->_x1 == 255) { /* If the grabbable object is the first */ + if (AL_6_box->_rect.left == 255) { /* If the grabbable object is the first */ *AL_6_box = boxByteGreen; - if ((heightGreenGoat = AL_6_box->_y2 - AL_6_box->_y1) < 14) { /* If the box is too small then enlarge it a little */ + if ((heightGreenGoat = AL_6_box->_rect.bottom - AL_6_box->_rect.top) < 14) { /* If the box is too small then enlarge it a little */ heightGreenGoat = heightGreenGoat >> 1; - AL_6_box->_y1 += heightGreenGoat - 7; + AL_6_box->_rect.top += heightGreenGoat - 7; if (heightGreenGoat < 4) - AL_6_box->_y2 -= heightGreenGoat - 3; + AL_6_box->_rect.bottom -= heightGreenGoat - 3; } } else { /* If there are several grabbable objects then enlarge the box so it includes all objects */ - AL_6_box->_x1 = MIN(AL_6_box->_x1, boxByteGreen._x1); - AL_6_box->_x2 = MAX(AL_6_box->_x2, boxByteGreen._x2); - AL_6_box->_y1 = MIN(AL_6_box->_y1, boxByteGreen._y1); - AL_6_box->_y2 = MAX(AL_6_box->_y2, boxByteGreen._y2); + AL_6_box->_rect.left = MIN(AL_6_box->_rect.left, boxByteGreen._rect.left); + AL_6_box->_rect.right = MAX(AL_6_box->_rect.right, boxByteGreen._rect.right); + AL_6_box->_rect.top = MIN(AL_6_box->_rect.top, boxByteGreen._rect.top); + AL_6_box->_rect.bottom = MAX(AL_6_box->_rect.bottom, boxByteGreen._rect.bottom); } bitmapRedBanana = bitmapGreenAnt; _vm->_dungeonMan->_pileTopObject[AL_2_viewCell] = thingParam; /* The object is at the top of the pile */ @@ -3471,8 +3470,8 @@ T0115077_DrawSecondHalfSquareCreature: } AL_4_yPos = coordinateSet[1]; AL_4_yPos += shiftSets[AL_8_shiftSetIndex][getVerticalOffsetM23(creatureAspectInt)]; - boxByteGreen._y2 = MIN(AL_4_yPos, (int16)135); - boxByteGreen._y1 = MAX(0, AL_4_yPos - (heightRedEagle - 1)); + boxByteGreen._rect.bottom = MIN(AL_4_yPos, (int16)135); + boxByteGreen._rect.top = MAX(0, AL_4_yPos - (heightRedEagle - 1)); AL_4_xPos = coordinateSet[0]; AL_4_xPos += shiftSets[AL_8_shiftSetIndex][getHorizontalOffsetM22(creatureAspectInt)]; @@ -3481,14 +3480,14 @@ T0115077_DrawSecondHalfSquareCreature: else if (viewLane != kDMViewLaneCenter) /* Lane right */ AL_4_xPos += 100; - boxByteGreen._x2 = CLIP(0, AL_4_xPos + byteWidth, 223); + boxByteGreen._rect.right = CLIP(0, AL_4_xPos + byteWidth, 223); - if (!boxByteGreen._x2) + if (!boxByteGreen._rect.right) goto T0115126_CreatureNotVisible; int16 AL_0_creaturePosX; - boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223); - if (boxByteGreen._x1) { - if (boxByteGreen._x1 == 223) + boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223); + if (boxByteGreen._rect.left) { + if (boxByteGreen._rect.left == 223) goto T0115126_CreatureNotVisible; AL_0_creaturePosX = creaturePaddingPixelCount; } else @@ -3609,11 +3608,11 @@ T0115129_DrawProjectiles: if (flipHorizontal) flipBitmapHorizontal(bitmapRedBanana, AL_4_normalizdByteWidth, heightRedEagle); } - boxByteGreen._y2 = (heightRedEagle >> 1) + 47; - boxByteGreen._y1 = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001); - boxByteGreen._x2 = MIN(223, projectilePosX + byteWidth); - boxByteGreen._x1 = MAX(0, projectilePosX - byteWidth + 1); - if (boxByteGreen._x1) { + boxByteGreen._rect.bottom = (heightRedEagle >> 1) + 47; + boxByteGreen._rect.top = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001); + boxByteGreen._rect.right = MIN(223, projectilePosX + byteWidth); + boxByteGreen._rect.left = MAX(0, projectilePosX - byteWidth + 1); + if (boxByteGreen._rect.left) { if (flipHorizontal) AL_4_xPos = paddingPixelCount; else @@ -3732,19 +3731,19 @@ T0115200_DrawExplosion: if (flipHorizontal) paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; /* Number of unused pixels in the units on the right of the bitmap */ - boxByteGreen._y2 = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1)); + boxByteGreen._rect.bottom = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1)); AL_4_yPos = MAX(0, explosionCoordinates[1] - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001)); if (AL_4_yPos >= 136) continue; - boxByteGreen._y1 = AL_4_yPos; + boxByteGreen._rect.top = AL_4_yPos; AL_4_xPos = MIN(223, explosionCoordinates[0] + byteWidth); if (AL_4_xPos < 0) continue; - boxByteGreen._x2 = AL_4_xPos; + boxByteGreen._rect.right = AL_4_xPos; AL_4_xPos = explosionCoordinates[0]; - boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223); + boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223); - if (boxByteGreen._x1) + if (boxByteGreen._rect.left) AL_4_xPos = paddingPixelCount; else { AL_4_xPos = MAX(paddingPixelCount, int16(byteWidth - AL_4_xPos - 1)); /* BUG0_07 Graphical glitch when drawing explosions. If an explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is not flipped horizontally (flipHorizontal = false) then the variable paddingPixelCount is not set before being used here. Its previous value (defined while drawing something else) is used and may cause an incorrect bitmap to be drawn */ @@ -3752,7 +3751,7 @@ T0115200_DrawExplosion: /* BUG0_06 Graphical glitch when drawing projectiles or explosions. If a projectile or explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is flipped horizontally (flipHorizontal = true) then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingPixelCount" must be added to the second parameter of this function call */ } - if (boxByteGreen._x2 <= boxByteGreen._x1) + if (boxByteGreen._rect.right <= boxByteGreen._rect.left) continue; byteWidth = getNormalizedByteWidth(byteWidth); diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index e8cdb2927a..6fc6253a9e 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -371,25 +371,25 @@ public: // in all cases, where a function takes a Box, it expects it to contain inclusive boundaries class Box { public: - int16 _x1; - int16 _x2; - int16 _y1; - int16 _y2; + Common::Rect _rect; - Box(int16 x1, int16 x2, int16 y1, int16 y2) : _x1(x1), _x2(x2), _y1(y1), _y2(y2) {} - Box() {} - template <typename T> - explicit Box(T *ptr) { - _x1 = *ptr++; - _x2 = *ptr++; - _y1 = *ptr++; - _y2 = *ptr++; + Box(int16 x1, int16 x2, int16 y1, int16 y2) { + // +1 because Rect.constains is not inclusive for right and bottom, at the opposite of the isPointInside + _rect = Common::Rect(x1, y1, x2, y2); } + + Box() {} + bool isPointInside(Common::Point point) { - return (_x1 <= point.x) && (point.x <= _x2) && (_y1 <= point.y) && (point.y <= _y2); // <= because incluseive boundaries + // not using Common::Rect::contains() because we need both boundaries to be included + return (_rect.left <= point.x) && (point.x <= _rect.right) && (_rect.top <= point.y) && (point.y <= _rect.bottom); } - bool isPointInside(int16 x, int16 y) { return isPointInside(Common::Point(x, y)); } - void setToZero() { _x1 = _x2 = _y1 = _y2 = 0; } + + bool isPointInside(int16 x, int16 y) { + return isPointInside(Common::Point(x, y)); + } + + void setToZero() { _rect = Common::Rect(0, 0, 0, 0); } }; // @ BOX_BYTE, BOX_WORD extern Box g2_BoxMovementArrows; // @ G0002_s_Graphic562_Box_MovementArrows diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 0b07cf0d22..92843ee041 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -166,19 +166,19 @@ void InventoryMan::drawStatusBoxPortrait(ChampionIndex championIndex) { DisplayMan &dispMan = *_vm->_displayMan; dispMan._useByteBoxCoordinates = false; Box box; - box._y1 = 0; - box._y2 = 28; - box._x1 = championIndex * k69_ChampionStatusBoxSpacing + 7; - box._x2 = box._x1 + 31; + box._rect.top = 0; + box._rect.bottom = 28; + box._rect.left = championIndex * k69_ChampionStatusBoxSpacing + 7; + box._rect.right = box._rect.left + 31; dispMan.blitToScreen(_vm->_championMan->_champions[championIndex]._portrait, &box, k16_byteWidth, kDMColorNoTransparency, 29); } void InventoryMan::drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) { Box box; - box._x1 = x; - box._x2 = box._x1 + pixelWidth; - box._y1 = y; - box._y2 = box._y1 + 6; + 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); } diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 4481c0451c..2e5f92f993 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -191,10 +191,10 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) { Champion &champion = _vm->_championMan->_champions[championIndex]; Box box; - box._x1 = championIndex * 22 + 233; - box._x2 = box._x1 + 19; - box._y1 = 86; - box._y2 = 120; + box._rect.left = championIndex * 22 + 233; + box._rect.right = box._rect.left + 19; + box._rect.top = 86; + box._rect.bottom = 120; dm._useByteBoxCoordinates = false; if (!champion._currHealth) { dm.fillScreenBox(box, kDMColorBlack); @@ -216,10 +216,10 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) { T0386006: dm.fillScreenBox(box, kDMColorCyan); Box box2; - box2._x1 = box._x1 + 2; - box2._x2 = box._x2 - 2; - box2._y1 = 95; - box2._y2 = 110; + box2._rect.left = box._rect.left + 2; + box2._rect.right = box._rect.right - 2; + box2._rect.top = 95; + box2._rect.bottom = 110; dm.blitToScreen(bitmapIcon, &box2, k8_byteWidth, kDMColorNoTransparency, 16); if (champion.getAttributes(kDMAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) { _vm->_displayMan->shadeScreenBox(&box, kDMColorBlack); diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 76b40d52e8..5b3407b42a 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -205,10 +205,10 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { return; Box blitBox; - blitBox._x1 = slotBox->_x; - blitBox._x2 = blitBox._x1 + 15; - blitBox._y1 = slotBox->_y; - blitBox._y2 = blitBox._y1 + 15; + blitBox._rect.left = slotBox->_x; + blitBox._rect.right = blitBox._rect.left + 15; + blitBox._rect.top = slotBox->_y; + blitBox._rect.bottom = blitBox._rect.top + 15; uint16 iconGraphicIndex; for (iconGraphicIndex = 0; iconGraphicIndex < 7; iconGraphicIndex++) { diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index 65b83caf15..a006c6efc5 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -192,13 +192,13 @@ void TextMan::moveCursor(int16 column, int16 row) { void TextMan::clearExpiredRows() { _vm->_displayMan->_useByteBoxCoordinates = false; Box displayBox; - displayBox._x1 = 0; - displayBox._x2 = 319; + displayBox._rect.left = 0; + displayBox._rect.right = 319; for (uint16 rowIndex = 0; rowIndex < 4; rowIndex++) { int32 expirationTime = _messageAreaRowExpirationTime[rowIndex]; if ((expirationTime == -1) || (expirationTime > _vm->_gameTime) || _isScrolling) continue; - displayBox._y2 = (displayBox._y1 = 172 + (rowIndex * 7)) + 6; + displayBox._rect.bottom = (displayBox._rect.top = 172 + (rowIndex * 7)) + 6; isTextScrolling(&_textScroller, true); _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapScreen, displayBox, kDMColorBlack, k160_byteWidthScreen, k200_heightScreen); _messageAreaRowExpirationTime[rowIndex] = -1; |