[Tux4kids-commits] r1146 - tuxmath/trunk/src

Bolesław Kulbabiński bolekk-guest at alioth.debian.org
Sun Jul 5 16:24:24 UTC 2009


Author: bolekk-guest
Date: 2009-07-05 16:24:23 +0000 (Sun, 05 Jul 2009)
New Revision: 1146

Modified:
   tuxmath/trunk/src/Makefile.am
   tuxmath/trunk/src/SDL_extras.c
   tuxmath/trunk/src/SDL_extras.h
   tuxmath/trunk/src/SDL_rotozoom.c
   tuxmath/trunk/src/campaign.c
   tuxmath/trunk/src/convert_utf.c
   tuxmath/trunk/src/credits.c
   tuxmath/trunk/src/factoroids.c
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/game.c
   tuxmath/trunk/src/globals.h
   tuxmath/trunk/src/highscore.c
   tuxmath/trunk/src/lessons.c
   tuxmath/trunk/src/multiplayer.c
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/setup.c
   tuxmath/trunk/src/titlescreen.c
   tuxmath/trunk/src/tuxmath.c
Log:
converted all #TUXMATH_DEBUGs and tmdprintfs into DEBUGMSGs; got rid of all compiler warnings

Modified: tuxmath/trunk/src/Makefile.am
===================================================================
--- tuxmath/trunk/src/Makefile.am	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/Makefile.am	2009-07-05 16:24:23 UTC (rev 1146)
@@ -7,7 +7,7 @@
 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
 
 AM_CFLAGS=-Wall -g -DDATA_PREFIX=\"${DATA_PREFIX}\" -DDEBUG \
-	-DVERSION=\"@NAME_VERSION@\" -D$(SOUND)SOUND
+	-D$(SOUND)SOUND
 
 AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" \
 	-I../intl -I$(top_srcdir)/intl

Modified: tuxmath/trunk/src/SDL_extras.c
===================================================================
--- tuxmath/trunk/src/SDL_extras.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/SDL_extras.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -19,8 +19,9 @@
 
 
 
-/* DrawButton() creates and draws a translucent button with */
-/* rounded ends.  All colors and alpha values are supported.*/
+/* DrawButton() creates a translucent button with rounded ends
+   and draws it on the screen.
+   All colors and alpha values are supported.*/
 void DrawButton(SDL_Rect* target_rect,
                 int radius,
                 Uint8 r, Uint8 g, Uint8 b, Uint8 a)
@@ -31,6 +32,8 @@
   SDL_FreeSurface(tmp_surf);
 }
 
