[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.7,1.8 actor.cpp,1.10,1.11 animation.cpp,1.5,1.6 console.cpp,1.5,1.6 cvar.cpp,1.5,1.6 events.cpp,1.9,1.10 events.h,1.2,1.3 font.cpp,1.7,1.8 font.h,1.4,1.5 game.cpp,1.13,1.14 interface.cpp,1.7,1.8 ite_introproc.cpp,1.8,1.9 music.cpp,1.13,1.14 objectmap.cpp,1.8,1.9 palanim.cpp,1.7,1.8 reinherit.h,1.18,1.19 saga.cpp,1.19,1.20 scene.cpp,1.8,1.9 sceneproc.cpp,1.6,1.7 script.cpp,1.6,1.7 sdata.cpp,1.4,1.5 sprite.cpp,1.7,1.8 sthread.cpp,1.6,1.7

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Wed May 5 06:06:12 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9451

Modified Files:
	actionmap.cpp actor.cpp animation.cpp console.cpp cvar.cpp 
	events.cpp events.h font.cpp font.h game.cpp interface.cpp 
	ite_introproc.cpp music.cpp objectmap.cpp palanim.cpp 
	reinherit.h saga.cpp scene.cpp sceneproc.cpp script.cpp 
	sdata.cpp sprite.cpp sthread.cpp 
Log Message:
Replaced R_printf() with debug() and warning(). There are still a couple of
standard printf()s left, though.


Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- actionmap.cpp	4 May 2004 03:33:03 -0000	1.7
+++ actionmap.cpp	5 May 2004 13:05:30 -0000	1.8
@@ -42,7 +42,7 @@
 }
 
 int ACTIONMAP_Init(void) {
-	R_printf(R_STDOUT, "ACTIONMAP Module: Initializing...\n");
+	debug(0, "ACTIONMAP Module: Initializing...");
 	ActmapModule.init = 1;
 	return R_SUCCESS;
 }
@@ -68,7 +68,7 @@
 
 	exmap_entry = (R_ACTIONMAP_ENTRY *)malloc(exit_ct * sizeof *exmap_entry);
 	if (exmap_entry == NULL) {
-		R_printf(R_STDERR, "Memory allocation failure.\n");
+		warning("Memory allocation failure");
 		return R_MEM;
 	}
 
