[Tux4kids-commits] r751 - in tuxmath/trunk: mingw src

cheezmeister-guest at alioth.debian.org cheezmeister-guest at alioth.debian.org
Mon Sep 8 03:25:33 UTC 2008


Author: cheezmeister-guest
Date: 2008-09-08 03:25:33 +0000 (Mon, 08 Sep 2008)
New Revision: 751

Modified:
   tuxmath/trunk/mingw/tuxmath.cbp
   tuxmath/trunk/src/factroids.c
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/game.c
   tuxmath/trunk/src/highscore.c
   tuxmath/trunk/src/mathcards.c
   tuxmath/trunk/src/mathcards.h
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/options.h
   tuxmath/trunk/src/setup.c
   tuxmath/trunk/src/titlescreen.c
Log:
Reorganized game options so that global options are held separately and 
will not be overridden by individual mission files. 


Modified: tuxmath/trunk/mingw/tuxmath.cbp
===================================================================
--- tuxmath/trunk/mingw/tuxmath.cbp	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/mingw/tuxmath.cbp	2008-09-08 03:25:33 UTC (rev 751)
@@ -47,7 +47,6 @@
 					<Add option='-DPROGRAM_NAME=\\&quot;tuxmath\\&quot;' />
 					<Add option='-DDATA_PREFIX=\\&quot;../data\\&quot;' />
 					<Add option='-DLOCALEDIR=\\&quot;/usr/local/share/locale\\&quot;' />
-					<Add option='-DVERSION=\\&quot;1.6.3\\&quot;' />
 				</Compiler>
 			</Target>
 			<Target title="NixRelease">
@@ -64,7 +63,6 @@
 					<Add option='-DPROGRAM_NAME=\\&quot;tuxmath\\&quot;' />
 					<Add option='-DDATA_PREFIX=\\&quot;/usr/local/share/tuxmath\\&quot;' />
 					<Add option='-DLOCALEDIR=\\&quot;/usr/local/share/locale\\&quot;' />
-					<Add option="-DVERSION=FULLVERSION_STRING" />
 				</Compiler>
 			</Target>
 		</Build>

Modified: tuxmath/trunk/src/factroids.c
===================================================================
--- tuxmath/trunk/src/factroids.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/factroids.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -1909,7 +1909,7 @@
   /* get out unless we really are using keypad */
   if ( level_start_wait 
     || Opts_DemoMode()
-    || !Opts_UseKeypad())
+    || !Opts_GetGlobalOpt(USE_KEYPAD))
   {
     return -1;
   }

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/fileops.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -104,6 +104,7 @@
 static int is_lesson_file(const struct dirent *lfdirent);
 static int read_goldstars(void);
 static int read_lines_from_file(FILE *fp,char ***lines);
+static int parse_option(const char* name, int val, int file_type);
 static void dirname_up(char *dirname);
 static char* get_user_name(void);
 static char* get_file_name(char *fullpath);
@@ -1195,64 +1196,64 @@
     /* Now ready to handle each name/value pair! */
     
     /* Set general game_options struct (see tuxmath.h): */ 
-    if(0 == strcasecmp(parameter, "per_user_config"))
+//    if(0 == strcasecmp(parameter, "per_user_config"))
+//    {
+//      /* Only let administrator change this setting */
+//      if (file_type == GLOBAL_CONFIG_FILE) 
+//      {
+//        int v = str_to_bool(value);
+//        if (v != -1)
+//          Opts_SetGlobalOpt(PER_USER_CONFIG, v);
+//      }
+//    }
+//                                 
+//    else if(0 == strcasecmp(parameter, "homedir"))
+//    {
+//      /* Only let administrator change this setting */
+//      if (file_type == GLOBAL_CONFIG_FILE && user_data_dir == NULL)
+//      {
+//        /* Check to see whether the specified homedir exists */
+//        dir = opendir(value);
+//        if (dir == NULL)
+//          fprintf(stderr,"homedir: %s is not a directory, or it could not be read\n", value);
+//        else {
+//          set_user_data_dir(value);  /* copy the homedir setting */
+//          closedir(dir);
+//        }
+//      }
+//    }
+//
+//    else if(0 == strcasecmp(parameter, "use_sound"))
+//    {
+//      int v = str_to_bool(value);
+//      if (v != -1)
+//        Opts_SetGlobalOpt(USE_SOUND, v);
+//    }
+//    else if(0 == strcasecmp(parameter, "menu_sound"))
+//    {
+//      int v = str_to_bool(value);
+//      if (v != -1)
+//        Opts_SetGlobalOpt(MENU_SOUND, v);
+//    }
+//
+//    else if(0 == strcasecmp(parameter, "menu_music"))
+//    {
+//      int v = str_to_bool(value);
+//      if (v != -1)
+//        Opts_SetGlobalOpt(MENU_MUSIC, v);
+//    }
+//
+//    else if(0 == strcasecmp(parameter, "fullscreen"))
+//    {
+//      int v = str_to_bool(value);
+//      if (v != -1)
+//        Opts_SetGlobalOpt(FULLSCREEN, v);
+//    }
+    //TODO herd these per-game options into their own "domain" as well
+    if(0 == strcasecmp(parameter, "use_bkgd"))
     {
-      /* Only let administrator change this setting */
-      if (file_type == GLOBAL_CONFIG_FILE) 
-      {
-        int v = str_to_bool(value);
-        if (v != -1)
-          Opts_SetPerUserConfig(v);
-      }
-    }
-
-    else if(0 == strcasecmp(parameter, "homedir"))
-    {
-      /* Only let administrator change this setting */
-      if (file_type == GLOBAL_CONFIG_FILE && user_data_dir == NULL)
-      {
-        /* Check to see whether the specified homedir exists */
-        dir = opendir(value);
-        if (dir == NULL)
-          fprintf(stderr,"homedir: %s is not a directory, or it could not be read\n", value);
-        else {
-          set_user_data_dir(value);  /* copy the homedir setting */
-          closedir(dir);
-        }
-      }
-    }
-
-    else if(0 == strcasecmp(parameter, "use_sound"))
-    {
       int v = str_to_bool(value);
       if (v != -1)
-        Opts_SetUseSound(v);
-    }
-    else if(0 == strcasecmp(parameter, "menu_sound"))
-    {
-      int v = str_to_bool(value);
-      if (v != -1)
-        Opts_SetMenuSound(v);
-    }
-
-    else if(0 == strcasecmp(parameter, "menu_music"))
-    {
-      int v = str_to_bool(value);
-      if (v != -1)
-        Opts_SetMenuMusic(v);
-    }
-
-    else if(0 == strcasecmp(parameter, "fullscreen"))
-    {
-      int v = str_to_bool(value);
-      if (v != -1)
-        Opts_SetFullscreen(v);
-    }
-
-    else if(0 == strcasecmp(parameter, "use_bkgd"))
-    {
-      int v = str_to_bool(value);
-      if (v != -1)
         Opts_SetUseBkgd(v);
     }
 