+/* CreateButton() creates a translucent button with rounded ends
+   All colors and alpha values are supported.*/
 SDL_Surface* CreateButton(int w, int h, int radius,
                           Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 {
@@ -253,7 +256,7 @@
    Currently this works only with RGBA images, but this is largely to
    make the (fast) pointer arithmetic work out; it could be easily
    generalized to other image types. */
-SDL_Surface* Blend(SDL_Surface *S1,SDL_Surface *S2,float gamma)
+SDL_Surface* Blend(SDL_Surface *S1, SDL_Surface *S2, float gamma)
 {
   SDL_PixelFormat *fmt1, *fmt2;
   Uint8 r1, r2, g1, g2, b1, b2, a1, a2;
@@ -356,10 +359,6 @@
   return ret;
 }
 
-void UpdateRect(SDL_Surface* surf, SDL_Rect* rect)
-{
-  SDL_UpdateRect(surf, rect->x, rect->y, rect->w, rect->h);
-}
 
 /* free every surface in the array together with the array itself */
 void FreeSurfaceArray(SDL_Surface** surfs, int length)
@@ -381,6 +380,11 @@
         return 1;
 }
 
+void UpdateRect(SDL_Surface* surf, SDL_Rect* rect)
+{
+  SDL_UpdateRect(surf, rect->x, rect->y, rect->w, rect->h);
+}
+
 /* Darkens the screen by a factor of 2^bits */
 void DarkenScreen(Uint8 bits)
 {
@@ -524,7 +528,7 @@
   Uint8 r4, g4, b4, a4;
   Uint8 r, g, b, a;
 
-  tmdprintf("\nEntering zoom():\n");
+  DEBUGMSG(debug_sdl, "Entering zoom():\n");
 
   /* Create surface for zoom: */
 
@@ -545,9 +549,9 @@
 //    exit(1);
   }
 
-  tmdprintf("orig surface %dx%d, %d bytes per pixel\n",
+  DEBUGMSG(debug_sdl, "zoom(): orig surface %dx%d, %d bytes per pixel\n",
             src->w, src->h, src->format->BytesPerPixel);
-  tmdprintf("new surface %dx%d, %d bytes per pixel\n",
+  DEBUGMSG(debug_sdl, "zoom(): new surface %dx%d, %d bytes per pixel\n",
             s->w, s->h, s->format->BytesPerPixel);
 
   /* Now assign function pointers to correct functions based */
@@ -622,7 +626,7 @@
   SDL_UnlockSurface(s);
   SDL_UnlockSurface(src);
 
-  tmdprintf("\nLeaving zoom():\n");
+  DEBUGMSG(debug_sdl, "Leaving zoom():\n");
 
   return s;
 }
@@ -670,7 +674,7 @@
 {
 #ifdef HAVE_LIBSDL_PANGO
 
-  tmdprintf("Setup_SDL_Text() - using SDL_Pango\n");
+  DEBUGMSG(debug_sdl, "Setup_SDL_Text() - using SDL_Pango\n");
 
   SDLPango_Init();
   if (!Set_SDL_Pango_Font_Size(DEFAULT_MENU_FONT_SIZE))
@@ -682,7 +686,7 @@
 
 #else
 /* using SDL_ttf: */
-  tmdprintf("Setup_SDL_Text() - using SDL_ttf\n");
+  DEBUGMSG(debug_sdl, "Setup_SDL_Text() - using SDL_ttf\n");
 
   if (TTF_Init() < 0)
   {
@@ -751,10 +755,8 @@
     return NULL;
   }
 
-#ifdef TUXMATH_DEBUG
-  fprintf( stderr, "\nEntering BlackOutline(): \n");
-  fprintf( stderr, "BlackOutline of \"%s\"\n", t );
-#endif
+  DEBUGMSG(debug_sdl, "Entering BlackOutline():\n");
+  DEBUGMSG(debug_sdl, "BlackOutline of \"%s\"\n", t );
 
 #ifdef HAVE_LIBSDL_PANGO
   Set_SDL_Pango_Font_Size(size);
@@ -827,9 +829,7 @@
   out = SDL_DisplayFormatAlpha(bg);
   SDL_FreeSurface(bg);
 
-#ifdef TUXMATH_DEBUG
-  fprintf( stderr, "\nLeaving BlackOutline(): \n");
-#endif
+  DEBUGMSG(debug_sdl, "\nLeaving BlackOutline(): \n");
 
   return out;
 }
@@ -963,7 +963,7 @@
   {
     char buf[64];
 
-    tmdprintf("Setting font size to %d\n", size);
+    DEBUGMSG(debug_sdl, "Setting font size to %d\n", size);
 
     if(context != NULL)
       SDLPango_FreeContext(context);
@@ -1082,9 +1082,7 @@
 
   if (f)
   {
-#ifdef TUXMATH_DEBUG
-    fprintf(stderr, "LoadFont(): %s loaded successfully\n\n", fontfile);
-#endif
+    DEBUGMSG(debug_sdl, "LoadFont(): %s loaded successfully\n\n", fontfile);
     return f;
   }
   else
@@ -1095,8 +1093,3 @@
 }
 #endif
 
-
-
-
-
-

Modified: tuxmath/trunk/src/SDL_extras.h
===================================================================
--- tuxmath/trunk/src/SDL_extras.h	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/SDL_extras.h	2009-07-05 16:24:23 UTC (rev 1146)
@@ -29,27 +29,30 @@
 
 
 /* Non-text graphics functions: */
-void DrawButton(SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-SDL_Surface* CreateButton(int w, int h, int radius,
-                          Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-void RoundCorners(SDL_Surface* s, Uint16 radius);
-SDL_Surface* Flip(SDL_Surface *in, int x, int y);
-void UpdateRect(SDL_Surface* surf, SDL_Rect* rect);
-void FreeSurfaceArray(SDL_Surface** surfs, int length);
-int  inRect(SDL_Rect r, int x, int y);
-void DarkenScreen(Uint8 bits);
-void SwitchScreenMode(void);
-void ChangeWindowSize(int new_res_x, int new_res_y);
-SDL_EventType WaitForEvent(SDL_EventMask events);
-SDL_Surface* Blend(SDL_Surface *S1, SDL_Surface *S2,float gamma);
-SDL_Surface* zoom(SDL_Surface* src, int new_w, int new_h);
+void            DrawButton(SDL_Rect* target_rect, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+SDL_Surface*    CreateButton(int w, int h, int radius, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
+void            RoundCorners(SDL_Surface* s, Uint16 radius);
 
+SDL_Surface*    Flip(SDL_Surface *in, int x, int y);
+SDL_Surface*    Blend(SDL_Surface *S1, SDL_Surface *S2, float gamma);
+
+void            FreeSurfaceArray(SDL_Surface** surfs, int length);
+int             inRect(SDL_Rect r, int x, int y);
+void            UpdateRect(SDL_Surface* surf, SDL_Rect* rect);
+
+void            DarkenScreen(Uint8 bits);
+void            ChangeWindowSize(int new_res_x, int new_res_y);
+void            SwitchScreenMode(void);
+
+SDL_EventType   WaitForEvent(SDL_EventMask events);
+SDL_Surface*    zoom(SDL_Surface* src, int new_w, int new_h);
+
 /*Text rendering functions: */
-int Setup_SDL_Text(void);
-void Cleanup_SDL_Text(void);
-SDL_Surface* BlackOutline(const char* t, int size, SDL_Color* c);
-SDL_Surface* SimpleText(const char *t, int size, SDL_Color* col);
-SDL_Surface* SimpleTextWithOffset(const char *t, int size, SDL_Color* col, int *glyph_offset);
+int             Setup_SDL_Text(void);
+void            Cleanup_SDL_Text(void);
+SDL_Surface*    BlackOutline(const char* t, int size, SDL_Color* c);
+SDL_Surface*    SimpleText(const char *t, int size, SDL_Color* col);
+SDL_Surface*    SimpleTextWithOffset(const char *t, int size, SDL_Color* col, int *glyph_offset);
 
 
 #endif

Modified: tuxmath/trunk/src/SDL_rotozoom.c
===================================================================
--- tuxmath/trunk/src/SDL_rotozoom.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/SDL_rotozoom.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -493,6 +493,10 @@
     tColorRGBA *pc, *sp;
     int gap;
 
+    c00.r = c00.g = c00.b = c00.a = 0;
+    c01.r = c01.g = c01.b = c01.a = 0;
+    c10.r = c10.g = c10.b = c10.a = 0;
+    c11.r = c11.g = c11.b = c11.a = 0;
     /*
      * Variable setup 
      */

Modified: tuxmath/trunk/src/campaign.c
===================================================================
--- tuxmath/trunk/src/campaign.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/campaign.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -64,13 +64,13 @@
       }
       else if (gameresult == GAME_OVER_ERROR)
       {
-        tmdprintf("Error!\n");
+        DEBUGMSG(debug_game, "Error!\n");
         endcampaign = 1;
       }
 #ifndef TESTING_CAMPAIGN
       else if (gameresult == GAME_OVER_ESCAPE)
       {
-        tmdprintf("hit escape\n");
+        DEBUGMSG(debug_game, "hit escape\n");
         endcampaign = 1;
       }
 #endif      
@@ -194,15 +194,15 @@
   SDL_FillRect(screen, NULL, 0);
   //TransWipe(black, RANDOM_WIPE, 10, 20);
   //show this stage's text
-  tmdprintf("Briefing\n");
+  DEBUGMSG(debug_game, "Briefing\n");
 
   SDL_BlitSurface(icon, NULL, screen, NULL);
 
   linewrap_list(briefings[stage], wrapped_lines, 40, MAX_LINES, MAX_LINEWIDTH);
   scroll_text(wrapped_lines, textarea, 1);
 
-  tmdprintf("Finished briefing\n");
-  
+  DEBUGMSG(debug_game, "Finished briefing\n");
+
   SDL_FreeSurface(loadedsprite);
   SDL_FreeSurface(icon);
 }

Modified: tuxmath/trunk/src/convert_utf.c
===================================================================
--- tuxmath/trunk/src/convert_utf.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/convert_utf.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -47,7 +47,7 @@
     return 0;
   }
 
-  tmdprintf("ConvertFromUTF8(): UTF8_word = %s\n", UTF8_word);
+  DEBUGMSG(debug_convert_utf, "ConvertFromUTF8(): UTF8_word = %s\n", UTF8_word);
 
   /* NOTE although we *should* be just able to pass "wchar_t" as the out_type, */
   /* iconv_open() segfaults on Windows if this is done - grrr....             */
@@ -64,7 +64,7 @@
   SDL_iconv_close(conv_descr);
   wcsncpy(wide_word, temp_wchar, max_length);
 
-  tmdprintf("ConvertToUTF8(): wide_word = %S\n", wide_word);
+  DEBUGMSG(debug_convert_utf, "ConvertToUTF8(): wide_word = %S\n", wide_word);
 
   return wcslen(wide_word);
 }
@@ -91,7 +91,7 @@
   size_t in_length = (size_t)UTF_BUF_LENGTH;
   size_t out_length = (size_t)UTF_BUF_LENGTH;
 
-  tmdprintf("ConvertToUTF8(): wide_word = %S\n", wide_word);
+  DEBUGMSG(debug_convert_utf, "ConvertToUTF8(): wide_word = %S\n", wide_word);
 
   if(max_length > UTF_BUF_LENGTH)
   {
@@ -116,7 +116,7 @@
   SDL_iconv_close(conv_descr);
   strncpy(UTF8_word, temp_UTF8, max_length);
 
-  tmdprintf("ConvertToUTF8(): UTF8_word = %s\n", UTF8_word);
+  DEBUGMSG(debug_convert_utf, "ConvertToUTF8(): UTF8_word = %s\n", UTF8_word);
 
   return strlen(UTF8_word);
 }

Modified: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/credits.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -109,7 +109,7 @@
   {" "},
   {N_("For more information about Free Software and the GNU GPL, visit:")},
   {"http://www.fsf.org"},
-  {NULL}
+  {" "}
 };
 
 
@@ -472,7 +472,7 @@
           clearing = 1; //scroll to blank            
         }            
         else
