From 0f535e79f59c24545f40d52cf0cf25a3818cfffd Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 25 Jul 2016 13:40:51 -0500 Subject: SCI32: Add 6-argument signature of kAddPicAt This is used by Torin in room 50900. --- engines/sci/engine/kernel_tables.h | 2 +- engines/sci/engine/kgraphics32.cpp | 3 ++- engines/sci/graphics/frameout.cpp | 4 ++-- engines/sci/graphics/frameout.h | 2 +- engines/sci/graphics/plane32.cpp | 9 +++++---- engines/sci/graphics/plane32.h | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 7d622d16d1..e0e4dcc233 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -823,7 +823,7 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(Robot), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_CALL(Save), SIG_EVERYWHERE, "i(.*)", kSave_subops, NULL }, { MAP_CALL(Text), SIG_SINCE_SCI21MID, SIGFOR_ALL, "i(.*)", kText_subops, NULL }, - { MAP_CALL(AddPicAt), SIG_EVERYWHERE, "oiii", NULL, NULL }, + { MAP_CALL(AddPicAt), SIG_EVERYWHERE, "oiii(i)(i)", NULL, NULL }, { MAP_CALL(GetWindowsOption), SIG_EVERYWHERE, "i", NULL, NULL }, { MAP_CALL(WinHelp), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_CALL(GetConfig), SIG_EVERYWHERE, "ro", NULL, NULL }, diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 40c048bdeb..44085da6e7 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -124,8 +124,9 @@ reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) { int16 x = argv[2].toSint16(); int16 y = argv[3].toSint16(); bool mirrorX = argc > 4 ? argv[4].toSint16() : false; + bool deleteDuplicate = argc > 5 ? argv[5].toSint16() : true; - g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, x, y, mirrorX); + g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, x, y, mirrorX, deleteDuplicate); return s->r_acc; } diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index a264516bf7..7ea159f45d 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -485,12 +485,12 @@ void GfxFrameout::updatePlane(Plane &plane) { #pragma mark - #pragma mark Pics -void GfxFrameout::kernelAddPicAt(const reg_t planeObject, const GuiResourceId pictureId, const int16 x, const int16 y, const bool mirrorX) { +void GfxFrameout::kernelAddPicAt(const reg_t planeObject, const GuiResourceId pictureId, const int16 x, const int16 y, const bool mirrorX, const bool deleteDuplicate) { Plane *plane = _planes.findByObject(planeObject); if (plane == nullptr) { error("kAddPicAt: Plane %04x:%04x not found", PRINT_REG(planeObject)); } - plane->addPic(pictureId, Common::Point(x, y), mirrorX); + plane->addPic(pictureId, Common::Point(x, y), mirrorX, deleteDuplicate); } #pragma mark - diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index 035555af6f..1724ad94b6 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -167,7 +167,7 @@ public: #pragma mark - #pragma mark Pics public: - void kernelAddPicAt(const reg_t planeObject, const GuiResourceId pictureId, const int16 pictureX, const int16 pictureY, const bool mirrorX); + void kernelAddPicAt(const reg_t planeObject, const GuiResourceId pictureId, const int16 pictureX, const int16 pictureY, const bool mirrorX, const bool deleteDuplicate); #pragma mark - #pragma mark Rendering diff --git a/engines/sci/graphics/plane32.cpp b/engines/sci/graphics/plane32.cpp index cb6ec74e8f..1cd88d667b 100644 --- a/engines/sci/graphics/plane32.cpp +++ b/engines/sci/graphics/plane32.cpp @@ -194,11 +194,12 @@ void Plane::addPicInternal(const GuiResourceId pictureId, const Common::Point *p _type = transparent ? kPlaneTypeTransparentPicture : kPlaneTypePicture; } -GuiResourceId Plane::addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX) { - GuiResourceId oldPictureId = _pictureId; - deletePic(pictureId); +GuiResourceId Plane::addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX, const bool deleteDuplicate) { + if (deleteDuplicate) { + deletePic(pictureId); + } addPicInternal(pictureId, &position, mirrorX); - return oldPictureId; + return _pictureId; } void Plane::changePic() { diff --git a/engines/sci/graphics/plane32.h b/engines/sci/graphics/plane32.h index f55d97b6ed..964d20ca12 100644 --- a/engines/sci/graphics/plane32.h +++ b/engines/sci/graphics/plane32.h @@ -347,7 +347,7 @@ public: * new picture resource to the plane at the given * position. */ - GuiResourceId addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX); + GuiResourceId addPic(const GuiResourceId pictureId, const Common::Point &position, const bool mirrorX, const bool deleteDuplicate = true); /** * If the plane is a picture plane, re-adds all cels -- cgit v1.2.3