rnd-20040612-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 12 Jun 2004 17:51:42 +0000 (19:51 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:47:28 +0000 (10:47 +0200)
* fixed bug when pressing "stop, pause, stop, play" on tape recorder

ChangeLog
src/conftime.h
src/game.c
src/main.h
src/tape.c

index 829c0d5b972a466fc822a79bcfba92127aa4238c..732e0ff2c5be61b20fcde5b24ab95a533093e2fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2004-06-12
+       * fixed bug when pressing "stop, pause, stop, play" on tape recorder
+
 2004-06-11
        * fixed bug with wrong door state after trying to quickload empty tape
        * fixed waste of static memory usage of the binary, making it smaller
index dae3329ac318e9a5a04511cbe3021983549f62bb..73a88170dc0e90b20932911e70b4496c3bfe7a53 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-06-12 03:59]"
+#define COMPILE_DATE_STRING "[2004-06-12 17:19]"
index d43970cad7e203ffbb0f57dc74e884168fbf8c27..a8389022119adf4edf8b101a8d74d59844df3d6b 100644 (file)
 #define USE_NEW_AMOEBA_CODE    FALSE
 
 /* EXPERIMENTAL STUFF */
-#define USE_NEW_MOVEMENT       FALSE
-#define USE_NEW_MOVE_DELAY     TRUE   *1
-#define USE_NEW_PUSH_DELAY     TRUE   *1
+#define USE_NEW_MOVE_STYLE     TRUE    *0
+#define USE_NEW_MOVE_DELAY     TRUE    *1
+#define USE_NEW_PUSH_DELAY     TRUE    *1
+#define USE_NEW_BLOCK_STYLE    TRUE    *1
 
 /* for DigField() */
 #define DF_NO_PUSH             0
