[Tux4kids-commits] r71 - in tuxmath/trunk: data/images/title data/missions/lessons docs src

dbruce at alioth.debian.org dbruce at alioth.debian.org
Thu Mar 8 21:29:15 CET 2007


Author: dbruce
Date: 2007-01-24 19:22:08 +0000 (Wed, 24 Jan 2007)
New Revision: 71

Added:
   tuxmath/trunk/data/images/title/left_gray.png
   tuxmath/trunk/data/images/title/right_gray.png
   tuxmath/trunk/data/missions/lessons/lesson00
   tuxmath/trunk/data/missions/lessons/lesson04
   tuxmath/trunk/data/missions/lessons/lesson05
   tuxmath/trunk/data/missions/lessons/lesson06
   tuxmath/trunk/data/missions/lessons/lesson07
   tuxmath/trunk/data/missions/lessons/lesson08
   tuxmath/trunk/data/missions/lessons/lesson09
Modified:
   tuxmath/trunk/data/images/title/left.png
   tuxmath/trunk/data/images/title/right.png
   tuxmath/trunk/data/missions/lessons/lesson01
   tuxmath/trunk/data/missions/lessons/lesson02
   tuxmath/trunk/data/missions/lessons/lesson03
   tuxmath/trunk/docs/changelog
   tuxmath/trunk/src/credits.c
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/mathcards.c
   tuxmath/trunk/src/mathcards.h
   tuxmath/trunk/src/options.c
   tuxmath/trunk/src/options.h
   tuxmath/trunk/src/titlescreen.c
   tuxmath/trunk/src/titlescreen.h
   tuxmath/trunk/src/tuxmath.c
   tuxmath/trunk/src/tuxmath.h
Log:
More menu work



Modified: tuxmath/trunk/data/images/title/left.png
===================================================================
(Binary files differ)

Added: tuxmath/trunk/data/images/title/left_gray.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/title/left_gray.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: tuxmath/trunk/data/images/title/right.png
===================================================================
(Binary files differ)

Added: tuxmath/trunk/data/images/title/right_gray.png
===================================================================
(Binary files differ)


Property changes on: tuxmath/trunk/data/images/title/right_gray.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: tuxmath/trunk/data/missions/lessons/lesson00
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson00	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson00	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Number Typing
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 0
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+allow_negatives = 0
+typing_practice_allowed = 1
+min_augend = 1
+max_augend = 3
+min_addend = 1
+max_addend = 3
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 2
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 0
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 400
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Modified: tuxmath/trunk/data/missions/lessons/lesson01
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson01	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson01	2007-01-24 19:22:08 UTC (rev 71)
@@ -7,6 +7,7 @@
 multiplication_allowed = 0
 division_allowed = 0
 allow_negatives = 0
+typing_practice_allowed = 0
 min_augend = 1
 max_augend = 3
 min_addend = 1
@@ -23,6 +24,8 @@
 max_divisor = 10
 min_quotient = 0
 max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
 save_summary = 1
 question_copies = 2
 repeat_wrongs = 1

Modified: tuxmath/trunk/data/missions/lessons/lesson02
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson02	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson02	2007-01-24 19:22:08 UTC (rev 71)
@@ -5,6 +5,7 @@
 addition_allowed = 1
 subtraction_allowed = 0
 multiplication_allowed = 0
+typing_practice_allowed = 0
 division_allowed = 0
 allow_negatives = 0
 min_augend = 0
@@ -23,6 +24,8 @@
 max_divisor = 10
 min_quotient = 0
 max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
 save_summary = 1
 question_copies = 2
 repeat_wrongs = 1

Modified: tuxmath/trunk/data/missions/lessons/lesson03
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson03	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson03	2007-01-24 19:22:08 UTC (rev 71)
@@ -6,6 +6,7 @@
 subtraction_allowed = 0
 multiplication_allowed = 0
 division_allowed = 0
+typing_practice_allowed = 0
 allow_negatives = 0
 min_augend = 0
 max_augend = 10
@@ -23,6 +24,8 @@
 max_divisor = 10
 min_quotient = 0
 max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
 save_summary = 1
 question_copies = 2
 repeat_wrongs = 1

Added: tuxmath/trunk/data/missions/lessons/lesson04
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson04	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson04	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Addition - Sums To 15
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 1
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 0
+max_augend = 10
+min_addend = 0
+max_addend = 10
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 2
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 0
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 15
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Added: tuxmath/trunk/data/missions/lessons/lesson05
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson05	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson05	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Addition - Sums To 20
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 1
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 0
+max_augend = 10
+min_addend = 0
+max_addend = 10
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 1
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 0
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 20
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Added: tuxmath/trunk/data/missions/lessons/lesson06
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson06	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson06	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Addition: Two Digit Numbers
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 1
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 10
+max_augend = 20
+min_addend = 10
+max_addend = 20
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 1
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 1
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 0
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 999
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Added: tuxmath/trunk/data/missions/lessons/lesson07
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson07	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson07	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Addition: Missing Numbers
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 1
+subtraction_allowed = 0
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 0
+max_augend = 10
+min_addend = 0
+max_addend = 10
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 1
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 0
+format_add_answer_first = 1
+format_add_answer_middle = 1
+format_sub_answer_last = 0
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 999
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Added: tuxmath/trunk/data/missions/lessons/lesson08
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson08	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson08	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Subtraction: 0 to 10
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 0
+subtraction_allowed = 1
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 0
+max_augend = 10
+min_addend = 0
+max_addend = 10
+min_minuend = 0
+max_minuend = 10
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 2
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 0
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 1
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 999
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Added: tuxmath/trunk/data/missions/lessons/lesson09
===================================================================
--- tuxmath/trunk/data/missions/lessons/lesson09	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/data/missions/lessons/lesson09	2007-01-24 19:22:08 UTC (rev 71)
@@ -0,0 +1,57 @@
+# Subtraction: 0 to 20
+play_through_list = 1
+allow_speedup = 1
+use_feedback = 1
+addition_allowed = 0
+subtraction_allowed = 1
+multiplication_allowed = 0
+division_allowed = 0
+typing_practice_allowed = 0
+allow_negatives = 0
+min_augend = 0
+max_augend = 10
+min_addend = 0
+max_addend = 10
+min_minuend = 0
+max_minuend = 20
+min_subtrahend = 0
+max_subtrahend = 10
+min_multiplier = 0
+max_multiplier = 10
+min_multiplicand = 0
+max_multiplicand = 10
+min_divisor = 0
+max_divisor = 10
+min_quotient = 0
+max_quotient = 10
+min_typing_num = 0
+max_typing_num = 10
+save_summary = 1
+question_copies = 1
+repeat_wrongs = 1
+copies_repeated_wrongs = 2
+format_add_answer_last = 0
+format_add_answer_first = 0
+format_add_answer_middle = 0
+format_sub_answer_last = 1
+format_sub_answer_first = 0
+format_sub_answer_middle = 0
+format_mult_answer_last = 0
+format_mult_answer_first = 0
+format_mult_answer_middle = 0
+format_div_answer_last = 0
+format_div_answer_first = 0
+format_div_answer_middle = 0
+max_answer = 999
+max_questions = 5000
+randomize = 1
+starting_comets = 2
+extra_comets_per_wave = 2
+max_comets = 10
+speed = 1.00
+max_speed = 10.00
+danger_level = 0.35
+danger_level_speedup = 1
+danger_level_max = 0.90
+city_explode_handicap = 0.00
+

Modified: tuxmath/trunk/docs/changelog
===================================================================
--- tuxmath/trunk/docs/changelog	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/docs/changelog	2007-01-24 19:22:08 UTC (rev 71)
@@ -1,5 +1,20 @@
 changelog for "tuxmath"
 
+2007.Jan.24 (https://svn.tux4kids.net/tuxmath/ - revision 69)
+  Options:
+    * More progress on new menu system, generally works
+      correctly to extent that things have been implemented.
+      More 'lesson' files added, now up through addition and
+      subtraction of two-digit positive numbers.
+  Game:
+    * "Typing Tutor" mode added for kids just beginning to 
+      use the keyboard.
+
+      New menu still "alpha" - would not suggest packaging
+      for Debian yet.
+
+      David Bruce <dbruce at tampabay.rr.com>
+
 2007.Jan.12 (https://svn.tux4kids.net/tuxmath/ - revision 67)
   Options:
     * Overhaul of menu system well underway, suitable for
@@ -14,8 +29,10 @@
       should be OK from licensing standpoint.
   Code:
     * Bugfix - question_copies parameter now handled correctly
-      in read_config_file.
+      in read_config_file().
 
+      David Bruce <dbruce at tampabay.rr.com>
+
 2006.Dec.07 (https://svn.tux4kids.net/tuxmath/ - revision 65)
   Options:
     * Several files brought in from tuxtype as part of overhaul

Modified: tuxmath/trunk/src/credits.c
===================================================================
--- tuxmath/trunk/src/credits.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/credits.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -393,7 +393,6 @@
       
       
       /* Handle any incoming events: */
-      /* TODO allow player to return to Title with mouse click */
       while (SDL_PollEvent(&event) > 0)
 	{
 	  if (event.type == SDL_QUIT)
@@ -414,6 +413,10 @@
 		  done = 1;
 		}
 	    }
+	  else if (event.type == SDL_MOUSEBUTTONDOWN)
+	    {
+              done = 1;
+	    }
 	}
 
       

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/fileops.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -611,7 +611,20 @@
       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);