-          tmdprintf("text[line]: %s\n", text[line]);
+          DEBUGMSG(debug_titlescreen, "text[line]: %s\n", text[line]);
       }
     }
 
@@ -583,8 +583,8 @@
   if (!str || *str == '\0')
     return;
 
-  tmdprintf("Entering draw_text(%s)\n", str);
-  
+  DEBUGMSG(debug_titlescreen, "Entering draw_text(%s)\n", str);
+
   if (str[0] == '-') //highlight text
   {
     str++;
@@ -606,6 +606,6 @@
   dest.x -= surf->w / 2; //center text
   SDL_BlitSurface(surf, NULL, screen, &dest);
   SDL_FreeSurface(surf);
-  tmdprintf("done\n");
+  DEBUGMSG(debug_titlescreen, "done\n");
 }
 #endif

Modified: tuxmath/trunk/src/factoroids.c
===================================================================
--- tuxmath/trunk/src/factoroids.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/factoroids.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -234,9 +234,7 @@
   counter = 0;
   tux_img = IMG_TUX_CONSOLE1;
 
-  #ifdef TUXMATH_DEBUG
-     fprintf(stderr, "Entering factors():\n");
-  #endif
+  DEBUGMSG(debug_factoroids, "Entering factors():\n");
 
   FF_game = FACTOROIDS_GAME;
   
@@ -316,11 +314,7 @@
   counter = 0;
   tux_img = IMG_TUX_CONSOLE1;
 
-  
-  #ifdef TUXMATH_DEBUG
-     fprintf(stderr, "Entering factors():\n");
-  #endif
-  
+  DEBUGMSG(debug_factoroids, "Entering factors():\n");
   /*****Initalizing the Factor activiy *****/
   FF_game = FRACTIONS_GAME;
 
@@ -1230,9 +1224,6 @@
   SDL_Rect dest_message;
   SDL_Event event;
 
-#ifdef TUXMATH_DEBUG
-  //print_exit_conditions();
-#endif
 
   /* TODO: need better "victory" screen with animation, special music, etc., */
   /* as well as options to review missed questions, play again using missed  */
@@ -1286,9 +1277,7 @@
 
     case GAME_OVER_ERROR:
     {
-#ifdef TUXMATH_DEBUG
-      printf("\ngame() exiting with error");
-#endif
+      DEBUGMSG(debug_factoroids, "game() exiting with error");
     }
     case GAME_OVER_LOST:
     case GAME_OVER_OTHER:
@@ -1713,9 +1702,7 @@
 
   s1 = s2 = s3 = s4 = NULL;
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "ShowMessage() - creating text\n" );
-#endif
+  DEBUGMSG(debug_factoroids, "ShowMessage() - creating text\n" );
 
   if (str1)
     s1 = BlackOutline(str1, DEFAULT_MENU_FONT_SIZE, &white);
@@ -1727,11 +1714,8 @@
   if (str4)
     s4 = BlackOutline(str4, DEFAULT_MENU_FONT_SIZE, &white);
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "ShowMessage() - drawing screen\n" );
-#endif
+  DEBUGMSG(debug_factoroids, "ShowMessage() - drawing screen\n" );
 
