diff options
author | Colin Snover | 2016-01-06 20:03:27 -0600 |
---|---|---|
committer | Colin Snover | 2016-01-07 16:35:09 -0600 |
commit | 8a1d48fc0373730d9239786aea070b363b346729 (patch) | |
tree | 828ee001d5401ade09758d8e48ecf7199169ed39 /engines | |
parent | 70d89b3e394e46bc96a7fde681cd84f36763ee52 (diff) | |
download | scummvm-rg350-8a1d48fc0373730d9239786aea070b363b346729.tar.gz scummvm-rg350-8a1d48fc0373730d9239786aea070b363b346729.tar.bz2 scummvm-rg350-8a1d48fc0373730d9239786aea070b363b346729.zip |
SCI32: Add kFrameOut stub code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 91 |
2 files changed, 111 insertions, 0 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 2ae6b1f1f5..a765fe842e 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -127,6 +127,26 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) { } reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) { +/* TODO: Transcribed from SCI engine disassembly. + GraphicsMgr &graphicsMgr = g_sci->_graphicsMgr; + if (graphicsMgr.palMorphNeeded) { + graphicsMgr.PalMorphFrameOut(&g_PalStyleRanges, false); + } + else { + // TODO: Not sure if this is a pointer or not yet. + if (g_ScrollState != nullptr) { + kFrameOutDoScroll(); + } + + bool showBits = true; + if (argc == 1) { + showBits = (bool) argv[0].toUint16(); + } + + rect SOL_Rect = { .left = 0, .top = 0, .right = UINT32_MAX, .bottom = UINT32_MAX }; + graphicsMgr.FrameOut(showBits, &rect); + } +*/ g_sci->_gfxFrameout->kernelFrameout(); return NULL_REG; } diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 7396115f4c..9512ec2ed1 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -651,6 +651,97 @@ void GfxFrameout::drawPicture(FrameoutEntry *itemEntry, int16 planeOffsetX, int1 // warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority); } +/* TODO: This is the proper implementation of GraphicsMgr::FrameOut transcribed from SQ6 SCI engine disassembly. +static DrawList* g_drawLists[100]; +static RectList* g_rectLists[100]; +void GfxFrameout::FrameOut(bool shouldShowBits, SOL_Rect *rect) { + if (robot) { + robot.doRobot(); + } + + auto planeCount = screen.planeList.planeCount; + if (planeCount > 0) { + for (int planeIndex = 0; planeIndex < planeCount; ++planeIndex) { + Plane plane = *screen.planeList[planeIndex]; + + DrawList* drawList = new DrawList(); + g_drawLists[planeIndex] = drawList; + RectList* rectList = new RectList(); + g_rectLists[planeIndex] = rectList; + } + } + + if (g_Remap_numActiveRemaps > 0 && remapNeeded) { + screen.RemapMarkRedraw(); + } + + CalcLists(&g_drawLists, &g_rectLists, rect); + + // SCI engine stores reference *after* CalcLists + planeCount = screen.planeList.planeCount; + if (planeCount > 0) { + for (int drawListIndex = 0; drawListIndex < planeCount; ++i) { + DrawList* drawList = g_drawLists[drawListIndex]; + drawList->Sort(); + } + + for (int drawListIndex = 0; drawListIndex < planeCount; ++i) { + DrawList* drawList = g_drawLists[drawListIndex]; + if (drawList == nullptr || drawList->count == 0) { + continue; + } + + for (int screenItemIndex = 0, screenItemCount = drawList->count; screenItemIndex < screenItemCount; ++screenItemIndex) { + ScreenItem* screenItem = drawList->items[screenItemIndex]; + screenItem->GetCelObj()->SubmitPalette(); + } + } + } + + // UpdateForFrame is where all palette mutations occur (cycles, varies, etc.) + bool remapNeeded = GPalette().UpdateForFrame(); + if (planeCount > 0) { + frameNowVisible = false; + + for (int planeIndex = 0; planeIndex < planeCount; ++planeIndex) { + Plane* plane = screen.planeList[planeIndex]; + + DrawEraseList(g_rectLists[planeIndex], plane); + DrawScreenItemsList(g_drawLists[planeIndex]); + } + } + + if (robot) { + robot.FrameAlmostVisible(); + } + + GPalette().UpdateHardware(); + + if (shouldShowBits) { + ShowBits(); + } + + frameNowVisible = true; + + if (robot) { + robot.FrameNowVisible(); + } + + if (planeCount > 0) { + for (int planeIndex = 0; planeIndex < planeCount; ++planeIndex) { + if (g_rectLists[planeIndex] != nullptr) { + delete g_rectLists[planeIndex]; + } + if (g_drawLists[planeIndex] != nullptr) { + delete g_drawLists[planeIndex]; + } + } + } +} +void GfxFrameout::CalcLists(DrawList **drawLists, RectList **rectLists, SOL_Rect *rect) { + screen.CalcLists(&visibleScreen, drawLists, rectLists, rect); +} +*/ void GfxFrameout::kernelFrameout() { if (g_sci->_robotDecoder->isVideoLoaded()) { showVideo(); |