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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri May 29 19:19:40 CEST 2009


Revision: 41010
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41010&view=rev
Author:   thebluegr
Date:     2009-05-29 17:19:39 +0000 (Fri, 29 May 2009)

Log Message:
-----------
- Moved some debug code into console.cpp, adding 3 console commands: resource_types, sci0_palette and exit
- Removed the "man" command
- Removed the commands which set the SCI01 priority table flags and the crossblit alpha threshold (they're too specific, and not really useful anymore)
- Removed some leftover debug code from gfxop_clear_box()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/sciconsole.cpp
    scummvm/trunk/engines/sci/gfx/gfx_support.cpp
    scummvm/trunk/engines/sci/gfx/gfx_tools.h
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/console.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -85,11 +85,13 @@
 	DCmd_Register("kernelnames",		WRAP_METHOD(Console, cmdKernelNames));
 	DCmd_Register("suffixes",			WRAP_METHOD(Console, cmdSuffixes));
 	DCmd_Register("kernelwords",		WRAP_METHOD(Console, cmdKernelWords));
-	DCmd_Register("man",				WRAP_METHOD(Console, cmdMan));
 	DCmd_Register("hexdump",			WRAP_METHOD(Console, cmdHexDump));
 	DCmd_Register("dissect_script",		WRAP_METHOD(Console, cmdDissectScript));
 	DCmd_Register("room",				WRAP_METHOD(Console, cmdRoomNumber));
 	DCmd_Register("size",				WRAP_METHOD(Console, cmdResourceSize));
+	DCmd_Register("restypes",			WRAP_METHOD(Console, cmdResourceTypes));
+	DCmd_Register("sci0_palette",		WRAP_METHOD(Console, cmdSci0Palette));
+	DCmd_Register("exit",				WRAP_METHOD(Console, cmdExit));
 }
 
 Console::~Console() {
@@ -231,53 +233,14 @@
 	return true;
 }
 
-bool Console::cmdMan(int argc, const char **argv) {
-#if 0
-	int section = 0;
-	unsigned int i;
-	char *name = cmd_params[0].str;
-	char *c = strchr(name, '.');
-	cmd_mm_entry_t *entry = 0;
-
-	if (c) {
-		*c = 0;
-		section = atoi(c + 1);
-	}
-
-	if (section < 0 || section >= CMD_MM_ENTRIES) {
-		DebugPrintf("Invalid section %d\n", section);
-		return true;
-	}
-
-	DebugPrintf("section:%d\n", section);
-	if (section)
-		entry = cmd_mm_find(name, section - 1);
-	else
-		for (i = 0; i < CMD_MM_ENTRIES && !section; i++) {
-			if ((entry = cmd_mm_find(name, i)))
-				section = i + 1;
-		}
-
-	if (!entry) {
-		DebugPrintf("No manual entry\n");
-		return true;
-	}
-
-	DebugPrintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name, section);
-	cmd_mm[section - 1].print(entry, 1);
-
-#endif
-	return true;
-}
-
 bool Console::cmdHexDump(int argc, const char **argv) {
 	if (argc != 3) {
 		DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]);
-		DebugPrintf("The 20 valid resource types are:\n");
+		DebugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid);
 		// There are 20 resource types supported by SCI1.1
-		for (int i = 0; i < 20; i++) {
+		for (int i = 0; i < kResourceTypeInvalid; i++) {
 			DebugPrintf("%s", getResourceTypeName((ResourceType) i));
-			DebugPrintf((i < 19) ? ", " : "\n");
+			DebugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n");
 		}
 
 		return true;
@@ -360,4 +323,51 @@
 	return true;
 }
 