-
   /* Draw lines of text (do after drawing Tux so text is in front): */
   if (s1)
   {
@@ -2202,10 +2186,6 @@
   /* This SHOULD NOT HAPPEN and means we have a bug somewhere. */
  /* if (!MC_ListQuestionsLeft() && !num_comets_alive)
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nListQuestionsLeft() = %d", MC_ListQuestionsLeft());
-    printf("\nnum_comets_alive = %d", num_comets_alive);
-    #endif 
     return GAME_OVER_ERROR;
   }
   */

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/fileops.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -294,9 +294,7 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, OPTIONS_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_user_config_file() full path to config file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_user_config_file() full path to config file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
@@ -331,11 +329,8 @@
     free(last_config_file_name);
   last_config_file_name = strdup(filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() filename is: = %s\n", filename);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() filename is: = %s\n", filename);
 
-
   /* First look in current working directory:  */
   getcwd(opt_path, PATH_MAX); /* get current working directory */
   /* add separating '/' unless cwd is '/' : */
@@ -345,18 +340,12 @@
   }
   strcat(opt_path, filename); /* tack on filename              */
 
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (cwd)\n", opt_path);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (cwd)\n", opt_path);
-  #endif
-
-
   fp = fopen(opt_path, "r");  /* try to open file */
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -384,16 +373,12 @@
     strcat(opt_path, filename);
   }
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (abs)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (abs)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -414,16 +399,12 @@
   strcat(opt_path, "/missions/");
   strcat(opt_path, filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (missions)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (missions)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -443,16 +424,12 @@
   strcat(opt_path, "/missions/lessons/");
   strcat(opt_path, filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (missions/lessons)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (missions/lessons)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -472,16 +449,12 @@
   strcat(opt_path, "/missions/arcade/");
   strcat(opt_path, filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (missions/arcade)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (missions/arcade)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -501,16 +474,12 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (.tuxmath)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (.tuxmath)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -532,16 +501,12 @@
   strcat(opt_path, "/");
   strcat(opt_path, filename);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_named_config_file() checking for %s (home)\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_named_config_file() checking for %s (home)\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nFound %s\n", opt_path);
-    #endif
+    DEBUGMSG(debug_fileops, "Found %s\n", opt_path);
 
     if (read_config_file(fp, USER_CONFIG_FILE))
     {
@@ -557,9 +522,7 @@
   }
 
   /* Could not find file (or read it if found) in any location: */
-  #ifdef TUXMATH_DEBUG
-  printf("\nread_named_config_file() could not find/read: %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "read_named_config_file() could not find/read: %s\n", opt_path);
   return 0;
 }
 
@@ -596,18 +559,13 @@
     return 0;
   }
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "lesson_path is: %s\n", lesson_path);
-#endif
+  DEBUGMSG(debug_fileops, "lesson_path is: %s\n", lesson_path);
 
   /* Believe we now have complete scandir() for all platforms :) */
   num_lessons = scandir(lesson_path, &lesson_list_dirents, is_lesson_file, alphasort);
 
+  DEBUGMSG(debug_fileops, "num_lessons is: %d\n", num_lessons);
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "num_lessons is: %d\n", num_lessons);
-#endif
-
   if (num_lessons < 0) {
     perror("scanning lesson directory");
     num_lessons = 0;
@@ -642,9 +600,7 @@
     if (nchars < 0 || nchars >= NAME_BUF_SIZE)
       continue;
 
-#ifdef TUXMATH_DEBUG
-    fprintf(stderr, "Found lesson file %d:\t%s\n", lessons, lesson_list_filenames[lessons]);
-#endif
+    DEBUGMSG(debug_fileops, "Found lesson file %d:\t%s\n", lessons, lesson_list_filenames[lessons]);
 
     /* load the name for the lesson from the file ... (1st line) */
     tempFile = fopen(lesson_list_filenames[lessons], "r");
@@ -740,9 +696,7 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, GOLDSTAR_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_goldstars() full path to file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_goldstars() full path to file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
@@ -776,9 +730,7 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, GOLDSTAR_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn write_goldstars() full path to file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In write_goldstars() full path to file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "w");
   if (fp)
@@ -808,9 +760,7 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, HIGHSCORE_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_high_scores() full path to file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_high_scores() full path to file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
@@ -856,9 +806,7 @@
     strncpy(opt_path,high_scores_file_path,PATH_MAX);
   strcat(opt_path, HIGHSCORE_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn read_high_scores() full path to file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In read_high_scores() full path to file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "r");
   if (fp) /* file exists */
