From d2e8a6bed53c58ac3c9100dee399585c781fe9fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jan 2014 18:13:44 -0500 Subject: VOYEUR: Implemented lots more sDrawPic logic --- engines/voyeur/files.h | 6 +- engines/voyeur/graphics.cpp | 298 ++++++++++++++++++++++++++++++++++++++++++- engines/voyeur/staticres.cpp | 2 +- 3 files changed, 300 insertions(+), 6 deletions(-) diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h index edc5ee5811..cc30d0a493 100644 --- a/engines/voyeur/files.h +++ b/engines/voyeur/files.h @@ -279,8 +279,10 @@ public: /* bvoy.blt resource types */ -enum PictureFlag { PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10, PICFLAG_20 = 0x20, - PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_CLEAR_SCREEN00 = 0x1000 }; +enum PictureFlag { PICFLAG_2 = 2, PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10, + PICFLAG_20 = 0x20, PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_100 = 0x100, + PICFLAG_CLEAR_SCREEN00 = 0x1000 +}; class PictureResource: public DisplayResource { private: diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index bea322717d..387be4e499 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -135,9 +135,9 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des ViewPortResource *destViewPort = NULL; Common::Rect newBounds; Common::Rect backBounds; - int var24; + int var22 = 0; + int var24 = 0; bool isClipped = false; - int var22; int var26; byte pixel = 0; @@ -544,7 +544,299 @@ error("TODO: var22/var24/var2C not initialised before use?"); } else { // loc_26673 - // TODO + int pick = srcPic->_pick; + int onOff = srcPic->_onOff; + + if (!(srcFlags & PICFLAG_PIC_OFFSET)) { + srcP = srcImgData += srcOffset; + int pixel = 0; + + if (destFlags & PICFLAG_PIC_OFFSET) { + destP = destImgData + screenOffset; + if (srcFlags & PICFLAG_2) { + if (srcFlags & PICFLAG_100) { + if (isClipped) { + // loc_266E3 + destP = (byte *)_screenSurface.getPixels() + screenOffset; + var22 = (var22 < 0) ? -var22 : 0; + var26 = var22 + width2; + var24 = (var24 < 0) ? -var24 : 0; + pick = 0x7F; + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + + for (int yp = 0; yp < height1; ++yp) { + int byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp, --byteVal2) { + if (byteVal2 <= 0) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + if (pixel) { + *destP = (pixel & pick) ^ onOff; + } + ++destP; + } + } + if (yp >= var24) + destP += widthDiff2; + } + } else { + // loc_26815 + destP = (byte *)_screenSurface.getPixels() + screenOffset; + + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++destP) { + byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) { + byteVal2 = width2; + } + } + } + + if (pixel) + *destP = (pixel & pick) ^ onOff; + } + } + + destP += widthDiff2; + } + } + } else { + // Direct screen write + destP = (byte *)_screenSurface.getPixels() + screenOffset; + + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) { + if (*srcP) + *destP = (*srcP & pick) ^ onOff; + } + destP += widthDiff2; + srcP += widthDiff; + } + } + } else if (srcFlags & PICFLAG_100) { + srcP = srcImgData; + if (isClipped) { + // loc_269FD + var22 = (var22 < 0) ? -var22 : 0; + var26 = var22 + width2; + var24 = (var24 < 0) ? -var24 : 0; + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel = 0x7F; + byteVal2 = *srcP++; + + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + *destP++ = (pixel & 0x80) ^ onOff; + } + } + } + } else { + // loc_26BD5 + destP = (byte *)_screenSurface.getPixels() + screenOffset; + + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + + for (int xp = 0; xp < width2; ++xp, ++destP) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + *destP = (pixel & pick) ^ onOff; + } + + destP += widthDiff2; + } + } + } else { + // loc_26C9A + destP = (byte *)_screenSurface.getPixels() + screenOffset; + + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) { + *destP = (*srcP & pick) ^ onOff; + } + destP += widthDiff2; + srcP += widthDiff; + } + } + } else { + // loc_26D2F + destP = destImgData + screenOffset; + + if (srcFlags & PICFLAG_2) { + // loc_26D4F + if (srcFlags & PICFLAG_100) { + srcP = srcImgData; + + if (isClipped) { + // loc_26D6A + var22 = (var22 < 0) ? -var22 : 0; + var26 = var22 + width2; + var24 = (var24 < 0) ? -var24 : 0; + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + + for (int xp = 0; xp < width2; ++xp, --byteVal2) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + if (pixel) + *destP = (pixel & pick) ^ onOff; + + ++destP; + } + } + + if (yp >= var24) + destP += widthDiff2; + } + } else { + // loc_26E95 + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (pixel) + *destP = (pixel & pick) ^ onOff; + } + + destP += widthDiff2; + } + } + } else { + // loc_26F5D + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) { + if (*srcP) + *destP = (*srcP & pick) ^ onOff; + } + destP += widthDiff2; + srcP += widthDiff; + } + } + } else { + // loc_26FEF + if (srcFlags & PICFLAG_100) { + // loc_26FF9 + for (int yp = 0; yp < height1; ++yp) { + for (int xp = 0; xp < width2; ++xp, ++srcP, ++destP) { + *destP = (*srcP & pick) ^ onOff; + } + destP += widthDiff2; + srcP += widthDiff; + } + } else { + // loc_271F0 + srcP = srcImgData; + + if (isClipped) { + // loc_2700A + var22 = (var22 < 0) ? -var22 : 0; + var26 = var22 + width2; + var24 = (var24 < 0) ? -var24 : 0; + width2 = srcPic->_bounds.width(); + height1 = var24 + height1; + + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + + for (int xp = 0; xp < width2; ++xp, --byteVal2) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + if (yp >= var24 && xp >= var22 && xp < var26) { + *destP++ = (pixel & pick) ^ onOff; + } + } + + if (yp >= var24) + destP += widthDiff2; + } + } else { + // loc_2712F + for (int yp = 0; yp < height1; ++yp) { + byteVal2 = 0; + for (int xp = 0; xp < width2; ++xp, ++destP, --byteVal2) { + if (!byteVal2) { + pixel = *srcP++; + if (pixel & 0x80) { + pixel &= 0x7F; + byteVal2 = *srcP++; + if (!byteVal2) + byteVal2 = width2; + } + } + + *destP = (*srcP & pick) ^ onOff; + } + destP += widthDiff2; + } + } + } + } + } + } } } diff --git a/engines/voyeur/staticres.cpp b/engines/voyeur/staticres.cpp index 7bba6517fe..078731e965 100644 --- a/engines/voyeur/staticres.cpp +++ b/engines/voyeur/staticres.cpp @@ -114,7 +114,7 @@ const char *const PM = "pm"; const char *const START_OF_MESSAGE = "*** Start of Message ***"; const char *const END_OF_MESSAGE = "*** End of Message ***"; -const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio" "Evidence", "Computer" }; +const char *const EVENT_TYPE_STRINGS[4] = { "Video", "Audio", "Evidence", "Computer" }; int DOT_LINE_START[9] = { 0xE880, 0xE9C0, 0xEB00, 0xEC40, 0xED80, 0xEEC0, 0xF000, 0xF140, 0xF280 -- cgit v1.2.3