+bool Console::cmdResourceTypes(int argc, const char **argv) {
+	DebugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid);
+	for (int i = 0; i < kResourceTypeInvalid; i++) {
+		DebugPrintf("%s", getResourceTypeName((ResourceType) i));
+		DebugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n");
+	}
+
+	return true;
+}
+
+extern int sci0_palette;
+
+bool Console::cmdSci0Palette(int argc, const char **argv) {
+	if (argc != 2) {
+		DebugPrintf("Set the SCI0 palette to use - 0: EGA, 1: AGI/Amiga, 2: Grayscale\n");
+		return true;
+	}
+
+	sci0_palette = atoi(argv[1]);
+	// TODO: the current room has to be changed to reset the palette of the views
+	game_init_graphics(g_EngineState);
+
+	return false;
+}
+
+bool Console::cmdExit(int argc, const char **argv) {
+	if (argc != 2) {
+		DebugPrintf("exit game - exit gracefully\n");
+		DebugPrintf("exit now - exit ungracefully\n");
+		return true;
+	}
+
+	if (!scumm_stricmp(argv[1], "game")) {
+		// Quit gracefully
+		script_abort_flag = 1; // Terminate VM
+		_debugstate_valid = 0;
+		_debug_seeking = 0;
+		_debug_step_running = 0;
+
+	} else if (!scumm_stricmp(argv[1], "now")) {
+		// Quit ungracefully
+		exit(0);
+	}
+
+	return false;
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/console.h	2009-05-29 17:19:39 UTC (rev 41010)
@@ -50,11 +50,13 @@
 	bool cmdKernelNames(int argc, const char **argv);
 	bool cmdSuffixes(int argc, const char **argv);
 	bool cmdKernelWords(int argc, const char **argv);
-	bool cmdMan(int argc, const char **argv);
 	bool cmdHexDump(int argc, const char **argv);
 	bool cmdDissectScript(int argc, const char **argv);
 	bool cmdRoomNumber(int argc, const char **argv);
 	bool cmdResourceSize(int argc, const char **argv);
+	bool cmdResourceTypes(int argc, const char **argv);
+	bool cmdSci0Palette(int argc, const char **argv);
+	bool cmdExit(int argc, const char **argv);
 
 private:
 	SciEngine *_vm;

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2009-05-29 17:19:39 UTC (rev 41010)
@@ -170,8 +170,6 @@
 
 /******************** Priority macros/functions ********************/
 
-extern int sci01_priority_table_flags; /* 1: delete, 2: print */
-
 int _find_priority_band(EngineState *s, int band);
 /* Finds the position of the priority band specified
 ** Parameters: (EngineState *) s: State to search in

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -987,8 +987,6 @@
 
 void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr);
 
-int sci01_priority_table_flags = 0;
-
 #define K_DRAWPIC_FLAG_MIRRORED (1 << 14)
 
 reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
@@ -1050,18 +1048,6 @@
 
 	s->pic_priority_table = gfxop_get_pic_metainfo(s->gfx_state);
 
-	if (sci01_priority_table_flags & 0x2) {
-		if (s->pic_priority_table) {
-			int i;
-			fprintf(stderr, "---------------------------\nPriority table:\n");
-			for (i = 0; i < 16; i++)
-				fprintf(stderr, "\t%d:\t%d\n", i, s->pic_priority_table[i]);
-			fprintf(stderr, "---------------------------\n");
-		}
-	}
-	if (sci01_priority_table_flags & 0x1)
-		s->pic_priority_table = NULL;
-
 	if (argc > 1)
 		s->pic_animate = SKPV(1) & 0xff; // The animation used during kAnimate() later on
 

Modified: scummvm/trunk/engines/sci/engine/sciconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/sciconsole.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/engine/sciconsole.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -37,7 +37,6 @@
 // console commands
 
 static int c_list(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // lists various types of things
-static int c_man(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // 'manual page'
 static int c_set(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // sets an int variable
 static int c_print(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // prints a variable
 //static int c_objinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // shows some info about one class
@@ -162,7 +161,6 @@
 
 		// Hook up some commands
 		con_hook_command(&c_list, "list", "s*", "Lists various things (try 'list')");
-		con_hook_command(&c_man, "man", "s", "Gives a short description of something");
 		con_hook_command(&c_print, "print", "s", "Prints an int variable");
 		con_hook_command(&c_set, "set", "si", "Sets an int variable");
 		con_hook_command(&c_hexgrep, "hexgrep", "shh*", "Searches some resources for a\n"
@@ -191,6 +189,20 @@
 		              "    a list of addresses and indices is provided.\n"
 		              "    ?obj.idx may be used to disambiguate 'obj'\n"
 		              "    by the index 'idx'.\n");
+
+			// These were in sci.cpp
+			/*
+			con_hook_int(&(gfx_options.buffer_pics_nr), "buffer_pics_nr",
+				"Number of pics to buffer in LRU storage\n");
+			con_hook_int(&(gfx_options.pic0_dither_mode), "pic0_dither_mode",
+				"Mode to use for pic0 dithering\n");
+			con_hook_int(&(gfx_options.pic0_dither_pattern), "pic0_dither_pattern",
+				"Pattern to use for pic0 dithering\n");
+			con_hook_int(&(gfx_options.pic0_unscaled), "pic0_unscaled",
+				"Whether pic0 should be drawn unscaled\n");
+			con_hook_int(&(gfx_options.dirty_frames), "dirty_frames",
+				"Dirty frames management\n");
+			*/
 	}
 }
 
