diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 8 | ||||
-rw-r--r-- | engines/sci/module.mk | 1 | ||||
-rw-r--r-- | engines/sci/scicore/sciconsole.cpp | 92 | ||||
-rw-r--r-- | engines/sci/scicore/sciconsole.h | 25 | ||||
-rw-r--r-- | engines/sci/tools.cpp | 42 |
5 files changed, 47 insertions, 121 deletions
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index c391543e51..9e962a6449 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -836,6 +836,7 @@ int c_viewinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { 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 c_viewinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) { 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); diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 373c0ea0de..9a8fd4fc17 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -54,7 +54,6 @@ MODULE_OBJS = \ gfx/res_view1.o \ scicore/decompressor.o \ scicore/resource.o \ - scicore/sciconsole.o \ scicore/vocabulary.o \ scicore/vocab_debug.o \ sfx/adlib_sbi.o \ diff --git a/engines/sci/scicore/sciconsole.cpp b/engines/sci/scicore/sciconsole.cpp deleted file mode 100644 index 7f56eef7b8..0000000000 --- a/engines/sci/scicore/sciconsole.cpp +++ /dev/null @@ -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 diff --git a/engines/sci/scicore/sciconsole.h b/engines/sci/scicore/sciconsole.h index 1f3a4d2d5a..b2060143aa 100644 --- a/engines/sci/scicore/sciconsole.h +++ b/engines/sci/scicore/sciconsole.h @@ -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 @@ typedef int (*ConCommand)(EngineState *s, const Common::Array<cmd_param_t> &cmdP /*** 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 @@ int con_hook_command(ConCommand command, const char *name, const char *param, co ** 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 diff --git a/engines/sci/tools.cpp b/engines/sci/tools.cpp index 429a6122ed..f21196b27b 100644 --- a/engines/sci/tools.cpp +++ b/engines/sci/tools.cpp @@ -24,6 +24,11 @@ */ #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 { @@ -41,4 +46,41 @@ int sci_ffs(int bits) { 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 |