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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat May 30 20:22:55 CEST 2009


Revision: 41040
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41040&view=rev
Author:   thebluegr
Date:     2009-05-30 18:22:55 +0000 (Sat, 30 May 2009)

Log Message:
-----------
- Moved 3 more commands to console.cpp: "draw_pic", "draw_rect" and "fill_screen"
- Removed some FreeSCI-specific variables for checking of the on-screen console
- Removed the Control-1 key combo - the console command "visual_state" can be used for the same reason

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/console.cpp	2009-05-30 18:22:55 UTC (rev 41040)
@@ -69,6 +69,9 @@
 	DCmd_Register("restart_game",		WRAP_METHOD(Console, cmdRestartGame));
 	DCmd_Register("class_table",		WRAP_METHOD(Console, cmdClassTable));
 	DCmd_Register("parser_words",		WRAP_METHOD(Console, cmdParserWords));
+	DCmd_Register("draw_pic",			WRAP_METHOD(Console, cmdDrawPic));
+	DCmd_Register("draw_rect",			WRAP_METHOD(Console, cmdDrawRect));
+	DCmd_Register("fill_screen",		WRAP_METHOD(Console, cmdFillScreen));
 	DCmd_Register("current_port",		WRAP_METHOD(Console, cmdCurrentPort));
 	DCmd_Register("print_port",			WRAP_METHOD(Console, cmdPrintPort));
 	DCmd_Register("parse_grammar",		WRAP_METHOD(Console, cmdParseGrammar));
@@ -507,7 +510,7 @@
 		shrink_execution_stack(g_EngineState, g_EngineState->execution_stack_base + 1);
 		return 0;
 	} else {
-		sciprintf("Restoring gamestate '%s' failed.\n", argv[1]);
+		DebugPrintf("Restoring gamestate '%s' failed.\n", argv[1]);
 		return 1;
 	}
 
@@ -564,6 +567,66 @@
 	return true;
 }
 
+bool Console::cmdDrawPic(int argc, const char **argv) {
+	if (argc < 2) {
+		DebugPrintf("Draws a pic resource\n");
+		DebugPrintf("Usage: %s <nr> [<pal>] [<fl>]\n", argv[0]);
+		DebugPrintf("where <nr> is the number of the pic resource to draw\n");
+		DebugPrintf("<pal> is the optional default palette for the pic (default: 0)\n");
+		DebugPrintf("<fl> are any pic draw flags (default: 1)\n");
+		return true;
+	}
+
+	int flags = 1, default_palette = 0;
+
+	if (argc > 2)
+		default_palette = atoi(argv[2]);
+
+	if (argc == 4)
+		flags = atoi(argv[3]);
+
+	gfxop_new_pic(g_EngineState->gfx_state, atoi(argv[1]), flags, default_palette);
+	gfxop_clear_box(g_EngineState->gfx_state, gfx_rect(0, 0, 320, 200));
+	gfxop_update(g_EngineState->gfx_state);
+	gfxop_sleep(g_EngineState->gfx_state, 0);
+
+	return false;
+}
+
+bool Console::cmdDrawRect(int argc, const char **argv) {
+	if (argc != 6) {
+		DebugPrintf("Draws a rectangle to the screen with one of the EGA colors\n");
+		DebugPrintf("Usage: %s <x> <y> <width> <height> <color>\n", argv[0]);
+		DebugPrintf("where <color> is the EGA color to use (0-15)\n");
+		return true;
+	}
+
+	int col = CLIP<int>(atoi(argv[5]), 0, 15);
+
+	gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen);
+	gfxop_fill_box(g_EngineState->gfx_state, gfx_rect(atoi(argv[1]), atoi(argv[2]), 
+										atoi(argv[3]), atoi(argv[4])), g_EngineState->ega_colors[col]);
+	gfxop_update(g_EngineState->gfx_state);
+
+	return false;
+}
+
+bool Console::cmdFillScreen(int argc, const char **argv) {
+	if (argc != 2) {
+		DebugPrintf("Fills the screen with one of the EGA colors\n");
+		DebugPrintf("Usage: %s <color>\n", argv[0]);
+		DebugPrintf("where <color> is the EGA color to use (0-15)\n");
+		return true;
+	}
+
+	int col = CLIP<int>(atoi(argv[1]), 0, 15);
+
+	gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen);
+	gfxop_fill_box(g_EngineState->gfx_state, gfx_rect_fullscreen, g_EngineState->ega_colors[col]);
+	gfxop_update(g_EngineState->gfx_state);
+	return false;
+}
+
 bool Console::cmdCurrentPort(int argc, const char **argv) {
 	if (!g_EngineState->port)
 		DebugPrintf("There is no port active currently.\n");
@@ -873,7 +936,7 @@
 
 		node = &(nt->_table[pos.offset]);
 
-		sciprintf("\t%04x:%04x  : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
+		DebugPrintf("\t%04x:%04x  : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
 
 		if (my_prev != node->pred)
 			DebugPrintf("   WARNING: current node gives %04x:%04x as predecessor!\n",

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/console.h	2009-05-30 18:22:55 UTC (rev 41040)
@@ -62,6 +62,9 @@
 	bool cmdRestartGame(int argc, const char **argv);
 	bool cmdClassTable(int argc, const char **argv);
 	bool cmdParserWords(int argc, const char **argv);
+	bool cmdDrawPic(int argc, const char **argv);
+	bool cmdDrawRect(int argc, const char **argv);
+	bool cmdFillScreen(int argc, const char **argv);
 	bool cmdCurrentPort(int argc, const char **argv);
 	bool cmdPrintPort(int argc, const char **argv);
 	bool cmdParseGrammar(int argc, const char **argv);

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-05-30 18:22:55 UTC (rev 41040)
@@ -520,8 +520,6 @@
 	s->game_start_time = g_system->getMillis();
 	s->last_wait_time = s->game_start_time;
 
-	s->onscreen_console = 0; // No onscreen console unless explicitly requested
-
 	srand(g_system->getMillis()); // Initialize random number generator
 
 //	script_dissect(0, s->_selectorNames);

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-05-30 18:22:55 UTC (rev 41040)
@@ -94,14 +94,10 @@
 			sciprintf("Debug mode activated\n");
 			script_debug_flag = 1; // Enter debug mode
 			_debug_seeking = _debug_step_running = 0;
-			s->onscreen_console = 0;
 		} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '`')) {
+			sciprintf("Debug mode activated\n");
 			script_debug_flag = 1; // Enter debug mode
 			_debug_seeking = _debug_step_running = 0;
-			s->onscreen_console = 1;
-		} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '1')) {
-			if (s->visual)
-				s->visual->print(0);
 		} else {
 			PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
 			s->r_acc = make_reg(0, 1);

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 18:22:55 UTC (rev 41040)
@@ -1260,15 +1260,9 @@
 
 	// TODO
 #if 0
-	if (s->onscreen_console)
-		con_restore_screen(s, s->osc_backup);
-
 	if (cmdParams[0].val <= 3)
 		s->pic_visible_map = cmdParams[0].val;
 	c_redraw_screen(s);
-
-	if (s->onscreen_console)
-		s->osc_backup = con_backup_screen(s);
 #endif
 	return 0;
 }
