rnd-20020324-1-src
[rocksndiamonds.git] / src / events.c
index f4e690f82c2ddbe6b6d3f3aba10df575f4bc9025..652ff31da2097c2690414392f1d62cfc29242e21 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2000 Artsoft Entertainment                      *
+* (c) 1995-2001 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -19,8 +19,8 @@
 #include "tools.h"
 #include "game.h"
 #include "editor.h"
+#include "files.h"
 #include "tape.h"
-#include "joystick.h"
 #include "network.h"
 
 /* values for key_status */
@@ -303,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;
@@ -335,7 +335,7 @@ void HandleFocusEvent(FocusChangeEvent *event)
       KeyboardAutoRepeatOff();
     }
     if (old_joystick_status != -1)
-      joystick_status = old_joystick_status;
+      joystick.status = old_joystick_status;
   }
 }
 
@@ -510,9 +510,9 @@ 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)
+  if (key == KSYM_Escape &&
+      game_status != MAINMENU && game_status != LEVELED)
   {
-    CloseDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
     game_status = MAINMENU;
     DrawMainMenu();
     return;
@@ -565,6 +565,12 @@ void HandleKey(Key key, int key_status)
             HandleChooseLevel(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
          break;
 
+#ifdef DEBUG
+        case KSYM_t:
+         DumpTape(&tape);
+         break;
+#endif
+
        default:
          break;
       }
@@ -598,7 +604,7 @@ void HandleKey(Key key, int key_status)
       break;
 
     case LEVELED:
-      if (!anyTextGadgetActiveOrJustFinished)
+      if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape)
        HandleLevelEditorKeyInput(key);
       break;