@@ -86,7 +86,7 @@
 
 		exmap_pt_tbl = (R_POINT *)malloc(exmap_entry[i].pt_count * sizeof *exmap_pt_tbl);
 		if (exmap_pt_tbl == NULL) {
-			R_printf(R_STDERR, "Memory allocation failure.\n");
+			warning("Memory allocation failure");
 			return R_MEM;
 		}
 

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- actor.cpp	4 May 2004 03:33:03 -0000	1.10
+++ actor.cpp	5 May 2004 13:05:30 -0000	1.11
@@ -351,7 +351,7 @@
 	}
 
 	if (last_frame >= SPRITE_GetListLen(actor->sl_p)) {
-		R_printf(R_STDOUT, "Appending to sprite list %d.\n", actor->sl_rn);
+		debug(0, "Appending to sprite list %d.", actor->sl_rn);
 		if (SPRITE_AppendList(actor->sl_rn + 1,
 			actor->sl_p) != R_SUCCESS) {
 			return R_FAILURE;
@@ -662,18 +662,18 @@
 
 	result = RSC_LoadResource(ActorModule.actor_ctxt, si_rn, &res_p, &res_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't load sprite action index resource.\n");
+		warning("Couldn't load sprite action index resource");
 		return R_FAILURE;
 	}
 
 	s_action_ct = res_len / 16;
-	R_printf(R_STDOUT, "Sprite resource contains %d sprite actions.\n", s_action_ct);
+	debug(0, "Sprite resource contains %d sprite actions.", s_action_ct);
 	action_p = (R_ACTORACTION *)malloc(sizeof(R_ACTORACTION) * s_action_ct);
 
 	MemoryReadStream *readS = new MemoryReadStream(res_p, res_len);
 
 	if (action_p == NULL) {
-		R_printf(R_STDERR, "Couldn't allocate memory for sprite actions.\n");
+		warning("Couldn't allocate memory for sprite actions");
 		RSC_FreeResource(res_p);
 		return R_MEM;
 	}
@@ -838,16 +838,14 @@
 
 	if (node_p->calc_flag == 0) {
 
-#if 0
-		R_printf(R_STDOUT, "Calculating new path vector to point (%d, %d)\n", node_p->node_pt.x, node_p->node_pt.y);
-#endif
+		debug(2, "Calculating new path vector to point (%d, %d)", node_p->node_pt.x, node_p->node_pt.y);
 
 		dx = a_walkint->org.x - node_p->node_pt.x;
 		dy = a_walkint->org.y - node_p->node_pt.y;
 
 		if (dx == 0) {
 
-			R_printf(R_STDOUT, "Vertical paths not implemented.\n");
+			debug(0, "Vertical paths not implemented.");
 
 			ys_dll_delete(walk_p);
 			a_walkint->wi_active = 0;
@@ -889,9 +887,7 @@
 
 		sprintf(buf, "%f", a_walkint->slope);
 
-#if 0
-		R_printf(R_STDOUT, "Path slope: %s.\n", buf);
-#endif
+		debug(2, "Path slope: %s.", buf);
 
 		actor->action = ACTION_WALK;
 		actor->action_flags = ACTION_LOOP;
@@ -917,9 +913,7 @@
 	if (a_walkint->x_dir == 1) {
 
 		if (new_a_x >= node_p->node_pt.x) {
-#if 0
-			R_printf(R_STDOUT, "Path complete.\n");
-#endif
+			debug(2, "Path complete.");
 			ys_dll_delete(walk_p);
 			a_walkint->wi_active = 0;
 
@@ -935,10 +929,7 @@
 		}
 	} else {
 		if (new_a_x <= node_p->node_pt.x) {
-
-#if 0
-			R_printf(R_STDOUT, "Path complete.\n");
-#endif
+			debug(2, "Path complete.");
 			ys_dll_delete(walk_p);
 			a_walkint->wi_active = 0;
 

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- animation.cpp	4 May 2004 03:33:03 -0000	1.5
+++ animation.cpp	5 May 2004 13:05:30 -0000	1.6
@@ -85,7 +85,7 @@
 
 	new_anim = (R_ANIMATION *)malloc(sizeof *new_anim);
 	if (new_anim == NULL) {
-		R_printf(R_STDERR, "Error: Allocation failure.\n");
+		warning("Error: Allocation failure");
 		return R_MEM;
 	}
 
@@ -94,14 +94,14 @@
 
 	if (GAME_GetGameType() == R_GAMETYPE_ITE) {
 		if (ANIM_GetNumFrames(anim_resdata, anim_resdata_len, &new_anim->n_frames) != R_SUCCESS) {
-			R_printf(R_STDERR, "Error: Couldn't get animation frame count.\n");
+			warning("Error: Couldn't get animation frame count");
 			return R_FAILURE;
 		}
 
 		// Cache frame offsets
 		new_anim->frame_offsets = (size_t *)malloc(new_anim->n_frames * sizeof *new_anim->frame_offsets);
 		if (new_anim->frame_offsets == NULL) {
-			R_printf(R_STDERR, "Error: Allocation failure.\n");
+			warning("Error: Allocation failure");
 			return R_MEM;
 		}
 
@@ -195,20 +195,20 @@
 			result = ITE_DecodeFrame(anim->resdata, anim->resdata_len, anim->frame_offsets[frame - 1], display_buf,
 									disp_info.logical_w * disp_info.logical_h);
 			if (result != R_SUCCESS) {
-				R_printf(R_STDERR, "ANIM_Play: Error decoding frame %u", anim->current_frame);
+				warning("ANIM_Play: Error decoding frame %u", anim->current_frame);
 				anim->play_flag = 0;
 				return R_FAILURE;
 			}
 		} else {
 			if (anim->cur_frame_p == NULL) {
-				R_printf(R_STDERR, "ANIM_Play: Frames exhausted.\n");
+				warning("ANIM_Play: Frames exhausted");
 				return R_FAILURE;
 			}
 
 			result = IHNM_DecodeFrame(display_buf,  disp_info.logical_w * disp_info.logical_h,
 									anim->cur_frame_p, anim->cur_frame_len, &nextf_p, &nextf_len);
 			if (result != R_SUCCESS) {
-				R_printf(R_STDERR, "ANIM_Play: Error decoding frame %u", anim->current_frame);
+				warning("ANIM_Play: Error decoding frame %u", anim->current_frame);
 				anim->play_flag = 0;
 				return R_FAILURE;
 			}
@@ -436,7 +436,7 @@
 
 	if ((screen_w * screen_h) > buf_len) {
 		// Buffer argument is too small to hold decoded frame, abort.
-		R_printf(R_STDERR, "ITE_DecodeFrame: Buffer size inadequate.\n");
+		warning("ITE_DecodeFrame: Buffer size inadequate");
 		return R_FAILURE;
 	}
 
@@ -446,7 +446,7 @@
 	// Check for frame magic byte
 	magic = readS->readByte();
 	if (magic != SAGA_FRAME_HEADER_MAGIC) {
-		R_printf(R_STDERR, "ITE_DecodeFrame: Invalid frame offset.\n");
+		warning("ITE_DecodeFrame: Invalid frame offset");
 		return R_FAILURE;
 	}
 
@@ -543,7 +543,7 @@
 			break;
 		default:
 			// Unknown marker found - abort
-			R_printf(R_STDERR, "ITE_DecodeFrame: Invalid RLE marker encountered.\n");
+			warning("ITE_DecodeFrame: Invalid RLE marker encountered");
 			return R_FAILURE;
 			break;
 		}
@@ -596,7 +596,7 @@
 				int param6;
 
 				if (thisf_len - readS->tell() < 13) {
-					R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
+					warning("0x%02X: Input buffer underrun", in_ch);
 					return R_FAILURE;
 				}
 
@@ -614,7 +614,7 @@
 				outbuf_p = decode_buf + x_origin + (y_origin * di.logical_w);
 
 				if (outbuf_p > outbuf_endp) {
-					R_printf(R_STDERR, "0x%02X: (0x%X) Invalid output position. (x: %d, y: %d)\n",
+					warning("0x%02X: (0x%X) Invalid output position. (x: %d, y: %d)",
 							in_ch, in_ch_offset, x_origin, y_origin);
 					return R_FAILURE;
 				}
@@ -626,11 +626,11 @@
 		case 0x10: // Long Unencoded Run
 			runcount = readS->readSint16BE();
 			if (thisf_len - readS->tell() < runcount) {
-				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
+				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
 			if (outbuf_remain < runcount) {
-				R_printf(R_STDERR, "0x%02X: Output buffer overrun.", in_ch);
+				warning("0x%02X: Output buffer overrun", in_ch);
 				return R_FAILURE;
 			}
 
@@ -647,7 +647,7 @@
 			break;
 		case 0x1F: // 31: Unusued?
 			if (thisf_len - readS->tell() < 3) {
-				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
+				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
 
@@ -658,7 +658,7 @@
 			break;
 		case 0x20: // Long compressed run
 			if (thisf_len - readS->tell() <= 3) {
-				R_printf(R_STDERR, "0x%02X: Input buffer underrun.", in_ch);
+				warning("0x%02X: Input buffer underrun", in_ch);
 				return R_FAILURE;
 			}
 
@@ -693,7 +693,7 @@
 			x_vector = readS->readSint16BE();
 
 			if (((x_vector > 0) && ((size_t) x_vector > outbuf_remain)) || (-x_vector > outbuf_p - decode_buf)) {
-				R_printf(R_STDERR, "0x30: Invalid x_vector.\n");
+				warning("0x30: Invalid x_vector");
 				return R_FAILURE;
 			}
 
@@ -703,7 +703,7 @@
 			break;
 
 		case 0x3F:	// 68: Frame end marker
-			printf("0x3F: Frame end marker\n");
+			debug(1, "0x3F: Frame end marker");
 			if (decoded_data && (thisf_len - readS->tell() > 0)) {
 				*nextf_p = thisf_p + readS->tell();
 				*nextf_len = thisf_len - readS->tell();

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/console.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- console.cpp	2 May 2004 00:00:38 -0000	1.5
+++ console.cpp	5 May 2004 13:05:30 -0000	1.6
@@ -67,7 +67,7 @@
 }
 
 int CON_Shutdown() {
-	R_printf(R_STDOUT, "CON_Shutdown(): Deleting console scrollback and command history.\n");
+	debug(0, "CON_Shutdown(): Deleting console scrollback and command history.");
 
 	CON_DeleteScroll(&ConScrollback);
 	CON_DeleteScroll(&ConHistory);
@@ -283,7 +283,7 @@
 	strcpy(ConInfo.input_buf, start_ptr->str_p);
 	ConInfo.input_pos = start_ptr->str_len - 1;
 
-	R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
+	debug(0, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
 
 	return R_SUCCESS;
 }
@@ -293,7 +293,7 @@
 	int i;
 
 	if (ConInfo.hist_pos == 1) {
-		R_printf(R_STDOUT, "Erased input buffer.");
+		debug(0, "Erased input buffer.");
 		memset(ConInfo.input_buf, 0, R_CON_INPUTBUF_LEN);
 		ConInfo.input_pos = 0;
 		ConInfo.hist_pos--;
@@ -316,8 +316,7 @@
 	strcpy(ConInfo.input_buf, start_ptr->str_p);
 	ConInfo.input_pos = start_ptr->str_len - 1;
 
-	R_printf(R_STDOUT, "History pos: %d/%d", ConInfo.hist_pos,
-	    ConHistory.lines);
+	debug(0, "History pos: %d/%d", ConInfo.hist_pos, ConHistory.lines);
 
 	return R_SUCCESS;
 }
@@ -330,7 +329,7 @@
 		ConInfo.line_pos += n_lines;
 	}
 
-	R_printf(R_STDOUT, "Line pos: %d", ConInfo.line_pos);
+	debug(0, "Line pos: %d", ConInfo.line_pos);
 	return R_SUCCESS;
 }
 

Index: cvar.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/cvar.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cvar.cpp	1 May 2004 19:41:47 -0000	1.5
+++ cvar.cpp	5 May 2004 13:05:30 -0000	1.6
@@ -77,7 +77,7 @@
 	R_CVAR *temp_ptr;
 	int i;
 
-	R_printf(R_STDOUT, "CVAR_Shutdown(): Deleting cvar hash table.\n");
+	debug(0, "CVAR_Shutdown(): Deleting cvar hash table.");
 
 	for (i = 0; i < R_CVAR_HASHLEN; i++) {
 		for (walk_ptr = CVHashTbl[i]; walk_ptr; walk_ptr = temp_ptr) {

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- events.cpp	2 May 2004 00:00:38 -0000	1.9
+++ events.cpp	5 May 2004 13:05:30 -0000	1.10
@@ -49,13 +49,13 @@
 static YS_DL_LIST *EventList;
 
 int EVENT_Init() {
-	R_printf(R_STDOUT, "Initializing event subsystem...\n");
+	debug(0, "Initializing event subsystem...");
 	EventList = ys_dll_create();
 	return (EventList != NULL) ? R_SUCCESS : R_FAILURE;
 }
 
 int EVENT_Shutdown() {
-	R_printf(R_STDOUT, "Shutting down event subsystem...\n");
+	debug(0, "Shutting down event subsystem...");
 	EVENT_FreeList();
 	return R_SUCCESS;
 }
@@ -99,7 +99,7 @@
 
 		default:
 			result = R_EVENT_INVALIDCODE;
-			R_printf(R_STDERR, "Invalid event code encountered.\n");
+			warning("Invalid event code encountered");
 			break;
 		}
 
@@ -447,7 +447,7 @@
 		event_count++;
 
 		if (event_count > R_EVENT_WARNINGCOUNT) {
-			R_printf(R_STDERR, "WARNING: Event list exceeds %u.\n", R_EVENT_WARNINGCOUNT);
+			warning("Event list exceeds %u", R_EVENT_WARNINGCOUNT);
 		}
 	}
 

Index: events.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- events.h	1 May 2004 06:50:20 -0000	1.2
+++ events.h	5 May 2004 13:05:30 -0000	1.3
@@ -28,7 +28,6 @@
 
 namespace Saga {
 
-#define R_EVENT_DBGLVL R_DEBUG_NONE
 #define R_EVENT_WARNINGCOUNT 1000
 #define R_EVENT_MASK 0x00FF
 

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- font.cpp	4 May 2004 03:33:03 -0000	1.7
+++ font.cpp	5 May 2004 13:05:30 -0000	1.8
@@ -74,7 +74,7 @@
 int FONT_Shutdown() {
 //	int i;
 
-	R_printf(R_STDOUT, "FONT_Shutdown(): Freeing fonts.\n");
+	debug(0, "FONT_Shutdown(): Freeing fonts.");
 /*
 	for ( i = 0 ; i < R_FONT_COUNT ; i ++ ) {
 		if ( FontModule.fonts[i] != NULL ) {
@@ -132,15 +132,11 @@
 	fh.c_width = readS->readUint16LE();
 	fh.row_length = readS->readUint16LE();
 
-#if R_FONT_DBGLVL >= R_DEBUG_INFO
-	R_printf(R_STDOUT, "FONT_Load(): Reading font resource...\n");
-#endif
+	debug(1, "FONT_Load(): Reading font resource...");
 
-#if R_FONT_DBGLVL >= R_DEBUG_VERBOSE
-	R_printf(R_STDOUT, "Character width:\t%d\n", fh.c_width);
-	R_printf(R_STDOUT, "Character height:\t%d\n", fh.c_height);
-	R_printf(R_STDOUT, "Row padding:\t%d\n", fh.row_length);
-#endif
+	debug(2, "Character width:\t%d", fh.c_width);
+	debug(2, "Character height:\t%d", fh.c_height);
+	debug(2, "Row padding:\t%d", fh.row_length);
 
 	// Create normal font style
 	normal_font = (R_FONT_STYLE *)malloc(sizeof *normal_font);
@@ -173,7 +169,7 @@
 	}
 
 	if (readS->tell() != R_FONT_DESCSIZE) {
-		R_printf(R_STDERR, "Invalid font resource size.\n");
+		warning("Invalid font resource size.");
 		return R_FAILURE;
 	}
 
@@ -267,9 +263,7 @@
 		new_row_len += new_byte_width;
 	}
 
-#if R_FONT_DBGLVL >= R_DEBUG_VERBOSE
-	R_printf(R_STDOUT, "New row length: %d\n", new_row_len);
-#endif
+	debug(2, "New row length: %d", new_row_len);
 
 	new_font->hdr.c_width = s_width + 2;
 	new_font->hdr.c_height = s_height + 2;

Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- font.h	1 May 2004 08:44:00 -0000	1.4
+++ font.h	5 May 2004 13:05:30 -0000	1.5
@@ -28,8 +28,6 @@
 
 namespace Saga {
 
-#define R_FONT_DBGLVL R_DEBUG_NONE
-
 #define R_FONT_SHOWUNDEFINED 1	// Define to draw undefined characters * as ?'s
 
 // The first defined character (!) is the only one that may 

Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- game.cpp	5 May 2004 12:05:00 -0000	1.13
+++ game.cpp	5 May 2004 13:05:30 -0000	1.14
@@ -355,27 +355,27 @@
 	if (GameDescs[game_n].gd_game_type == R_GAMETYPE_ITE) {
 		snprintf(lang_file, R_MAXPATH, "%s%s.%s", R_GAME_ITE_LANG_PREFIX, GameModule.game_language, R_GAME_LANG_EXT);
 		if (!test_file.open(lang_file)) {
-			R_printf(R_STDOUT, "Couldn't open language file %s. Using default (US English)\n", lang_file);
+			debug(0, "Couldn't open language file %s. Using default (US English)", lang_file);
 			return R_SUCCESS;
 		}
 
 		test_file.close();
 
 		if (INTERFACE_RegisterLang() != R_SUCCESS) {
-			R_printf(R_STDERR, "Error registering interface language cvars.");
+			warning("Error registering interface language cvars");
 			return R_FAILURE;
 		}
 
 		if (ITE_IntroRegisterLang() != R_SUCCESS) {
-			R_printf(R_STDERR, "Error registering intro sequence language cvars.");
+			warning("Error registering intro sequence language cvars");
 			return R_FAILURE;
 		}
 
-		R_printf(R_STDOUT, "Using language file %s.\n", lang_file);
+		debug(0, "Using language file %s.", lang_file);
 		// FIXME
 		//CFG_Read(lang_path);
 	} else {
-		R_printf(R_STDOUT, "Language support for this game not implemented.\n");
+		debug(0, "Language support for this game not implemented.");
 	}
 
 	return R_SUCCESS;
@@ -494,7 +494,7 @@
 			continue;
 		}
 
-		R_printf(R_STDOUT, "Found game: %s\n", GameDescs[game_n].gd_title);
+		debug(0, "Found game: %s", GameDescs[game_n].gd_title);
 		*game_n_p = game_n;
 		return R_SUCCESS;
 	}
@@ -530,7 +530,7 @@
 			return R_FAILURE;
 		}
 
-		R_printf(R_STDOUT, "Opened resource file: %s\n", game_fname);
+		debug(0, "Opened resource file: %s", game_fname);
 		GameModule.gfile_data[i].file_ctxt = load_ctxt;
 		GameModule.gfile_data[i].file_types = GameDescs[game_n].gd_filedescs[i].gf_type;
 		GameModule.gfile_data[i].file_flags = 0;

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- interface.cpp	2 May 2004 00:00:38 -0000	1.7
+++ interface.cpp	5 May 2004 13:05:30 -0000	1.8
@@ -150,7 +150,7 @@
 
 	IfModule.i_thread = STHREAD_Create();
 	if (IfModule.i_thread == NULL) {
-		R_printf(R_STDERR, "Error creating script thread for game interface module.\n");
+		warning("Error creating script thread for game interface module");
 		return R_FAILURE;
 	}
 

Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ite_introproc.cpp	2 May 2004 00:00:39 -0000	1.8
+++ ite_introproc.cpp	5 May 2004 13:05:30 -0000	1.9
@@ -158,7 +158,7 @@
 		if (CVAR_Register_S(IntroDiag[i].i_str,
 			IntroDiag[i].i_cvar_name,
 			NULL, R_CVAR_CFG, R_INTRO_STRMAX) != R_SUCCESS) {
-			R_printf(R_STDERR, "Error registering intro text cvars.");
+			warning("Error registering intro text cvars");
 			return R_FAILURE;
 		}
 	}
@@ -184,8 +184,8 @@
 
 		EVENT_Queue(&event);
 
-		R_printf(R_STDOUT, "Intro animation procedure started.\n");
-		R_printf(R_STDOUT, "Linking animation resources...\n");
+		debug(0, "Intro animation procedure started.");
+		debug(0, "Linking animation resources...");
 
 		ANIM_SetFrameTime(0, ITE_INTRO_FRAMETIME);
 
@@ -201,7 +201,7 @@
 		// Scene should end on display of last animation frame
 		ANIM_SetFlag(6, ANIM_ENDSCENE);
 
-		R_printf(R_STDOUT, "Beginning animation playback.\n");
+		debug(0, "Beginning animation playback.");
 
 		ANIM_Play(0, 0);
 
@@ -218,7 +218,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 
@@ -337,7 +337,7 @@
 		break;
 
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
+		warning("Illegal scene procedure paramater");
 		break;
 	}
 
@@ -433,7 +433,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
+		warning("Illegal scene procedure paramater");
 		break;
 	}
 
@@ -530,7 +530,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
+		warning("Illegal scene procedure paramater");
 		break;
 	}
 
@@ -627,7 +627,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure paramater.\n");
+		warning("Illegal scene procedure paramater");
 		break;
 	}
 
@@ -672,7 +672,7 @@
 
 		q_event = EVENT_Queue(&event);
 
-		R_printf(R_STDOUT, "Beginning animation playback.\n");
+		debug(0, "Beginning animation playback.");
 
 		// Begin title screen background animation 
 		ANIM_SetFlag(0, ANIM_LOOP);
@@ -732,7 +732,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 
@@ -838,7 +838,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 
@@ -947,7 +947,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 
@@ -983,7 +983,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 

Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- music.cpp	1 May 2004 16:49:23 -0000	1.13
+++ music.cpp	5 May 2004 13:05:30 -0000	1.14
@@ -297,8 +297,7 @@
 
 		if (RSC_LoadResource(rsc_ctxt, music_rn, &resource_data, 
 				&resource_size) != R_SUCCESS ) {
-			R_printf(R_STDERR, "SYSMUSIC_Play(): Resource load failed: %u",
-				music_rn);
+			warning("SYSMUSIC_Play(): Resource load failed: %u", music_rn);
 			return R_FAILURE;
 		}
 

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- objectmap.cpp	4 May 2004 03:33:03 -0000	1.8
+++ objectmap.cpp	5 May 2004 13:05:30 -0000	1.9
@@ -34,8 +34,6 @@
 #include "gfx_mod.h"
 #include "font_mod.h"
 
-#define R_OBJECTMAP_DEBUG R_DEBUG_INFO
-
 #include "objectmap_mod.h"
 #include "objectmap.h"
 
@@ -51,7 +49,7 @@
 
 // Initializes the object map module, creates module allocation context
 int OBJECTMAP_Init() {
-	R_printf(R_STDOUT, "OBJECTMAP Module: Initializing...\n");
+	debug(0, "OBJECTMAP Module: Initializing...");
 
 	OMInfo.initialized = 1;
 	return R_SUCCESS;
@@ -63,12 +61,12 @@
 		return R_FAILURE;
 	}
 
-	R_printf(R_STDOUT, "OBJECTMAP Module: Shutting down...\n");
+	debug(0, "OBJECTMAP Module: Shutting down...");
 
 	OBJECTMAP_Free();
 	OBJECTMAP_FreeNames();
 
-	R_printf(R_STDOUT, "OBJECTMAP Module: Shutdown AOK.\n");
+	debug(0, "OBJECTMAP Module: Shutdown AOK.");
 
 	OMInfo.initialized = 0;
 	return R_SUCCESS;
@@ -85,7 +83,7 @@
 	MemoryReadStream *readS = new MemoryReadStream(om_res, om_res_len);
 
 	if (!OMInfo.initialized) {
-		R_printf(R_STDERR, "Error: Object map module not initialized!\n");
+		warning("Error: Object map module not initialized");
 		return R_FAILURE;
 	}
 
@@ -99,7 +97,7 @@
 	OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
 
 	if (OMInfo.object_maps == NULL) {
-		R_printf(R_STDERR, "Error: Memory allocation failed.\n");
+		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
@@ -114,7 +112,7 @@
 		object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
 
 		if (object_map->clickareas == NULL) {
-			R_printf(R_STDERR, "Error: Memory allocation failed.\n");
+			warning("Error: Memory allocation failed");
 			return R_MEM;
 		}
 
@@ -126,7 +124,7 @@
 
 			clickarea->points = (R_POINT *)malloc(clickarea->n_points * sizeof *(clickarea->points));
 			if (clickarea->points == NULL) {
-				R_printf(R_STDERR, "Error: Memory allocation failed.\n");
+				warning("Error: Memory allocation failed");
 				return R_MEM;
 			}
 
@@ -136,10 +134,8 @@
 				point->x = readS->readSint16LE();
 				point->y = readS->readSint16LE();
 			}
-#if R_OBJECTMAP_DEBUG >= R_DEBUG_PARANOID
-			R_printf(R_STDOUT, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.\n",
+			debug(2, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.",
 					clickarea->n_points, k, object_map->object_num);
-#endif
 		}
 	}
 
@@ -196,15 +192,11 @@
 	n_names = table_len / 2 - 2;
 	OMInfo.n_names = n_names;
 
-#if 0
-#if R_OBJECTMAP_DEBUG >= R_DEBUG_INFO
-	R_printf(R_STDOUT, "OBJECTMAP_LoadNames: Loading %d object names.\n", n_names);
-#endif
-#endif
+	debug(2, "OBJECTMAP_LoadNames: Loading %d object names.", n_names);
 	OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
 
 	if (OMInfo.names == NULL) {
-		R_printf(R_STDERR, "Error: Memory allocation failed.\n");
+		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
@@ -212,9 +204,7 @@
 		name_offset = readS->readUint16LE();
 		OMInfo.names[i] = (const char *)(onl_res + name_offset);
 
-#if R_OBJECTMAP_DEBUG >= R_DEBUG_VERBOSE
-		R_printf(R_STDOUT, "Loaded object name string: %s\n", OMInfo.names[i]);
-#endif
+		debug(3, "Loaded object name string: %s", OMInfo.names[i]);
 	}
 
 	OMInfo.names_loaded = 1;

Index: palanim.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/palanim.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- palanim.cpp	4 May 2004 03:33:03 -0000	1.7
+++ palanim.cpp	5 May 2004 13:05:30 -0000	1.8
@@ -56,11 +56,11 @@
 
 	PAnimData.entry_count = readS->readUint16LE();
 
-	R_printf(R_STDOUT, "PALANIM_Load(): Loading %d PALANIM entries.\n", PAnimData.entry_count);
+	debug(0, "PALANIM_Load(): Loading %d PALANIM entries.", PAnimData.entry_count);
 
 	test_p = calloc(PAnimData.entry_count, sizeof(PALANIM_ENTRY));
 	if (test_p == NULL) {
-		R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n");
+		warning("PALANIM_Load(): Allocation failure");
 		return R_MEM;
 	}
 
@@ -77,25 +77,21 @@
 		PAnimData.entries[i].pal_count = pal_count;
 		PAnimData.entries[i].color_count = color_count;
 
-#if 0
-		R_printf(R_STDOUT, "PALANIM_Load(): Entry %d: Loading %d palette indices.\n", i, pal_count);
-#endif
+		debug(2, "PALANIM_Load(): Entry %d: Loading %d palette indices.\n", i, pal_count);
 
 		test_p = calloc(1, sizeof(char) * pal_count);
 		if (test_p == NULL) {
-			R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n");
+			warning("PALANIM_Load(): Allocation failure");
 			return R_MEM;
 		}
 
 		PAnimData.entries[i].pal_index = (byte *)test_p;
 
-#if 0
-		R_printf(R_STDOUT, "PALANIM_Load(): Entry %d: Loading %d SAGA_COLOR structures.\n", i, color_count);
-#endif
+		debug(2, "PALANIM_Load(): Entry %d: Loading %d SAGA_COLOR structures.", i, color_count);
 
 		test_p = calloc(1, sizeof(R_COLOR) * color_count);
 		if (test_p == NULL) {
-			R_printf(R_STDERR, "PALANIM_Load(): Allocation failure.\n");
+			warning("PALANIM_Load(): Allocation failure");
 			return R_MEM;
 		}
 
@@ -191,17 +187,13 @@
 	}
 
 	for (i = 0; i < PAnimData.entry_count; i++) {
-#if 0
-		R_printf(R_STDOUT, "PALANIM_Free(): Entry %d: Freeing colors.\n", i);
-#endif
+		debug(2, "PALANIM_Free(): Entry %d: Freeing colors.", i);
 		free(PAnimData.entries[i].colors);
-#if 0
-		R_printf(R_STDOUT, "PALANIM_Free(): Entry %d: Freeing indices.\n", i);
-#endif
+		debug(2, "PALANIM_Free(): Entry %d: Freeing indices.", i);
 		free(PAnimData.entries[i].pal_index);
 	}
 
-	R_printf(R_STDOUT, "PALANIM_Free(): Freeing entries.\n");
+	debug(0, "PALANIM_Free(): Freeing entries.");
 
 	free(PAnimData.entries);
 

Index: reinherit.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/reinherit.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- reinherit.h	2 May 2004 00:06:34 -0000	1.18
+++ reinherit.h	5 May 2004 13:05:30 -0000	1.19
@@ -36,19 +36,8 @@
 
 #define R_MAXPATH 512
 
-// For debug message processing
-#define R_DEBUG_NONE 0
-#define R_DEBUG_INFO 1
-#define R_DEBUG_VERBOSE 2
-#define R_DEBUG_PARANOID 3
-
 #define R_MEMFAIL_MSG "Memory allocation error."
 
-#define R_STDOUT stdout
-#define R_STDERR stderr
-
-#define R_printf fprintf
-
 // Define opaque types
 
 // r_rscfile

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- saga.cpp	2 May 2004 00:00:39 -0000	1.19
+++ saga.cpp	5 May 2004 13:05:30 -0000	1.20
@@ -142,7 +142,7 @@
 	// FIXME
 	/*
 	if (CFG_Read(NULL) != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't read configuration file.\n");
+		warning("Couldn't read configuration file");
 	}
 	*/
 
@@ -150,7 +150,7 @@
 
 	// Detect game and open resource files
 	if (GAME_Init() != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't start the game: %s\n", GAME_GetErrS());
+		warning("Couldn't start the game: %s", GAME_GetErrS());
 		return;
 	}
 
@@ -168,7 +168,7 @@
 	ACTOR_Init();
 
 	if (SCENE_Init() != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't initialize scene module.\n");
+		warning("Couldn't initialize scene module");
 		return;
 	}
 
@@ -192,7 +192,7 @@
 	_music->hasNativeMT32(ConfMan.getBool("native_mt32"));
 
 	if (!MainData.music_enabled) {
-		R_printf(R_STDOUT, "Music disabled.\n");
+		debug(0, "Music disabled.");
 	}
 
 	// Initialize graphics
@@ -203,7 +203,7 @@
 	// Initialize system specific sound
 	_sound = new Sound(this, _mixer, MainData.sound_enabled);
 	if (!MainData.sound_enabled) {
-		R_printf(R_STDOUT, "Sound disabled.\n");
+		debug(0, "Sound disabled.");
 	}
 
 	SYSINPUT_Init();

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scene.cpp	4 May 2004 03:33:03 -0000	1.8
+++ scene.cpp	5 May 2004 13:05:30 -0000	1.9
@@ -71,7 +71,7 @@
 	// Load scene module resource context
 	result = GAME_GetFileContext(&SceneModule.scene_ctxt, R_GAME_RESOURCEFILE, 0);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't load scene resource context.\n");
+		warning("Couldn't load scene resource context");
 		return R_FAILURE;
 	}
 
@@ -82,10 +82,10 @@
 	}
 
 	// Load scene lookup table
-	R_printf(R_STDOUT, "SCENE_Init(): Loading scene LUT from resource %u.\n", gs_desc.scene_lut_rn);
+	debug(0, "SCENE_Init(): Loading scene LUT from resource %u.", gs_desc.scene_lut_rn);
 	result = RSC_LoadResource(SceneModule.scene_ctxt, gs_desc.scene_lut_rn, &scene_lut_p, &scene_lut_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error: couldn't load scene LUT.\n");
+		warning("Error: couldn't load scene LUT");
 		return R_FAILURE;
 	}
 
@@ -93,7 +93,7 @@
 	SceneModule.scene_max = SceneModule.scene_count - 1;
 	SceneModule.scene_lut = (int *)malloc(SceneModule.scene_max * sizeof *SceneModule.scene_lut);
 	if (SceneModule.scene_lut == NULL) {
-		R_printf(R_STDERR, "SCENE_Init(): Memory allocation failed.\n");
+		warning("SCENE_Init(): Memory allocation failed");
 		return R_MEM;
 	}
 
@@ -109,16 +109,15 @@
 		SceneModule.first_scene = gs_desc.first_scene;
 	}
 
-	R_printf(R_STDOUT,
-	    "SCENE_Init(): First scene set to %d.\n", SceneModule.first_scene);
+	debug(0, "SCENE_Init(): First scene set to %d.", SceneModule.first_scene);
 
-	R_printf(R_STDOUT, "SCENE_Init(): LUT has %d entries.\n", SceneModule.scene_max);
+	debug(0, "SCENE_Init(): LUT has %d entries.", SceneModule.scene_max);
 
 	// Create scene module text list
 	SceneModule.text_list = TEXT_CreateList();
 
 	if (SceneModule.text_list == NULL) {
-		R_printf(R_STDERR, "Error: Couldn't create scene text list.\n");
+		warning("Error: Couldn't create scene text list");
 		return R_FAILURE;
 	}
 
@@ -160,12 +159,12 @@
 	assert(SceneModule.init);
 
 	if (SceneModule.scene_loaded) {
-		R_printf(R_STDERR, "Error: Can't start game...scene already loaded!\n");
+		warning("Error: Can't start game...scene already loaded");
 		return R_FAILURE;
 	}
 
 	if (SceneModule.in_game) {
-		R_printf(R_STDERR, "Error: Can't start game...game already started!\n");
+		warning("Error: Can't start game...game already started");
 		return R_FAILURE;
 	}
 
@@ -177,7 +176,7 @@
 		IHNM_StartProc();
 		break;
 	default:
-		R_printf(R_STDERR, "Error: Can't start game... gametype not supported.\n");
+		warning("Error: Can't start game... gametype not supported");
 		break;
 	}
 
@@ -202,12 +201,12 @@
 	assert(SceneModule.init);
 
 	if (!SceneModule.scene_loaded) {
-		R_printf(R_STDERR, "Error: Can't advance scene...no scene loaded!\n");
+		warning("Error: Can't advance scene...no scene loaded");
 		return R_FAILURE;
 	}
 
 	if (SceneModule.in_game) {
-		R_printf(R_STDERR, "Error: Can't advance scene...game already started!\n");
+		warning("Error: Can't advance scene...game already started");
 		return R_FAILURE;
 	}
 
@@ -246,19 +245,19 @@
 	assert(SceneModule.init);
 
 	if (!SceneModule.scene_loaded) {
-		R_printf(R_STDERR, "Error: Can't skip scene...no scene loaded.\n");
+		warning("Error: Can't skip scene...no scene loaded");
 		return R_FAILURE;
 	}
 
 	if (SceneModule.in_game) {
-		R_printf(R_STDERR, "Error: Can't skip scene...game already started.\n");
+		warning("Error: Can't skip scene...game already started");
 		return R_FAILURE;
 	}
 
 	// Walk down scene queue and try to find a skip target
 	node = ys_dll_head(SceneModule.scene_queue);
 	if (node == NULL) {
-		R_printf(R_STDERR, "Error: Can't skip scene...no scenes in queue.\n");
+		warning("Error: Can't skip scene...no scenes in queue");
 		return R_FAILURE;
 	}
 
@@ -291,17 +290,17 @@
 	assert(SceneModule.init);
 
 	if (!SceneModule.scene_loaded) {
-		R_printf(R_STDERR, "Error: Can't change scene. No scene currently loaded. Game in invalid state.\n");
+		warning("Error: Can't change scene. No scene currently loaded. Game in invalid state");
 		return R_FAILURE;
 	}
 
 	if ((scene_num < 0) || (scene_num > SceneModule.scene_max)) {
-		R_printf(R_STDERR, "Error: Can't change scene. Invalid scene number.\n");
+		warning("Error: Can't change scene. Invalid scene number");
 		return R_FAILURE;
 	}
 
 	if (SceneModule.scene_lut[scene_num] == 0) {
-		R_printf(R_STDERR, "Error: Can't change scene; invalid scene descriptor resource number (0)\n");
+		warning("Error: Can't change scene; invalid scene descriptor resource number (0)");
 		return R_FAILURE;
 	}
 
@@ -402,7 +401,7 @@
 	assert(SceneModule.init);
 
 	if (SceneModule.scene_loaded == 1) {
-		R_printf(R_STDERR, "Error, a scene is already loaded.\n");
+		warning("Error, a scene is already loaded");
 		return R_FAILURE;
 	}
 
@@ -428,7 +427,7 @@
 		SceneModule.reslist_entries = scene_desc_param->res_list_ct;
 		break;
 	default:
-		R_printf(R_STDERR, "Error: Invalid scene load flag.\n");
+		warning("Error: Invalid scene load flag");
 		return R_FAILURE;
 		break;
 	}
@@ -438,19 +437,19 @@
 
 		SceneModule.scene_rn = res_number;
 		assert(SceneModule.scene_rn != 0);
-		R_printf(R_STDOUT, "Loading scene resource %u:\n", res_number);
+		debug(0, "Loading scene resource %u:", res_number);
 
 		if (LoadSceneDescriptor(res_number) != R_SUCCESS) {
-			R_printf(R_STDERR, "Error reading scene descriptor.\n");
+			warning("Error reading scene descriptor");
 			return R_FAILURE;
 		}
 
 		if (LoadSceneResourceList(SceneModule.desc.res_list_rn) != R_SUCCESS) {
-			R_printf(R_STDERR, "Error reading scene resource list.\n");
+			warning("Error reading scene resource list");
 			return R_FAILURE;
 		}
 	} else {
-		R_printf(R_STDOUT, "Loading memory scene resource.\n");
+		debug(0, "Loading memory scene resource.");
 	}
 
 	// Load resources from scene resource list
@@ -458,21 +457,21 @@
 		result = RSC_LoadResource(SceneModule.scene_ctxt, SceneModule.reslist[i].res_number,
 								&SceneModule.reslist[i].res_data, &SceneModule.reslist[i].res_data_len);
 		if (result != R_SUCCESS) {
-			R_printf(R_STDERR, "Error: Allocation failure loading scene resource list.\n");
+			warning("Error: Allocation failure loading scene resource list");
 			return R_FAILURE;
 		}
 	}
 
 	// Process resources from scene resource list
 	if (ProcessSceneResources() != R_SUCCESS) {
-		R_printf(R_STDERR, "Error loading scene resources.\n");
+		warning("Error loading scene resources");
 		return R_FAILURE;
 	}
 
 	// Load scene script data
 	if (SceneModule.desc.script_num > 0) {
 		if (SCRIPT_Load(SceneModule.desc.script_num) != R_SUCCESS) {
-			R_printf(R_STDERR, "Error loading scene script.\n");
+			warning("Error loading scene script");
 			return R_FAILURE;
 		}
 	}
@@ -499,12 +498,12 @@
 
 	result = RSC_LoadResource(SceneModule.scene_ctxt, res_number, &scene_desc_data, &scene_desc_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error: couldn't load scene descriptor.\n");
+		warning("Error: couldn't load scene descriptor");
 		return R_FAILURE;
 	}
 
 	if (scene_desc_len != SAGA_SCENE_DESC_LEN) {
-		R_printf(R_STDERR, "Error: scene descriptor length invalid.\n");
+		warning("Error: scene descriptor length invalid");
 		return R_FAILURE;
 	}
 
@@ -533,7 +532,7 @@
 	// Load the scene resource table
 	result = RSC_LoadResource(SceneModule.scene_ctxt, reslist_rn, &resource_list, &resource_list_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error: couldn't load scene resource list.\n");
+		warning("Error: couldn't load scene resource list");
 		return R_FAILURE;
 	}
 
@@ -541,17 +540,17 @@
 
 	// Allocate memory for scene resource list 
 	SceneModule.reslist_entries = resource_list_len / SAGA_RESLIST_ENTRY_LEN;
-	R_printf(R_STDOUT, "Scene resource list contains %d entries.\n", SceneModule.reslist_entries);
+	debug(0, "Scene resource list contains %d entries.", SceneModule.reslist_entries);
 	SceneModule.reslist = (R_SCENE_RESLIST *)calloc(SceneModule.reslist_entries, sizeof *SceneModule.reslist);
 
 	if (SceneModule.reslist == NULL) {
-		R_printf(R_STDERR, "Error: Memory allocation failed.\n");
+		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
 	// Load scene resource list from raw scene 
 	// resource table
-	R_printf(R_STDOUT, "Loading scene resource list...\n");
+	debug(0, "Loading scene resource list...");
 
 	for (i = 0; i < SceneModule.reslist_entries; i++) {
 		SceneModule.reslist[i].res_number = readS->readUint16LE();
@@ -576,11 +575,11 @@
 		switch (SceneModule.reslist[i].res_type) {
 		case SAGA_BG_IMAGE: // Scene background resource
 			if (SceneModule.bg.loaded) {
-				R_printf(R_STDERR, "Error: Multiple background resources encountered.\n");
+				warning("Error: Multiple background resources encountered");
 				return R_FAILURE;
 			}
 
-			R_printf(R_STDOUT, "Loading background resource.\n");
+			debug(0, "Loading background resource.");
 			SceneModule.bg.res_buf = SceneModule.reslist[i].res_data;
 			SceneModule.bg.res_len = SceneModule.reslist[i].res_data_len;
 			SceneModule.bg.loaded = 1;
@@ -591,7 +590,7 @@
 				&SceneModule.bg.buf_len,
 				&SceneModule.bg.w,
 				&SceneModule.bg.h) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading background resource: %u\n", SceneModule.reslist[i].res_number);
+				warning("Error loading background resource: %u", SceneModule.reslist[i].res_number);
 				return R_FAILURE;
 			}
 
@@ -601,9 +600,9 @@
 			break;
 		case SAGA_BG_MASK: // Scene background mask resource
 			if (SceneModule.bg_mask.loaded) {
-				R_printf(R_STDERR, "Error: Duplicate background mask resource encountered.\n");
+				warning("Error: Duplicate background mask resource encountered");
 			}
-			R_printf(R_STDOUT, "Loading BACKGROUND MASK resource.\n");
+			debug(0, "Loading BACKGROUND MASK resource.");
 			SceneModule.bg_mask.res_buf = SceneModule.reslist[i].res_data;
 			SceneModule.bg_mask.res_len = SceneModule.reslist[i].res_data_len;
 			SceneModule.bg_mask.loaded = 1;
@@ -611,34 +610,34 @@
 							&SceneModule.bg_mask.buf_len, &SceneModule.bg_mask.w, &SceneModule.bg_mask.h);
 			break;
 		case SAGA_OBJECT_NAME_LIST:
-			R_printf(R_STDOUT, "Loading object name list resource...\n");
+			debug(0, "Loading object name list resource...");
 			OBJECTMAP_LoadNames(SceneModule.reslist[i].res_data, SceneModule.reslist[i].res_data_len);
 			break;
 		case SAGA_OBJECT_MAP:
-			R_printf(R_STDOUT, "Loading object map resource...\n");
+			debug(0, "Loading object map resource...");
 			if (OBJECTMAP_Load(res_data,
 				res_data_len) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading object map resource.\n");
+				warning("Error loading object map resource");
 				return R_FAILURE;
 			}
 			break;
 		case SAGA_ACTION_MAP:
-			R_printf(R_STDOUT, "Loading exit map resource...\n");
+			debug(0, "Loading exit map resource...");
 			if (ACTIONMAP_Load(res_data, res_data_len) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading exit map resource.\n");
+				warning("Error loading exit map resource");
 				return R_FAILURE;
 			}
 			break;
 		case SAGA_ISO_TILESET:
 			if (SceneModule.scene_mode == R_SCENE_MODE_NORMAL) {
-				R_printf(R_STDERR, "Isometric tileset incompatible with normal scene mode.\n");
+				warning("Isometric tileset incompatible with normal scene mode");
 				return R_FAILURE;
 			}
 
-			R_printf(R_STDOUT, "Loading isometric tileset resource.\n");
+			debug(0, "Loading isometric tileset resource.");
 
 			if (ISOMAP_LoadTileset(res_data, res_data_len) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading isometric tileset resource.\n");
+				warning("Error loading isometric tileset resource");
 				return R_FAILURE;
 			}
 
@@ -646,14 +645,14 @@
 			break;
 		case SAGA_ISO_METAMAP:
 			if (SceneModule.scene_mode == R_SCENE_MODE_NORMAL) {
-				R_printf(R_STDERR, "Isometric metamap incompatible with normal scene mode.\n");
+				warning("Isometric metamap incompatible with normal scene mode");
 				return R_FAILURE;
 			}
 
-			R_printf(R_STDOUT, "Loading isometric metamap resource.\n");
+			debug(0, "Loading isometric metamap resource.");
 
 			if (ISOMAP_LoadMetamap(res_data, res_data_len) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading isometric metamap resource.\n");
+				warning("Error loading isometric metamap resource");
 				return R_FAILURE;
 			}
 
@@ -661,14 +660,14 @@
 			break;
 		case SAGA_ISO_METATILESET:
 			if (SceneModule.scene_mode == R_SCENE_MODE_NORMAL) {
-				R_printf(R_STDERR, "Isometric metatileset incompatible with normal scene mode.\n");
+				warning("Isometric metatileset incompatible with normal scene mode");
 				return R_FAILURE;
 			}
 
-			R_printf(R_STDOUT, "Loading isometric metatileset resource.\n");
+			debug(0, "Loading isometric metatileset resource.");
 
 			if (ISOMAP_LoadMetaTileset(res_data, res_data_len) != R_SUCCESS) {
-				R_printf(R_STDERR, "Error loading isometric tileset resource.\n");
+				warning("Error loading isometric tileset resource");
 				return R_FAILURE;
 			}
 
@@ -685,11 +684,11 @@
 				SCENE_ANIMINFO *new_animinfo;
 				uint16 new_anim_id;
 
-				R_printf(R_STDOUT, "Loading animation resource...\n");
+				debug(0, "Loading animation resource...");
 
 				new_animinfo = (SCENE_ANIMINFO *)malloc(sizeof *new_animinfo);
 				if (new_animinfo == NULL) {
-					R_printf(R_STDERR, "Memory allocation error.\n");
+					warning("Memory allocation error");
 					return R_MEM;
 				}
 
@@ -697,7 +696,7 @@
 					SceneModule.reslist[i].res_data_len,
 					&new_anim_id) == R_SUCCESS) {
 				} else {
-					R_printf(R_STDERR, "Error loading animation resource\n");
+					warning("Error loading animation resource");
 					return R_FAILURE;
 				}
 
@@ -708,11 +707,11 @@
 			}
 			break;
 		case SAGA_PAL_ANIM:
-			R_printf(R_STDOUT, "Loading palette animation resource.\n");
+			debug(0, "Loading palette animation resource.");
 			PALANIM_Load(SceneModule.reslist[i].res_data, SceneModule.reslist[i].res_data_len);
 			break;
 		default:
-			R_printf(R_STDERR, "Encountered unknown resource type: %d\n", SceneModule.reslist[i].res_type);
+			warning("Encountered unknown resource type: %d", SceneModule.reslist[i].res_type);
 			break;
 		}
 	}
@@ -757,11 +756,11 @@
 	assert(SceneModule.init);
 
 	if (SceneModule.scene_loaded != 1) {
-		R_printf(R_STDERR, "SCENE_End(): No scene to end.\n");
+		warning("SCENE_End(): No scene to end");
 		return -1;
 	}
 
-	R_printf(R_STDOUT, "SCENE_End(): Ending scene...\n");
+	debug(0, "SCENE_End(): Ending scene...");
 
 	SCENE_GetInfo(&scene_info);
 

Index: sceneproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sceneproc.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sceneproc.cpp	2 May 2004 00:00:39 -0000	1.6
+++ sceneproc.cpp	5 May 2004 13:05:44 -0000	1.7
@@ -109,7 +109,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 
@@ -151,7 +151,7 @@
 	case SCENE_END:
 		break;
 	default:
-		R_printf(R_STDERR, "Illegal scene procedure parameter.\n");
+		warning("Illegal scene procedure parameter");
 		break;
 	}
 

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- script.cpp	4 May 2004 03:33:03 -0000	1.6
+++ script.cpp	5 May 2004 13:05:44 -0000	1.7
@@ -60,24 +60,24 @@
 	int result;
 	int i, j;
 
-	R_printf(R_STDOUT, "Initializing scripting subsystem.\n");
+	debug(0, "Initializing scripting subsystem.");
 	// Load script resource file context
 	result = GAME_GetFileContext(&ScriptModule.script_ctxt, R_GAME_SCRIPTFILE, 0);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't get script file context.\n");
+		warning("Couldn't get script file context");
 		return R_FAILURE;
 	}
 
 	// Load script LUT resource
 	result = GAME_GetFileContext(&s_lut_ctxt, R_GAME_RESOURCEFILE, 0);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Couldn't get resource file context.\n");
+		warning("Couldn't get resource file context");
 		return R_FAILURE;
 	}
 
 	result = RSC_LoadResource(s_lut_ctxt, ITE_SCRIPT_LUT, &rsc_ptr, &rsc_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error: Couldn't load script resource look-up table.\n");
+		warning("Error: Couldn't load script resource look-up table");
 		return R_FAILURE;
 	}
 