@@ -933,9 +881,7 @@
     strncpy(opt_path,high_scores_file_path,PATH_MAX);
   strcat(opt_path, HIGHSCORE_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn write_high_scores() full path to file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In write_high_scores() full path to file is: = %s\n", opt_path);
 
   fp = fopen(opt_path, "a");
   if (fp)
@@ -1062,17 +1008,13 @@
   char buf[PATH_MAX];
   char *parameter, *param_begin, *param_end, *value, *value_end;
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nEntering read_config_file()\n");
-  #endif
+  DEBUGMSG(debug_fileops, "Entering read_config_file()\n");
 
   /* get out if file pointer invalid: */
   if(!fp)
   {
-    #ifdef TUXMATH_DEBUG
-    printf("config file pointer invalid!\n");
-    printf("Leaving read_config_file()\n");
-    #endif
+    DEBUGMSG(debug_fileops, "config file pointer invalid!\n");
+    DEBUGMSG(debug_fileops, "Leaving read_config_file()\n");
 
     fprintf(stderr, "config file pointer invalid!\n");
     return 0;
@@ -1084,9 +1026,6 @@
   /* read in a line at a time: */
   while (fgets (buf, PATH_MAX, fp))
   { 
-    #ifdef TUXMATH_DEBUG
-    //printf("Beginning fgets() loop\n");
-    #endif
     /* "parameter" and "value" will contain the non-whitespace chars */
     /* before and after the '=' sign, respectively.  e.g.:           */
     /*                                                               */
@@ -1098,9 +1037,6 @@
     /* ignore comment lines */
     if ((buf[0] == ';') || (buf[0] == '#'))
     {
-      #ifdef TUXMATH_DEBUG
-      //printf("Skipping comment line\n");
-      #endif
       continue;
     }
  
@@ -1140,10 +1076,6 @@
 
     if (!value || (value == buf))
     {
-      #ifdef TUXMATH_DEBUG
-      //fprintf(stderr, "Error while reading prefs - line with no '='!\n");
-      #endif
-
       free(parameter);
       continue;
     }
@@ -1169,8 +1101,8 @@
     /* terminate string here: */
     *value_end = 0;
 
-    tmdprintf("parameter = '%s'\t, length = %zu\n", parameter, strlen(parameter));
-    tmdprintf("value = '%s'\t, length = %zu\t, atoi() = %d\t, atof() = %.2f\n", value, strlen(value), atoi(value), atof(value));
+    DEBUGMSG(debug_fileops, "parameter = '%s'\t, length = %zu\n", parameter, strlen(parameter));
+    DEBUGMSG(debug_fileops, "value = '%s'\t, length = %zu\t, atoi() = %d\t, atof() = %.2f\n", value, strlen(value), atoi(value), atof(value));
     
     /* Now ready to handle each name/value pair! */
     
@@ -1413,13 +1345,12 @@
       MC_SetOpt(DIVISION_ALLOWED, 0);
   if (MC_GetOpt(MIN_TYPING_NUM) > MC_GetOpt(MAX_TYPING_NUM) )
       MC_SetOpt(TYPING_PRACTICE_ALLOWED, 0);
-      
-  #ifdef TUXMATH_DEBUG
-  printf("\nAfter file read in:\n");
-  write_config_file(stdout, 0);
-  printf("Leaving read_config_file()\n");
-  #endif
 
+  DEBUGMSG(debug_fileops, "After file read in:\n");
+  DEBUGCODE(debug_fileops)
+    write_config_file(stdout, 0);
+  DEBUGMSG(debug_fileops, "Leaving read_config_file()\n");
+
   return 1;
 }
 
@@ -1462,9 +1393,7 @@
   get_user_data_dir_with_subdir(opt_path);
   strcat(opt_path, OPTIONS_FILENAME);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn write_user_config_file() full path to config file is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In write_user_config_file() full path to config file is: = %s\n", opt_path);
 
   /* save settings: */
   fp = fopen(opt_path, "w");
@@ -1718,14 +1647,13 @@
     "############################################################\n\n";
     
   }
-  
-  tmdprintf("\nEntering write_config_file()\n");
+  DEBUGMSG(debug_fileops, "Entering write_config_file()\n");
 
   /* get out if file pointer null */
   if(!fp)
   {
     fprintf (stderr, "write_config_file() - file pointer invalid/n");
-    tmdprintf("Leaving write_config_file()\n");
+    DEBUGMSG(debug_fileops, "Leaving write_config_file()\n");
     return 0;
   }
   
@@ -1944,9 +1872,7 @@
   /* print options pertaining to math questions from MathCards: */
 //  MC_PrintMathOptions(fp, 1);
 
-  #ifdef TUXMATH_DEBUG
-  printf("Leaving write_config_file()\n");
-  #endif
+  DEBUGMSG(debug_fileops, "Leaving write_config_file()\n");
 
   return 1;
 }
@@ -2170,17 +2096,13 @@
   /* find $HOME */
   get_user_data_dir_with_subdir(opt_path);
 
-  #ifdef TUXMATH_DEBUG
-  printf("\nIn find_tuxmath_dir() tuxmath dir is: = %s\n", opt_path);
-  #endif
+  DEBUGMSG(debug_fileops, "In find_tuxmath_dir() tuxmath dir is: = %s\n", opt_path);
 
   /* find out if directory exists - if not, create it: */
   dir_ptr = opendir(opt_path);
   if (dir_ptr)  /* don't leave DIR* open if it was already there */
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nIn find_tuxmath_dir() tuxmath dir opened OK\n");
-    #endif
+    DEBUGMSG(debug_fileops, "In find_tuxmath_dir() tuxmath dir opened OK\n");
 
     closedir(dir_ptr);
     return 1;
@@ -2198,17 +2120,13 @@
     fp = fopen(opt_path, "r");
     if (fp)
     {
-      #ifdef TUXMATH_DEBUG
-      printf("\nIn find_tuxmath_dir() - removing old .tuxmath file\n");
-      #endif
+      DEBUGMSG(debug_fileops, "In find_tuxmath_dir() - removing old .tuxmath file\n");
 
       fclose(fp);
       remove(opt_path);
     }
 
-    #ifdef TUXMATH_DEBUG
-    printf("\nIn find_tuxmath_dir() - trying to create .tuxmath dir\n");
-    #endif
+    DEBUGMSG(debug_fileops, "In find_tuxmath_dir() - trying to create .tuxmath dir\n");
 
     //status = mkdir(opt_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
 
@@ -2218,9 +2136,7 @@
     status = mkdir(opt_path);
 #endif
 
-    #ifdef TUXMATH_DEBUG
-    printf("\nIn find_tuxmath_dir() - mkdir returned: %d\n", status);
-    #endif
+    DEBUGMSG(debug_fileops, "In find_tuxmath_dir() - mkdir returned: %d\n", status);
 
     /* mkdir () returns 0 if successful */
     if (0 == status)

Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/game.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -196,9 +196,7 @@
 {
   Uint32 last_time, now_time;
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "Entering game():\n");
-#endif
+  DEBUGMSG(debug_game, "Entering game():\n");
 
   //see if the option matches the actual screen
   if (Opts_GetGlobalOpt(FULLSCREEN) == !(screen->flags & SDL_FULLSCREEN) )
@@ -689,11 +687,7 @@
   }
 #endif
 
-
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "Leaving game():\n");
-#endif
-
+  DEBUGMSG(debug_game, "Leaving game():\n");
 }
 
 void game_handle_help(void)
