freedroidrpg (0.14.1-1) 27_debug.diff

Summary

 graphics.c |   24 ++++++++++++------------
 init.c     |   17 ++++++++++++++---
 main.c     |    2 +-
 misc.c     |   20 ++++++++++----------
 4 files changed, 37 insertions(+), 26 deletions(-)

    
download this patch

Patch contents

--- ../orig/freedroidrpg-0.13/src/init.c	2010-01-21 13:31:29.000000000 +0100
+++ src/init.c	2010-02-13 11:34:05.000000000 +0100
@@ -1201,6 +1201,9 @@
                     [-f | --fullscreen] [-w | --window] \n\
                     [-d X | --debug=X]       X = 0-5; default 1 \n\
                     [-r Y | --resolution=Y]  Y = 99 lists available resolutions. \n\
+";
+
+char report_bugs_string[] = "\
 \n\
 Please report bugs either by entering them into the bug tracker\n\
 on our sourceforge-website at:\n\n\
@@ -1233,6 +1236,7 @@
 		case 'h':
 		case '?':
 			printf("%s",usage_string);
+			DebugPrintf( 1, report_bugs_string );
 			exit(0);
 			break;
 
@@ -1313,6 +1317,13 @@
 					GameConfig.screen_width = screen_resolutions[resolution_code].xres;
 					GameConfig.screen_height = screen_resolutions[resolution_code].yres;
 					DebugPrintf(1, "\n%s(): Command line argument -r %d recognized.", __FUNCTION__, resolution_code);
