From 71172add9cffd7747cefe6d1c07f6fccc7460075 Mon Sep 17 00:00:00 2001 From: Robert Crossfield Date: Sun, 5 May 2019 22:41:20 +1000 Subject: SCUMM: Original V0-V2 flashlight shape and size for MM/Zak (#10947, #10951) --- engines/scumm/costume.cpp | 4 ++-- engines/scumm/gfx.cpp | 47 +++++++++++++++++++++++++--------------------- engines/scumm/saveload.cpp | 5 ++++- engines/scumm/scumm.cpp | 2 ++ 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index dc29414623..f33d599f20 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -1213,7 +1213,7 @@ byte V0CostumeRenderer::drawLimb(const Actor *a, int limb) { palette[1] = 10; palette[2] = actorV0Colors[_actorID]; } else { - palette[2] = 11; + palette[2] = (_vm->getCurrentLights() & LIGHTMODE_flashlight_on) ? actorV0Colors[_actorID] : 11; palette[3] = 11; } @@ -1378,7 +1378,7 @@ byte V0CostumeLoader::increaseAnim(Actor *a, int limb) { // Use the previous frame --a0->_cost.curpos[limb]; - // Reset the comstume command + // Reset the costume command a0->_costCommandNew = 0xFF; a0->_costCommand = 0xFF; diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index f35c1e52fc..9bf5133c82 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -1460,27 +1460,32 @@ void ScummEngine_v5::drawFlashlight() { blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel); - // Round the corners. To do so, we simply hard-code a set of nicely - // rounded corners. - static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 }; - int minrow = 0; - int maxcol = (_flashlight.w - 1) * vs->format.bytesPerPixel; - int maxrow = (_flashlight.h - 1) * vs->pitch; - - for (i = 0; i < 8; i++, minrow += vs->pitch, maxrow -= vs->pitch) { - int d = corner_data[i]; - - for (j = 0; j < d; j++) { - if (vs->format.bytesPerPixel == 2) { - WRITE_UINT16(&_flashlight.buffer[minrow + 2 * j], 0); - WRITE_UINT16(&_flashlight.buffer[minrow + maxcol - 2 * j], 0); - WRITE_UINT16(&_flashlight.buffer[maxrow + 2 * j], 0); - WRITE_UINT16(&_flashlight.buffer[maxrow + maxcol - 2 * j], 0); - } else { - _flashlight.buffer[minrow + j] = 0; - _flashlight.buffer[minrow + maxcol - j] = 0; - _flashlight.buffer[maxrow + j] = 0; - _flashlight.buffer[maxrow + maxcol - j] = 0; + // C64 does not round the flashlight + if (_game.platform != Common::kPlatformC64) { + + // Round the corners. To do so, we simply hard-code a set of nicely + // rounded corners. + static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 }; + int minrow = 0; + int maxcol = (_flashlight.w - 1) * vs->format.bytesPerPixel; + int maxrow = (_flashlight.h - 1) * vs->pitch; + + for (i = 0; i < 8; i++, minrow += vs->pitch, maxrow -= vs->pitch) { + int d = corner_data[i]; + + for (j = 0; j < d; j++) { + if (vs->format.bytesPerPixel == 2) { + WRITE_UINT16(&_flashlight.buffer[minrow + 2 * j], 0); + WRITE_UINT16(&_flashlight.buffer[minrow + maxcol - 2 * j], 0); + WRITE_UINT16(&_flashlight.buffer[maxrow + 2 * j], 0); + WRITE_UINT16(&_flashlight.buffer[maxrow + maxcol - 2 * j], 0); + } + else { + _flashlight.buffer[minrow + j] = 0; + _flashlight.buffer[minrow + maxcol - j] = 0; + _flashlight.buffer[maxrow + j] = 0; + _flashlight.buffer[maxrow + maxcol - j] = 0; + } } } } diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 84dd16efa6..0997fd0a55 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -68,7 +68,7 @@ struct SaveInfoSection { #define SaveInfoSectionSize (4+4+4 + 4+4 + 4+2) -#define CURRENT_VER 98 +#define CURRENT_VER 99 #define INFOSECTION_VERSION 2 #pragma mark - @@ -1518,6 +1518,9 @@ void ScummEngine_v2::saveLoadWithSerializer(Common::Serializer &s) { if (s.getVersion() < VER(79) && s.isLoading()) { _inventoryOffset = 0; } + + s.syncAsByte(_flashlight.xStrips, VER(99)); + s.syncAsByte(_flashlight.yStrips, VER(99)); } void ScummEngine_v5::saveLoadWithSerializer(Common::Serializer &s) { diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 2f6ea489d5..8d781a0ef1 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -705,6 +705,8 @@ ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr) : ScummEngine_v3old(syst, dr) { _inventoryOffset = 0; + _flashlight.xStrips = 6; + _flashlight.yStrips = 4; VAR_SENTENCE_VERB = 0xFF; VAR_SENTENCE_OBJECT1 = 0xFF; -- cgit v1.2.3