@@ -1026,9 +1020,7 @@
       if ((rand() % 3) < 1)
         demo_answer--;  // sometimes get it wrong on purpose
 
-      #ifdef TUXMATH_DEBUG
-      printf("Demo mode, comet %d attacked with answer %d\n",picked_comet,demo_answer);
-      #endif
+      DEBUGMSG(debug_game, "Demo mode, comet %d attacked with answer %d\n",picked_comet,demo_answer);
       /* handle negative answer: */
       if (demo_answer < 0)
       {
@@ -1072,9 +1064,7 @@
     else
     {
       /* "Press Return" */
-      #ifdef TUXMATH_DEBUG
-      printf("Demo mode firing with these digits: %d%d%d\n",digits[0],digits[1],digits[2]);
-      #endif
+      DEBUGMSG(debug_game, "Demo mode firing with these digits: %d%d%d\n",digits[0],digits[1],digits[2]);
       doing_answer = 1;
       picked_comet = -1;
     }
@@ -1416,16 +1406,12 @@
           comets[i].alive = 0;
           if (bonus_comet_counter > 1 && comets[i].zapped) {
             bonus_comet_counter--;
-#ifdef TUXMATH_DEBUG
-            printf("\nbonus_comet_counter is now %d\n",bonus_comet_counter);
-#endif
+            DEBUGMSG(debug_game, "bonus_comet_counter is now %d\n",bonus_comet_counter);
           }
           if (comets[i].bonus && comets[i].zapped) {
             playsound(SND_EXTRA_LIFE);
             extra_life_earned = 1;
-#ifdef TUXMATH_DEBUG
-            printf("\nExtra life earned!");
-#endif
+            DEBUGMSG(debug_game, "Extra life earned!");
           }
         }
       }
@@ -1689,9 +1675,8 @@
 
   if (cloud.status == EXTRA_LIFE_ON)
     return 1;
-#ifdef TUXMATH_DEBUG
-  print_status();
-#endif
+  DEBUGCODE(debug_game)
+    print_status();
   if (extra_life_earned) {
     /* Check to see if any ingloo has been hit */
     fewest_hits_left = 2;
@@ -1710,9 +1695,9 @@
     cloud.y = screen->h/3;
     cloud.city = fewest_index;
     bonus_comet_counter = Opts_BonusCometInterval()+1;
-#ifdef TUXMATH_DEBUG
-    printf("\nBonus comet counter restored to %d\n",bonus_comet_counter);
-#endif
+
+    DEBUGMSG(debug_game, "Bonus comet counter restored to %d\n",bonus_comet_counter);
+
     if (cloud.city < NUM_CITIES/2)
       cloud.x = -images[IMG_CLOUD]->w/2;  /* come in from the left */
     else
@@ -1725,9 +1710,8 @@
       cloud.snowflake_x[i] = - snow_width/2  + (rand() % snow_width);
       cloud.snowflake_size[i] = rand() % 3;
     }
-#ifdef TUXMATH_DEBUG
-    print_status();
-#endif
+    DEBUGCODE(debug_game)
+      print_status();
     return 1;
   } else
     return 0;
@@ -1740,12 +1724,13 @@
 
   if (cloud.status == EXTRA_LIFE_ON) {
 
-#ifdef TUXMATH_DEBUG
-     if (penguins[cloud.city].status == PENGUIN_WALKING_OFF) {
-       print_status();
-       pause_game();
-     }
-#endif
+    DEBUGCODE(debug_game)
+    {
+      if (penguins[cloud.city].status == PENGUIN_WALKING_OFF) {
+        print_status();
+        pause_game();
+      }
+    }
 
     // Get the cloud moving in the right direction, if not yet "parked"
     direction = 2*(cloud.city < NUM_CITIES/2) - 1;
@@ -2258,10 +2243,8 @@
   /* This SHOULD NOT HAPPEN and means we have a bug somewhere. */
   if (!MC_ListQuestionsLeft() && !num_comets_alive)
   {
-    #ifdef TUXMATH_DEBUG
-    printf("\nListQuestionsLeft() = %d", MC_ListQuestionsLeft());
-    printf("\nnum_comets_alive = %d", num_comets_alive);
-    #endif
+    DEBUGMSG(debug_game, "ListQuestionsLeft() = %d ", MC_ListQuestionsLeft());
+    DEBUGMSG(debug_game, "num_comets_alive = %d", num_comets_alive);
     return GAME_OVER_ERROR;
   }
 
@@ -2586,21 +2569,18 @@
   comets[found].zapped = 0;
   /* Should it be a bonus comet? */
   comets[found].bonus = 0;
-#ifdef TUXMATH_DEBUG
-  printf("\nbonus_comet_counter is %d\n",bonus_comet_counter);
-#endif
+
+  DEBUGMSG(debug_game, "bonus_comet_counter is %d\n",bonus_comet_counter);
+
   if (bonus_comet_counter == 1) {
     bonus_comet_counter = 0;
     comets[found].bonus = 1;
     playsound(SND_BONUS_COMET);
-#ifdef TUXMATH_DEBUG
-    printf("\nCreated bonus comet");
-#endif
+
+    DEBUGMSG(debug_game, "Created bonus comet");
   }
 
-  #ifdef TUXMATH_DEBUG
-  printf ("\nadd_comet(): formula string is: %s", comets[found].flashcard.formula_string);
-  #endif
+  DEBUGMSG(debug_game, "add_comet(): formula string is: %s", comets[found].flashcard.formula_string);
 
   /* Record the time at which this comet was created */
   comets[found].time_started = SDL_GetTicks();
@@ -3230,12 +3210,13 @@
     /* Escape key - quit! */
     user_quit_received = GAME_OVER_ESCAPE;
   }
-#ifdef TUXMATH_DEBUG
-  if (key == SDLK_LEFTBRACKET) //a nice nonobvious/unused key
+  DEBUGCODE(debug_game)
   {
-    user_quit_received = GAME_OVER_CHEATER;
+    if (key == SDLK_LEFTBRACKET) //a nice nonobvious/unused key
+    {
+      user_quit_received = GAME_OVER_CHEATER;
+    }
   }
