[Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.18,1.19 build_display.cpp,1.24,1.25 console.cpp,1.10,1.11 console.h,1.4,1.5 debug.cpp,1.9,1.10 debug.h,1.4,1.5 events.cpp,1.5,1.6 function.cpp,1.15,1.16 icons.cpp,1.8,1.9 interpreter.cpp,1.13,1.14 interpreter.h,1.7,1.8 layers.cpp,1.7,1.8 logic.cpp,1.14,1.15 maketext.cpp,1.13,1.14 mem_view.cpp,1.9,1.10 memory.cpp,1.7,1.8 mouse.cpp,1.17,1.18 protocol.cpp,1.10,1.11 resman.cpp,1.43,1.44 router.cpp,1.15,1.16 save_rest.cpp,1.18,1.19 scroll.cpp,1.4,1.5 sound.cpp,1.17,1.18 speech.cpp,1.22,1.23 startup.cpp,1.13,1.14 sword2.cpp,1.39,1.40 sync.cpp,1.5,1.6 tony_gsdk.cpp,1.9,1.10 walker.cpp,1.7,1.8

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sat Sep 27 04:37:01 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv15614

Modified Files:
	anims.cpp build_display.cpp console.cpp console.h debug.cpp 
	debug.h events.cpp function.cpp icons.cpp interpreter.cpp 
	interpreter.h layers.cpp logic.cpp maketext.cpp mem_view.cpp 
	memory.cpp mouse.cpp protocol.cpp resman.cpp router.cpp 
	save_rest.cpp scroll.cpp sound.cpp speech.cpp startup.cpp 
	sword2.cpp sync.cpp tony_gsdk.cpp walker.cpp 
Log Message:
More cleanup, and I've replaced most - not quite all - of BS2's debug
message functions with our own.

We still need to go through them and assign sensible debug levels to them.


Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/anims.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- anims.cpp	26 Sep 2003 10:07:17 -0000	1.18
+++ anims.cpp	27 Sep 2003 11:02:56 -0000	1.19
@@ -35,7 +35,6 @@
 #include "anims.h"
 #include "console.h"
 #include "controls.h"		// for 'speechSelected' & 'subtitles'
-#include "debug.h"
 #include "defs.h"
 #include "header.h"
 #include "interpreter.h"
@@ -156,7 +155,7 @@
 #ifdef _SWORD2_DEBUG
 		// check that we haven't been passed a zero resource number
 		if (res == 0)
-			Con_fatal_error("Animate: %s (id %d) passed zero anim resource (%s line %u)", FetchObjectName(ID), ID, __FILE__, __LINE__);
+			Con_fatal_error("Animate: %s (id %d) passed zero anim resource", FetchObjectName(ID), ID);
 #endif
 
 		// open anim file
@@ -166,7 +165,7 @@
 		// check this this resource is actually an animation file!
 		head = (_standardHeader *) anim_file;
 		if (head->fileType != ANIMATION_FILE)
-			Con_fatal_error("Animate: %s (%d) is not an anim! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
+			Con_fatal_error("Animate: %s (%d) is not an anim!", FetchObjectName(res), res);
 #endif
 
 		// point to anim header
@@ -175,7 +174,7 @@
 /* #ifdef _SWORD2_DEBUG
 		// check there's at least one frame
 		if (anim_head->noAnimFrames == 0)
- 			Con_fatal_error("Animate: %s (%d) has zero frame count! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
+ 			Con_fatal_error("Animate: %s (%d) has zero frame count!", FetchObjectName(res), res);
 #endif */
 
 		// now running an anim, looping back to this 'FN' call again
@@ -188,7 +187,7 @@
 			ob_graphic->anim_pc = 0;
  	} else if (Get_sync()) {
 		// We've received a sync - return to script immediately
-		// Zdebug("**sync stopped %d**", ID);
+		debug(5, "**sync stopped %d**", ID);
 
 		// If sync received, anim finishes right now (remaining on
 		// last frame). Quit animation, but continue script.
@@ -278,7 +277,7 @@
 #ifdef _SWORD2_DEBUG
 	// check that we haven't been passed a zero resource number
 	if (res == 0)
-		Con_fatal_error("FN_set_frame: %s (id %d) passed zero anim resource (%s line %u)", FetchObjectName(ID), ID, __FILE__, __LINE__);
+		Con_fatal_error("FN_set_frame: %s (id %d) passed zero anim resource", FetchObjectName(ID), ID);
 #endif
 
 	// open the resource (& check it's valid)
@@ -289,7 +288,7 @@
 	// check this this resource is actually an animation file!
 	head = (_standardHeader *) anim_file;
 	if (head->fileType != ANIMATION_FILE)
-		Con_fatal_error("FN_set_frame: %s (%d) is not an anim! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
+		Con_fatal_error("FN_set_frame: %s (%d) is not an anim!", FetchObjectName(res), res);
 #endif
 
 	// set up pointer to the animation header
@@ -298,7 +297,7 @@
 /* #ifdef _SWORD2_DEBUG
 	// check there's at least one frame
 	if (anim_head->noAnimFrames == 0)
-		Con_fatal_error("FN_set_frame: %s (%d) has zero frame count! (%s line %u)", FetchObjectName(res), res, __FILE__, __LINE__);
+		Con_fatal_error("FN_set_frame: %s (%d) has zero frame count!", FetchObjectName(res), res);
 #endif */
 
 	// set up anim resource in graphic object
@@ -495,7 +494,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (sequenceTextLines == MAX_SEQUENCE_TEXT_LINES)
-		Con_fatal_error("FN_add_sequence_text ran out of lines (%s line %u)",__FILE__,__LINE__);
+		Con_fatal_error("FN_add_sequence_text ran out of lines");
 #endif
 
 	sequence_text_list[sequenceTextLines].textNumber = params[0];
@@ -538,11 +537,8 @@
 		// now ok to close the text file
 		res_man.Res_close(text_res);
 
-#ifdef _SWORD2_DEBUG
-		// Write to walkthrough file (zebug0.txt)
 		// 1st word of text line is the official line number
-		Zdebug(0,"(%d) SEQUENCE TEXT: %s", *(uint16 *) text, text + 2);
-#endif
+		debug(5,"(%d) SEQUENCE TEXT: %s", *(uint16 *) text, text + 2);
 
 		// is it to be speech or subtitles or both?
 		// assume speech is not running until know otherwise
@@ -669,17 +665,15 @@
 #ifdef _SWORD2_DEBUG
 	header = (_standardHeader *) leadIn;
 	if (header->fileType != WAV_FILE)
-		Con_fatal_error("FN_smacker_lead_in() given invalid resource (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("FN_smacker_lead_in() given invalid resource");
 #endif
 
 	leadIn += sizeof(_standardHeader);
 	// wav data gets copied to sound memory
 	rv = g_sound->PlayFx(0, leadIn, 0, 0, RDSE_FXLEADIN);
 
-#ifdef _SWORD2_DEBUG
 	if (rv)
-		Zdebug("SFX ERROR: PlayFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
-#endif
+		debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
 
 	res_man.Res_close(params[0]);
 
@@ -716,22 +710,20 @@
 	// of computer games" - but at the very least we want to show the
 	// cutscene subtitles, so I removed them.
 
-	Zdebug("FN_play_sequence(\"%s\");", params[0]);
+	debug(5, "FN_play_sequence(\"%s\");", params[0]);
 
 #ifdef _SWORD2_DEBUG
 	// check that the name paseed from script is 8 chars or less
 	if (strlen((char *) params[0]) > 8)
-		Con_fatal_error("Sequence filename too long (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("Sequence filename too long");
 #endif
 
 	// add the appropriate file extension & play it
 
 	sprintf(filename, "%s.smk", (char *) params[0]);
 
-#ifdef _SWORD2_DEBUG
 	// Write to walkthrough file (zebug0.txt)
- 	Zdebug(0,"PLAYING SEQUENCE \"%s\"", filename);
-#endif
+ 	debug(5, "PLAYING SEQUENCE \"%s\"", filename);
 
 	// now create the text sprites, if any (James27may97)
 
@@ -746,7 +738,7 @@
 #ifdef _SWORD2_DEBUG
 		header = (_standardHeader *)leadOut;
 		if (header->fileType != WAV_FILE)
-			Con_fatal_error("FN_smacker_lead_out() given invalid resource (%s line %u)", __FILE__, __LINE__);
+			error("FN_smacker_lead_out() given invalid resource");
 #endif
 
 		leadOut += sizeof(_standardHeader);
@@ -775,11 +767,9 @@
 		smackerLeadOut = 0;
 	}
 
-#ifdef _SWORD2_DEBUG
 	// check the error return-value
 	if (rv)
-		Zdebug("PlaySmacker(\"%s\") returned 0x%.8x", filename, rv);
-#endif
+		debug(5, "PlaySmacker(\"%s\") returned 0x%.8x", filename, rv);
 
 	// now clear the text sprites, if any (James27may97)
 
@@ -798,7 +788,7 @@
 	memset(pal, 0, 256 * sizeof(_palEntry));
 	BS2_SetPalette(0, 256, (uint8 *) pal, RDPAL_INSTANT);
 
-  	Zdebug("FN_play_sequence FINISHED");
+	debug(5, "FN_play_sequence FINISHED");
 
 	// continue script
 	return IR_CONT;

Index: build_display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/build_display.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- build_display.cpp	26 Sep 2003 10:07:17 -0000	1.24
+++ build_display.cpp	27 Sep 2003 11:02:56 -0000	1.25
@@ -303,7 +303,7 @@
 
 		rv = DrawSprite(&spriteInfo);
 		if (rv)
-			ExitWithReport("Driver Error %.8x (drawing console) [%s line %u]", rv, __FILE__, __LINE__);
+			error("Driver Error %.8x (drawing console)", rv);
 
 		CopyScreenBuffer();
 	} else{
@@ -366,7 +366,7 @@
 
 	rv = DrawSprite(&spriteInfo);
 	if (rv)
-		ExitWithReport("Driver Error %.8x (in DisplayMsg) [%s line %u]", rv, __FILE__, __LINE__);
+		error("Driver Error %.8x (in DisplayMsg)", rv);
 
 	spriteInfo.x = oldX;
 	spriteInfo.y = oldY;
@@ -396,7 +396,7 @@
 
 		rv = DrawSprite(&spriteInfo);	// Keep the message there even when the user task swaps.
 		if (rv)
-			ExitWithReport("Driver Error %.8x (in DisplayMsg) [%s line %u]", rv, __FILE__, __LINE__);
+			error("Driver Error %.8x (in DisplayMsg)", rv);
 
 		// Drivers change the y co-ordinate, don't know why...
 		spriteInfo.y = oldY;
@@ -552,7 +552,7 @@
 
 	rv = DrawSprite(&spriteInfo);
 	if (rv)
-		ExitWithReport("Driver Error %.8x in Process_layer(%d) [%s line %u]", rv, layer_number, __FILE__, __LINE__);
+		error("Driver Error %.8x in Process_layer(%d)", rv, layer_number);
 
 	res_man.Res_close(this_screen.background_layer_id);
 }
@@ -633,7 +633,7 @@
 	spriteInfo.type = spriteType;
 	spriteInfo.blend = anim_head->blend;
 	// points to just after frame header, ie. start of sprite data
-	spriteInfo.data = (uint8*) (frame_head + 1);
+	spriteInfo.data = (uint8 *) (frame_head + 1);
 	spriteInfo.colourTable	= colTablePtr;
 
 #ifdef _SWORD2_DEBUG
@@ -680,13 +680,15 @@
 
 // #ifdef _SWORD2_DEBUG
 //	if (frame_head->width <= 1) {
-//		Zdebug(8,"WARNING: 1-pixel-wide frame found in %s (%d)", FetchObjectName(build_unit->anim_resource), build_unit->anim_resource);
+//		debug(5, "WARNING: 1-pixel-wide frame found in %s (%d)", FetchObjectName(build_unit->anim_resource), build_unit->anim_resource);
 //	}
 // #endif
 
 	rv = DrawSprite(&spriteInfo);
 	if (rv)
-		ExitWithReport("Driver Error %.8x with sprite %s (%d) in Process_image [%s line %u]", rv, FetchObjectName(build_unit->anim_resource), build_unit->anim_resource, __FILE__, __LINE__);
+		error("Driver Error %.8x with sprite %s (%d) in Process_image",
+			rv, FetchObjectName(build_unit->anim_resource),
+			build_unit->anim_resource);
 
 	// release the anim resource
 	res_man.Res_close(build_unit->anim_resource);
@@ -759,7 +761,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (ob_graph->anim_resource == 0)
-		Con_fatal_error("ERROR: %s(%d) has no anim resource in Register_frame [line=%d file=%s]", FetchObjectName(ID), ID, __LINE__, __FILE__);
+		Con_fatal_error("ERROR: %s(%d) has no anim resource in Register_frame", FetchObjectName(ID), ID);
 #endif
 
 	file = res_man.Res_open(ob_graph->anim_resource);
@@ -847,7 +849,7 @@
 		if (ob_mouse->pointer) {
 #ifdef _SWORD2_DEBUG
 			if (cur_mouse == TOTAL_mouse_list)
-				Con_fatal_error("ERROR: mouse_list full [%s line %u]",__FILE__,__LINE__);
+				Con_fatal_error("ERROR: mouse_list full");
 #endif
 
 			mouse_list[cur_mouse].x1 = build_unit->x;
@@ -897,7 +899,7 @@
 	case BGP0_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_bgp0 == MAX_bgp0_sprites)
-			Con_fatal_error("ERROR: bgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: bgp0_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &bgp0_list[cur_bgp0]);
@@ -906,7 +908,7 @@
 	case BGP1_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_bgp1 == MAX_bgp1_sprites)
-			Con_fatal_error("ERROR: bgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: bgp1_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &bgp1_list[cur_bgp1]);
@@ -915,7 +917,7 @@
 	case BACK_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_back == MAX_back_sprites)
-			Con_fatal_error("ERROR: back_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: back_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &back_list[cur_back]);
@@ -924,7 +926,7 @@
 	case SORT_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_sort == MAX_sort_sprites)
-			Con_fatal_error("ERROR: sort_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: sort_list full in FN_register_frame");
 #endif
 
 		sort_order[cur_sort] = cur_sort;
@@ -934,7 +936,7 @@
 	case FORE_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_fore == MAX_fore_sprites)
-			Con_fatal_error("ERROR: fore_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: fore_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &fore_list[cur_fore]);
@@ -943,7 +945,7 @@
 	case FGP0_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_fgp0 == MAX_fgp0_sprites)
-			Con_fatal_error("ERROR: fgp0_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: fgp0_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &fgp0_list[cur_fgp0]);
@@ -952,7 +954,7 @@
 	case FGP1_SPRITE:
 #ifdef _SWORD2_DEBUG
 		if (cur_fgp1 == MAX_fgp1_sprites)
-			Con_fatal_error("ERROR: fgp1_list full in FN_register_frame [line=%d file=%s]", __LINE__, __FILE__);
+			Con_fatal_error("ERROR: fgp1_list full in FN_register_frame");
 #endif
 
 		Register_frame(params, &fgp1_list[cur_fgp1]);
@@ -1011,7 +1013,7 @@
 
 	SCROLL_OFFSET_X = this_screen.scroll_offset_x;
 
-	// Zdebug(42,"%d %d", ob_mega->feet_x, ob_mega->feet_y);
+	debug(5, "FN_Update_player_stats: %d %d", ob_mega->feet_x, ob_mega->feet_y);
 
 	return IR_CONT;
 }
@@ -1103,7 +1105,7 @@
 
 #ifdef _SWORD2_DEBUG
 		if (head->fileType != PALETTE_FILE)
- 			Con_fatal_error("FN_set_palette() called with invalid resource! (%s line %u)",__FILE__,__LINE__);
+ 			Con_fatal_error("FN_set_palette() called with invalid resource!");
 #endif
 
 		file = (uint8*) (head + 1);
@@ -1144,7 +1146,7 @@
 			// close screen file
 	  		res_man.Res_close(this_screen.background_layer_id);
 		} else
-			Con_fatal_error("FN_set_palette(0) called, but no current screen available! (%s line %u)",__FILE__,__LINE__);
+			Con_fatal_error("FN_set_palette(0) called, but no current screen available!");
 	}
 }
 
@@ -1160,7 +1162,7 @@
 		rv = CloseLightMask();
 
 		if (rv)
-			ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
+			error("Driver Error %.8x [%s line %u]", rv);
 
 		this_screen.mask_flag = 0;
 	}

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/console.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- console.cpp	24 Sep 2003 06:40:20 -0000	1.10
+++ console.cpp	27 Sep 2003 11:02:56 -0000	1.11
@@ -20,14 +20,12 @@
 #include "stdafx.h"
 #include "driver/driver96.h"
 
-uint32	console_status=0;	//0 off		// LEFT IN RELEASE VERSION
-
+uint32	console_status = 0;	//0 off		// LEFT IN RELEASE VERSION
 
 #ifdef _SWORD2_DEBUG
 
-//-----------------------------------------------------------------------------------------------------------------------
-//its the console! <great>
[...1955 lines suppressed...]
-//------------------------------------------------------------------------------------
 
-#else // not debug
+#else
 
-void	Print_to_console(const char *format,...) {}
-void	Temp_print_to_console(const char *format,...) {}
-void	Clear_console_line(void) {}
-void	Scroll_console(void) {}
-void	Init_console(void) {}
-void	StartConsole(void) {}
+void Print_to_console(const char *format, ...) {}
+void Temp_print_to_console(const char *format, ...) {}
+void Clear_console_line(void) {}
+void Scroll_console(void) {}
+void Init_console(void) {}
+void StartConsole(void) {}
 
-#endif	// _SWORD2_DEBUG
+#endif

Index: console.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/console.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- console.h	30 Jul 2003 19:25:28 -0000	1.4
+++ console.h	27 Sep 2003 11:02:56 -0000	1.5
@@ -25,57 +25,41 @@
 
 #ifdef _SWORD2_DEBUG
 
-void	Init_console(void);	//Tony9Sept96
-uint32	One_console(void);	//Tony12Aug96
-void	StartConsole(void);	//Tony12Aug96
-void	EndConsole(void);	//Tony9Oct96
+void Init_console(void);
+uint32 One_console(void);
+void StartConsole(void);
+void EndConsole(void);
 
