diff options
Diffstat (limited to 'engines/sci/graphics/frameout.cpp')
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
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(); |