rnd-20020417-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 16 Apr 2002 22:13:19 +0000 (00:13 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:36:56 +0000 (10:36 +0200)
src/events.c
src/events.h
src/game.c
src/game.h
src/libgame/sound.c
src/libgame/system.c
src/libgame/system.h
src/screens.c
src/tape.c
src/timestamp.h
src/tools.c

index 879b5396dd22f13549eb52245e15e97d1fa71db5..f67bc13ecac7dc8bb5d3aed4e151383cea5b7439 100644 (file)
@@ -176,6 +176,16 @@ void ClearEventQueue()
   }
 }
 
+void ClearPlayerAction()
+{
+  int i;
+
+  /* simulate key release events for still pressed keys */
+  key_joystick_mapping = 0;
+  for (i=0; i<MAX_PLAYERS; i++)
+    stored_player[i].action = 0;
+}
+
 void SleepWhileUnmapped()
 {
   boolean window_unmapped = TRUE;
@@ -269,16 +279,11 @@ void HandleFocusEvent(FocusChangeEvent *event)
 
   if (event->type == EVENT_FOCUSOUT)
   {
-    int i;
-
     KeyboardAutoRepeatOn();
     old_joystick_status = joystick.status;
     joystick.status = JOYSTICK_NOT_AVAILABLE;
 
-    /* simulate key release events for still pressed keys */
-    key_joystick_mapping = 0;
-    for (i=0; i<MAX_PLAYERS; i++)
-      stored_player[i].action = 0;
+    ClearPlayerAction();
   }
   else if (event->type == EVENT_FOCUSIN)
   {
@@ -771,11 +776,9 @@ static int HandleJoystickForAllPlayers()
     joy_action = Joystick(i);
     result |= joy_action;
 
-
     if (!setup.input[i].use_joystick)
       continue;
 
-
     stored_player[i].action = joy_action;
   }
 
index e2c4e994d95a2b78df413af5a7e9424cfbbab3b5..6cc08ef8d829f281eabbf859a99778f8aa3cd481 100644 (file)
@@ -20,6 +20,7 @@ int FilterMouseMotionEvents(const Event *);
 void EventLoop(void);
 void HandleOtherEvents(Event *);
 void ClearEventQueue(void);
+void ClearPlayerAction(void);
 void SleepWhileUnmapped(void);
 
 void HandleExposeEvent(ExposeEvent *);
index f0bf7dd9600b8bef766243fad5256c9fdd382372..e2ae24362e543e5ad437c404ff88d99ddbb6e32d 100644 (file)
@@ -432,6 +432,18 @@ static void InitField(int x, int y, boolean init_game)
   }
 }
 
+void DrawGameDoorValues()
+{
+  DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
+          int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE,
+          int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_SCORE, DY + YY_SCORE,
+          int2str(local_player->score, 5), FS_SMALL, FC_YELLOW);
+  DrawText(DX + XX_TIME, DY + YY_TIME,
+          int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
+}
+
 void InitGame()
 {
   int i, j, x, y;
@@ -792,6 +804,9 @@ void InitGame()
               DX + XX_LEVEL - 1, DY + YY_LEVEL + 1);
   }
 
+#if 1
+  DrawGameDoorValues();
+#else
   DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
           int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW);
   DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE,
