From ec0b26ce795c9f5d7ecb12a642f444183b52348e Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Sun, 3 Jul 2016 01:06:54 +0200 Subject: DM: Reorder blitting method parameters --- engines/dm/champion.cpp | 37 ++++++++++++++++--------------------- engines/dm/gfx.cpp | 39 +++++++++++++++++++-------------------- engines/dm/gfx.h | 4 ++-- engines/dm/inventory.cpp | 36 +++++++++++++----------------------- engines/dm/menus.cpp | 22 +++++++++++----------- engines/dm/objectman.cpp | 10 ++++------ engines/dm/text.cpp | 3 +-- 7 files changed, 66 insertions(+), 85 deletions(-) (limited to 'engines') diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 7986650644..8cac2c732a 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -48,7 +48,7 @@ Color g46_ChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14}; int16 g39_LightPowerToLightAmount[16] = {0, 5, 12, 24, 33, 40, 46, 51, 59, 68, 76, 82, 89, 94, 97, 100}; uint16 gSlotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks - /* 30 for champion inventory, 8 for chest */ + /* 30 for champion inventory, 8 for chest */ 0xFFFF, /* Ready Hand Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ 0xFFFF, /* Action Hand Mouth/Head/Neck/Torso/Legs/Feet/Quiver 1/Quiver 2/Pouch/Hands/Chest */ 0x0002, /* Head Head */ @@ -414,10 +414,10 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch ((Junk*)rawObjPtr)->setChargeCount(1); _g407_party._magicalLightAmount += g39_LightPowerToLightAmount[2]; warning("MISSING CODE: F0337_INVENTORY_SetDungeonViewPalette"); - iconIndex = (IconIndice) (iconIndex + 1); + iconIndex = (IconIndice)(iconIndex + 1); } else if ((iconIndex >= k10_IconIndiceJunkJewelSymalUnequipped) && (iconIndex <= k11_IconIndiceJunkJewelSymalEquipped)) { ((Junk*)rawObjPtr)->setChargeCount(1); - iconIndex = (IconIndice) (iconIndex + 1); + iconIndex = (IconIndice)(iconIndex + 1); } } @@ -461,8 +461,7 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) dispMan._g578_useByteBoxCoordinates = true; { // limit destBox scope Box &destBox = gBoxChampionPortrait; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k26_ChampionPortraitsIndice), 256, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), - champ->_portrait, 32, destBox, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k26_ChampionPortraitsIndice), champ->_portrait, destBox, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), 256, 32, k255_ColorNoTransparency); } champ->_actionIndex = k255_ChampionActionNone; @@ -751,8 +750,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { if (_g407_party._shieldDefense > 0) nativeBitmapIndices[AL_0_borderCount++] = k37_BorderPartyShieldIndice; while (AL_0_borderCount--) { - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(nativeBitmapIndices[AL_0_borderCount]), 80, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, box, k10_ColorFlesh); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(nativeBitmapIndices[AL_0_borderCount]), dispMan._g348_bitmapScreen, box, 0, 0, 80, k160_byteWidthScreen * 2, k10_ColorFlesh); } if (isInventoryChamp) { invMan.f354_drawStatusBoxPortrait(champIndex); @@ -761,8 +759,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { champAttributes |= (k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x2000_ChampionAttributeWounds | k0x8000_ChampionAttributeActionHand); } } else { - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k8_StatusBoxDeadChampion), 80, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, box, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k8_StatusBoxDeadChampion), dispMan._g348_bitmapScreen, box, 0, 0, 80, k160_byteWidthScreen * 2, k255_ColorNoTransparency); _vm->_textMan->f53_printToLogicalScreen(champStatusBoxX + 1, 5, k13_ColorLightestGray, k1_ColorDarkGary, champ->_name); menuMan.f386_drawActionIcon(champIndex); goto T0292042_green; @@ -804,8 +801,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } else { AL_2_nativeBitmapIndex = k33_SlotBoxNormalIndice; } - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), 32, 0, 0, - dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, gBoxMouth, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport, gBoxMouth, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray); AL_2_nativeBitmapIndex = k33_SlotBoxNormalIndice; for (int16 AL_0_statisticIndex = k1_ChampionStatStrength; AL_0_statisticIndex <= k6_ChampionStatAntifire; AL_0_statisticIndex++) { if (champ->getStatistic((ChampionStatisticType)AL_0_statisticIndex, k1_ChampionStatCurrent) @@ -814,8 +810,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { break; } } - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), 32, 0, 0, - dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, gBoxEye, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport, gBoxEye, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray); champAttributes |= k0x4000_ChampionAttributeViewport; } } @@ -858,8 +853,11 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { if ((champAttributes & k28_ChampionIcons) && (eventMan._g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(AL_0_championIconIndex))) { dispMan.D24_clearScreenBox(g46_ChampionColor[champIndex], g54_BoxChampionIcons[AL_0_championIconIndex]); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k28_ChampionIcons), 80, M26_championIconIndex(champ->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g54_BoxChampionIcons[AL_0_championIconIndex], k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k28_ChampionIcons), + dispMan._g348_bitmapScreen, + g54_BoxChampionIcons[AL_0_championIconIndex << 2], + M26_championIconIndex(champ->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, + 40 * 2, k160_byteWidthScreen * 2, k12_ColorDarkestGray); } } @@ -980,11 +978,9 @@ void ChampionMan::f291_drawSlot(uint16 champIndex, ChampionSlot slotIndex) { if (nativeBitmapIndex != -1) { _vm->_displayMan->_g578_useByteBoxCoordinates = false; if (isInventoryChamp) { - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(nativeBitmapIndex), 32, 0, 0, - _vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport * 2, box, k12_ColorDarkestGray); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(nativeBitmapIndex), _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray); } else { - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(nativeBitmapIndex), 32, 0, 0, - _vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen * 2, box, k12_ColorDarkestGray); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(nativeBitmapIndex), _vm->_displayMan->_g348_bitmapScreen, box, 0, 0, 32, k160_byteWidthScreen * 2, k12_ColorDarkestGray); } } @@ -1008,8 +1004,7 @@ void ChampionMan::f281_renameChampion(Champion* champ) { box._x2 = box._x1 + 167; dispMan.f135_fillBoxBitmap(dispMan._g296_bitmapViewport, box, k12_ColorDarkestGray, k112_byteWidthViewport * 2, k136_heightViewport); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k27_PanelRenameChampionIndice), 144, 0, 0, - dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, g32_BoxPanel, k4_ColorCyan); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k27_PanelRenameChampionIndice), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k4_ColorCyan); textMan.f52_printToViewport(177, 58, k13_ColorLightestGray, "_______"); textMan.f52_printToViewport(105, 76, k13_ColorLightestGray, "___________________"); Common::Point clickPos; diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index a21d8213e1..a91d6ee7a8 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -955,7 +955,7 @@ void DisplayMan::f566_viewportBlitToScreen() { warning("MISSING FUNCTIONALITY: using correct colorpalette"); Box box(0, 223, 33, 33 + 135); - f132_blitToBitmap(_g296_bitmapViewport, k112_byteWidthViewport * 2, 0, 0, _g348_bitmapScreen, k160_byteWidthScreen * 2, box, k255_ColorNoTransparency); + f132_blitToBitmap(_g296_bitmapViewport, _g348_bitmapScreen, box, 0, 0, k112_byteWidthViewport * 2, k160_byteWidthScreen * 2, k255_ColorNoTransparency); } void DisplayMan::loadPalette(uint16 *palette) { @@ -1017,15 +1017,14 @@ void DisplayMan::f466_loadIntoBitmap(uint16 index, byte *destBitmap) { } } - -void DisplayMan::f132_blitToBitmap(byte* srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte* destBitmap, uint16 destWidth, Box& box, Color transparent) { +void DisplayMan::f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcWidth, + uint16 destWidth, Color transparent) { for (uint16 y = 0; y < box._y2 - box._y1; ++y) for (uint16 x = 0; x < box._x2 - box._x1; ++x) { byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; if (srcPixel != transparent) destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel; } - } void DisplayMan::D24_clearScreenBox(Color color, Box &box) { @@ -1153,12 +1152,12 @@ void DisplayMan::f99_copyBitmapAndFlipHorizontal(byte* srcBitmap, byte* destBitm void DisplayMan::f101_drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) { if (f._srcWidth) - f132_blitToBitmap(bitmap, f._srcWidth, f._srcX, f._srcY, _g296_bitmapViewport, k112_byteWidthViewport * 2, f._box, k255_ColorNoTransparency); + f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k255_ColorNoTransparency); } void DisplayMan::f100_drawWallSetBitmap(byte *bitmap, Frame &f) { if (f._srcWidth) - f132_blitToBitmap(bitmap, f._srcWidth, f._srcX, f._srcY, _g296_bitmapViewport, k112_byteWidthViewport * 2, f._box, k10_ColorFlesh); + f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); } @@ -1621,12 +1620,12 @@ void DisplayMan::f96_loadCurrentMapGraphics() { f99_copyBitmapAndFlipHorizontal(_g95_bitmapWall_D3LCR_Native = _g698_bitmapWallSet_Wall_D3LCR, _g74_tmpBitmap, g163_FrameWalls[k0_ViewSquare_D3C]._srcWidth, g163_FrameWalls[k0_ViewSquare_D3C]._srcHeight); f134_fillBitmap(_g90_bitmapWall_D3LCR_Flipped, 128, 51, k10_ColorFlesh); - f132_blitToBitmap(_g74_tmpBitmap, 128, 11, 0, _g90_bitmapWall_D3LCR_Flipped, 128, g161_BoxWallBitmap_D3LCR, k255_ColorNoTransparency); + f132_blitToBitmap(_g74_tmpBitmap, _g90_bitmapWall_D3LCR_Flipped, g161_BoxWallBitmap_D3LCR, 11, 0, 128, 128, k255_ColorNoTransparency); f99_copyBitmapAndFlipHorizontal(_g96_bitmapWall_D2LCR_Native = _g699_bitmapWallSet_Wall_D2LCR, _g74_tmpBitmap, g163_FrameWalls[k3_ViewSquare_D2C]._srcWidth, g163_FrameWalls[k3_ViewSquare_D2C]._srcHeight); f134_fillBitmap(_g91_bitmapWall_D2LCR_Flipped, 144, 71, k10_ColorFlesh); - f132_blitToBitmap(_g74_tmpBitmap, 144, 8, 0, _g91_bitmapWall_D2LCR_Flipped, 144, g162_BoxWallBitmap_D2LCR, k255_ColorNoTransparency); + f132_blitToBitmap(_g74_tmpBitmap, _g91_bitmapWall_D2LCR_Flipped, g162_BoxWallBitmap_D2LCR, 8, 0, 144, 144, k255_ColorNoTransparency); f99_copyBitmapAndFlipHorizontal(_g97_bitmapWall_D1LCR_Native = _g700_bitmapWallSet_Wall_D1LCR, _g92_bitmapWall_D1LCR_Flipped, g163_FrameWalls[k6_ViewSquare_D1C]._srcWidth, g163_FrameWalls[k6_ViewSquare_D1C]._srcHeight); @@ -1733,13 +1732,13 @@ void DisplayMan::f93_applyCreatureReplColors(int replacedColor, int replacementC void DisplayMan::f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &f) { if (f._srcWidth) - f132_blitToBitmap(_bitmaps[nativeIndex], f._srcWidth, f._srcX, f._srcY, _g296_bitmapViewport, k112_byteWidthViewport * 2, f._box, k10_ColorFlesh); + f132_blitToBitmap(_bitmaps[nativeIndex], _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); } void DisplayMan::f105_drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &f) { if (f._srcWidth) { f99_copyBitmapAndFlipHorizontal(f489_getBitmap(nativeIndex), _g74_tmpBitmap, f._srcWidth, f._srcHeight); - f132_blitToBitmap(_g74_tmpBitmap, f._srcWidth, f._srcX, f._srcY, _g296_bitmapViewport, k112_byteWidthViewport * 2, f._box, k10_ColorFlesh); + f132_blitToBitmap(_g74_tmpBitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); } } @@ -1804,8 +1803,8 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall if (viewWallIndex == k12_ViewWall_D1C_FRONT) { if (isInscription) { Frame &D1CFrame = g163_FrameWalls[k6_ViewSquare_D1C]; - f132_blitToBitmap(_g700_bitmapWallSet_Wall_D1LCR, D1CFrame._srcWidth, 94, 28, _g296_bitmapViewport, k112_byteWidthViewport * 2, - g202_BoxWallPatchBehindInscription, k255_ColorNoTransparency); + f132_blitToBitmap(_g700_bitmapWallSet_Wall_D1LCR, _g296_bitmapViewport, g202_BoxWallPatchBehindInscription, 94, 28, + D1CFrame._srcWidth, k112_byteWidthViewport * 2, k255_ColorNoTransparency); unsigned char *string = inscriptionString; bitmapRed = _bitmaps[k120_InscriptionFontIndice]; @@ -1819,7 +1818,7 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall frame._box._x2 = (frame._box._x1 = 112 - (characterCount * 4)) + 7; frame._box._y1 = (frame._box._y2 = g203_InscriptionLineY[textLineIndex++]) - 7; while (characterCount--) { - f132_blitToBitmap(bitmapRed, 288, (*string++) * 8, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, frame._box, k10_ColorFlesh); + f132_blitToBitmap(bitmapRed, _g296_bitmapViewport, frame._box, (*string++) * 8, 0, 288, k112_byteWidthViewport * 2, k10_ColorFlesh); frame._box._x1 += 8; frame._box._x2 += 8; } @@ -1905,12 +1904,12 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall coordinateSetA[3] = g204_UnreadableInscriptionBoxY2[g190_WallOrnDerivedBitmapIndexIncrement[viewWallIndex] * 3 + unreadableTextLineCount - 1]; } } - f132_blitToBitmap(bitmapGreen, coordinateSetA[4], var_X, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, *(Box*)coordinateSetA, k10_ColorFlesh); + f132_blitToBitmap(bitmapGreen, _g296_bitmapViewport, *(Box*)coordinateSetA, var_X, 0, coordinateSetA[4], k112_byteWidthViewport * 2, k10_ColorFlesh); if ((viewWallIndex == k12_ViewWall_D1C_FRONT) && _g289_championPortraitOrdinal--) { Box &box = g109_BoxChampionPortraitOnWall; - f132_blitToBitmap(_bitmaps[k26_ChampionPortraitsIndice], 256, (_g289_championPortraitOrdinal & 0x7) << 5, (_g289_championPortraitOrdinal >> 3) * 29, - _g296_bitmapViewport, k112_byteWidthViewport * 2, box, k1_ColorDarkGary); + f132_blitToBitmap(_bitmaps[k26_ChampionPortraitsIndice], _g296_bitmapViewport, box, (_g289_championPortraitOrdinal & 0x7) << 5, + (_g289_championPortraitOrdinal >> 3) * 29, 256, k112_byteWidthViewport * 2, k1_ColorDarkGary); } return isAlcove; } @@ -2417,7 +2416,7 @@ T0115015_DrawProjectileAsObject: AL_6_bitmapRedBanana = bitmapGreenAnt; dunMan._g292_pileTopObject[AL_2_viewCell] = thingParam; /* The object is at the top of the pile */ } - f132_blitToBitmap(AL_6_bitmapRedBanana, byteWidth, AL_4_xPos, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, boxByteGreen, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); if (drawProjectileAsObject) goto T0115171_BackFromT0115015_DrawProjectileAsObject; @@ -2668,7 +2667,7 @@ T0115077_DrawSecondHalfSquareCreature: AL_0_creaturePosX = creaturePaddingPixelCount + (byteWidth - AL_4_xPos - 1); } warning("SUPER WARNINIG: we might nee noralized with on byteWidth"); - f132_blitToBitmap(AL_6_bitmapRedBanana, byteWidth, AL_0_creaturePosX, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, boxByteGreen, (Color)transparentColor); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_0_creaturePosX, 0, byteWidth, k112_byteWidthViewport * 2, (Color)transparentColor); T0115126_CreatureNotVisible: if (twoHalfSquareCreaturesFrontView) { @@ -2803,7 +2802,7 @@ the bitmap is flipped horizontally (flipHorizontal = C1_TRUE) then a wrong part screen. To fix this bug, "+ paddingPixelCount" must be added to the second parameter of this function call */ AL_4_xPos = MAX(paddingPixelCount, (int16)(byteWidth - projectilePosX - 1)); } - f132_blitToBitmap(AL_6_bitmapRedBanana, byteWidth, AL_4_xPos, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, boxByteGreen, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); } else { /* Positive value: projectile aspect is the index of a OBJECT_ASPECT */ useAlcoveObjectImage = false; projectileCoordinates[0] = projectilePosX; @@ -2955,7 +2954,7 @@ then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingP if (flipVertical) { flipBitmapVertical(AL_6_bitmapRedBanana, byteWidth, heightRedEagle); } - f132_blitToBitmap(AL_6_bitmapRedBanana, byteWidth, AL_4_xPos, 0, _g296_bitmapViewport, k112_byteWidthViewport * 2, boxByteGreen, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); } } } while ((thingParam = dunMan.f159_getNextThing(thingParam)) != Thing::_endOfList); diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index a0a61ba78f..1305322e72 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -547,8 +547,8 @@ public: void f99_copyBitmapAndFlipHorizontal(byte *srcBitmap, byte *destBitmap, uint16 byteWidth, uint16 height); - void f132_blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, - byte *destBitmap, uint16 destWidth, Box &box, Color transparent = k255_ColorNoTransparency); // @ F0132_VIDEO_Blit + void f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcWidth, + uint16 destWidth, Color transparent = k255_ColorNoTransparency); // @ F0132_VIDEO_Blit void f133_blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent, diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 1d1eb5e8c9..9718a57be2 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -128,8 +128,7 @@ void InventoryMan::f354_drawStatusBoxPortrait(ChampionIndex championIndex) { box._y2 = 28 + 1; box._x1 = championIndex * k69_ChampionStatusBoxSpacing + 7; box._x2 = box._x1 + 31 + 1; - dispMan.f132_blitToBitmap(_vm->_championMan->_gK71_champions[championIndex]._portrait, 32, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, box, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(_vm->_championMan->_gK71_champions[championIndex]._portrait, dispMan._g348_bitmapScreen, box, 0, 0, 32, k160_byteWidthScreen * 2, k255_ColorNoTransparency); } void InventoryMan::f343_drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) { @@ -162,15 +161,11 @@ void InventoryMan::f345_drawPanelFoodWaterPoisoned() { Champion &champ = _vm->_championMan->_gK71_champions[_g432_inventoryChampionOrdinal]; f334_closeChest(); DisplayMan &dispMan = *_vm->_displayMan; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k20_PanelEmptyIndice), 144, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g32_BoxPanel, k8_ColorRed); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k30_FoodLabelIndice), 48, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g35_BoxFood, k12_ColorDarkestGray); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k31_WaterLabelIndice), 48, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g36_BoxWater, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k20_PanelEmptyIndice), dispMan._g348_bitmapScreen, g32_BoxPanel, 0, 0, 144, k160_byteWidthScreen * 2, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k30_FoodLabelIndice), dispMan._g348_bitmapScreen, g35_BoxFood, 0, 0, 48, k160_byteWidthScreen * 2, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k31_WaterLabelIndice), dispMan._g348_bitmapScreen, g36_BoxWater, 0, 0, 48, k160_byteWidthScreen * 2, k12_ColorDarkestGray); if (champ._poisonEventCount) { - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k32_PoisionedLabelIndice), 96, 0, 0, - dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g37_BoxPoisoned, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k32_PoisionedLabelIndice), dispMan._g348_bitmapScreen, g37_BoxPoisoned, 0, 0, 96, k160_byteWidthScreen * 2, k12_ColorDarkestGray); } f344_drawPanelFoodOrWaterBar(champ._food, 69, k5_ColorLightBrown); f344_drawPanelFoodOrWaterBar(champ._water, 92, k14_ColorBlue); @@ -178,8 +173,7 @@ void InventoryMan::f345_drawPanelFoodWaterPoisoned() { void InventoryMan::f346_drawPanelResurrectReincarnate() { _g424_panelContent = k5_PanelContentResurrectReincarnate; - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(k40_PanelResurectReincaranteIndice), 144, 0, 0, - _vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport * 2, g32_BoxPanel, k6_ColorDarkGreen); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(k40_PanelResurectReincaranteIndice), _vm->_displayMan->_g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k6_ColorDarkGreen); } void InventoryMan::f347_drawPanel() { @@ -262,7 +256,7 @@ void InventoryMan::f341_drawPanelScroll(Scroll* scroll) { charRed++; } *charRed = '\0'; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k23_PanelOpenScrollIndice), 144, 0, 0, dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, g32_BoxPanel, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k23_PanelOpenScrollIndice), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k8_ColorRed); int16 lineCount = 1; charRed++; char *charGreen = charRed; // first char of the second line @@ -314,7 +308,7 @@ void InventoryMan::f333_openAndDrawChest(Thing thingToOpen, Container* chest, bo if (!isPressingEye) { objMan.f38_drawIconInSlotBox(k9_SlotBoxInventoryActionHand, k145_IconIndiceContainerChestOpen); } - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k25_PanelOpenChestIndice), 144, 0, 0, dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g32_BoxPanel, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k25_PanelOpenChestIndice), dispMan._g348_bitmapScreen, g32_BoxPanel, 0, 0, 144, k160_byteWidthScreen * 2, k8_ColorRed); int16 chestSlotIndex = 0; Thing thing = chest->getSlot(); @@ -340,8 +334,7 @@ void InventoryMan::f332_drawIconToViewport(IconIndice iconIndex, int16 xPos, int box._x2 = (box._x1 = xPos) + 15 + 1; box._y2 = (box._y1 = yPos) + 15 + 1; _vm->_objectMan->f36_extractIconFromBitmap(iconIndex, iconBitmap); - _vm->_displayMan->f132_blitToBitmap(iconBitmap, 16, 0, 0, _vm->_displayMan->_g296_bitmapViewport, - k112_byteWidthViewport * 2, box, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconBitmap, _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport * 2, k255_ColorNoTransparency); } void InventoryMan::f336_buildObjectAttributeString(int16 potentialAttribMask, int16 actualAttribMask, char** attribStrings, char* destString, char* prefixString, char* suffixString) { @@ -415,8 +408,7 @@ Box g33_BoxArrowOrEye = Box(83, 98, 57, 65); // @ G0033_s_Graphic562_Box_ArrowOr void InventoryMan::f339_drawPanelArrowOrEye(bool pressingEye) { DisplayMan &dispMan = *_vm->_displayMan; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(pressingEye ? k19_EyeForObjectDescriptionIndice : k18_ArrowForChestContentIndice), - 16, 0, 0, dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, g33_BoxArrowOrEye, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(pressingEye ? k19_EyeForObjectDescriptionIndice : k18_ArrowForChestContentIndice), dispMan._g296_bitmapViewport, g33_BoxArrowOrEye, 0, 0, 16, k112_byteWidthViewport * 2, k8_ColorRed); } @@ -448,10 +440,8 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { f333_openAndDrawChest(thingToDraw, (Container*)rawThingPtr, pressingEye); } else { IconIndice iconIndex = objMan.f33_getIconIndex(thingToDraw); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k20_PanelEmptyIndice), 144, 0, 0, - dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, g32_BoxPanel, k8_ColorRed); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k29_ObjectDescCircleIndice), 32, 0, 0, - dispMan._g296_bitmapViewport, k112_byteWidthViewport * 2, g34_BoxObjectDescCircle, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k20_PanelEmptyIndice), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k29_ObjectDescCircleIndice), dispMan._g296_bitmapViewport, g34_BoxObjectDescCircle, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray); char *descString = nullptr; char str[40]; @@ -552,7 +542,7 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { strcat(str, "."); // TODO: localization weight -= (weight / 10) * 10; - strcat(str, champMan.f288_getStringFromInteger(weight, false, 1).c_str()); + strcat(str, champMan.f288_getStringFromInteger(weight, false, 1).c_str()); strcat(str, " KG."); // TODO: localization diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 1d93895e09..ee023e7522 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -64,7 +64,7 @@ void MenuMan::f395_drawMovementArrows() { Box &dest = g2_BoxMovementArrows; uint16 w = disp.getWidth(k13_MovementArrowsIndice); - disp.f132_blitToBitmap(arrowsBitmap, w, 0, 0, disp._g348_bitmapScreen, k160_byteWidthScreen * 2, dest, k255_ColorNoTransparency); + disp.f132_blitToBitmap(arrowsBitmap, disp._g348_bitmapScreen, dest, 0, 0, w, k160_byteWidthScreen * 2, k255_ColorNoTransparency); } void MenuMan::f388_clearActingChampion() { ChampionMan &cm = *_vm->_championMan; @@ -113,7 +113,7 @@ T0386006: box2._x2 = box._x2 - 2; // no need to add +1 for exclusive boundaries, box already has that box2._y1 = 95; box2._y2 = 110 + 1; - dm.f132_blitToBitmap(bitmapIcon, 16, 0, 0, dm._g348_bitmapScreen, k160_byteWidthScreen * 2, box2); + dm.f132_blitToBitmap(bitmapIcon, dm._g348_bitmapScreen, box2, 0, 0, 16, k160_byteWidthScreen * 2, k255_ColorNoTransparency); if (champion.getAttributes(k0x0008_ChampionAttributeDisableAction) || _vm->_championMan->_g299_candidateChampionOrdinal || _vm->_championMan->_g300_partyIsSleeping) { warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); } @@ -208,13 +208,13 @@ void MenuMan::f387_drawActionArea() { box = g500_BoxActionArea2ActionMenu; if (_g713_actionList._actionIndices[1] == k255_ChampionActionNone) box = g501_BoxActionArea1ActionMenu; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k10_MenuActionAreaIndice), 96, 0, 0, dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, box, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k10_MenuActionAreaIndice), dispMan._g348_bitmapScreen, box, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency); textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, 235, 83, k0_ColorBlack, k4_ColorCyan, champMan._gK71_champions[_vm->M1_ordinalToIndex(champMan._g506_actingChampionOrdinal)]._name, - k7_ChampionNameMaximumLength, k200_heightScreen); + k7_ChampionNameMaximumLength, k200_heightScreen); for (uint16 actionListIndex = 0; actionListIndex < 3; actionListIndex++) { textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, 241, 93 + actionListIndex * 12, k4_ColorCyan, k0_ColorBlack, - f384_getActionName(_g713_actionList._actionIndices[actionListIndex]), - k12_ActionNameMaximumLength, k200_heightScreen); + f384_getActionName(_g713_actionList._actionIndices[actionListIndex]), + k12_ActionNameMaximumLength, k200_heightScreen); } } warning("MISSING CODE: F0078_MOUSE_ShowPointer"); @@ -315,7 +315,7 @@ void MenuMan::f392_buildSpellAreaLine(int16 spellAreaBitmapLine) { Champion &champ = _vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]; if (spellAreaBitmapLine == k2_SpellAreaAvailableSymbols) { dispMan._g578_useByteBoxCoordinates = false; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k11_MenuSpellAreLinesIndice), 96, 0, 12, _gK72_bitmapSpellAreaLine, 96, gK74_BoxSpellAreaLine, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k11_MenuSpellAreLinesIndice), _gK72_bitmapSpellAreaLine, gK74_BoxSpellAreaLine, 0, 12, 96, 96, k255_ColorNoTransparency); int16 x = 1; byte c = 96 + (6 * champ._symbolStep); char spellSymbolString[2] = {'\0', '\0'}; @@ -325,7 +325,7 @@ void MenuMan::f392_buildSpellAreaLine(int16 spellAreaBitmapLine) { } } else if (spellAreaBitmapLine == k3_SpellAreaChampionSymbols) { dispMan._g578_useByteBoxCoordinates = false; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k11_MenuSpellAreLinesIndice), 96, 0, 24, _gK72_bitmapSpellAreaLine, 96, gK74_BoxSpellAreaLine, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k11_MenuSpellAreLinesIndice), _gK72_bitmapSpellAreaLine, gK74_BoxSpellAreaLine, 0, 24, 96, 96, k255_ColorNoTransparency); char spellSymbolString[2] = {'\0', '\0'}; int16 x = 8; for (uint16 symbolIndex = 0; symbolIndex < 4; symbolIndex++) { @@ -345,7 +345,7 @@ void MenuMan::f394_setMagicCasterAndDrawSpellArea(int16 champIndex) { return; if (champMan._g514_magicCasterChampionIndex == kM1_ChampionNone) { warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE"); - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k9_MenuSpellAreaBackground), 96, 0, 0, dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, g0_BoxSpellArea); + dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k9_MenuSpellAreaBackground), dispMan._g348_bitmapScreen, g0_BoxSpellArea, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency); warning("MISSING CODE: F0078_MOUSE_ShowPointer"); } if (champIndex == kM1_ChampionNone) { @@ -361,9 +361,9 @@ void MenuMan::f394_setMagicCasterAndDrawSpellArea(int16 champIndex) { f392_buildSpellAreaLine(k2_SpellAreaAvailableSymbols); warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE"); f393_drawSpellAreaControls((ChampionIndex)champIndex); - dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, 96, 0, 0, dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, gK75_BoxSpellAreaLine2); + dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, dispMan._g348_bitmapScreen, gK75_BoxSpellAreaLine2, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency); f392_buildSpellAreaLine(k3_SpellAreaChampionSymbols); - dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, 96, 0, 0, dispMan._g348_bitmapScreen, k160_byteWidthScreen * 2, gK76_BoxSpellAreaLine3); + dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, dispMan._g348_bitmapScreen, gK76_BoxSpellAreaLine3, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency); warning("MISSING CODE: F0078_MOUSE_ShowPointer"); } } diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 251401f069..2daf3e12bb 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -196,7 +196,7 @@ void ObjectMan::f36_extractIconFromBitmap(uint16 iconIndex, byte *destBitmap) { iconIndex -= g26_IconGraphicFirstIndex[i]; _vm->_displayMan->_g578_useByteBoxCoordinates = true; Box box(0, 0, 15, 15); - _vm->_displayMan->f132_blitToBitmap(srcBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, destBitmap, 16, box, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(srcBitmap, destBitmap, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, 16, k255_ColorNoTransparency); } void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { @@ -224,12 +224,10 @@ void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { _vm->_displayMan->_g578_useByteBoxCoordinates = false; if (slotBoxIndex >= k8_SlotBoxInventoryFirstSlot) { - _vm->_displayMan->f132_blitToBitmap(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, - _vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport * 2, box, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g296_bitmapViewport, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, k112_byteWidthViewport * 2, k255_ColorNoTransparency); } else { - _vm->_displayMan->f132_blitToBitmap(iconsBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, - _vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen * 2, box, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g348_bitmapScreen, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, k160_byteWidthScreen * 2, k255_ColorNoTransparency); } } @@ -248,7 +246,7 @@ void ObjectMan::f34_drawLeaderObjectName(Thing thing) { objName = _g352_objectNames[iconIndex]; } _vm->_textMan->f41_printWithTrailingSpaces(_vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen * 2, 233, 37, - k4_ColorCyan, k0_ColorBlack, objName, k14_ObjectNameMaximumLength, k200_heightScreen); + k4_ColorCyan, k0_ColorBlack, objName, k14_ObjectNameMaximumLength, k200_heightScreen); } IconIndice ObjectMan::f39_getIconIndexInSlotBox(uint16 slotBoxIndex) { diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index a97060e914..b29584e3bd 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -61,8 +61,7 @@ void TextMan::f40_printTextToBitmap(byte* destBitmap, uint16 destPixelWidth, uin uint16 srcX = (1 + 5) * toupper(*begin); // 1 + 5 is not the letter width, arbitrary choice of the unpacking code Box box((nextX == destX) ? (nextX + 1) : nextX, nextX + k5_LetterWidth + 1, nextY, nextY + k6_LetterHeight - 1); - _vm->_displayMan->f132_blitToBitmap(srcBitmap, 6 * 128, (nextX == destX) ? (srcX + 1) : srcX, 0, destBitmap, destPixelWidth, - box, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(srcBitmap, destBitmap, box, (nextX == destX) ? (srcX + 1) : srcX, 0, 6 * 128, destPixelWidth, k255_ColorNoTransparency); nextX += k5_LetterWidth + 1; } -- cgit v1.2.3