[Scummvm-cvs-logs] SF.net SVN: scummvm:[45533] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Oct 30 12:26:00 CET 2009


Revision: 45533
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45533&view=rev
Author:   thebluegr
Date:     2009-10-30 11:26:00 +0000 (Fri, 30 Oct 2009)

Log Message:
-----------
Rewrote the avoidpath debug code to use new graphics functions

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kpathing.cpp
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui.h

Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-10-30 10:13:44 UTC (rev 45532)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp	2009-10-30 11:26:00 UTC (rev 45533)
@@ -26,8 +26,7 @@
 #include "sci/sci.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
-#include "sci/gfx/gfx_widgets.h"
-#include "sci/gfx/gfx_state_internal.h"	// required for GfxPort, GfxContainer
+#include "sci/gui/gui.h"
 
 #include "common/list.h"
 
@@ -307,41 +306,42 @@
 	// Red : Barred access
 	// Blue: Near-point access
 	// Yellow: Contained access
-	int poly_colors[][3] = {{0, 255, 0}, {0, 0, 255}, {255, 0, 0}, {255, 255, 0}};
-	gfx_color_t col;
-	GfxList *decorations = s->picture_port->_decorations;
-	GfxPrimitive *line;
+	int poly_colors[4] = {
+		s->_gui->paletteFind(0, 255, 0),	// green
+		s->_gui->paletteFind(255, 0, 0),	// red
+		s->_gui->paletteFind(0, 0, 255),	// blue
+		s->_gui->paletteFind(255, 255, 0)	// yellow
+	};
 
-	col.visual = PaletteEntry(poly_colors[type][0], poly_colors[type][1], poly_colors[type][2]);
-	col.alpha = 0;
-	col.priority = -1;
-	col.control = 0;
-	col.mask = GFX_MASK_VISUAL | GFX_MASK_PRIORITY;
+	// Clip
+	p1.x = CLIP<int16>(p1.x, 0, 319);
+	p1.y = CLIP<int16>(p1.y, 0, 199);
+	p2.x = CLIP<int16>(p2.x, 0, 319);
+	p2.y = CLIP<int16>(p2.y, 0, 199);
 
-	p1.y += 10;
-	p2.y += 10;
-
-	line = gfxw_new_line(p1, p2, col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL);
-	decorations->add((GfxContainer *)decorations, (GfxWidget *)line);
+	assert(type >= 0 && type <= 3);
+	s->_gui->graphDrawLine(p1, p2, poly_colors[type], 255, 255);
 }
 
 static void draw_point(EngineState *s, Common::Point p, int start) {
 	// Colors for starting and end point
 	// Green: End point
 	// Blue: Starting point
-	int point_colors[][3] = {{0, 255, 0}, {0, 0, 255}};
-	gfx_color_t col;
-	GfxList *decorations = s->picture_port->_decorations;
-	GfxBox *box;
+	int point_colors[2] = {
+		s->_gui->paletteFind(0, 255, 0),	// green
+		s->_gui->paletteFind(0, 0, 255)		// blue
+	};
 
-	col.visual = PaletteEntry(point_colors[start][0], point_colors[start][1], point_colors[start][2]);
-	col.alpha = 0;
-	col.priority = -1;
-	col.control = 0;
-	col.mask = GFX_MASK_VISUAL | GFX_MASK_PRIORITY;
+	Common::Rect rect = Common::Rect(p.x - 1, p.y - 1, p.x - 1 + 3, p.y - 1 + 3);
 
-	box = gfxw_new_box(s->gfx_state, gfx_rect(p.x - 1, p.y - 1 + 10, 3, 3), col, col, GFX_BOX_SHADE_FLAT);
-	decorations->add((GfxContainer *)decorations, (GfxWidget *)box);
+	// Clip
+	rect.top = CLIP<int16>(rect.top, 0, 199);
+	rect.bottom = CLIP<int16>(rect.bottom, 0, 199);
+	rect.left = CLIP<int16>(rect.left, 0, 319);
+	rect.right = CLIP<int16>(rect.right, 0, 319);
+
+	assert(start >= 0 && start <= 1);
+	s->_gui->graphFrameBox(rect, point_colors[start]);
 }
 
 static void draw_polygon(EngineState *s, reg_t polygon) {
@@ -1685,17 +1685,6 @@
 reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) {
 	Common::Point start = Common::Point(argv[0].toSint16(), argv[1].toSint16());
 
-#ifdef DEBUG_AVOIDPATH
-	GfxPort *port = s->picture_port;
-
-	if (!port->_decorations) {
-		port->_decorations = gfxw_new_list(gfx_rect(0, 0, 320, 200), 0);
-		port->_decorations->setVisual(port->_visual);
-	} else {
-		port->_decorations->free_contents(port->_decorations);
-	}
-#endif
-
 	switch (argc) {
 
 	case 3 : {
@@ -1730,6 +1719,9 @@
 			print_input(s, poly_list, start, end, opt);
 			draw_input(s, poly_list, start, end, opt);
 		}
+
+		// Update the whole screen
+		s->_gui->graphUpdateBox(Common::Rect(0, 0, 319, 219));
 #endif
 
 		p = convert_polygon_set(s, poly_list, start, end, opt);

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-30 10:13:44 UTC (rev 45532)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-30 11:26:00 UTC (rev 45533)
@@ -434,6 +434,11 @@
 	_gfx->FillRect(rect, colorMask, color, priority, control);
 }
 
+void SciGui::graphFrameBox(Common::Rect rect, int16 color) {
+	_gfx->PenColor(color);
+	_gfx->FrameRect(rect);
+}
+
 void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
 	_gfx->OffsetLine(startPoint, endPoint);
 	_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2009-10-30 10:13:44 UTC (rev 45532)
+++ scummvm/trunk/engines/sci/gui/gui.h	2009-10-30 11:26:00 UTC (rev 45533)
@@ -93,6 +93,7 @@
 	virtual void graphFillBoxForeground(Common::Rect rect);
 	virtual void graphFillBoxBackground(Common::Rect rect);
 	virtual void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
+	virtual void graphFrameBox(Common::Rect rect, int16 color);
 	virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
 	virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
 	virtual void graphRestoreBox(reg_t handle);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list