Added a joystick control dialog.
authorRicardo Cruz <rick2@aeiou.pt>
Fri, 23 Apr 2004 11:12:43 +0000 (11:12 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Fri, 23 Apr 2004 11:12:43 +0000 (11:12 +0000)
I don't have a joystick, so please test and improve this thing. Thx.

SVN-Revision: 664

src/menu.cpp
src/menu.h
src/setup.cpp

index 798dce3..db41fce 100644 (file)
@@ -48,7 +48,8 @@ Menu* main_menu      = 0;
 Menu* game_menu      = 0;
 Menu* worldmap_menu  = 0;
 Menu* options_menu   = 0;
-Menu* options_controls_menu   = 0;
+Menu* options_keys_menu     = 0;
+Menu* options_joystick_menu = 0;
 Menu* highscore_menu = 0;
 Menu* load_game_menu = 0;
 Menu* save_game_menu = 0;
index 4764350..43aee85 100644 (file)
@@ -155,7 +155,8 @@ extern Menu* main_menu;
 extern Menu* game_menu;
 extern Menu* worldmap_menu;
 extern Menu* options_menu;
-extern Menu* options_controls_menu;
+extern Menu* options_keys_menu;
+extern Menu* options_joystick_menu;
 extern Menu* highscore_menu;
 extern Menu* load_game_menu;
 extern Menu* save_game_menu;
index 765f107..1b63b77 100644 (file)
@@ -365,7 +365,8 @@ void st_menu(void)
 {
   main_menu      = new Menu();
   options_menu   = new Menu();
-  options_controls_menu   = new Menu();
+  options_keys_menu     = new Menu();
+  options_joystick_menu = new Menu();
   load_game_menu = new Menu();
   save_game_menu = new Menu();
   game_menu      = new Menu();
@@ -401,20 +402,36 @@ void st_menu(void)
       options_menu->additem(MN_DEACTIVE,"Music     ",use_music,0);
     }
   options_menu->additem(MN_TOGGLE,"Show FPS  ",show_fps,0);
-  options_menu->additem(MN_GOTO,"Controls  ",0,options_controls_menu);
+  options_menu->additem(MN_GOTO,"Key Setup  ",0,options_keys_menu);
+  if(use_joystick)
+    options_menu->additem(MN_GOTO,"Joystick Setup  ",0,options_joystick_menu);
   options_menu->additem(MN_HL,"",0,0);
   options_menu->additem(MN_BACK,"Back",0,0);
   
-  options_controls_menu->additem(MN_LABEL,"Controls",0,0);
-  options_controls_menu->additem(MN_HL,"",0,0);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Left move", 0,0, &keymap.left);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Right move", 0,0, &keymap.right);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, &keymap.jump);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Duck", 0,0, &keymap.duck);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Power", 0,0, &keymap.fire);
-  options_controls_menu->additem(MN_HL,"",0,0);
-  options_controls_menu->additem(MN_BACK,"Back",0,0);
-
+  options_keys_menu->additem(MN_LABEL,"Key Setup",0,0);
+  options_keys_menu->additem(MN_HL,"",0,0);
+  options_keys_menu->additem(MN_CONTROLFIELD,"Left move", 0,0, &keymap.left);
+  options_keys_menu->additem(MN_CONTROLFIELD,"Right move", 0,0, &keymap.right);
+  options_keys_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, &keymap.jump);
+  options_keys_menu->additem(MN_CONTROLFIELD,"Duck", 0,0, &keymap.duck);
+  options_keys_menu->additem(MN_CONTROLFIELD,"Power", 0,0, &keymap.fire);
+  options_keys_menu->additem(MN_HL,"",0,0);
+  options_keys_menu->additem(MN_BACK,"Back",0,0);
+
+  if(use_joystick)
+    {
+    options_joystick_menu->additem(MN_LABEL,"Joystick Setup",0,0);
+    options_joystick_menu->additem(MN_HL,"",0,0);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"X axis", 0,0, &joystick_keymap.x_axis);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"Y axis", 0,0, &joystick_keymap.y_axis);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"A button", 0,0, &joystick_keymap.a_button);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"B button", 0,0, &joystick_keymap.b_button);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"Start", 0,0, &joystick_keymap.start_button);
+    options_joystick_menu->additem(MN_CONTROLFIELD,"DeadZone", 0,0, &joystick_keymap.dead_zone);
+    options_joystick_menu->additem(MN_HL,"",0,0);
+    options_joystick_menu->additem(MN_BACK,"Back",0,0);
+    }
+  
   load_game_menu->additem(MN_LABEL,"Start Game",0,0);
   load_game_menu->additem(MN_HL,"",0,0);
   load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0);