@@ -87,7 +87,7 @@
 	} else if (rsc_len % R_S_LUT_ENTRYLEN_ITEDISK == 0) {
 		ScriptModule.script_lut_entrylen = R_S_LUT_ENTRYLEN_ITEDISK;
 	} else {
-		R_printf(R_STDERR, "Error: Invalid script lookup table length.\n");
+		warning("Error: Invalid script lookup table length");
 		return R_FAILURE;
 	}
 
@@ -97,7 +97,7 @@
 	// Allocate space for logical LUT
 	ScriptModule.script_lut = (R_SCRIPT_LUT_ENTRY *)malloc(ScriptModule.script_lut_max * sizeof(R_SCRIPT_LUT_ENTRY));
 	if (ScriptModule.script_lut == NULL) {
-		R_printf(R_STDERR, "Error: Couldn't allocate memory for script resource look-up table.\n");
+		warning("Error: Couldn't allocate memory for script resource look-up table");
 		return R_MEM;
 	}
 
@@ -144,7 +144,7 @@
 		return R_FAILURE;
 	}
 
-	R_printf(R_STDOUT, "Shutting down scripting subsystem.\n");
+	debug(0, "Shutting down scripting subsystem.");
 
 	// Free script lookup table
 	free(ScriptModule.script_lut);