-#endif
   else if (key == SDLK_TAB
         || key == SDLK_p)
   {

Modified: tuxmath/trunk/src/globals.h
===================================================================
--- tuxmath/trunk/src/globals.h	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/globals.h	2009-07-05 16:24:23 UTC (rev 1146)
@@ -32,15 +32,10 @@
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 #define max(a,b) (((a) > (b)) ? (a) : (b))
 
-/* for conditional compilation of debugging output */
-//#define TUXMATH_DEBUG
 /* for Tim's feedback speed control code           */
 //#define FEEDBACK_DEBUG
 //#define LINEBREAK
 
-/* deprecated ;) */
-#define tmdprintf(...) DEBUGMSG(debug_all, __VA_ARGS__)
-
 /* debug data (declared in options.c) */
 extern int debug_status;
 
@@ -59,6 +54,8 @@
 extern const int debug_lessons;
 extern const int debug_highscore;
 extern const int debug_options;
+extern const int debug_convert_utf;
+extern const int debug_multiplayer;
 extern const int debug_all;
 
 /* debug macros */

Modified: tuxmath/trunk/src/highscore.c
===================================================================
--- tuxmath/trunk/src/highscore.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/highscore.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -383,9 +383,7 @@
   /* We need to get Unicode vals from SDL keysyms */
   SDL_EnableUNICODE(SDL_ENABLE);
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "\nEnter HighScoreNameEntry()\n" );
-#endif
+  DEBUGMSG(debug_highscore, "Enter HighScoreNameEntry()\n" );
 
 
   /* Draw background: */
@@ -479,10 +477,8 @@
         }
         case SDL_KEYDOWN:
         {
-#ifdef TUXMATH_DEBUG
-          fprintf(stderr, "Before keypress, string is %S\tlength = %d\n",
-                  wchar_buf, (int)wcslen(wchar_buf));
-#endif
+          DEBUGMSG(debug_highscore, "Before keypress, string is %S\tlength = %d\n",
+                   wchar_buf, (int)wcslen(wchar_buf));
           switch (event.key.keysym.sym)
           {
             case SDLK_ESCAPE:
@@ -514,10 +510,8 @@
             }
           }  /* end  'switch (event.key.keysym.sym)'  */
 
-#ifdef TUXMATH_DEBUG
-          fprintf(stderr, "After keypress, string is %S\tlength = %d\n",
-                    wchar_buf, (int)wcslen(wchar_buf));
-#endif
+          DEBUGMSG(debug_highscore, "After keypress, string is %S\tlength = %d\n",
+                   wchar_buf, (int)wcslen(wchar_buf));
             /* Now draw name, if needed: */
           if (redraw)
           {
@@ -747,11 +741,8 @@
   int score_read;
   int diff_level;
 
+  DEBUGMSG(debug_highscore, "Entering read_high_scores_fp()\n");
 
-#ifdef TUXMATH_DEBUG
-  printf("\nEntering read_high_scores_fp()\n");
-#endif
-
   /* get out if file pointer invalid: */
   if(!fp)
   {

Modified: tuxmath/trunk/src/lessons.c
===================================================================
--- tuxmath/trunk/src/lessons.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/lessons.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -35,9 +35,7 @@
   const char delimiters[] = "\t\n\r"; /* this will keep newline chars out of string */
   int i;
 
-#ifdef TUXMATH_DEBUG
-  printf("\nEntering read_goldstars_fp()\n");
-#endif
+  DEBUGMSG(debug_lessons, "Entering read_goldstars_fp()\n");
 
   /* get out if file pointer invalid: */
   if(!fp)
@@ -96,9 +94,7 @@
 {
   int i = 0;
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "\nEntering write_goldstars_fp()\n");
-#endif
+  DEBUGMSG(debug_lessons, "Entering write_goldstars_fp()\n");
 
   /* get out if file pointer invalid: */
   if(!fp)
@@ -112,11 +108,9 @@
 
   for (i = 0; i < num_lessons; i++)
   {
-#ifdef TUXMATH_DEBUG
-    printf("i = %d\nfilename = %s\ngoldstar = %d\n",
-           i, lesson_list_filenames[i],
-           lesson_list_goldstars[i]);
-#endif
+    DEBUGMSG(debug_lessons, "i = %d\nfilename = %s\ngoldstar = %d\n",
+             i, lesson_list_filenames[i],
+             lesson_list_goldstars[i]);
 
     if(lesson_list_goldstars[i] == 1)
     {

Modified: tuxmath/trunk/src/multiplayer.c
===================================================================
--- tuxmath/trunk/src/multiplayer.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/multiplayer.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -32,7 +32,7 @@
 {
   if (inprogress)
   {
-    tmdprintf("Oops, tried to set param %d in the middle of a game\n", param);
+    DEBUGMSG(debug_multiplayer, "Oops, tried to set param %d in the middle of a game\n", param);
     return;
   }
   params[param] = value;
@@ -84,7 +84,7 @@
       
       if (activeplayers <= 1) //last man standing!
       {
-        tmdprintf("%d wins\n", currentplayer);
+        DEBUGMSG(debug_multiplayer, "%d wins\n", currentplayer);
         winners[0] = currentplayer;
         done = 1;
       }
@@ -125,8 +125,9 @@
       }
     }
   }
-  
-  tmdprintf("Game over; showing winners\n");
+
+  DEBUGMSG(debug_multiplayer, "Game over; showing winners\n");
+
   showWinners(winners, params[PLAYERS]);
   cleanupMP();
 }
@@ -135,7 +136,7 @@
 {
   if (playernum > params[PLAYERS])
   {
-    tmdprintf("No player %d!\n", playernum);
+    DEBUGMSG(debug_multiplayer, "No player %d!\n", playernum);
     return 0;
   }
   return pscores[playernum];
@@ -145,7 +146,7 @@
 {
   if (playernum > params[PLAYERS])
   {
-    tmdprintf("No player %d!\n", playernum);
+    DEBUGMSG(debug_multiplayer, "No player %d!\n", playernum);
     return 0;
   }
   return pnames[playernum];
@@ -181,10 +182,9 @@
   {
     snprintf(strchr(text, '\0'), sectionlength, _("Then %s\n"), pnames[winners[i]]);
   }
-  
-  tmdprintf("%s", pnames[winners[0]] );
-  tmdprintf("Win text: %s\n", text);
 
+  DEBUGMSG(debug_multiplayer, "%s Win text: %s\n", pnames[winners[0]], text);
+
   DarkenScreen(1);
 
   while (box.h < screen->h || box.w < screen->w)
@@ -229,7 +229,7 @@
     "multiplay/commando"
   };
 
-  tmdprintf("Reading in difficulty settings...\n");
+  DEBUGMSG(debug_multiplayer, "Reading in difficulty settings...\n");
 
   success *= read_global_config_file();
 

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/options.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -56,6 +56,8 @@
 const int debug_lessons        = 1 << 11;
 const int debug_highscore      = 1 << 12;
 const int debug_options        = 1 << 13;
+const int debug_convert_utf    = 1 << 14;
+const int debug_multiplayer    = 1 << 15;
 const int debug_all            = ~0;
 
 /* extern'd constants */

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/setup.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -204,9 +204,8 @@
     /* (can still proceed).         */
   }
 
-#ifdef TUXMATH_DEBUG
-  print_high_scores(stdout);
-#endif
+  DEBUGCODE(debug_setup)
+    print_high_scores(stdout);
 }
 
 