@@ -391,6 +392,18 @@ struct ChangingElementInfo
 
 static struct ChangingElementInfo change_delay_list[] =
 {
+#if USE_NEW_BLOCK_STYLE
+#if 0
+  {
+    EL_PLAYER_IS_LEAVING,
+    EL_EMPTY,
+    -1,                /* delay for blocking field left by player set at runtime */
+    NULL,
+    NULL,
+    NULL
+  },
+#endif
+#endif
   {
     EL_NUT_BREAKING,
     EL_EMERALD,
@@ -761,6 +774,10 @@ static void InitPlayerField(int x, int y, int element, boolean init_game)
   {
     struct PlayerInfo *player = &stored_player[Feld[x][y] - EL_PLAYER_1];
     int jx = player->jx, jy = player->jy;
+    int sp_block_delay = 7;
+    int em_block_delay = 7;
+    int sp_no_block_delay = 1;
+    int em_no_block_delay = 1;
 
     player->present = TRUE;
 
@@ -768,6 +785,11 @@ static void InitPlayerField(int x, int y, int element, boolean init_game)
                                level.sp_block_last_field :
                                level.block_last_field);
 
+    player->block_delay_value =
+      (element == EL_SP_MURPHY ?
+       (player->block_last_field ? sp_block_delay : sp_no_block_delay) :
+       (player->block_last_field ? em_block_delay : em_no_block_delay));
+
     if (!options.network || player->connected)
     {
       player->active = TRUE;
@@ -1385,8 +1407,13 @@ static void InitGameEngine()
     {
       if (IS_SP_ELEMENT(i))
       {
+#if USE_NEW_MOVE_STYLE
+       element_info[i].push_delay_fixed  = 7;  /* just enough to escape ... */
+       element_info[i].push_delay_random = 0;  /* ... from falling zonk     */
+#else
        element_info[i].push_delay_fixed  = 6;  /* just enough to escape ... */
        element_info[i].push_delay_random = 0;  /* ... from falling zonk     */
+#endif
       }
     }
   }
@@ -1511,7 +1538,10 @@ void InitGame()
 
     player->use_murphy_graphic = FALSE;
 
-    player->block_last_field = FALSE;
+    player->block_last_field = FALSE;  /* initialized in InitPlayerField() */
+    player->block_delay = 0;
+    player->block_delay_value = -1;    /* initialized in InitPlayerField() */
+
     player->can_fall_into_acid = CAN_MOVE_INTO_ACID(player->element_nr);
 
     player->actual_frame_counter = 0;
@@ -6400,7 +6430,7 @@ void ContinueMoving(int x, int y)
   else if (element == EL_PENGUIN)
     TestIfFriendTouchesBadThing(newx, newy);
 
-#if USE_NEW_MOVEMENT
+#if USE_NEW_MOVE_STYLE
 #if 0
   if (CAN_FALL(element) && direction == MV_DOWN &&
       (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) &&
@@ -8627,6 +8657,14 @@ void GameActions()
     Changed[x][y] = CE_BITMASK_DEFAULT;
     ChangeEvent[x][y] = CE_BITMASK_DEFAULT;
 
+    /* this must be handled before main playfield loop */
+    if (Feld[x][y] == EL_PLAYER_IS_LEAVING)
+    {
+      MovDelay[x][y]--;
+      if (MovDelay[x][y] <= 0)
+       RemoveField(x, y);
+    }
+
 #if DEBUG
     if (ChangePage[x][y] != -1 && ChangeDelay[x][y] != 1)
     {
@@ -9830,13 +9868,13 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
     */
     player->is_moving = FALSE;
 
-#if USE_NEW_MOVEMENT
+#if USE_NEW_MOVE_STYLE
     /* player is ALLOWED to move, but CANNOT move (something blocks his way) */
     /* ensure that the player is also allowed to move in the next frame */
     /* (currently, the player is forced to wait eight frames before he can try
        again!!!) */
 
-    player->move_delay = -1;   /* allow direct movement in the next frame */
+    player->move_delay = 0;    /* allow direct movement in the next frame */
 #endif
   }
 
@@ -9871,7 +9909,19 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     player->actual_frame_counter = FrameCounter;
     player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
-#if USE_NEW_MOVEMENT
+#if USE_NEW_BLOCK_STYLE
+    if (player->block_delay_value > 0 &&
+       Feld[last_jx][last_jy] == EL_EMPTY)
+    {
+      Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
+#if 1
+      MovDelay[last_jx][last_jy] = player->block_delay_value + 1;
+#else
+      ChangeDelay[last_jx][last_jy] = player->block_last_field_delay;
+#endif
+    }
+#else
+#if USE_NEW_MOVE_STYLE
     if (player->block_last_field &&
        Feld[last_jx][last_jy] == EL_EMPTY)
       Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
@@ -9879,6 +9929,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     if (Feld[last_jx][last_jy] == EL_EMPTY)
       Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
 #endif
+#endif
 
 #if 0
     DrawPlayer(player);
@@ -9892,9 +9943,16 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
   player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
   player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
+#if USE_NEW_BLOCK_STYLE
+#else
   if (!player->block_last_field &&
       Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING)
+#if 1
+    RemoveField(last_jx, last_jy);
+#else
     Feld[last_jx][last_jy] = EL_EMPTY;
+#endif
+#endif
 
   /* before DrawPlayer() to draw correct player graphic for this case */
   if (player->MovPos == 0)
@@ -9931,9 +9989,16 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     }
 #endif
 
+#if USE_NEW_BLOCK_STYLE
+#else
     if (player->block_last_field &&
        Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING)
+#if 1
+      RemoveField(last_jx, last_jy);
+#else
       Feld[last_jx][last_jy] = EL_EMPTY;
+#endif
+#endif
 
     player->last_jx = jx;
     player->last_jy = jy;
index b7a70f9f001f6d5fca4bb613d3eb9f37f17bca7e..009736ffc4224aa68666f655eb8b7a4c89cbc108 100644 (file)
@@ -1381,6 +1381,9 @@ struct PlayerInfo
   boolean use_murphy_graphic;
 
   boolean block_last_field;
+  int block_delay;
+  int block_delay_value;
+
   boolean can_fall_into_acid;
 
   boolean LevelSolved, GameOver;
index 6b1b011cca8a628b6699e38d54108ebfc14f40b3..e6fbcdab528e3082dcaca4c7d1cd11b58986d8e0 100644 (file)
@@ -776,8 +776,10 @@ void TapeHaltRecording()
 
 void TapeStopRecording()
 {
+#if 0
   if (!tape.recording)
     return;
+#endif
 
   TapeHaltRecording();
 
@@ -923,8 +925,10 @@ static void TapeStartGamePlaying()
 
 void TapeStopPlaying()
 {
+#if 0
   if (!tape.playing)
     return;
+#endif
 
   tape.playing = FALSE;
   tape.pausing = FALSE;