@@ -731,7 +743,6 @@
 		          "vars       - lists all variables\n"
 		          "docs       - lists all misc. documentation\n"
 		          "\n"
-		          "restypes   - lists all resource types\n"
 		          "[resource] - lists all [resource]s");
 	} else if (cmdParams.size() == 1) {
 		const char *mm_subsects[3] = {"cmds", "vars", "docs"};
@@ -749,11 +760,6 @@
 			if (!s) {
 				sciprintf("You need a state to do that!\n");
 				return 1;
-			}
-
-			else if (strcmp("restypes", cmdParams[0].str) == 0) {
-				for (i = 0; i < kResourceTypeInvalid; i++)
-					sciprintf("%s\n", getResourceTypeName((ResourceType)i));
 			} else {
 				ResourceType res = parseResourceType(cmdParams[0].str);
 				if (res == kResourceTypeInvalid)
@@ -770,43 +776,6 @@
 	return 0;
 }
 
-static int c_man(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	int section = 0;
-	uint i;
-	Common::String name = cmdParams[0].str;
-	const char *c = strchr(name.c_str(), '.');
-	cmd_mm_entry_t *entry = 0;
-
-	if (c) {
-		section = atoi(c + 1);
-		name = Common::String(name.begin(), c);
-	}
-
-	if (section < 0 || section >= CMD_MM_ENTRIES) {
-		sciprintf("Invalid section %d\n", section);
-		return 1;
-	}
-
-	sciprintf("section:%d\n", section);
-	if (section)
-		entry = cmd_mm_find(name.c_str(), section - 1);
-	else
-		for (i = 0; i < CMD_MM_ENTRIES && !section; i++) {
-			if ((entry = cmd_mm_find(name.c_str(), i)))
-				section = i + 1;
-		}
-
-	if (!entry) {
-		sciprintf("No manual entry\n");
-		return 1;
-	}
-
-	sciprintf("-- %s: %s.%d\n", cmd_mm[section - 1].name, name.c_str(), section);
-	cmd_mm[section - 1].print(entry, 1);
-
-	return 0;
-}
-
 static int c_set(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	cmd_var_t *var = (cmd_var_t *)cmd_mm_find(cmdParams[0].str, CMD_MM_VAR);
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -32,9 +32,6 @@
 
 namespace Sci {
 
-int gfx_crossblit_alpha_threshold = 128;
-
-
 #define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
                   linearend, nonlinearstart, linearmod, nonlinearmod) \
 	incrNE = ((deltalinear) > 0) ? (deltalinear) : -(deltalinear); \
@@ -314,6 +311,12 @@
 #endif
 	}
 
+		/**
+		 * Crossblitting functions use this value as threshold for distinguishing
+		 * between transparent and opaque wrt alpha values.
+		 */
+		int gfx_crossblit_alpha_threshold = 0x90;	// was 128
+
 		if (alpha_mask & 0xff)
 			alpha_min = ((alpha_mask * gfx_crossblit_alpha_threshold) >> 8) & alpha_mask;
 		else

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-05-29 17:19:39 UTC (rev 41010)
@@ -42,13 +42,6 @@
 	GFX_XLATE_FILTER_TRILINEAR
 };
 