+				} else if( resolution_code == 99 ) {
+					printf( "Available resolution codes:\n" );
+					int i;
+					for (i = 0; i < nb_res; ++i) {
+						printf( "\t%d = %s\n", i, screen_resolutions[i].comment);
+					}
+					exit( 0 );
 				} else {
 					fprintf(stderr, "\nresolution code received: %d", resolution_code);
 					char *txt = (char *)malloc((nb_res * 128 + 1) * sizeof(char));
@@ -1657,7 +1668,7 @@
 	// We mention the version of FreedroidRPG, so that debug reports
 	// are easier to assign to the different versions of the game.
 	//
-	DebugPrintf(-4, "\nHello, this is FreedroidRPG, version %s.", VERSION);
+	DebugPrintf(1, "\nHello, this is FreedroidRPG, version %s.", VERSION);
 
 #ifndef __WIN32__
 
@@ -1670,7 +1681,7 @@
 	// string and enable/disable the exceptions accordingly...
 	//
 	if (strstr(VERSION, "svn") != NULL) {
-		DebugPrintf(-4, "\nThis seems to be a development version, so we'll exit on floating point exceptions.");
+		DebugPrintf(1, "\nThis seems to be a development version, so we'll exit on floating point exceptions.");
 		// feenableexcept ( FE_ALL_EXCEPT );
 		// feenableexcept ( FE_INEXACT ) ;
 		// feenableexcept ( FE_UNDERFLOW ) ;
@@ -1678,7 +1689,7 @@
 		feenableexcept(FE_INVALID);
 		feenableexcept(FE_DIVBYZERO);
 	} else {
-		DebugPrintf(-4, "\nThis seems to be a 'stable' release, so no exit on floating point exceptions.");
+		DebugPrintf(1, "\nThis seems to be a 'stable' release, so no exit on floating point exceptions.");
 		fedisableexcept(FE_INVALID);
 		fedisableexcept(FE_DIVBYZERO);
 	}
--- ../orig/freedroidrpg-0.14.1/src/misc.c	2010-11-26 22:41:13.000000000 +0000
+++ src/misc.c	2010-12-27 16:22:49.000000000 +0000
@@ -444,7 +444,7 @@
 
 #if (!defined __WIN32__) && (!defined __APPLE_CC__)
 
-	DebugPrintf(-4, "\n-Signal Handling------------------------------------------------------\n\
+	DebugPrintf( 1 , "\n-Signal Handling------------------------------------------------------\n\
 Setting up signal handlers for internal backtrace:\n\
 Now catching SIGSEGV: ");
 
@@ -459,22 +459,22 @@
 	//
 	sigaction(SIGSEGV, NULL, &old_action);
 	if (old_action.sa_handler != SIG_IGN) {
-		DebugPrintf(-4, "YES");
+		DebugPrintf( 1 , "YES");
 		sigaction(SIGSEGV, &new_action, NULL);
 	} else {
-		DebugPrintf(-4, "NO");
+		DebugPrintf( 1 , "NO");
 	}
 
 	// 
-	DebugPrintf(-4, "\nNow catching FPE (if raised, that is!): ");
+	DebugPrintf( 1 , "\nNow catching FPE (if raised, that is!): ");
 	sigaction(SIGFPE, NULL, &old_action);
 	if (old_action.sa_handler != SIG_IGN) {
-		DebugPrintf(-4, "YES");
+		DebugPrintf( 1 , "YES");
 		sigaction(SIGFPE, &new_action, NULL);
 	} else {
-		DebugPrintf(-4, "NO");
+		DebugPrintf( 1 , "NO");
 	}
-	DebugPrintf(-4, "\n\n");
+	DebugPrintf( 1 , "\n\n");
 
 #endif
 
@@ -1243,14 +1243,14 @@
  */
 void Terminate(int ExitCode)
 {
-	printf("\n----------------------------------------------------------------------");
-	printf("\nTermination of freedroidRPG initiated...");
+	DebugPrintf( 1, "\n----------------------------------------------------------------------");
+	DebugPrintf( 1, "\nTermination of freedroidRPG initiated...");
 
 	// We save the config file in any case.
 	//
 	SaveGameConfig();
 
-	printf("Thank you for playing freedroidRPG.\n\n");
+	DebugPrintf( 1, "Thank you for playing freedroidRPG.\n\n");
 	SDL_Quit();
 
 	// Finally, especially on win32 systems, we should open an editor with
--- ../orig/freedroidrpg-0.13/src/graphics.c	2010-01-21 13:31:29.000000000 +0100
+++ src/graphics.c	2010-02-13 12:09:32.000000000 +0100
@@ -1119,16 +1119,16 @@
 	// Since we want to use openGl, it might be good to check the OpenGL vendor string
 	// provided by the graphics driver.  Let's see...
 	//
-	fprintf(stderr, "\n-OpenGL-------------------------------------------------------");
-	fprintf(stderr, "\nVendor     : %s", glGetString(GL_VENDOR));
+	DebugPrintf(1, "\n-OpenGL-------------------------------------------------------");
+	DebugPrintf(1, "\nVendor     : %s", glGetString(GL_VENDOR));
 	open_gl_check_error_status(__FUNCTION__);
-	fprintf(stderr, "\nRenderer   : %s", glGetString(GL_RENDERER));
+	DebugPrintf(1, "\nRenderer   : %s", glGetString(GL_RENDERER));
 	open_gl_check_error_status(__FUNCTION__);
-	fprintf(stderr, "\nVersion    : %s", glGetString(GL_VERSION));
+	DebugPrintf(1, "\nVersion    : %s", glGetString(GL_VERSION));
 	open_gl_check_error_status(__FUNCTION__);
-	fprintf(stderr, "\nExtensions : %s", glGetString(GL_EXTENSIONS));
+	DebugPrintf(1, "\nExtensions : %s", glGetString(GL_EXTENSIONS));
 	open_gl_check_error_status(__FUNCTION__);
-	fprintf(stderr, "\n\n");
+	DebugPrintf(1, "\n\n");
 #endif
 };				// void safely_show_open_gl_driver_info ( void )
 
@@ -1219,11 +1219,11 @@
 SDL reported, that the video mode mentioned above is not supported\nBreaking off...", PLEASE_INFORM, IS_FATAL);
 		break;
 	default:
-		DebugPrintf(-4, "\nTesting if color depth %d bits is available... ", vid_bpp);
+		DebugPrintf(1, "\nTesting if color depth %d bits is available... ", vid_bpp);
 		if (video_mode_ok_check_result == vid_bpp) {
-			DebugPrintf(-4, "YES.");
+			DebugPrintf(1, "YES.");
 		} else {
-			DebugPrintf(-4, "NO! \nThe closest we will get is %d bits per pixel.", video_mode_ok_check_result);
+			DebugPrintf(1, "NO! \nThe closest we will get is %d bits per pixel.", video_mode_ok_check_result);
 			/*
 			   ErrorMessage ( __FUNCTION__  , "\
 			   SDL reported, that the video mode mentioned \nabove is not supported UNDER THE COLOR DEPTH MENTIONED ABOVE!\n\
@@ -1251,7 +1251,7 @@
 		SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blue_size);
 		SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &alpha_size);
 		SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth_size);
-		fprintf(stderr, "\n\nvideo mode set (bpp=%d RGBA=%d%d%d%d depth=%d)",
+		DebugPrintf(1, "\n\nvideo mode set (bpp=%d RGBA=%d%d%d%d depth=%d)",
 			buffer_size, red_size, green_size, blue_size, alpha_size, depth_size);
 	}
 
@@ -1314,7 +1314,7 @@
 	// NOTE:  This has got NOTHING to do with OpenGL and OpenGL venour or the like yet...
 	//
 	if (SDL_VideoDriverName(vid_driver, 80)) {
-		DebugPrintf(-4, "\nVideo system type: %s.", vid_driver);
+		DebugPrintf(1, "\nVideo system type: %s.", vid_driver);
 	} else {
 		fprintf(stderr, "Video driver seems not to exist or initialisation failure!\nError code: %s\n", SDL_GetError());
 		Terminate(ERR);
@@ -1330,7 +1330,7 @@
 	//--------------------
 	// We note the screen resolution used.
 	//
-	DebugPrintf(-4, "\nUsing screen resolution %d x %d.", GameConfig.screen_width, GameConfig.screen_height);
+	DebugPrintf(1, "\nUsing screen resolution %d x %d.", GameConfig.screen_width, GameConfig.screen_height);
 
 	//--------------------
 	// We query the available video configuration on this system.
--- ../orig/freedroidrpg-0.13/src/main.c	2010-01-21 13:31:29.000000000 +0100
+++ src/main.c	2010-02-14 07:39:08.000000000 +0100
@@ -439,7 +439,7 @@
 				if (!strcmp(curShip.AllLevels[i]->Levelname, "Town"))
 					continue;
 
-				DebugPrintf(-10, "\nNow respawning all bots on level : %d. ", i);
+				DebugPrintf(1, "\nNow respawning all bots on level : %d. ", i);
 				Me.time_since_last_visit_or_respawn[i] = 0;
 
 				respawn_level(i);