rnd-20020401-1-src
[rocksndiamonds.git] / src / game.c
index 5dbf9df02a21b95923757ebeff666a09bc1c15a7..0c369f03ae7363a53b4b83d59ae75d2449e7a08b 100644 (file)
@@ -19,7 +19,6 @@
 #include "init.h"
 #include "files.h"
 #include "tape.h"
-#include "joystick.h"
 #include "network.h"
 
 /* this switch controls how rocks move horizontally */
@@ -174,10 +173,10 @@ void GetPlayerConfig()
     setup.sound = FALSE;
 
   if (!audio.loops_available)
-  {
     setup.sound_loops = FALSE;
+
+  if (!audio.music_available)
     setup.sound_music = FALSE;
-  }
 
   if (!video.fullscreen_available)
     setup.fullscreen = FALSE;
@@ -693,7 +692,7 @@ void InitGame()
 
   /* dynamically adjust element properties according to game engine version */
   {
-    static int ep_slippery[] =
+    static int ep_em_slippery_wall[] =
     {
       EL_BETON,
       EL_MAUERWERK,
@@ -702,14 +701,30 @@ void InitGame()
       EL_MAUER_Y,
       EL_MAUER_XY
     };
-    static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
+#if 1
+    static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall);
+#else
+    static int ep_em_slippery_wall_num =
+      sizeof(ep_em_slippery_wall) / sizeof(int);
+#endif
+
+    /*
+    printf("level %d: game.version == %06d\n", level_nr, level.game_version);
+    printf("         file_version == %06d\n", level.file_version);
+    */
 
-    for (i=0; i<ep_slippery_num; i++)
+    for (i=0; i<ep_em_slippery_wall_num; i++)
     {
+#if 1
+      if (level.em_slippery_gems)      /* special EM style gems behaviour */
+#else
       if (game.version >= GAME_VERSION_2_0)
-       Elementeigenschaften2[ep_slippery[i]] |= EP_BIT_SLIPPERY_GEMS;
+#endif
+       Elementeigenschaften2[ep_em_slippery_wall[i]] |=
+         EP_BIT_EM_SLIPPERY_WALL;
       else
-       Elementeigenschaften2[ep_slippery[i]] &= ~EP_BIT_SLIPPERY_GEMS;
+       Elementeigenschaften2[ep_em_slippery_wall[i]] &=
+         ~EP_BIT_EM_SLIPPERY_WALL;
     }
   }
 
@@ -787,6 +802,7 @@ void InitGame()
           int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
 
   UnmapGameButtons();
+  UnmapTapeButtons();
   game_gadget[SOUND_CTRL_ID_MUSIC]->checked = setup.sound_music;
   game_gadget[SOUND_CTRL_ID_LOOPS]->checked = setup.sound_loops;
   game_gadget[SOUND_CTRL_ID_SIMPLE]->checked = setup.sound_simple;
@@ -2626,7 +2642,7 @@ void StartMoving(int x, int y)
 #endif
 #else
     else if ((IS_SLIPPERY(Feld[x][y+1]) ||
-             (IS_SLIPPERY_GEMS(Feld[x][y+1]) && IS_GEM(element))) &&
+             (IS_EM_SLIPPERY_WALL(Feld[x][y+1]) && IS_GEM(element))) &&
             !IS_FALLING(x, y+1) && !JustStopped[x][y+1] &&
             element != EL_DX_SUPABOMB && element != EL_SP_DISK_ORANGE)
 #endif
@@ -4364,6 +4380,9 @@ void GameActions()
   action_delay_value =
     (tape.playing && tape.fast_forward ? FfwdFrameDelay : GameFrameDelay);
 
+  if (tape.playing && tape.index_search)
+    action_delay_value = 0;
+
   /* ---------- main game synchronization point ---------- */
 
   WaitUntilDelayReached(&action_delay, action_delay_value);
@@ -4398,11 +4417,6 @@ void GameActions()
   if (tape.pausing)
     return;
 
-  if (tape.playing)
-    TapePlayDelay();
-  else if (tape.recording)
-    TapeRecordDelay();
-
   recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
 
   for (i=0; i<MAX_PLAYERS; i++)
@@ -4957,7 +4971,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
     return FALSE;
 #else
   if (!FrameReached(&player->move_delay, player->move_delay_value) &&
-      !(tape.playing && tape.file_version < FILE_VERSION_2_0))
+      !(tape.playing && tape.game_version < GAME_VERSION_2_0))
     return FALSE;
 #endif
 
@@ -5815,7 +5829,7 @@ int DigField(struct PlayerInfo *player,
        return MF_NO_ACTION;
 #else
       if (!FrameReached(&player->push_delay, player->push_delay_value) &&
-         !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+         !(tape.playing && tape.game_version < GAME_VERSION_2_0) &&
          element != EL_SPRING)
        return MF_NO_ACTION;
 #endif
@@ -6057,7 +6071,7 @@ int DigField(struct PlayerInfo *player,
        return MF_NO_ACTION;
 #else
       if (!FrameReached(&player->push_delay, player->push_delay_value) &&
-         !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
+         !(tape.playing && tape.game_version < GAME_VERSION_2_0) &&
          element != EL_BALLOON)
        return MF_NO_ACTION;
 #endif
@@ -6500,7 +6514,7 @@ static void HandleGameButtons(struct GadgetInfo *gi)
        setup.sound_music = FALSE;
        FadeMusic();
       }
-      else if (audio.loops_available)
+      else if (audio.music_available)
       { 
        setup.sound = setup.sound_music = TRUE;
        if (num_bg_loops)