From 00ac235331bcffc19fbc96dc973e876085f2db93 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 4 Feb 2010 20:43:00 +0000 Subject: SCI: making pathfinding debug support also work in sci32 (though it just shows the path for 2.5 seconds there) svn-id: r47888 --- engines/sci/engine/kpathing.cpp | 13 ++++++++----- engines/sci/graphics/paint.cpp | 3 +++ engines/sci/graphics/paint.h | 1 + engines/sci/graphics/paint32.cpp | 4 ++++ engines/sci/graphics/paint32.h | 1 + engines/sci/sci.cpp | 1 + 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 7797ead3e6..1a466bc6c1 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -29,6 +29,7 @@ #include "sci/engine/kernel.h" #include "sci/graphics/paint16.h" #include "sci/graphics/palette.h" +#include "sci/graphics/screen.h" #include "common/list.h" @@ -307,7 +308,7 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty p2.y = CLIP(p2.y, 0, height - 1); assert(type >= 0 && type <= 3); - s->_gfxPaint16->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255); + s->_gfxPaint->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255); } static void draw_point(EngineState *s, Common::Point p, int start, int width, int height) { @@ -328,7 +329,8 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in rect.right = CLIP(rect.right, 0, width - 1); assert(start >= 0 && start <= 1); - s->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]); + if (s->_gfxPaint16) + s->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]); } static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) { @@ -1405,8 +1407,6 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { } if (Common::isDebugChannelEnabled(kDebugLevelAvoidPath)) { - assert(s->_gui); - debug("[avoidpath] Pathfinding input:"); draw_point(s, start, 1, width, height); draw_point(s, end, 0, width, height); @@ -1417,7 +1417,10 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { } // Update the whole screen - s->_gfxPaint16->kernelGraphUpdateBox(Common::Rect(0, 0, width - 1, height - 1), width > 320); + s->_gfxScreen->copyToScreen(); + g_system->updateScreen(); + if (!s->_gfxPaint16) + g_system->delayMillis(2500); } PathfindingState *p = convert_polygon_set(s, poly_list, start, end, width, height, opt); diff --git a/engines/sci/graphics/paint.cpp b/engines/sci/graphics/paint.cpp index 674d7fb2e1..50b0534ba7 100644 --- a/engines/sci/graphics/paint.cpp +++ b/engines/sci/graphics/paint.cpp @@ -46,4 +46,7 @@ void GfxPaint::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, boo void GfxPaint::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle) { } +void GfxPaint::kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) { +} + } // End of namespace Sci diff --git a/engines/sci/graphics/paint.h b/engines/sci/graphics/paint.h index d569730639..918e8d3046 100644 --- a/engines/sci/graphics/paint.h +++ b/engines/sci/graphics/paint.h @@ -39,6 +39,7 @@ public: virtual void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); virtual void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle); + virtual void kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control); private: }; diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index 88f413e9b4..55b88ecb4b 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -74,4 +74,8 @@ void GfxPaint32::kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, _screen->copyRectToScreen(celRect); } +void GfxPaint32::kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) { + _screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control); +} + } // End of namespace Sci diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h index 64ec3fa948..c158075326 100644 --- a/engines/sci/graphics/paint32.h +++ b/engines/sci/graphics/paint32.h @@ -44,6 +44,7 @@ public: void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); void kernelDrawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle); + void kernelGraphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control); private: ResourceManager *_resMan; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 65c18e8583..0bcc299162 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -176,6 +176,7 @@ Common::Error SciEngine::run() { _gamestate->_gfxAnimate = 0; _gamestate->_gfxControls = 0; _gamestate->_gfxMenu = 0; + _gamestate->_gfxPaint16 = 0; _gamestate->_gfxPorts = 0; _gamestate->_gui = 0; _gamestate->_gui32 = new SciGui32(_gamestate, screen, palette, cache, cursor); -- cgit v1.2.3