@@ -1293,29 +1287,6 @@
 	return 0;
 }
 
-static int c_gfx_drawpic(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	int flags = 1, default_palette = 0;
-
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	if (cmdParams.size() > 1) {
-		default_palette = cmdParams[1].val;
-
-		if (cmdParams.size() > 2)
-			flags = cmdParams[2].val;
-	}
-
-	gfxop_new_pic(s->gfx_state, cmdParams[0].val, flags, default_palette);
-	gfxop_clear_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
-	gfxop_update(s->gfx_state);
-	gfxop_sleep(s->gfx_state, 0);
-
-	return 0;
-}
-
 #ifdef GFXW_DEBUG_WIDGETS
 extern GfxWidget *debug_widgets[];
 extern int debug_widget_pos;
@@ -1364,42 +1335,6 @@
 	return 0;
 }
 
-static int c_gfx_fill_screen(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	int col = cmdParams[0].val;
-
-	if (!s) {
-		sciprintf("Not in debug state!\n");
-		return 1;
-	}
-
-	if (col < 0 || col > 15)
-		col = 0;
-
-	gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
-	gfxop_fill_box(s->gfx_state, gfx_rect_fullscreen, s->ega_colors[col]);
-	gfxop_update(s->gfx_state);
-
-	return 0;
-}
-
-static int c_gfx_draw_rect(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	int col = cmdParams[4].val;
-
-	if (!s) {
-		sciprintf("Not in debug state!\n");
-		return 1;
-	}
-
-	if (col < 0 || col > 15)
-		col = 0;
-
-	gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
-	gfxop_fill_box(s->gfx_state, gfx_rect(cmdParams[0].val, cmdParams[1].val, cmdParams[2].val, cmdParams[3].val), s->ega_colors[col]);
-	gfxop_update(s->gfx_state);
-
-	return 0;
-}
-
 static int c_gfx_propagate_rect(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	int map = cmdParams[4].val;
 	rect_t rect;
@@ -2287,12 +2222,6 @@
 			con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n  shows which widgets are active.\n"
 			                 "  With parameters, it lists the\n  widget corresponding to the\n  numerical index specified (for\n  each parameter).");
 #endif
-			con_hook_command(c_gfx_drawpic, "gfx_drawpic", "ii*", "Draws a pic resource\n\nUSAGE\n  gfx_drawpic <nr> [<pal> [<fl>]]\n"
-			                 "  where <nr> is the number of the pic resource\n  to draw\n  <pal> is the optional default\n  palette for the pic (0 is"
-			                 "\n  assumed if not specified)\n  <fl> are any pic draw flags (default\n  is 1)");
-			con_hook_command(c_gfx_fill_screen, "gfx_fill_screen", "i", "Fills the screen with one\n  of the EGA colors\n");
-			con_hook_command(c_gfx_draw_rect, "gfx_draw_rect", "iiiii", "Draws a rectangle to the screen\n  with one of the EGA colors\n\nUSAGE\n\n"
-			                 "  gfx_draw_rect <x> <y> <xl> <yl> <color>");
 			con_hook_command(c_gfx_propagate_rect,
 			                 "gfx_propagate_rect",
 			                 "iiiii",

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2009-05-30 18:22:55 UTC (rev 41040)
@@ -46,9 +46,7 @@
 
 	pic_not_valid = 0;
 	pic_is_new = 0;
-	onscreen_console = 0;
-	osc_backup = 0;
-
+	
 	pic_priority_table = 0;
 
 	status_bar_foreground = 0;

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-05-30 17:53:12 UTC (rev 41039)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-05-30 18:22:55 UTC (rev 41040)
@@ -137,8 +137,6 @@
 
 	byte pic_not_valid; /**< Is 0 if the background picture is "valid" */
 	byte pic_is_new; /**< New pic was loaded or port was opened */
-	byte onscreen_console;  /**< Use the onscreen console for debugging */
-	byte *osc_backup; /**< Backup of the pre-onscreen console screen data */
 
 	int *pic_priority_table; /**< 16 entries with priorities or NULL if not present */
 


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