rnd-20020330-3-src
authorHolger Schemel <info@artsoft.org>
Sat, 30 Mar 2002 19:03:17 +0000 (20:03 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:36:36 +0000 (10:36 +0200)
src/files.c
src/screens.c

index 1bcbec75a4341748095f29dd9cba338414c88868..3a53cb09d31c8c460ee8e4f2eaa9e85fb2a9d48a 100644 (file)
@@ -1168,17 +1168,18 @@ void SaveScore(int level_nr)
 #define SETUP_TOKEN_SOUND_LOOPS                2
 #define SETUP_TOKEN_SOUND_MUSIC                3
 #define SETUP_TOKEN_SOUND_SIMPLE       4
-#define SETUP_TOKEN_SCROLL_DELAY       5
-#define SETUP_TOKEN_SOFT_SCROLLING     6
-#define SETUP_TOKEN_FADING             7
-#define SETUP_TOKEN_AUTORECORD         8
-#define SETUP_TOKEN_QUICK_DOORS                9
-#define SETUP_TOKEN_TEAM_MODE          10
-#define SETUP_TOKEN_HANDICAP           11
-#define SETUP_TOKEN_TIME_LIMIT         12
-#define SETUP_TOKEN_FULLSCREEN         13
-
-#define NUM_GLOBAL_SETUP_TOKENS                14
+#define SETUP_TOKEN_TOONS              5
+#define SETUP_TOKEN_SCROLL_DELAY       6
+#define SETUP_TOKEN_SOFT_SCROLLING     7
+#define SETUP_TOKEN_FADING             8
+#define SETUP_TOKEN_AUTORECORD         9
+#define SETUP_TOKEN_QUICK_DOORS                10
+#define SETUP_TOKEN_TEAM_MODE          11
+#define SETUP_TOKEN_HANDICAP           12
+#define SETUP_TOKEN_TIME_LIMIT         13
+#define SETUP_TOKEN_FULLSCREEN         14
+
+#define NUM_GLOBAL_SETUP_TOKENS                15
 
 /* player setup */
 #define SETUP_TOKEN_USE_JOYSTICK       0
@@ -1211,6 +1212,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH,  &si.sound_loops,     "repeating_sound_loops"         },
   { TYPE_SWITCH,  &si.sound_music,     "background_music"              },
   { TYPE_SWITCH,  &si.sound_simple,    "simple_sound_effects"          },
+  { TYPE_SWITCH,  &si.toons,           "toons"                         },
   { TYPE_SWITCH,  &si.scroll_delay,    "scroll_delay"                  },
   { TYPE_SWITCH,  &si.soft_scrolling,  "soft_scrolling"                },
   { TYPE_SWITCH,  &si.fading,          "screen_fading"                 },
index 1efffdd720a20f94f2916874523ac6b2c15dbe24..61d6d94e96a22baf2443d6556f54aab52262c3ad 100644 (file)
 /* screens in the setup menu */
 #define SETUP_MODE_MAIN                        0
 #define SETUP_MODE_INPUT               1
+#define SETUP_MODE_GRAPHICS            2
+#define SETUP_MODE_SOUND               3
 
-/* for DrawSetupScreen(), HandleSetupScreen() */
-#define SETUP_SCREEN_POS_START         0
-#define SETUP_SCREEN_POS_END           (SCR_FIELDY - 3)
-#define SETUP_SCREEN_POS_EMPTY1                (SETUP_SCREEN_POS_END - 2)
-#define SETUP_SCREEN_POS_EMPTY2                (SETUP_SCREEN_POS_END - 2)
+#define MAX_SETUP_MODES                        4
 
 /* for HandleSetupInputScreen() */
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -1306,10 +1304,22 @@ static struct TokenInfo *setup_info;
 static int num_setup_info;
 static int setup_mode = SETUP_MODE_MAIN;
 
+static void execSetupMain()
+{
+  setup_mode = SETUP_MODE_MAIN;
+  DrawSetupScreen();
+}
+
+static void execSetupSound()
+{
+  setup_mode = SETUP_MODE_SOUND;
+  DrawSetupScreen();
+}
+
 static void execSetupInput()
 {
   setup_mode = SETUP_MODE_INPUT;
-  DrawSetupInputScreen();
+  DrawSetupScreen();
 }
 
 static void execExitSetup()
@@ -1324,13 +1334,18 @@ static void execSaveAndExitSetup()
   execExitSetup();
 }
 
