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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed May 13 23:22:54 CEST 2009


Revision: 40542
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40542&view=rev
Author:   thebluegr
Date:     2009-05-13 21:22:53 +0000 (Wed, 13 May 2009)

Log Message:
-----------
Simplified and re-enabled the debug code that shows pixmaps on screen and moved sciprintf() to tools.cpp

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/module.mk
    scummvm/trunk/engines/sci/scicore/sciconsole.h
    scummvm/trunk/engines/sci/tools.cpp

Removed Paths:
-------------
    scummvm/trunk/engines/sci/scicore/sciconsole.cpp

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-13 21:21:27 UTC (rev 40541)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-13 21:22:53 UTC (rev 40542)
@@ -836,6 +836,7 @@
 	int palette = cmdParams[1].val;
 	int loops, i;
 	gfxr_view_t *view_pixmaps = NULL;
+	gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
 
 	if (!s) {
 		sciprintf("Not in debug state\n");
@@ -859,10 +860,9 @@
 				int height;
 				Common::Point mod;
 
-				if (con_can_handle_pixmaps()) {
-					view_pixmaps = s->gfx_state->gfxResMan->getView(view, &i, &j, palette);
-					con_insert_pixmap(gfx_clone_pixmap(view_pixmaps->loops[i].cels[j], s->gfx_state->driver->mode));
-				}
+				// Show pixmap on screen
+				view_pixmaps = s->gfx_state->gfxResMan->getView(view, &i, &j, palette);
+				gfxop_draw_cel(s->gfx_state, view, i, j, Common::Point(0,0), transparent, palette);
 
 				gfxop_get_cel_parameters(s->gfx_state, view, i, j, &width, &height, &mod);
 

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2009-05-13 21:21:27 UTC (rev 40541)
+++ scummvm/trunk/engines/sci/module.mk	2009-05-13 21:22:53 UTC (rev 40542)
@@ -54,7 +54,6 @@
 	gfx/res_view1.o \
 	scicore/decompressor.o \
 	scicore/resource.o \
-	scicore/sciconsole.o \
 	scicore/vocabulary.o \
 	scicore/vocab_debug.o \
 	sfx/adlib_sbi.o \

Deleted: scummvm/trunk/engines/sci/scicore/sciconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/sciconsole.cpp	2009-05-13 21:21:27 UTC (rev 40541)
+++ scummvm/trunk/engines/sci/scicore/sciconsole.cpp	2009-05-13 21:22:53 UTC (rev 40542)
@@ -1,92 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-/* First part of the console implmentation: VM independent stuff */
-/* Remember, it doesn't have to be fast. */
-
-#include "sci/engine/state.h"
-#include "sci/scicore/sciconsole.h"
-
-#include "sci/sci.h"	// For _console only
-#include "sci/console.h"	// For _console only
-
-namespace Sci {
-
-#ifdef SCI_CONSOLE
-
-static void (*_con_pixmap_callback)(gfx_pixmap_t *) = NULL;
-
-bool g_redirect_sciprintf_to_gui = false;
-
-int sciprintf(const char *fmt, ...) {
-	va_list argp;
-
-	assert(fmt);
-
-	// First determine how big a buffer we need
-	va_start(argp, fmt);
-	int bufsize = vsnprintf(0, 0, fmt, argp);
-	assert(bufsize >= 0);
-	va_end(argp);
-
-	// Allocate buffer for the full printed string
-	char *buf = (char *)malloc(bufsize + 1);
-	assert(buf);
-
-	// Print everything according to fmt into buf
-	va_start(argp, fmt); // reset argp
-	int bufsize2 = vsnprintf(buf, bufsize + 1, fmt, argp);
-	assert(bufsize == bufsize2);
-	va_end(argp);
-
-	// Display the result suitably
-	if (g_redirect_sciprintf_to_gui)
-		((SciEngine *)g_engine)->_console->DebugPrintf("%s", buf);
-	printf("%s", buf);
-
-	free(buf);
-
-	return 1;
-}
-
-void con_set_pixmap_callback(void(*callback)(gfx_pixmap_t *)) {
-	_con_pixmap_callback = callback;
-}
-
-int con_can_handle_pixmaps() {
-	return _con_pixmap_callback != NULL;
-}
-
-int con_insert_pixmap(gfx_pixmap_t *pixmap) {
-	if (_con_pixmap_callback)
-		_con_pixmap_callback(pixmap);
-	else
-		return 1;
-	return 0;
-}
-
-#endif // SCI_CONSOLE
-
-} // End of namespace Sci

Modified: scummvm/trunk/engines/sci/scicore/sciconsole.h
===================================================================
--- scummvm/trunk/engines/sci/scicore/sciconsole.h	2009-05-13 21:21:27 UTC (rev 40541)
+++ scummvm/trunk/engines/sci/scicore/sciconsole.h	2009-05-13 21:22:53 UTC (rev 40542)
@@ -35,6 +35,7 @@
 #include "common/scummsys.h"
 
 #include "sci/tools.h"
+#include "sci/engine/state.h"
 #include "sci/engine/vm_types.h"
 
 #define SCI_CONSOLE
@@ -54,15 +55,6 @@
 
 /*** FUNCTION DEFINITIONS ***/
 
-void con_set_pixmap_callback(void(*callback)(gfx_pixmap_t *));
-/* Sets the console pixmap callback
-** Parameters: (void -> gfx_pixmap_t *) callback: The closure to invoke after
-**                                      a pixmap has been provided to be
-**                                      published in the on-screen console
-** This sets a single callback function to be used after sciprintf()
-** is used.
-*/
-
 void con_init();
 /* Initializes the command parser
 ** Parameters: (void)
@@ -116,21 +108,6 @@
 ** as no element beyond strlen(cmd_params[x].str)+1 is accessed.
 */
 
-int con_can_handle_pixmaps();
-/* Determines whether the console supports pixmap inserts
-** Returns   : (int) non-zero iff pixmap inserts are supported
-*/
-
-int con_insert_pixmap(gfx_pixmap_t *pixmap);
-/* Inserts a pixmap into the console history buffer
-** Parameters: (gfx_pixmap_t *) pixmap: The pixmap to insert
-** Returns   : (int) 0 on success, non-zero if no receiver for
-**                   the pixmap could not be found
-** The pixmap must be unique; it is freed by the console on demand.
-** Use gfx_clone_pixmap() if neccessary.
-** If the pixmap could not be inserted, the called must destroy it
-*/
-
 int con_hook_page(const char *topic, const char *body);
 /* Hooks a general information page to the manual page system
 ** Parameters: (const char *) topic: The topic name

Modified: scummvm/trunk/engines/sci/tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/tools.cpp	2009-05-13 21:21:27 UTC (rev 40541)
+++ scummvm/trunk/engines/sci/tools.cpp	2009-05-13 21:22:53 UTC (rev 40542)
@@ -24,7 +24,12 @@
  */
 
 #include "sci/tools.h"
+#include "sci/engine/state.h"
+#include "sci/scicore/sciconsole.h"
 
+#include "sci/sci.h"	// For _console only
+#include "sci/console.h"	// For _console only
+
 namespace Sci {
 
 int sci_ffs(int bits) {
@@ -41,4 +46,41 @@
 	return retval;
 }
 
+#ifdef SCI_CONSOLE
+
+bool g_redirect_sciprintf_to_gui = false;
+
+int sciprintf(const char *fmt, ...) {
+	va_list argp;
+
+	assert(fmt);
+
+	// First determine how big a buffer we need
+	va_start(argp, fmt);
+	int bufsize = vsnprintf(0, 0, fmt, argp);
+	assert(bufsize >= 0);
+	va_end(argp);
+
+	// Allocate buffer for the full printed string
+	char *buf = (char *)malloc(bufsize + 1);
+	assert(buf);
+
+	// Print everything according to fmt into buf
+	va_start(argp, fmt); // reset argp
+	int bufsize2 = vsnprintf(buf, bufsize + 1, fmt, argp);
+	assert(bufsize == bufsize2);
+	va_end(argp);
+
+	// Display the result suitably
+	if (g_redirect_sciprintf_to_gui)
+		((SciEngine *)g_engine)->_console->DebugPrintf("%s", buf);
+	printf("%s", buf);
+
+	free(buf);
+
+	return 1;
+}
+
+#endif // SCI_CONSOLE
+
 } // 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