@@ -546,11 +545,11 @@
       Opts_SetSoundHWAvailable(1);
     else
       frequency = format = channels = 0; //more helpful than garbage
-    tmdprintf("Sound mixer: frequency = %d, "
-                    "format = %x, "
-                    "channels = %d, "
-                    "n_timesopened = %d\n",
-                    frequency,format,channels,n_timesopened);
+    DEBUGMSG(debug_setup, "Sound mixer: frequency = %d, "
+                          "format = %x, "
+                          "channels = %d, "
+                          "n_timesopened = %d\n",
+                          frequency,format,channels,n_timesopened);
   }
 
   #endif
@@ -561,17 +560,17 @@
     if (videoInfo->hw_available)
     {
       surfaceMode = SDL_HWSURFACE;
-      tmdprintf("HW mode\n");
+      DEBUGMSG(debug_setup, "HW mode\n");
     }
     else
     {
       surfaceMode = SDL_SWSURFACE;
-      tmdprintf("SW mode\n");
+      DEBUGMSG(debug_setup, "SW mode\n");
     }
 
     // Determine the current resolution: this will be used as the
     // fullscreen resolution, if the user wants fullscreen.
-    tmdprintf("Current resolution: w %d, h %d.\n",videoInfo->current_w,videoInfo->current_h);
+    DEBUGMSG(debug_setup, "Current resolution: w %d, h %d.\n",videoInfo->current_w,videoInfo->current_h);
     fs_res_x = videoInfo->current_w;
     fs_res_y = videoInfo->current_h;
 

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/titlescreen.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -835,7 +835,7 @@
       }
       case 6: {
         // Quit
-        tmdprintf("Exiting main menu\n");
+        DEBUGMSG(debug_titlescreen, "Exiting main menu\n");
         return 0;
       }    
     }
@@ -883,7 +883,7 @@
       case 4:
         return 0;
       default:
-        tmdprintf("choose_menu_item() returned %d--returning\n", choice);
+        DEBUGMSG(debug_titlescreen, "choose_menu_item() returned %d--returning\n", choice);
         return 0;
     }
   }

Modified: tuxmath/trunk/src/tuxmath.c
===================================================================
--- tuxmath/trunk/src/tuxmath.c	2009-07-05 14:32:37 UTC (rev 1145)
+++ tuxmath/trunk/src/tuxmath.c	2009-07-05 16:24:23 UTC (rev 1146)
@@ -46,16 +46,14 @@
   s3 = bind_textdomain_codeset(PACKAGE, "UTF-8");
   s4 = textdomain(PACKAGE);
 
-#ifdef TUXMATH_DEBUG
-  fprintf(stderr, "PACKAGE = %s\n", PACKAGE);
-  fprintf(stderr, "TUXLOCALE = %s\n", TUXLOCALE);
-  fprintf(stderr, "setlocale(LC_ALL, \"\") returned: %s\n", s1);
-  fprintf(stderr, "bindtextdomain(PACKAGE, TUXLOCALE) returned: %s\n", s2);
-  fprintf(stderr, "bind_textdomain_codeset(PACKAGE, \"UTF-8\") returned: %s\n", s3);
-  fprintf(stderr, "textdomain(PACKAGE) returned: %s\n", s4);
-  fprintf(stderr, "gettext(\"Help\"): %s\n\n", gettext("Help"));
-  fprintf(stderr, "After gettext() call\n");
-#endif
+  DEBUGMSG(debug_setup, "PACKAGE = %s\n", PACKAGE);
+  DEBUGMSG(debug_setup, "TUXLOCALE = %s\n", TUXLOCALE);
+  DEBUGMSG(debug_setup, "setlocale(LC_ALL, \"\") returned: %s\n", s1);
+  DEBUGMSG(debug_setup, "bindtextdomain(PACKAGE, TUXLOCALE) returned: %s\n", s2);
+  DEBUGMSG(debug_setup, "bind_textdomain_codeset(PACKAGE, \"UTF-8\") returned: %s\n", s3);
+  DEBUGMSG(debug_setup, "textdomain(PACKAGE) returned: %s\n", s4);
+  DEBUGMSG(debug_setup, "gettext(\"Help\"): %s\n\n", gettext("Help"));
+  DEBUGMSG(debug_setup, "After gettext() call\n");
 
   setup(argc, argv);
   TitleScreen();  /* Run the game! */




More information about the Tux4kids-commits mailing list