@@ -182,7 +182,7 @@
 
 	// Validate script number
 	if ((script_num < 0) || (script_num > ScriptModule.script_lut_max)) {
-		R_printf(R_STDERR, "SCRIPT_Load(): Invalid script number!\n");
+		warning("SCRIPT_Load(): Invalid script number");
 		return R_FAILURE;
 	}
 
@@ -190,11 +190,11 @@
 	SCRIPT_Free();
 
 	// Initialize script data structure
-	R_printf(R_STDOUT, "Loading script data for script #%d.\n", script_num);
+	debug(0, "Loading script data for script #%d", script_num);
 
 	script_data = (R_SCRIPTDATA *)malloc(sizeof *script_data);
 	if (script_data == NULL) {
-		R_printf(R_STDERR, "Memory allocation failed.\n");
+		warning("Memory allocation failed");
 		return R_MEM;
 	}
 
@@ -210,7 +210,7 @@
 
 	result = RSC_LoadResource(ScriptModule.script_ctxt, scriptl_rn, &bytecode_p, &bytecode_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error loading script bytecode resource.\n");
+		warning("Error loading script bytecode resource");
 		free(script_data);
 		return R_FAILURE;
 	}
@@ -218,7 +218,7 @@
 	script_data->bytecode = SCRIPT_LoadBytecode(bytecode_p, bytecode_len);
 
 	if (script_data->bytecode == NULL) {
-		R_printf(R_STDERR, "Error interpreting script bytecode resource.\n");
+		warning("Error interpreting script bytecode resource");
 		free(script_data);
 		RSC_FreeResource(bytecode_p);
 		return R_FAILURE;
@@ -230,7 +230,7 @@
 	// Load dialogue list resource
 	result = RSC_LoadResource(ScriptModule.script_ctxt, diagl_rn, &diagl_p, &diagl_len);
 	if (result != R_SUCCESS) {
-		R_printf(R_STDERR, "Error loading dialogue list resource.\n");
+		warning("Error loading dialogue list resource");
 		free(script_data);
 		RSC_FreeResource(bytecode_p);
 		return R_FAILURE;
@@ -239,7 +239,7 @@
 	// Convert dialogue list resource to logical dialogue list
 	script_data->diag = SCRIPT_LoadDialogue(diagl_p, diagl_len);
 	if (script_data->diag == NULL) {
-		R_printf(R_STDERR, "Error interpreting dialogue list resource.\n");
+		warning("Error interpreting dialogue list resource");
 		free(script_data);
 		RSC_FreeResource(bytecode_p);
 		RSC_FreeResource(diagl_p);
@@ -253,7 +253,7 @@
 		// Load voice LUT resource
 		result = RSC_LoadResource(ScriptModule.script_ctxt, voicelut_rn, &voicelut_p, &voicelut_len);
 		if (result != R_SUCCESS) {
-			R_printf(R_STDERR, "Error loading voice LUT resource.\n");
+			warning("Error loading voice LUT resource");
 			free(script_data);
 			RSC_FreeResource(bytecode_p);
 			RSC_FreeResource(diagl_p);
@@ -263,7 +263,7 @@
 		// Convert voice LUT resource to logical voice LUT
 		script_data->voice = SCRIPT_LoadVoiceLUT(voicelut_p, voicelut_len, script_data);
 		if (script_data->voice == NULL) {
-			R_printf(R_STDERR, "Error interpreting voice LUT resource.\n");
+			warning("Error interpreting voice LUT resource");
 			free(script_data);
 			RSC_FreeResource(bytecode_p);
 			RSC_FreeResource(diagl_p);
@@ -289,7 +289,7 @@
 		return R_FAILURE;
 	}
 
-	R_printf(R_STDOUT, "Releasing script data.\n");
+	debug(0, "Releasing script data.");
 
 	// Finish initialization
 	if (ScriptModule.current_script->diag != NULL) {
@@ -327,7 +327,7 @@
 	size_t ep_tbl_offset; // Offset of bytecode entrypoint table
 	unsigned long i;
 
-	R_printf(R_STDOUT, "Loading script bytecode...\n");
+	debug(0, "Loading script bytecode...");
 
 	MemoryReadStream *readS = new MemoryReadStream(bytecode_p, bytecode_len);
 
@@ -338,12 +338,12 @@
 
 	// Check that the entrypoint table offset is valid.
 	if ((bytecode_len - ep_tbl_offset) < (n_entrypoints * R_SCRIPT_TBLENTRY_LEN)) {
-		R_printf(R_STDERR, "Invalid table offset.\n");
+		warning("Invalid table offset");
 		return NULL;
 	}
 
 	if (n_entrypoints > R_SCRIPT_MAX) {
-		R_printf(R_STDERR, "Script limit exceeded.\n");
+		warning("Script limit exceeded");
 		return NULL;
 	}
 
@@ -352,13 +352,13 @@
 
 	bc_new_data = (R_SCRIPT_BYTECODE *)malloc(sizeof *bc_new_data);
 	if (bc_new_data == NULL) {
-		R_printf(R_STDERR, "Memory allocation failure loading script bytecode.\n");
+		warning("Memory allocation failure loading script bytecode");
 		return NULL;
 	}
 
 	bc_ep_tbl = (R_PROC_TBLENTRY *)malloc(n_entrypoints * sizeof *bc_ep_tbl);
 	if (bc_ep_tbl == NULL) {
-		R_printf(R_STDERR, "Memory allocation failure creating script entrypoint table.\n");
+		warning("Memory allocation failure creating script entrypoint table");
 		free(bc_new_data);
 		return NULL;
 	}
@@ -377,7 +377,7 @@
 
 		// Perform a simple range check on offset values
 		if ((bc_ep_tbl[i].name_offset > bytecode_len) || (bc_ep_tbl[i].offset > bytecode_len)) {
-			R_printf(R_STDERR, "Invalid offset encountered in script entrypoint table.\n");
+			warning("Invalid offset encountered in script entrypoint table");
 			free(bc_new_data);
 			free(bc_ep_tbl);
 			return NULL;
@@ -402,7 +402,7 @@
 	uint16 i;
 	size_t offset;
 
-	R_printf(R_STDOUT, "Loading dialogue list...\n");
+	debug(0, "Loading dialogue list...");
 
 	// Allocate dialogue list structure
 	dialogue_list = (R_DIALOGUE_LIST *)malloc(sizeof *dialogue_list);
@@ -415,7 +415,7 @@
 	// First uint16 is the offset of the first string
 	offset = readS->readUint16LE();
 	if (offset > dialogue_len) {
-		R_printf(R_STDERR, "Error, invalid string offset.\n");
+		warning("Error, invalid string offset");
 		return NULL;
 	}
 
@@ -443,7 +443,7 @@
 	for (i = 0; i < n_dialogue; i++) {
 		offset = readS->readUint16LE();
 		if (offset > dialogue_len) {
-			R_printf(R_STDERR, "Error, invalid string offset.\n");
+			warning("Error, invalid string offset");
 			free(dialogue_list->str);
 			free(dialogue_list->str_off);
 			free(dialogue_list);
@@ -471,7 +471,7 @@
 
 	n_voices = voicelut_len / 2;
 	if (n_voices != script->diag->n_dialogue) {
-		R_printf(R_STDERR, "Error: Voice LUT entries do not match dialogue entries.\n");
+		warning("Error: Voice LUT entries do not match dialogue entries");
 		return NULL;
 	}
 

Index: sdata.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sdata.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sdata.cpp	1 May 2004 19:41:47 -0000	1.4
+++ sdata.cpp	5 May 2004 13:05:44 -0000	1.5
@@ -38,11 +38,11 @@
 	unsigned int i;
 	void *alloc_ptr;
 
-	R_printf(R_STDOUT, "Initializing script data buffers.\n");
+	debug(0, "Initializing script data buffers.");
 	for (i = 0; i < R_SCRIPT_DATABUF_NUM; i++) {
 		alloc_ptr = malloc(sizeof *ScriptModule.data_buf[0]);
 		if (alloc_ptr == NULL) {
-			R_printf(R_STDERR, "Error allocating memory for script data buffer %d.\n", i);
+			warning("Error allocating memory for script data buffer %d", i);
 			return R_MEM;
 		}
 
@@ -50,7 +50,7 @@
 		alloc_ptr = calloc(R_SCRIPT_DATABUF_LEN, sizeof(SDataWord_T));
 
 		if (alloc_ptr == NULL) {
-			R_printf(R_STDERR,  "Error allocating memory for script data buffer %d.\n", i);
+			warning("Error allocating memory for script data buffer %d", i);
 			return R_MEM;
 		}
 

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sprite.cpp	4 May 2004 03:33:03 -0000	1.7
+++ sprite.cpp	5 May 2004 13:05:44 -0000	1.8
@@ -47,7 +47,7 @@
 		return R_FAILURE;
 	}
 
-	R_printf(R_STDOUT, "Initializing sprite subsystem...\n");
+	debug(0, "Initializing sprite subsystem...");
 
 	// Load sprite module resource context
 	result = GAME_GetFileContext(&SpriteModule.sprite_ctxt, R_GAME_RESOURCEFILE, 0);
@@ -72,7 +72,7 @@
 		return R_FAILURE;
 	}
 
-	R_printf(R_STDOUT, "Shutting down sprite subsystem...\n");
+	debug(0, "Shutting down sprite subsystem...");
 
 	free(SpriteModule.decode_buf);
 
@@ -305,7 +305,7 @@
 	}
 
 	if (sprite_num >= sprite_list->sprite_count) {
-		R_printf(R_STDOUT, "Invalid sprite number (%d) for sprite list %d.\n", sprite_num, sprite_list->slist_rn);
+		warning("Invalid sprite number (%d) for sprite list %d", sprite_num, sprite_list->slist_rn);
 		return R_FAILURE;
 	}
 

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sthread.cpp	4 May 2004 03:33:03 -0000	1.6
+++ sthread.cpp	5 May 2004 13:05:45 -0000	1.7
@@ -220,9 +220,7 @@
 		}
 
 		saved_offset = thread->i_offset;
-#if 0
-		R_printf(R_STDOUT, "Executing thread offset: %lu", thread->i_offset);
-#endif
+		debug(2, "Executing thread offset: %lu", thread->i_offset);
 		MemoryReadStream *readS = new MemoryReadStream(GetReadPtr(thread), GetReadLen(thread));
 
 		in_char = readS->readByte();





More information about the Scummvm-git-logs mailing list