changed behaviour of key shortcut to start/pause/continue game
authorHolger Schemel <info@artsoft.org>
Tue, 14 Jun 2016 09:14:07 +0000 (11:14 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 14 Jun 2016 09:14:07 +0000 (11:14 +0200)
src/events.c
src/game.c
src/tape.c
src/tape.h

index dcb957a5fe3600f082d86dd28f3d784b8e15a601..843fb1972f2005871c0eab401a157b6ccd260be1 100644 (file)
@@ -1451,7 +1451,7 @@ void HandleKey(Key key, int key_status)
     else if (key == setup.shortcut.load_game)
       TapeQuickLoad();
     else if (key == setup.shortcut.toggle_pause)
-      TapeTogglePause(TAPE_TOGGLE_MANUAL);
+      TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
 
     HandleTapeButtonKeys(key);
     HandleSoundButtonKeys(key);
index a452586d0b487f8c31ccd111e5f746c21d29abc0..f7ff3eab01a0d85cf274df89332e410030031d47 100644 (file)
@@ -15180,7 +15180,7 @@ static void HandleGameButtonsExt(int id, int button)
          SendToServer_ContinuePlaying();
        else
 #endif
-         TapeTogglePause(TAPE_TOGGLE_MANUAL);
+         TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
       }
       break;
 
index 919bd418455f9749b5490bf4445de947b3371a05..8087860ba5b33d4a7fd2f7ec4396a3f6a7910e06 100644 (file)
@@ -672,11 +672,21 @@ void TapeRecordAction(byte action_raw[MAX_PLAYERS])
   }
 }
 
-void TapeTogglePause(boolean toggle_manual)
+void TapeTogglePause(boolean toggle_mode)
 {
+  if (tape.playing && tape.pausing && (toggle_mode & TAPE_TOGGLE_PLAY_PAUSE))
+  {
+    // continue playing in normal mode
+    tape.fast_forward = FALSE;
+    tape.warp_forward = FALSE;
+    tape.deactivate_display = FALSE;
+
+    tape.pause_before_end = FALSE;
+  }
+
   tape.pausing = !tape.pausing;
 
-  if (tape.single_step && toggle_manual)
+  if (tape.single_step && (toggle_mode & TAPE_TOGGLE_MANUAL))
     tape.single_step = FALSE;
 
   DrawVideoDisplayCurrentState();
@@ -1367,14 +1377,7 @@ static void HandleTapeButtonsExt(int id)
       {
        if (tape.pausing)                       /* PAUSE -> PLAY */
        {
-         // continue playing in normal mode
-         tape.fast_forward = FALSE;
-         tape.warp_forward = FALSE;
-         tape.deactivate_display = FALSE;
-
-         tape.pause_before_end = FALSE;
-
-         TapeTogglePause(TAPE_TOGGLE_MANUAL);
+         TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
        }
        else if (!tape.fast_forward)            /* PLAY -> FFWD */
        {
index 03849d0a45ab049011ecd3ef27808992fe0555fa..cf6f4dfda9d046982b6f9ad148d97953770dafac 100644 (file)
@@ -14,8 +14,9 @@
 
 
 /* values for TapeTogglePause() */
-#define        TAPE_TOGGLE_MANUAL      TRUE
-#define        TAPE_TOGGLE_AUTOMATIC   FALSE
+#define        TAPE_TOGGLE_AUTOMATIC   0
+#define        TAPE_TOGGLE_MANUAL      (1 << 0)
+#define        TAPE_TOGGLE_PLAY_PAUSE  (1 << 1)
 
 /* values for tape properties */
 #define MAX_TAPE_LEN           (1000 * FRAMES_PER_SECOND) /* max.time x fps */