@@ -1274,7 +1275,7 @@
     {
       int v = str_to_bool(value);
       if (v != -1)
-        Opts_SetUseKeypad(v);
+        Opts_SetGlobalOpt(USE_KEYPAD, v);
     }
 
     else if(0 == strcasecmp(parameter, "allow_pause"))
@@ -1288,7 +1289,7 @@
     {
       int v = str_to_bool(value);
       if (v != -1)
-        Opts_SetUseIgloos(v);
+        Opts_SetGlobalOpt(USE_IGLOOS, v);
     }
 
     else if(0 == strcasecmp(parameter, "bonus_comet_interval"))
@@ -1367,7 +1368,7 @@
     else if(0 == strcasecmp(parameter, "starting_comets"))
     {
       Opts_SetStartingComets(atoi(value));
-    }
+    }          
 
     else if(0 == strcasecmp(parameter, "extra_comets_per_wave"))
     {
@@ -1384,9 +1385,37 @@
       Opts_SetKeepScore(atoi(value) );
     }
 
-    else
-    {   
-      MC_SetOp(parameter, atoi(value) ); //automatically handles bad parameters
+    else //we're going to delegate the setting of options to their subsystems
+    {
+      int ival = str_to_bool(value); //see if it's a valid bool
+      if (ival == -1) //guess not, must be an int
+        ival = atoi(value);
+      if (!parse_option(parameter, ival, file_type) )
+        printf("Sorry, I couldn't set %s\n", parameter);
+//        
+//      if (file_type != GLOBAL_CONFIG_FILE)
+//        MC_SetOp(parameter, ival); 
+//      else
+//      {
+//        if(0 != strcasecmp(parameter, "homedir"))
+//        {
+//          Opts_SetGlobalOp(parameter, ival);
+//        }
+//        else //set homedir
+//        {
+//          if (user_data_dir == NULL)
+//          {
+//            /* Check to see whether the specified homedir exists */
+//            dir = opendir(value);
+//            if (dir == NULL)
+//              fprintf(stderr,"homedir: %s is not a directory, or it could not be read\n", value);
+//            else {
+//              set_user_data_dir(value);  /* copy the homedir setting */
+//              closedir(dir);
+//            }
+//          }
+//        }
+//      }
     }
     free(parameter);
   }
@@ -1415,6 +1444,28 @@
   return 1;
 }
 
+/* determine which option class a name belongs to, and set it */
+/* accordingly. Returns 1 on success, 0 on failure            */
+static int parse_option(const char* name, int val, int file_type)
+{
+  int index = -1;
+  
+  if ((index = MC_MapTextToIndex(name)) != -1) //is it a math opt?
+  {
+    MC_SetOpt(index, val);
+  }
+  else if ((index = Opts_MapTextToIndex(name)) != -1) //is it a global opt?
+  {
+    if (file_type == GLOBAL_CONFIG_FILE)
+      Opts_SetGlobalOpt(index, val);
+  }
+  else //no? oh well.
+  {
+    return 0;
+  }
+  
+  return 1;
+}
 
 
 int write_user_config_file(void)
@@ -1716,7 +1767,7 @@
   {
     //use_sound comment
   } 
-  fprintf(fp, "use_sound = %d\n", Opts_UseSound() );
+  fprintf(fp, "use_sound = %d\n", Opts_GetGlobalOpt(USE_SOUND) );
   
   if (verbose)
   {
@@ -1904,7 +1955,7 @@
                  "# out' by accidentally setting per_user_config to 0.       #\n"
                  "############################################################\n\n");
   }
-  fprintf(fp, "per_user_config = %d\n", Opts_PerUserConfig());
+  fprintf(fp, "per_user_config = %d\n", Opts_GetGlobalOpt(PER_USER_CONFIG));
   fprintf(fp, "# homedir = /servervolume/tuxmath_users\n");
 
 
@@ -2308,6 +2359,7 @@
 
 /* Allows use of "true", "YES", T, etc. in text file for boolean values. */
 /* Return value of -1 means value string is not recognized.              */
+/* Now reject non-"boolish" ints to prevent int/bool ambiguity           */
 static int str_to_bool(const char* val)
 {
   char* ptr;
@@ -2317,6 +2369,7 @@
     ||(0 == strcasecmp(val, "t"))
     ||(0 == strcasecmp(val, "yes"))
     ||(0 == strcasecmp(val, "y"))
+    ||(0 == strcasecmp(val, "1"))
     ||(0 == strcasecmp(val, "on")))
   {
     return 1;
@@ -2326,11 +2379,14 @@
     ||(0 == strcasecmp(val, "f"))
     ||(0 == strcasecmp(val, "no"))
     ||(0 == strcasecmp(val, "n"))
-    ||(0 == strcasecmp(val, "off")))
+    ||(0 == strcasecmp(val, "0"))
+  ||(0 == strcasecmp(val, "off")))
   {
     return 0;
   }  
 
+  return -1;
+  
   /* Return -1 if any chars are non-digits: */
   ptr = (char*)val;
   while (*ptr)
@@ -2341,6 +2397,7 @@
   }
 
   /* If we get to here, val should be an integer. */
+  
   if (atoi(val))
     return 1;
   else

Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/game.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -201,7 +201,7 @@
 #endif
 
   //see if the option matches the actual screen
-  if (Opts_Fullscreen() == !(screen->flags & SDL_FULLSCREEN) )
+  if (Opts_GetGlobalOpt(FULLSCREEN) == !(screen->flags & SDL_FULLSCREEN) )
     {
     ;//SwitchScreenMode();
     }
@@ -467,7 +467,7 @@
 void game_set_start_message(const char* m1, const char* m2, 
                             const char* m3, const char* m4)
 {
-  game_set_message(&s1, m1, screen->w / 2 - 40, RES_Y * 2 / 10);
+  game_set_message(&s1, m1, -1, RES_Y * 2 / 10);
   game_set_message(&s2, m2, screen->w / 2 - 40, RES_Y * 3 / 10);
   game_set_message(&s3, m3, screen->w / 2 - 40, RES_Y * 4 / 10);
   game_set_message(&s4, m4, screen->w / 2 - 40, RES_Y * 5 / 10);
@@ -569,7 +569,7 @@
 
   /* (Create and position cities) */
 
-  if (Opts_UseIgloos())
+  if (Opts_GetGlobalOpt(USE_IGLOOS))
     img = IMG_IGLOO_INTACT;
   else
     img = IMG_CITY_BLUE;
@@ -951,6 +951,7 @@
     else
       rect.x = msg->x;              // left justified
     rect.y = msg->y;
+    //FIXME alpha blending doesn't seem to work properly
     SDL_SetAlpha(surf, SDL_SRCALPHA, msg->alpha);
     SDL_BlitSurface(surf, NULL, screen, &rect);
     SDL_FreeSurface(surf);
@@ -1367,7 +1368,7 @@
         if (cities[this_city].hits_left)
         {
           cities[this_city].status = CITY_EXPLODING;
-          if (Opts_UseIgloos()) {
+          if (Opts_GetGlobalOpt(USE_IGLOOS)) {
             playsound(SND_IGLOO_SIZZLE);
             cities[this_city].counter = IGLOO_SWITCH_START;
             steam[this_city].status = STEAM_ON;
@@ -1483,7 +1484,7 @@
         if (cities[i].hits_left)
           cities[i].status = CITY_PRESENT;
         else {
-          if (Opts_UseIgloos()) {
+          if (Opts_GetGlobalOpt(USE_IGLOOS)) {
             cities[i].status = CITY_EVAPORATING;
             cities[i].counter = EVAPORATING_COUNTER_START;
             cities[i].img = IMG_IGLOO_MELTED1;
@@ -1495,7 +1496,7 @@
       }
     }
     /* Choose the correct city/igloo image */
-    if (Opts_UseIgloos()) {
+    if (Opts_GetGlobalOpt(USE_IGLOOS)) {
       if (cities[i].status == CITY_EVAPORATING) {
         /* Handle the evaporation animation */
         cities[i].layer = 0;  /* these have to be drawn below the penguin */
@@ -1545,7 +1546,7 @@
 {
   int i,direction,walk_counter;
 
-  if (!Opts_UseIgloos())
+  if (!Opts_GetGlobalOpt(USE_IGLOOS))
     return;
   for (i = 0; i < NUM_CITIES; i++) {
     penguins[i].layer = 0;
@@ -1651,7 +1652,7 @@
 {
   int i;
 
-  if (!Opts_UseIgloos())
+  if (!Opts_GetGlobalOpt(USE_IGLOOS))
     return;
   for (i = 0; i < NUM_CITIES; i++) {
     if (steam[i].counter) {
@@ -1807,7 +1808,7 @@
   }
 
   /* Draw numeric keypad: */
-  if (Opts_UseKeypad())
+  if (Opts_GetGlobalOpt(USE_KEYPAD))
   {
     /* pick image to draw: */
     int keypad_image;
@@ -1988,7 +1989,7 @@
   SDL_Rect src, dest;
   SDL_Surface* this_image;
 
-  if (Opts_UseIgloos()) {
+  if (Opts_GetGlobalOpt(USE_IGLOOS)) {
     /* We have to draw respecting layering */
     current_layer = 0;
     max_layer = 0;
@@ -3064,7 +3065,7 @@
   /* get out unless we really are using keypad */
   if ( level_start_wait
     || Opts_DemoMode()
-    || !Opts_UseKeypad())
+    || !Opts_GetGlobalOpt(USE_KEYPAD))
   {
     return;
   }
@@ -3259,7 +3260,7 @@
   /* Toggle screen mode: */
   else if (key == SDLK_F10)
   {
-    Opts_SetFullscreen(!Opts_Fullscreen() );
+    Opts_SetGlobalOpt(FULLSCREEN, !Opts_GetGlobalOpt(FULLSCREEN) );
     SwitchScreenMode();
     game_recalc_positions();
   }
@@ -3420,7 +3421,7 @@
 
   tmdprintf("Recalculating positions\n");
 
-  if (Opts_UseIgloos())
+  if (Opts_GetGlobalOpt(USE_IGLOOS))
     img = IMG_IGLOO_INTACT;
   else
     img = IMG_CITY_BLUE;
@@ -3455,7 +3456,7 @@
       continue;
 
     comets[i].x = cities[comets[i].city].x;
-    //if (Opts_Fullscreen() )
+    //if (Opts_GetGlobalOpt(FULLSCREEN) )
       comets[i].y = comets[i].y * city_expl_height / old_city_expl_height;
     //else
     //  comets[i].y = comets[i].y * RES_Y / screen->h;

Modified: tuxmath/trunk/src/highscore.c
===================================================================
--- tuxmath/trunk/src/highscore.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/highscore.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -130,7 +130,7 @@
             if (diff_level > CADET_HIGH_SCORE)
             {
               diff_level--;
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
               {
                 playsound(SND_TOCK);
               }
@@ -143,7 +143,7 @@
             if (diff_level < (NUM_HIGH_SCORE_LEVELS-1))
             {
               diff_level++;
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
               {
                 playsound(SND_TOCK);
               }

Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/mathcards.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -1841,7 +1841,7 @@
     if (!strcasecmp(text, MC_OPTION_TEXT[i]) )
       return i;
   }
-  printf("Sorry, don't recognize option '%s'\n", text);
+  mcdprintf("'%s' isn't a math option\n", text);
   return NOT_VALID_OPTION;
 }
 
@@ -1850,7 +1850,7 @@
 {
   if (index >= NOPTS)
   {
-    mcdprintf("Invalid option index: %d\n", index);
+    mcdprintf("Invalid math option index: %d\n", index);
     return;
   }
   math_opts->iopts[index] = val;

Modified: tuxmath/trunk/src/mathcards.h
===================================================================
--- tuxmath/trunk/src/mathcards.h	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/mathcards.h	2008-09-08 03:25:33 UTC (rev 751)
@@ -15,7 +15,7 @@
 #ifndef MATHCARDS_H
 #define MATHCARDS_H
 
-#define MC_DEBUG
+//#define MC_DEBUG
 #ifdef MC_DEBUG
 #define mcdprintf(...) printf(__VA_ARGS__)
 #else

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/options.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -37,37 +37,69 @@
 
 //int opers[NUM_OPERS], range_enabled[NUM_Q_RANGES];
 
+/* extern'd constants */
+
+const char* const OPTION_TEXT[NUM_GLOBAL_OPTS+1] = {
+  "PER_USER_CONFIG",
+  "USE_SOUND",
+  "MENU_SOUND",
+  "MENU_MUSIC",
+  "FULLSCREEN",
+  "USE_KEYPAD",
+  "USE_IGLOOS",
+  "END_OF_OPTS"
+};
+
+const int DEFAULT_GLOBAL_OPTS[NUM_GLOBAL_OPTS] = {
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1
+};
+  
+
 /* file scope only now that accessor functions used: */
 static game_option_type* game_options;
+static global_option_type* global_options;
 
 /*local function prototypes: */
 static int int_to_bool(int i);
+//static int find_and_set_option(const char* name, int val);
 
 
-
 /********************************************************************/
 /*  "Public Methods" for options struct:                            */
 /********************************************************************/
 
 int Opts_Initialize(void)
 {
+  int i;
+  
   game_options = malloc(sizeof(game_option_type));
+  global_options = malloc(sizeof(global_option_type));
   /* bail out if no struct */
   if (!game_options)
     return 0;
 
+  /* set global program options */
+  for (i = 0; i < NUM_GLOBAL_OPTS; ++i)
+    global_options->iopts[i] = DEFAULT_GLOBAL_OPTS[i];
+    
   /* set general game options */
-  game_options->per_user_config = DEFAULT_PER_USER_CONFIG;
-  game_options->use_sound = DEFAULT_USE_SOUND;
-  game_options->menu_sound = DEFAULT_MENU_SOUND;
-  game_options->menu_music = DEFAULT_MENU_MUSIC;
-  game_options->fullscreen = DEFAULT_FULLSCREEN;
+  global_options->iopts[PER_USER_CONFIG] = DEFAULT_PER_USER_CONFIG;
+  global_options->iopts[USE_SOUND] = DEFAULT_USE_SOUND;
+  global_options->iopts[MENU_SOUND] = DEFAULT_MENU_SOUND;
+  global_options->iopts[MENU_MUSIC] = DEFAULT_MENU_MUSIC;
+  global_options->iopts[FULLSCREEN] = DEFAULT_FULLSCREEN;
+  global_options->iopts[USE_KEYPAD] = DEFAULT_USE_KEYPAD;
+  global_options->iopts[USE_IGLOOS] = DEFAULT_USE_IGLOOS;
   game_options->use_bkgd = DEFAULT_USE_BKGD;
   game_options->help_mode = DEFAULT_HELP_MODE;
   game_options->demo_mode = DEFAULT_DEMO_MODE;
   game_options->oper_override = DEFAULT_OPER_OVERRIDE;
-  game_options->use_keypad = DEFAULT_USE_KEYPAD;
-  game_options->use_igloos = DEFAULT_USE_IGLOOS;
   game_options->allow_pause = DEFAULT_ALLOW_PAUSE;
   game_options->bonus_comet_interval = DEFAULT_BONUS_COMET_INTERVAL;
   game_options->bonus_speed_ratio = DEFAULT_BONUS_SPEED_RATIO;
@@ -109,41 +141,84 @@
 }
 
 
-/* "Set" functions for tuxmath options struct: */
-void Opts_SetPerUserConfig(int val)
+//* "Set" functions for tuxmath options struct: */
+unsigned int Opts_MapTextToIndex(const char* text)
 {
-  game_options->per_user_config = int_to_bool(val);
+  int i;
+  for (i = 0; i < NUM_GLOBAL_OPTS; ++i)
+  {
+    if (0 == strcasecmp(text, OPTION_TEXT[i]) )
+      return i;
+  }
+  tmdprintf("'%s' isn't a global option\n", text);
+  return -1;
 }
-
-
-void Opts_SetUseSound(int val)
+int Opts_GetGlobalOp(const char* text)
 {
-  if (val == -1)
-    game_options->use_sound = val;
-  else if (game_options->use_sound != -1)
-    game_options->use_sound = int_to_bool(val);
+  int index = Opts_MapTextToIndex(text);
+  if (index < NUM_GLOBAL_OPTS)
+    return Opts_GetGlobalOpt(index);
+  return 0;
 }
-
-
-void Opts_SetMenuSound(int val)
+int Opts_GetGlobalOpt(unsigned int index)
 {
-  game_options->menu_sound = int_to_bool(val);
+  if (index < NUM_GLOBAL_OPTS)
+    return global_options->iopts[index];
+    
+  tmdprintf("Invalid global option index: %d\n", index);
+  return 0;
 }
 
-
-void Opts_SetMenuMusic(int val)
+void Opts_SetGlobalOp(const char* text, int val)
 {
-  game_options->menu_music = int_to_bool(val);
+  int index = Opts_MapTextToIndex(text);
+  if (index < NUM_GLOBAL_OPTS)
+    Opts_SetGlobalOpt(index, val);
 }
-
-
-/* FIXME need to actually change screen resolution when this is called */
-void Opts_SetFullscreen(int val)
+    
+void Opts_SetGlobalOpt(unsigned int index, int val)
 {
-  game_options->fullscreen = int_to_bool(val);
+  if (index < NUM_GLOBAL_OPTS)
+    global_options->iopts[index] = val;
+  else
+    tmdprintf("Invalid global option index: %d\n", index);
 }
+  
 
+//void Opts_SetPerUserConfig(int val)
+//{
+//  global_options->iopts[PER_USER_CONFIG] = int_to_bool(val);
+//}
+//
+//
+//void Opts_SetUseSound(int val)
+//{
+//  if (val == -1)
+//    global_options->iopts[USE_SOUND] = val;
+//  else if (global_options->iopts[USE_SOUND] != -1)
+//    global_options->iopts[USE_SOUND] = int_to_bool(val);
+//}
+//
+//
+//void Opts_SetMenuSound(int val)
+//{
+//  global_options->iopts[MENU_SOUND] = int_to_bool(val);
+//}
+//
+//
+//void Opts_SetMenuMusic(int val)
+//{
+//  global_options->iopts[MENU_MUSIC] = int_to_bool(val);
+//}
 
+
+///* FIXME need to actually change screen resolution when this is called */
+//void Opts_SetFullscreen(int val)
+//{
+//  global_options->iopts[FULLSCREEN] = int_to_bool(val);
+//}
+
+
 void Opts_SetUseBkgd(int val)
 {
   game_options->use_bkgd = int_to_bool(val);
@@ -168,10 +243,10 @@
 }
 
 
-void Opts_SetUseKeypad(int val)
-{
-  game_options->use_keypad = int_to_bool(val);
-}
+//void Opts_SetUseKeypad(int val)
+//{
+//  global_options->iopts[USE_KEYPAD] = int_to_bool(val);
+//}
 
 
 void Opts_SetAllowPause(int val)
@@ -180,10 +255,10 @@
 }
 
 
-void Opts_SetUseIgloos(int val)
-{
-  game_options->use_igloos = int_to_bool(val);
-}
+//void Opts_SetUseIgloos(int val)
+//{
+//  global_options->iopts[USE_IGLOOS] = int_to_bool(val);
+//}
 
 
 void Opts_SetBonusCometInterval(int val)
@@ -451,61 +526,61 @@
 
 
 /* "Get" functions for tuxmath options struct: */
-int Opts_PerUserConfig(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_PerUserConfig(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->per_user_config;
-}
+//int Opts_PerUserConfig(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_PerUserConfig(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[PER_USER_CONFIG];
+//}
+//
+//
+//int Opts_UseSound(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_UseSound(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[USE_SOUND] > 0;
+//}
+//
+//
+//int Opts_MenuSound(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_MenuSound(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[MENU_SOUND];
+//}
+//
+//
+//int Opts_MenuMusic(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_MenuMusic(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[MENU_MUSIC];
+//}
+//
+//
+//int Opts_Fullscreen(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_Fullscreen(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[FULLSCREEN];
+//}
 
 
-int Opts_UseSound(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_UseSound(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->use_sound > 0;
-}
-
-
-int Opts_MenuSound(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_MenuSound(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->menu_sound;
-}
-
-
-int Opts_MenuMusic(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_MenuMusic(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->menu_music;
-}
-
-
-int Opts_Fullscreen(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_Fullscreen(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->fullscreen;
-}
-
-
 int Opts_UseBkgd(void)
 {
   if (!game_options)
@@ -550,17 +625,17 @@
 }
 
 
-int Opts_UseKeypad(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_UseKeypad(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->use_keypad;
-}
-
-
+//int Opts_UseKeypad(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_UseKeypad(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[USE_KEYPAD];
+//}
+//
+//
 int Opts_AllowPause(void)
 {
   if (!game_options)
@@ -572,15 +647,15 @@
 }
 
 
-int Opts_UseIgloos(void)
-{
-  if (!game_options)
-  {
-    fprintf(stderr, "\nOpts_UseIgloos(): game_options not valid!\n");
-    return GAME_OPTS_INVALID;
-  }
-  return game_options->use_igloos;
-}
+//int Opts_UseIgloos(void)
+//{
+//  if (!game_options)
+//  {
+//    fprintf(stderr, "\nOpts_UseIgloos(): game_options not valid!\n");
+//    return GAME_OPTS_INVALID;
+//  }
+//  return global_options->iopts[USE_IGLOOS];
+//}
 
 int Opts_BonusCometInterval(void)
 {
@@ -803,7 +878,7 @@
     fprintf(stderr, "\nOpts_UsingSound(): game_options not valid!\n");
     return GAME_OPTS_INVALID;
   }
-  return (game_options->use_sound>0 && game_options->sound_hw_available);
+  return (global_options->iopts[USE_SOUND]>0 && game_options->sound_hw_available);
 }
 
 int Opts_KeepScore(void)
@@ -833,7 +908,22 @@
     return 0;
 }
 
-
+///* determine which option class a name belongs to, and set it */
+///* accordingly. Returns 1 on success, 0 on failure            */
+//static int find_and_set_option(const char* name, int val)
+//{
+//  int index = -1;
+//  
+//  if ((index = MC_MapTextToIndex(name)) != -1) //is it a math opt?
+//    MC_SetOpt(index, val);
+//  else if ((index = Opts_MapTextToIndex(name)) != -1) //is it a global opt?
+//    Opts_SetGlobalOpt(index, val);
+//  else //no? oh well.
+//    return 0;
+//    
+//  return 1;
+//}
+  
 /* prints struct to stream: */
 void print_game_options(FILE* fp, int verbose)
 {
@@ -863,7 +953,7 @@
   if(verbose)
   {
     fprintf (fp, "############################################################\n" 
-                 "# 'per_user_config' determines whether Tuxmath will look   #\n"
+                 "# 'PER_USER_CONFIG' determines whether Tuxmath will look   #\n"
                  "# in the user's home directory for settings. Default is 1  #\n"
                  "# (yes). If deselected, the program will ignore the user's #\n"
                  "# .tuxmath file and use the the global settings in the     #\n"
@@ -871,21 +961,21 @@
                  "# This setting cannot be changed by an ordinary user.      #\n"
                  "############################################################\n");
   }
-  fprintf(fp, "per_user_config = %d\n", game_options->per_user_config);
+  fprintf(fp, "PER_USER_CONFIG = %d\n", global_options->iopts[PER_USER_CONFIG]);
 
   if(verbose)
   {
     fprintf (fp, "\n# Self-explanatory, default is 1:\n");
   }
-  fprintf(fp, "use_sound = %d\n", game_options->use_sound>0);
+  fprintf(fp, "USE_SOUND = %d\n", global_options->iopts[USE_SOUND]>0);
 
   if(verbose)
   {
-    fprintf (fp, "\n# Use fullscreen at 640x480 resolution instead of\n"
-                 "640x480 window. Default is 1 (fullscreen). Change to 0\n"
-                 "if SDL has trouble with fullscreen on your system.\n");
+    fprintf (fp, "\n# Use FULLSCREEN at 640x480 resolution instead of\n"
+                 "640x480 window. Default is 1 (FULLSCREEN). Change to 0\n"
+                 "if SDL has trouble with FULLSCREEN on your system.\n");
   } 
-  fprintf(fp, "fullscreen = %d\n", game_options->fullscreen);
+  fprintf(fp, "FULLSCREEN = %d\n", global_options->iopts[FULLSCREEN]);
 
   if(verbose)
   {
@@ -909,7 +999,7 @@
   {
     fprintf (fp, "\n# Display onscreen numeric keypad; default is 0.\n");
   }
-  fprintf(fp, "use_keypad = %d\n", game_options->use_keypad);
+  fprintf(fp, "USE_KEYPAD = %d\n", global_options->iopts[USE_KEYPAD]);
 
   if(verbose)
   {

Modified: tuxmath/trunk/src/options.h
===================================================================
--- tuxmath/trunk/src/options.h	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/options.h	2008-09-08 03:25:33 UTC (rev 751)
@@ -24,21 +24,34 @@
 
 #include "tuxmath.h"  /* needed for PATH_MAX definition */
 
+enum {
+  PER_USER_CONFIG,
+  USE_SOUND,
+  MENU_SOUND,
+  MENU_MUSIC,
+  FULLSCREEN,
+  USE_KEYPAD,
+  USE_IGLOOS,
+  NUM_GLOBAL_OPTS
+};                                 
+
+extern const char* const OPTION_TEXT[];
+extern const int OPTION_DEFAULTS[];
+
+/* contains options that tend to apply to the progam as a whole, rather *
+ * than on a per-game basis                                             */
+typedef struct global_option_type {
+  int iopts[NUM_GLOBAL_OPTS];
+} global_option_type;
+
 /* this struct contains all options regarding general       */
 /* gameplay but not having to do with math questions per se */
 typedef struct game_option_type {
   /* general game options */
-  int per_user_config;
-  int use_sound;
-  int menu_sound;
-  int menu_music;
-  int fullscreen;
   int use_bkgd;
   int help_mode;
   int demo_mode;
   int oper_override;
-  int use_keypad;
-  int use_igloos;
   int allow_pause;
   int bonus_comet_interval;
   float bonus_speed_ratio;
@@ -98,18 +111,18 @@
 int Opts_Initialize(void);
 void Opts_Cleanup(void);
 
+
 /* "Set" functions for tuxmath options struct: */
-void Opts_SetPerUserConfig(int val);
-void Opts_SetUseSound(int val);
-void Opts_SetMenuSound(int val);
-void Opts_SetMenuMusic(int val);
-void Opts_SetFullscreen(int val);
+
+unsigned int Opts_MapTextToIndex(const char* text);
+
+int  Opts_GetGlobalOpt(unsigned int index);
+void Opts_SetGlobalOpt(unsigned int index, int val);
+
 void Opts_SetUseBkgd(int val);
 void Opts_SetHelpMode(int val);
 void Opts_SetDemoMode(int val);
 void Opts_SetOperOverride(int val);
-void Opts_SetUseKeypad(int val);
-void Opts_SetUseIgloos(int val);
 void Opts_SetAllowPause(int val);
 void Opts_SetBonusCometInterval(int val);
 void Opts_SetBonusSpeedRatio(float val);
@@ -138,18 +151,11 @@
 void Opts_SetKeepScore(int val);
 
 /* "Get" functions for tuxmath options struct: */
-int Opts_PerUserConfig(void);
-int Opts_UseSound(void);
-int Opts_MenuSound(void);
-int Opts_MenuMusic(void);
-int Opts_Fullscreen(void);
 int Opts_UseBkgd(void);
 int Opts_HelpMode(void);
 int Opts_DemoMode(void);
 int Opts_OperOverride(void);
 int Opts_AllowPause(void);
-int Opts_UseKeypad(void);
-int Opts_UseIgloos(void);
 int Opts_BonusCometInterval(void);
 float Opts_BonusSpeedRatio(void);
 float Opts_Speed(void);

Modified: tuxmath/trunk/src/setup.c
===================================================================
--- tuxmath/trunk/src/setup.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/setup.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -116,7 +116,10 @@
   /* Generate blended images (e.g., igloos) */
   generate_blended_images();
   /* Note that the per-user options will be set after the call to
-     titlescreen, to allow for user-login to occur. */
+     titlescreen, to allow for user-login to occur. 
+     
+     FIXME this means that command-line args will be overridden!
+     Is this desirable? */
 }
 
 
@@ -161,7 +164,7 @@
   /* Read in user-specific settings, if desired.  By    */
   /* default, this restores settings from the player's last */
   /* game:                                                  */
-  if (Opts_PerUserConfig())
+  if (Opts_GetGlobalOpt(PER_USER_CONFIG))
   {
     if (!read_user_config_file())
     {
@@ -321,19 +324,19 @@
     else if (strcmp(argv[i], "--fullscreen") == 0 ||
              strcmp(argv[i], "-f") == 0)
     {
-      Opts_SetFullscreen(1);
+      Opts_SetGlobalOpt(FULLSCREEN, 1);
     }
     else if (strcmp(argv[i], "--windowed") == 0 ||
              strcmp(argv[i], "-w") == 0)
     {
-      Opts_SetFullscreen(0);
+      Opts_SetGlobalOpt(FULLSCREEN, 0);
     }
     else if (strcmp(argv[i], "--nosound") == 0 ||
              strcmp(argv[i], "-s") == 0 ||
              strcmp(argv[i], "--quiet") == 0 ||
              strcmp(argv[i], "-q") == 0)
     {
-      Opts_SetUseSound(-1);  // prevent options files from overwriting
+      Opts_SetGlobalOpt(USE_SOUND, -1);  // prevent options files from overwriting
     }
     else if (strcmp(argv[i], "--version") == 0 ||
              strcmp(argv[i], "-v") == 0)
@@ -356,7 +359,7 @@
     else if (strcmp(argv[i], "--keypad") == 0 ||
              strcmp(argv[i], "-k") == 0)
     {
-      Opts_SetUseKeypad(1);
+      Opts_SetGlobalOpt(USE_KEYPAD, 1);
     }
     else if (strcmp(argv[i], "--allownegatives") == 0 ||
              strcmp(argv[i], "-n") == 0)
@@ -404,10 +407,10 @@
   }/* end of command-line args */
 
 
-  if (Opts_DemoMode() && Opts_UseKeypad())
+  if (Opts_DemoMode() && Opts_GetGlobalOpt(USE_KEYPAD))
   {
     fprintf(stderr, "No use for keypad in demo mode!\n");
-    Opts_SetUseKeypad(0);
+    Opts_SetGlobalOpt(USE_KEYPAD, 0);
   }
 }
 
@@ -461,7 +464,7 @@
   #ifndef NOSOUND
   /* Init SDL Audio: */
   Opts_SetSoundHWAvailable(0);  // By default no sound HW
-  if (Opts_UseSound())
+  if (Opts_GetGlobalOpt(USE_SOUND))
   {
     if (SDL_Init(SDL_INIT_AUDIO) < 0)
     {
@@ -516,7 +519,7 @@
     fs_res_x = videoInfo->current_w;
     fs_res_y = videoInfo->current_h;
 
-    if (Opts_Fullscreen())
+    if (Opts_GetGlobalOpt(FULLSCREEN))
     {
       screen = SDL_SetVideoMode(fs_res_x, fs_res_y, PIXEL_BITS, SDL_FULLSCREEN | surfaceMode);
       if (screen == NULL)
@@ -525,11 +528,11 @@
               "\nWarning: I could not open the display in fullscreen mode.\n"
               "The Simple DirectMedia error that occured was:\n"
               "%s\n\n", SDL_GetError());
-        Opts_SetFullscreen(0);
+        Opts_SetGlobalOpt(FULLSCREEN, 0);
       }
     }
 
-    if (!Opts_Fullscreen())
+    if (!Opts_GetGlobalOpt(FULLSCREEN))
     {
       screen = SDL_SetVideoMode(RES_X, RES_Y, PIXEL_BITS, surfaceMode);
     }

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2008-08-31 07:56:43 UTC (rev 750)
+++ tuxmath/trunk/src/titlescreen.c	2008-09-08 03:25:33 UTC (rev 751)
@@ -206,8 +206,8 @@
 
   if (Opts_UsingSound())
   {
-    Opts_SetMenuSound(1);
-    Opts_SetMenuMusic(1);
+    Opts_SetGlobalOpt(MENU_SOUND, 1);
+    Opts_SetGlobalOpt(MENU_MUSIC, 1);
 //    menu_music = localsettings.menu_music;
   }
 
@@ -373,7 +373,7 @@
   beak.w = beak.h = 50;
 
   /* Start playing menu music if desired: */
-  if (Opts_MenuMusic())
+  if (Opts_GetGlobalOpt(MENU_MUSIC))
   {
     audioMusicLoad("tuxi.ogg", -1);
   }
@@ -706,11 +706,11 @@
         // Help
         Opts_SetHelpMode(1);
         Opts_SetDemoMode(0);
-        if (Opts_MenuMusic())  //Turn menu music off for game
+        if (Opts_GetGlobalOpt(MENU_MUSIC))  //Turn menu music off for game
           {audioMusicUnload();}
         game();
         RecalcTitlePositions();
-        if (Opts_MenuMusic()) //Turn menu music back on
+        if (Opts_GetGlobalOpt(MENU_MUSIC)) //Turn menu music back on
           {audioMusicLoad( "tuxi.ogg", -1 );}
         Opts_SetHelpMode(0);
         break;
@@ -890,7 +890,7 @@
         audioMusicUnload();
         game();
         RecalcTitlePositions();
-        if (Opts_MenuMusic()) {
+        if (Opts_GetGlobalOpt(MENU_MUSIC)) {
           audioMusicLoad( "tuxi.ogg", -1 );
         }
         /* See if player made high score list!                        */
@@ -946,14 +946,14 @@
   ShowMessage(s1, s2, s3, s4);
 
   if (read_user_config_file()) {
-    if (Opts_MenuMusic())
+    if (Opts_GetGlobalOpt(MENU_MUSIC))
       audioMusicUnload();
 
     game();
     RecalcTitlePositions();
     write_user_config_file();
 
-    if (Opts_MenuMusic())
+    if (Opts_GetGlobalOpt(MENU_MUSIC))
       audioMusicLoad( "tuxi.ogg", -1 );
   }
 
@@ -991,7 +991,7 @@
           audioMusicUnload();
           factors();
 	  
-	  if (Opts_MenuMusic()) {
+	  if (Opts_GetGlobalOpt(MENU_MUSIC)) {
 	      audioMusicLoad( "tuxi.ogg", -1 );
 	  }
 	  break;
@@ -999,7 +999,7 @@
           audioMusicUnload(); 
           fractions();
 	  
-	  if (Opts_MenuMusic()) {
+	  if (Opts_GetGlobalOpt(MENU_MUSIC)) {
 	     audioMusicLoad( "tuxi.ogg", -1 );
 	  }
 	  break;
@@ -1095,7 +1095,7 @@
         audioMusicUnload();
         game();
         RecalcTitlePositions();
-        if (Opts_MenuMusic()) {
+        if (Opts_GetGlobalOpt(MENU_MUSIC)) {
           audioMusicLoad( "tuxi.ogg", -1 );
         }
       } else {
@@ -1173,7 +1173,7 @@
 
   while (chosen_lesson >= 0)
   {
-    if (Opts_MenuSound())
+    if (Opts_GetGlobalOpt(MENU_SOUND))
       playsound(SND_POP);
 
     /* Re-read global settings first in case any settings were */
@@ -1182,7 +1182,7 @@
     /* Now read the selected file and play the "mission": */
     if (read_named_config_file(lesson_list_filenames[chosen_lesson]))
     {
-      if (Opts_MenuMusic())  //Turn menu music off for game
+      if (Opts_GetGlobalOpt(MENU_MUSIC))  //Turn menu music off for game
         {audioMusicUnload();}
 
 
@@ -1198,7 +1198,7 @@
         write_goldstars();
       }
 
-      if (Opts_MenuMusic()) //Turn menu music back on
+      if (Opts_GetGlobalOpt(MENU_MUSIC)) //Turn menu music back on
         {audioMusicLoad("tuxi.ogg", -1);}
     }
     else  // Something went wrong - could not read lesson config file:
@@ -1601,7 +1601,7 @@
             if (inRect(menu_button_rect[i], event.motion.x, event.motion.y))
             {
               // Play sound if loc is being changed:
-              if (Opts_MenuSound() && (old_loc != loc_screen_start + i))
+              if (Opts_GetGlobalOpt(MENU_SOUND) && (old_loc != loc_screen_start + i))
               {
                 playsound(SND_TOCK);
               }
@@ -1615,7 +1615,7 @@
           {
             if (loc_screen_start - n_entries_per_screen >= 0)
             {
-              if (Opts_MenuSound() && click_flag)
+              if (Opts_GetGlobalOpt(MENU_SOUND) && click_flag)
               {
                 playsound(SND_TOCK);
                 click_flag = 0;
@@ -1629,7 +1629,7 @@
           {
             if (loc_screen_start + n_entries_per_screen < n_menu_entries)
             {
-              if (Opts_MenuSound() && click_flag)
+              if (Opts_GetGlobalOpt(MENU_SOUND) && click_flag)
               {
                 playsound(SND_TOCK);
                 click_flag = 0;
@@ -1652,7 +1652,7 @@
           {
             if (inRect(menu_button_rect[i], event.button.x, event.button.y))
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
               {
                 playsound(SND_POP);
               }
@@ -1671,7 +1671,7 @@
               //loc = loc_screen_start - n_entries_per_screen;
               loc_screen_start -= n_entries_per_screen;
               loc = -1;  // nothing selected
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
               {
                 playsound(SND_TOCK);
               }
@@ -1687,7 +1687,7 @@
               //loc = loc_screen_start + n_entries_per_screen;
               loc_screen_start += n_entries_per_screen;
               loc = -1;  // nothing selected
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
               {
                 playsound(SND_TOCK);
               }
@@ -1720,7 +1720,7 @@
             case SDLK_SPACE:
             case SDLK_KP_ENTER:
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
                 playsound(SND_POP);
               stop = 1;
               break;
@@ -1731,7 +1731,7 @@
             case SDLK_LEFT:
             case SDLK_PAGEUP:
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
                 playsound(SND_TOCK);
               if (loc_screen_start - n_entries_per_screen >= 0) {
                 loc_screen_start -= n_entries_per_screen;
@@ -1746,7 +1746,7 @@
             case SDLK_RIGHT:
             case SDLK_PAGEDOWN:
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
                 playsound(SND_TOCK);
               if (loc_screen_start + n_entries_per_screen < n_menu_entries) {
                 loc_screen_start += n_entries_per_screen;
@@ -1759,7 +1759,7 @@
             /* Go up one entry, if present: */
             case SDLK_UP:
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
                 playsound(SND_TOCK);
               if (loc > title_offset)
                 {loc--;}
@@ -1779,7 +1779,7 @@
             /* Go down one entry, if present: */
             case SDLK_DOWN:
             {
-              if (Opts_MenuSound())
+              if (Opts_GetGlobalOpt(MENU_SOUND))
                 playsound(SND_TOCK);
               if (loc >= 0 && loc + 1 < n_menu_entries)
                 {loc++;}
@@ -1819,14 +1819,14 @@
             /* Toggle menu music: */
             case SDLK_F11:
             {
-              if (Opts_MenuMusic())
+              if (Opts_GetGlobalOpt(MENU_MUSIC))
               {
                 audioMusicUnload( );
-                Opts_SetMenuMusic(0);
+                Opts_SetGlobalOpt(MENU_MUSIC, 0);
               }
               else
               {
-                Opts_SetMenuMusic(1);
+                Opts_SetGlobalOpt(MENU_MUSIC, 1);
                 audioMusicLoad("tuxi.ogg", -1);
               }
               break;




More information about the Tux4kids-commits mailing list