diff options
author | Max Horn | 2009-03-04 05:19:19 +0000 |
---|---|---|
committer | Max Horn | 2009-03-04 05:19:19 +0000 |
commit | 302a99a2c0223bceb3a1f553f1b4ec0bf4b13fea (patch) | |
tree | abbf172d4eac22d9090c4021b5e9310d6f902d7f | |
parent | 57e0d1611268efc5f4dda8fd02fb4dfe11b0eb5b (diff) | |
download | scummvm-rg350-302a99a2c0223bceb3a1f553f1b4ec0bf4b13fea.tar.gz scummvm-rg350-302a99a2c0223bceb3a1f553f1b4ec0bf4b13fea.tar.bz2 scummvm-rg350-302a99a2c0223bceb3a1f553f1b4ec0bf4b13fea.zip |
SCI: cleanup
svn-id: r39106
-rw-r--r-- | engines/sci/engine/kdebug.cpp | 16 | ||||
-rw-r--r-- | engines/sci/engine/said.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/said.y | 2 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 14 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 7 | ||||
-rw-r--r-- | engines/sci/scicore/sciconsole.cpp | 29 | ||||
-rw-r--r-- | engines/sci/scicore/sciconsole.h | 65 |
7 files changed, 13 insertions, 122 deletions
diff --git a/engines/sci/engine/kdebug.cpp b/engines/sci/engine/kdebug.cpp index 2ab7310d24..d1d89f6c1b 100644 --- a/engines/sci/engine/kdebug.cpp +++ b/engines/sci/engine/kdebug.cpp @@ -33,15 +33,6 @@ namespace Sci { int script_debug_flag = 0; // Defaulting to running mode int sci_debug_flags = 0; // Special flags -// Functions for internal macro use -void _SCIkvprintf(FILE *file, const char *format, va_list args); - -void _SCIkvprintf(FILE *file, const char *format, va_list args) { - vfprintf(file, format, args); - if (con_file) vfprintf(con_file, format, args); -} - - void _SCIkwarn(EngineState *s, const char *file, int line, int area, const char *format, ...) { va_list args; @@ -51,11 +42,12 @@ void _SCIkwarn(EngineState *s, const char *file, int line, int area, const char fprintf(stderr, "Warning: "); va_start(args, format); - _SCIkvprintf(stderr, format, args); + vfprintf(stderr, format, args); va_end(args); fflush(NULL); - if (sci_debug_flags & _DEBUG_FLAG_BREAK_ON_WARNINGS) script_debug_flag = 1; + if (sci_debug_flags & _DEBUG_FLAG_BREAK_ON_WARNINGS) + script_debug_flag = 1; } void _SCIkdebug(EngineState *s, const char *file, int line, int area, const char *format, ...) { @@ -64,7 +56,7 @@ void _SCIkdebug(EngineState *s, const char *file, int line, int area, const char if (s->debug_mode & (1 << area)) { fprintf(stdout, " kernel: (%s L%d): ", file, line); va_start(args, format); - _SCIkvprintf(stdout, format, args); + vfprintf(stdout, format, args); va_end(args); fflush(NULL); } diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index 879cc09829..2a20d6fbdf 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -2466,7 +2466,7 @@ int said(EngineState *s, byte *spec, int verbose) { int main (int argc, char *argv) { byte block[] = {0x01, 0x00, 0xf8, 0xf5, 0x02, 0x01, 0xf6, 0xf2, 0x02, 0x01, 0xf2, 0x01, 0x03, 0xff}; EngineState s; - con_passthrough = 1; + con_passthrough = true; s.parser_valid = 1; said(&s, block); diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index b479834bfa..d2a1c2cc84 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -822,7 +822,7 @@ int said(EngineState *s, byte *spec, int verbose) { int main (int argc, char *argv) { byte block[] = {0x01, 0x00, 0xf8, 0xf5, 0x02, 0x01, 0xf6, 0xf2, 0x02, 0x01, 0xf2, 0x01, 0x03, 0xff}; EngineState s; - con_passthrough = 1; + con_passthrough = true; s.parser_valid = 1; said(&s, block); diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 34d628d44f..71ed439c07 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -3258,23 +3258,11 @@ void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t * while (_debugstate_valid) { int skipfirst = 0; const char *commandstring; -#ifdef WANT_CONSOLE - char *input; -#endif // Suspend music playing sfx_suspend(&s->sound, 1); -#ifdef WANT_CONSOLE - if (!have_windowed) { - con_gfx_show(s->gfx_state); - input = con_gfx_read(s->gfx_state); - con_gfx_hide(s->gfx_state); - commandstring = input; - sciprintf("> %s\n", commandstring); - } else -#endif - commandstring = _debug_get_input(); + commandstring = _debug_get_input(); // Check if a specific destination has been given if (commandstring && (commandstring[0] == '.' || commandstring[0] == ':')) diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 29bdca5e91..cbd1657267 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -51,9 +51,6 @@ int c_die(EngineState *s) { } static void init_console() { -#ifdef WANT_CONSOLE - con_gfx_init(); -#endif con_hook_command(&c_quit, "quit", "", "console: Quits gracefully"); con_hook_command(&c_die, "die", "", "console: Quits ungracefully"); @@ -76,7 +73,7 @@ static void init_console() { con_hook_int(&sci01_priority_table_flags, "sci01_priority_table_flags", "SCI01 priority table debugging flags: 1:Disable, 2:Print on change\n"); - con_passthrough = 1; // enables all sciprintf data to be sent to stdout + con_passthrough = true; // enables all sciprintf data to be sent to stdout } static int init_gamestate(EngineState *gamestate, sci_version_t version) { @@ -298,8 +295,6 @@ Common::Error SciEngine::run() { delete _resmgr; - close_console_file(); - gfxop_exit(&gfx_state); return Common::kNoError; diff --git a/engines/sci/scicore/sciconsole.cpp b/engines/sci/scicore/sciconsole.cpp index a8e57e6d74..3e70dfe64c 100644 --- a/engines/sci/scicore/sciconsole.cpp +++ b/engines/sci/scicore/sciconsole.cpp @@ -33,8 +33,7 @@ namespace Sci { #ifdef SCI_CONSOLE -int con_passthrough = 0; -FILE *con_file = NULL; +int con_passthrough = false; static void (*_con_string_callback)(char*) = NULL; static void (*_con_pixmap_callback)(gfx_pixmap_t *) = NULL; @@ -68,8 +67,6 @@ int sciprintf(const char *fmt, ...) { if (con_passthrough) printf("%s", buf); - if (con_file) - fprintf(con_file, "%s", buf); if (_con_string_callback) _con_string_callback(buf); @@ -99,30 +96,6 @@ int con_insert_pixmap(gfx_pixmap_t *pixmap) { return 0; } -void open_console_file(char *filename) { - if (con_file != NULL) - fclose(con_file); - - if (NULL == filename) { - fprintf(stderr, "console.c: open_console_file(): NULL passed for parameter filename\r\n"); - } -#ifdef WIN32 - con_file = fopen(filename, "wt"); -#else - con_file = fopen(filename, "w"); -#endif - - if (NULL == con_file) - fprintf(stderr, "console.c: open_console_file(): Could not open output file %s\n", filename); -} - -void close_console_file() { - if (con_file != NULL) { - fclose(con_file); - con_file = NULL; - } -} - #endif // SCI_CONSOLE } // End of namespace Sci diff --git a/engines/sci/scicore/sciconsole.h b/engines/sci/scicore/sciconsole.h index 25b8907a50..e451895a9a 100644 --- a/engines/sci/scicore/sciconsole.h +++ b/engines/sci/scicore/sciconsole.h @@ -34,7 +34,6 @@ #include "common/scummsys.h" -#include "sci/sci_memory.h" #include "sci/tools.h" #include "sci/engine/vm_types.h" @@ -43,13 +42,8 @@ namespace Sci { +/** If this flag is set, we echo all sciprintf() stuff to the text console. */ extern int con_passthrough; -/* Echo all sciprintf() stuff to the text console */ -extern FILE *con_file; -/* Echo all sciprintf() output to a text file. Note: clients of freesci.dll -** should use open_console_file and close_console_file, rather than refer -** directly to the con_file variable. -*/ union cmd_param_t { int32 val; @@ -57,14 +51,14 @@ union cmd_param_t { reg_t reg; }; +/** The number of parameters passed to a function called from the parser */ extern unsigned int cmd_paramlength; -/* The number of parameters passed to a function called from the parser */ +/** The parameters passed to a function called by the parser */ extern cmd_param_t *cmd_params; -/* The parameters passed to a function called by the parser */ +/** The game state as used by some of the console commands */ extern struct EngineState *con_gamestate; -/* The game state as used by some of the console commands */ /*** FUNCTION DEFINITIONS ***/ @@ -139,21 +133,6 @@ int con_hook_command(int command(EngineState *s), const char *name, const char * ** as no element beyond strlen(cmd_params[x].str)+1 is accessed. */ -cmd_param_t con_getopt(char *opt); -/* Retreives the specified optional parameter -** -- for use within console functions only -- -** Parameters: (char *) opt: The optional parameter to retrieve -** Returns : (cmd_param_t) The corresponding parameter -** Should only be used if con_hasopt() reports its presence. -*/ - -int con_hasopt(char *opt); -/* Checks whether an optional parameter was specified -** -- for use within console functions only -- -** Parameters: (char *) opt: The optional parameter to check for -** Returns : (int) non-zero iff the parameter was specified -*/ - int con_can_handle_pixmaps(); /* Determines whether the console supports pixmap inserts ** Returns : (int) non-zero iff pixmap inserts are supported @@ -187,44 +166,8 @@ int con_hook_int(int *pointer, const char *name, const char *description); */ -void con_gfx_init(); -/* Initializes the gfx console -*/ - -void con_gfx_show(gfx_state_t *state); -/* Enters on-screen console mode -** Parameters: (gfx_state_t *state): The graphics state to use for interaction -** Returns : (void) -*/ - -char *con_gfx_read(gfx_state_t *state); -/* Reads a single line from the on-screen console, if it is open -** Parameters: (gfx_state_t *state): The graphics state to use for interaction -** Returns : (char *) The input, in a static buffer -*/ - -void con_gfx_hide(gfx_state_t *stae); -/* Closes the on-screen console -** Parameters: (gfx_state_t *state): The graphics state to use for interaction -** Returns : (void) -*/ - - int sci_hexdump(byte *data, int length, int offsetplus); -void open_console_file(char *filename); -/* Opens the file to which the console output is echoed. If a file was opened -** before, closes it. -** Parameters: filename - name of the file -** Returns : (void) -*/ - -void close_console_file(); -/* Closes the console output file. -** Parameters: (void) -** Returns : (void) -*/ - } // End of namespace Sci #endif // SCI_SCICORE_SCICONSOLE_H |