-void	Con_fatal_error(const char *format,...);
-void	Print_to_console(const char *format,...);	//Tony13Aug96
-void	Temp_print_to_console(const char *format,...);	//Tony13Aug96
-void	Scroll_console(void);	//Tony13Aug96
-void	Clear_console_line(void);	//Tony13Aug96
+void Con_fatal_error(const char *format, ...);
+void Print_to_console(const char *format, ...);
+void Temp_print_to_console(const char *format, ...);
+void Scroll_console(void);
+void Clear_console_line(void);
 
-extern	mem	*console_sprite;
-extern	uint32	con_y;
-extern	uint32	con_depth;
-extern	uint32	con_width;
+extern mem *console_sprite;
+extern uint32 con_y;
+extern uint32 con_depth;
+extern uint32 con_width;
 
 extern uint8 grabbingSequences;
 extern uint8 wantSfxDebug;	// sfx debug file enabled/disabled from console
 
+#else
 
-#else	// _SWORD2_DEBUG
-/*
-#define	Init_console	NULL
-#define	One_console		NULL
-#define	StartConsole	NULL
-#define	EndConsole		NULL
-*/
-
-void	Init_console(void);
-uint32	One_console(void);	
-void	StartConsole(void);
-void	EndConsole(void);
+void Init_console(void);
+uint32 One_console(void);	
+void StartConsole(void);
+void EndConsole(void);
 
-// 'Con_fatal_error' commands map to ExitWithReport
-// so we show errors in a window rather than our development game console
-#define Con_fatal_error		ExitWithReport
+#define Con_fatal_error		error
 
-//#define	Print_to_console		NULL
-//#define	Temp_print_to_console	NULL
-//#define	Clear_console_line		NULL
-//#define	Scroll_console			NULL
-void	Print_to_console(const char *format,...);
-void	Temp_print_to_console(const char *format,...);
-void	Clear_console_line(void);
-void	Scroll_console(void);
-//#define	Var_check			NULL
-//#define	Var_set				NULL
+void Print_to_console(const char *format, ...);
+void Temp_print_to_console(const char *format, ...);
+void Clear_console_line(void);
+void Scroll_console(void);
 
-#endif	// _SWORD2_DEBUG
+#endif
 
 extern	uint32	console_status;
-
 
 #endif

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/debug.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- debug.cpp	23 Sep 2003 16:38:37 -0000	1.9
+++ debug.cpp	27 Sep 2003 11:02:56 -0000	1.10
@@ -17,23 +17,22 @@
  * $Header$
  */
 
-//--------------------------------------------------------------------------------------
 #include <stdarg.h> // for ExitWithReport, which stays in RELEASE version
 #include <stdio.h>
 
 #include "stdafx.h"
 #include "driver/driver96.h"
 #include "debug.h"
-//--------------------------------------------------------------------------------------
 
-#ifdef _SWORD2_DEBUG  // this whole file (except ExitWithReport) only included on debug versions
+// this whole file (except ExitWithReport) only included on debug versions
+#ifdef _SWORD2_DEBUG
 
 #include <stdlib.h>
 
-#include "build_display.h"	// for 'fps' (frames-per-second counter)
+#include "build_display.h"		// for 'fps'
 #include "console.h"
 #include "defs.h"
-#include "events.h"	// for CountEvents()
+#include "events.h"			// for CountEvents()
 #include "layers.h"
 #include "logic.h"
 #include "maketext.h"
@@ -41,213 +40,107 @@
 #include "mouse.h"
 #include "protocol.h"
 #include "resman.h"
-#include "router.h"	// for PlotWalkGrid()
-#include "speech.h"	// for 'officialTextNumber' and 'speechScriptWaiting'
+#include "router.h"			// for PlotWalkGrid()
+#include "speech.h"			// for 'officialTextNumber' and
+					// 'speechScriptWaiting'
 
-//--------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------
-//--------------------------------------------------------------------------------------
-// global variables
-uint8 displayDebugText		= 0;	// "INFO"		0=off; 1=on
-uint8 displayWalkGrid		= 0;	// "WALKGRID"
-uint8 displayMouseMarker	= 0;	// "MOUSE"
-uint8 displayTime			= 0;	// "TIME"
-uint8 displayPlayerMarker	= 0;	// "PLAYER"
-uint8 displayTextNumbers	= 0;	// "TEXT"
-uint8 renderSkip			= 0;	// Toggled on 'S' key - to render only 1 in 4 frames, to speed up game
+uint8 displayDebugText = 0;		// "INFO"		0=off; 1=on
+uint8 displayWalkGrid = 0;		// "WALKGRID"
+uint8 displayMouseMarker = 0;		// "MOUSE"
+uint8 displayTime = 0;			// "TIME"
+uint8 displayPlayerMarker = 0;		// "PLAYER"
+uint8 displayTextNumbers = 0;		// "TEXT"
+uint8 renderSkip = 0;			// Toggled on 'S' key - to render only
+					// 1 in 4 frames, to speed up game
 
-uint8 definingRectangles	= 0;	// "RECT"
-uint8 draggingRectangle		= 0;	// 0=waiting to start new rect; 1=currently dragging a rectangle
-int16 rect_x1	= 0;
-int16 rect_y1	= 0;
-int16 rect_x2	= 0;
-int16 rect_y2	= 0;
-uint8 rectFlicker=0;
+uint8 definingRectangles = 0;		// "RECT"
+uint8 draggingRectangle	 = 0;		// 0=waiting to start new rect;
+					// 1=currently dragging a rectangle
+int16 rect_x1 = 0;
+int16 rect_y1 = 0;
+int16 rect_x2 = 0;
+int16 rect_y2 = 0;
+uint8 rectFlicker = 0;
 
-uint8 testingSnR = 0;				// "SAVEREST" - for system to kill all object resources (except player) in FN_add_human()
+uint8 testingSnR = 0;			// "SAVEREST" - for system to kill all
+					// object resources (except player) in
+					// FN_add_human()
 
-int32 startTime = 0;				// "TIMEON" & "TIMEOFF" - system start time.
-int32 gameCycle = 0;				// Counter for game clocks.
+int32 startTime = 0;			// "TIMEON" & "TIMEOFF" - system start
+					// time.
+int32 gameCycle = 0;			// Counter for game clocks.
 
-int32 textNumber = 0;				// current system text line number
+int32 textNumber = 0;			// Current system text line number
 
 int32 showVar[MAX_SHOWVARS];		// "SHOWVAR"
 
-Object_graphic playerGraphic;		// for displaying player object's current graphical info
-uint32 player_graphic_no_frames=0;	// no. of frames in currently displayed anim
+Object_graphic playerGraphic;		// For displaying player object's
+					// current graphical info
+uint32 player_graphic_no_frames = 0;	// No. of frames in currently displayed
+					// anim
 
 uint8 debug_text_blocks[MAX_DEBUG_TEXT_BLOCKS];
 
