Skip to content

Commit

Permalink
SCI: Fix compilation when SCI32 is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Aug 25, 2018
1 parent d597fbc commit 6fb19d1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions engines/sci/engine/kpathing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
#include "sci/graphics/paint16.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
#ifdef ENABLE_SCI32
#include "sci/graphics/paint32.h"
#include "sci/graphics/palette32.h"
#include "sci/graphics/plane32.h"
#include "sci/graphics/frameout.h"
#endif

#include "common/debug-channels.h"
#include "common/list.h"
Expand Down Expand Up @@ -316,18 +318,20 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty
// Blue: Near-point access
// Red : Barred access
// Yellow: Contained access
int poly_colors[4];
int poly_colors[4] = { 0, 0, 0, 0 };

if (getSciVersion() <= SCI_VERSION_1_1) {
poly_colors[0] = g_sci->_gfxPalette16->kernelFindColor(0, 255, 0); // green
poly_colors[1] = g_sci->_gfxPalette16->kernelFindColor(0, 0, 255); // blue
poly_colors[2] = g_sci->_gfxPalette16->kernelFindColor(255, 0, 0); // red
poly_colors[3] = g_sci->_gfxPalette16->kernelFindColor(255, 255, 0); // yellow
#ifdef ENABLE_SCI32
} else {
poly_colors[0] = g_sci->_gfxPalette32->matchColor(0, 255, 0); // green
poly_colors[1] = g_sci->_gfxPalette32->matchColor(0, 0, 255); // blue
poly_colors[2] = g_sci->_gfxPalette32->matchColor(255, 0, 0); // red
poly_colors[3] = g_sci->_gfxPalette32->matchColor(255, 255, 0); // yellow
#endif
}

// Clip
Expand All @@ -341,24 +345,28 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty

if (getSciVersion() <= SCI_VERSION_1_1) {
g_sci->_gfxPaint16->kernelGraphDrawLine(p1, p2, poly_colors[type], 255, 255);
#ifdef ENABLE_SCI32
} else {
Plane *topPlane = g_sci->_gfxFrameout->getTopVisiblePlane();
g_sci->_gfxPaint32->kernelAddLine(topPlane->_object, p1, p2, 255, poly_colors[type], kLineStyleSolid, 0, 1);
#endif
}
}

static void draw_point(EngineState *s, Common::Point p, int start, int width, int height) {
// Colors for starting and end point
// Green: End point
// Blue: Starting point
int point_colors[2];
int point_colors[2] = { 0, 0 };

if (getSciVersion() <= SCI_VERSION_1_1) {
point_colors[0] = g_sci->_gfxPalette16->kernelFindColor(0, 255, 0); // green
point_colors[1] = g_sci->_gfxPalette16->kernelFindColor(0, 0, 255); // blue
#ifdef ENABLE_SCI32
} else {
point_colors[0] = g_sci->_gfxPalette32->matchColor(0, 255, 0); // green
point_colors[1] = g_sci->_gfxPalette32->matchColor(0, 0, 255); // blue
#endif
}

Common::Rect rect = Common::Rect(p.x - 1, p.y - 1, p.x - 1 + 3, p.y - 1 + 3);
Expand All @@ -372,12 +380,14 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in
assert(start >= 0 && start <= 1);
if (getSciVersion() <= SCI_VERSION_1_1) {
g_sci->_gfxPaint16->kernelGraphFrameBox(rect, point_colors[start]);
#ifdef ENABLE_SCI32
} else {
Plane *topPlane = g_sci->_gfxFrameout->getTopVisiblePlane();
g_sci->_gfxPaint32->kernelAddLine(topPlane->_object, Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.top), 255, point_colors[start], kLineStyleSolid, 0, 1);
g_sci->_gfxPaint32->kernelAddLine(topPlane->_object, Common::Point(rect.right, rect.top), Common::Point(rect.right, rect.bottom), 255, point_colors[start], kLineStyleSolid, 0, 1);
g_sci->_gfxPaint32->kernelAddLine(topPlane->_object, Common::Point(rect.left, rect.bottom), Common::Point(rect.right, rect.bottom), 255, point_colors[start], kLineStyleSolid, 0, 1);
g_sci->_gfxPaint32->kernelAddLine(topPlane->_object, Common::Point(rect.left, rect.top), Common::Point(rect.left, rect.bottom), 255, point_colors[start], kLineStyleSolid, 0, 1);
#endif
}
}

Expand Down

0 comments on commit 6fb19d1

Please sign in to comment.