DM: Add partial fix to drawing explosions

This commit is contained in:
Bendegúz Nagy 2016-09-12 15:49:25 +02:00
parent 3b3572a110
commit 06d6e118eb
2 changed files with 26 additions and 5 deletions

View file

@ -2,6 +2,7 @@ Bugs:
Display: Display:
Spellcasting tabs are displayed inproperly, switching between them is possible tho Spellcasting tabs are displayed inproperly, switching between them is possible tho
Cursor icons are drawn twice Cursor icons are drawn twice
DisplayMan::blitBoxFilledWithMaskedBitmap does not produce the same effect as the original
Logic: Logic:
Items thrown on the right side end up on the left side Items thrown on the right side end up on the left side
@ -15,7 +16,7 @@ Todo:
I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions I forgot to add a bunch of warning for show/hide mouse pointer and other mouse functions
Code stuff todo: Code stuff todo:
Complete stub methods(blitShrink, blitmask) Complete stub methods(blitShrink)
Add proper save header, add error handling to it Add proper save header, add error handling to it
Add translations to f433_processCommand140_saveGame 'LOAD' Add translations to f433_processCommand140_saveGame 'LOAD'

View file

@ -866,10 +866,30 @@ void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 by
} }
void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box, void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box,
int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent, int16 lastUnitIndex, int16 firstUnitIndex, int16 destByteWidth, Color transparent,
int16 xPos, int16 yPos, int16 destHeight, int16 height2) { int16 xPos, int16 yPos, int16 destHeight, int16 height2) {
// make sure to take care of inclusive boundaries, color can have 0x8000 flag to not use mask
warning("STUB: blitBoxFilledWithMaskedBitmap"); // FIXME: does not produce the same effect as the original
byte nextUnitIndex = firstUnitIndex;
bool useMask = !(transparent & k0x0080_BlitDoNotUseMask);
transparent = (Color)(transparent & ~(k0x0080_BlitDoNotUseMask)); // clear flag 0x0080
for (byte next_y = box._y1; next_y <= box._y2; next_y++) { // '<=' for inclusive boundaries
for (byte next_x = box._x1; next_x <= box._x2; next_x++) { // '<=' for inclusive boundaries
byte *nextDestPixel = dest + next_y * destByteWidth * 2 + next_x;
byte nextSrcPixel = src[nextUnitIndex];
if (nextSrcPixel != transparent) {
if (useMask && mask && *mask++) {
*nextDestPixel = *mask & nextSrcPixel;
} else
*nextDestPixel = nextSrcPixel;
}
if (++nextUnitIndex >= lastUnitIndex)
nextUnitIndex = 0; // 0 is not an error
}
}
} }
void DisplayMan::flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height) { void DisplayMan::flipBitmapHorizontal(byte *bitmap, uint16 byteWidth, uint16 height) {