rnd-20020330-4-src
[rocksndiamonds.git] / src / events.c
index fd8c35132206c56097d8a6bb099ca81ab23c972b..ccab40eedbbd44190ca7d1e7d776238cb5a161b3 100644 (file)
@@ -21,7 +21,6 @@
 #include "editor.h"
 #include "files.h"
 #include "tape.h"
-#include "joystick.h"
 #include "network.h"
 
 /* values for key_status */
@@ -304,8 +303,8 @@ void HandleFocusEvent(FocusChangeEvent *event)
     int i;
 
     KeyboardAutoRepeatOn();
-    old_joystick_status = joystick_status;
-    joystick_status = JOYSTICK_OFF;
+    old_joystick_status = joystick.status;
+    joystick.status = JOYSTICK_NOT_AVAILABLE;
 
     /* simulate key release events for still pressed keys */
     key_joystick_mapping = 0;
@@ -336,7 +335,7 @@ void HandleFocusEvent(FocusChangeEvent *event)
       KeyboardAutoRepeatOff();
     }
     if (old_joystick_status != -1)
-      joystick_status = old_joystick_status;
+      joystick.status = old_joystick_status;
   }
 }
 
@@ -393,10 +392,6 @@ void HandleButton(int mx, int my, int button)
       HandleSetupScreen(mx,my, 0,0, button);
       break;
 
-    case SETUPINPUT:
-      HandleSetupInputScreen(mx,my, 0,0, button);
-      break;
-
     case PLAYING:
 #ifdef DEBUG
       if (button == MB_RELEASED)
@@ -512,7 +507,10 @@ void HandleKey(Key key, int key_status)
 
   /* allow quick escape to the main menu with the Escape key */
   if (key == KSYM_Escape &&
-      game_status != MAINMENU && game_status != LEVELED)
+      game_status != MAINMENU &&
+      game_status != LEVELED &&
+      game_status != CHOOSELEVEL &&
+      game_status != SETUP)
   {
     game_status = MAINMENU;
     DrawMainMenu();
@@ -541,7 +539,6 @@ void HandleKey(Key key, int key_status)
     case MAINMENU:
     case CHOOSELEVEL:
     case SETUP:
-    case SETUPINPUT:
       switch(key)
       {
        case KSYM_Return:
@@ -552,8 +549,13 @@ void HandleKey(Key key, int key_status)
             HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE);
          else if (game_status == SETUP)
            HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE);
-         else if (game_status == SETUPINPUT)
-           HandleSetupInputScreen(0,0, 0,0, MB_MENU_CHOICE);
+         break;
+
+       case KSYM_Escape:
+          if (game_status == CHOOSELEVEL)
+            HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE);
+         else if (game_status == SETUP)
+           HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE);
          break;
 
         case KSYM_Page_Up:
@@ -818,7 +820,6 @@ void HandleJoystick()
     case MAINMENU:
     case CHOOSELEVEL:
     case SETUP:
-    case SETUPINPUT:
     {
       static unsigned long joystickmove_delay = 0;
 
@@ -832,9 +833,6 @@ void HandleJoystick()
         HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       else if (game_status==SETUP)
        HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
-      else if (game_status==SETUPINPUT)
-       HandleSetupInputScreen(0,0,dx,dy,
-                              newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
       break;
     }