-
-/**
- * Crossblitting functions use this value as threshold for distinguishing
- * between transparent and opaque wrt alpha values.
- */
-extern int gfx_crossblit_alpha_threshold;
-
 gfx_mode_t *gfx_new_mode(int xfact, int yfact, const Graphics::PixelFormat &format, Palette *palette, int flags);
 /* Allocates a new gfx_mode_t structure with the specified parameters
 ** Parameters: (int x int) xfact x yfact: Horizontal and vertical scaling factors

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -1049,9 +1049,6 @@
 	_gfxop_full_pointer_refresh(state);
 	_gfxop_add_dirty(state, box);
 	DDIRTY(stderr, "[]  clearing box %d %d %d %d\n", GFX_PRINT_RECT(box));
-	if (box.x == 29 && box.y == 77 && (sci0_palette == 1)) {
-		BREAKPOINT();
-	}
 
 	_gfxop_clip(&box, gfx_rect(0, 0, 320, 200));
 #ifdef PRECISE_PRIORITY_MAP

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-05-29 17:16:31 UTC (rev 41009)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-05-29 17:19:39 UTC (rev 41010)
@@ -55,44 +55,6 @@
 	"SCI32"
 };
 
-
-int c_quit(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	script_abort_flag = 1; // Terminate VM
-	_debugstate_valid = 0;
-	_debug_seeking = 0;
-	_debug_step_running = 0;
-	return 0;
-}
-
-int c_die(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	exit(0); //
-	return 0;
-}
-
-static void init_console() {
-	con_hook_command(&c_quit, "quit", "", "console: Quits gracefully");
-	con_hook_command(&c_die, "die", "", "console: Quits ungracefully");
-
-	/*
-	con_hook_int(&(gfx_options.buffer_pics_nr), "buffer_pics_nr",
-		"Number of pics to buffer in LRU storage\n");
-	con_hook_int(&(gfx_options.pic0_dither_mode), "pic0_dither_mode",
-		"Mode to use for pic0 dithering\n");
-	con_hook_int(&(gfx_options.pic0_dither_pattern), "pic0_dither_pattern",
-		"Pattern to use for pic0 dithering\n");
-	con_hook_int(&(gfx_options.pic0_unscaled), "pic0_unscaled",
-		"Whether pic0 should be drawn unscaled\n");
-	con_hook_int(&(gfx_options.dirty_frames), "dirty_frames",
-		"Dirty frames management\n");
-	*/
-	con_hook_int(&gfx_crossblit_alpha_threshold, "alpha_threshold",
-	             "Alpha threshold for crossblitting\n");
-	con_hook_int(&sci0_palette, "sci0_palette",
-	             "SCI0 palette- 0: EGA, 1:AGI/Amiga, 2:Grayscale\n");
-	con_hook_int(&sci01_priority_table_flags, "sci01_priority_table_flags",
-	             "SCI01 priority table debugging flags: 1:Disable, 2:Print on change\n");
-}
-
 SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc)
 		: Engine(syst), _gameDescription(desc) {
 	// Put your engine in a sane state, but do nothing big yet;
@@ -161,8 +123,6 @@
 
 	// FIXME/TODO: Move some of the stuff below to init()
 
-	init_console(); /* So we can get any output */
-
 	script_debug_flag = 0;
 
 	sci_version_t version;
@@ -238,7 +198,6 @@
 	// since we cannot let the game control where saves are stored)
 	script_set_gamestate_save_dir(gamestate, "/");
 
-	gfx_crossblit_alpha_threshold = 0x90;
 	GfxState gfx_state;
 	gfx_state.driver = &gfx_driver_scummvm;
 


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