@@ -800,6 +815,7 @@ void InitGame()
           int2str(local_player->score, 5), FS_SMALL, FC_YELLOW);
   DrawText(DX + XX_TIME, DY + YY_TIME,
           int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
+#endif
 
   UnmapGameButtons();
   UnmapTapeButtons();
index acd25c1b80c1265137addb5999141f9eaf6b1c00..081964f58922999c0ce824d7e1e9aaa4ea74b584 100644 (file)
@@ -30,6 +30,7 @@
 #define SC_ZEITBONUS           10
 
 void GetPlayerConfig(void);
+void DrawGameDoorValues(void);
 void InitGame(void);
 void InitMovDir(int, int);
 void InitAmoebaNr(int, int);
index 29d5a981f3d2836356d397f7160a2e49da7bb482..a517bf6769785625ef2efbbbce6a76fe6a06193f 100644 (file)
@@ -1169,7 +1169,9 @@ void PlaySoundExt(int nr, int volume, int stereo, boolean loop)
 {
   struct SoundControl snd_ctrl = emptySoundControl;
 
-  if (!audio.sound_available || !audio.sound_enabled)
+  if (!audio.sound_available ||
+      !audio.sound_enabled ||
+      audio.sound_deactivated)
     return;
 
   if (volume<PSND_MIN_VOLUME)
index 521e43f40bebd8a19b5e820fb0182de0cbb34dd9..e1ac9ccc26659467c0490607596c87ed8e235ca2 100644 (file)
@@ -357,6 +357,16 @@ inline boolean DrawingDeactivated(int x, int y, int width, int height)
     if ((gfx.draw_deactivation_mask & REDRAW_FIELD) &&
        x < gfx.sx + gfx.sxsize)
       return TRUE;
+    else if ((gfx.draw_deactivation_mask & REDRAW_DOORS) &&
+            x > gfx.dx)
+    {
+      if ((gfx.draw_deactivation_mask & REDRAW_DOOR_1) &&
+         y < gfx.dy + gfx.dysize)
+       return TRUE;
+      else if ((gfx.draw_deactivation_mask & REDRAW_DOOR_2) &&
+              y > gfx.vy)
+       return TRUE;
+    }
   }
 
   return FALSE;
@@ -730,6 +740,8 @@ inline void OpenAudio(void)
   audio.mods_available = FALSE;
   audio.sound_enabled = FALSE;
 
+  audio.sound_deactivated = FALSE;
+
   audio.soundserver_pipe[0] = audio.soundserver_pipe[1] = 0;
   audio.soundserver_pid = -1;
   audio.device_name = NULL;
index f372306fa0a9425a3b220bbffe4256d5e97a5447..17411f8d0464a4d685bcccfbc557ebdac97a5b9d 100644 (file)
@@ -229,6 +229,8 @@ struct AudioSystemInfo
   boolean mods_available;
   boolean sound_enabled;
 
+  boolean sound_deactivated;   /* for temporarily disabling sound */
+
   int soundserver_pipe[2];
   int soundserver_pid;
   char *device_name;
index 4537893fc7b9d5a591621cf3c87045f14deb1ab2..76ed7a1e4a054a7adc05df41465b8d4337281bfd 100644 (file)
@@ -137,6 +137,7 @@ void DrawMainMenu()
   KeyboardAutoRepeatOn();
   ActivateJoystick();
   SetDrawDeactivationMask(REDRAW_NONE);
+  audio.sound_deactivated = FALSE;
 
   /* needed if last screen was the playing screen, invoked from level editor */
   if (level_editor_test_game)
index db15dde94b1e7c1307af7f0c136396472395e627..8cbc41f6b50189b3dbf3285ecfec01bc66e948ee 100644 (file)
@@ -320,6 +320,7 @@ void TapeStartRecording()
   MapTapeIndexButton();
 
   SetDrawDeactivationMask(REDRAW_NONE);
+  audio.sound_deactivated = FALSE;
 }
 
 static void TapeStartGameRecording()
@@ -363,6 +364,8 @@ void TapeHaltRecording()
     return;
 
   tape.counter++;
+  tape.pos[tape.counter].delay = 0;
+
   tape.length = tape.counter;
   tape.length_seconds = GetTapeLength();
 }
@@ -437,18 +440,15 @@ void TapeTogglePause()
 
   DrawVideoDisplay(state, 0);
 
-  if (tape.index_search)
-  {
-    SetDrawDeactivationMask(REDRAW_NONE);
-    RedrawPlayfield(TRUE, 0,0,0,0);
-  }
-
   if (tape.index_search)
   {
     tape.index_search = FALSE;
 
     SetDrawDeactivationMask(REDRAW_NONE);
+    audio.sound_deactivated = FALSE;
+
     RedrawPlayfield(TRUE, 0,0,0,0);
+    DrawGameDoorValues();
 
     if (tape.quick_resume)
     {
@@ -486,6 +486,7 @@ void TapeStartPlaying()
   MapTapeIndexButton();
 
   SetDrawDeactivationMask(REDRAW_NONE);
+  audio.sound_deactivated = FALSE;
 }
 
 static void TapeStartGamePlaying()
@@ -594,7 +595,10 @@ void TapeIndexSearch()
   tape.index_search = TRUE;
 
   if (!tape.fast_forward || tape.pause_before_death)
-    SetDrawDeactivationMask(REDRAW_FIELD);
+  {
+    SetDrawDeactivationMask(REDRAW_FIELD | REDRAW_DOOR_1);
+    audio.sound_deactivated = TRUE;
+  }
 }
 
 void TapeQuickSave()
index f99d17f4347bdcca3554c2b28fe1873dbe0753cc..5d73021289c593a4a1e164e88214a2a4bdeb7e56 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2002-04-07 21:03]"
+#define COMPILE_DATE_STRING "[2002-04-17 00:07]"
index b0ffdcf7b7bc148ca9000f7c87cdc2243780ca6e..bbe7c10f6169cc91c797cc858d68a5056ebd10a2 100644 (file)
@@ -1966,7 +1966,7 @@ boolean Request(char *text, unsigned int req_state)
          break;
 
        case EVENT_KEYRELEASE:
-         key_joystick_mapping = 0;
+         ClearPlayerAction();
          break;
 
        default: