diff options
author | Colin Snover | 2016-08-20 21:02:07 -0500 |
---|---|---|
committer | Colin Snover | 2016-09-29 19:39:16 -0500 |
commit | 44dd029cb17160316b2015321a0a53f8854b6dd3 (patch) | |
tree | b6975dd6bf0f1bc7723345273abdecf034a667a5 /engines/sci/engine | |
parent | 2be2629a3b2b43a0c86cfb7ea26cf979b91251bd (diff) | |
download | scummvm-rg350-44dd029cb17160316b2015321a0a53f8854b6dd3.tar.gz scummvm-rg350-44dd029cb17160316b2015321a0a53f8854b6dd3.tar.bz2 scummvm-rg350-44dd029cb17160316b2015321a0a53f8854b6dd3.zip |
SCI32: Implement kSetHotRectangles
Used only by chapter 7 of Phant1.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/kevent.cpp | 24 |
3 files changed, 26 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index bd9d1bb770..6cacb5f839 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -483,6 +483,7 @@ reg_t kShowMovieWinGetDuration(EngineState *s, int argc, reg_t *argv); reg_t kShowMovieWinPlayUntilEvent(EngineState *s, int argc, reg_t *argv); reg_t kShowMovieWinInitDouble(EngineState *s, int argc, reg_t *argv); +reg_t kSetHotRectangles(EngineState *s, int argc, reg_t *argv); reg_t kIsHiRes(EngineState *s, int argc, reg_t *argv); reg_t kListAt(EngineState *s, int argc, reg_t *argv); diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 201afb66e2..b8d8450bc1 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -969,6 +969,7 @@ static SciKernelMapEntry s_kernelMap[] = { // SetHotRectangles - used by Phantasmagoria 1, script 64981 (used in the chase scene) // <lskovlun> The idea, if I understand correctly, is that the engine generates events // of a special HotRect type continuously when the mouse is on that rectangle + { MAP_CALL(SetHotRectangles), SIG_SINCE_SCI21MID, SIGFOR_ALL, "i(r)", NULL, NULL }, // Used by SQ6 to scroll through the inventory via the up/down buttons { MAP_CALL(MovePlaneItems), SIG_SINCE_SCI21, SIGFOR_ALL, "oii(i)", NULL, NULL }, diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 600dce3014..8dcafe0f38 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -369,6 +369,30 @@ reg_t kLocalToGlobal32(EngineState *s, int argc, reg_t *argv) { return make_reg(0, visible); } + +reg_t kSetHotRectangles(EngineState *s, int argc, reg_t *argv) { + if (argc == 1) { + g_sci->getEventManager()->setHotRectanglesActive((bool)argv[0].toUint16()); + return s->r_acc; + } + + const int16 numRects = argv[0].toSint16(); + SciArray &hotRects = *s->_segMan->lookupArray(argv[1]); + + Common::Array<Common::Rect> rects; + rects.resize(numRects); + + for (int16 i = 0; i < numRects; ++i) { + rects[i].left = hotRects.int16At(i * 4); + rects[i].top = hotRects.int16At(i * 4 + 1); + rects[i].right = hotRects.int16At(i * 4 + 2) + 1; + rects[i].bottom = hotRects.int16At(i * 4 + 3) + 1; + } + + g_sci->getEventManager()->setHotRectanglesActive(true); + g_sci->getEventManager()->setHotRectangles(rects); + return s->r_acc; +} #endif } // End of namespace Sci |