diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/champion.cpp | 34 | ||||
-rw-r--r-- | engines/dm/champion.h | 2 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 2 | ||||
-rw-r--r-- | engines/dm/eventman.h | 2 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 493 | ||||
-rw-r--r-- | engines/dm/gfx.h | 56 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 30 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 33 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 12 | ||||
-rw-r--r-- | engines/dm/text.cpp | 16 | ||||
-rw-r--r-- | engines/dm/text.h | 4 |
11 files changed, 354 insertions, 330 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 44d783f4ff..333243c969 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -138,7 +138,7 @@ Common::String ChampionMan::f288_getStringFromInteger(uint16 val, bool padding, return result += valToStr;
}
-void ChampionMan::f299_pplyModifiersToStatistics(Champion* champ, ChampionSlot slotIndex, IconIndice iconIndex, int16 modifierFactor, Thing thing) {
+void ChampionMan::f299_applyModifiersToStatistics(Champion* champ, ChampionSlot slotIndex, IconIndice iconIndex, int16 modifierFactor, Thing thing) {
int16 statIndex;
int16 modifier = 0;
ThingType thingType = thing.getType();
@@ -383,7 +383,7 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch champ->setAttributeFlag(k0x0200_ChampionAttributeLoad, true);
IconIndice iconIndex = objMan.f33_getIconIndex(thing);
bool isInventoryChampion = (_vm->M0_indexToOrdinal(champIndex) == invMan._g432_inventoryChampionOrdinal);
- f299_pplyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing);
+ f299_applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing);
uint16 *rawObjPtr = dunMan.f156_getThingData(thing);
if (slotIndex < k2_ChampionSlotHead) {
@@ -461,7 +461,8 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) dispMan._g578_useByteBoxCoordinates = true;
{ // limit destBox scope
Box &destBox = gBoxChampionPortrait;
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k26_ChampionPortraitsIndice), champ->_portrait, destBox, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), 256, 32, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), champ->_portrait,
+ destBox, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), 128, 16, k255_ColorNoTransparency);
}
champ->_actionIndex = k255_ChampionActionNone;
@@ -750,7 +751,8 @@ 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]), dispMan._g348_bitmapScreen, box, 0, 0, 80, k160_byteWidthScreen * 2, k10_ColorFlesh);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(nativeBitmapIndices[AL_0_borderCount]),
+ dispMan._g348_bitmapScreen, box, 0, 0, 40, k160_byteWidthScreen, k10_ColorFlesh);
}
if (isInventoryChamp) {
invMan.f354_drawStatusBoxPortrait(champIndex);
@@ -759,7 +761,8 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { champAttributes |= (k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x2000_ChampionAttributeWounds | k0x8000_ChampionAttributeActionHand);
}
} else {
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k8_StatusBoxDeadChampion), dispMan._g348_bitmapScreen, box, 0, 0, 80, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k8_StatusBoxDeadChampion), dispMan._g348_bitmapScreen,
+ box, 0, 0, 40, k160_byteWidthScreen, k255_ColorNoTransparency);
_vm->_textMan->f53_printToLogicalScreen(champStatusBoxX + 1, 5, k13_ColorLightestGray, k1_ColorDarkGary, champ->_name);
menuMan.f386_drawActionIcon(champIndex);
goto T0292042_green;
@@ -801,7 +804,8 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } else {
AL_2_nativeBitmapIndex = k33_SlotBoxNormalIndice;
}
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport, gBoxMouth, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport,
+ gBoxMouth, 0, 0, 16, k112_byteWidthViewport, 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)
@@ -810,7 +814,8 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { break;
}
}
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport, gBoxEye, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(AL_2_nativeBitmapIndex), dispMan._g296_bitmapViewport, gBoxEye,
+ 0, 0, 16, k112_byteWidthViewport, k12_ColorDarkestGray);
champAttributes |= k0x4000_ChampionAttributeViewport;
}
}
@@ -853,11 +858,11 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { if ((champAttributes & k28_ChampionIcons) && (eventMan._g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(AL_0_championIconIndex))) {
dispMan.D24_fillScreenBox(g54_BoxChampionIcons[AL_0_championIconIndex], g46_ChampionColor[champIndex]);
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k28_ChampionIcons),
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(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);
+ 40, k160_byteWidthScreen, k12_ColorDarkestGray);
}
}
@@ -978,9 +983,11 @@ 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), _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 32, k112_byteWidthViewport * 2, k12_ColorDarkestGray);
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex),
+ _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport, k12_ColorDarkestGray);
} else {
- _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(nativeBitmapIndex), _vm->_displayMan->_g348_bitmapScreen, box, 0, 0, 32, k160_byteWidthScreen * 2, k12_ColorDarkestGray);
+ _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(nativeBitmapIndex),
+ _vm->_displayMan->_g348_bitmapScreen, box, 0, 0, 16, k160_byteWidthScreen, k12_ColorDarkestGray);
}
}
@@ -1003,8 +1010,9 @@ void ChampionMan::f281_renameChampion(Champion* champ) { box._x1 = 3;
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), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k4_ColorCyan);
+ dispMan.f135_fillBoxBitmap(dispMan._g296_bitmapViewport, box, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), dispMan._g296_bitmapViewport, g32_BoxPanel,
+ 0, 0, 72, k112_byteWidthViewport, k4_ColorCyan);
textMan.f52_printToViewport(177, 58, k13_ColorLightestGray, "_______");
textMan.f52_printToViewport(105, 76, k13_ColorLightestGray, "___________________");
Common::Point clickPos;
diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 1b7a4ff548..cabf06fbfb 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -461,7 +461,7 @@ public: void f281_renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename uint16 f303_getSkillLevel(ChampionIndex champIndex, ChampionSkill skillIndex);// @ F0303_CHAMPION_GetSkillLevel Common::String f288_getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount); // @ F0288_CHAMPION_GetStringFromInteger - void f299_pplyModifiersToStatistics(Champion *champ, ChampionSlot slotIndex, IconIndice iconIndex, + void f299_applyModifiersToStatistics(Champion *champ, ChampionSlot slotIndex, IconIndice iconIndex, int16 modifierFactor, Thing thing); // @ F0299_CHAMPION_ApplyObjectModifiersToStatistics bool f295_hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing); // @ F0295_CHAMPION_HasObjectIconInSlotBoxChanged void f296_drawChangedObjectIcons(); // @ F0296_CHAMPION_DrawChangedObjectIcons diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 7a3ce4089e..ae7852d649 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -263,7 +263,7 @@ void DMEngine::f2_gameloop() { if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_g300_partyIsSleeping) { Box box(0, 223, 0, 135); - _displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport * 2, k136_heightViewport); // dummy code + _displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // dummy code _displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY); } diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index 51f176185a..c156eedd94 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -243,7 +243,7 @@ public: void setMousePos(Common::Point pos); void processInput(); // acknowledges mouse and keyboard input void f360_processPendingClick(); // @ F0360_COMMAND_ProcessPendingClick - void f359_processClick(Common::Point mousePos, MouseButton button); // @ F0359_COMMAND_ProcessClick_CPSC + void f359_processClick(Common::Point mousePos, MouseButton button); // @ F0359_COMMAND_ProcessClick_CPSC CommandType f358_getCommandTypeFromMouseInput(MouseInput *input, Common::Point mousePos, MouseButton button); // @ F0358_COMMAND_GetCommandFromMouseInput_CPSC void f380_processCommandQueue(); // @ F0380_COMMAND_ProcessQueue_CPSC diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 2bfcb6c213..4aa9ea2b2a 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -224,111 +224,111 @@ byte g195_FloorOrnCoordSetIndices[9] = { // @ G0195_auc_Graphic558_FloorOrnament 0}; /* Floor Ornament 08 Puddle */ uint16 g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets - /* { X1, X2, Y1, Y2, PixelWidth, Height } */ - {{80, 83, 41, 45, 8 * 2, 5}, /* D3L */ - {140, 143, 41, 45, 8 * 2, 5}, /* D3R */ - {16, 29, 39, 50, 8 * 2, 12}, /* D3L */ - {107, 120, 39, 50, 8 * 2, 12}, /* D3C */ - {187, 200, 39, 50, 8 * 2, 12}, /* D3R */ - {67, 77, 40, 49, 8 * 2, 10}, /* D2L */ - {146, 156, 40, 49, 8 * 2, 10}, /* D2R */ - {0, 17, 38, 55, 16 * 2, 18}, /* D2L */ - {102, 123, 38, 55, 16 * 2, 18}, /* D2C */ - {206, 223, 38, 55, 16 * 2, 18}, /* D2R */ - {48, 63, 38, 56, 8 * 2, 19}, /* D1L */ - {160, 175, 38, 56, 8 * 2, 19}, /* D1R */ - {96, 127, 36, 63, 16 * 2, 28}}, /* D1C */ - {{74, 82, 41, 60, 8 * 2, 20}, /* D3L */ - {141, 149, 41, 60, 8 * 2, 20}, /* D3R */ - {1, 47, 37, 63, 24 * 2, 27}, /* D3L */ - {88, 134, 37, 63, 24 * 2, 27}, /* D3C */ - {171, 217, 37, 63, 24 * 2, 27}, /* D3R */ - {61, 76, 38, 67, 8 * 2, 30}, /* D2L */ - {147, 162, 38, 67, 8 * 2, 30}, /* D2R */ - {0, 43, 37, 73, 32 * 2, 37}, /* D2L */ - {80, 143, 37, 73, 32 * 2, 37}, /* D2C */ - {180, 223, 37, 73, 32 * 2, 37}, /* D2R */ - {32, 63, 36, 83, 16 * 2, 48}, /* D1L */ - {160, 191, 36, 83, 16 * 2, 48}, /* D1R */ - {64, 159, 36, 91, 48 * 2, 56}}, /* D1C */ - {{80, 83, 66, 70, 8 * 2, 5}, /* D3L */ - {140, 143, 66, 70, 8 * 2, 5}, /* D3R */ - {16, 29, 64, 75, 8 * 2, 12}, /* D3L */ - {106, 119, 64, 75, 8 * 2, 12}, /* D3C */ - {187, 200, 64, 75, 8 * 2, 12}, /* D3R */ - {67, 77, 74, 83, 8 * 2, 10}, /* D2L */ - {146, 156, 74, 83, 8 * 2, 10}, /* D2R */ - {0, 17, 73, 90, 16 * 2, 18}, /* D2L */ - {100, 121, 73, 90, 16 * 2, 18}, /* D2C */ - {206, 223, 73, 90, 16 * 2, 18}, /* D2R */ - {48, 63, 84, 102, 8 * 2, 19}, /* D1L */ - {160, 175, 84, 102, 8 * 2, 19}, /* D1R */ - {96, 127, 92, 119, 16 * 2, 28}}, /* D1C */ - {{80, 83, 49, 53, 8 * 2, 5}, /* D3L */ - {140, 143, 49, 53, 8 * 2, 5}, /* D3R */ - {16, 29, 50, 61, 8 * 2, 12}, /* D3L */ - {106, 119, 50, 61, 8 * 2, 12}, /* D3C */ - {187, 200, 50, 61, 8 * 2, 12}, /* D3R */ - {67, 77, 53, 62, 8 * 2, 10}, /* D2L */ - {146, 156, 53, 62, 8 * 2, 10}, /* D2R */ - {0, 17, 55, 72, 16 * 2, 18}, /* D2L */ - {100, 121, 55, 72, 16 * 2, 18}, /* D2C */ - {206, 223, 55, 72, 16 * 2, 18}, /* D2R */ - {48, 63, 57, 75, 8 * 2, 19}, /* D1L */ - {160, 175, 57, 75, 8 * 2, 19}, /* D1R */ - {96, 127, 64, 91, 16 * 2, 28}}, /* D1C */ - {{75, 90, 40, 44, 8 * 2, 5}, /* D3L */ - {133, 148, 40, 44, 8 * 2, 5}, /* D3R */ - {1, 48, 44, 49, 24 * 2, 6}, /* D3L */ - {88, 135, 44, 49, 24 * 2, 6}, /* D3C */ - {171, 218, 44, 49, 24 * 2, 6}, /* D3R */ - {60, 77, 40, 46, 16 * 2, 7}, /* D2L */ - {146, 163, 40, 46, 16 * 2, 7}, /* D2R */ - {0, 35, 43, 50, 32 * 2, 8}, /* D2L */ - {80, 143, 43, 50, 32 * 2, 8}, /* D2C */ - {184, 223, 43, 50, 32 * 2, 8}, /* D2R */ - {32, 63, 41, 52, 16 * 2, 12}, /* D1L */ - {160, 191, 41, 52, 16 * 2, 12}, /* D1R */ - {64, 159, 41, 52, 48 * 2, 12}}, /* D1C */ - {{78, 85, 36, 51, 8 * 2, 16}, /* D3L */ - {138, 145, 36, 51, 8 * 2, 16}, /* D3R */ - {10, 41, 34, 53, 16 * 2, 20}, /* D3L */ - {98, 129, 34, 53, 16 * 2, 20}, /* D3C */ - {179, 210, 34, 53, 16 * 2, 20}, /* D3R */ - {66, 75, 34, 56, 8 * 2, 23}, /* D2L */ - {148, 157, 34, 56, 8 * 2, 23}, /* D2R */ - {0, 26, 33, 61, 24 * 2, 29}, /* D2L */ - {91, 133, 33, 61, 24 * 2, 29}, /* D2C */ - {194, 223, 33, 61, 24 * 2, 29}, /* D2R */ - {41, 56, 31, 65, 8 * 2, 35}, /* D1L */ - {167, 182, 31, 65, 8 * 2, 35}, /* D1R */ - {80, 143, 29, 71, 32 * 2, 43}}, /* D1C */ - {{75, 82, 25, 75, 8 * 2, 51}, /* D3L */ - {142, 149, 25, 75, 8 * 2, 51}, /* D3R */ - {12, 60, 25, 75, 32 * 2, 51}, /* D3L */ - {88, 136, 25, 75, 32 * 2, 51}, /* D3C */ - {163, 211, 25, 75, 32 * 2, 51}, /* D3R */ - {64, 73, 20, 90, 8 * 2, 71}, /* D2L */ - {150, 159, 20, 90, 8 * 2, 71}, /* D2R */ - {0, 38, 20, 90, 32 * 2, 71}, /* D2L */ - {82, 142, 20, 90, 32 * 2, 71}, /* D2C */ - {184, 223, 20, 90, 32 * 2, 71}, /* D2R */ - {41, 56, 9, 119, 8 * 2, 111}, /* D1L */ - {169, 184, 9, 119, 8 * 2, 111}, /* D1R */ - {64, 159, 9, 119, 48 * 2, 111}}, /* D1C */ - {{74, 85, 25, 75, 8 * 2, 51}, /* D3L */ - {137, 149, 25, 75, 8 * 2, 51}, /* D3R */ - {0, 75, 25, 75, 40 * 2, 51}, /* D3L Atari ST: { 0, 83, 25, 75, 48*2, 51 } */ - {74, 149, 25, 75, 40 * 2, 51}, /* D3C Atari ST: { 74, 149, 25, 75, 48*2, 51 } */ - {148, 223, 25, 75, 40 * 2, 51}, /* D3R Atari ST: { 139, 223, 25, 75, 48*2, 51 } */ - {60, 77, 20, 90, 16 * 2, 71}, /* D2L */ - {146, 163, 20, 90, 16 * 2, 71}, /* D2R */ - {0, 74, 20, 90, 56 * 2, 71}, /* D2L */ - {60, 163, 20, 90, 56 * 2, 71}, /* D2C */ - {149, 223, 20, 90, 56 * 2, 71}, /* D2R */ - {32, 63, 9, 119, 16 * 2, 111}, /* D1L */ - {160, 191, 9, 119, 16 * 2, 111}, /* D1R */ - {32, 191, 9, 119, 80 * 2, 111}}}; /* D1C */ + /* { X1, X2, Y1, Y2, PixelWidth, Height } */ + {{80, 83, 41, 45, 8, 5}, /* D3L */ + {140, 143, 41, 45, 8, 5}, /* D3R */ + {16, 29, 39, 50, 8, 12}, /* D3L */ + {107, 120, 39, 50, 8, 12}, /* D3C */ + {187, 200, 39, 50, 8, 12}, /* D3R */ + {67, 77, 40, 49, 8, 10}, /* D2L */ + {146, 156, 40, 49, 8, 10}, /* D2R */ + {0, 17, 38, 55, 16, 18}, /* D2L */ + {102, 123, 38, 55, 16, 18}, /* D2C */ + {206, 223, 38, 55, 16, 18}, /* D2R */ + {48, 63, 38, 56, 8, 19}, /* D1L */ + {160, 175, 38, 56, 8, 19}, /* D1R */ + {96, 127, 36, 63, 16, 28}}, /* D1C */ + {{74, 82, 41, 60, 8, 20}, /* D3L */ + {141, 149, 41, 60, 8, 20}, /* D3R */ + {1, 47, 37, 63, 24, 27}, /* D3L */ + {88, 134, 37, 63, 24, 27}, /* D3C */ + {171, 217, 37, 63, 24, 27}, /* D3R */ + {61, 76, 38, 67, 8, 30}, /* D2L */ + {147, 162, 38, 67, 8, 30}, /* D2R */ + {0, 43, 37, 73, 32, 37}, /* D2L */ + {80, 143, 37, 73, 32, 37}, /* D2C */ + {180, 223, 37, 73, 32, 37}, /* D2R */ + {32, 63, 36, 83, 16, 48}, /* D1L */ + {160, 191, 36, 83, 16, 48}, /* D1R */ + {64, 159, 36, 91, 48, 56}}, /* D1C */ + {{80, 83, 66, 70, 8, 5}, /* D3L */ + {140, 143, 66, 70, 8, 5}, /* D3R */ + {16, 29, 64, 75, 8, 12}, /* D3L */ + {106, 119, 64, 75, 8, 12}, /* D3C */ + {187, 200, 64, 75, 8, 12}, /* D3R */ + {67, 77, 74, 83, 8, 10}, /* D2L */ + {146, 156, 74, 83, 8, 10}, /* D2R */ + {0, 17, 73, 90, 16, 18}, /* D2L */ + {100, 121, 73, 90, 16, 18}, /* D2C */ + {206, 223, 73, 90, 16, 18}, /* D2R */ + {48, 63, 84, 102, 8, 19}, /* D1L */ + {160, 175, 84, 102, 8, 19}, /* D1R */ + {96, 127, 92, 119, 16, 28}}, /* D1C */ + {{80, 83, 49, 53, 8, 5}, /* D3L */ + {140, 143, 49, 53, 8, 5}, /* D3R */ + {16, 29, 50, 61, 8, 12}, /* D3L */ + {106, 119, 50, 61, 8, 12}, /* D3C */ + {187, 200, 50, 61, 8, 12}, /* D3R */ + {67, 77, 53, 62, 8, 10}, /* D2L */ + {146, 156, 53, 62, 8, 10}, /* D2R */ + {0, 17, 55, 72, 16, 18}, /* D2L */ + {100, 121, 55, 72, 16, 18}, /* D2C */ + {206, 223, 55, 72, 16, 18}, /* D2R */ + {48, 63, 57, 75, 8, 19}, /* D1L */ + {160, 175, 57, 75, 8, 19}, /* D1R */ + {96, 127, 64, 91, 16, 28}}, /* D1C */ + {{75, 90, 40, 44, 8, 5}, /* D3L */ + {133, 148, 40, 44, 8, 5}, /* D3R */ + {1, 48, 44, 49, 24, 6}, /* D3L */ + {88, 135, 44, 49, 24, 6}, /* D3C */ + {171, 218, 44, 49, 24, 6}, /* D3R */ + {60, 77, 40, 46, 16, 7}, /* D2L */ + {146, 163, 40, 46, 16, 7}, /* D2R */ + {0, 35, 43, 50, 32, 8}, /* D2L */ + {80, 143, 43, 50, 32, 8}, /* D2C */ + {184, 223, 43, 50, 32, 8}, /* D2R */ + {32, 63, 41, 52, 16, 12}, /* D1L */ + {160, 191, 41, 52, 16, 12}, /* D1R */ + {64, 159, 41, 52, 48, 12}}, /* D1C */ + {{78, 85, 36, 51, 8, 16}, /* D3L */ + {138, 145, 36, 51, 8, 16}, /* D3R */ + {10, 41, 34, 53, 16, 20}, /* D3L */ + {98, 129, 34, 53, 16, 20}, /* D3C */ + {179, 210, 34, 53, 16, 20}, /* D3R */ + {66, 75, 34, 56, 8, 23}, /* D2L */ + {148, 157, 34, 56, 8, 23}, /* D2R */ + {0, 26, 33, 61, 24, 29}, /* D2L */ + {91, 133, 33, 61, 24, 29}, /* D2C */ + {194, 223, 33, 61, 24, 29}, /* D2R */ + {41, 56, 31, 65, 8, 35}, /* D1L */ + {167, 182, 31, 65, 8, 35}, /* D1R */ + {80, 143, 29, 71, 32, 43}}, /* D1C */ + {{75, 82, 25, 75, 8, 51}, /* D3L */ + {142, 149, 25, 75, 8, 51}, /* D3R */ + {12, 60, 25, 75, 32, 51}, /* D3L */ + {88, 136, 25, 75, 32, 51}, /* D3C */ + {163, 211, 25, 75, 32, 51}, /* D3R */ + {64, 73, 20, 90, 8, 71}, /* D2L */ + {150, 159, 20, 90, 8, 71}, /* D2R */ + {0, 38, 20, 90, 32, 71}, /* D2L */ + {82, 142, 20, 90, 32, 71}, /* D2C */ + {184, 223, 20, 90, 32, 71}, /* D2R */ + {41, 56, 9, 119, 8, 111}, /* D1L */ + {169, 184, 9, 119, 8, 111}, /* D1R */ + {64, 159, 9, 119, 48, 111}}, /* D1C */ + {{74, 85, 25, 75, 8, 51}, /* D3L */ + {137, 149, 25, 75, 8, 51}, /* D3R */ + {0, 75, 25, 75, 40, 51}, /* D3L Atari ST: { 0, 83, 25, 75, 48*2, 51 } */ + {74, 149, 25, 75, 40, 51}, /* D3C Atari ST: { 74, 149, 25, 75, 48*2, 51 } */ + {148, 223, 25, 75, 40, 51}, /* D3R Atari ST: { 139, 223, 25, 75, 48*2, 51 } */ + {60, 77, 20, 90, 16, 71}, /* D2L */ + {146, 163, 20, 90, 16, 71}, /* D2R */ + {0, 74, 20, 90, 56, 71}, /* D2L */ + {60, 163, 20, 90, 56, 71}, /* D2C */ + {149, 223, 20, 90, 56, 71}, /* D2R */ + {32, 63, 9, 119, 16, 111}, /* D1L */ + {160, 191, 9, 119, 16, 111}, /* D1R */ + {32, 191, 9, 119, 80, 111}}}; /* D1C */ byte g194_WallOrnCoordSetIndices[60] = { // @ G0194_auc_Graphic558_WallOrnamentCoordinateSetIndices 1, /* Wall Ornament 00 Unreadable Inscription */ @@ -531,7 +531,6 @@ ProjectileAspect g210_ProjectileAspect[k14_ProjectileAspectCount] = { // @ G0210 ProjectileAspect(31, 156, 16, 24, 0x0103) /* Explosion Poison Bolt Poison Cloud */ }; -// TODO: this is ONLY for the Amiga version, name will have to be refactored /* Identical to the palette at the end of the swoosh palette animation */ uint16 gK57_PalSwoosh[16] = {0x000, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0x000, 0xFFF, 0xAAA, 0xFFF, 0xAAA, 0x444, 0xFF0, 0xFF0}; // @ K0057_aui_Palette_Swoosh @@ -780,17 +779,17 @@ void DisplayMan::f460_initializeGraphicData() { _g638_derivedBitmaps[i] = nullptr; } - _g639_derivedBitmapByteCount[k0_DerivedBitmapViewport] = 224 * 136; - _g639_derivedBitmapByteCount[k1_DerivedBitmapThievesEyeVisibleArea] = 96 * 95; - _g639_derivedBitmapByteCount[k2_DerivedBitmapDamageToCreatureMedium] = 64 * 37; - _g639_derivedBitmapByteCount[k3_DerivedBitmapDamageToCreatureSmall] = 48 * 37; + _g639_derivedBitmapByteCount[k0_DerivedBitmapViewport] = 112 * 136; + _g639_derivedBitmapByteCount[k1_DerivedBitmapThievesEyeVisibleArea] = 48 * 95; + _g639_derivedBitmapByteCount[k2_DerivedBitmapDamageToCreatureMedium] = 32 * 37; + _g639_derivedBitmapByteCount[k3_DerivedBitmapDamageToCreatureSmall] = 24 * 37; for (int16 doorOrnamentIndex = k15_DoorOrnDestroyedMask; doorOrnamentIndex <= k16_DoorOrnThivesEyeMask; doorOrnamentIndex++) { _g103_currMapDoorOrnInfo[doorOrnamentIndex][k0_NativeBitmapIndex] = doorOrnamentIndex + (k301_DoorMaskDestroyedIndice - k15_DoorOrnDestroyedMask); _g103_currMapDoorOrnInfo[doorOrnamentIndex][k1_CoordinateSet] = 1; - _g639_derivedBitmapByteCount[doorOrnamentIndex * 2 + k68_DerivedBitmapFirstDoorOrnament_D3] = 48 * 41; - _g639_derivedBitmapByteCount[doorOrnamentIndex * 2 + k69_DerivedBitmapFirstDoorOrnament_D2] = 64 * 61; + _g639_derivedBitmapByteCount[doorOrnamentIndex * 2 + k68_DerivedBitmapFirstDoorOrnament_D3] = 24 * 41; + _g639_derivedBitmapByteCount[doorOrnamentIndex * 2 + k69_DerivedBitmapFirstDoorOrnament_D2] = 32 * 61; } _g102_currMapFloorOrnInfo[k15_FloorOrnFootprints][k0_NativeBitmapIndex] = k241_FloorOrn_15_D3L_footprints; @@ -801,8 +800,8 @@ void DisplayMan::f460_initializeGraphicData() { for (int16 objectAspectIndex = 0; objectAspectIndex < k85_ObjAspectCount; ++objectAspectIndex, ++objectAspect) { derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex; - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(objectAspect->_width, objectAspect->_height, k16_Scale_D3); - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(objectAspect->_width, objectAspect->_height, k20_Scale_D2); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k16_Scale_D3); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k20_Scale_D2); if (getFlag(objectAspect->_graphicInfo, k0x0001_ObjectFlipOnRightMask)) { _g639_derivedBitmapByteCount[derivedBitmapIndex] = _g639_derivedBitmapByteCount[derivedBitmapIndex - 2]; @@ -825,14 +824,14 @@ void DisplayMan::f460_initializeGraphicData() { derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + projectileAspect->_firstDerivedBitmapRelativeIndex; for (int16 projectileScaleIndex = 0; projectileScaleIndex < 6; projectileScaleIndex++) { - int16 bitmapPixelCount = f459_getScaledBitmapPixelCount(projectileAspect->_width, projectileAspect->_height, g215_ProjectileScales[projectileScaleIndex]); - _g639_derivedBitmapByteCount[derivedBitmapIndex] = bitmapPixelCount; + int16 bitmapByteCount = f459_getScaledBitmapByteCount(projectileAspect->_byteWidth, projectileAspect->_height, g215_ProjectileScales[projectileScaleIndex]); + _g639_derivedBitmapByteCount[derivedBitmapIndex] = bitmapByteCount; if (getFlag(projectileAspect->_graphicInfo, k0x0003_ProjectileAspectTypeMask) != k3_ProjectileAspectHasNone) { - _g639_derivedBitmapByteCount[derivedBitmapIndex + 6] = bitmapPixelCount; + _g639_derivedBitmapByteCount[derivedBitmapIndex + 6] = bitmapByteCount; if (getFlag(projectileAspect->_graphicInfo, k0x0003_ProjectileAspectTypeMask) != k2_ProjectileAspectHasRotation) { - _g639_derivedBitmapByteCount[derivedBitmapIndex + 12] = bitmapPixelCount; + _g639_derivedBitmapByteCount[derivedBitmapIndex + 12] = bitmapByteCount; } } } @@ -847,10 +846,10 @@ void DisplayMan::f460_initializeGraphicData() { ExplosionAspect *expAsp = g211_ExplosionAspects; for (uint16 expAspIndex = 0; expAspIndex < k4_ExplosionAspectCount; ++expAspIndex, expAsp++) { for (int16 scale = 4; scale < 32; scale += 2) - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(expAsp->_pixelWidth, expAsp->_height, scale); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(expAsp->_byteWidth, expAsp->_height, scale); if (expAspIndex == k3_ExplosionAspectSmoke) { - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = expAsp->_pixelWidth * expAsp->_height; + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = expAsp->_byteWidth * expAsp->_height; } } @@ -863,14 +862,16 @@ void DisplayMan::f460_initializeGraphicData() { creatureAsp->_firstDerivedBitmapIndex = derivedBitmapIndex; int16 creatureFrontBitmapD3PixelCount; - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD3PixelCount = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k16_Scale_D3); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD3PixelCount + = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k16_Scale_D3); int16 creatureFrontBitmapD2PixelCount; - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount + = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2); if (getFlag(creatureGraphicInfo, k0x0008_CreatureInfoGraphicMaskSide)) { - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k16_Scale_D3); - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k20_Scale_D2); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k16_Scale_D3); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k20_Scale_D2); } if (getFlag(creatureGraphicInfo, k0x0010_CreatureInfoGraphicMaskBack)) { @@ -879,16 +880,16 @@ void DisplayMan::f460_initializeGraphicData() { } if (getFlag(creatureGraphicInfo, k0x0020_CreatureInfoGraphicMaskAttack)) { - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k16_Scale_D3); - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k20_Scale_D2); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k16_Scale_D3); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k20_Scale_D2); } int16 additionalFronGraphicCount; if (additionalFronGraphicCount = getFlag(creatureGraphicInfo, k0x0003_CreatureInfoGraphicMaskAdditional)) { do { _g639_derivedBitmapByteCount[derivedBitmapIndex++] = creatureAsp->_byteWidthFront * creatureAsp->_heightFront; - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k16_Scale_D3); - _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapPixelCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k16_Scale_D3); + _g639_derivedBitmapByteCount[derivedBitmapIndex++] = f459_getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2); } while (--additionalFronGraphicCount); } } @@ -897,9 +898,9 @@ void DisplayMan::f460_initializeGraphicData() { void DisplayMan::unpackGraphics() { uint32 unpackedBitmapsSize = 0; for (uint16 i = 0; i <= 20; ++i) - unpackedBitmapsSize += getWidth(i) * getHeight(i); + unpackedBitmapsSize += getPixelWidth(i) * getPixelHeight(i); for (uint16 i = 22; i <= 532; ++i) - unpackedBitmapsSize += getWidth(i) * getHeight(i); + unpackedBitmapsSize += getPixelWidth(i) * getPixelHeight(i); unpackedBitmapsSize += (5 + 1) * 6 * 128; // 5 x 6 characters, 128 of them, +1 for convenience padding // graphics items go from 0-20 and 22-532 inclusive, _unpackedItemPos 21 and 22 are there for indexing convenience if (_bitmaps) { @@ -910,15 +911,15 @@ void DisplayMan::unpackGraphics() { _bitmaps[0] = new byte[unpackedBitmapsSize]; f466_loadIntoBitmap(0, _bitmaps[0]); for (uint16 i = 1; i <= 20; ++i) { - _bitmaps[i] = _bitmaps[i - 1] + getWidth(i - 1) * getHeight(i - 1); + _bitmaps[i] = _bitmaps[i - 1] + getPixelWidth(i - 1) * getPixelHeight(i - 1); f466_loadIntoBitmap(i, _bitmaps[i]); } - _bitmaps[22] = _bitmaps[20] + getWidth(20) * getHeight(20); + _bitmaps[22] = _bitmaps[20] + getPixelWidth(20) * getPixelHeight(20); for (uint16 i = 23; i <= 532; ++i) { - _bitmaps[i] = _bitmaps[i - 1] + getWidth(i - 1) * getHeight(i - 1); + _bitmaps[i] = _bitmaps[i - 1] + getPixelWidth(i - 1) * getPixelHeight(i - 1); f466_loadIntoBitmap(i, _bitmaps[i]); } - _bitmaps[k557_FontGraphicIndice] = _bitmaps[532] + getWidth(532) * getHeight(532); + _bitmaps[k557_FontGraphicIndice] = _bitmaps[532] + getPixelWidth(532) * getPixelHeight(532); loadFNT1intoBitmap(k557_FontGraphicIndice, _bitmaps[k557_FontGraphicIndice]); } @@ -955,7 +956,7 @@ void DisplayMan::f566_viewportBlitToScreen() { warning("MISSING FUNCTIONALITY: using correct colorpalette"); Box box(0, 223, 33, 33 + 135); - f132_blitToBitmap(_g296_bitmapViewport, _g348_bitmapScreen, box, 0, 0, k112_byteWidthViewport * 2, k160_byteWidthScreen * 2, k255_ColorNoTransparency); + f132_blitToBitmap(_g296_bitmapViewport, _g348_bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, k255_ColorNoTransparency); } void DisplayMan::loadPalette(uint16 *palette) { @@ -1017,10 +1018,12 @@ void DisplayMan::f466_loadIntoBitmap(uint16 index, byte *destBitmap) { } } -void DisplayMan::f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcWidth, - uint16 destWidth, Color transparent, int16 srcHeight, int16 destHight) { +void DisplayMan::f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcByteWidth, + uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight) { // Note: if you want to use srcHeight and destHight parameters, remove the defaults values and // and complete the function calls at the callsites, otherwise their value can be the default -1 + 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 byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x]; @@ -1035,13 +1038,13 @@ void DisplayMan::D24_fillScreenBox(Box &box, Color color) { memset(_g348_bitmapScreen + y * _screenWidth + box._x1, color, sizeof(byte) * width); } -void DisplayMan::f135_fillBoxBitmap(byte* destBitmap, Box &box, Color color, int16 pixelWidth, int16 height) { +void DisplayMan::f135_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 * pixelWidth + box._x1, color, sizeof(byte) * (box._x2 - box._x1 + 1)); // + 1 for inclusive boundaries + memset(destBitmap + y * byteWidth * 2 + box._x1, color, sizeof(byte) * (box._x2 - box._x1 + 1)); // + 1 for inclusive boundaries } void DisplayMan::f133_blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte* mask, byte* tmp, Box& box, - int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent, int16 xPos, int16 yPos, int16 destHeight, int16 height2) { // make sure to take care of inclusive boundaries warning("STUB FUNCTION: does nothing at all"); @@ -1049,7 +1052,8 @@ void DisplayMan::f133_blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte* -void DisplayMan::f130_flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height) { +void DisplayMan::f130_flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height) { + uint16 width = byteWidth * 2; for (uint16 y = 0; y < height; ++y) { for (uint16 x = 0; x < width / 2; ++x) { byte tmp; @@ -1060,7 +1064,8 @@ void DisplayMan::f130_flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 he } } -void DisplayMan::flipBitmapVertical(byte *bitmap, uint16 width, uint16 height) { +void DisplayMan::flipBitmapVertical(byte *bitmap, uint16 byteWidth, uint16 height) { + uint16 width = byteWidth * 2; byte *tmp = new byte[width]; for (uint16 y = 0; y < height / 2; ++y) { @@ -1072,27 +1077,27 @@ void DisplayMan::flipBitmapVertical(byte *bitmap, uint16 width, uint16 height) { delete[] tmp; } -byte* DisplayMan::f114_getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16& returnPixelWidth, int16& returnHeight) { +byte* DisplayMan::f114_getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16& returnByteWidth, int16& returnHeight) { ExplosionAspect *explAsp = &g211_ExplosionAspects[explosionAspIndex]; if (scale > 32) scale = 32; - int16 pixelWidth = M78_getScaledDimension(explAsp->_pixelWidth, scale); + int16 pixelWidth = M78_getScaledDimension(explAsp->_byteWidth, scale); int16 height = M78_getScaledDimension(explAsp->_height, scale); byte *bitmap; int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + k438_DerivedBitmapFirstExplosion - 2; if ((scale == 32) && (explosionAspIndex != k3_ExplosionAspectSmoke)) { - bitmap = f489_getBitmap(explosionAspIndex + k348_FirstExplosionGraphicIndice); + bitmap = f489_getNativeBitmapOrGraphic(explosionAspIndex + k348_FirstExplosionGraphicIndice); } else if (f491_isDerivedBitmapInCache(derBitmapIndex)) { bitmap = f492_getDerivedBitmap(derBitmapIndex); } else { - byte *nativeBitmap = f489_getBitmap(MIN(explosionAspIndex, (uint16)k2_ExplosionAspectPoison) + k348_FirstExplosionGraphicIndice); + byte *nativeBitmap = f489_getNativeBitmapOrGraphic(MIN(explosionAspIndex, (uint16)k2_ExplosionAspectPoison) + k348_FirstExplosionGraphicIndice); bitmap = f492_getDerivedBitmap(derBitmapIndex); - f129_blitToBitmapShrinkWithPalChange(nativeBitmap, bitmap, explAsp->_pixelWidth, explAsp->_height, pixelWidth, height, + f129_blitToBitmapShrinkWithPalChange(nativeBitmap, bitmap, explAsp->_byteWidth, explAsp->_height, pixelWidth * 2, height, (explosionAspIndex == k3_ExplosionAspectSmoke) ? g212_PalChangeSmoke : g17_PalChangesNoChanges); - warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap"); + f493_addDerivedBitmap(derBitmapIndex); } - returnPixelWidth = pixelWidth; + returnByteWidth = pixelWidth; returnHeight = height; return bitmap; } @@ -1137,30 +1142,30 @@ byte *DisplayMan::getCurrentVgaBuffer() { return _g348_bitmapScreen; } -uint16 DisplayMan::getWidth(uint16 index) { +uint16 DisplayMan::getPixelWidth(uint16 index) { byte *data = _packedBitmaps + _packedItemPos[index]; return READ_BE_UINT16(data); } -uint16 DisplayMan::getHeight(uint16 index) { +uint16 DisplayMan::getPixelHeight(uint16 index) { uint8 *data = _packedBitmaps + _packedItemPos[index]; return READ_BE_UINT16(data + 2); } // Note: has been screened for missing code -void DisplayMan::f99_copyBitmapAndFlipHorizontal(byte* srcBitmap, byte* destBitmap, uint16 pixelWidth, uint16 height) { - memmove(destBitmap, srcBitmap, pixelWidth * height * sizeof(byte)); - f130_flipBitmapHorizontal(destBitmap, pixelWidth, height); +void DisplayMan::f99_copyBitmapAndFlipHorizontal(byte* srcBitmap, byte* destBitmap, uint16 byteWidth, uint16 height) { + memmove(destBitmap, srcBitmap, byteWidth * 2 * height * sizeof(byte)); + f130_flipBitmapHorizontal(destBitmap, byteWidth, height); } void DisplayMan::f101_drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) { - if (f._srcWidth) - f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k255_ColorNoTransparency); + if (f._srcByteWidth) + f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, k255_ColorNoTransparency); } void DisplayMan::f100_drawWallSetBitmap(byte *bitmap, Frame &f) { - if (f._srcWidth) - f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + if (f._srcByteWidth) + f132_blitToBitmap(bitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh); } @@ -1495,7 +1500,7 @@ void DisplayMan::f128_drawDungeon(direction dir, int16 posX, int16 posY) { if (_g76_useFlippedWallAndFootprintsBitmap = (posX + posY + dir) & 1) { f100_drawWallSetBitmap(_g85_bitmapCeiling, gK12_CeilingFrame); - f99_copyBitmapAndFlipHorizontal(_g84_bitmapFloor, _g74_tmpBitmap, k112_byteWidthViewport * 2, 70); + f99_copyBitmapAndFlipHorizontal(_g84_bitmapFloor, _g74_tmpBitmap, k112_byteWidthViewport, 70); f100_drawWallSetBitmap(_g74_tmpBitmap, gK13_FloorFrame); if (flippedFloorCeiling) { @@ -1506,7 +1511,7 @@ void DisplayMan::f128_drawDungeon(direction dir, int16 posX, int16 posY) { _g702_bitmapWallSet_Wall_D0R = _g94_bitmapWall_D0R_Flipped; } } else { - f99_copyBitmapAndFlipHorizontal(_g85_bitmapCeiling, _g74_tmpBitmap, k112_byteWidthViewport * 2, 29); + f99_copyBitmapAndFlipHorizontal(_g85_bitmapCeiling, _g74_tmpBitmap, k112_byteWidthViewport, 29); f100_drawWallSetBitmap(_g74_tmpBitmap, gK12_CeilingFrame); f100_drawWallSetBitmap(_g84_bitmapFloor, gK13_FloorFrame); } @@ -1566,7 +1571,8 @@ void DisplayMan::fillScreen(Color color) { memset(getCurrentVgaBuffer(), color, sizeof(byte) * _screenWidth * _screenHeight); } -void DisplayMan::f134_fillBitmap(byte *bitmap, Color color, uint16 width, uint16 height) { +void DisplayMan::f134_fillBitmap(byte *bitmap, Color color, uint16 byteWidth, uint16 height) { + uint16 width = byteWidth * 2; memset(bitmap, color, sizeof(byte) * width * height); } @@ -1605,9 +1611,9 @@ void DisplayMan::f95_loadWallSet(WallSet set) { f466_loadIntoBitmap(graphicIndice++, _g697_bitmapWallSet_Wall_D3L2); } f99_copyBitmapAndFlipHorizontal(_g708_bitmapWallSet_DoorFrameLeft_D1C, _g710_bitmapWallSet_DoorFrameRight_D1C, - g171_Frame_DoorFrameRight_D1C._srcWidth, g171_Frame_DoorFrameRight_D1C._srcHeight); + g171_Frame_DoorFrameRight_D1C._srcByteWidth, g171_Frame_DoorFrameRight_D1C._srcHeight); f99_copyBitmapAndFlipHorizontal(_g697_bitmapWallSet_Wall_D3L2, _g696_bitmapWallSet_Wall_D3R2, - g712_FrameWall_D3R2._srcWidth, g712_FrameWall_D3R2._srcHeight); + g712_FrameWall_D3R2._srcByteWidth, g712_FrameWall_D3R2._srcHeight); } } @@ -1621,21 +1627,21 @@ void DisplayMan::f96_loadCurrentMapGraphics() { _g578_useByteBoxCoordinates = true; 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, k10_ColorFlesh, 128, 51); - f132_blitToBitmap(_g74_tmpBitmap, _g90_bitmapWall_D3LCR_Flipped, g161_BoxWallBitmap_D3LCR, 11, 0, 128, 128, k255_ColorNoTransparency); + g163_FrameWalls[k0_ViewSquare_D3C]._srcByteWidth, g163_FrameWalls[k0_ViewSquare_D3C]._srcHeight); + f134_fillBitmap(_g90_bitmapWall_D3LCR_Flipped, k10_ColorFlesh, 64, 51); + f132_blitToBitmap(_g74_tmpBitmap, _g90_bitmapWall_D3LCR_Flipped, g161_BoxWallBitmap_D3LCR, 11, 0, 64, 64, 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, k10_ColorFlesh, 144, 71); - f132_blitToBitmap(_g74_tmpBitmap, _g91_bitmapWall_D2LCR_Flipped, g162_BoxWallBitmap_D2LCR, 8, 0, 144, 144, k255_ColorNoTransparency); + g163_FrameWalls[k3_ViewSquare_D2C]._srcByteWidth, g163_FrameWalls[k3_ViewSquare_D2C]._srcHeight); + f134_fillBitmap(_g91_bitmapWall_D2LCR_Flipped, k10_ColorFlesh, 72, 71); + f132_blitToBitmap(_g74_tmpBitmap, _g91_bitmapWall_D2LCR_Flipped, g162_BoxWallBitmap_D2LCR, 8, 0, 72, 72, 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); + g163_FrameWalls[k6_ViewSquare_D1C]._srcByteWidth, g163_FrameWalls[k6_ViewSquare_D1C]._srcHeight); f99_copyBitmapAndFlipHorizontal(_g98_bitmapWall_D0L_Native = _g701_bitmapWallSet_Wall_D0L, _g94_bitmapWall_D0R_Flipped, - g163_FrameWalls[k10_ViewSquare_D0L]._srcWidth, g163_FrameWalls[k10_ViewSquare_D0L]._srcHeight); + g163_FrameWalls[k10_ViewSquare_D0L]._srcByteWidth, g163_FrameWalls[k10_ViewSquare_D0L]._srcHeight); f99_copyBitmapAndFlipHorizontal(_g99_bitmapWall_D0R_Native = _g702_bitmapWallSet_Wall_D0R, _g93_bitmapWall_D0L_Flipped, - g163_FrameWalls[k10_ViewSquare_D0L]._srcWidth, g163_FrameWalls[k10_ViewSquare_D0L]._srcHeight); + g163_FrameWalls[k10_ViewSquare_D0L]._srcByteWidth, g163_FrameWalls[k10_ViewSquare_D0L]._srcHeight); } @@ -1734,14 +1740,14 @@ void DisplayMan::f93_applyCreatureReplColors(int replacedColor, int replacementC } void DisplayMan::f104_drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &f) { - if (f._srcWidth) - f132_blitToBitmap(_bitmaps[nativeIndex], _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + if (f._srcByteWidth) + f132_blitToBitmap(_bitmaps[nativeIndex], _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, 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, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + if (f._srcByteWidth) { + f99_copyBitmapAndFlipHorizontal(f489_getNativeBitmapOrGraphic(nativeIndex), _g74_tmpBitmap, f._srcByteWidth, f._srcHeight); + f132_blitToBitmap(_g74_tmpBitmap, _g296_bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh); } } @@ -1807,7 +1813,7 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall if (isInscription) { Frame &D1CFrame = g163_FrameWalls[k6_ViewSquare_D1C]; f132_blitToBitmap(_g700_bitmapWallSet_Wall_D1LCR, _g296_bitmapViewport, g202_BoxWallPatchBehindInscription, 94, 28, - D1CFrame._srcWidth, k112_byteWidthViewport * 2, k255_ColorNoTransparency); + D1CFrame._srcByteWidth, k112_byteWidthViewport, k255_ColorNoTransparency); unsigned char *string = inscriptionString; bitmapRed = _bitmaps[k120_InscriptionFontIndice]; @@ -1821,7 +1827,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, _g296_bitmapViewport, frame._box, (*string++) * 8, 0, 288, k112_byteWidthViewport * 2, k10_ColorFlesh); + f132_blitToBitmap(bitmapRed, _g296_bitmapViewport, frame._box, (*string++) * 8, 0, 144, k112_byteWidthViewport, k10_ColorFlesh); frame._box._x1 += 8; frame._box._x2 += 8; } @@ -1899,7 +1905,7 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall frame._box._x2 = coordinateSetA[1]; frame._box._y1 = coordinateSetA[2]; frame._box._y2 = coordinateSetA[3]; - frame._srcWidth = coordinateSetA[4]; + frame._srcByteWidth = coordinateSetA[4]; frame._srcHeight = coordinateSetA[5]; coordinateSetA = (uint16*)&frame._box; @@ -1907,12 +1913,12 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall coordinateSetA[3] = g204_UnreadableInscriptionBoxY2[g190_WallOrnDerivedBitmapIndexIncrement[viewWallIndex] * 3 + unreadableTextLineCount - 1]; } } - f132_blitToBitmap(bitmapGreen, _g296_bitmapViewport, *(Box*)coordinateSetA, var_X, 0, coordinateSetA[4], k112_byteWidthViewport * 2, k10_ColorFlesh); + f132_blitToBitmap(bitmapGreen, _g296_bitmapViewport, *(Box*)coordinateSetA, var_X, 0, coordinateSetA[4], k112_byteWidthViewport, k10_ColorFlesh); if ((viewWallIndex == k12_ViewWall_D1C_FRONT) && _g289_championPortraitOrdinal--) { Box &box = g109_BoxChampionPortraitOnWall; f132_blitToBitmap(_bitmaps[k26_ChampionPortraitsIndice], _g296_bitmapViewport, box, (_g289_championPortraitOrdinal & 0x7) << 5, - (_g289_championPortraitOrdinal >> 3) * 29, 256, k112_byteWidthViewport * 2, k1_ColorDarkGary); + (_g289_championPortraitOrdinal >> 3) * 29, 128, k112_byteWidthViewport, k1_ColorDarkGary); } return isAlcove; } @@ -1920,22 +1926,22 @@ bool DisplayMan::f107_isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWall } -void DisplayMan::f129_blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap, int16 srcWidth, int16 srcHeight, int16 destWidth, int16 destHeight, byte *palChange) { - double rateW = srcWidth / destWidth; +void DisplayMan::f129_blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap, int16 srcPixelWidth, int16 srcHeight, int16 destPixelWidth, int16 destHeight, byte *palChange) { + double rateW = srcPixelWidth / destPixelWidth; double rateH = srcHeight / destHeight; for (uint16 y = 0; y < destHeight; ++y) { - for (uint16 x = 0; x < destWidth; ++x) { + for (uint16 x = 0; x < destPixelWidth; ++x) { if (palChange) - destBitmap[y * destWidth + x] = palChange[srcBitmap[(int)(y * rateH * srcWidth) + (int)(x * rateW)]]; + destBitmap[y * destPixelWidth + x] = palChange[srcBitmap[(int)(y * rateH * srcPixelWidth) + (int)(x * rateW)]]; else - destBitmap[y * destWidth + x] = srcBitmap[(int)(y * rateH * srcWidth) + (int)(x * rateW)]; + destBitmap[y * destPixelWidth + x] = srcBitmap[(int)(y * rateH * srcPixelWidth) + (int)(x * rateW)]; } } } -byte* DisplayMan::f489_getBitmap(uint16 index) { +byte* DisplayMan::f489_getNativeBitmapOrGraphic(uint16 index) { return _bitmaps[index]; } @@ -1960,21 +1966,21 @@ void DisplayMan::f113_drawField(FieldAspect* fieldAspect, Box& box) { bitmapMask = nullptr; } else { bitmapMask = dispMan._g74_tmpBitmap; - memmove(bitmapMask, dispMan.f489_getBitmap(k69_FieldMask_D3R_GraphicIndice + getFlag(fieldAspect->_mask, kMaskFieldAspectIndex)), - fieldAspect->_height * fieldAspect->_pixelWidth * sizeof(bitmapMask[0])); + memmove(bitmapMask, dispMan.f489_getNativeBitmapOrGraphic(k69_FieldMask_D3R_GraphicIndice + getFlag(fieldAspect->_mask, kMaskFieldAspectIndex)), + fieldAspect->_height * fieldAspect->_byteWidth * 2 * sizeof(bitmapMask[0])); if (getFlag(fieldAspect->_mask, kMaskFieldAspectFlipMask)) { - dispMan.f130_flipBitmapHorizontal(bitmapMask, fieldAspect->_pixelWidth, fieldAspect->_height); + dispMan.f130_flipBitmapHorizontal(bitmapMask, fieldAspect->_byteWidth, fieldAspect->_height); } } - byte *bitmap = dispMan.f489_getBitmap(k73_FieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex); + byte *bitmap = dispMan.f489_getNativeBitmapOrGraphic(k73_FieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex); warning("MISSING CODE: F0133_VIDEO_BlitBoxFilledWithMaskedBitmap"); warning("IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache, F0493_CACHE_AddDerivedBitmap, F0480_CACHE_ReleaseBlock"); } -int16 DisplayMan::f459_getScaledBitmapPixelCount(int16 pixelWidth, int16 pixelHeight, int16 scale) { - return M78_getScaledDimension(pixelWidth, scale) * M78_getScaledDimension(pixelHeight, scale); +int16 DisplayMan::f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale) { + return M77_getNormalizedByteWidth(M78_getScaledDimension(byteWidth, scale)) * M78_getScaledDimension(height, scale); } int16 DisplayMan::M78_getScaledDimension(int16 dimension, int16 scale) { @@ -2326,11 +2332,11 @@ T0115015_DrawProjectileAsObject: /* If object is in the center lane (only D0C or D1C with condition above) and is not a projectile */ drawingGrabbableObject = (!viewLane && !drawProjectileAsObject); AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front; - AL_6_bitmapRedBanana = f489_getBitmap(AL_4_nativeBitmapIndex); /* Use base graphic, no resizing */ - byteWidth = objectAspect->_width; + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); /* Use base graphic, no resizing */ + byteWidth = objectAspect->_byteWidth; heightRedEagle = objectAspect->_height; if (flipHorizontal) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * heightRedEagle * sizeof(byte)); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * 2 * heightRedEagle * sizeof(byte)); f130_flipBitmapHorizontal(_g74_tmpBitmap, byteWidth, heightRedEagle); AL_6_bitmapRedBanana = _g74_tmpBitmap; } @@ -2340,18 +2346,18 @@ T0115015_DrawProjectileAsObject: if ((viewSquareIndex >= k6_ViewSquare_D1C) || ((viewSquareIndex >= k3_ViewSquare_D2C) && (AL_2_viewCell >= k2_ViewCellBackRight))) { derivedBitmapIndex++; AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front; - byteWidth = M78_getScaledDimension(objectAspect->_width, k20_Scale_D2); + byteWidth = M78_getScaledDimension(objectAspect->_byteWidth, k20_Scale_D2); heightRedEagle = M78_getScaledDimension(objectAspect->_height, k20_Scale_D2); paletteChanges = g214_PalChangesFloorOrn_D2; } else { AL_8_shiftSetIndex = k2_ShiftSet_D2BackD3Front; - byteWidth = M78_getScaledDimension(objectAspect->_width, k16_Scale_D3); + byteWidth = M78_getScaledDimension(objectAspect->_byteWidth, k16_Scale_D3); heightRedEagle = M78_getScaledDimension(objectAspect->_height, k16_Scale_D3); paletteChanges = g213_PalChangesFloorOrn_D3; } if (flipHorizontal) { derivedBitmapIndex += 2; - paddingPixelCount = (7 - ((byteWidth / 2 - 1) & 0x0007)) << 1; + paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; } else if (useAlcoveObjectImage) { derivedBitmapIndex += 4; } @@ -2359,12 +2365,12 @@ T0115015_DrawProjectileAsObject: if (f491_isDerivedBitmapInCache(derivedBitmapIndex)) { AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); } else { - bitmapGreenAnt = f489_getBitmap(AL_4_nativeBitmapIndex); + bitmapGreenAnt = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex), - objectAspect->_width, objectAspect->_height, - byteWidth, heightRedEagle, paletteChanges); + objectAspect->_byteWidth * 2, objectAspect->_height, + byteWidth * 2, heightRedEagle, paletteChanges); if (flipHorizontal) { - f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, byteWidth, heightRedEagle); + f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, M77_getNormalizedByteWidth(byteWidth), heightRedEagle); } warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap"); } @@ -2413,14 +2419,14 @@ T0115015_DrawProjectileAsObject: } } else { /* If there are several grabbable objects then enlarge the box so it includes all objects */ AL_6_boxPtrRed->_x1 = MIN(AL_6_boxPtrRed->_x1, boxByteGreen._x1); - AL_6_boxPtrRed->_x2 = MIN(AL_6_boxPtrRed->_x2, boxByteGreen._x2); + AL_6_boxPtrRed->_x2 = MAX(AL_6_boxPtrRed->_x2, boxByteGreen._x2); AL_6_boxPtrRed->_y1 = MIN(AL_6_boxPtrRed->_y1, boxByteGreen._y1); - AL_6_boxPtrRed->_y2 = MIN(AL_6_boxPtrRed->_y2, boxByteGreen._y2); + AL_6_boxPtrRed->_y2 = MAX(AL_6_boxPtrRed->_y2, boxByteGreen._y2); } 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, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, M77_getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh); if (drawProjectileAsObject) goto T0115171_BackFromT0115015_DrawProjectileAsObject; @@ -2574,17 +2580,17 @@ T0115077_DrawSecondHalfSquareCreature: AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front; transparentColor = ((CreatureAspect*)objectAspect)->getTranspColour(); if (useCreatureSideBitmap) { - AL_6_bitmapRedBanana = f489_getBitmap(AL_4_nativeBitmapIndex); + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); if (creatureDirectionDelta == 1) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * heightRedEagle * sizeof(byte)); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * 2 * heightRedEagle * sizeof(byte)); f130_flipBitmapHorizontal(_g74_tmpBitmap, byteWidth, heightRedEagle); AL_6_bitmapRedBanana = _g74_tmpBitmap; } } else { if (useCreatureBackBitmap || !useFlippedHorizontallyCreatureFrontImage) { - AL_6_bitmapRedBanana = f489_getBitmap(AL_4_nativeBitmapIndex); + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * heightRedEagle * sizeof(byte)); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * 2 * heightRedEagle * sizeof(byte)); f130_flipBitmapHorizontal(_g74_tmpBitmap, byteWidth, heightRedEagle); AL_6_bitmapRedBanana = _g74_tmpBitmap; } @@ -2592,10 +2598,10 @@ T0115077_DrawSecondHalfSquareCreature: if (f491_isDerivedBitmapInCache(derivedBitmapIndex)) { /* If derived graphic is already in memory */ AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); } else { - bitmapGreenAnt = f489_getBitmap(AL_4_nativeBitmapIndex); + bitmapGreenAnt = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); if (getFlag(AL_0_creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack)) { AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); - memmove(AL_6_bitmapRedBanana, bitmapGreenAnt, byteWidth * heightRedEagle * sizeof(byte)); + memmove(AL_6_bitmapRedBanana, bitmapGreenAnt, byteWidth * 2 * heightRedEagle * sizeof(byte)); f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, byteWidth, heightRedEagle); } warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap"); @@ -2625,9 +2631,9 @@ T0115077_DrawSecondHalfSquareCreature: if (derivedBitmapInCache = f491_isDerivedBitmapInCache(derivedBitmapIndex)) { AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); } else { - bitmapGreenAnt = f489_getBitmap(AL_4_nativeBitmapIndex); + bitmapGreenAnt = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); - f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, sourceByteWidth, sourceHeight, byteWidth, heightRedEagle, paletteChanges); + f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, sourceByteWidth * 2, sourceHeight, byteWidth * 2, heightRedEagle, paletteChanges); warning("IGNORED CODE: F0493_CACHE_AddDerivedBitmap"); } if ((useCreatureSideBitmap && (creatureDirectionDelta == 1)) || /* If creature is viewed from the right, the side view must be flipped */ @@ -2635,15 +2641,14 @@ T0115077_DrawSecondHalfSquareCreature: (useCreatureSpecialD2FrontBitmap && getFlag(AL_0_creatureGraphicInfoRed, k0x0100_CreatureInfoGraphicMaskSpecialD2FrontIsFlipped)) || (useFlippedHorizontallyCreatureFrontImage && getFlag(AL_0_creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack))) { /* If the graphic should be flipped */ if (!useFlippedHorizontallyCreatureFrontImage || !derivedBitmapInCache) { - AL_4_normalizdByteWidth = byteWidth; - warning("SUPER WARNING: we might need M77_getNormalizedByteWidth"); + AL_4_normalizdByteWidth = M77_getNormalizedByteWidth(byteWidth); if (!useFlippedHorizontallyCreatureFrontImage) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, AL_4_normalizdByteWidth * heightRedEagle * sizeof(byte)); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, AL_4_normalizdByteWidth * 2 * heightRedEagle * sizeof(byte)); AL_6_bitmapRedBanana = _g74_tmpBitmap; } f130_flipBitmapHorizontal(AL_6_bitmapRedBanana, AL_4_normalizdByteWidth, heightRedEagle); } - creaturePaddingPixelCount = (7 - ((byteWidth / 2 - 1) & 0x0007)) << 1; + creaturePaddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; } else { creaturePaddingPixelCount = 0; } @@ -2651,7 +2656,7 @@ T0115077_DrawSecondHalfSquareCreature: AL_4_yPos = coordinateSet[1]; AL_4_yPos += g223_ShiftSets[AL_8_shiftSetIndex][M23_getVerticalOffsetM23(creatureAspectInt)]; boxByteGreen._y2 = MIN(AL_4_yPos, (int16)135); - boxByteGreen._y1 = MIN(0, AL_4_yPos - (heightRedEagle - 1)); + boxByteGreen._y1 = MAX(0, AL_4_yPos - (heightRedEagle - 1)); AL_4_xPos = coordinateSet[0]; AL_4_xPos += g223_ShiftSets[AL_8_shiftSetIndex][M22_getHorizontalOffsetM22(creatureAspectInt)]; if (viewLane == k1_ViewLaneLeft) { @@ -2670,8 +2675,7 @@ T0115077_DrawSecondHalfSquareCreature: } else { AL_0_creaturePosX = creaturePaddingPixelCount + (byteWidth - AL_4_xPos - 1); } - warning("SUPER WARNINIG: we might nee noralized with on byteWidth"); - f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_0_creaturePosX, 0, byteWidth, k112_byteWidthViewport * 2, (Color)transparentColor); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_0_creaturePosX, 0, M77_getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, (Color)transparentColor); T0115126_CreatureNotVisible: if (twoHalfSquareCreaturesFrontView) { @@ -2703,7 +2707,7 @@ continue; if (((doNotScaleWithKineticEnergy = !getFlag(((ProjectileAspect*)objectAspect)->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask)) || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == k9_ViewSquare_D0C)) { scale = 0; /* Use native bitmap without resizing */ - byteWidth = ((ProjectileAspect*)objectAspect)->_width; + byteWidth = ((ProjectileAspect*)objectAspect)->_byteWidth; heightRedEagle = ((ProjectileAspect*)objectAspect)->_height; } else { AL_8_projectileScaleIndex = ((viewSquareIndex / 3) << 1) + (AL_2_viewCell >> 1); @@ -2711,7 +2715,7 @@ continue; if (!doNotScaleWithKineticEnergy) { scale = (scale * MAX(96, projectile->_kineticEnergy + 1)) >> 8; } - byteWidth = M78_getScaledDimension(((ProjectileAspect*)objectAspect)->_width, scale); + byteWidth = M78_getScaledDimension(((ProjectileAspect*)objectAspect)->_byteWidth, scale); heightRedEagle = M78_getScaledDimension(((ProjectileAspect*)objectAspect)->_height, scale); } if (projectileAspectTypeHasBackGraphicAndRotation = (projectileAspectType == k0_ProjectileAspectHasBackGraphicRotation)) { @@ -2754,33 +2758,32 @@ continue; AL_4_nativeBitmapIndex += projectileBitmapIndexData; paddingPixelCount = 0; if (!scale) { - AL_6_bitmapRedBanana = f489_getBitmap(AL_4_nativeBitmapIndex); + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); } else { if (flipHorizontal) { - paddingPixelCount = (7 - ((byteWidth / 2 - 1) & 0x0007)) << 1; + paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; } derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + ((ProjectileAspect*)objectAspect)->_firstNativeBitmapRelativeIndex + (projectileBitmapIndexData * 6); if (doNotScaleWithKineticEnergy && f491_isDerivedBitmapInCache(derivedBitmapIndex) + AL_8_projectileScaleIndex) { AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); } else { - bitmapGreenAnt = f489_getBitmap(AL_4_nativeBitmapIndex); + bitmapGreenAnt = f489_getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); if (doNotScaleWithKineticEnergy) { AL_6_bitmapRedBanana = f492_getDerivedBitmap(derivedBitmapIndex); } else { AL_6_bitmapRedBanana = _g74_tmpBitmap; } - f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, ((ProjectileAspect*)objectAspect)->_width, ((ProjectileAspect*)objectAspect)->_height, - byteWidth, heightRedEagle, _g75_palChangesProjectile[AL_8_projectileScaleIndex >> 1]); + f129_blitToBitmapShrinkWithPalChange(bitmapGreenAnt, AL_6_bitmapRedBanana, ((ProjectileAspect*)objectAspect)->_byteWidth * 2, ((ProjectileAspect*)objectAspect)->_height, + byteWidth * 2, heightRedEagle, _g75_palChangesProjectile[AL_8_projectileScaleIndex >> 1]); if (doNotScaleWithKineticEnergy) { warning("IGNORED CODE F0493_CACHE_AddDerivedBitmap"); } } } if (flipHorizontal || flipVertical) { - warning("might need noralized bytewidth"); - AL_4_normalizdByteWidth = byteWidth; + AL_4_normalizdByteWidth = M77_getNormalizedByteWidth(byteWidth); if (AL_6_bitmapRedBanana != _g74_tmpBitmap) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, AL_4_normalizdByteWidth * heightRedEagle * sizeof(byte)); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, AL_4_normalizdByteWidth * 2 * heightRedEagle * sizeof(byte)); AL_6_bitmapRedBanana = _g74_tmpBitmap; } if (flipVertical) { @@ -2806,7 +2809,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, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, M77_getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh); } else { /* Positive value: projectile aspect is the index of a OBJECT_ASPECT */ useAlcoveObjectImage = false; projectileCoordinates[0] = projectilePosX; @@ -2854,14 +2857,14 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; } else { if (AL_4_explosionType == k100_ExplosionType_RebirthStep1) { objectAspect = (ObjectAspect*)&g210_ProjectileAspect[_vm->M1_ordinalToIndex(-dunMan.f142_getProjectileAspect(Thing::_explLightningBolt))]; - AL_6_bitmapRedBanana = f489_getBitmap(((ProjectileAspect*)objectAspect)->_firstNativeBitmapRelativeIndex + (k316_FirstProjectileGraphicIndice + 1)); + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(((ProjectileAspect*)objectAspect)->_firstNativeBitmapRelativeIndex + (k316_FirstProjectileGraphicIndice + 1)); explosionCoordinates = g228_RebirthStep1ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3]; - byteWidth = M78_getScaledDimension((((ProjectileAspect*)objectAspect)->_width), explosionCoordinates[2]); + byteWidth = M78_getScaledDimension((((ProjectileAspect*)objectAspect)->_byteWidth), explosionCoordinates[2]); heightRedEagle = M78_getScaledDimension((((ProjectileAspect*)objectAspect)->_height), explosionCoordinates[2]); if (AL_1_viewSquareExplosionIndex != k9_ViewSquare_D1C_Explosion) { f129_blitToBitmapShrinkWithPalChange(AL_6_bitmapRedBanana, _g74_tmpBitmap, - ((ProjectileAspect*)objectAspect)->_width, ((ProjectileAspect*)objectAspect)->_height, - byteWidth, heightRedEagle, g17_PalChangesNoChanges); + ((ProjectileAspect*)objectAspect)->_byteWidth * 2, ((ProjectileAspect*)objectAspect)->_height, + byteWidth * 2, heightRedEagle, g17_PalChangesNoChanges); AL_6_bitmapRedBanana = _g74_tmpBitmap; } goto T0115200_DrawExplosion; @@ -2888,7 +2891,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; } } warning("IGNORED CODE: F0491_CACHE_IsDerivedBitmapInCache"); - AL_6_bitmapRedBanana = f489_getBitmap(AL_4_explosionAspectIndex + k351_FirstExplosionPatternGraphicIndice); + AL_6_bitmapRedBanana = f489_getNativeBitmapOrGraphic(AL_4_explosionAspectIndex + k351_FirstExplosionPatternGraphicIndice); if (smoke) { f129_blitToBitmapShrinkWithPalChange(AL_6_bitmapRedBanana, _g74_tmpBitmap, 48, 32, 48, 32, g212_PalChangeSmoke); AL_6_bitmapRedBanana = _g74_tmpBitmap; @@ -2920,7 +2923,7 @@ T0115200_DrawExplosion: flipVertical = _vm->_rnd->getRandomNumber(2); paddingPixelCount = 0; if (flipHorizontal = _vm->_rnd->getRandomNumber(2)) { - paddingPixelCount = (7 - ((byteWidth / 2 - 1) & 0x0007)) << 1; /* Number of unused pixels in the units on the right of the bitmap */ + 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)); AL_4_yPos = MAX(0, explosionCoordinates[1] - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001)); @@ -2938,7 +2941,7 @@ T0115200_DrawExplosion: left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is not flipped horizontally (flipHorizontal = C0_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 */ - AL_4_xPos = MIN(paddingPixelCount, (int16)(byteWidth / 2 - AL_4_xPos - 1)); + AL_4_xPos = MAX(paddingPixelCount, (int16)(byteWidth - AL_4_xPos - 1)); /* 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 = C1_TRUE) @@ -2946,10 +2949,9 @@ then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingP } if (boxByteGreen._x2 <= boxByteGreen._x1) continue; - warning("might need M77_NORMALIZED_BYTE_WIDTH"); - byteWidth = byteWidth; + byteWidth = M77_getNormalizedByteWidth(byteWidth); if (flipHorizontal || flipVertical) { - memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * heightRedEagle); + memmove(_g74_tmpBitmap, AL_6_bitmapRedBanana, byteWidth * 2 * heightRedEagle); AL_6_bitmapRedBanana = _g74_tmpBitmap; } if (flipHorizontal) { @@ -2958,7 +2960,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, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport * 2, k10_ColorFlesh); + f132_blitToBitmap(AL_6_bitmapRedBanana, _g296_bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, k10_ColorFlesh); } } } while ((thingParam = dunMan.f159_getNextThing(thingParam)) != Thing::_endOfList); @@ -2996,5 +2998,8 @@ byte* DisplayMan::f492_getDerivedBitmap(int16 derivedBitmapIndex) { return _g638_derivedBitmaps[derivedBitmapIndex]; } +void DisplayMan::f493_addDerivedBitmap(int16 derivedBitmapIndex) { + warning("f493_addDerivedBitmap DOES NOTHING"); +} } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 282dfc2f3d..50a6d5e267 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -111,10 +111,10 @@ namespace DM { class ExplosionAspect { public: - uint16 _pixelWidth; + uint16 _byteWidth; uint16 _height; - ExplosionAspect(uint16 byteWidth, uint16 height) :_pixelWidth(byteWidth * 2), _height(height) {} + ExplosionAspect(uint16 byteWidth, uint16 height) :_byteWidth(byteWidth), _height(height) {} }; // @ EXPLOSION_ASPECT extern ExplosionAspect g211_ExplosionAspects[k4_ExplosionAspectCount]; // @ G0211_as_Graphic558_ExplosionAspects @@ -252,14 +252,14 @@ extern Box g2_BoxMovementArrows; // @ G0002_s_Graphic562_Box_MovementArrows class Frame { public: Box _box; - uint16 _srcWidth, _srcHeight; + uint16 _srcByteWidth, _srcHeight; uint16 _srcX, _srcY; Frame() {} Frame(uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY, uint16 srcWidth, uint16 srcHeight, uint16 srcX, uint16 srcY) : _box(destFromX, destToX, destFromY, destToY), - _srcWidth(srcWidth * 2), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {} + _srcByteWidth(srcWidth), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {} }; enum WallSet { @@ -312,13 +312,13 @@ public: uint16 _baseStartUnitIndex; /* Index of the unit (16 pixels = 8 bytes) in bitmap where blit will start from. A random value of 0 or 1 is added to this base index */ uint16 _transparentColor; /* Bit 7: Do not use mask if set, Bits 6-0: Transparent color index. 0xFF = no transparency */ byte _mask; /* Bit 7: Flip, Bits 6-0: Mask index. 0xFF = no mask */ - uint16 _pixelWidth; + uint16 _byteWidth; uint16 _height; uint16 _xPos; uint16 _bitplaneWordCount; FieldAspect(uint16 native, uint16 base, uint16 transparent, byte mask, uint16 byteWidth, uint16 height, uint16 xPos, uint16 bitplane) : _nativeBitmapRelativeIndex(native), _baseStartUnitIndex(base), _transparentColor(transparent), _mask(mask), - _pixelWidth(byteWidth * 2), _height(height), _xPos(xPos), _bitplaneWordCount(bitplane) {} + _byteWidth(byteWidth), _height(height), _xPos(xPos), _bitplaneWordCount(bitplane) {} FieldAspect() {} }; // @ FIELD_ASPECT @@ -342,11 +342,11 @@ public: CreatureAspect(uint16 uint161, uint16 uint162, byte byte0, byte byte1, byte byte2, byte byte3, byte byte4, byte byte5, byte byte6, byte byte7) : _firstNativeBitmapRelativeIndex(uint161), _firstDerivedBitmapIndex(uint162), - _byteWidthFront(byte0 * 2), + _byteWidthFront(byte0), _heightFront(byte1), - _byteWidthSide(byte2 * 2), + _byteWidthSide(byte2), _heightSide(byte3), - _byteWidthAttack(byte4 * 2), + _byteWidthAttack(byte4), _heightAttack(byte5), _coordinateSet_TransparentColor(byte6), _replacementColorSetIndices(byte7) {} @@ -355,34 +355,32 @@ public: byte getTranspColour() { return _coordinateSet_TransparentColor & 0xF; } // @ M72_TRANSPARENT_COLOR byte getReplColour10() { return (_replacementColorSetIndices >> 4) & 0xF; } // @ M74_COLOR_10_REPLACEMENT_COLOR_SET byte getReplColour9() { return _replacementColorSetIndices & 0xF; } // @ M73_COLOR_09_REPLACEMENT_COLOR_SET - - }; // @ CREATURE_ASPECT class ObjectAspect { public: byte _firstNativeBitmapRelativeIndex; byte _firstDerivedBitmapRelativeIndex; - byte _width; + byte _byteWidth; byte _height; byte _graphicInfo; /* Bits 7-5 and 3-1 Unreferenced */ byte _coordinateSet; ObjectAspect(byte firstN, byte firstD, byte byteWidth, byte h, byte grap, byte coord) : _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD), - _width(byteWidth * 2), _height(h), _graphicInfo(grap), _coordinateSet(coord) {} + _byteWidth(byteWidth), _height(h), _graphicInfo(grap), _coordinateSet(coord) {} }; // @ OBJECT_ASPECT class ProjectileAspect { public: byte _firstNativeBitmapRelativeIndex; byte _firstDerivedBitmapRelativeIndex; - byte _width; + byte _byteWidth; byte _height; uint16 _graphicInfo; /* Bits 15-9, 7-5 and 3-2 Unreferenced */ ProjectileAspect(byte firstN, byte firstD, byte byteWidth, byte h, uint16 grap) : _firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD), - _width(byteWidth * 2), _height(h), _graphicInfo(grap) {} + _byteWidth(byteWidth), _height(h), _graphicInfo(grap) {} }; // @ PROJECTIL_ASPECT class CreatureReplColorSet { @@ -541,9 +539,9 @@ public: void f461_allocateFlippedWallBitmaps(); // @ F0461_START_AllocateFlippedWallBitmaps /// Gives the width of an IMG0 type item - uint16 getWidth(uint16 index); + uint16 getPixelWidth(uint16 index); /// Gives the height of an IMG1 type item - uint16 getHeight(uint16 index); + uint16 getPixelHeight(uint16 index); void f99_copyBitmapAndFlipHorizontal(byte *srcBitmap, byte *destBitmap, uint16 byteWidth, uint16 height); @@ -553,34 +551,35 @@ public: does not pass anything, newly imported calls do pass srcHeght and srcWidth, so this is a ceonvenience change so the the parameters match the original exatcly, if need arises for heights then we'll have to retrospectively add them in old function calls*/ /* Expects inclusive boundaries in box */ - void f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcWidth, - uint16 destWidth, Color transparent = k255_ColorNoTransparency, int16 srcHeight = -1, int16 destHight = -1); // @ F0132_VIDEO_Blit + void f132_blitToBitmap(byte *srcBitmap, byte *destBitmap, Box &box, uint16 srcX, uint16 srcY, uint16 srcByteWidth, + uint16 destByteWidth, Color transparent = k255_ColorNoTransparency, int16 srcHeight = -1, int16 destHight = -1); // @ F0132_VIDEO_Blit /* Expects inclusive boundaries in box */ void f133_blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex, - int16 firstUnitIndex, int16 destPixelWidth, Color transparent, + int16 firstUnitIndex, int16 destByteWidth, Color transparent, int16 xPos, int16 yPos, int16 destHeight, int16 height2); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap + // this function takes pixel widths void f129_blitToBitmapShrinkWithPalChange(byte *srcBitmap, byte *destBitmap, - int16 srcWidth, int16 srcHight, int16 destWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges - void f130_flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height); // @ F0130_VIDEO_FlipHorizontal - void flipBitmapVertical(byte *bitmap, uint16 width, uint16 height); - byte *f114_getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16 &returnPixelWidth, int16 &returnHeight); // @ F0114_DUNGEONVIEW_GetExplosionBitmap + int16 srcPixelWidth, int16 srcHight, int16 destPixelWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges + void f130_flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height); // @ F0130_VIDEO_FlipHorizontal + void flipBitmapVertical(byte *bitmap, uint16 byteWidth, uint16 height); + byte *f114_getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int16 &returnByteWidth, int16 &returnHeight); // @ F0114_DUNGEONVIEW_GetExplosionBitmap - void f134_fillBitmap(byte *bitmap, Color color, uint16 width, uint16 height); // @ F0134_VIDEO_FillBitmap + void f134_fillBitmap(byte *bitmap, Color color, uint16 byteWidth, uint16 height); // @ F0134_VIDEO_FillBitmap void fillScreen(Color color); /* Expects inclusive boundaries in box */ void D24_fillScreenBox(Box &box, Color color); // @ D24_FillScreenBox, F0550_VIDEO_FillScreenBox /* Expects inclusive boundaries in box */ - void f135_fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 pixelWidth, int16 height); // @ F0135_VIDEO_FillBox + void f135_fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height); // @ F0135_VIDEO_FillBox void f128_drawDungeon(direction dir, int16 posX, int16 posY); // @ F0128_DUNGEONVIEW_Draw_CPSF void updateScreen(); void f97_drawViewport(int16 palSwitchingRequestedState); // @ F0097_DUNGEONVIEW_DrawViewport - byte* f489_getBitmap(uint16 index); // @ F0489_MEMORY_GetNativeBitmapOrGraphic + byte* f489_getNativeBitmapOrGraphic(uint16 index); // @ F0489_MEMORY_GetNativeBitmapOrGraphic Common::MemoryReadStream getCompressedData(uint16 index); uint32 getCompressedDataSize(uint16 index); void f113_drawField(FieldAspect *fieldAspect, Box &box); // @ F0113_DUNGEONVIEW_DrawField - int16 f459_getScaledBitmapPixelCount(int16 pixelWidth, int16 pixelHeight, int16 scale); // @ F0459_START_GetScaledBitmapByteCount + int16 f459_getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale); // @ F0459_START_GetScaledBitmapByteCount int16 M78_getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION void f115_cthulhu(Thing thingParam, direction directionParam, int16 mapXpos, int16 mapYpos, int16 viewSquareIndex, @@ -611,6 +610,7 @@ public: bool f491_isDerivedBitmapInCache(int16 derivedBitmapIndex); // @ F0491_CACHE_IsDerivedBitmapInCache byte *f492_getDerivedBitmap(int16 derivedBitmapIndex); // @ F0492_CACHE_GetDerivedBitmap + void f493_addDerivedBitmap(int16 derivedBitmapIndex); // @ F0493_CACHE_AddDerivedBitmap diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 77242c1e58..1583c6f994 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -96,7 +96,7 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { champion = &cm._gK71_champions[championIndex]; dm.f466_loadIntoBitmap(k17_InventoryGraphicIndice, dm._g296_bitmapViewport); if (cm._g299_candidateChampionOrdinal) { - dm.f135_fillBoxBitmap(dm._g296_bitmapViewport, g41_BoxFloppyZzzCross, k12_ColorDarkestGray, k112_byteWidthViewport * 2, k136_heightViewport); + dm.f135_fillBoxBitmap(dm._g296_bitmapViewport, g41_BoxFloppyZzzCross, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport); } _vm->_textMan->f52_printToViewport(5, 116, k13_ColorLightestGray, "HEALTH"); _vm->_textMan->f52_printToViewport(5, 124, k13_ColorLightestGray, "STAMINA"); @@ -128,7 +128,7 @@ void InventoryMan::f354_drawStatusBoxPortrait(ChampionIndex championIndex) { box._y2 = 28; box._x1 = championIndex * k69_ChampionStatusBoxSpacing + 7; box._x2 = box._x1 + 31; - dispMan.f132_blitToBitmap(_vm->_championMan->_gK71_champions[championIndex]._portrait, dispMan._g348_bitmapScreen, box, 0, 0, 32, k160_byteWidthScreen * 2, k255_ColorNoTransparency); + dispMan.f132_blitToBitmap(_vm->_championMan->_gK71_champions[championIndex]._portrait, dispMan._g348_bitmapScreen, box, 0, 0, 16, k160_byteWidthScreen, k255_ColorNoTransparency); } void InventoryMan::f343_drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) { @@ -161,11 +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), 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); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k20_PanelEmptyIndice), dispMan._g348_bitmapScreen, g32_BoxPanel, 0, 0, 72, k160_byteWidthScreen, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k30_FoodLabelIndice), dispMan._g348_bitmapScreen, g35_BoxFood, 0, 0, 24, k160_byteWidthScreen, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k31_WaterLabelIndice), dispMan._g348_bitmapScreen, g36_BoxWater, 0, 0, 24, k160_byteWidthScreen, k12_ColorDarkestGray); if (champ._poisonEventCount) { - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k32_PoisionedLabelIndice), dispMan._g348_bitmapScreen, g37_BoxPoisoned, 0, 0, 96, k160_byteWidthScreen * 2, k12_ColorDarkestGray); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k32_PoisionedLabelIndice), dispMan._g348_bitmapScreen, g37_BoxPoisoned, 0, 0, 48, k160_byteWidthScreen, k12_ColorDarkestGray); } f344_drawPanelFoodOrWaterBar(champ._food, 69, k5_ColorLightBrown); f344_drawPanelFoodOrWaterBar(champ._water, 92, k14_ColorBlue); @@ -173,7 +173,8 @@ void InventoryMan::f345_drawPanelFoodWaterPoisoned() { void InventoryMan::f346_drawPanelResurrectReincarnate() { _g424_panelContent = k5_PanelContentResurrectReincarnate; - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getBitmap(k40_PanelResurectReincaranteIndice), _vm->_displayMan->_g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k6_ColorDarkGreen); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k40_PanelResurectReincaranteIndice), + _vm->_displayMan->_g296_bitmapViewport, g32_BoxPanel, 0, 0, 72, k112_byteWidthViewport, k6_ColorDarkGreen); } void InventoryMan::f347_drawPanel() { @@ -256,7 +257,7 @@ void InventoryMan::f341_drawPanelScroll(Scroll* scroll) { charRed++; } *charRed = '\0'; - dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k23_PanelOpenScrollIndice), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 144, k112_byteWidthViewport * 2, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k23_PanelOpenScrollIndice), dispMan._g296_bitmapViewport, g32_BoxPanel, 0, 0, 72, k112_byteWidthViewport, k8_ColorRed); int16 lineCount = 1; charRed++; char *charGreen = charRed; // first char of the second line @@ -308,7 +309,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), dispMan._g348_bitmapScreen, g32_BoxPanel, 0, 0, 144, k160_byteWidthScreen * 2, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k25_PanelOpenChestIndice), dispMan._g348_bitmapScreen, g32_BoxPanel, 0, 0, 72, k160_byteWidthScreen, k8_ColorRed); int16 chestSlotIndex = 0; Thing thing = chest->getSlot(); @@ -334,7 +335,7 @@ void InventoryMan::f332_drawIconToViewport(IconIndice iconIndex, int16 xPos, int box._x2 = (box._x1 = xPos) + 15; box._y2 = (box._y1 = yPos) + 15; _vm->_objectMan->f36_extractIconFromBitmap(iconIndex, iconBitmap); - _vm->_displayMan->f132_blitToBitmap(iconBitmap, _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport * 2, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconBitmap, _vm->_displayMan->_g296_bitmapViewport, box, 0, 0, 8, k112_byteWidthViewport, k255_ColorNoTransparency); } void InventoryMan::f336_buildObjectAttributeString(int16 potentialAttribMask, int16 actualAttribMask, char** attribStrings, char* destString, char* prefixString, char* suffixString) { @@ -408,7 +409,8 @@ 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), dispMan._g296_bitmapViewport, g33_BoxArrowOrEye, 0, 0, 16, k112_byteWidthViewport * 2, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(pressingEye ? k19_EyeForObjectDescriptionIndice : k18_ArrowForChestContentIndice), + dispMan._g296_bitmapViewport, g33_BoxArrowOrEye, 0, 0, 8, k112_byteWidthViewport, k8_ColorRed); } @@ -440,8 +442,10 @@ 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), 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); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k20_PanelEmptyIndice), dispMan._g296_bitmapViewport, + g32_BoxPanel, 0, 0, 72, k112_byteWidthViewport, k8_ColorRed); + dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k29_ObjectDescCircleIndice), dispMan._g296_bitmapViewport, + g34_BoxObjectDescCircle, 0, 0, 16, k112_byteWidthViewport, k12_ColorDarkestGray); char *descString = nullptr; char str[40]; diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 63ca90c8fd..376b629d28 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -60,11 +60,11 @@ MenuMan::~MenuMan() { void MenuMan::f395_drawMovementArrows() {
DisplayMan &disp = *_vm->_displayMan;
- byte *arrowsBitmap = disp.f489_getBitmap(k13_MovementArrowsIndice);
+ byte *arrowsBitmap = disp.f489_getNativeBitmapOrGraphic(k13_MovementArrowsIndice);
Box &dest = g2_BoxMovementArrows;
- uint16 w = disp.getWidth(k13_MovementArrowsIndice);
+ uint16 byteWidth = disp.getPixelWidth(k13_MovementArrowsIndice) / 2;
- disp.f132_blitToBitmap(arrowsBitmap, disp._g348_bitmapScreen, dest, 0, 0, w, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ disp.f132_blitToBitmap(arrowsBitmap, disp._g348_bitmapScreen, dest, 0, 0, byteWidth, k160_byteWidthScreen, k255_ColorNoTransparency);
}
void MenuMan::f388_clearActingChampion() {
ChampionMan &cm = *_vm->_championMan;
@@ -113,7 +113,7 @@ T0386006: box2._x2 = box._x2 - 2;
box2._y1 = 95;
box2._y2 = 110;
- dm.f132_blitToBitmap(bitmapIcon, dm._g348_bitmapScreen, box2, 0, 0, 16, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ dm.f132_blitToBitmap(bitmapIcon, dm._g348_bitmapScreen, box2, 0, 0, 8, k160_byteWidthScreen, k255_ColorNoTransparency);
if (champion.getAttributes(k0x0008_ChampionAttributeDisableAction) || _vm->_championMan->_g299_candidateChampionOrdinal || _vm->_championMan->_g300_partyIsSleeping) {
warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
}
@@ -208,11 +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), 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,
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k10_MenuActionAreaIndice), dispMan._g348_bitmapScreen,
+ box, 0, 0, 48, k160_byteWidthScreen, k255_ColorNoTransparency);
+ textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen,
+ 235, 83, k0_ColorBlack, k4_ColorCyan, champMan._gK71_champions[_vm->M1_ordinalToIndex(champMan._g506_actingChampionOrdinal)]._name,
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,
+ textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen, 241, 93 + actionListIndex * 12, k4_ColorCyan, k0_ColorBlack,
f384_getActionName(_g713_actionList._actionIndices[actionListIndex]),
k12_ActionNameMaximumLength, k200_heightScreen);
}
@@ -315,23 +317,25 @@ 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), _gK72_bitmapSpellAreaLine, gK74_BoxSpellAreaLine, 0, 12, 96, 96, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k11_MenuSpellAreLinesIndice), _gK72_bitmapSpellAreaLine,
+ gK74_BoxSpellAreaLine, 0, 12, 48, 48, k255_ColorNoTransparency);
int16 x = 1;
byte c = 96 + (6 * champ._symbolStep);
char spellSymbolString[2] = {'\0', '\0'};
for (uint16 symbolIndex = 0; symbolIndex < 6; symbolIndex++) {
spellSymbolString[0] = c++;
- _vm->_textMan->f40_printTextToBitmap(_gK72_bitmapSpellAreaLine, 96, x += 14, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
+ _vm->_textMan->f40_printTextToBitmap(_gK72_bitmapSpellAreaLine, 48, x += 14, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
}
} else if (spellAreaBitmapLine == k3_SpellAreaChampionSymbols) {
dispMan._g578_useByteBoxCoordinates = false;
- dispMan.f132_blitToBitmap(dispMan.f489_getBitmap(k11_MenuSpellAreLinesIndice), _gK72_bitmapSpellAreaLine, gK74_BoxSpellAreaLine, 0, 24, 96, 96, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k11_MenuSpellAreLinesIndice), _gK72_bitmapSpellAreaLine,
+ gK74_BoxSpellAreaLine, 0, 24, 48, 48, k255_ColorNoTransparency);
char spellSymbolString[2] = {'\0', '\0'};
int16 x = 8;
for (uint16 symbolIndex = 0; symbolIndex < 4; symbolIndex++) {
if ((spellSymbolString[0] = champ._symbols[symbolIndex]) == '\0')
break;
- _vm->_textMan->f40_printTextToBitmap(_gK72_bitmapSpellAreaLine, 96, x += 9, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
+ _vm->_textMan->f40_printTextToBitmap(_gK72_bitmapSpellAreaLine, 48, x += 9, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
}
}
}
@@ -345,7 +349,8 @@ 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), dispMan._g348_bitmapScreen, g0_BoxSpellArea, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(dispMan.f489_getNativeBitmapOrGraphic(k9_MenuSpellAreaBackground), dispMan._g348_bitmapScreen, g0_BoxSpellArea, 0, 0,
+ 48, k160_byteWidthScreen, k255_ColorNoTransparency);
warning("MISSING CODE: F0078_MOUSE_ShowPointer");
}
if (champIndex == kM1_ChampionNone) {
@@ -361,9 +366,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, dispMan._g348_bitmapScreen, gK75_BoxSpellAreaLine2, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, dispMan._g348_bitmapScreen, gK75_BoxSpellAreaLine2, 0, 0, 48, k160_byteWidthScreen, k255_ColorNoTransparency);
f392_buildSpellAreaLine(k3_SpellAreaChampionSymbols);
- dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, dispMan._g348_bitmapScreen, gK76_BoxSpellAreaLine3, 0, 0, 96, k160_byteWidthScreen * 2, k255_ColorNoTransparency);
+ dispMan.f132_blitToBitmap(_gK72_bitmapSpellAreaLine, dispMan._g348_bitmapScreen, gK76_BoxSpellAreaLine3, 0, 0, 48, k160_byteWidthScreen, k255_ColorNoTransparency);
warning("MISSING CODE: F0078_MOUSE_ShowPointer");
}
}
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 1d8b7800bb..ff7ff4dd9d 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -192,11 +192,11 @@ void ObjectMan::f36_extractIconFromBitmap(uint16 iconIndex, byte *destBitmap) { } --i; - byte *srcBitmap = _vm->_displayMan->f489_getBitmap(k42_ObjectIcons_000_TO_031 + i); + byte *srcBitmap = _vm->_displayMan->f489_getNativeBitmapOrGraphic(k42_ObjectIcons_000_TO_031 + i); iconIndex -= g26_IconGraphicFirstIndex[i]; _vm->_displayMan->_g578_useByteBoxCoordinates = true; Box box(0, 0, 15, 15); - _vm->_displayMan->f132_blitToBitmap(srcBitmap, destBitmap, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, 16, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(srcBitmap, destBitmap, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 128, 8, k255_ColorNoTransparency); } void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { @@ -219,15 +219,15 @@ void ObjectMan::f38_drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { } } iconGraphicIndex--; - byte *iconsBitmap = _vm->_displayMan->f489_getBitmap(iconGraphicIndex + k42_ObjectIcons_000_TO_031); + byte *iconsBitmap = _vm->_displayMan->f489_getNativeBitmapOrGraphic(iconGraphicIndex + k42_ObjectIcons_000_TO_031); iconIndex -= g26_IconGraphicFirstIndex[iconGraphicIndex]; _vm->_displayMan->_g578_useByteBoxCoordinates = false; if (slotBoxIndex >= k8_SlotBoxInventoryFirstSlot) { - _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g296_bitmapViewport, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, k112_byteWidthViewport * 2, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g296_bitmapViewport, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 128, k112_byteWidthViewport, k255_ColorNoTransparency); } else { - _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g348_bitmapScreen, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 256, k160_byteWidthScreen * 2, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(iconsBitmap, _vm->_displayMan->_g348_bitmapScreen, box, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 128, k160_byteWidthScreen, k255_ColorNoTransparency); } } @@ -245,7 +245,7 @@ void ObjectMan::f34_drawLeaderObjectName(Thing thing) { } else { objName = _g352_objectNames[iconIndex]; } - _vm->_textMan->f41_printWithTrailingSpaces(_vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen * 2, 233, 37, + _vm->_textMan->f41_printWithTrailingSpaces(_vm->_displayMan->_g348_bitmapScreen, k160_byteWidthScreen, 233, 37, k4_ColorCyan, k0_ColorBlack, objName, k14_ObjectNameMaximumLength, k200_heightScreen); } diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index b29584e3bd..5426dd0f61 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -35,15 +35,17 @@ TextMan::TextMan(DMEngine* vm) : _vm(vm) {} #define k5_LetterWidth 5 #define k6_LetterHeight 6 -void TextMan::f40_printTextToBitmap(byte* destBitmap, uint16 destPixelWidth, uint16 destX, uint16 destY, +void TextMan::f40_printTextToBitmap(byte* destBitmap, uint16 destByteWidth, uint16 destX, uint16 destY, Color textColor, Color bgColor, const char* text, uint16 destHeight) { destX -= 1; // fixes missalignment, to be checked destY -= 4; // fixes missalignment, to be checked + uint16 destPixelWidth = destByteWidth * 2; + uint16 textLength = strlen(text); uint16 nextX = destX; uint16 nextY = destY; - byte *srcBitmap = _vm->_displayMan->f489_getBitmap(k557_FontGraphicIndice); + byte *srcBitmap = _vm->_displayMan->f489_getNativeBitmapOrGraphic(k557_FontGraphicIndice); byte *tmp = _vm->_displayMan->_g74_tmpBitmap; for (uint16 i = 0; i < (k5_LetterWidth + 1) * k6_LetterHeight * 128; ++i) { @@ -61,26 +63,26 @@ 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, destBitmap, box, (nextX == destX) ? (srcX + 1) : srcX, 0, 6 * 128, destPixelWidth, k255_ColorNoTransparency); + _vm->_displayMan->f132_blitToBitmap(srcBitmap, destBitmap, box, (nextX == destX) ? (srcX + 1) : srcX, 0, 6 * 128 / 2, destByteWidth, k255_ColorNoTransparency); nextX += k5_LetterWidth + 1; } } void TextMan::f53_printToLogicalScreen(uint16 destX, uint16 destY, Color textColor, Color bgColor, const char* text) { - f40_printTextToBitmap(_vm->_displayMan->_g348_bitmapScreen, _vm->_displayMan->_screenWidth, destX, destY, textColor, bgColor, text, _vm->_displayMan->_screenHeight); + f40_printTextToBitmap(_vm->_displayMan->_g348_bitmapScreen, _vm->_displayMan->_screenWidth / 2, destX, destY, textColor, bgColor, text, _vm->_displayMan->_screenHeight); } void TextMan::f52_printToViewport(int16 posX, int16 posY, Color textColor, const char* text, Color bgColor) { - f40_printTextToBitmap(_vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport * 2, posX, posY, textColor, bgColor, text, k200_heightScreen); + f40_printTextToBitmap(_vm->_displayMan->_g296_bitmapViewport, k112_byteWidthViewport, posX, posY, textColor, bgColor, text, k200_heightScreen); } -void TextMan::f41_printWithTrailingSpaces(byte* destBitmap, int16 destPixelWidth, int16 destX, int16 destY, Color textColor, +void TextMan::f41_printWithTrailingSpaces(byte* destBitmap, int16 destByteWidth, int16 destX, int16 destY, Color textColor, Color bgColor, const char* text, int16 requiredTextLength, int16 destHeight) { Common::String str = text; for (int16 i = str.size(); i < requiredTextLength; ++i) str += ' '; - f40_printTextToBitmap(destBitmap, destPixelWidth, destX, destY, textColor, bgColor, str.c_str(), destHeight); + f40_printTextToBitmap(destBitmap, destByteWidth, destX, destY, textColor, bgColor, str.c_str(), destHeight); } } diff --git a/engines/dm/text.h b/engines/dm/text.h index adfc42635b..31344e21d9 100644 --- a/engines/dm/text.h +++ b/engines/dm/text.h @@ -37,11 +37,11 @@ class TextMan { DMEngine *_vm; public: explicit TextMan(DMEngine *vm); - void f40_printTextToBitmap(byte *destBitmap, uint16 destPixelWidth, uint16 destX, uint16 destY, + void f40_printTextToBitmap(byte *destBitmap, uint16 destByteWidth, uint16 destX, uint16 destY, Color textColor, Color bgColor, const char *text, uint16 destHeight); // @ F0040_TEXT_Print void f53_printToLogicalScreen(uint16 destX, uint16 destY, Color textColor, Color bgColor, const char *text); // @ F0053_TEXT_PrintToLogicalScreen void f52_printToViewport(int16 posX, int16 posY, Color textColor, const char *text, Color bgColor = k12_ColorDarkestGray); // @ F0052_TEXT_PrintToViewport - void f41_printWithTrailingSpaces(byte *destBitmap, int16 destPixelWidth, int16 destX, int16 destY, Color textColor, Color bgColor, + void f41_printWithTrailingSpaces(byte *destBitmap, int16 destByteWidth, int16 destX, int16 destY, Color textColor, Color bgColor, const char *text, int16 strLenght, int16 destHeight); // @ F0041_TEXT_PrintWithTrailingSpaces }; |