-//--------------------------------------------------------------------------------------
-// function prototypes
-
-void Clear_debug_text_blocks( void );
-void Make_debug_text_block( char *text, int16 x, int16 y );
-void Plot_cross_hair( int16 x, int16 y, uint8 pen );
-void DrawRect( int16 x, int16 y, int16 x2, int16 y2, uint8 pen );
-//--------------------------------------------------------------------------------------
-#endif	// _SWORD2_DEBUG
-
-// THIS FUNCTION STAYS IN THE RELEASE VERSION
-// IN FACT, CON_FATAL_ERROR IS MAPPED TO THIS AS WELL, SO WE HAVE A MORE PRESENTABLE ERROR REPORT
-void ExitWithReport(const char *format,...)	// (6dec96 JEL)
-{
-	//	Send a printf type string to Paul's windows routine
-	char buf[500];
-	va_list arg_ptr;	// Variable argument pointer
-
-	va_start(arg_ptr,format);
-
-
-	vsprintf(buf, format, arg_ptr);
-	Zdebug("%s",buf);		// send output to 'debug.txt' as well, just for the record
-
-	// wait for fade to finish before calling RestoreDisplay()
-	WaitForFade();
-
-	error(buf);
-}
-
-#ifdef _SWORD2_DEBUG	// all other functions only for _SWORD2_DEBUG version
-//--------------------------------------------------------------------------------------
-void Zdebug(const char *format,...)	//Tony's special debug logging file March96
-{
-//	Write a printf type string to a debug file
-
-	va_list		arg_ptr;			// Variable argument pointer
-	FILE *		debug_filep=0;			// Debug file pointer
-	static int	first_debug = 1;		// Flag for first time this is used
-
-	va_start(arg_ptr,format);
-
-	if (first_debug)					//First time round delete any previous debug file
-	{
-		unlink("debug.txt");
-		first_debug = 0;
-	}
-
-	debug_filep = fopen("debug.txt","a+t");
-
-	if (debug_filep != NULL)	// if it could be opened
-	{
-		vfprintf(debug_filep, format, arg_ptr);
-		fprintf(debug_filep,"\n");
-
-		fclose(debug_filep);
-	}
-}
-
-//--------------------------------------------------------------------------------------
-void Zdebug(uint32 stream, const char *format,...)	//Tony's special debug logging file March96
-{
-//	Write a printf type string to a debug file
-
-	va_list		arg_ptr;			// Variable argument pointer
-	FILE *		debug_filep=0;			// Debug file pointer
-	static int	first = 1;		// Flag for first time this is used
-	int	j;
-	static	int	first_debugs[100];
-
-
-
-	if	(first==1)	//first time run then reset the states
-	{	for	(j=0;j<100;j++)
-			first_debugs[j]=0;
-
-		first=0;
-	}
-
-
-
-
-	char	name[20];
-
-
-	sprintf(name, "debug%d.txt", stream);
-
-	va_start(arg_ptr,format);
-
-	if (!first_debugs[stream])					//First time round delete any previous debug file
-	{
-		unlink(name);
-		first_debugs[stream] = 1;
-	}
-
-	debug_filep = fopen(name,"a+t");
+void Clear_debug_text_blocks(void);
+void Make_debug_text_block(char *text, int16 x, int16 y);
+void Plot_cross_hair(int16 x, int16 y, uint8 pen);
+void DrawRect(int16 x, int16 y, int16 x2, int16 y2, uint8 pen);
 
-	if (debug_filep != NULL)	// if it could be opened
-	{
-		vfprintf(debug_filep, format, arg_ptr);
-		fprintf(debug_filep,"\n");
+void Clear_debug_text_blocks(void) {
+	uint8 blockNo = 0;
 
-		fclose(debug_filep);
-	}
-}
-//--------------------------------------------------------------------------------------
-void Clear_debug_text_blocks( void )	// JAMES
-{
-	uint8 blockNo=0;
+	while (blockNo < MAX_DEBUG_TEXT_BLOCKS && debug_text_blocks[blockNo] > 0) {
+		// kill the system text block
+		Kill_text_bloc(debug_text_blocks[blockNo]);
 
+		// clear this element of our array of block numbers
+		debug_text_blocks[blockNo] = 0;
 
-	while ((blockNo < MAX_DEBUG_TEXT_BLOCKS) && (debug_text_blocks[blockNo] > 0))
-	{
-		Kill_text_bloc(debug_text_blocks[blockNo]);	// kill the system text block
-		debug_text_blocks[blockNo] = 0;				// clear this element of our array of block numbers
 		blockNo++;
 	}
 }
-//--------------------------------------------------------------------------------------
-void Make_debug_text_block( char *text, int16 x, int16 y)	// JAMES
-{
-	uint8 blockNo=0;
 
+void Make_debug_text_block(char *text, int16 x, int16 y) {
+	uint8 blockNo = 0;
 
-	while ((blockNo < MAX_DEBUG_TEXT_BLOCKS) && (debug_text_blocks[blockNo] > 0))
+	while (blockNo < MAX_DEBUG_TEXT_BLOCKS && debug_text_blocks[blockNo] > 0)
 		blockNo++;
 
 	if (blockNo == MAX_DEBUG_TEXT_BLOCKS)
-		Con_fatal_error("ERROR: debug_text_blocks[] full in Make_debug_text_block() at line %d in file \"%s\"",__LINE__,__FILE__);
+		Con_fatal_error("ERROR: debug_text_blocks[] full in Make_debug_text_block()");
 
-	debug_text_blocks[blockNo] = Build_new_block( (uint8 *)text, x, y, 640-x, 0, RDSPR_DISPLAYALIGN, CONSOLE_FONT_ID, NO_JUSTIFICATION);
+	debug_text_blocks[blockNo] = Build_new_block((uint8 *) text, x, y, 640 - x, 0, RDSPR_DISPLAYALIGN, CONSOLE_FONT_ID, NO_JUSTIFICATION);
 }
 
-//--------------------------------------------------------------------------------------
-//
-//
-// PC Build_debug_info
-//
-//
-//--------------------------------------------------------------------------------------
-void Build_debug_text( void )	// JAMES
-{
+void Build_debug_text(void) {
 	char buf[128];
 
-	int32 showVarNo;	// for variable watching
+	int32 showVarNo;		// for variable watching
 	int32 showVarPos;
 	int32 varNo;
 	int32 *varTable;
 
+	// clear the array of text block numbers for the debug text
+	Clear_debug_text_blocks();
 
-	Clear_debug_text_blocks();	// clear the array of text block numbers for the debug text
-
-	//-------------------------------------------------------------------
 	// mouse coords
 /*
-	if (displayMouseMarker)	// print mouse coords beside mouse-marker, if it's being displayed
-	{
-		sprintf (buf, "%d,%d", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y);
+	// print mouse coords beside mouse-marker, if it's being displayed
+	if (displayMouseMarker) {
+		sprintf(buf, "%d,%d", mousex + this_screen.scroll_offset_x, mousey + this_screen.scroll_offset_y);
 		if (mousex>560)
-			Make_debug_text_block (buf, mousex-50, mousey-15);
+			Make_debug_text_block(buf, mousex - 50, mousey - 15);
 		else
-			Make_debug_text_block (buf, mousex+5, mousey-15);
+			Make_debug_text_block(buf, mousex + 5, mousey - 15);
 	}
 */
-	//-------------------------------------------------------------------
+
 	// mouse area coords
 
-	if (draggingRectangle || SYSTEM_TESTING_ANIMS)	// defining a mouse area the easy way, by creating a box on-screen
-	{
-		rectFlicker = 1-rectFlicker;	// so we can see what's behind the lines
+	// defining a mouse area the easy way, by creating a box on-screen
+	if (draggingRectangle || SYSTEM_TESTING_ANIMS) {
+		// so we can see what's behind the lines
+		rectFlicker = 1 - rectFlicker;
 
 		sprintf (buf, "x1=%d", rect_x1);
 		Make_debug_text_block (buf, 0, 120);
@@ -261,47 +154,41 @@
 		sprintf (buf, "y2=%d", rect_y2);
 		Make_debug_text_block (buf, 0, 165);
 	}
-	//-------------------------------------------------------------------
+
 	// testingSnR indicator
 
-	if (testingSnR)		// see FN_add_human()
-	{
+	if (testingSnR) {		// see FN_add_human()
 		sprintf (buf, "TESTING LOGIC STABILITY!");
 		Make_debug_text_block (buf, 0, 105);
 	}
-	//---------------------------------------------
+
 	// speed-up indicator
 
-	if (renderSkip)		// see sword.cpp
-	{
+	if (renderSkip) {		// see sword.cpp
 		sprintf (buf, "SKIPPING FRAMES FOR SPEED-UP!");
 		Make_debug_text_block (buf, 0, 120);
 	}
-	//---------------------------------------------
+
 	// debug info at top of screen - enabled/disabled as one complete unit
 
-	if (displayTime)
-	{
+	if (displayTime) {
 		int32 time = timeGetTime();
 
 		if ((time - startTime) / 1000 >= 10000)
 			startTime = time;
 
 		time -= startTime;
-		sprintf(buf, "Time %.2d:%.2d:%.2d.%.3d",(time / 3600000) % 60,(time / 60000) % 60, (time / 1000) % 60,time%1000);
+		sprintf(buf, "Time %.2d:%.2d:%.2d.%.3d", (time / 3600000) % 60, (time / 60000) % 60, (time / 1000) % 60, time % 1000);
 		Make_debug_text_block(buf, 500, 360);
 		sprintf(buf, "Game %d", gameCycle);
 		Make_debug_text_block(buf, 500, 380);
 	}
-	//---------------------------------------------
+
    	// current text number & speech-sample resource id
 
-	if (displayTextNumbers)
-	{
-		if (textNumber)
-		{
-			if (SYSTEM_TESTING_TEXT)
-			{
+	if (displayTextNumbers) {
+		if (textNumber) {
+			if (SYSTEM_TESTING_TEXT) {
 				if (SYSTEM_WANT_PREVIOUS_LINE)
 					sprintf (buf, "backwards");
 				else
@@ -318,133 +205,144 @@
 
  			sprintf (buf, "TEXT: %d", officialTextNumber);
 			Make_debug_text_block (buf, 0, 385);
-
 		}
 	}
-	//---------------------------------------------
+
 	// resource number currently being checking for animation
 
-	if (SYSTEM_TESTING_ANIMS)
-	{
+	if (SYSTEM_TESTING_ANIMS) {
 		sprintf (buf, "trying resource %d", SYSTEM_TESTING_ANIMS);
 		Make_debug_text_block (buf, 0, 90);
 	}
-	//---------------------------------------------
 
 	// general debug info
 
-	if (displayDebugText)
-	{
-		//---------------------------------------------
+	if (displayDebugText) {
 /*
 		// CD in use
 		sprintf (buf, "CD-%d", currentCD);
 		Make_debug_text_block (buf, 0, 0);
 */
-		//---------------------------------------------
+
 		// mouse coords & object pointed to
 
 		if (CLICKED_ID)
-			sprintf (buf, "last click at %d,%d (id %d: %s)", MOUSE_X, MOUSE_Y, CLICKED_ID, FetchObjectName(CLICKED_ID));
+			sprintf(buf, "last click at %d,%d (id %d: %s)",
+				MOUSE_X, MOUSE_Y, CLICKED_ID,
+				FetchObjectName(CLICKED_ID));
 		else
-			sprintf (buf, "last click at %d,%d (---)", MOUSE_X, MOUSE_Y);
+			sprintf(buf, "last click at %d,%d (---)",
+				MOUSE_X, MOUSE_Y);
 
  		Make_debug_text_block (buf, 0, 15);
 
 		if (mouse_touching)
-			sprintf (buf, "mouse %d,%d (id %d: %s)", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y, mouse_touching, FetchObjectName(mouse_touching));
+			sprintf(buf, "mouse %d,%d (id %d: %s)",
+				mousex + this_screen.scroll_offset_x,
+				mousey + this_screen.scroll_offset_y,
+				mouse_touching,
+				FetchObjectName(mouse_touching));
 		else
-			sprintf (buf, "mouse %d,%d (not touching)", mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y);
+			sprintf(buf, "mouse %d,%d (not touching)",
+				mousex + this_screen.scroll_offset_x,
+				mousey + this_screen.scroll_offset_y);
 
 		Make_debug_text_block (buf, 0, 30);
 
-		//---------------------------------------------
  		// player coords & graphic info
+		// if player objct has a graphic
 
-		if (playerGraphic.anim_resource)	// if player objct has a graphic
-			sprintf (buf, "player %d,%d %s (%d) #%d/%d", this_screen.player_feet_x, this_screen.player_feet_y, FetchObjectName(playerGraphic.anim_resource), playerGraphic.anim_resource, playerGraphic.anim_pc, player_graphic_no_frames);
+		if (playerGraphic.anim_resource)
+			sprintf(buf, "player %d,%d %s (%d) #%d/%d",
+				this_screen.player_feet_x,
+				this_screen.player_feet_y,
+				FetchObjectName(playerGraphic.anim_resource),
+				playerGraphic.anim_resource,
+				playerGraphic.anim_pc,
+				player_graphic_no_frames);
 		else
-			sprintf (buf, "player %d,%d --- %d", this_screen.player_feet_x, this_screen.player_feet_y, playerGraphic.anim_pc);
+			sprintf(buf, "player %d,%d --- %d",
+				this_screen.player_feet_x,
+				this_screen.player_feet_y,
+				playerGraphic.anim_pc);
 
 		Make_debug_text_block (buf, 0, 45);
 
-		//---------------------------------------------
  		// frames-per-second counter
 
-		sprintf (buf, "fps %d", fps);
+		sprintf(buf, "fps %d", fps);
 		Make_debug_text_block (buf, 440, 0);
 
-		//---------------------------------------------
  		// location number
 
-		sprintf (buf, "location=%d", LOCATION);
+		sprintf(buf, "location=%d", LOCATION);
 		Make_debug_text_block (buf, 440, 15);
 
-		//---------------------------------------------
  		// "result" variable
 
-		sprintf (buf, "result=%d", RESULT);
+		sprintf(buf, "result=%d", RESULT);
 		Make_debug_text_block (buf, 440, 30);
 
-		//---------------------------------------------
  		// no. of events in event list
 
-		sprintf (buf, "events=%d", CountEvents());
+		sprintf(buf, "events=%d", CountEvents());
 		Make_debug_text_block (buf, 440, 45);
 
-		//---------------------------------------------
 		// sprite list usage
 
-		sprintf (buf, "bgp0: %d/%d",cur_bgp0,MAX_bgp0_sprites);
+		sprintf(buf, "bgp0: %d/%d", cur_bgp0, MAX_bgp0_sprites);
 		Make_debug_text_block (buf, 560, 0);
 
-		sprintf (buf, "bgp1: %d/%d",cur_bgp1,MAX_bgp1_sprites);
+		sprintf(buf, "bgp1: %d/%d", cur_bgp1, MAX_bgp1_sprites);
 		Make_debug_text_block (buf, 560, 15);
 
-		sprintf (buf, "back: %d/%d",cur_back,MAX_back_sprites);
+		sprintf(buf, "back: %d/%d", cur_back, MAX_back_sprites);
 		Make_debug_text_block (buf, 560, 30);
 
-		sprintf (buf, "sort: %d/%d",cur_sort,MAX_sort_sprites);
+		sprintf(buf, "sort: %d/%d", cur_sort, MAX_sort_sprites);
 		Make_debug_text_block (buf, 560, 45);
 
-		sprintf (buf, "fore: %d/%d",cur_fore,MAX_fore_sprites);
+		sprintf(buf, "fore: %d/%d", cur_fore, MAX_fore_sprites);
 		Make_debug_text_block (buf, 560, 60);
 
-		sprintf (buf, "fgp0: %d/%d",cur_fgp0,MAX_fgp0_sprites);
+		sprintf(buf, "fgp0: %d/%d", cur_fgp0, MAX_fgp0_sprites);
 		Make_debug_text_block (buf, 560, 75);
 
-		sprintf (buf, "fgp1: %d/%d",cur_fgp1,MAX_fgp1_sprites);
+		sprintf(buf, "fgp1: %d/%d", cur_fgp1, MAX_fgp1_sprites);
 		Make_debug_text_block (buf, 560, 90);
 
-		//---------------------------------------------
 		// largest layer & sprite
 
 		// NB. Strings already constructed in Build_display.cpp
 		Make_debug_text_block (largest_layer_info, 0, 60);
 		Make_debug_text_block (largest_sprite_info, 0, 75);
 
-		//---------------------------------------------
-		// "waiting for person" indicator - set form FN_they_do & FN_they_do_we_wait
+		// "waiting for person" indicator - set form FN_they_do &
+		// FN_they_do_we_wait
 
-		if (speechScriptWaiting)
-		{
-			sprintf (buf, "script waiting for %s (%d)", FetchObjectName(speechScriptWaiting), speechScriptWaiting);
+		if (speechScriptWaiting) {
+			sprintf(buf, "script waiting for %s (%d)",
+				FetchObjectName(speechScriptWaiting),
+				speechScriptWaiting);
 			Make_debug_text_block (buf, 0, 90);
 		}
- 		//---------------------------------------------
+
 		// variable watch display
 
 		showVarPos = 115;	// y-coord for first showVar
 
-		varTable = (int32*)(res_man.Res_open(1) + sizeof(_standardHeader));	// res 1 is the global variables resource
+		// res 1 is the global variables resource
+		varTable = (int32 *) (res_man.Res_open(1) + sizeof(_standardHeader));
 
-		for (showVarNo=0; showVarNo < MAX_SHOWVARS; showVarNo++)
-		{
+		for (showVarNo = 0; showVarNo < MAX_SHOWVARS; showVarNo++) {
 			varNo = showVar[showVarNo];	// get variable number
 
-			if (varNo)	// if non-zero ie. cannot watch 'id' but not needed anyway because it changes throughout the logic loop
-			{
-				sprintf (buf, "var(%d) = %d", varNo, varTable[varNo]);
+			// if non-zero ie. cannot watch 'id' but not needed
+			// anyway because it changes throughout the logic loop
+
+			if (varNo) {
+				sprintf(buf, "var(%d) = %d",
+					varNo, varTable[varNo]);
 				Make_debug_text_block (buf, 530, showVarPos);
 				showVarPos += 15;	// next line down
 			}
@@ -452,98 +350,80 @@
 
 		res_man.Res_close(1);	// close global variables resource
 
-		//---------------------------------------------
-		// memory indicator - this should come last, to show all the sprite blocks above!
+		// memory indicator - this should come last, to show all the
+		// sprite blocks above!
 
 		Create_mem_string (buf);
 		Make_debug_text_block (buf, 0, 0);
-
-		//---------------------------------------------
 	}
-	
-	//-------------------------------------------------------------------
-	
-
 }
 
-//--------------------------------------------------------------------------------------
-void Draw_debug_graphics( void )	// JAMES (08apr97)
-{
- 	//-------------------------------
+void Draw_debug_graphics(void) {
 	// walk-grid
 
 	if (displayWalkGrid)
 		PlotWalkGrid(); 
 
- 	//-------------------------------
 	// player feet coord marker
 
 	if (displayPlayerMarker)
-		Plot_cross_hair (this_screen.player_feet_x, this_screen.player_feet_y, 215);
+		Plot_cross_hair(this_screen.player_feet_x, this_screen.player_feet_y, 215);
 
-	//-------------------------------------------------------------------
 	// mouse marker & coords
 
 	if (displayMouseMarker)
-		Plot_cross_hair (mousex+this_screen.scroll_offset_x, mousey+this_screen.scroll_offset_y, 215);
+		Plot_cross_hair(mousex + this_screen.scroll_offset_x, mousey + this_screen.scroll_offset_y, 215);
 
-	//-------------------------------------------------------------------
    	// mouse area rectangle / sprite box rectangle when testing anims
 
-	if (SYSTEM_TESTING_ANIMS)
-	{
-		DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184);	// draw box around current frame
-	}
-	else if (draggingRectangle)		// defining a mouse area the easy way, by creating a box on-screen
-	{
+	if (SYSTEM_TESTING_ANIMS) {
+		// draw box around current frame
+		DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184);
+	} else if (draggingRectangle) {
+		// defining a mouse area the easy way, by creating a box
+		// on-screen
 		if (rectFlicker)
 			DrawRect(rect_x1, rect_y1, rect_x2, rect_y2, 184);
 	}
-	//-------------------------------------------------------------------
 }
-//--------------------------------------------------------------------------------------
-void Plot_cross_hair( int16 x, int16 y, uint8 pen )
-{
-	PlotPoint(x,y,pen);			// driver function
 
-	DrawLine(x-2,y,x-5,y,pen);	// driver function
-	DrawLine(x+2,y,x+5,y,pen);
+void Plot_cross_hair(int16 x, int16 y, uint8 pen) {
+	PlotPoint(x, y, pen);			// driver function
 
-	DrawLine(x,y-2,x,y-5,pen);
-	DrawLine(x,y+2,x,y+5,pen);
+	DrawLine(x - 2, y, x - 5, y, pen);	// driver function
+	DrawLine(x + 2, y, x + 5, y, pen);
+
+	DrawLine(x, y - 2, x, y - 5, pen);
+	DrawLine(x, y + 2, x, y + 5, pen);
 }
-//--------------------------------------------------------------------------------------
-void DrawRect( int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen )
-{
-	DrawLine(x1,y1,x2,y1,pen);	// top edge
-	DrawLine(x1,y2,x2,y2,pen);	// bottom edge
-	DrawLine(x1,y1,x1,y2,pen);	// left edge
-	DrawLine(x2,y1,x2,y2,pen);	// right edge
+
+void DrawRect(int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen) {
+	DrawLine(x1, y1, x2, y1, pen);	// top edge
+	DrawLine(x1, y2, x2, y2, pen);	// bottom edge
+	DrawLine(x1, y1, x1, y2, pen);	// left edge
+	DrawLine(x2, y1, x2, y2, pen);	// right edge
 }
-//--------------------------------------------------------------------------------------
-void Print_current_info(void)	//Tony30Oct96
-{
-//prints general stuff about the screen, etc.
 
+void Print_current_info(void) {
+	// prints general stuff about the screen, etc.
 
-	if	(this_screen.background_layer_id)
-	{	Print_to_console(" background layer id %d", this_screen.background_layer_id);
-		Print_to_console(" %d wide, %d high", this_screen.screen_wide, this_screen.screen_deep);
-		Print_to_console(" %d normal layers", this_screen.number_of_layers);
+	if (this_screen.background_layer_id) {
+		Print_to_console(" background layer id %d",
+			this_screen.background_layer_id);
+		Print_to_console(" %d wide, %d high",
+			this_screen.screen_wide, this_screen.screen_deep);
+		Print_to_console(" %d normal layers",
+			this_screen.number_of_layers);
 
 		LLogic.Examine_run_list();
-
-	}
-	else
+	} else
 		Print_to_console(" no screen");
 
-
 	Scroll_console();
 }
-//--------------------------------------------------------------------------------------
-#else // not debug
+
+#else
 
 void Draw_debug_graphics(void) {}
 
-#endif	// _SWORD2_DEBUG
-//--------------------------------------------------------------------------------------
+#endif

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/debug.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- debug.h	30 Jul 2003 19:25:28 -0000	1.4
+++ debug.h	27 Sep 2003 11:02:56 -0000	1.5
@@ -20,33 +20,31 @@
 #ifndef	D_DEBUG
 #define D_DEBUG
 
-//--------------------------------------------------------------------------------------
-#ifdef _SWORD2_DEBUG	// this whole file only included on debug versions
-
+// this whole file only included on debug versions
+#ifdef _SWORD2_DEBUG
 
-//#include "src\driver96.h"
 #include "driver.h"
 #include "object.h"
 
 #define MAX_DEBUG_TEXT_BLOCKS	50
 
-extern	uint8 displayDebugText;	// 0=off; 1=on
-extern	uint8 displayWalkGrid;
-extern	uint8 displayMouseMarker;
-extern	uint8 displayPlayerMarker;
-extern	uint8 displayTime;
-extern	uint8 displayTextNumbers;
-extern	uint8 definingRectangles;
-extern	uint8 draggingRectangle;
-extern	uint8 displayTime;
-extern	int32 startTime;
-extern	int32 gameCycle;
-extern	uint8 renderSkip;
+extern uint8 displayDebugText;	// 0=off; 1=on
+extern uint8 displayWalkGrid;
+extern uint8 displayMouseMarker;
+extern uint8 displayPlayerMarker;
+extern uint8 displayTime;
+extern uint8 displayTextNumbers;
+extern uint8 definingRectangles;
+extern uint8 draggingRectangle;
+extern uint8 displayTime;
+extern int32 startTime;
+extern int32 gameCycle;
+extern uint8 renderSkip;
 
-extern	int16 rect_x1;
-extern	int16 rect_y1;
-extern	int16 rect_x2;
-extern	int16 rect_y2;
+extern int16 rect_x1;
+extern int16 rect_y1;
+extern int16 rect_x2;
+extern int16 rect_y2;
 
 extern	uint8 testingSnR;
 
@@ -55,38 +53,20 @@
 extern Object_graphic playerGraphic;
 extern uint32 player_graphic_no_frames;
 
-
-
 #define MAX_SHOWVARS 15
-extern	int32 showVar[MAX_SHOWVARS];
 
+extern int32 showVar[MAX_SHOWVARS];
 
-void Zdebug(const char * ,...);		// Tony's special debug logging file March96
-void Zdebug(uint32 stream, const char *format,...);
-void Build_debug_text(void);	// James's debug text display
-void Draw_debug_graphics(void);	// James's debug graphics display
-
-void Print_current_info(void);	//Tony30Oct96
+void Build_debug_text(void);
+void Draw_debug_graphics(void);
 
+void Print_current_info(void);
 
 #else	// ie. not _SWORD2_DEBUG
 
-/* gcc doesn't like this - khalek
-#define Zdebug				NULL
-#define Build_debug_text	NULL
-#define Draw_debug_graphics	NULL
-#define Print_current_info	NULL
-*/
-
-void Zdebug(const char * ,...);		// Tony's special debug logging file March96
-void Build_debug_text(void);	// James's debug text display
-void Draw_debug_graphics(void);	// James's debug graphics display
-
-#endif	// _SWORD2_DEBUG	// this whole file only included on debug versions
-//--------------------------------------------------------------------------------------
-
-void ExitWithReport(const char *format,...);	// (6dec96 JEL) IN BOTH DEBUG & RELEASE VERSIONS
-
+void Build_debug_text(void);
+void Draw_debug_graphics(void);
 
+#endif
 
-#endif	//D_DEBUG
+#endif

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/events.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- events.cpp	26 Sep 2003 10:07:18 -0000	1.5
+++ events.cpp	27 Sep 2003 11:02:56 -0000	1.6
@@ -68,7 +68,7 @@
 	}
 
 	if (j == MAX_events)
-		Con_fatal_error("FN_set_event out of event slots (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("FN_set_event out of event slots");
 
 	//found that slot
 
@@ -159,7 +159,7 @@
 
 	uint32 j = 0;
 
-	// Zdebug("*+*+* %d %d", params[0], params[1]);
+	debug(5, "FN_send_event(%d, %d)", params[0], params[1]);
 
 	// search for an existing event or a slot
 

Index: function.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/function.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- function.cpp	26 Sep 2003 10:07:18 -0000	1.15
+++ function.cpp	27 Sep 2003 11:02:56 -0000	1.16
@@ -39,14 +39,14 @@
 int32 FN_test_function(int32 *params) {
 	// param	0 address of a flag
 
-	Zdebug(" TEST %d %d", params[0], RESULT);
+	debug(5, " TEST %d %d", params[0], RESULT);
 	return IR_CONT;
 }
 
 int32 FN_test_flags(int32 *params) {
 	// param	0 value of flag
 
-	// Zdebug("\nFN_test_flags %d, %d\n", params[0], params[1]);
+	debug(5, "FN_test_flags %d, %d\n", params[0], params[1]);
 	return IR_CONT;
 }
 
@@ -65,7 +65,7 @@
 	// directive
 	// param	0 id of script
 
-	Zdebug("FN_new_script %d", params[0]);
+	debug(5, "FN_new_script %d", params[0]);
 
 	// must clear this
 	PLAYER_ACTION = 0;
@@ -82,7 +82,7 @@
 	// param	0 id of target from which we derive action script
 	//		  reference
 
-	Zdebug("FN_interact %d", params[0]);
+	debug(5, "FN_interact %d", params[0]);
 
 	// must clear this
 	PLAYER_ACTION = 0;
@@ -354,7 +354,7 @@
 	size = res_man.Res_fetch_len(1);
 	size -= sizeof(_standardHeader);
 
-	Zdebug("\nglobals size %d", size / 4);
+	debug(5, "globals size %d", size / 4);
 
 	globals = (uint32*) ((uint8 *) res_man.Res_open(1) + sizeof(_standardHeader));
 

Index: icons.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/icons.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- icons.cpp	26 Sep 2003 10:07:18 -0000	1.8
+++ icons.cpp	27 Sep 2003 11:02:56 -0000	1.9
@@ -33,11 +33,11 @@
 int32 FN_add_menu_object(int32 *params) {
 	// param	0 pointer to a menu_object structure to copy down
 
-	// Zdebug("FN_add_menu_object icon res");
+	debug(5, "FN_add_menu_object icon res");
 
 #ifdef _SWORD2_DEBUG
 	if (total_temp == TOTAL_engine_pockets)
-		Con_fatal_error("TOTAL_engine_pockets exceeded! (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("TOTAL_engine_pockets exceeded!");
 #endif
 
 	// copy the structure to our in-the-engine list
@@ -81,7 +81,7 @@
 	// reset temp list which will be totally rebuilt
 	total_temp = 0;
 
-	// Zdebug("\nbuild top menu %d", total_masters);
+	debug(5, "build top menu %d", total_masters);
 
 	// clear the temp list before building a new temp list in-case list
 	// gets smaller. check each master
@@ -116,7 +116,7 @@
 			if (!res) {
 				// otherwise not in temp so kill in main
 				master_menu_list[j].icon_resource = 0;
-				// Zdebug("Killed menu %d",j);
+				debug(5, "Killed menu %d", j);
 			}
 		}
 	}
@@ -209,7 +209,7 @@
 		} else {
 			// no icon here
 			SetMenuIcon(RDMENU_BOTTOM, j, NULL);
-			// Zdebug(" NULL for %d", j);
+			debug(5, " NULL for %d", j);
 		}
 	}
 

Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- interpreter.cpp	24 Sep 2003 06:40:20 -0000	1.13
+++ interpreter.cpp	27 Sep 2003 11:02:56 -0000	1.14
@@ -280,7 +280,7 @@
 	FN_change_shadows,
 };
 
-#define CHECKSTACKPOINTER2 ASSERT(stackPointer2 >= 0 && stackPointer2 < STACK_SIZE);
+#define CHECKSTACKPOINTER2 assert(stackPointer2 >= 0 && stackPointer2 < STACK_SIZE);
 #define	PUSHONSTACK(x) { stack2[stackPointer2] = (x); stackPointer2++; CHECKSTACKPOINTER2 }
 #define POPOFFSTACK(x) { x = stack2[stackPointer2 - 1]; stackPointer2--; CHECKSTACKPOINTER2 }
 #define DOOPERATION(x) { stack2[stackPointer2 - 2] = (x); stackPointer2--; CHECKSTACKPOINTER2 }
@@ -317,7 +317,7 @@
 	const char *tempScrPtr;
 
 	// Get the start of variables and start of code
-	DEBUG("Enter interpreter data %x, object %x, offset %d", scriptData, objectData, *offset);
+	debug(5, "Enter interpreter data %x, object %x, offset %d", scriptData, objectData, *offset);
 
 	// FIXME: 'scriptData' and 'variables' used to be const. However,
 	// this code writes into 'variables' so it can not be const.
@@ -328,10 +328,10 @@
 
 	if (*offset < noScripts) {
 		ip = READ_LE_UINT32((const int *) code + *offset + 1);
-		DEBUG("Start script %d with offset %d",*offset,ip);
+		debug(5, "Start script %d with offset %d",*offset,ip);
 	} else {
 		ip = *offset;
-		DEBUG("Start script with offset %d",ip);
+		debug(5, "Start script with offset %d",ip);
 	}
 
 	code += noScripts * sizeof(int) + sizeof(int);
@@ -368,36 +368,36 @@
 		switch (curCommand) {
 		case CP_END_SCRIPT:
 			// End the script
-			DEBUG("End script",0);
+			debug(5, "End script",0);
 			runningScript = 0;
 			break;
 		case CP_PUSH_LOCAL_VAR32:
 			// Push the contents of a local variable
 			Read16ip(parameter);
-			DEBUG("Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
+			debug(5, "Push local var %d (%d)", parameter, *(int32 *) (variables + parameter));
 			PUSHONSTACK(*(int32 *) (variables + parameter));
 			break;
 		case CP_PUSH_GLOBAL_VAR32:
 			// Push a global variable
 			Read16ip(parameter);
-			DEBUG("Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
-			ASSERT(globalInterpreterVariables2);
+			debug(5, "Push global var %d (%d)", parameter, globalInterpreterVariables2[parameter]);
+			assert(globalInterpreterVariables2);
 			PUSHONSTACK(globalInterpreterVariables2[parameter]);
 			break;
 		case CP_POP_LOCAL_VAR32:
 			// Pop a value into a local word variable
 			Read16ip(parameter);
 			POPOFFSTACK(value);
-			DEBUG("Pop %d into var %d", value, parameter);
+			debug(5, "Pop %d into var %d", value, parameter);
 			*((int32 *) (variables + parameter)) = value;
 			break;
 		case CP_CALL_MCODE:
 			// Call an mcode routine
 			Read16ip(parameter);
-			ASSERT(parameter <= MAX_FN_NUMBER);
+			assert(parameter <= MAX_FN_NUMBER);
 			// amount to adjust stack by (no of parameters)
 			Read8ip(value);
-			DEBUG("Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
+			debug(5, "Call mcode %d with stack = %x", parameter, stack2 + stackPointer2 - value);
 			retVal = McodeTable[parameter](stack2 + stackPointer2 - value);
 			stackPointer2 -= value;
 			CHECKSTACKPOINTER2
@@ -424,27 +424,27 @@
 				*offset = ip;
 				return 2;
 			default:
-				ASSERT(false);
+				assert(false);
 			}
 			parameterReturnedFromMcodeFunction = retVal >> 3;
 			break;
 		case CP_PUSH_LOCAL_ADDR:
 			// push the address of a local variable
 			Read16ip(parameter);
-			DEBUG("Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
+			debug(5, "Push address of local variable %d (%x)", parameter, (int32) (variables + parameter));
 			PUSHONSTACK((int32) (variables + parameter));
 			break;
 		case CP_PUSH_INT32:
 			// Push a long word value on to the stack
 			Read32ip(parameter);
-			DEBUG("Push int32 %d (%x)", parameter, parameter);
+			debug(5, "Push int32 %d (%x)", parameter, parameter);
 			PUSHONSTACK(parameter);
 			break;
 		case CP_SKIPONFALSE:
 			// Skip if the value on the stack is false
 			Read32ipLeaveip(parameter);
 			POPOFFSTACK(value);
-			DEBUG("Skip %d if %d is false", parameter, value);
+			debug(5, "Skip %d if %d is false", parameter, value);
 			if (value)
 				ip += sizeof(int32);
 			else
@@ -453,7 +453,7 @@
 		case CP_SKIPALWAYS:
 			// skip a block
 			Read32ipLeaveip(parameter);
-			DEBUG("Skip %d", parameter);
+			debug(5, "Skip %d", parameter);
 			ip += parameter;
 			break;
 		case CP_SWITCH:
@@ -484,19 +484,19 @@
 			Read16ip(parameter);
 			POPOFFSTACK(value);
 			*((int32 *) (variables + parameter)) += value;
-			DEBUG("+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+			debug(5, "+= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
 			break;
 		case CP_SUBNPOP_LOCAL_VAR32:
 			Read16ip(parameter);
 			POPOFFSTACK(value);
 			*((int32 *) (variables + parameter)) -= value;
-			DEBUG("-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+			debug(5, "-= %d into var %d->%d", value, parameter, *(int32 *) (variables + parameter));
 			break;
 		case CP_SKIPONTRUE:
 			// Skip if the value on the stack is TRUE
 			Read32ipLeaveip(parameter);
 			POPOFFSTACK(value);
-			DEBUG("Skip %d if %d is false", parameter, value);
+			debug(5, "Skip %d if %d is false", parameter, value);
 			if (!value)
 				ip += sizeof(int32);
 			else
@@ -506,7 +506,7 @@
 			// Pop a global variable
 			Read16ip(parameter);
 			POPOFFSTACK(value);
-			DEBUG("Pop %d into global var %d", value, parameter);
+			debug(5, "Pop %d into global var %d", value, parameter);
 
 #ifdef TRACEGLOBALVARIABLESET
 			TRACEGLOBALVARIABLESET(parameter, value);
@@ -521,14 +521,14 @@
 			// ip += 2;
 			POPOFFSTACK(value);
 			globalInterpreterVariables2[parameter] += value;
-			DEBUG("+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+			debug(5, "+= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
 			break;
 		case CP_SUBNPOP_GLOBAL_VAR32:
 			// Sub and pop a global variable
 			Read16ip(parameter);
 			POPOFFSTACK(value);
 			globalInterpreterVariables2[parameter] -= value;
-			DEBUG("-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
+			debug(5, "-= %d into global var %d->%d", value, parameter, *(int32 *) (variables + parameter));
 			break;
 		case CP_DEBUGON:
 			// Turn debugging on
@@ -551,7 +551,7 @@
 
 		case OP_ISEQUAL:
 			// '=='
-			DEBUG("%d == %d -> %d",
+			debug(5, "%d == %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] == stack2[stackPointer2 - 1]);
@@ -559,7 +559,7 @@
 			break;
 		case OP_PLUS:
 			// '+'
-			DEBUG("%d + %d -> %d",
+			debug(5, "%d + %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] + stack2[stackPointer2 - 1]);
@@ -567,7 +567,7 @@
 			break;
 		case OP_MINUS:
 			// '-'
-			DEBUG("%d - %d -> %d",
+			debug(5, "%d - %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] - stack2[stackPointer2 - 1]);
@@ -575,7 +575,7 @@
 			break;
 		case OP_TIMES:
 			// '*'
-			DEBUG("%d * %d -> %d",
+			debug(5, "%d * %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] * stack2[stackPointer2 - 1]);
@@ -583,7 +583,7 @@
 			break;
 		case OP_DIVIDE:
 			// '/'
-			DEBUG("%d / %d -> %d",
+			debug(5, "%d / %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] / stack2[stackPointer2 - 1]);
@@ -591,7 +591,7 @@
 			break;
 		case OP_NOTEQUAL:
 			// '!='
-			DEBUG("%d != %d -> %d",
+			debug(5, "%d != %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] != stack2[stackPointer2 - 1]);
@@ -599,7 +599,7 @@
 			break;
 		case OP_ANDAND:
 			// '&&'
-			DEBUG("%d != %d -> %d",
+			debug(5, "%d != %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] && stack2[stackPointer2 - 1]);
@@ -607,7 +607,7 @@
 			break;
 		case OP_GTTHAN:
 			// '>'
-			DEBUG("%d > %d -> %d",
+			debug(5, "%d > %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] > stack2[stackPointer2 - 1]);
@@ -615,7 +615,7 @@
 			break;
 		case OP_LSTHAN:
 			// '<'
-			DEBUG("%d < %d -> %d",
+			debug(5, "%d < %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] < stack2[stackPointer2 - 1]);
@@ -633,7 +633,7 @@
 			// Process a text line
 			// This was apparently used in Linc
 			Read32ip(parameter);
-			DEBUG("Process text id %d", parameter);
+			debug(5, "Process text id %d", parameter);
 			break;
 		case CP_SAVE_MCODE_START:
 			// Save the start position on an mcode instruction in
@@ -675,12 +675,12 @@
 		case CP_PUSH_DEREFERENCED_STRUCTURE:
 			// Push the address of a dereferenced structure
 			Read32ip(parameter);
-			DEBUG("Push address of far variable (%x)", (int32) (variables + parameter));
+			debug(5, "Push address of far variable (%x)", (int32) (variables + parameter));
 			PUSHONSTACK((int) (objectData + sizeof(int) + sizeof(_standardHeader) + sizeof(_object_hub) + parameter));
 			break;
 		case OP_GTTHANE:
 			// '>='
-			DEBUG("%d > %d -> %d",
+			debug(5, "%d > %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] >= stack2[stackPointer2 - 1]);
@@ -688,7 +688,7 @@
 			break;
 		case OP_LSTHANE:
 			// '<='
-			DEBUG("%d < %d -> %d",
+			debug(5, "%d < %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] <= stack2[stackPointer2 - 1]);
@@ -696,7 +696,7 @@
 			break;
 		case OP_OROR:
 			// '||'
-			DEBUG("%d || %d -> %d",
+			debug(5, "%d || %d -> %d",
 				stack2[stackPointer2 - 2],
 				stack2[stackPointer2 - 1],
 				stack2[stackPointer2 - 2] || stack2[stackPointer2 - 1]);

Index: interpreter.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/interpreter.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- interpreter.h	20 Sep 2003 12:41:41 -0000	1.7
+++ interpreter.h	27 Sep 2003 11:02:56 -0000	1.8
@@ -31,10 +31,6 @@
 #define IR_REPEAT			3
 #define IR_GOSUB			4
 
-#define DEBUG				if (g_debugFlag) Zdebug
-
-#define ASSERT(x)		 	{ if (!(x)) { Zdebug("Interpreter ASSERT %s,%d", __FILE__, __LINE__); Con_fatal_error("Assert error in interpreter"); } }
-
 // Get parameter fix so that the playstation version can handle words not on
 // word boundaries
 

Index: layers.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/layers.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- layers.cpp	26 Sep 2003 10:07:18 -0000	1.7
+++ layers.cpp	27 Sep 2003 11:02:56 -0000	1.8
@@ -52,28 +52,16 @@
 	uint8 *file;
 	uint32 rv;
 
-#ifdef _SWORD2_DEBUG
-	//--------------------------------------
-	// Write to walkthrough file (zebug0.txt)
-	Zdebug(0,"=====================================");
-	Zdebug(0,"CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
-	Zdebug(0,"=====================================");
-
-	// Also write this to system debug file
-	Zdebug("=====================================");
-	Zdebug("CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
-	Zdebug("=====================================");
- 	//--------------------------------------
-#endif
+	debug(5, "CHANGED TO LOCATION \"%s\"", FetchObjectName(*params));
 
 	// stop all fx & clears the queue
 	Clear_fx_queue();
 
 #ifdef _SWORD2_DEBUG
-	Zdebug("FN_init_background(%d)", *params);
+	debug(5, "FN_init_background(%d)", *params);
 
 	if (!*params) {
-		Con_fatal_error("ERROR: FN_set_background cannot have 0 for background layer id! (%s line=%u)", __FILE__, __LINE__);
+		Con_fatal_error("ERROR: FN_set_background cannot have 0 for background layer id!");
 	}
 #endif
 
@@ -84,7 +72,7 @@
 	if (this_screen.mask_flag) {
 		rv = CloseLightMask();
 		if (rv)
-			ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
+			error("Driver Error %.8x", rv);
 	}
 	
 	// New stuff for faster screen drivers
@@ -110,7 +98,7 @@
 	this_screen.screen_wide = screen_head->width;
 	this_screen.screen_deep = screen_head->height;
 
-	Zdebug("res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
+	debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
 
 	//initialise the driver back buffer
 	SetLocationMetrics(screen_head->width, screen_head->height);
@@ -128,7 +116,7 @@
 			// signifies a layer
 			sort_list[j].layer_number = j + 1;
 
-			Zdebug("init layer %d", j);
+			debug(5, "init layer %d", j);
 		}
 	}
 
@@ -188,7 +176,7 @@
 
 		rv = OpenLightMask(&spriteInfo);
 		if (rv)
-			ExitWithReport("Driver Error %.8x [%s line %u]", rv, __FILE__, __LINE__);
+			error("Driver Error %.8x", rv);
 
 		// so we know to close it later! (see above)
 		this_screen.mask_flag = 1;
@@ -202,7 +190,7 @@
 
 	SetUpBackgroundLayers();
 
-	Zdebug("end init");
+	debug(5, "end init");
 	return 1;
 }
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/logic.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- logic.cpp	26 Sep 2003 10:07:18 -0000	1.14
+++ logic.cpp	27 Sep 2003 11:02:56 -0000	1.15
@@ -78,7 +78,7 @@
 
 		res_man.Res_close(run_list);
 
-		// Zdebug("%d", ID);
+		debug(5, "%d", ID);
 
 		// null terminated
 		if (!ID) {
@@ -93,10 +93,10 @@
 
 		cur_object_hub = (_object_hub *) (head + 1);
 
-		// Zdebug(" %d id(%d) pc(%d)",
-		//	cur_object_hub->logic_level,
-		//	cur_object_hub->script_id[cur_object_hub->logic_level],
-		//	cur_object_hub->script_pc[cur_object_hub->logic_level]);
+		debug(5, " %d id(%d) pc(%d)",
+			cur_object_hub->logic_level,
+			cur_object_hub->script_id[cur_object_hub->logic_level],
+			cur_object_hub->script_pc[cur_object_hub->logic_level]);
 
 		// do the logic for this object
 		// we keep going until a function says to stop - remember,
@@ -113,9 +113,9 @@
 			if (script / SIZE == ID) {
 				// its our script
 
-				// Zdebug("run script %d pc%d",
-				//	script / SIZE,
-				//	cur_object_hub->script_pc[LEVEL]);
+				debug(5, "run script %d pc%d",
+					script / SIZE,
+					cur_object_hub->script_pc[LEVEL]);
 
 				// this is the script data
 				// raw_script_ad = (char *) (cur_object_hub + 1);
@@ -164,7 +164,7 @@
 					// be different this time and simply
 					// let it restart next go :-)
 
-					// Zdebug("**WARNING object %d script 0 terminated!", id);
+					debug(5, "**WARNING object %d script 0 terminated!", id);
 
 					// reset to rerun
 					cur_object_hub->script_pc[LEVEL] = cur_object_hub->script_id[LEVEL] & 0xffff;
@@ -173,7 +173,7 @@
 					ret = 0;
 				}
 			} else if (ret > 2) {
-				Con_fatal_error("Process_session: illegal script return type %d (%s line %u)", ret, __FILE__, __LINE__);
+				Con_fatal_error("Process_session: illegal script return type %d", ret);
 			}
 
 			// if ret == 2 then we simply go around again - a new
@@ -209,7 +209,7 @@
 	// leaving a room so remove all ids that must reboot correctly
 	Process_kill_list();
 
-	Zdebug("RESTART the loop");
+	debug(5, "RESTART the loop");
 
 	// means restart the loop
 	return 1;
@@ -297,9 +297,9 @@
 	if (cur_object_hub->logic_level == 3)
 		Con_fatal_error("Logic_up id %d has run off script tree! :-O", ID);
 
-	//setup new script on next level (not the current level)
+	// setup new script on next level (not the current level)
 
-	// Zdebug("new pc = %d", new_script & 0xffff);
+	debug(5, "new pc = %d", new_script & 0xffff);
 
 	cur_object_hub->script_id[cur_object_hub->logic_level] = new_script;
 	cur_object_hub->script_pc[cur_object_hub->logic_level] = new_script & 0xffff;
@@ -422,7 +422,7 @@
 #ifdef _SWORD2_DEBUG
 			// no room at the inn
 			if (kills == OBJECT_KILL_LIST_SIZE)
-				Con_fatal_error("List full in FN_add_to_kill_list(%u) (%s line %u)", ID, __FILE__, __LINE__);
+				Con_fatal_error("List full in FN_add_to_kill_list(%u)", ID);
 #endif
 
 			// add this 'ID' to the kill list

Index: maketext.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/maketext.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- maketext.cpp	26 Sep 2003 10:07:18 -0000	1.13
+++ maketext.cpp	27 Sep 2003 11:02:57 -0000	1.14
@@ -105,7 +105,7 @@
 	uint16 noOfLines;	// no of lines of text required to fit within
 				// a sprite of width 'maxWidth' pixels
 
-	// Zdebug("MakeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
+	debug(5, "MakeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
 
 	// NB. ensure sentence contains no leading/tailing/extra spaces - if
 	// necessary, copy to another array first, missing the extra spaces.
@@ -271,8 +271,8 @@
 	frameHeadPtr->width = spriteWidth;
 	frameHeadPtr->height = spriteHeight;
 	
-	// Zdebug("spriteWidth=%u",spriteWidth);
-	// Zdebug("spriteHeight=%u",spriteHeight);
+	debug(5, "spriteWidth=%u", spriteWidth);
+	debug(5, "spriteHeight=%u", spriteHeight);
 
 	// ok, now point to the start (of the first line) of the sprite data
 	// itelf
@@ -302,7 +302,7 @@
 
 #ifdef _SWORD2_DEBUG			
 			if (charPtr->height != charHeight)
-				Con_fatal_error("FONT ERROR: '%c' is not same height as the space (%s line %u)", sentence[pos - 1], __FILE__, __LINE__);
+				Con_fatal_error("FONT ERROR: '%c' is not same height as the space", sentence[pos - 1]);
 #endif
 
 			CopyChar(charPtr, spritePtr, spriteWidth, pen);
@@ -481,7 +481,7 @@
 #ifdef _SWORD2_DEBUG
 	// we've run out - might as well stop the system
 	if (j == MAX_text_blocs)
-		Con_fatal_error("Build_new_block ran out of blocks! (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("Build_new_block ran out of blocks!");
 #endif
 
 	// make the sprite!
@@ -590,7 +590,7 @@
 
 			rv = DrawSprite(&spriteInfo);
 			if (rv)
-				ExitWithReport("Driver Error %.8x in Print_text_blocs [%s line %u]", rv, __FILE__, __LINE__);
+				error("Driver Error %.8x in Print_text_blocs", rv);
 		}
 	}
 }

Index: mem_view.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mem_view.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mem_view.cpp	26 Sep 2003 10:07:18 -0000	1.9
+++ mem_view.cpp	27 Sep 2003 11:02:57 -0000	1.10
@@ -20,7 +20,6 @@
 #include "stdafx.h"
 #include "build_display.h"
 #include "console.h"
-#include "debug.h"
 #include "header.h"
 #include "mem_view.h"
 #include "memory.h"
@@ -49,7 +48,7 @@
 			// close immediately so give a true count
 			res_man.Res_close(mem_list[j].uid);
 
-			Zdebug("view %d", mem_list[j].uid);
+			debug(5, "view %d", mem_list[j].uid);
 
 			pass = 0;
 			found_end = 0;

Index: memory.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/memory.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- memory.cpp	26 Sep 2003 10:07:18 -0000	1.7
+++ memory.cpp	27 Sep 2003 11:02:57 -0000	1.8
@@ -38,6 +38,7 @@
 // MemMan v1.1
 
 #include "stdafx.h"
+#include "driver/driver96.h"
 #include "debug.h"
 #include "memory.h"
 #include "resman.h"
@@ -79,8 +80,7 @@
 	memory_base = (uint8 *) malloc(total_free_memory);
 
 	if (!memory_base) {	//could not grab the memory
-		Zdebug("couldn't malloc %d in Init_memory_manager", total_free_memory);
-		ExitWithReport("Init_memory_manager() couldn't malloc %d bytes [line=%d file=%s]", total_free_memory, __LINE__, __FILE__);
+		error("Init_memory_manager() couldn't malloc %d bytes", total_free_memory);
 	}
 
 	// the original malloc address
@@ -206,7 +206,7 @@
 		// up and we need to alert the developer
 		// Lets get a printout of this
 		Mem_debug();
-		ExitWithReport("ERROR: ran out of mem blocks in Talloc() [file=%s line=%u]", __FILE__, __LINE__);
+		error("Out of mem blocks in Talloc()");
 	}
 
 	mem_list[spawn].state = MEM_free;	// new block is free
@@ -462,14 +462,14 @@
 		{ "MEM_float" }
 	};
 
-	Zdebug("\nbase %d total %d", base_mem_block, total_blocks);
+	debug(5, "base %d total %d", base_mem_block, total_blocks);
 
 	// first in mem list order
 	for (j = 0; j < MAX_mem_blocks; j++) {
 		if (mem_list[j].state == MEM_null)
-			Zdebug("%d- NULL", j);
+			debug(5, "%d- NULL", j);
 		else
-			Zdebug("%d- state %s, ad %d, size %d, p %d, c %d, id %d",
+			debug(5, "%d- state %s, ad %d, size %d, p %d, c %d, id %d",
 				j, inf[mem_list[j].state], mem_list[j].ad,
 				mem_list[j].size, mem_list[j].parent,
 				mem_list[j].child, mem_list[j].uid);
@@ -478,7 +478,7 @@
 	// now in child/parent order
 	j = base_mem_block;
 	do {
-		Zdebug(" %d- state %s, ad %d, size %d, p %d, c %d", j, 
+		debug(5, " %d- state %s, ad %d, size %d, p %d, c %d", j, 
 			inf[mem_list[j].state], mem_list[j].ad,
 			mem_list[j].size, mem_list[j].parent,
 			mem_list[j].child, mem_list[j].uid);
@@ -499,16 +499,14 @@
 	while (VirtualDefrag(size)) {
 		// trash the oldest closed resource
 		if (!res_man.Help_the_aged_out()) {
-			Zdebug("Twalloc ran out of memory! %d %d %d\n", size, type, unique_id);
-			ExitWithReport("Twalloc ran out of memory!");
+			error("Twalloc ran out of memory: size=%d type=%d unique_id=%d", size, type, unique_id);
 		}
 	}
 
 	membloc = Talloc(size, type, unique_id);
 
 	if (membloc == 0) {
-		Zdebug("Talloc failed to get memory VirtualDefrag said was there");
-		ExitWithReport("Talloc failed to get memory VirtualDefrag said was there");
+		error("Talloc failed to get memory VirtualDefrag said was there");
 	}
 
 	j = base_mem_block;

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/mouse.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mouse.cpp	26 Sep 2003 10:07:18 -0000	1.17
+++ mouse.cpp	27 Sep 2003 11:02:57 -0000	1.18
@@ -22,7 +22,6 @@
 #include "build_display.h"
 #include "console.h"
 #include "controls.h"
-#include "debug.h"
 #include "defs.h"
 #include "events.h"
 #include "icons.h"
@@ -159,7 +158,7 @@
 	case MOUSE_holding:
 		if (mousey < 400) {
 			mouse_mode = MOUSE_normal;
-			Zdebug("   releasing");
+			debug(5, "   releasing");
 		}
 		break;
 	default:
@@ -218,7 +217,7 @@
 
 				rv = g_sound->PauseFx();
 				if (rv != RD_OK)
-					Zdebug("ERROR: PauseFx() returned %.8x in SystemMenu()", rv);
+					debug(5, "ERROR: PauseFx() returned %.8x in SystemMenu()", rv);
 
 				// NB. Need to keep a safe copy of
 				// 'looping_music_id' for savegame & for
@@ -296,7 +295,7 @@
 
 				rv = g_sound->UnpauseFx();
 				if (rv != RD_OK)
-					Zdebug("ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv);
+					debug(5, "ERROR: UnpauseFx() returned %.8x in SystemMenu()", rv);
 
 				// If there was looping music before coming
 				// into the control panels then restart it!
@@ -374,12 +373,9 @@
 
 			CLICKED_ID = mouse_touching;
 
-			Set_player_action_event(CUR_PLAYER_ID, mouse_touching);	// Tony4Dec96
+			Set_player_action_event(CUR_PLAYER_ID, mouse_touching);
 
-#ifdef _SWORD2_DEBUG
-			// Write to walkthrough file (zebug0.txt)
-			Zdebug(0, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
-#endif
+			debug(5, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
 
 			// Hide menu - back to normal menu mode
 
@@ -409,13 +405,13 @@
 						menu_selected_pos = 0;
 					} else {
 						// combine the 2 icons
-						// Zdebug("combine");
+						debug(5, "combine");
 
 						//what we clicked on, not what
 						// we're dragging
 
 						COMBINE_BASE = master_menu_list[pos].icon_resource;
-						Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);	//Tony4Dec96
+						Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
 
 						// turn off mouse now, to
 						// prevent player trying to
@@ -424,16 +420,12 @@
 
 						No_human();
 
-#ifdef _SWORD2_DEBUG
-						// Write to walkthrough file
-						// (zebug0.txt)
-						Zdebug(0, "USED \"%s\" ICON ON \"%s\" ICON", FetchObjectName(OBJECT_HELD), FetchObjectName(COMBINE_BASE));
-#endif
+						debug(5, "USED \"%s\" ICON ON \"%s\" ICON", FetchObjectName(OBJECT_HELD), FetchObjectName(COMBINE_BASE));
 					}
 
 					// refresh the menu
 					Build_top_menu();
-					// Zdebug("switch to top mode");
+					debug(5, "switch to top mode");
 				}
 			}
 		}
@@ -481,13 +473,9 @@
 
 					EXIT_CLICK_ID = 0;
 
-#ifdef _SWORD2_DEBUG
-					// Write to walkthrough file
-					// (zebug0.txt)
-					Zdebug(0, "RIGHT-CLICKED ON \"%s\" ICON", FetchObjectName(OBJECT_HELD));
-#endif
+					debug(5, "RIGHT-CLICKED ON \"%s\" ICON", FetchObjectName(OBJECT_HELD));
 
-					Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);	// Tony4Dec96
+					Set_player_action_event(CUR_PLAYER_ID, MENU_MASTER_OBJECT);
 
 					// refresh the menu
 					Build_top_menu();
@@ -509,14 +497,13 @@
 					current_luggage_resource = master_menu_list[pos].luggage_resource;
 
 					mouse_mode = MOUSE_drag;
-					// Zdebug("setting OH in top menu");
+					debug(5, "setting OH in top menu");
 
 					// id the object via its graphic
 					OBJECT_HELD = master_menu_list[pos].icon_resource;
 
-					// (JEL09oct97) must clear this so
-					// next click on exit becomes 1st
-					// click again
+					// must clear this so next click on
+					// exit becomes 1st click again
 
 					EXIT_CLICK_ID = 0;
 
@@ -524,7 +511,7 @@
 					Build_top_menu();
 
 					Set_luggage(master_menu_list[pos].luggage_resource);
-					// Zdebug("switch to drag mode");
+					debug(5, "switch to drag mode");
 				}
 			}
 		}
@@ -692,15 +679,12 @@
 
 			Set_player_action_event(CUR_PLAYER_ID, mouse_touching);	//Tony4Dec96
 
-#ifdef _SWORD2_DEBUG
-			// Write to walkthrough file (zebug0.txt)
 			if (OBJECT_HELD)
-				Zdebug(0, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
+				debug(5, "USED \"%s\" ICON ON %s", FetchObjectName(OBJECT_HELD), FetchObjectName(CLICKED_ID));
 			else if (LEFT_BUTTON)
-				Zdebug(0, "LEFT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
+				debug(5, "LEFT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
 			else	// RIGHT BUTTON
-				Zdebug(0, "RIGHT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
-#endif
+				debug(5, "RIGHT-CLICKED ON %s", FetchObjectName(CLICKED_ID));
 		}
 	}
 
@@ -1187,7 +1171,7 @@
 	// param	0 pointer to Object_mouse or 0 for no write to mouse
 	//		  list
 
-	// Zdebug(1, "cur_mouse = %d", cur_mouse);
+	debug(5, "cur_mouse = %d", cur_mouse);
 
 	Object_mouse *ob_mouse = (Object_mouse *) params[0];
 
@@ -1195,7 +1179,7 @@
 	if (ob_mouse->pointer) {
 #ifdef _SWORD2_DEBUG
 		if (cur_mouse == TOTAL_mouse_list)
-			Con_fatal_error("ERROR: mouse_list full [%s line %u]", __FILE__, __LINE__);
+			Con_fatal_error("ERROR: mouse_list full");
 #endif
 
 		mouse_list[cur_mouse].x1 = ob_mouse->x1;
@@ -1228,7 +1212,7 @@
 		mouse_list[cur_mouse].anim_resource = 0;
 		mouse_list[cur_mouse].anim_pc = 0;
 
-		// Zdebug("mouse id %d", mouse_list[cur_mouse].id);
+		debug(5, "mouse id %d", mouse_list[cur_mouse].id);
 		cur_mouse++;
 	}
 
@@ -1244,7 +1228,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (cur_mouse == TOTAL_mouse_list)
-		Con_fatal_error("ERROR: mouse_list full [%s line %u]", __FILE__, __LINE__);
+		Con_fatal_error("ERROR: mouse_list full");
 #endif
 
 	// current object id - used for checking pointer_text when mouse area

Index: protocol.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/protocol.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- protocol.cpp	26 Sep 2003 10:07:18 -0000	1.10
+++ protocol.cpp	27 Sep 2003 11:02:57 -0000	1.11
@@ -77,7 +77,7 @@
 	_screenHeader *screenHead = FetchScreenHeader(screenFile);
 
 	if (layerNo > screenHead->noLayers - 1)
-		Con_fatal_error("FetchLayerHeader(%d) invalid layer number! (%s line %u)", layerNo, __FILE__, __LINE__);
+		Con_fatal_error("FetchLayerHeader(%d) invalid layer number!", layerNo);
 #endif
 
 	_multiScreenHeader *mscreenHeader = (_multiScreenHeader *) (screenFile + sizeof(_standardHeader));
@@ -112,7 +112,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (frameNo > animHead->noAnimFrames - 1)
-		Con_fatal_error("FetchCdtEntry(animFile,%d) - anim only %d frames (%s line %u)", frameNo, animHead->noAnimFrames, __FILE__, __LINE__);
+		Con_fatal_error("FetchCdtEntry(animFile,%d) - anim only %d frames", frameNo, animHead->noAnimFrames);
 #endif
 
 	return (_cdtEntry *) ((uint8 *) animHead + sizeof(_animHeader) + frameNo * sizeof(_cdtEntry));
@@ -134,7 +134,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (mscreenHeader->bg_parallax[layer] == 0)
-		Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists (%s line %u)", layer, __FILE__, __LINE__);
+		Con_fatal_error("FetchBackgroundParallaxLayer(%d) - No parallax layer exists", layer);
 #endif
 
 	return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->bg_parallax[layer]);
@@ -145,7 +145,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (mscreenHeader->screen == 0)
-		Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("FetchBackgroundLayer (%d) - No background layer exists");
 #endif
 
 	return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->screen + sizeof(_screenHeader));
@@ -156,7 +156,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (mscreenHeader->fg_parallax[layer] == 0)
-		Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists (%s line %u)",layer, __FILE__, __LINE__);
+		Con_fatal_error("FetchForegroundParallaxLayer(%d) - No parallax layer exists", layer);
 #endif
 
 	return (_parallax *) ((uint8 *) mscreenHeader + mscreenHeader->fg_parallax[layer]);

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- resman.cpp	26 Sep 2003 10:07:18 -0000	1.43
+++ resman.cpp	27 Sep 2003 11:02:57 -0000	1.44
@@ -105,21 +105,17 @@
 	total_clusters = 0;
 
 	if (!file.open("resource.inf")) {
-		Zdebug("InitResMan cannot *OPEN* resource.inf");
-		ExitWithReport("InitResMan cannot *OPEN* resource.inf [file=%s line=%u]", __FILE__, __LINE__);
+		error("InitResMan cannot *OPEN* resource.inf");
 	}
 
 	end = file.size();
 
-	// Zdebug("seek end %d %d", fh, end);
-
 	//get some space for the incoming resource file - soon to be trashed
 	temp = Twalloc(end, MEM_locked, UID_temp);
 
 	if (file.read(temp->ad, end) != end) {
 		file.close();
-		Zdebug("InitResMan cannot *READ* resource.inf");
-		ExitWithReport("InitResMan cannot *READ* resource.inf [file=%s line=%u]", __FILE__, __LINE__);
+		error("InitResMan cannot *READ* resource.inf");
 	}
 
 	file.close();
@@ -149,8 +145,7 @@
 
 	// now load in the binary id to res conversion table
 	if (!file.open("resource.tab")) {
-		Zdebug("InitResMan cannot *OPEN* resource.tab");
-		ExitWithReport("InitResMan cannot *OPEN* resource.tab [file=%s line=%u]", __FILE__, __LINE__);
+		error("InitResMan cannot *OPEN* resource.tab");
 	}
 
 	// find how many resources
@@ -166,15 +161,13 @@
 
 	if (file.ioFailed()) {
 		file.close();
-		Zdebug("InitResMan cannot *READ* resource.tab");
-		ExitWithReport("InitResMan cannot *READ* resource.tab [file=%s line=%u]", __FILE__, __LINE__);
+		error("InitResMan cannot *READ* resource.tab");
 	}
 
 	file.close();
 
 	if (!file.open("cd.inf")) {
-		Zdebug("InitResMan cannot *OPEN* cd.inf");
-		ExitWithReport("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
+		error("InitResMan cannot *OPEN* cd.inf");
 	}
 
 	_cd_inf *cdInf = new _cd_inf[total_clusters];
@@ -184,8 +177,7 @@
 		cdInf[j].cd = file.readByte();
 		
 		if (file.ioFailed()) {
-			Zdebug("InitResMan failed to read cd.inf. Insufficient entries?");
-			ExitWithReport("InitResMan failed to read cd.inf. Insufficient entries? [file=%s line=%u]", __FILE__, __LINE__);
+			error("InitResMan failed to read cd.inf. Insufficient entries?");
 		}
 	}
 
@@ -198,17 +190,15 @@
 			i++;
 
 		if (i == total_clusters) {
-			Zdebug("InitResMan, %s is not in cd.inf", resource_files[j]);
-			ExitWithReport("InitResMan, %s is not in cd.inf [file=%s line=%u]",resource_files[j], __FILE__, __LINE__);
+			error("InitResMan, %s is not in cd.inf",resource_files[j]);
 		} else
 			cdTab[j] = cdInf[i].cd;
 	}
 
 
-	Zdebug("\n%d resources in %d cluster files", total_res_files, total_clusters);
+	debug(5, "%d resources in %d cluster files", total_res_files, total_clusters);
 	for (j = 0; j < total_clusters; j++)
-		Zdebug("filename of cluster %d: -%s", j, resource_files[j]);
-	Zdebug("");
+		debug(5, "filename of cluster %d: -%s", j, resource_files[j]);
 
 	// create space for a list of pointers to mem's
 	resList = (mem **) malloc(total_res_files * sizeof(mem *));
@@ -241,8 +231,7 @@
 		cdDrives[index++] = 'C';
 		
 		if (index == 0) {
-			Zdebug("InitResMan, cannot find CD drive.");
-			ExitWithReport("InitResMan, cannot find CD drive. [file=%s line=%u]", __FILE__, __LINE__);
+			error("InitResMan, cannot find CD drive");
 		}
 
 		while (index < 24)
@@ -487,7 +476,7 @@
 
 		// first we have to find the file via the res_conv_table
 
-		// Zdebug("resOpen %s res %d", resource_files[parent_res_file], res);
+		debug(5, "resOpen %s res %d", resource_files[parent_res_file], res);
 
 		// ** at this point here we start to think about where the
 		// ** file is and prompt the user for the right CD to be
@@ -532,10 +521,10 @@
 		// 1st DWORD of a cluster is an offset to the look-up table
 		table_offset = file.readUint32LE();
 
-		// Zdebug("table offset = %d", table_offset);
+		debug(5, "table offset = %d", table_offset);
 
 		// 2 dwords per resource
-		file.seek(table_offset + actual_res *8, SEEK_SET);
+		file.seek(table_offset + actual_res * 8, SEEK_SET);
 		// get position of our resource within the cluster file
 		pos = file.readUint32LE();
 		// read the length
@@ -544,7 +533,7 @@
 		// ** get to position in file of our particular resource
 		file.seek(pos, SEEK_SET);
 
-		// Zdebug("res len %d", len);
+		debug(5, "res len %d", len);
 
 		// ok, we know the length so try and allocate the memory
 		// if it can't then old files will be ditched until it works
@@ -566,7 +555,7 @@
 		convertEndian((uint8 *)resList[res]->ad, len);
 #endif
 	} else {
-		// Zdebug("RO %d, already open count=%d", res, count[res]);
+		debug(5, "RO %d, already open count=%d", res, count[res]);
 	}
 
 	// number of times opened - the file won't move in memory while count
@@ -743,7 +732,7 @@
 	if (!oldest_res)
 		return 0;
 
-	// Zdebug(42,"removing %d, age %d, size %d", oldest_res, age[oldest_res], resList[oldest_res]->size);
+	debug(5, "removing %d, age %d, size %d", oldest_res, age[oldest_res], resList[oldest_res]->size);
 
 	// trash this old resource
 
@@ -921,9 +910,9 @@
 	if (age[res]) {
 		age[res] = 0;		//effectively gone from resList
 		Free_mem(resList[res]);	//release the memory too
-		// Zdebug(" - Trashing %d", res);
+		debug(5, " - Trashing %d", res);
 	} else
-		Zdebug("Remove_res(%d) not even in memory!",res);
+		debug(5, "Remove_res(%d) not even in memory!", res);
 }
 
 void resMan::Remove_all_res(void) {
@@ -978,7 +967,7 @@
 				// want info
 				if (wantInfo && console_status) {
 					Print_to_console(" nuked %5d: %s", res, header->name);
-					Zdebug(" nuked %d: %s", res, header->name);
+					debug(5, " nuked %d: %s", res, header->name);
 					Build_display();
 
 					scrolls++;
@@ -1050,7 +1039,7 @@
 					// if this was called from the console + we want info
 					if (wantInfo && console_status)	{
 						Print_to_console(" nuked %5d: %s", res, header->name);
-						Zdebug(" nuked %d: %s", res, header->name);
+						debug(5, " nuked %d: %s", res, header->name);
 						Build_display();
 
 						scrolls++;
@@ -1111,8 +1100,7 @@
 		file = fopen("cd.inf", "r+b");
 
 		if (file == NULL) {
-			Zdebug("CacheNewCluster cannot *OPEN* cd.inf");
-			Con_fatal_error("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
+			Con_fatal_error("InitResMan cannot *OPEN* cd.inf");
 		}
 
 		_cd_inf cdInf;
@@ -1122,7 +1110,6 @@
 		} while ((scumm_stricmp((char *) cdInf.clusterName, resource_files[i]) != 0) && !feof(file));
 
 		if (feof(file)) {
-			Zdebug("CacheNewCluster cannot find %s in cd.inf", resource_files[i]);
 			Con_fatal_error("CacheNewCluster cannot find %s in cd.inf", resource_files[i]);
 		}
 
@@ -1167,8 +1154,7 @@
 	outFile.open(resource_files[newCluster], NULL, File::kFileWriteMode);
 
 	if (!inFile.isOpen() || !outFile.isOpen()) {
-		Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
-		Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
+		Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
 	}
 
 	_spriteInfo textSprite;
@@ -1250,8 +1236,7 @@
 		realRead = inFile.read(buffer, BUFFERSIZE);
 		read += realRead;
 		if (outFile.write(buffer, realRead) != realRead) {
-			Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
-			Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
+			Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
 		}
 
 		if (step == stepSize) {
@@ -1283,8 +1268,7 @@
 	} while ((read % BUFFERSIZE) == 0);
 
 	if (read != size) {
-		Zdebug("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
-		Con_fatal_error("Cache new cluster could not copy %s to %s [file=%s line=%u]", buf, resource_files[newCluster], __FILE__, __LINE__);
+		Con_fatal_error("Cache new cluster could not copy %s to %s", buf, resource_files[newCluster]);
 	}
 
 	inFile.close();
@@ -1308,8 +1292,7 @@
 	file = fopen("cd.inf", "r+b");
 
 	if (file == NULL) {
-		Zdebug("CacheNewCluster cannot *OPEN* cd.inf");
-		Con_fatal_error("InitResMan cannot *OPEN* cd.inf [file=%s line=%u]", __FILE__, __LINE__);
+		Con_fatal_error("InitResMan cannot *OPEN* cd.inf");
 	}
 
 	_cd_inf cdInf;
@@ -1319,7 +1302,6 @@
 	} while (scumm_stricmp((char *) cdInf.clusterName, resource_files[newCluster]) != 0 && !feof(file));
 
 	if (feof(file)) {
-		Zdebug("CacheNewCluster cannot find %s in cd.inf", resource_files[newCluster]);
 		Con_fatal_error("CacheNewCluster cannot find %s in cd.inf", resource_files[newCluster]);
 	}
 
@@ -1386,7 +1368,7 @@
 		// must be running off the network, but still want to see
 		// CD-requests to show where they would occur when playing
 		// from CD
-		Zdebug("RUNNING OFF NETWORK");
+		debug(5, "RUNNING OFF NETWORK");
 
 		fscanf(file, "%s", cdPath);
 		fclose(file);

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/router.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- router.cpp	24 Sep 2003 06:40:22 -0000	1.15
+++ router.cpp	27 Sep 2003 11:02:57 -0000	1.16
@@ -652,9 +652,9 @@
 
 #ifdef _SWORD2_DEBUG
 		if (options == 0) {
-			Zdebug("BestTurns fail %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
-			Zdebug("BestTurns fail %d %d %d %d", turns[0], turns[1], turns[2], options);
-			Con_fatal_error("BestTurns failed (%s line %u)", __FILE__, __LINE__);
+			debug(5, "BestTurns fail %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
+			debug(5, "BestTurns fail %d %d %d %d", turns[0], turns[1], turns[2], options);
+			Con_fatal_error("BestTurns failed");
 		}
 #endif
 
@@ -670,9 +670,9 @@
 
 #ifdef _SWORD2_DEBUG
 		if (steps == 0) {
-			Zdebug("BestTurns failed %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
-			Zdebug("BestTurns failed %d %d %d %d", turns[0], turns[1], turns[2], options);
-			Con_fatal_error("BestTurns failed (%s line %u)", __FILE__, __LINE__);
+			debug(5, "BestTurns failed %d %d %d %d", route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
+			debug(5, "BestTurns failed %d %d %d %d", turns[0], turns[1], turns[2], options);
+			Con_fatal_error("BestTurns failed");
 		}
 #endif
 
@@ -935,17 +935,17 @@
 	int32 walk_pc;
 	_walkData *walkAnim;
 
-	// Zdebug("\nEARLY SLOW-OUT");
+	debug(5, "EARLY SLOW-OUT");
 
 	LoadWalkData(ob_walkdata);
 
-	// Zdebug("********************************");
-	// Zdebug("framesPerStep              =%d", framesPerStep);
-	// Zdebug("numberOfSlowOutFrames      =%d", numberOfSlowOutFrames);
-	// Zdebug("firstWalkingTurnLeftFrame  =%d", firstWalkingTurnLeftFrame);
-	// Zdebug("firstWalkingTurnRightFrame =%d", firstWalkingTurnRightFrame);
-	// Zdebug("firstSlowOutFrame          =%d", firstSlowOutFrame);
-	// Zdebug("********************************");
+	debug(5, "********************************");
+	debug(5, "framesPerStep = %d", framesPerStep);
+	debug(5, "numberOfSlowOutFrames = %d", numberOfSlowOutFrames);
+	debug(5, "firstWalkingTurnLeftFrame = %d", firstWalkingTurnLeftFrame);
+	debug(5, "firstWalkingTurnRightFrame = %d", firstWalkingTurnRightFrame);
+	debug(5, "firstSlowOutFrame = %d", firstSlowOutFrame);
+	debug(5, "********************************");
 
  	walk_pc  = ob_mega->walk_pc;
 
@@ -958,8 +958,8 @@
 		// (ie .step - 0..5)
 
 		do {
-			// Zdebug("\nSTEP NUMBER:    walkAnim[%d].step  = %d", walk_pc, walkAnim[walk_pc].step);
-			// Zdebug("ORIGINAL FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
+			debug(5, "STEP NUMBER: walkAnim[%d].step = %d", walk_pc, walkAnim[walk_pc].step);
+			debug(5, "ORIGINAL FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
 
 			// map from existing walk frame across to correct
 			// frame number of slow-out - remember, there may be
@@ -971,29 +971,27 @@
 				// frame first
 
 				walkAnim[walk_pc].frame -= firstWalkingTurnRightFrame;
-				// Zdebug("MAPPED TO WALK: walkAnim[%d].frame = %d  (walking turn-right frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
+				debug(5, "MAPPED TO WALK: walkAnim[%d].frame = %d  (walking turn-right frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
 			} else if (walkAnim[walk_pc].frame >= firstWalkingTurnLeftFrame) {
 				// if it's a walking turn-left, rather than a
 				// normal step, then map it to a normal step
 				// frame first
 
 				walkAnim[walk_pc].frame -= firstWalkingTurnLeftFrame;
-				// Zdebug("MAPPED TO WALK: walkAnim[%d].frame = %d  (walking turn-left frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
+				debug(5, "MAPPED TO WALK: walkAnim[%d].frame = %d  (walking turn-left frame --> walk frame)", walk_pc, walkAnim[walk_pc].frame);
 			}
 
 			walkAnim[walk_pc].frame += firstSlowOutFrame + ((walkAnim[walk_pc].frame / framesPerStep) * (numberOfSlowOutFrames - framesPerStep));
 			walkAnim[walk_pc].step = 0;
-			// Zdebug("SLOW-OUT FRAME: walkAnim[%d].frame = %d",walk_pc, walkAnim[walk_pc].frame);
+			debug(5, "SLOW-OUT FRAME: walkAnim[%d].frame = %d",walk_pc, walkAnim[walk_pc].frame);
 			walk_pc++;
 		} while(walkAnim[walk_pc].step > 0);
 
-		// Zdebug("\n");
-
 		// add stationary frame(s) (OPTIONAL)
 
 		for (slowOutFrameNo = framesPerStep; slowOutFrameNo < numberOfSlowOutFrames; slowOutFrameNo++) {
 			walkAnim[walk_pc].frame = walkAnim[walk_pc - 1].frame + 1;
-			// Zdebug("EXTRA FRAME:    walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
+			debug(5, "EXTRA FRAME: walkAnim[%d].frame = %d", walk_pc, walkAnim[walk_pc].frame);
 			walkAnim[walk_pc].step = 0;
 			walkAnim[walk_pc].dir = walkAnim[walk_pc - 1].dir;
 			walkAnim[walk_pc].x = walkAnim[walk_pc - 1].x;
@@ -1034,7 +1032,7 @@
 	
 		slowOutFrameNo = lastCount - framesPerStep;
 
-		// Zdebug("SLOW OUT: slowOutFrameNo(%d) = lastCount(%d) - framesPerStep(%d)", slowOutFrameNo, lastCount, framesPerStep);
+		debug(5, "SLOW OUT: slowOutFrameNo(%d) = lastCount(%d) - framesPerStep(%d)", slowOutFrameNo, lastCount, framesPerStep);
 	
 		// overwrite the last step (half a cycle) of the walk
 
@@ -1048,7 +1046,7 @@
 			// because no longer a normal walk-step
 			walkAnim[slowOutFrameNo].step = 0;
 
-			//Zdebug("walkAnim[%d].frame = %d",slowOutFrameNo,walkAnim[slowOutFrameNo].frame);
+			debug(5, "walkAnim[%d].frame = %d",slowOutFrameNo,walkAnim[slowOutFrameNo].frame);
 			slowOutFrameNo++;
 		} while(slowOutFrameNo < lastCount);
 	
@@ -1057,7 +1055,7 @@
 		for (slowOutFrameNo = framesPerStep; slowOutFrameNo < numberOfSlowOutFrames; slowOutFrameNo++) {
 			walkAnim[stepCount].frame = walkAnim[stepCount - 1].frame + 1;
 
-			// Zdebug("EXTRA FRAMES: walkAnim[%d].frame = %d", stepCount, walkAnim[stepCount].frame);
+			debug(5, "EXTRA FRAMES: walkAnim[%d].frame = %d", stepCount, walkAnim[stepCount].frame);
 
 			walkAnim[stepCount].step = 0;
 			walkAnim[stepCount].dir = walkAnim[stepCount - 1].dir;
@@ -1117,7 +1115,7 @@
 	// START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
 	// BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
 
-	// Zdebug("\nSLIDY: STARTING THE WALK");
+	debug(5, "SLIDY: STARTING THE WALK");
 
 	module = framesPerChar + lastDir;
 	walkAnim[stepCount].frame = module;
@@ -1129,7 +1127,7 @@
 
 	// TURN TO START THE WALK
 
-	// Zdebug("\nSLIDY: TURNING TO START THE WALK");
+	debug(5, "SLIDY: TURNING TO START THE WALK");
 	// rotate if we need to
 
 	if (lastDir != currentDir) {
@@ -1199,7 +1197,7 @@
 
 	// THE WALK
 
-	// Zdebug("\nSLIDY: THE WALK");
+	debug(5, "SLIDY: THE WALK");
 
 	// start the walk on the left or right leg, depending on how the
 	// slow-in frames were drawn
@@ -1393,7 +1391,7 @@
 
 #ifdef _SWORD2_DEBUG
 	if (lastRealDir == 99)
-		Con_fatal_error("SlidyWalkAnimatorlast direction error (%s line %u)", __FILE__, __LINE__);
+		Con_fatal_error("SlidyWalkAnimatorlast direction error");
 #endif
 
 	// THE SLOW OUT
@@ -1504,15 +1502,13 @@
 	walkAnim[stepCount].frame = 512;
 	walkAnim[stepCount].step = 99;
 
-#ifdef _SWORD2_DEBUG
 	// write all the frames to "debug.txt"
-	// Zdebug("\nTHE WALKDATA:");
+	debug(5, "THE WALKDATA:");
 
 	for (frame = 0; frame <= stepCount; frame++)
-		Zdebug("walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
-#endif
+		debug(5, "walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
 
-	// Zdebug("RouteFinder RouteSize is %d", stepCount);
+	debug(5, "RouteFinder RouteSize is %d", stepCount);
 	return;
 }
 
@@ -1632,7 +1628,7 @@
 	// START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
 	// BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
 
-	//Zdebug("\nSOLID: STARTING THE WALK");
+	debug(5, "SOLID: STARTING THE WALK");
 	walkAnim[stepCount].frame = module;
 	walkAnim[stepCount].step = 0;
 	walkAnim[stepCount].dir = lastDir;
@@ -1642,7 +1638,7 @@
 
 	// TURN TO START THE WALK
 
-	// Zdebug("\nSOLID: TURNING TO START THE WALK");
+	debug(5, "SOLID: TURNING TO START THE WALK");
 
 	// rotate if we need to
 
@@ -1712,7 +1708,7 @@
 
 	// THE WALK
 
-	// Zdebug("\nSOLID: THE WALK");
+	debug(5, "SOLID: THE WALK");
 
 	// start the walk on the left or right leg, depending on how the
 	// slow-in frames were drawn
@@ -1879,17 +1875,14 @@
 	walkAnim[stepCount].frame = 512;
 	walkAnim[stepCount].step = 99;
 
-#ifdef _SWORD2_DEBUG
-	// write all the frames to "debug.txt"
-	//Zdebug("\nTHE WALKDATA:");
+	debug(5, "THE WALKDATA:");
 
 	for (frame = 0; frame <= stepCount; frame++)
-		Zdebug("walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
-#endif
+		debug(5, "walkAnim[%d].frame=%d", frame, walkAnim[frame].frame);
 
 	// NO END TURNS
 
-	// Zdebug("RouteFinder RouteSize is %d", stepCount);
+	debug(5, "RouteFinder RouteSize is %d", stepCount);
 	// now check the route
 
 	i = 0;
@@ -1905,7 +1898,7 @@
 		if (CheckTarget(moduleX, moduleY) == 3) {
 			// new target on a line
 			p = 0;
-			// Zdebug("Solid walk target was on a line %d %d", moduleX, moduleY);
+			debug(5, "Solid walk target was on a line %d %d", moduleX, moduleY);
 		}
 	}
 
@@ -2403,7 +2396,7 @@
 				if (yc >= ymin && yc <= ymax) {
 					// target on a line so drop out
 					onLine = 3;
-					// Zdebug("RouteFail due to target on a line %d %d", x, y);
+					debug(5, "RouteFail due to target on a line %d %d", x, y);
 				} else {
 					// vertical line so we know it overlaps y
 					if (bars[i].dy == 0)
@@ -2417,7 +2410,7 @@
 					if (xc >= xmin && xc <= xmax) {
 						// target on a line so drop out
 						onLine = 3;
-						// Zdebug("RouteFail due to target on a line %d %d", x, y);
+						debug(5, "RouteFail due to target on a line %d %d", x, y);
 					}
 				}
 			}
@@ -2755,14 +2748,14 @@
 			// allowed in the complete walkgrid arrays
 
 			if (nbars + theseBars >= O_GRID_SIZE)
-				Con_fatal_error("Adding walkgrid(%d): %d+%d bars exceeds max %d (%s line %u)",
+				Con_fatal_error("Adding walkgrid(%d): %d+%d bars exceeds max %d",
 					walkGridList[entry], nbars, theseBars,
-					O_GRID_SIZE, __FILE__, __LINE__);
+					O_GRID_SIZE);
 
 			if (nnodes + theseNodes >= O_GRID_SIZE)
-				Con_fatal_error("Adding walkgrid(%d): %d+%d nodes exceeds max %d (%s line %u)",
+				Con_fatal_error("Adding walkgrid(%d): %d+%d nodes exceeds max %d",
 					walkGridList[entry], nnodes, theseBars,
-					O_GRID_SIZE, __FILE__, __LINE__);
+					O_GRID_SIZE);
 #endif
 
 			// lines
@@ -2836,7 +2829,7 @@
 		if (entry < MAX_WALKGRIDS)
 			walkGridList[entry] = gridResource;
 		else
-			Con_fatal_error("ERROR: walkGridList[] full in %s line %d", __FILE__, __LINE__);
+			Con_fatal_error("ERROR: walkGridList[] full");
 	}
 }
 

Index: save_rest.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/save_rest.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- save_rest.cpp	26 Sep 2003 10:07:18 -0000	1.18
+++ save_rest.cpp	27 Sep 2003 11:02:57 -0000	1.19
@@ -455,16 +455,7 @@
 
 	// Write to walkthrough file (zebug0.txt)
 
-#ifdef _SWORD2_DEBUG
-	Zdebug(0, "*************************************");
-	Zdebug(0, "RESTORED GAME \"%s\"", g_header.description);
-	Zdebug(0, "*************************************");
-
-	// Also write this to system debug file
- 	Zdebug("*************************************");
-	Zdebug("RESTORED GAME \"%s\"", g_header.description);
-	Zdebug("*************************************");
-#endif
+	debug(5, "RESTORED GAME \"%s\"", g_header.description);
 
 	// game restored ok
 	return SR_OK;
@@ -528,7 +519,7 @@
 	head = (_standardHeader*) res_man.Res_open(CUR_PLAYER_ID);
 
 	if (head->fileType != GAME_OBJECT)
-		Con_fatal_error("incorrect CUR_PLAYER_ID=%d (%s line %u)", CUR_PLAYER_ID, __FILE__, __LINE__);
+		Con_fatal_error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
 
 	raw_script_ad = (char *) head;
 	RunScript(raw_script_ad, raw_script_ad, &null_pc);
@@ -547,7 +538,7 @@
 	head = (_standardHeader*) res_man.Res_open(CUR_PLAYER_ID);
 
 	if (head->fileType != GAME_OBJECT)
-		Con_fatal_error("incorrect CUR_PLAYER_ID=%d (%s line %u)", CUR_PLAYER_ID, __FILE__, __LINE__);
+		Con_fatal_error("incorrect CUR_PLAYER_ID=%d", CUR_PLAYER_ID);
 
 	raw_script_ad = (char *) head;
 

Index: scroll.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/scroll.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- scroll.cpp	26 Sep 2003 10:07:18 -0000	1.4
+++ scroll.cpp	27 Sep 2003 11:02:57 -0000	1.5
@@ -18,6 +18,7 @@
  */
 
 #include "stdafx.h"
+#include "driver/driver96.h"
 #include "debug.h"
 #include "defs.h"
 #include "header.h"
@@ -81,7 +82,7 @@
 		// immediately!
 
 		if (this_screen.scroll_flag == 2) {
-			// Zdebug(42,"init scroll");
+			debug(5, "init scroll");
 			this_screen.scroll_offset_x = offset_x;
 			this_screen.scroll_offset_y = offset_y;
 			this_screen.scroll_flag = 1;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sound.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- sound.cpp	26 Sep 2003 10:07:18 -0000	1.17
+++ sound.cpp	27 Sep 2003 11:02:57 -0000	1.18
@@ -129,10 +129,8 @@
 		}
 	}
 
-#ifdef _SWORD2_DEBUG
 	if (rv)
-		Zdebug("SFX ERROR: PlayFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
-#endif
+		debug(5, "SFX ERROR: PlayFx() returned %.8x", rv);
 }
 
 // called from script only
@@ -177,7 +175,7 @@
 			strcpy(type, "INVALID");
 		}
 
-		Zdebug("SFX (sample=\"%s\", vol=%d, pan=%d, delay=%d, type=%s)", FetchObjectName(params[0]), params[3], params[4], params[2], type);
+		debug(5, "SFX (sample=\"%s\", vol=%d, pan=%d, delay=%d, type=%s)", FetchObjectName(params[0]), params[3], params[4], params[2], type);
 	}
 #endif
 
@@ -211,7 +209,7 @@
 #ifdef _SWORD2_DEBUG
 		header = (_standardHeader*) data;
 		if (header->fileType != WAV_FILE)
-			Con_fatal_error("FN_play_fx given invalid resource (%s line %u)", __FILE__, __LINE__);
+			Con_fatal_error("FN_play_fx given invalid resource");
 #endif
 
 		// but then releases it to "age" out if the space is needed
@@ -227,7 +225,7 @@
 #ifdef _SWORD2_DEBUG
 		header = (_standardHeader*)data;
 		if (header->fileType != WAV_FILE)
-			Con_fatal_error("FN_play_fx given invalid resource (%s line %u)", __FILE__, __LINE__);
+			Con_fatal_error("FN_play_fx given invalid resource");
 #endif
 
 		data += sizeof(_standardHeader);
@@ -235,10 +233,8 @@
 		// copy it to sound memory, using position in queue as 'id'
 		rv = g_sound->OpenFx(id, data);
 
-#ifdef _SWORD2_DEBUG
 		if (rv)
-			Zdebug("SFX ERROR: OpenFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
-#endif
+			debug(5, "SFX ERROR: OpenFx() returned %.8x", rv);
 
 		// release the sample
 		res_man.Res_close(fxq[j].resource);
@@ -271,7 +267,7 @@
 	//		1 new volume (0..16)
 	//		2 new pan (-16..16)
 
-	// Zdebug("%d", params[2]);
+	debug(5, "FN_set_fx_vol_and_pan(%d, %d, %d)", params[0], params[1], params[2]);
 
 	// SetFxVolumePan(int32 id, uint8 vol, uint8 pan);
 	// driver fx_id is 1 + <pos in queue>
@@ -310,10 +306,8 @@
 		// stop fx & remove sample from sound memory
 		rv = g_sound->CloseFx(id);
 
-#ifdef _SWORD2_DEBUG
 		if (rv)
-			Zdebug("SFX ERROR: CloseFx() returned %.8x (%s line %u)", rv, __FILE__, __LINE__);
-#endif
+			debug(5, "SFX ERROR: CloseFx() returned %.8x", rv);
 	}
 
 	// remove from queue
@@ -379,7 +373,7 @@
 	bool loopFlag;
 	uint32 rv;
 
-	// Zdebug("FN_play_music(%d)", params[0]);
+	debug(5, "FN_play_music(%d, %d)", params[0], params[1]);
 
 	if (params[1] == FX_LOOP) {
 		loopFlag = true;
@@ -414,12 +408,8 @@
 
 	rv = g_sound->StreamCompMusic(filename, params[0], loopFlag);
 
-#ifdef _SWORD2_DEBUG
-		if (rv)
-	 		Zdebug("ERROR: StreamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
-#endif
-
-	// Zdebug("FN_play_music(%d) returning", params[0]);
+	if (rv)
+		debug(5, "ERROR: StreamCompMusic(%s, %d, %d) returned error 0x%.8x", filename, params[0], loopFlag, rv);
 
 	return IR_CONT;
 }
@@ -454,15 +444,15 @@
 
 	rv = g_sound->PauseMusic();
 	if (rv != RD_OK)
-		Zdebug("ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv);
+		debug(5, "ERROR: PauseMusic() returned %.8x in PauseAllSound()", rv);
 
 	rv = g_sound->PauseSpeech();
 	if (rv != RD_OK)
-		Zdebug("ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv);
+		debug(5, "ERROR: PauseSpeech() returned %.8x in PauseAllSound()", rv);
 
 	rv = g_sound->PauseFx();
 	if (rv != RD_OK)
-		Zdebug("ERROR: PauseFx() returned %.8x in PauseAllSound()", rv);
+		debug(5, "ERROR: PauseFx() returned %.8x in PauseAllSound()", rv);
 }
 
 void UnpauseAllSound(void) {
@@ -470,13 +460,13 @@
 
 	rv = g_sound->UnpauseMusic();
 	if (rv != RD_OK)
-		Zdebug("ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv);
+		debug(5, "ERROR: UnpauseMusic() returned %.8x in UnpauseAllSound()", rv);
 
 	rv = g_sound->UnpauseSpeech();
 	if (rv != RD_OK)
-		Zdebug("ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv);
+		debug(5, "ERROR: UnpauseSpeech() returned %.8x in UnpauseAllSound()", rv);
 
 	rv = g_sound->UnpauseFx();
  	if (rv != RD_OK)
-		Zdebug("ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv);
+		debug(5, "ERROR: UnpauseFx() returned %.8x in UnpauseAllSound()", rv);
 }

Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- speech.cpp	26 Sep 2003 10:07:18 -0000	1.22
+++ speech.cpp	27 Sep 2003 11:02:57 -0000	1.23
@@ -128,7 +128,7 @@
 		subject_list[IN_SUBJECT].res = params[0];
 		subject_list[IN_SUBJECT].ref = params[1];
 
-		// Zdebug("FN_add_subject res %d, uid %d", params[0], params[1]);
+		debug(5, "FN_add_subject res %d, uid %d", params[0], params[1]);
 
 		IN_SUBJECT++;
 	}
@@ -149,12 +149,11 @@
 	uint8 *icon;
 	uint32 pos = 0;
 
-	// Zdebug("into choose");
+	debug(5, "FN_choose");
 
 	AUTO_SELECTED = 0;	// see below
 
 	// new thing to intercept objects held at time of clicking on a person
-	// (James 06may97)
 
 	if (OBJECT_HELD) {
 		// If we are using a luggage icon on the person, scan the
@@ -194,7 +193,6 @@
 	}
 
 	// new thing for skipping chooser with "nothing else to say" text
-	// (James 23may97)
 
 	// If this is the 1st time the chooser is coming up in this
 	// conversation, AND there's only 1 subject, AND it's the EXIT icon
@@ -220,13 +218,13 @@
 
 		for (j = 0; j < 15; j++) {
 			if (j < IN_SUBJECT) {
-				// Zdebug(" ICON res %d for %d", subject_list[j].res, j);
+				debug(5, " ICON res %d for %d", subject_list[j].res, j);
 				icon = res_man.Res_open(subject_list[j].res) + sizeof(_standardHeader) + RDMENU_ICONWIDE * RDMENU_ICONDEEP;
 				SetMenuIcon(RDMENU_BOTTOM, (uint8) j, icon);
 				res_man.Res_close(subject_list[j].res);
 			} else {
 				//no icon here
-				//Zdebug(" NULL for %d", j);
+				debug(5, " NULL for %d", j);
 				SetMenuIcon(RDMENU_BOTTOM, (uint8) j, NULL);
 			}
 		}
@@ -243,7 +241,7 @@
 		return IR_REPEAT;
 	} else {
 		// menu is there - we're just waiting for a click
-		// Zdebug("choosing");
+		debug(5, "choosing");
 
 		me = MouseEvent();
 
@@ -261,20 +259,11 @@
 
 				//clicked on something - what button?
 				if (hit < IN_SUBJECT) {
-#ifdef _SWORD2_DEBUG
-					// Write to walkthrough file
-					// (zebug0.txt)
- 					Zdebug(0, "----------------------");
-					Zdebug(0, "Icons available:");
-#endif
+					debug(5, "Icons available:");
 
 					// change icons
 					for (j = 0; j < IN_SUBJECT; j++) {
-#ifdef _SWORD2_DEBUG
-						// Write to walkthrough file
-						// (zebug0.txt)
-						Zdebug(0, "%s", FetchObjectName(subject_list[j].res));
-#endif
+						debug(5, "%s", FetchObjectName(subject_list[j].res));
 
 						// change all others to grey
 						if (j != hit) {
@@ -285,12 +274,7 @@
 					}
 
 
-#ifdef _SWORD2_DEBUG
-					// Write to walkthrough file
-					// (zebug0.txt)
-					Zdebug(0, "Selected: %s", FetchObjectName(subject_list[hit].res));
-					Zdebug(0, "----------------------");
-#endif
+					debug(5, "Selected: %s", FetchObjectName(subject_list[hit].res));
 
 					// this is our looping flag
 					choosing = 0;
@@ -300,7 +284,7 @@
 					// blank mouse again
 					Set_mouse(0);
 
-					// Zdebug("hit %d - ref %d  ref*8 %d", hit, subject_list[hit].ref, subject_list[hit].ref * 8);
+					debug(5, "hit %d - ref %d  ref*8 %d", hit, subject_list[hit].ref, subject_list[hit].ref * 8);
 
 					// for non-speech scripts that manually
 					// call the chooser
@@ -311,7 +295,9 @@
 				}
 			}
 		}
-		// Zdebug("end choose");
+
+		debug(5, "end choose");
+
 		// again next cycle
 		return IR_REPEAT;
 	}
@@ -325,7 +311,7 @@
 
 	// params:	none
 
-	// Zdebug("FN_start_conversation %d", ID);
+	debug(5, "FN_start_conversation %d", ID);
 
 	// reset 'chooser_count_flag' at the start of each conversation:
 
@@ -350,14 +336,14 @@
 	// FN_idle();
 	// params:	none
 
-	// Zdebug("FN_end_conversation");
+	debug(5, "FN_end_conversation");
 
 	HideMenu(RDMENU_BOTTOM);
 
 	if (mousey > 399) {
 		// will wait for cursor to move off the bottom menu
 		mouse_mode = MOUSE_holding;
-		Zdebug("   holding");
+		debug(5, "   holding");
 	}
 
 	TALK_FLAG = 0;	//in-case DC forgets
@@ -446,7 +432,7 @@
 	_standardHeader	*head;
 	int32 target = params[1];
 
-	// Zdebug("FN_they_do_we_wait id %d, command %d", params[1], params[2]);
+	debug(5, "FN_they_do_we_wait id %d, command %d", params[1], params[2]);
 
 	// ok, see if the target is busy - we must request this info from the
 	// target object
@@ -467,7 +453,7 @@
 	if (!INS_COMMAND && RESULT == 1 && ob_logic->looping == 0) {
 		// first time so set up targets command if target is waiting
 
-		// Zdebug("FNtdww sending command to %d", target);
+		debug(5, "FNtdww sending command to %d", target);
 
 		SPEECH_ID = params[1];
 		INS_COMMAND = params[2];
@@ -500,7 +486,8 @@
 
 	if (RESULT == 1) {
 		// its waiting now so we can be finished with all this
-		// Zdebug("FNtdww finished");
+		debug(5, "FNtdww finished");
+
 		// not looping anymore
 		ob_logic->looping = 0;
 
@@ -510,7 +497,7 @@
 		return IR_CONT;
 	}
 
-	// Zdebug("FNtdww just waiting");
+	debug(5, "FNtdww just waiting");
 
 	// debug flag to indicate who we're waiting for - see debug.cpp
 	speechScriptWaiting = target;
@@ -614,7 +601,7 @@
 		// none of this should ever happen
 		Kill_all_ids_events(target);
 
-		Zdebug("EVENT timed out");
+		debug(5, "EVENT timed out");
 
 		// reset debug flag now that we're no longer waiting - see
 		// debug.cpp
@@ -655,7 +642,7 @@
 
 	ob_speech = (Object_speech *) params[1];
 
-	// Zdebug("  SP");
+	debug(5, "  SP");
 
 	while(1) {
 		//we are currently running a command
@@ -674,13 +661,14 @@
 			pars[7] = ob_speech->ins4;	// anim table res id
 			pars[8] = ob_speech->ins5;	// animation mode - 0 lip synced, 1 just straight animation
 
-			// Zdebug("speech-process talk");
+			debug(5, "speech-process talk");
 
 			// run the function - (it thinks it's been called from
 			// script - bloody fool)
 
 			if (FN_i_speak(pars) != IR_REPEAT) {
-				// Zdebug("speech-process talk finished");
+				debug(5, "speech-process talk finished");
+
 				// command finished
 				ob_speech->command = 0;
 
@@ -816,7 +804,8 @@
 			pars[6] = ob_speech->ins3;	// target direction
 
 			if (FN_walk(pars) != IR_REPEAT) {
-				// Zdebug("speech-process walk finished");
+				debug(5, "speech-process walk finished");
+
 				// command finished
 				ob_speech->command = 0;
 
@@ -834,7 +823,8 @@
 			pars[4] = ob_speech->ins1;	// anim resource
 
 			if (FN_walk_to_anim(pars) != IR_REPEAT) {
-				// Zdebug("speech-process walk finished");
+				debug(5, "speech-process walk finished");
+
 				// command finished
 				ob_speech->command = 0;
 
@@ -861,7 +851,8 @@
 			ob_speech->wait_state = 1;	// waiting for command
 			return IR_REPEAT;		// come back again next cycle
 		case INS_quit:
-			// Zdebug("speech-process - quit");
+			debug(5, "speech-process - quit");
+
 			ob_speech->command = 0;		// finish with all this
 			// ob_speech->wait_state = 0;	// start with waiting for command next conversation
 			return IR_CONT;			// thats it, we're finished with this
@@ -894,7 +885,7 @@
 			// now busy
 			ob_speech->wait_state = 0;
 
-			// Zdebug("received new command %d", INS_COMMAND);
+			debug(5, "received new command %d", INS_COMMAND);
 
 			// we'll drop off and be caught by the while(1), so
 			// kicking in the new command straight away
@@ -1088,17 +1079,13 @@
 		// can't right-click past the text for the first quarter second
 		right_click_delay = 3;
 
-#ifdef _SWORD2_DEBUG
 		// Write to walkthrough file (zebug0.txt)
 		// if (player_id != george), then player is controlling Nico
 
-		// Oh, really? I thought Nico used the same object...
-
 		if (PLAYER_ID != CUR_PLAYER_ID)
-			Zdebug(0, "(%d) Nico: %s", officialTextNumber, text + 2);
+			debug(5, "(%d) Nico: %s", officialTextNumber, text + 2);
 		else
-			Zdebug(0, "(%d) %s: %s", officialTextNumber, FetchObjectName(ID), text + 2);
-#endif
+			debug(5, "(%d) %s: %s", officialTextNumber, FetchObjectName(ID), text + 2);
 
 		// Set up the speech animation
 
@@ -1222,9 +1209,7 @@
 				// this next cycle, don't know yet)
 				g_sound->UnpauseSpeech();
 			} else {
-#ifdef _SWORD2_DEBUG
-				Zdebug("ERROR: PlayCompSpeech(speechFile=\"%s\", wav=%d (res=%d pos=%d)) returned %.8x", speechFile, params[S_WAV], text_res, local_text, rv);
-#endif
+				debug(5, "ERROR: PlayCompSpeech(speechFile=\"%s\", wav=%d (res=%d pos=%d)) returned %.8x", speechFile, params[S_WAV], text_res, local_text, rv);
 			}
 		}
 
@@ -1576,8 +1561,7 @@
 		speech_time = strlen((char *) text) + 30;
 	} else {
 		// no text line passed? - this is bad
-		// Zdebug(9, "no text line for speech wav %d", params[S_WAV]);
-		Zdebug("no text line for speech wav %d", params[S_WAV]);
+		debug(5, "no text line for speech wav %d", params[S_WAV]);
 	}
 }
 

Index: startup.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/startup.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- startup.cpp	26 Sep 2003 10:07:18 -0000	1.13
+++ startup.cpp	27 Sep 2003 11:02:57 -0000	1.14
@@ -66,10 +66,10 @@
 
 	total_startups = 0;	// no starts
 
-	Zdebug("initialising start menu");
+	debug(5, "initialising start menu");
 
 	if (!(end = Read_file("startup.inf", &temp, UID_temp))) {
-		Zdebug("Init_start_menu cannot open startup.inf");
+		debug(5, "Init_start_menu cannot open startup.inf");
 		return 0;	// meaning no start menu available
 	}
 
@@ -96,7 +96,7 @@
 		total_screen_managers++;
 
 		if (total_screen_managers == MAX_starts) {
-			Zdebug("WARNING MAX_starts exceeded!");
+			debug(5, "WARNING MAX_starts exceeded!");
 			break;
 		}
 	} while (j <end);
@@ -104,7 +104,7 @@
 	// using this method the Gode generated resource.inf must have #0d0a
 	// on the last entry
 
-	Zdebug("%d screen manager objects", total_screen_managers);
+	debug(5, "%d screen manager objects", total_screen_managers);
 
 	// Open each object and make a query call. The object must fill in a
 	// startup structure. It may fill in several if it wishes - for
@@ -114,7 +114,7 @@
 	for (j = 0; j < total_screen_managers; j++) {
 		res = atoi(ascii_start_ids[j]);
 
-		Zdebug("+querying screen manager %d", res);
+		debug(5, "+querying screen manager %d", res);
 
 		// resopen each one and run through the interpretter
 		// script 0 is the query request script
@@ -125,16 +125,15 @@
 		// start list
 
 		if (res_man.Res_check_valid(res)) {
-			Zdebug("- resource %d ok", res);
+			debug(5, "- resource %d ok", res);
 			raw_script = (char*) res_man.Res_open(res);
 			null_pc = 0;
 			RunScript(raw_script, raw_script, &null_pc);
 			res_man.Res_close(res);
 		} else
-			Zdebug("- resource %d invalid", res);
+			debug(5, "- resource %d invalid", res);
 	}
 
-	Zdebug("");	// line feed
 	Free_mem(temp);	// release the Talloc
 
 	return 1;
@@ -144,15 +143,15 @@
 	// params:	0 id of startup script to call - key
 	// 		1 pointer to ascii message
 
-	// Zdebug(" FN_register_start_point %d %s", params[0], params[1]);
+	debug(5, " FN_register_start_point %d %s", params[0], params[1]);
 
 #ifdef _SWORD2_DEBUG
 	if (total_startups == MAX_starts)
-		Con_fatal_error("ERROR: start_list full [%s line %u]", __FILE__, __LINE__);
+		Con_fatal_error("ERROR: start_list full");
 
 	// +1 to allow for NULL terminator
 	if (strlen((char*) params[1]) + 1 > MAX_description)
-		Con_fatal_error("ERROR: startup description too long [%s line %u]", __FILE__, __LINE__);
+		Con_fatal_error("ERROR: startup description too long");
 #endif
 
 	// this objects id

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- sword2.cpp	26 Sep 2003 10:07:18 -0000	1.39
+++ sword2.cpp	27 Sep 2003 11:02:57 -0000	1.40
@@ -132,65 +132,60 @@
 
 	// get some falling RAM and put it in your pocket, never let it slip
 	// away
-	// Zdebug("CALLING: Init_memory_manager");
+
+	debug(5, "CALLING: Init_memory_manager");
 	Init_memory_manager();
-	// Zdebug("RETURNED.");
 
 	// initialise the resource manager
-	// Zdebug("CALLING: res_man.InitResMan");
+	debug(5, "CALLING: res_man.InitResMan");
 	res_man.InitResMan();
-	Zdebug("RETURNED from res_man.InitResMan");
 
 	// initialise global script variables
 	// res 1 is the globals list
 	file = res_man.Res_open(1);
-	// Zdebug("CALLING: SetGlobalInterpreterVariables");
+	debug(5, "CALLING: SetGlobalInterpreterVariables");
 	SetGlobalInterpreterVariables((int32 * ) (file + sizeof(_standardHeader)));
-	// Zdebug("RETURNED.");
+
 	// DON'T CLOSE VARIABLES RESOURCE - KEEP IT OPEN AT VERY START OF
 	// MEMORY SO IT CAN'T MOVE!
-	// res_man.Res_close(1);
 
 	// DON'T CLOSE PLAYER OBJECT RESOURCE - KEEP IT OPEN IN MEMORY SO IT
 	// CAN'T MOVE!
+
 	file = res_man.Res_open(8);
 
 	// Set up font resource variables for this language version
-	// (James31july97)
-	// Zdebug("CALLING: InitialiseFontResourceFlags");
+
+	debug(5, "CALLING: InitialiseFontResourceFlags");
 	InitialiseFontResourceFlags();
-	// Also set the windows application name to the proper game name
-	// Zdebug("RETURNED.");
 
 	// set up the console system
-	// Zdebug("CALLING: Init_console");
+
+	debug(5, "CALLING: Init_console");
 	Init_console();
-	// Zdebug("RETURNED.");
 
 #ifdef _SWORD2_DEBUG
 	// read in all the startup information
-	// Zdebug("CALLING: Init_start_menu");
+
+	debug(5, "CALLING: Init_start_menu");
 	Init_start_menu();
-	// Zdebug("RETURNED from Init_start_menu");
 #endif
 
 	// no blocs live
-	// Zdebug("CALLING: Init_text_bloc_system");
+
+	debug(5, "CALLING: Init_text_bloc_system");
 	Init_text_bloc_system();
-	// Zdebug("RETURNED.");
 
-	// Zdebug("CALLING: Init_sync_system");
+	debug(5, "CALLING: Init_sync_system");
 	Init_sync_system();
-	// Zdebug("RETURNED.");
 
-	// Zdebug("CALLING: Init_event_system");
+	debug(5, "CALLING: Init_event_system");
 	Init_event_system();
-	// Zdebug("RETURNED.");
 	
 	// initialise the sound fx queue
-	// Zdebug("CALLING: Init_fx_queue");
+
+	debug(5, "CALLING: Init_fx_queue");
 	Init_fx_queue();
-	// Zdebug("RETURNED.");
 
 	// all demos (not just web)
 	if (_gameId == GID_SWORD2_DEMO) {
@@ -202,7 +197,7 @@
 }
 
 void Close_game() {
-	// Zdebug("Close_game() STARTING:");
+	debug(5, "Close_game() STARTING:");
 	EraseBackBuffer();
 
 	// Stop music instantly!
@@ -211,8 +206,6 @@
 	// free the memory again
 	Close_memory_manager();
 	res_man.Close_ResMan();
-
-	// Zdebug("Close_game() DONE.");
 }
 
 int32 GameCycle(void) {
@@ -261,8 +254,6 @@
 	uint8 breakOut = 0;
 	_keyboardEvent ke;
 
-	// Zdebug("[%s]", lpCmdLine);
-
 	// Call the application "Revolution" until the resource manager is
 	// ready to dig the name out of a text file. See InitialiseGame()
 	// which calls InitialiseFontResourceFlags() in maketext.cpp
@@ -277,7 +268,7 @@
 		_system->property(OSystem::PROP_SET_GFX_MODE, &prop);
 	}
 
-	// Zdebug("CALLING: InitialiseDisplay");
+	debug(5, "CALLING: InitialiseDisplay");
 	_system->init_size(640, 480);
 	rv = InitialiseDisplay(640, 480, 8, RD_FULLSCREEN);
 
@@ -287,27 +278,21 @@
 			_system->property(OSystem::PROP_TOGGLE_FULLSCREEN, 0);
 	}
 		
-	// Zdebug("RETURNED with rv = %.8x", rv);
-
 	if (rv != RD_OK) {
 		// ReportDriverError(rv);
 		CloseAppWindow();
 		return;
 	}
 
-	// Zdebug("CALLING: ReadOptionSettings");
+	debug(5, "CALLING: ReadOptionSettings");
 	ReadOptionSettings();	//restore the menu settings
-	// Zdebug("RETURNED.");
-	// Zdebug("CALLING: InitialiseGame");
 
+	debug(5, "CALLING: InitialiseGame");
 	if (InitialiseGame()) {
-		Zdebug("RETURNED from InitialiseGame - closing game");
 		CloseAppWindow();
 		return;
 	}
 
- 	// Zdebug("RETURNED from InitialiseGame - ok");
-
 	if (_saveSlot != -1) {
 		if (SaveExists(_saveSlot))
 			RestoreGame(_saveSlot);
@@ -319,9 +304,8 @@
 	} else
 		Start_game();
 
-	// Zdebug("CALLING: InitialiseRenderCycle");
+	debug(5, "CALLING: InitialiseRenderCycle");
 	InitialiseRenderCycle();
-	// Zdebug("RETURNED.");
 
 	while (1) {
 		ServiceWindows();
@@ -449,7 +433,7 @@
 
 	int screen_manager_id;
 
-	Zdebug("Start_game() STARTING:");
+	debug(5, "Start_game() STARTING:");
 
 	// all demos not just web
 	if (_gameId == GID_SWORD2_DEMO)
@@ -486,7 +470,7 @@
 	// close george
 	res_man.Res_close(8);
 
-	Zdebug("Start_game() DONE.");
+	debug(5, "Start_game() DONE.");
 }
 
 void PauseGame(void) {

Index: sync.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sync.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sync.cpp	26 Sep 2003 10:07:18 -0000	1.5
+++ sync.cpp	27 Sep 2003 11:02:57 -0000	1.6
@@ -26,7 +26,7 @@
 typedef	struct {
 	uint32 id;
 	uint32 sync;
-} _sync_unit;	// haaaaaaaa
+} _sync_unit;
 
 // there wont be many will there. probably 2 at most i reckon
 #define	MAX_syncs 10
@@ -45,7 +45,7 @@
 
 	for (int i = 0; i < MAX_syncs; i++) {
 		if (sync_list[i].id == 0) {
-			// Zdebug(" %d sending sync %d to %d", ID, params[1], params[0]);
+			debug(5, " %d sending sync %d to %d", ID, params[1], params[0]);
 			sync_list[i].id = params[0];
 			sync_list[i].sync = params[1];
 			return IR_CONT;
@@ -67,7 +67,7 @@
 
 	for (int i = 0; i < MAX_syncs; i++) {
 		if (sync_list[i].id == id) {
-			// Zdebug("removing sync %d for %d", i, id);
+			debug(5, "removing sync %d for %d", i, id);
 			sync_list[i].id = 0;
 		}
 	}
@@ -111,12 +111,12 @@
 	// keep calling until a sync recieved
 	// params     none
 
-	// Zdebug("%d waits", ID);
+	debug(5, "FN_wait_sync: %d waits", ID);
 
 	for (int i = 0; i < MAX_syncs; i++) {
 		if (sync_list[i].id == ID) {
 			// return sync value waiting
-			//Zdebug(" go");
+			debug(5, "FN_wait_sync: go");
 			RESULT = sync_list[i].sync;
 			return IR_CONT;
 		}

Index: tony_gsdk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/tony_gsdk.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- tony_gsdk.cpp	26 Sep 2003 10:07:18 -0000	1.9
+++ tony_gsdk.cpp	27 Sep 2003 11:02:57 -0000	1.10
@@ -37,7 +37,7 @@
 	uint32 size;
 
 	if (!fh.open(name)) {
-		Zdebug("Read_file cannot open %s", name);
+		debug(5, "Read_file cannot open %s", name);
 		return 0;
 	}
 
@@ -47,7 +47,7 @@
 	*membloc = Twalloc(size, MEM_float, uid);
 	
 	if (fh.read((*membloc)->ad, size) != size) {
-		Zdebug("Read_file read fail %d", name);
+		debug(5, "Read_file read fail %d", name);
 		return 0;
 	}
 

Index: walker.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/walker.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- walker.cpp	26 Sep 2003 10:07:18 -0000	1.7
+++ walker.cpp	27 Sep 2003 11:02:57 -0000	1.8
@@ -99,7 +99,7 @@
 
 		// invalid direction (NB. '8' means end walk on ANY direction)
 		if (params[6] < 0 || params[6] > 8)
-			Con_fatal_error("Invalid direction (%d) in FN_walk (%s line %u)", params[6], __FILE__, __LINE__);
+			Con_fatal_error("Invalid direction (%d) in FN_walk", params[6]);
 
 		ob_walkdata = (Object_walkdata *) params[3];
 
@@ -290,11 +290,11 @@
 			pars[5] = standby_y;
 			pars[6] = standby_dir;
 
-			Zdebug("WARNING: FN_walk_to_anim(%s) used standby coords", FetchObjectName(params[4]));
+			debug(5, "WARNING: FN_walk_to_anim(%s) used standby coords", FetchObjectName(params[4]));
 		}
 
 		if (pars[6] < 0 || pars[6] > 7)
-			Con_fatal_error("Invalid direction (%d) in FN_walk_to_anim (%s line %u)", pars[6], __FILE__, __LINE__);
+			Con_fatal_error("Invalid direction (%d) in FN_walk_to_anim", pars[6]);
 	}
 
 	// set up the rest of the parameters for FN_walk()
@@ -333,7 +333,7 @@
 
 	if (ob_logic->looping == 0) {
 		if (params[4] < 0 || params[4] > 7)
-			Con_fatal_error("Invalid direction (%d) in FN_turn (%s line %u)", params[4], __FILE__, __LINE__);
+			Con_fatal_error("Invalid direction (%d) in FN_turn", params[4]);
 
 	 	ob_mega = (Object_mega *) params[2];
 	
@@ -370,7 +370,7 @@
 	// check for invalid direction
 
 	if (params[4] < 0 || params[4] > 7)
-		Con_fatal_error("Invalid direction (%d) in FN_stand_at (%s line %u)", params[4], __FILE__, __LINE__);
+		Con_fatal_error("Invalid direction (%d) in FN_stand_at", params[4]);
 
 	// set up pointers to the graphic & mega structure
 
@@ -448,11 +448,11 @@
 		pars[3] = standby_y;
 		pars[4] = standby_dir;
 
-		Zdebug("WARNING: FN_stand_after_anim(%s) used standby coords", FetchObjectName(params[2]));
+		debug(5, "WARNING: FN_stand_after_anim(%s) used standby coords", FetchObjectName(params[2]));
 	}
 
 	if (pars[4] < 0 || pars[4] > 7)
-		Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim (%s line %u)", pars[4], __FILE__, __LINE__);
+		Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim", pars[4]);
 
 	// close the anim file
 	res_man.Res_close(params[2]);
@@ -495,11 +495,11 @@
 		pars[3] = standby_y;
 		pars[4] = standby_dir;
 
-		Zdebug("WARNING: FN_stand_at_anim(%s) used standby coords", FetchObjectName(params[2]));
+		debug(5, "WARNING: FN_stand_at_anim(%s) used standby coords", FetchObjectName(params[2]));
 	}
 
 	if (pars[4] < 0 || pars[4] > 7)
-		Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim (%s line %u)", pars[4], __FILE__, __LINE__);
+		Con_fatal_error("Invalid direction (%d) in FN_stand_after_anim", pars[4]);
 
 	// close the anim file
 	res_man.Res_close(params[2]);
@@ -689,8 +689,8 @@
 
 		mega_seperation= (mega_seperation * scale) / 256;
 
-		// Zdebug("seperation %d", mega_seperation);
-		// Zdebug(" target x %d, y %d", engine_mega.feet_x, engine_mega.feet_y);
+		debug(5, "seperation %d", mega_seperation);
+		debug(5, " target x %d, y %d", engine_mega.feet_x, engine_mega.feet_y);
 
 		if (engine_mega.feet_x < ob_mega->feet_x)
 		{
@@ -790,7 +790,7 @@
 	//		2 direction (0..7)
 
 	if (params[2] < 0 || params[2] > 7)
-		Con_fatal_error("Invalid direction (%d) in FN_set_standby_coords (%s line %u)", params[2], __FILE__, __LINE__);
+		Con_fatal_error("Invalid direction (%d) in FN_set_standby_coords", params[2]);
 
 	standby_x = (int16) params[0];
 	standby_y = (int16) params[1];





More information about the Scummvm-git-logs mailing list