@@ -913,6 +926,12 @@
         MC_SetDivAllowed(v);
     }
 
+    else if(0 == strcasecmp(parameter, "typing_practice_allowed"))
+    {
+      int v = str_to_bool(value);
+      if (v != -1)
+        MC_SetTypingAllowed(v);
+    }
 
     /* Set min and max for addition: */
 
@@ -1009,6 +1028,20 @@
       MC_SetDivMaxQuotient(atoi(value));
     }
 
+
+    /* Set min and max for typing practice: */
+
+
+    else if(0 == strcasecmp(parameter, "min_typing_num"))
+    {
+      MC_SetTypeMin(atoi(value));
+    }
+
+    else if(0 == strcasecmp(parameter, "max_typing_num"))
+    {
+      MC_SetTypeMax(atoi(value));
+    }
+
     else
     {   
       #ifdef TUXMATH_DEBUG
@@ -1065,7 +1098,6 @@
 
 /* this function writes the settings for all game options to a */
 /* human-readable file.                                        */
-/* FIXME add 'verbose flag' */
 int write_config_file(FILE *fp, int verbose)
 {
   #ifdef TUXMATH_DEBUG
@@ -1205,6 +1237,22 @@
   {
     fprintf (fp, "\n############################################################\n"
                  "#                                                          #\n"
+                 "#                    Typing Practice                       #\n"
+                 "#                                                          #\n"
+                 "# Parameter: typing_practice_allowed (boolean)             #\n"
+                 "# Default: 0                                               #\n"
+                 "#                                                          #\n"
+                 "# This option simply displays numbers for the youngest     #\n"
+                 "# players to type in to learn the keyboard.                #\n"
+                 "############################################################\n\n");
+  }
+
+  fprintf(fp, "typing_practice_allowed = %d\n", MC_TypingAllowed());
+
+  if (verbose)
+  {
+    fprintf (fp, "\n############################################################\n"
+                 "#                                                          #\n"
                  "#                 Negative Number Support                  #\n"
                  "#                                                          #\n"
                  "# Parameter: allow_negatives (boolean)                     #\n"
@@ -1283,6 +1331,12 @@
   fprintf(fp, "min_quotient = %d\n", MC_DivMinQuotient());
   fprintf(fp, "max_quotient = %d\n", MC_DivMaxQuotient());
 
+  if (verbose)
+  {
+    fprintf(fp, "\n# Typing practice:\n\n");
+  }
+  fprintf(fp, "min_typing_num = %d\n",MC_TypeMin());
+  fprintf(fp, "max_typing_num = %d\n", MC_TypeMax());
 
   if (verbose)
   {
@@ -1292,6 +1346,10 @@
                  "#                                                          #\n"
                  "# Parameter: use_sound (boolean)                           #\n"
                  "# Default: 1                                               #\n"
+                 "# Parameter: menu_sound (boolean)                          #\n"
+                 "# Default: 1                                               #\n"
+                 "# Parameter: menu_music (boolean)                          #\n"
+                 "# Default: 1                                               #\n"
                  "# Parameter: fullscreen (boolean)                          #\n"
                  "# Default: 1                                               #\n"
                  "# Parameter: demo_mode (boolean)                           #\n"
@@ -1311,6 +1369,8 @@
     fprintf (fp, "\n# Use game sounds and background music if possible:\n");
   }
   fprintf(fp, "use_sound = %d\n", Opts_UseSound());
+  fprintf(fp, "menu_sound = %d\n", Opts_MenuSound());
+  fprintf(fp, "menu_music = %d\n", Opts_MenuMusic());
 
   if (verbose)
   {

Modified: tuxmath/trunk/src/mathcards.c
===================================================================
--- tuxmath/trunk/src/mathcards.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/mathcards.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -135,30 +135,34 @@
   math_opts->format_div_answer_first = DEFAULT_FORMAT_DIV_ANSWER_FIRST;
   math_opts->format_div_answer_middle = DEFAULT_FORMAT_DIV_ANSWER_MIDDLE;
 
-  /* set addition options */
+  /* set addition options: */
   math_opts->addition_allowed = DEFAULT_ADDITION_ALLOWED;
   math_opts->min_augend = DEFAULT_MIN_AUGEND;
   math_opts->max_augend = DEFAULT_MAX_AUGEND;
   math_opts->min_addend = DEFAULT_MIN_ADDEND;
   math_opts->max_addend = DEFAULT_MAX_ADDEND;
-  /* set subtraction options */
+  /* set subtraction options: */
   math_opts->subtraction_allowed = DEFAULT_SUBTRACTION_ALLOWED;
   math_opts->min_minuend = DEFAULT_MIN_MINUEND;
   math_opts->max_minuend = DEFAULT_MAX_MINUEND;
   math_opts->min_subtrahend = DEFAULT_MIN_SUBTRAHEND;
   math_opts->max_subtrahend = DEFAULT_MAX_SUBTRAHEND;
-  /* set multiplication options */
+  /* set multiplication options: */
   math_opts->multiplication_allowed = DEFAULT_MULTIPLICATION_ALLOWED;
   math_opts->min_multiplier = DEFAULT_MIN_MULTIPLIER;
   math_opts->max_multiplier = DEFAULT_MAX_MULTIPLIER;
   math_opts->min_multiplicand = DEFAULT_MIN_MULTIPLICAND;
   math_opts->max_multiplicand = DEFAULT_MAX_MULTIPLICAND;
-  /* set division options */
+  /* set division options: */
   math_opts->division_allowed = DEFAULT_DIVISION_ALLOWED;
   math_opts->min_divisor = DEFAULT_MIN_DIVISOR;
   math_opts->max_divisor = DEFAULT_MAX_DIVISOR;
   math_opts->min_quotient = DEFAULT_MIN_QUOTIENT;
   math_opts->max_quotient = DEFAULT_MAX_QUOTIENT;
+  /* set typing practice options: */
+  math_opts->typing_practice_allowed = DEFAULT_TYPING_PRACTICE_ALLOWED;
+  math_opts->min_typing_num = DEFAULT_MIN_TYPING_NUM;
+  math_opts->max_typing_num = DEFAULT_MAX_TYPING_NUM;
 
   /* if no negatives to be used, reset any negatives to 0 */
   if (!math_opts->allow_negatives)
@@ -936,6 +940,15 @@
 }
 
 
+void MC_SetTypingAllowed(int opt)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_SetTypingAllowed(): math_opts not valid!\n");
+    return;
+  }
+  math_opts->typing_practice_allowed = int_to_bool(opt);
+}
 
 
 
@@ -1181,8 +1194,29 @@
 }
 
 
+/* Set min and max for division: */
+void MC_SetTypeMin(int opt)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_SetTypeMin(): math_opts not valid!\n");
+    return;
+  }
+  math_opts->min_typing_num = sane_value(opt);
+}
 
 
+void MC_SetTypeMax(int opt)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_SetTypeMax(): math_opts not valid!\n");
+    return;
+  }
+  math_opts->max_typing_num = sane_value(opt);
+}
+
+
 /*"Get" type methods to query option parameters */
 
 /* Query general math options: */
@@ -1454,7 +1488,17 @@
 }
 
 
+int MC_TypingAllowed(void)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_TypeAllowed(): math_opts not valid!\n");
+    return MC_MATH_OPTS_INVALID;
+  }
+  return math_opts->typing_practice_allowed;
+}
 
+
 /* Query min and max for addition: */
 int MC_AddMinAugend(void)               /* the "augend" is the first addend i.e. "a" in "a + b = c" */
 {
@@ -1642,7 +1686,29 @@
 }
 
 
+/* Query min and max for typing practice: */
+int MC_TypeMin(void)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_TypeMin(): math_opts not valid!\n");
+    return MC_MATH_OPTS_INVALID;
+  }
+  return math_opts->min_typing_num;
+}
 
+
+int MC_TypeMax(void)
+{
+  if (!math_opts)
+  {
+    fprintf(stderr, "\nMC_TypeMax(): math_opts not valid!\n");
+    return MC_MATH_OPTS_INVALID;
+  }
+  return math_opts->max_typing_num;
+}
+
+
 /* prints struct to file */
 void MC_PrintMathOptions(FILE* fp, int verbose)
 {
@@ -1823,6 +1889,11 @@
   fprintf(fp, "max_divisor = %d\n", math_opts->max_divisor);
   fprintf(fp, "min_quotient = %d\n", math_opts->min_quotient);
   fprintf(fp, "max_quotient = %d\n", math_opts->max_quotient);
+
+  fprintf(fp, "\n# Typing practice:\n");
+  fprintf(fp, "min_typing_num = %d\n",math_opts->min_typing_num);
+  fprintf(fp, "max_typing_num = %d\n",math_opts->max_typing_num);
+
 }
 
 
@@ -1928,6 +1999,11 @@
     math_opts->min_quotient = 0;
   if (math_opts->max_quotient < 0)
     math_opts->max_quotient = 0;
