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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Jan 9 15:09:46 CET 2010


Revision: 47201
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47201&view=rev
Author:   m_kiewitz
Date:     2010-01-09 14:09:45 +0000 (Sat, 09 Jan 2010)

Log Message:
-----------
SCI: added new debug command "picture_visualize", which enables visualization of the drawing process of EGA pictures

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/graphics/gfx.cpp
    scummvm/trunk/engines/sci/graphics/gfx.h
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/picture.cpp
    scummvm/trunk/engines/sci/graphics/picture.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/console.cpp	2010-01-09 14:09:45 UTC (rev 47201)
@@ -115,6 +115,7 @@
 	DCmd_Register("draw_robot",			WRAP_METHOD(Console, cmdDrawRobot));
 #endif
 	DCmd_Register("undither",           WRAP_METHOD(Console, cmdUndither));
+	DCmd_Register("pic_visualize",		WRAP_METHOD(Console, cmdPicVisualize));
 	DCmd_Register("play_video",         WRAP_METHOD(Console, cmdPlayVideo));
 	// Segments
 	DCmd_Register("segment_table",		WRAP_METHOD(Console, cmdPrintSegmentTable));
@@ -314,6 +315,7 @@
 	DebugPrintf(" set_palette - Sets a palette resource\n");
 	DebugPrintf(" draw_pic - Draws a pic resource\n");
 	DebugPrintf(" draw_cel - Draws a cel from a view resource\n");
+	DebugPrintf(" pic_visualize - Enables visualization of the drawing process of EGA pictures\n");
 	DebugPrintf(" undither - Enable/disable undithering\n");
 	DebugPrintf("\n");
 	DebugPrintf("Segments:\n");
@@ -1049,6 +1051,18 @@
 	return _vm->_gamestate->_gui->debugUndither(flag);
 }
 
+bool Console::cmdPicVisualize(int argc, const char **argv) {
+	if (argc != 2) {
+		DebugPrintf("Enable/disable picture visualization (EGA only)\n");
+		DebugPrintf("Usage: %s <0/1>\n", argv[0]);
+		return true;
+	}
+
+	bool state = atoi(argv[1]) ? true : false;
+
+	return _vm->_gamestate->_gui->debugEGAdrawingVisualize(state);
+}
+
 bool Console::cmdPlayVideo(int argc, const char **argv) {
 	if (argc < 2) {
 		DebugPrintf("Plays a SEQ, AVI or VMD video.\n");

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/console.h	2010-01-09 14:09:45 UTC (rev 47201)
@@ -90,6 +90,7 @@
 	bool cmdDrawRobot(int argc, const char **argv);
 #endif
 	bool cmdUndither(int argc, const char **argv);
+	bool cmdPicVisualize(int argc, const char **argv);
 	bool cmdPlayVideo(int argc, const char **argv);
 	// Segments
 	bool cmdPrintSegmentTable(int argc, const char **argv);

Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-09 14:09:45 UTC (rev 47201)
@@ -66,6 +66,8 @@
 	_text->SetFont(0);
 	_menuPort->rect = Common::Rect(0, 0, _screen->getWidth(), _screen->getHeight());
 	_menuBarRect = Common::Rect(0, 0, _screen->getWidth(), 9);
+
+	_EGAdrawingVisualize = false;
 }
 
 void Gfx::purgeCache() {
@@ -323,8 +325,12 @@
 	}
 }
 
+void Gfx::setEGAdrawingVisualize(bool state) {
+	_EGAdrawingVisualize = state;
+}
+
 void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) {
-	SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId);
+	SciGuiPicture *picture = new SciGuiPicture(_resMan, this, _screen, _palette, pictureId, _EGAdrawingVisualize);
 
 	// do we add to a picture? if not -> clear screen with white
 	if (!addToFlag)

Modified: scummvm/trunk/engines/sci/graphics/gfx.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-09 14:09:45 UTC (rev 47201)
@@ -83,6 +83,8 @@
 	void BitsRestore(reg_t memoryHandle);
 	void BitsFree(reg_t memoryHandle);
 
+	void setEGAdrawingVisualize(bool state);
+
 	void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
 	void drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
 	void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Rect celRect, byte priority, uint16 paletteNo, uint16 scaleX = 128, uint16 scaleY = 128);
@@ -124,6 +126,9 @@
 	byte _priorityBands[200];
 
 	ViewCache _cachedViews;
+
+	// true means make EGA picture drawing visible
+	bool _EGAdrawingVisualize;
 };
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-01-09 14:09:45 UTC (rev 47201)
@@ -964,4 +964,9 @@
 	return false;
 }
 
+bool SciGui::debugEGAdrawingVisualize(bool state) {
+	_gfx->setEGAdrawingVisualize(state);
+	return false;
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-01-09 14:09:45 UTC (rev 47201)
@@ -167,6 +167,7 @@
 
 	virtual bool debugUndither(bool flag);
 	virtual bool debugShowMap(int mapNo);
+	virtual bool debugEGAdrawingVisualize(bool state);
 
 	// FIXME: Don't store EngineState
 	virtual void resetEngineState(EngineState *s);

Modified: scummvm/trunk/engines/sci/graphics/picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/picture.cpp	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/picture.cpp	2010-01-09 14:09:45 UTC (rev 47201)
@@ -33,8 +33,8 @@
 
 namespace Sci {
 
-SciGuiPicture::SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId)
-	: _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId) {
+SciGuiPicture::SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
+	: _resMan(resMan), _gfx(gfx), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) {
 	assert(resourceId != -1);
 	initData(resourceId);
 }
@@ -589,11 +589,11 @@
 		default:
 			error("Unsupported pic-operation %X", pic_op);
 		}
-		//printf("picop %X\n", pic_op);
-		// for debug purposes
-		//_screen->copyToScreen();
-		//g_system->updateScreen();
-		//g_system->delayMillis(500);
+		if ((_EGAdrawingVisualize) && (isEGA)) {
+			_screen->copyToScreen();
+			g_system->updateScreen();
+			g_system->delayMillis(10);
+		}
 	}
 	error("picture vector data without terminator");
 }

Modified: scummvm/trunk/engines/sci/graphics/picture.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/picture.h	2010-01-09 13:28:52 UTC (rev 47200)
+++ scummvm/trunk/engines/sci/graphics/picture.h	2010-01-09 14:09:45 UTC (rev 47201)
@@ -34,7 +34,7 @@
 
 class SciGuiPicture {
 public:
-	SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId);
+	SciGuiPicture(ResourceManager *resMan, Gfx *gfx, Screen *screen, SciPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
 	~SciGuiPicture();
 
 	GuiResourceId getResourceId();
@@ -75,6 +75,9 @@
 	bool _addToFlag;
 	int16 _EGApaletteNo;
 	byte _priority;
+
+	// If true, we will show the whole EGA drawing process...
+	bool _EGAdrawingVisualize;
 };
 
 } // End of namespace Sci


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