-static struct TokenInfo setup_main_info[] =
+static struct TokenInfo setup_info_main[] =
 {
+  { TYPE_ENTER_MENU,   execSetupSound,         "Sound Setup"   },
+  { TYPE_ENTER_MENU,   execSetupInput,         "Input Devices" },
+  { TYPE_EMPTY,                NULL,                   ""              },
+#if 0
   { TYPE_SWITCH,       &setup.sound,           "Sound:",       },
   { TYPE_SWITCH,       &setup.sound_loops,     " Sound Loops:" },
   { TYPE_SWITCH,       &setup.sound_music,     " Game Music:"  },
-#if 0
+#endif
   { TYPE_SWITCH,       &setup.toons,           "Toons:"        },
+#if 0
   { TYPE_SWITCH,       &setup.double_buffering,"Buffered gfx:" },
 #endif
   { TYPE_SWITCH,       &setup.scroll_delay,    "Scroll Delay:" },
@@ -1344,13 +1359,24 @@ static struct TokenInfo setup_main_info[] =
   { TYPE_SWITCH,       &setup.team_mode,       "Team-Mode:"    },
   { TYPE_SWITCH,       &setup.handicap,        "Handicap:"     },
   { TYPE_SWITCH,       &setup.time_limit,      "Timelimit:"    },
-  { TYPE_ENTER_MENU,   execSetupInput,         "Input Devices" },
   { TYPE_EMPTY,                NULL,                   ""              },
   { TYPE_LEAVE_MENU,   execExitSetup,          "Exit"          },
   { TYPE_LEAVE_MENU,   execSaveAndExitSetup,   "Save and exit" },
   { 0,                 NULL,                   NULL            }
 };
 
+static struct TokenInfo setup_info_sound[] =
+{
+  { TYPE_SWITCH,       &setup.sound,           "Sound:",       },
+  { TYPE_EMPTY,                NULL,                   ""              },
+  { TYPE_SWITCH,       &setup.sound_simple,    "Simple Sound:" },
+  { TYPE_SWITCH,       &setup.sound_loops,     "Sound Loops:"  },
+  { TYPE_SWITCH,       &setup.sound_music,     "Game Music:"   },
+  { TYPE_EMPTY,                NULL,                   ""              },
+  { TYPE_LEAVE_MENU,   execSetupMain,          "Exit"          },
+  { 0,                 NULL,                   NULL            }
+};
+
 static void drawSetupValue(int pos)
 {
   int xpos = MENU_SCREEN_VALUE_XPOS;
@@ -1375,16 +1401,27 @@ static void drawSetupValue(int pos)
   DrawText(SX + xpos * 32, SY + ypos * 32, value_string, FS_BIG, value_color);
 }
 
-static void DrawSetupMainScreen()
+static void DrawGenericSetupScreen()
 {
+  char *title_string = NULL;
   int i;
 
   UnmapAllGadgets();
   CloseDoor(DOOR_CLOSE_2);
   ClearWindow();
 
-  DrawText(SX + 16, SY + 16, "SETUP",FS_BIG,FC_YELLOW);
-  setup_info = setup_main_info;
+  if (setup_mode == SETUP_MODE_MAIN)
+  {
+    setup_info = setup_info_main;
+    title_string = "Setup";
+  }
+  else if (setup_mode == SETUP_MODE_SOUND)
+  {
+    setup_info = setup_info_sound;
+    title_string = "Sound Setup";
+  }
+
+  DrawText(SX + 16, SY + 16, title_string, FS_BIG, FC_YELLOW);
 
   num_setup_info = 0;
   for(i=0; setup_info[i].type != 0 && i < MAX_MENU_ENTRIES_ON_SCREEN; i++)
@@ -1420,9 +1457,10 @@ static void DrawSetupMainScreen()
   HandleSetupScreen(0,0,0,0,MB_MENU_INITIALIZE);
 }
 
-void HandleSetupMainScreen(int mx, int my, int dx, int dy, int button)
+void HandleGenericSetupScreen(int mx, int my, int dx, int dy, int button)
 {
-  static int choice = 0;
+  static int choice_store[MAX_SETUP_MODES];
+  int choice = choice_store[setup_mode];
   int x = 0;
   int y = choice;
 
@@ -1478,7 +1516,7 @@ void HandleSetupMainScreen(int mx, int my, int dx, int dy, int button)
       {
        drawCursor(y, FC_RED);
        drawCursor(choice, FC_BLUE);
-       choice = y;
+       choice = choice_store[setup_mode] = y;
       }
     }
     else if (!(setup_info[y].type & TYPE_GHOSTED))
@@ -1746,18 +1784,18 @@ void HandleSetupInputScreen(int mx, int my, int dx, int dy, int button)
 
 void DrawSetupScreen()
 {
-  if (setup_mode == SETUP_MODE_MAIN)
-    DrawSetupMainScreen();
-  else if (setup_mode == SETUP_MODE_INPUT)
+  if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupInputScreen();
+  else
+    DrawGenericSetupScreen();
 }
 
 void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
 {
-  if (setup_mode == SETUP_MODE_MAIN)
-    HandleSetupMainScreen(mx, my, dx, dy, button);
-  else if (setup_mode == SETUP_MODE_INPUT)
+  if (setup_mode == SETUP_MODE_INPUT)
     HandleSetupInputScreen(mx, my, dx, dy, button);
+  else
+    HandleGenericSetupScreen(mx, my, dx, dy, button);
 }
 
 void CustomizeKeyboard(int player_nr)