diff options
author | Eugene Sandulenko | 2019-12-09 22:36:57 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-12-10 00:32:54 +0100 |
commit | 080c2b8410c6c2d48f72a156a43710776872b9c3 (patch) | |
tree | 68868da8b828da925b0f41c20ba02fd6bb7d5cca /engines/director/lingo/lingo-builtins.cpp | |
parent | 1c119b41197f2de5c2615f2fdd74e07824b7a268 (diff) | |
download | scummvm-rg350-080c2b8410c6c2d48f72a156a43710776872b9c3.tar.gz scummvm-rg350-080c2b8410c6c2d48f72a156a43710776872b9c3.tar.bz2 scummvm-rg350-080c2b8410c6c2d48f72a156a43710776872b9c3.zip |
DIRECTOR: Do precomputations for 'zoomBox' built-in
Diffstat (limited to 'engines/director/lingo/lingo-builtins.cpp')
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 948c503e5b..09b8c11ca3 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -1278,9 +1278,55 @@ void Lingo::b_unLoadCast(int nargs) { } void Lingo::b_zoomBox(int nargs) { + // zoomBox startSprite, endSprite [, delatTicks] + // ticks are in 1/60th, default 1 + g_lingo->printSTUBWithArglist("b_zoomBox", nargs); - g_lingo->dropStack(nargs); + if (nargs < 2 || nargs > 3) { + warning("b_zoomBox: expected 2 or 3 arguments, got %d", nargs); + + g_lingo->dropStack(nargs); + + return; + } + + int delayTicks = 1; + if (nargs > 2) { + Datum d = g_lingo->pop(); + d.toInt(); + + delayTicks = d.u.i; + } + + Datum endSprite = g_lingo->pop(); + Datum startSprite = g_lingo->pop(); + + startSprite.toInt(); + endSprite.toInt(); + + Frame *frame = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame()]; + Frame *frame2 = nullptr; + if (g_director->getCurrentScore()->_frames.size() > g_director->getCurrentScore()->getCurrentFrame()) + frame2 = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame() + 1]; + + Common::Rect *startRect = frame->getSpriteRect(startSprite.u.i); + if (!startRect) { + warning("b_zoomBox: unknown start sprite #%d", startSprite.u.i); + return; + } + + Common::Rect *endRect = frame->getSpriteRect(endSprite.u.i); + if (!endRect && frame2) + endRect = frame2->getSpriteRect(endSprite.u.i); + + if (!endRect) { + warning("b_zoomBox: unknown end sprite #%d", endSprite.u.i); + return; + } + + startRect->debugPrint(0, "b_zoomBox: start: "); + endRect->debugPrint(0, "b_zoomBox: end: "); } void Lingo::b_updateStage(int nargs) { |