+
+  if (math_opts->min_typing_num < 0)
+    math_opts->min_typing_num = 0;
+  if (math_opts->max_typing_num < 0)
+    math_opts->max_typing_num = 0;
 }
 
 /* using parameters from the mission struct, create linked list of "flashcards" */
@@ -2221,6 +2297,31 @@
     }
   }
 
+  if (math_opts->typing_practice_allowed)
+  {
+    for (i = math_opts->min_typing_num; i <= math_opts->max_typing_num; i++)
+    {
+      /* check if max_answer exceeded or if question */
+      /* contains undesired negative values:         */
+      if (validate_question(i, i, i))
+      {  
+        /* put in the desired number of copies: */
+        for (k = 0; k < math_opts->question_copies; k++)
+        {
+          /* make sure max_questions not exceeded, */
+          /* also check if question being randomly kept or discarded: */
+          if ((length < math_opts->max_questions)
+               && randomly_keep())
+          {
+            tmp_ptr = create_node(i, i, MC_OPER_TYPING_PRACTICE, i, MC_FORMAT_ANS_LAST);
+            top_of_list = insert_node(top_of_list, end_of_list, tmp_ptr);
+            end_of_list = tmp_ptr;
+            length++; 
+          } 
+        }
+      }
+    }
+  }
   #ifdef MC_DEBUG
   length = list_length(top_of_list); 
   printf("\nlength before randomization:\t%d", length); 
@@ -2304,6 +2405,12 @@
         oper_char = '/';
         break; 
       }
+      case MC_OPER_TYPING_PRACTICE:
+      {
+        snprintf(ptr->card.formula_string, MC_FORMULA_LEN, "%d",ptr->card.num1);
+        snprintf(ptr->card.answer_string, MC_ANSWER_LEN, "%d",ptr->card.num1);
+        return ptr;  /* Don't need to look at formats for this case. */
+      }
       default:
       {
         fprintf(stderr, "\nIn create_node(): invalid math operation\n");

Modified: tuxmath/trunk/src/mathcards.h
===================================================================
--- tuxmath/trunk/src/mathcards.h	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/mathcards.h	2007-01-24 19:22:08 UTC (rev 71)
@@ -27,6 +27,7 @@
   MC_OPER_SUB,
   MC_OPER_MULT,
   MC_OPER_DIV,
+  MC_OPER_TYPING_PRACTICE,
   MC_NUM_OPERS
 };
 
@@ -91,6 +92,11 @@
   int max_divisor;
   int min_quotient;
   int max_quotient;
+  /* typing practice options */
+  int typing_practice_allowed;
+  int min_typing_num;
+  int max_typing_num;
+
 } MC_Options;
 
 /* default values for math_options */
@@ -129,6 +135,7 @@
 #define DEFAULT_SUBTRACTION_ALLOWED 1
 #define DEFAULT_MULTIPLICATION_ALLOWED 1
 #define DEFAULT_DIVISION_ALLOWED 1
+#define DEFAULT_TYPING_PRACTICE_ALLOWED 0
 
 #define DEFAULT_MIN_AUGEND 0              /* augend + addend = sum */
 #define DEFAULT_MAX_AUGEND 12
@@ -150,6 +157,8 @@
 #define DEFAULT_MIN_QUOTIENT 0             /* questions with division by zero.    */
 #define DEFAULT_MAX_QUOTIENT 12
 
+#define DEFAULT_MIN_TYPING_NUM 0           /* range for "typing tutor" mode, for kids */
+#define DEFAULT_MAX_TYPING_NUM 12          /* just learning to use keyboard.          */
 
 
 /* struct for individual "flashcard" */
@@ -296,6 +305,7 @@
 void MC_SetSubAllowed(int opt);
 void MC_SetMultAllowed(int opt);
 void MC_SetDivAllowed(int opt);
+void MC_SetTypingAllowed(int opt);
 
 /* Set min and max for addition: */
 void MC_SetAddMin(int opt);                    /* augend + addend = sum */
@@ -329,6 +339,9 @@
 void MC_SetDivMaxDivisor(int opt);
 void MC_SetDivMaxQuotient(int opt);
 
+/* Set min and max for typing practice: */
+void MC_SetTypeMin(int opt);
+void MC_SetTypeMax(int opt);
 
 /* "Get" type functions to query option parameters: */
 
@@ -362,6 +375,7 @@
 int MC_SubAllowed(void);
 int MC_MultAllowed(void);
 int MC_DivAllowed(void);
+int MC_TypingAllowed(void);
 
 /* Query min and max for addition: */
 int MC_AddMinAugend(void);              /* the "augend" is the first addend i.e. "a" in "a + b = c" */
@@ -387,4 +401,8 @@
 int MC_DivMaxDivisor(void);
 int MC_DivMaxQuotient(void);
 
+/* Query min and max for typing practice: */
+int MC_TypeMin(void);
+int MC_TypeMax(void);
+
 #endif

Modified: tuxmath/trunk/src/options.c
===================================================================
--- tuxmath/trunk/src/options.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/options.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -335,6 +335,8 @@
   /* 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;
   game_options->use_bkgd = DEFAULT_USE_BKGD;
   game_options->demo_mode = DEFAULT_DEMO_MODE;
@@ -390,6 +392,19 @@
   game_options->use_sound = int_to_bool(val);
 }
 
+
+void Opts_SetMenuSound(int val)
+{
+  game_options->menu_sound = int_to_bool(val);
+}
+
+
+void Opts_SetMenuMusic(int val)
+{
+  game_options->menu_music = int_to_bool(val);
+}
+
+
 /* FIXME need to actually change screen resolution when this is called */
 void Opts_SetFullscreen(int val)
 {
@@ -671,10 +686,31 @@
     return GAME_OPTS_INVALID;
   }
   return game_options->use_sound;
+}
 
+
+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)

Modified: tuxmath/trunk/src/options.h
===================================================================
--- tuxmath/trunk/src/options.h	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/options.h	2007-01-24 19:22:08 UTC (rev 71)
@@ -27,6 +27,8 @@
   /* general game options */
   int per_user_config;
   int use_sound;
+  int menu_sound;
+  int menu_music;
   int fullscreen;
   int use_bkgd;
   int demo_mode;
@@ -84,6 +86,8 @@
 /* "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);
 void Opts_SetUseBkgd(int val);
 void Opts_SetDemoMode(int val);
@@ -112,6 +116,8 @@
 /* "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_DemoMode(void);

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/titlescreen.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -61,16 +61,17 @@
 /* of the struct. */
 
 /* --- define menu structure --- */
-/* (these values are all in the Game_Type enum in globals.h) */
+/* (these values are all in the Game_Type enum in titlescreen.h) */
+/* They are the "commands" associated with the menu items.   */
 const int menu_item[][6]= {{0, 0,         0,         0,        0           },
-			   {0, LESSONS,      LEVEL1,    LEVEL1,   NOT_CODED   },
-			   {0, ARCADE,       LEVEL2,    LEVEL2,   FREETYPE    },
-			   {0, OPTIONS,      LEVEL3,    LEVEL3,   PROJECT_INFO},
-			   {0, MORE_OPTIONS, LEVEL4,    LEVEL4,   SET_LANGUAGE},
-			   {0, QUIT_GAME,    MAIN,      MAIN,     MAIN        }};
+			   {0, LESSONS,      ARCADE_CADET,   LEVEL1,   NOT_CODED   },
+			   {0, ARCADE,       ARCADE_SCOUT,   LEVEL2,   FREETYPE    },
+			   {0, OPTIONS,      ARCADE_RANGER,  LEVEL3,   PROJECT_INFO},
+			   {0, MORE_OPTIONS, ARCADE_ACE,     LEVEL4,   SET_LANGUAGE},
+			   {0, QUIT_GAME,    MAIN,           MAIN,     MAIN        }};
 
 /* --- menu text --- */
-const unsigned char *menu_text[][6]= 
+const unsigned char* menu_text[][6]= 
 /*    Main Menu                                       'Arcade' Games                    Math Options                     Game Options            */
 {{"", "",                                             "",                             "",                              ""                       },
  {"", gettext_noop("Math Command Training Academy"),  gettext_noop("Space Cadet"), gettext_noop("Addition"),       gettext_noop("Speed")    },
@@ -82,25 +83,24 @@
 
 /* These are the filenames of the images used in the animated menu icons: */
 /* --- menu icons --- */
-const unsigned char *menu_icon[][6]= 
+const unsigned char* menu_icon[][6]= 
 {{"", "",        "",       "",        ""        },
- {"", "lesson", "easy",   "grade1_", "list"    },
- {"", "comet",   "medium", "grade2_", "practice"},
- {"", "lesson",  "hard",   "grade3_", "keyboard"},
- {"", "option",  "tutor",  "grade4_", "lang"    },
- {"", "quit",    "main",   "main",    "main"   }};
+ {"", "lesson",   "easy",   "grade1_", "list"    },
+ {"", "comet",    "medium", "grade2_", "practice"},
+ {"", "keyboard", "hard",   "grade3_", "keyboard"},
+ {"", "keyboard", "tutor",  "grade4_", "lang"    },
+ {"", "quit",     "main",   "main",    "main"   }};
 
 
 /* this will contain pointers to all of the menu 'icons' */
-sprite *menu_gfx[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
+sprite* menu_gfx[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
 
-
-
 /* images of regular and selected text of menu items: */
-SDL_Surface *reg_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
-SDL_Surface *sel_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
-sprite *reg;
-sprite *sel;
+SDL_Surface* reg_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
+SDL_Surface* sel_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1];
+/* reg and sel are used to create the translucent button backgrounds. */
+sprite* reg;
+sprite* sel;
 
 
 /* keep track of the width of each menu: */
@@ -109,16 +109,15 @@
 /* NOTE for 'depth', think pages like a restaurant menu, */
 /* not heirarchical depth - choice of term is misleading */
 int menu_depth; // how deep we are in the menu
-int menu_sound; // status of menu sound effects
-int menu_music; // status of menu sound effects
 settings localsettings;
 
 /* --- other media --- */
-SDL_Surface *titlepic;
-SDL_Surface *speaker;
-SDL_Surface *speakeroff;
-sprite *Tux;
-Mix_Chunk *snd_move, *snd_select;
+SDL_Surface* titlepic;
+SDL_Surface* speaker;
+SDL_Surface* speakeroff;
+sprite* Tux;
+Mix_Chunk* snd_move;
+Mix_Chunk* snd_select;
 
 /* --- locations we need --- */
 SDL_Rect text_dst[TITLE_MENU_ITEMS + 1];     // location of text for menu
@@ -126,18 +125,23 @@
 /* These are the rectangular mouse event "buttons" for each menu item */
 SDL_Rect menu_button[TITLE_MENU_ITEMS + 1];  // size of "button"
 
+SDL_Rect dest,
+	 Tuxdest,
+	 Titledest,
+	 spkrdest,
+	 cursor;
 
 /* Local function prototypes: */
 //int chooseWordlist(void);
-void draw_button(int id, sprite* s);
+void draw_button(SDL_Rect* target_rect, int width, sprite* s);
 void TitleScreen_load_menu(void);
 void TitleScreen_unload_menu(void);
 void TitleScreen_load_media(void);
 void TitleScreen_unload_media(void);
 void NotImplemented(void);
 void TransWipe(SDL_Surface* newbkg, int type, int var1, int var2);
-void UpdateScreen(int *frame);
-void AddRect(SDL_Rect * src, SDL_Rect * dst);
+void UpdateScreen(int* frame);
+void AddRect(SDL_Rect* src, SDL_Rect* dst);
 void InitEngine(void);
 
 /***********************************************************/
@@ -156,16 +160,11 @@
 void TitleScreen(void)
 {
 
-  SDL_Rect dest,
-	 Tuxdest,
-	 Titledest,
-	 spkrdest,
-	 cursor;
-
   Uint32 frame = 0;
   Uint32 start = 0;
 
-  int i, j, tux_frame = 0;
+  int i, j; 
+  int tux_frame = 0;
   int done = 0;
   int firstloop = 1;
   int menu_opt = NONE;
@@ -181,8 +180,9 @@
 
   if (Opts_UseSound())
   {
-    menu_sound = 1;
-    menu_music = localsettings.menu_music;
+    Opts_SetMenuSound(1);
+    Opts_SetMenuMusic(1);
+//    menu_music = localsettings.menu_music;
   }
 
   InitEngine();  //set up pointers for blitting structure.
@@ -266,6 +266,8 @@
 
 
   /* --- Pull tux & logo onscreen --- */
+  /* NOTE we wind up with Tuxdest.y == (screen->h)  - (Tux->frame[0]->h), */
+  /* and Titledest.x == 0.                                                */
   for (i = 0; i < (PRE_ANIM_FRAMES * PRE_FRAME_MULT); i++)
   {
     start = SDL_GetTicks();
@@ -289,8 +291,11 @@
 
   SDL_BlitSurface(titlepic, NULL, screen, &Titledest);
 
+  LOG( "Tux and Title are in place now\n" );
+
+
   /* Pick speaker graphic according to whether music is on: */
-  if (menu_music)
+  if (Opts_MenuMusic())
   {
     SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
   }
@@ -300,12 +305,11 @@
   }
 
   /* Start playing menu music if desired: */
-  if (menu_music)
+  if (Opts_MenuMusic())
   {
     audioMusicLoad("tuxi.ogg", -1);
   }
 
-  LOG( "Tux and Title are in place now\n" );
 
   /* Move mouse to top button: */
   cursor.x = menu_button[1].x + (menu_button[1].w / 2);
@@ -328,7 +332,7 @@
   while (!done) 
   {
 
-    start=SDL_GetTicks();
+    start = SDL_GetTicks();
 
     /* ---process input queue --- */
 
@@ -362,7 +366,7 @@
                 (cursor.y >= menu_button[j].y && cursor.y <= (menu_button[j].y + menu_button[j].h)))
             {
               menu_opt = menu_item[j][menu_depth];
-              if (menu_sound)
+              if (Opts_MenuSound())
               {
                 tuxtype_playsound(snd_select);
               }
@@ -378,14 +382,14 @@
           if ((cursor.x >= spkrdest.x && cursor.x <= (spkrdest.x + spkrdest.w)) && 
               (cursor.y >= spkrdest.y && cursor.y <= (spkrdest.y + spkrdest.h)))
           {
-            if (menu_music)
+            if (Opts_MenuMusic())
             {
               audioMusicUnload();
-              menu_music = 0;
+              Opts_SetMenuMusic(0);
             }
             else
             {
-              menu_music = 1;
+              Opts_SetMenuMusic(1);
               audioMusicLoad("tuxi.ogg", -1);
             }
             redraw = 1;
@@ -415,7 +419,7 @@
               else
                 menu_opt = QUIT_GAME;
 
-              if (menu_sound)
+              if (Opts_MenuSound())
                 tuxtype_playsound(snd_select);
               break;
             }
@@ -433,14 +437,14 @@
             /* Toggle menu music: */
             case SDLK_F11:
             {
-              if (menu_music)
+              if (Opts_MenuMusic())
               {
                 audioMusicUnload( );
-                menu_music=0;
+                Opts_SetMenuMusic(0);
               }
               else
               {
-                menu_music=1;
+                Opts_SetMenuMusic(1);
                 audioMusicLoad("tuxi.ogg", -1);
               }
               redraw = 1;
@@ -461,7 +465,7 @@
 
             case SDLK_UP:
             {
-              if (menu_sound)
+              if (Opts_MenuSound())
                 tuxtype_playsound(snd_move);
               key_menu--;
               if (key_menu < 1)
@@ -473,7 +477,7 @@
             case SDLK_DOWN:
             {
               key_menu++;
-              if (menu_sound)
+              if (Opts_MenuSound())
                 tuxtype_playsound(snd_move);
               if (key_menu > 5)
                 key_menu = 1;
@@ -491,7 +495,7 @@
                 menu_opt = menu_item[key_menu][menu_depth];
                 DOUT(menu_opt);
 
-                if (menu_sound)
+                if (Opts_MenuSound())
                   tuxtype_playsound(snd_select);
               }
               break;
@@ -528,58 +532,24 @@
 
     /* --- do menu processing --- */
 
-    if (menu_opt == LESSONS)
+    /* First page:-----------------------------------------------*/
+
+    if (menu_opt == LESSONS) /* Go to 'lessons' menu: */
+                             /* i.e. Math Command Training Academy */
     {
-//      NotImplemented();
-//      redraw = 1;
-
-
-
-      if (choose_config_file()) 
+      /* choose_config_file() returns after selected lessons are  */
+      /* done - game() called from there.                         */
+      if (choose_config_file())  
       {
-        TitleScreen_unload_media();
-
-        /* play game with chosen file */
-
-//         switch (sub_menu)
-//         {
-//           case CASCADE: PlayCascade( EASY ); break;
-//           case LASER:   laser_game(  EASY ); break;
-//         }
-
-        TitleScreen_load_media();
-
-        if (menu_music)
+        if (Opts_MenuMusic())  // Restart music after game
           audioMusicLoad( "tuxi.ogg", -1 );
       }
-
       redraw = 1;
-
-
-//       SDL_BlitSurface(bkg, NULL, screen, NULL);
-//       SDL_Flip( screen );
-//       TitleScreen_unload_media();
-// 
-//       if (menu_music)
-//       {
-//         audioMusicUnload( );
-//       }
-// //      testLesson();
-// 
-//       TitleScreen_load_media();
-//       redraw = 1;
-// 
-//       if (menu_music)
-//       {
-//         audioMusicLoad( "tuxi.ogg", -1 );
-//       }
     }
 
 
-    if (menu_opt == ARCADE)
+    if (menu_opt == ARCADE)   /* Go to Arcade submenu */
     {
-//      NotImplemented();
-//      redraw = 1;
        menu_depth = ARCADE_SUBMENU; /* i.e. 2 */
        sub_menu = ARCADE;           /* i.e. 1 */
        update_locs = 1;
@@ -591,47 +561,51 @@
     {
       NotImplemented();
       redraw = 1;
-//       menu_depth = CASCADE_SUBMENU;
-//       sub_menu = ARCADE;
-//       update_locs = 1;
-//       redraw=1;
     }
 
 
-    if (menu_opt == OPTIONS)
+    if (menu_opt == OPTIONS)  /* Still using old options() for now */
     {
-      NotImplemented();
+      options();
+
+      if (Opts_MenuMusic())
+      {
+        audioMusicUnload();
+      }
+
+      game();
+
+      if (Opts_MenuMusic())
+      {
+        audioMusicLoad( "tuxi.ogg", -1 );
+      }
       redraw = 1;
-
-/*      menu_depth = OPTIONS_SUBMENU;
-      sub_menu = OPTIONS;
-      update_locs = 1;
-      redraw = 1;*/
     }
 
+
     if (menu_opt == MORE_OPTIONS)
     {
       NotImplemented();
       redraw = 1;
-//       menu_depth = OPTIONS_SUBMENU;
-//       sub_menu = OPTIONS;
-//       update_locs = 1;
-//       redraw = 1;
     }
 
+
     if (menu_opt == QUIT_GAME)
     {
       done = 1;
     }
 
+    /* Second (Arcade) page:-----------------------------------------------*/
 
-
-    if (menu_opt == LEVEL1)
+    /* Play game of selected difficulty:                                   */
+    /* TODO save high scores for each difficulty level.                    */
+    /* TODO display brief description of type of questions at each level.  */
+    if (menu_opt == ARCADE_CADET)
     {
-      LOG("menu_opt == LEVEL1");
+      LOG("menu_opt == ARCADE_CADET");
       if (read_named_config_file("arcade/space_cadet"))
       {
-        if (menu_music)
+        if (Opts_MenuMusic())
         {
           audioMusicUnload();
         }
@@ -644,7 +618,7 @@
 
       TitleScreen_load_media();
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         audioMusicLoad( "tuxi.ogg", -1 );
       }
@@ -652,12 +626,12 @@
     }
 
 
-    if (menu_opt == LEVEL2)
+    if (menu_opt == ARCADE_SCOUT)
     {
-      LOG("menu_opt == LEVEL2");
+      LOG("menu_opt == ARCADE_SCOUT");
       if (read_named_config_file("arcade/scout"))
       {
-        if (menu_music)
+        if (Opts_MenuMusic())
         {
           audioMusicUnload();
         }
@@ -670,7 +644,7 @@
 
       TitleScreen_load_media();
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         audioMusicLoad( "tuxi.ogg", -1 );
       }
@@ -678,13 +652,12 @@
     }
 
 
-
-    if (menu_opt == LEVEL3)
+    if (menu_opt == ARCADE_RANGER)
     {
-      LOG("menu_opt == LEVEL3");
+      LOG("menu_opt == ARCADE_RANGER");
       if (read_named_config_file("arcade/ranger"))
       {
-        if (menu_music)
+        if (Opts_MenuMusic())
         {
           audioMusicUnload();
         }
@@ -697,7 +670,7 @@
 
       TitleScreen_load_media();
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         audioMusicLoad( "tuxi.ogg", -1 );
       }
@@ -706,12 +679,12 @@
 
 
 
-    if (menu_opt == LEVEL4)
+    if (menu_opt == ARCADE_ACE)
     {
-      LOG("menu_opt == LEVEL4");
+      LOG("menu_opt == ARCADE_ACE");
       if (read_named_config_file("arcade/ace"))
       {
-        if (menu_music)
+        if (Opts_MenuMusic())
         {
           audioMusicUnload();
         }
@@ -729,32 +702,27 @@
 
       TitleScreen_load_media();
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         audioMusicLoad( "tuxi.ogg", -1 );
       }
       redraw = 1;
     }
 
-
-
-    if (menu_opt == LASER)
+    /* Go back to main menu: */
+    if (menu_opt == MAIN)
     {
-      menu_depth = LASER_SUBMENU;
-      sub_menu = LASER;
+      menu_depth = ROOTMENU;
       update_locs = 1;
       redraw = 1;
     }
 
-
-
-
-
-
-
-    if (menu_opt == MAIN)
+    /* Rest of menu_opts are not currently used: */
+/*
+    if (menu_opt == LASER)
     {
-      menu_depth = ROOTMENU;
+      menu_depth = LASER_SUBMENU;
+      sub_menu = LASER;
       update_locs = 1;
       redraw = 1;
     }
@@ -774,8 +742,6 @@
     }
 
 
-
-
     if (menu_opt == SET_LANGUAGE)
     {
       TitleScreen_unload_media();
@@ -785,14 +751,13 @@
       TitleScreen_load_media();
       redraw = 1;
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         audioMusicLoad( "tuxi.ogg", -1 );
       }
     }
 
 
-
     if (menu_opt == INSTRUCT)
     {
       TitleScreen_unload_media();
@@ -805,16 +770,14 @@
 
       TitleScreen_load_media();
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       { 
         audioMusicLoad( "tuxi.ogg", -1 );
       }
-
       redraw = 1;
     }
 
 
-
     if (menu_opt == FREETYPE)
     {
       TitleScreen_unload_media();
@@ -823,7 +786,7 @@
       TitleScreen_load_media();
       redraw = 1;
     }
-
+*/
     /* ------ End menu_opt processing ----------- */
 
 
@@ -833,7 +796,7 @@
       SDL_BlitSurface(bkg, NULL, screen, NULL); 
       SDL_BlitSurface(titlepic, NULL, screen, &Titledest);
 
-      if (menu_music)
+      if (Opts_MenuMusic())
       {
         SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
       }
@@ -861,7 +824,7 @@
         text_dst[i].w = reg_text[i][menu_depth]->w;
         text_dst[i].h = reg_text[i][menu_depth]->h;
         SDL_BlitSurface(bkg, &menu_button[i], screen, &menu_button[i]);
-        menu_button[i].w = menu_width[menu_depth] + (2*reg->frame[2]->w);
+        menu_button[i].w = menu_width[menu_depth] + (2 * reg->frame[2]->w);
       }
 
       update_locs = 0;
@@ -870,7 +833,7 @@
 
       for (j = 1; j <= TITLE_MENU_ITEMS; j++)
       {
-        draw_button(j, reg);
+        draw_button(&menu_button[j], menu_width[menu_depth], reg);
         SDL_BlitSurface(reg_text[j][menu_depth], NULL, screen, &text_dst[j]);
         SDL_BlitSurface(menu_gfx[j][menu_depth]->default_img, NULL, screen, &menu_gfxdest[j]);
       }
@@ -918,7 +881,7 @@
     if (old_key_menu && (key_menu != old_key_menu))
     {
       SDL_BlitSurface(bkg, &menu_button[old_key_menu], screen, &menu_button[old_key_menu]);
-      draw_button( old_key_menu, reg );
+      draw_button(&menu_button[old_key_menu], menu_width[menu_depth], reg );
       SDL_BlitSurface(reg_text[old_key_menu][menu_depth], NULL, screen, &text_dst[old_key_menu]);
       SDL_BlitSurface(menu_gfx[old_key_menu][menu_depth]->default_img, NULL, screen, &menu_gfxdest[old_key_menu]);
     }
@@ -936,7 +899,7 @@
       }
 
       SDL_BlitSurface(bkg, &menu_button[key_menu], screen, &menu_button[key_menu]);
-      draw_button( key_menu, sel );
+      draw_button(&menu_button[key_menu], menu_width[menu_depth], sel );
       SDL_BlitSurface(sel_text[key_menu][menu_depth], NULL, screen, &text_dst[key_menu]);
       SDL_BlitSurface(menu_gfx[key_menu][menu_depth]->frame[menu_gfx[key_menu][menu_depth]->cur], NULL, screen, &menu_gfxdest[key_menu]);
 
@@ -946,7 +909,7 @@
 
     // HACK This is still more than we need to update every frame but
     // it cuts cpu on my machine %60 so it seems better...
-    if (menu_music)
+    if (Opts_MenuMusic())
     {
       SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
     }
@@ -987,7 +950,7 @@
 
   LOG( "->>Freeing title screen images\n" );
 
-  localsettings.menu_music = menu_music;
+  localsettings.menu_music = Opts_MenuMusic();
   TitleScreen_unload_media();
 
   LOG( "->TitleScreen():END \n" );
@@ -1069,7 +1032,7 @@
     fprintf(stderr, "realPath[1] = %s\n", realPath[1]);
   }
 
-  if (menu_sound)
+  if (Opts_MenuSound())
   {
     snd_move = LoadSound("tock.wav");
     snd_select = LoadSound("pop.wav");
@@ -1123,7 +1086,7 @@
       sprintf(fn, "menu/%s", menu_icon[i][j]);
       menu_gfx[i][j] = LoadSprite(fn, IMG_ALPHA);
     }
-    menu_width[j] = max + 20 + 40; // Not clear where '20' and '40' are coming from
+    menu_width[j] = max + 20 + 40; // 40 is width of sprite, 20 is gap
   }
 
   LOG("done creating graphics, now setting positions\n");
@@ -1145,32 +1108,41 @@
 
   /* FIXME each menu item drawn hardcoded 60 pixels below last - */
   /* perhaps increment should be "menu_button[j-1].h + MENU_ITEM_GAP" */
-  for (j=2; j<6; j++) 
+  for (j = 2; j < 6; j++) 
   {
     /* --- setup vertical location of button text --- */
-    text_dst[j].y = text_dst[j-1].y + 60;
+    text_dst[j].y = text_dst[j - 1].y + 60;
 
     /* --- setup location of button background --- */
-    menu_button[j].x = menu_button[j-1].x;
-    menu_button[j].y = menu_button[j-1].y + 60;
-    menu_button[j].w = menu_button[j-1].w;
-    menu_button[j].h = menu_button[j-1].h;
+    menu_button[j].x = menu_button[j - 1].x;
+    menu_button[j].y = menu_button[j - 1].y + 60;
+    menu_button[j].w = menu_button[j - 1].w;
+    menu_button[j].h = menu_button[j - 1].h;
 
     /* --- setup location of animated icon --- */
-    menu_gfxdest[j].x = menu_gfxdest[j-1].x;
-    menu_gfxdest[j].y = menu_gfxdest[j-1].y + 60;
-    menu_gfxdest[j].w = menu_gfxdest[j-1].w;
-    menu_gfxdest[j].h = menu_gfxdest[j-1].h;
+    menu_gfxdest[j].x = menu_gfxdest[j - 1].x;
+    menu_gfxdest[j].y = menu_gfxdest[j - 1].y + 60;
+    menu_gfxdest[j].w = menu_gfxdest[j - 1].w;
+    menu_gfxdest[j].h = menu_gfxdest[j - 1].h;
   }
 }
 
-
-void draw_button( int id, sprite *s )
+/* draw_button() creates and draws a translucent button with */
+/* rounded ends.  The location and size are taken from the */
+/* SDL_Rect* and width arguments.  The sprite is used to   */
+/* fill in the rect with the desired translucent color and */
+/* give it nice, rounded ends.                             */
+void draw_button(SDL_Rect* target_rect, int width, sprite* s )
 {
   SDL_Rect button;
 
-  button.x = menu_button[id].x;
-  button.y = menu_button[id].y;
+  if (! target_rect || !s)
+  {
+    return;
+  }
+
+  button.x = target_rect->x;
+  button.y = target_rect->y;
   button.w = s->frame[0]->w;
   button.h = s->frame[0]->h;
 
@@ -1178,7 +1150,7 @@
   button.w = s->frame[1]->w;
 
   for (button.x += s->frame[0]->w;
-       button.x < (menu_button[id].x + menu_width[menu_depth]);
+       button.x < (target_rect->x + width);
        button.x += s->frame[1]->w)
 
   { 
@@ -1217,7 +1189,7 @@
 
 	/* --- unload sounds --- */
 
-	if (menu_sound){
+	if (Opts_MenuSound()){
 	    Mix_FreeChunk(snd_move);
 	    Mix_FreeChunk(snd_select);
 	}
@@ -1238,83 +1210,111 @@
 	TitleScreen_unload_menu();
 }
 
-void NotImplemented(void) {
-	SDL_Surface *s1, *s2, *s3, *s4;
-	sprite *tux;
-	SDL_Rect loc;
-	int finished=0,i;
+void NotImplemented(void)
+{
+  SDL_Surface *s1, *s2, *s3, *s4;
+  sprite *tux;
+  SDL_Rect loc;
+  int finished = 0;
+  int tux_frame = 0;
+  Uint32 frame = 0;
+  Uint32 start = 0;
 
-        LOG( "NotImplemented() - creating text\n" );
 
-	s1 = black_outline( _("Work In Progress!"), font, &white);
-	s2 = black_outline( _("This feature is not ready yet"), font, &white);
-	s3 = black_outline( _("Discuss the future of TuxMath at"), font, &white);
+  LOG( "NotImplemented() - creating text\n" );
 
-	/* we always want the URL in english */
-	if (!useEnglish) {
-		TTF_Font *english_font;
-		useEnglish = 1;
-		english_font = LoadFont( menu_font, menu_font_size );
-		s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", english_font, &white);
-		TTF_CloseFont(english_font);
-		useEnglish = 0;
-	} else 
-		s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", font, &white);
+  s1 = black_outline( _("Work In Progress!"), font, &white);
+  s2 = black_outline( _("This feature is not ready yet"), font, &white);
+  s3 = black_outline( _("Discuss the future of TuxMath at"), font, &white);
 
-        LOG( "NotImplemented() - drawing screen\n" );
+  /* we always want the URL in english */
+  if (!useEnglish)
+  {
+    TTF_Font *english_font;
+    useEnglish = 1;
+    english_font = LoadFont( menu_font, menu_font_size );
+    s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", english_font, &white);
+    TTF_CloseFont(english_font);
+    useEnglish = 0;
+  }
+  else 
+  {
+    s4 = black_outline( "tuxmath-devel at lists.sourceforge.net", font, &white);
+  }
 
-	SDL_BlitSurface( bkg, NULL, screen, NULL );
-	loc.x = 320-(s1->w/2); loc.y = 10;
-	SDL_BlitSurface( s1, NULL, screen, &loc);
-	loc.x = 320-(s2->w/2); loc.y = 60;
-	SDL_BlitSurface( s2, NULL, screen, &loc);
-	loc.x = 320-(s3->w/2); loc.y = 400;
-	SDL_BlitSurface( s3, NULL, screen, &loc);
-	loc.x = 320-(s4->w/2); loc.y = 440;
-	SDL_BlitSurface( s4, NULL, screen, &loc);
+  LOG( "NotImplemented() - drawing screen\n" );
 
-//	tux = LoadSprite("tux/tux-egypt", IMG_ALPHA);
-	tux = LoadSprite("tux/bigtux", IMG_ALPHA);
-	if (tux && tux->num_frames) /* make sure sprite has at least one frame */
-	{
-	  loc.x = 320-(tux->frame[0]->w/2);
-	  loc.y = 200;
-	  loc.w = tux->frame[0]->w;
-	  loc.h = tux->frame[0]->h;
-	  SDL_BlitSurface( tux->frame[tux->cur], NULL, screen, &loc);
-	}
-	SDL_UpdateRect(screen, 0, 0, 0, 0);
+  /* Draw lines of text: */
+  SDL_BlitSurface( bkg, NULL, screen, NULL );
+  loc.x = 320-(s1->w/2); loc.y = 10;
+  SDL_BlitSurface( s1, NULL, screen, &loc);
+  loc.x = 320-(s2->w/2); loc.y = 60;
+  SDL_BlitSurface( s2, NULL, screen, &loc);
+  loc.x = 320-(s3->w/2); loc.y = 400;
+  SDL_BlitSurface( s3, NULL, screen, &loc);
+  loc.x = 320-(s4->w/2); loc.y = 440;
+  SDL_BlitSurface( s4, NULL, screen, &loc);
 
-	i=0;
-	while (!finished) {
-		while (SDL_PollEvent(&event)) 
-			switch (event.type) {
-				case SDL_QUIT:
-					exit(0);
-				case SDL_MOUSEBUTTONDOWN:
-				case SDL_KEYDOWN:
-					finished=1;
-			}
-		i++;
-		if ((i%5==0)
-		 && tux
-		 && tux->num_frames) /* make sure sprite has at least one frame */
-		{
-			next_frame(tux);
-			SDL_BlitSurface( bkg, &loc, screen, &loc);
-			SDL_BlitSurface( tux->frame[tux->cur], NULL, screen, &loc);
-			SDL_UpdateRect(screen, loc.x, loc.y, loc.w, loc.h);
-		}
+  //  FIXME make Tux blink correctly.
+  tux = LoadSprite("tux/bigtux", IMG_ALPHA);
+  if (tux && tux->num_frames) /* make sure sprite has at least one frame */
+  {
+    SDL_BlitSurface(tux->frame[0], NULL, screen, &Tuxdest);
+  }
+  SDL_UpdateRect(screen, 0, 0, 0, 0);
 
-			
-		SDL_Delay(40);
-	}
+  while (!finished)
+  {
+    start = SDL_GetTicks();
 
-	SDL_FreeSurface(s1);
-	SDL_FreeSurface(s2);
-	SDL_FreeSurface(s3);
-	SDL_FreeSurface(s4);
-	FreeSprite(tux);
+    while (SDL_PollEvent(&event)) 
+    {
+      switch (event.type)
+      {
+        case SDL_QUIT:
+        {
+          cleanup();
+          //exit(0);
+        }
+
+        case SDL_MOUSEBUTTONDOWN:
+        case SDL_KEYDOWN:
+        {
+          finished = 1;
+        }
+      }
+    }
+
+    /* --- make tux blink --- */
+    switch (frame % TUX6)
+    {
+      case 0:    tux_frame = 1; break;
+      case TUX1: tux_frame = 2; break;
+      case TUX2: tux_frame = 3; break;
+      case TUX3: tux_frame = 4; break;			
+      case TUX4: tux_frame = 3; break;
+      case TUX5: tux_frame = 2; break;
+      default: tux_frame = 0;
+    }
+
+    if (tux_frame)
+    {
+      SDL_BlitSurface(tux->frame[tux_frame - 1], NULL, screen, &Tuxdest);
+      SDL_UpdateRect(screen, Tuxdest.x+37, Tuxdest.y+40, 70, 45);
+    }
+    /* Wait so we keep frame rate constant: */
+    while ((SDL_GetTicks() - start) < 33)
+    {
+      SDL_Delay(20);
+    }
+    frame++;
+  }  // End of while (!finished) loop
+
+  SDL_FreeSurface(s1);
+  SDL_FreeSurface(s2);
+  SDL_FreeSurface(s3);
+  SDL_FreeSurface(s4);
+  FreeSprite(tux);
 }
 
 
@@ -1324,6 +1324,7 @@
 /* Display a list of tuxmath config files in the missions directory   */
 /* and allow the player to pick one.                                  */
 /* FIXME the directory search and list generation belongs in fileops.c */
+/* FIXME set up frame counter so Tux blinks.                           */
 
 /* returns 0 if user pressed escape (or if dir not found)
  *         1 if config was set correctly
@@ -1332,16 +1333,23 @@
 {
   SDL_Surface *titles[MAX_LESSONS];
   SDL_Surface *select[MAX_LESSONS];
-  SDL_Surface *left, *right;
+  SDL_Surface* lesson_title;
+  SDL_Surface *left, *right, *left_gray, *right_gray;
   SDL_Rect leftRect, rightRect;
   SDL_Rect titleRects[8];               //8 lessons displayed per page 
+  SDL_Rect lesson_menu_button[8];      // Translucent mouse "buttons"
 
+  Uint32 frame = 0;                             //For keeping frame rate constant 
+  Uint32 frame_start = 0;
   int stop = 0;
   int loc = 0;                                  //The currently selected lesson file
   int old_loc = 1;
   int lessons = 0;                              //Number of lesson files found in dir
   int i;
   int length;
+  sprite* tux;
+  int tux_frame;
+  int click_flag = 1;
 
   unsigned char lesson_path[FNLEN];             //Path to lesson directory
   unsigned char lesson_list[MAX_LESSONS][200];  //List of lesson file names
@@ -1473,27 +1481,45 @@
   SDL_FreeSurface(bkg);
   bkg = LoadImage("title/main_bkg.png", IMG_REGULAR);
 
+  /* Put arrow buttons in right lower corner, inset by 20 pixels */
+  /* with a 10 pixel space between:                              */
+  right = LoadImage("title/right.png", IMG_ALPHA);
+  right_gray = LoadImage("title/right_gray.png", IMG_ALPHA);
+  rightRect.w = right->w;
+  rightRect.h = right->h;
+  rightRect.x = screen->w - right->w - 20;
+  rightRect.y = screen->h - right->h - 20;
+
   left = LoadImage("title/left.png", IMG_ALPHA);       
-  leftRect.w = left->w; leftRect.h = left->h;
-  leftRect.x = 320 - 80 - (leftRect.w/2); leftRect.y = 430;
+  left_gray = LoadImage("title/left_gray.png", IMG_ALPHA);       
+  leftRect.w = left->w;
+  leftRect.h = left->h;
+  leftRect.x = rightRect.x - 10 - left->w;
+  leftRect.y = screen->h - left->h - 20;
 
-  right = LoadImage("title/right.png", IMG_ALPHA);
-  rightRect.w = right->w; rightRect.h = right->h;
-  rightRect.x = 320 + 80 - (rightRect.w/2); rightRect.y = 430;
+  tux = LoadSprite("tux/bigtux", IMG_ALPHA);
+  lesson_title = LoadImage("title/title1.png", IMG_ALPHA);
 
-  /* set initial rect sizes */
-  titleRects[0].y = 30;
+  /* set initial title rect sizes */
+  titleRects[0].y = 20;
   titleRects[0].w = titleRects[0].h = titleRects[0].x = 0;
 
   for (i = 1; i < 8; i++)
   { 
-    titleRects[i].y = titleRects[i - 1].y + 50;
+    titleRects[i].y = titleRects[i - 1].y + 55;
     titleRects[i].w = titleRects[i].h = titleRects[i].x = 0;
   }
 
+  /* Set up background, title, and Tux: */
+  SDL_BlitSurface(bkg, NULL, screen, NULL);
+  SDL_BlitSurface(lesson_title, NULL, screen, &Titledest);
+  SDL_BlitSurface(tux->frame[0], NULL, screen, &Tuxdest);
+  SDL_UpdateRect(screen, 0, 0, 0 ,0);
 
   while (!stop)
   {
+    frame_start = SDL_GetTicks();         /* For keeping frame rate constant. */
+
     while (SDL_PollEvent(&event))
     {
       switch (event.type)
@@ -1509,36 +1535,85 @@
         {
           for (i = 0; (i < 8) && (loc -(loc % 8) + i < lessons); i++)
           {
-            if (inRect(titleRects[i], event.motion.x, event.motion.y))
+            if (inRect(lesson_menu_button[i], event.motion.x, event.motion.y))
             {
+              // Play sound if loc is being changed:
+              if (Opts_MenuSound() && (loc != loc - (loc % 8) + i)) 
+              {
+                tuxtype_playsound(snd_move);
+              }
               loc = loc - (loc % 8) + i;
               break;
             }
           }
-          break;
+
+          /* "Left" button - make click if button active: */
+          if (inRect(leftRect, event.motion.x, event.motion.y))
+          {
+            if (loc - (loc % 8) - 8 >= 0)
+            {
+              if (Opts_MenuSound() && click_flag)
+              {
+                tuxtype_playsound(snd_move);
+                click_flag = 0;
+              }
+              break;
+            }
+          }
+
+          /* "Right" button - go to next page: */
+          else if (inRect( rightRect, event.motion.x, event.motion.y ))
+          {
+            if (loc - (loc % 8) + 8 < lessons)
+            {
+              if (Opts_MenuSound() && click_flag)
+              {
+                tuxtype_playsound(snd_move);
+                click_flag = 0;
+              }
+              break;
+            }
+          }
+          else  // Mouse outside of arrow rects - re-enable click sound:
+          {
+            click_flag = 1;
+            break;
+          }
         }
 
         case SDL_MOUSEBUTTONDOWN:
         {
-#ifdef TUXMATH_DEBUG
-              fprintf(stderr, "MouseDown at x = %d, y = %d\n", event.button.x, event.button.y);
-#endif
-
           /* Lesson buttons - play game with corresponding lesson file: */
           for (i = 0; (i < 8) && (loc - (loc % 8) + i < lessons); i++)
           {
-            if (inRect(titleRects[i], event.button.x, event.button.y))
+            if (inRect(lesson_menu_button[i], event.button.x, event.button.y))
             {
+              if (Opts_MenuSound())
+              {
+                  tuxtype_playsound(snd_select);
+              }
+
               loc = loc - (loc % 8) + i;
 
-#ifdef TUXMATH_DEBUG
-              fprintf(stderr, "Player selecting lesson, loc = %d\n", loc);
-              fprintf(stderr, "Name of lesson file: %s", lesson_list[loc]);
-#endif
-              read_named_config_file(lesson_list[loc]);
-              game();
-              //FIXME only recognizing first entry in list
+              if (read_named_config_file(lesson_list[loc]))
+              {
+                if (Opts_MenuMusic())  //Turn menu music off for game
+                {
+                  audioMusicUnload();
+                }
 
+                game();
+
+                if (Opts_MenuMusic()) //Turn menu music back on
+                {
+                  audioMusicLoad( "tuxi.ogg", -1 );
+                }
+              }
+              else  // Something went wrong - could not read config file:
+              {
+                fprintf(stderr, "\nCould not find file: %s\n", lesson_list[loc]);
+              }
+
               stop = 1;
               break;
             }
@@ -1550,6 +1625,10 @@
             if (loc - (loc % 8) - 8 >= 0)
             {
               loc = loc - (loc % 8) - 8;
+              if (Opts_MenuSound())
+              {
+                tuxtype_playsound(snd_move);
+              }
               break;
             }
           }
@@ -1560,6 +1639,10 @@
             if (loc - (loc % 8) + 8 < lessons)
             {
               loc = loc - (loc % 8) + 8;
+              if (Opts_MenuSound())
+              {
+                tuxtype_playsound(snd_move);
+              }
               break;
             }
           }
@@ -1575,23 +1658,48 @@
             break;
           }
 
+          /* Selecting lesson game! */
           if ((event.key.keysym.sym == SDLK_RETURN)
            || (event.key.keysym.sym == SDLK_SPACE)
            || (event.key.keysym.sym == SDLK_KP_ENTER))
           {
-#ifdef TUXMATH_DEBUG
-            fprintf(stderr, "Player selecting lesson, loc = %d\n", loc);
-            fprintf(stderr, "Name of lesson file: %s", lesson_list[loc]);
-#endif
-            read_named_config_file(lesson_list[loc]);
-            game();
+            if (Opts_MenuSound())
+            {
+              tuxtype_playsound(snd_select);
+            }
+
+            if (read_named_config_file(lesson_list[loc]))
+            {
+              if (Opts_MenuMusic())  //Turn menu music off for game
+              {
+                audioMusicUnload();
+              }
+
+              game();
+
+              if (Opts_MenuMusic()) //Turn menu music back on
+              {
+                audioMusicLoad( "tuxi.ogg", -1 );
+              }
+            }
+            else  // Something went wrong - could not read config file:
+            {
+              fprintf(stderr, "\nCould not find file: %s\n", lesson_list[loc]);
+            }
+
             stop = 1;
             break;
           }
 
+
           /* Go to previous page, if present: */
           if ((event.key.keysym.sym == SDLK_LEFT) || (event.key.keysym.sym == SDLK_PAGEUP))
           {
+            if (Opts_MenuSound())
+            {
+              tuxtype_playsound(snd_move);
+            }
+
             if (loc - (loc % 8) - 8 >= 0)
             {
               loc = loc - (loc % 8) - 8;
@@ -1601,8 +1709,13 @@
           /* Go to next page, if present: */
           if ((event.key.keysym.sym == SDLK_RIGHT) || (event.key.keysym.sym == SDLK_PAGEDOWN))
           {
-            if (loc-(loc%8)+8 < lessons)
+            if (Opts_MenuSound())
             {
+              tuxtype_playsound(snd_move);
+            }
+
+            if (loc - (loc % 8) + 8 < lessons)
+            {
               loc = (loc - (loc % 8) + 8);
             }
           }
@@ -1610,6 +1723,11 @@
           /* Go up one entry, if present: */
           if (event.key.keysym.sym == SDLK_UP)
           {
+            if (Opts_MenuSound())
+            {
+              tuxtype_playsound(snd_move);
+            }
+
             if (loc > 0)
             {
               loc--;
@@ -1619,6 +1737,11 @@
           /* Go down one entry, if present: */
           if (event.key.keysym.sym == SDLK_DOWN)
           {
+            if (Opts_MenuSound())
+            {
+              tuxtype_playsound(snd_move);
+            }
+
             if (loc + 1 < lessons)
             {
               loc++;
@@ -1634,40 +1757,85 @@
       int start;
       start = loc - (loc % 8);
 
-      SDL_BlitSurface( bkg, NULL, screen, NULL );
+      /* Redraw background, title, and Tux: */
+      SDL_BlitSurface(bkg, NULL, screen, NULL);
+      SDL_BlitSurface(lesson_title, NULL, screen, &Titledest);
+      SDL_BlitSurface(tux->frame[0], NULL, screen, &Tuxdest);
 
-      /* FIXME get rid of evil macro ;)       */
+      /* FIXME get rid of "evil" macro ;)       */
       for (i = start; i < MIN(start+8,lessons); i++)
       {
         titleRects[i % 8].x = 320 - (titles[i]->w/2); //Center in screen
         titleRects[i % 8].w = titles[i]->w;
         titleRects[i % 8].h = titles[i]->h;
 
+        /* Now set up mouse button rects: */
+        lesson_menu_button[i % 8].x = titleRects[i % 8].x - 15;
+        lesson_menu_button[i % 8].y = titleRects[i % 8].y - 15;
+        lesson_menu_button[i % 8].h = titleRects[i % 8].h + 30;
+        lesson_menu_button[i % 8].w = titleRects[i % 8].w + 30;
+
         if (i == loc)  //Draw text in yellow
         {
+          draw_button(&lesson_menu_button[i % 8], lesson_menu_button[i % 8].w, sel);
           SDL_BlitSurface(select[loc], NULL, screen, &titleRects[i % 8]);
         }
         else           //Draw text in white
         {
+          draw_button(&lesson_menu_button[i % 8], lesson_menu_button[i % 8].w, reg);
           SDL_BlitSurface(titles[i], NULL, screen, &titleRects[i % 8]);
         }
       }
 
-      /* --- draw buttons --- */
+      /* --- draw 'left' and 'right' buttons --- */
       if (start > 0)        // i.e. not on first page
       {
         SDL_BlitSurface( left, NULL, screen, &leftRect );
       }
+      else  /* Draw grayed-out left button: */
+      {
+        SDL_BlitSurface( left_gray, NULL, screen, &leftRect );
+      }
+
       if (start + 8 < lessons)  // not on last page
       {
         SDL_BlitSurface( right, NULL, screen, &rightRect );
       }
+      else  /* Draw grayed-out right button: */
+      {
+        SDL_BlitSurface( right_gray, NULL, screen, &rightRect );
+      }
 
-      /* Now redraw whole screen: */
       SDL_UpdateRect(screen, 0, 0, 0 ,0);
     }
-    SDL_Delay(40);
+
     old_loc = loc;
+
+
+    /* --- make tux blink --- */
+    switch (frame % TUX6)
+    {
+      case 0:    tux_frame = 1; break;
+      case TUX1: tux_frame = 2; break;
+      case TUX2: tux_frame = 3; break;
+      case TUX3: tux_frame = 4; break;			
+      case TUX4: tux_frame = 3; break;
+      case TUX5: tux_frame = 2; break;
+      default: tux_frame = 0;
+    }
+
+    if (tux_frame)
+    {
+      SDL_BlitSurface(tux->frame[tux_frame - 1], NULL, screen, &Tuxdest);
+      SDL_UpdateRect(screen, Tuxdest.x+37, Tuxdest.y+40, 70, 45);
+    }
+
+    /* Wait so we keep frame rate constant: */
+    while ((SDL_GetTicks() - frame_start) < 33)
+    {
+      SDL_Delay(20);
+    }
+    frame++;
   }  // End !stop while loop
 
   /* --- clear graphics before leaving function --- */ 
@@ -1679,10 +1847,14 @@
 
   SDL_FreeSurface(left);
   SDL_FreeSurface(right);
+  SDL_FreeSurface(left_gray);
+  SDL_FreeSurface(right_gray);
+  SDL_FreeSurface(lesson_title);
+  FreeSprite(tux);
 
   DEBUGCODE { fprintf( stderr, "Leaving choose_config_file();\n" ); }
 
-  if (stop == 2)
+  if (stop == 2)  // Means player pressed ESC
     return 0;
 
   return 1;
@@ -1904,7 +2076,7 @@
 
 
 /******************************
-AddRect : Dont actually blit a surface,
+AddRect: Don't actually blit a surface,
     but add a rect to be updated next
     update
 *******************************/

Modified: tuxmath/trunk/src/titlescreen.h
===================================================================
--- tuxmath/trunk/src/titlescreen.h	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/titlescreen.h	2007-01-24 19:22:08 UTC (rev 71)
@@ -134,10 +134,11 @@
 
 /* Menu Prototypes */
 enum Game_Type { 
-	QUIT_GAME, ARCADE, OPTIONS, LESSONS, MORE_OPTIONS, HELP,
-	INSTRUCT_CASCADE, CASCADE1, CASCADE2, CASCADE3, CASCADE4,
+	LESSONS, ARCADE, OPTIONS, MORE_OPTIONS, QUIT_GAME,
+        ARCADE_CADET, ARCADE_SCOUT, ARCADE_RANGER, ARCADE_ACE, MAIN,
+        HELP, INSTRUCT_CASCADE, CASCADE1, CASCADE2, CASCADE3, CASCADE4,
 	INSTRUCT_LASER,    LASER1,    LASER2,    LASER3,    LASER4,
-	FREETYPE, ASDF, ALL, MAIN, SET_LANGUAGE, PROJECT_INFO, EDIT_WORDLIST,
+	FREETYPE, ASDF, ALL, SET_LANGUAGE, PROJECT_INFO, EDIT_WORDLIST,
 	LEVEL1, LEVEL2, LEVEL3, LEVEL4, LASER, INSTRUCT, NOT_CODED, NONE};
 
 /* Title sequence constants */

Modified: tuxmath/trunk/src/tuxmath.c
===================================================================
--- tuxmath/trunk/src/tuxmath.c	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/tuxmath.c	2007-01-24 19:22:08 UTC (rev 71)
@@ -32,18 +32,18 @@
 
 int main(int argc, char * argv[])
 {
-  int cmd, done;
+//  int cmd, done;
   setup(argc, argv);
 
   debugOn = 1; //for tuxtype-derived code  
 
-  done = 0;
+/*  done = 0;
   
   do
-  {
+  {*/
     setupTheme(NULL);
     TitleScreen();
-
+/*
     cmd = title();
 
     if (cmd == CMD_GAME)
@@ -55,7 +55,7 @@
     else if (cmd == CMD_QUIT)
       done = 1;
   }
-  while (!done);
+  while (!done);*/
   
   cleanup();
   return 0;

Modified: tuxmath/trunk/src/tuxmath.h
===================================================================
--- tuxmath/trunk/src/tuxmath.h	2007-01-12 11:52:34 UTC (rev 70)
+++ tuxmath/trunk/src/tuxmath.h	2007-01-24 19:22:08 UTC (rev 71)
@@ -44,6 +44,8 @@
 /* They can be changed in the struct to other values at run-time */
 #define DEFAULT_PER_USER_CONFIG 1
 #define DEFAULT_USE_SOUND 1
+#define DEFAULT_MENU_SOUND 1
+#define DEFAULT_MENU_MUSIC 1
 #define DEFAULT_FULLSCREEN 1
 #define DEFAULT_USE_BKGD 1
 #define DEFAULT_DEMO_MODE 0




More information about the Tux4kids-commits mailing list