aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/champion.cpp2
-rw-r--r--engines/dm/gfx.cpp67
-rw-r--r--engines/dm/gfx.h20
-rw-r--r--engines/dm/inventory.cpp4
-rw-r--r--engines/dm/menus.cpp4
-rw-r--r--engines/dm/objectman.cpp3
-rw-r--r--engines/dm/objectman.h2
-rw-r--r--engines/dm/text.cpp5
8 files changed, 46 insertions, 61 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 5a85434aa3..a708251a62 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -462,7 +462,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
{ // limit destBox scope
Box &destBox = gBoxChampionPortrait;
dispMan.blitToBitmap(dispMan.getBitmap(k26_ChampionPortraitsIndice), 256, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex),
- champ->_portrait, 32, destBox._x1, destBox._x2, destBox._y1, destBox._y2, k255_ColorNoTransparency);
+ champ->_portrait, 32, destBox, k255_ColorNoTransparency);
}
champ->_actionIndex = k255_ChampionActionNone;
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 25d4c46839..d41bf4900a 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1019,34 +1019,41 @@ void DisplayMan::loadIntoBitmap(uint16 index, byte *destBitmap) {
}
}
-void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- byte *destBitmap, uint16 destWidth,
- uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
- Color transparent, Viewport &destViewport) {
- for (uint16 y = 0; y < destToY - destFromY; ++y)
- for (uint16 x = 0; x < destToX - destFromX; ++x) {
+
+void DisplayMan::blitToBitmap(byte* srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte* destBitmap, uint16 destWidth, Box& box, Color transparent, Viewport& viewport) {
+ for (uint16 y = 0; y < box._y2 - box._y1; ++y)
+ for (uint16 x = 0; x < box._x2 - box._x1; ++x) {
byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x];
if (srcPixel != transparent)
- destBitmap[destWidth * (y + destFromY + destViewport._posY) + destFromX + x + destViewport._posX] = srcPixel;
+ destBitmap[destWidth * (y + box._y1 + viewport._posY) + box._x1 + x + viewport._posX] = srcPixel;
}
+
}
-void DisplayMan::blitToBitmap(byte* srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY, byte* destBitmap, uint16 destWidth, Box& box, Color transparent, Viewport& viewport) {
- blitToBitmap(srcBitmap, srcWidth, srcX, srcY, destBitmap, destWidth, box._x1, box._x2, box._y1, box._y2, transparent, viewport);
+void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, byte *destBitmap, uint16 destWidth, uint16 destX, uint16 destY) {
+ for (uint16 y = 0; y < srcHeight; ++y)
+ memcpy(destBitmap + destWidth*(y + destY) + destX, srcBitmap + y * srcWidth, sizeof(byte)* srcWidth);
+}
+
+void DisplayMan::clearScreenBox(Color color, Box &box, Viewport &viewport) {
+ uint16 width = box._x2 - box._x1;
+ for (int y = box._y1 + viewport._posY; y < box._y2 + viewport._posY; ++y)
+ memset(_g348_bitmapScreen + y * _screenWidth + box._x1 + viewport._posX, color, sizeof(byte) * width);
}
void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
+ Box &box,
Color transparent, Viewport &viewport) {
- blitToBitmap(srcBitmap, srcWidth, srcX, srcY,
- getCurrentVgaBuffer(), _screenWidth, destFromX, destToX, destFromY, destToY, transparent, viewport);
+ blitToBitmap(srcBitmap, srcWidth, srcX, srcY, _g348_bitmapScreen, k160_byteWidthScreen * 2, box, transparent, viewport);
}
-void DisplayMan::blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, byte *destBitmap, uint16 destWidth, uint16 destX, uint16 destY) {
- for (uint16 y = 0; y < srcHeight; ++y)
- memcpy(destBitmap + destWidth*(y + destY) + destX, srcBitmap + y * srcWidth, sizeof(byte)* srcWidth);
+void DisplayMan::blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte* mask, byte* tmp, Box& box,
+ int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent,
+ int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport) {
+ warning("STUB FUNCTION: does nothing at all");
}
+
void DisplayMan::blitBoxFilledWithMaskedBitmapToScreen(byte* src, byte* mask, byte* tmp, Box& box,
int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport& viewport) {
@@ -1819,8 +1826,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
if (viewWallIndex == k12_ViewWall_D1C_FRONT) {
if (isInscription) {
Frame &D1CFrame = g163_FrameWalls[k6_ViewSquare_D1C];
- blitToScreen(_g700_bitmapWallSet_Wall_D1LCR, D1CFrame._srcWidth, 94, 28, g202_BoxWallPatchBehindInscription._x1, g202_BoxWallPatchBehindInscription._x2,
- g202_BoxWallPatchBehindInscription._y1, g202_BoxWallPatchBehindInscription._y2, k255_ColorNoTransparency, g296_DungeonViewport);
+ blitToScreen(_g700_bitmapWallSet_Wall_D1LCR, D1CFrame._srcWidth, 94, 28, g202_BoxWallPatchBehindInscription, k255_ColorNoTransparency, g296_DungeonViewport);
unsigned char *string = inscriptionString;
bitmapRed = _bitmaps[k120_InscriptionFontIndice];
@@ -1923,12 +1929,12 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
coordinateSetA[3] = g204_UnreadableInscriptionBoxY2[g190_WallOrnDerivedBitmapIndexIncrement[viewWallIndex] * 3 + unreadableTextLineCount - 1];
}
}
- blitToScreen(bitmapGreen, coordinateSetA[4], var_X, 0, coordinateSetA[0], coordinateSetA[1], coordinateSetA[2], coordinateSetA[3], k10_ColorFlesh, g296_DungeonViewport);
+ blitToScreen(bitmapGreen, coordinateSetA[4], var_X, 0, *(Box*)coordinateSetA, k10_ColorFlesh, g296_DungeonViewport);
if ((viewWallIndex == k12_ViewWall_D1C_FRONT) && _g289_championPortraitOrdinal--) {
Box &box = g109_BoxChampionPortraitOnWall;
- blitToScreen(_bitmaps[k26_ChampionPortraitsIndice], 256, (_g289_championPortraitOrdinal & 0x7) << 5, (_g289_championPortraitOrdinal >> 3) * 29, box._x1, box._x2, box._y1, box._y2,
- k1_ColorDarkGary, g296_DungeonViewport);
+ blitToScreen(_bitmaps[k26_ChampionPortraitsIndice], 256, (_g289_championPortraitOrdinal & 0x7) << 5, (_g289_championPortraitOrdinal >> 3) * 29,
+ box, k1_ColorDarkGary, g296_DungeonViewport);
}
return isAlcove;
}
@@ -2250,8 +2256,8 @@ void DisplayMan::cthulhu(Thing thingParam, direction directionParam, int16 mapXp
bool drawProjectileAsObject;
bool sqaureHasProjectile;
- uint16 currentViewCellToDraw;
- bool projectileFlipVertical;
+ uint16 currentViewCellToDraw = 0;
+ bool projectileFlipVertical = false;
bool projectileAspectTypeHasBackGraphicAndRotation;
bool flipVertical;
Explosion* explosion;
@@ -3011,22 +3017,5 @@ byte* DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) {
return _g638_derivedBitmaps[derivedBitmapIndex];
}
-void DisplayMan::clearScreenBox(Color color, Box &box, Viewport &viewport) {
- uint16 width = box._x2 - box._x1;
- for (int y = box._y1 + viewport._posY; y < box._y2 + viewport._posY; ++y)
- memset(_g348_bitmapScreen + y * _screenWidth + box._x1 + viewport._posX, color, sizeof(byte) * width);
-}
-
-void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- Box &box,
- Color transparent, Viewport &viewport) {
- blitToScreen(srcBitmap, srcWidth, srcX, srcY, box._x1, box._x2, box._y1, box._y2, transparent, viewport);
-}
-
-void DisplayMan::blitBoxFilledWithMaskedBitmap(byte* src, byte* dest, byte* mask, byte* tmp, Box& box,
- int16 lastUnitIndex, int16 firstUnitIndex, int16 destPixelWidth, Color transparent,
- int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport) {
- warning("STUB FUNCTION: does nothing at all");
-}
}
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 5efa58aaa2..60f6cdb630 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -438,7 +438,6 @@ class DisplayMan {
byte *getCurrentVgaBuffer();
// the original function has two position parameters, but they are always set to zero
- void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void unpackGraphics();
void loadFNT1intoBitmap(uint16 index, byte *destBitmap);
@@ -542,6 +541,7 @@ public:
void loadWallSet(WallSet set); // @ F0095_DUNGEONVIEW_LoadWallSet
void loadFloorSet(FloorSet set); // @ F0094_DUNGEONVIEW_LoadFloorSet
+ void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void setUpScreens(uint16 width, uint16 height);
void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader, F0460_START_InitializeGraphicData
void initializeGraphicData(); // @ F0460_START_InitializeGraphicData
@@ -557,28 +557,22 @@ public:
void f99_copyBitmapAndFlipHorizontal(byte *srcBitmap, byte *destBitmap, uint16 byteWidth, uint16 height);
- void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- byte *destBitmap, uint16 destWidth,
- uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
- Color transparent = k255_ColorNoTransparency, Viewport &viewport = gDefultViewPort);
+
void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
byte *destBitmap, uint16 destWidth, Box &box, Color transparent = k255_ColorNoTransparency, Viewport &viewport = gDefultViewPort);
- void blitToBitmapShrinkWithPalChange(byte *srcBitmap, int16 srcWidth, int16 srcHight,
- byte *destBitmap, int16 destWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges
void blitToBitmap(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, byte *destBitmap, uint16 destWidth, uint16 destX = 0, uint16 destY = 0);
- void blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- uint16 destFromX, uint16 destToX, uint16 destFromY, uint16 destToY,
- Color transparent = k255_ColorNoTransparency, Viewport &viewport = gDefultViewPort);
- void blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
- Box &box,
- Color transparent = k255_ColorNoTransparency, Viewport &viewport = gDefultViewPort);
void blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex,
int16 firstUnitIndex, int16 destPixelWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport = gDefultViewPort); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
+ void blitToBitmapShrinkWithPalChange(byte *srcBitmap, int16 srcWidth, int16 srcHight,
+ byte *destBitmap, int16 destWidth, int16 destHeight, byte *palChange); // @ F0129_VIDEO_BlitShrinkWithPaletteChanges
void blitBoxFilledWithMaskedBitmapToScreen(byte *src, byte *mask, byte *tmp, Box &box, int16 lastUnitIndex,
int16 firstUnitIndex, int16 destPixelWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2, Viewport &viewport = g296_DungeonViewport); // @ F0133_VIDEO_BlitBoxFilledWithMaskedBitmap
+ void blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcX, uint16 srcY,
+ Box &box,
+ Color transparent = k255_ColorNoTransparency, Viewport &viewport = gDefultViewPort);
void flipBitmapHorizontal(byte *bitmap, uint16 width, uint16 height); // @ F0103_DUNGEONVIEW_DrawDoorFrameBitmapFlippedHorizontally
void flipBitmapVertical(byte *bitmap, uint16 width, uint16 height);
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 1d7bd95b80..04554691ba 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -94,9 +94,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
}
champion = &cm._champions[championIndex];
- int16 w = dm.getWidth(k17_InventoryGraphicIndice);
- int16 h = dm.getHeight(k17_InventoryGraphicIndice);
- dm.blitToScreen(dm.getBitmap(k17_InventoryGraphicIndice), w, 0, 0, 0, w, 0, h, k255_ColorNoTransparency, g296_DungeonViewport);
+ dm.loadIntoBitmap(k17_InventoryGraphicIndice, dm._g296_bitmapViewport);
if (cm._g299_candidateChampionOrdinal) {
dm.clearScreenBox(k12_ColorDarkestGray, g41_BoxFloppyZzzCross, g296_DungeonViewport);
}
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 890c8c09dd..b2ad003739 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -64,7 +64,7 @@ void MenuMan::drawMovementArrows() {
Box &dest = g2_BoxMovementArrows;
uint16 w = disp.getWidth(k13_MovementArrowsIndice);
- disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, k255_ColorNoTransparency);
+ disp.blitToScreen(arrowsBitmap, w, 0, 0, dest, k255_ColorNoTransparency);
}
void MenuMan::clearActingChampion() {
ChampionMan &cm = *_vm->_championMan;
@@ -113,7 +113,7 @@ T0386006:
box2._x2 = box._x2 - 2; // no need to add +1 for exclusive boundaries, box already has that
box2._y1 = 95;
box2._y2 = 110 + 1;
- dm.blitToScreen(bitmapIcon, 16, 0, 0, box2._x1, box2._x2, box2._y1, box2._y2);
+ dm.blitToScreen(bitmapIcon, 16, 0, 0, box2);
if (champion.getAttributes(k0x0008_ChampionAttributeDisableAction) || _vm->_championMan->_g299_candidateChampionOrdinal || _vm->_championMan->_g300_partyIsSleeping) {
warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox");
}
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp
index 499ae9d697..40dc4f2066 100644
--- a/engines/dm/objectman.cpp
+++ b/engines/dm/objectman.cpp
@@ -195,7 +195,8 @@ void ObjectMan::extractIconFromBitmap(uint16 iconIndex, byte *destBitmap) {
byte *srcBitmap = _vm->_displayMan->getBitmap(k42_ObjectIcons_000_TO_031 + i);
iconIndex -= g26_IconGraphicFirstIndex[i];
_vm->_displayMan->_g578_useByteBoxCoordinates = true;
- _vm->_displayMan->blitToBitmap(srcBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, destBitmap, 16, 0, 16, 0, 16, k255_ColorNoTransparency);
+ Box box(0, 0, 15, 15);
+ _vm->_displayMan->blitToBitmap(srcBitmap, 256, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, destBitmap, 16, box, k255_ColorNoTransparency);
}
void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h
index f0d2bedf07..e4ce2cf019 100644
--- a/engines/dm/objectman.h
+++ b/engines/dm/objectman.h
@@ -60,7 +60,7 @@ public:
IconIndice getObjectType(Thing thing); // @ F0032_OBJECT_GetType
IconIndice getIconIndex(Thing thing); // @ F0033_OBJECT_GetIconIndex
- void extractIconFromBitmap(uint16 iconIndex, byte *destBitmap); // F0036_OBJECT_ExtractIconFromBitmap
+ void extractIconFromBitmap(uint16 iconIndex, byte *destBitmap); // @ F0036_OBJECT_ExtractIconFromBitmap
void drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex); // @ F0038_OBJECT_DrawIconInSlotBox
void drawLeaderObjectName(Thing thing); // @ F0034_OBJECT_DrawLeaderHandObjectName
IconIndice getIconIndexInSlotBox(uint16 slotBoxIndex); // @ F0039_OBJECT_GetIconIndexInSlotBox
diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp
index 67ac123a72..c313b1f29e 100644
--- a/engines/dm/text.cpp
+++ b/engines/dm/text.cpp
@@ -59,8 +59,11 @@ void TextMan::printTextToBitmap(byte* destBitmap, uint16 destPixelWidth, uint16
if (nextY + k6_LetterHeight >= (viewport._posY + viewport._height))
break;
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, nextY, nextY + k6_LetterHeight);
_vm->_displayMan->blitToBitmap(srcBitmap, 6 * 128, (nextX == destX) ? (srcX + 1) : srcX, 0, destBitmap, destPixelWidth,
- (nextX == destX) ? (nextX + 1) : nextX, nextX + k5_LetterWidth + 1, nextY, nextY + k6_LetterHeight, k255_ColorNoTransparency, viewport);
+ box, k255_ColorNoTransparency, viewport);
+
nextX += k5_LetterWidth + 1;
}
}