rnd-20040615-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 15 Jun 2004 19:39:09 +0000 (21:39 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:47:32 +0000 (10:47 +0200)
* fixed bug (missing array boundary check) which caused broken tapes
* fixed bug (when loading level template) which caused broken levels
* fixed bug with new block last field code when using non-yellow player

ChangeLog
src/conftime.h
src/files.c
src/game.c

index 7604d7f59a9e6c31a6739afa44edb0ce02bf4e26..adf52116f1570edd63c31d69a18f5e057eb3379e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-06-13
+       * fixed bug (missing array boundary check) which caused broken tapes
+       * fixed bug (when loading level template) which caused broken levels
+       * fixed bug with new block last field code when using non-yellow player
+
 2004-06-12
        * fixed bug when pressing "stop, pause, stop, play" on tape recorder
        * internal change of how the player blocks the last field when moving
@@ -6,6 +11,7 @@
          unsuccessfully trying to move, when he directly could move after that
        * the last two changes should make original Supaplex level 93 solvable
        * improved use of random number generator to make it less predictable
+       * fixed behaviour of slippery SP elements to let slip left, then right
 
 2004-06-11
        * fixed bug with wrong door state after trying to quickload empty tape
index 71dbf4668942a6c895e2880b2793469e3e4468e6..ebd1d098c311d36364b0a05ae6b53118b957822d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2004-06-12 23:32]"
+#define COMPILE_DATE_STRING "[2004-06-14 00:25]"
index 3989a22a83fc62557b4bf434be9e29b9e287b87b..7280860bbe8fd48029be0765ed5dbe0375f9170d 100644 (file)
@@ -2235,10 +2235,14 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
       }
     }
 
-#if 1
+#if 1  /* USE_NEW_BLOCK_STYLE */
     /* blocking the last field when moving was corrected in version 3.1.1 */
     if (level->game_version < VERSION_IDENT(3,1,1,0))
     {
+#if 0
+      printf("::: %d\n", level->block_last_field);
+#endif
+
       /* even "not blocking" was blocking the last field for one frame */
       level->block_delay    = (level->block_last_field    ? 7 : 1);
       level->sp_block_delay = (level->sp_block_last_field ? 7 : 1);
@@ -2488,8 +2492,13 @@ void LoadLevelTemplate(int nr)
   LoadLevelFromFilename_RND(&level_template, filename);
 #endif
 
+#if 1
+  LoadLevel_InitVersion(&level_template, filename);
+  LoadLevel_InitElements(&level_template, filename);
+#else
   LoadLevel_InitVersion(&level, filename);
   LoadLevel_InitElements(&level, filename);
+#endif
 
   ActivateLevelTemplate();
 }
index 244aef5e67a4e43ad07b2976cbb470a1c5019080..9645f08e391bd6eeb903c2a46b712e4534ad3417 100644 (file)
 #define USE_NEW_AMOEBA_CODE    FALSE
 
 /* EXPERIMENTAL STUFF */
-#define USE_NEW_MOVE_STYLE     TRUE    *1
-#define USE_NEW_MOVE_DELAY     TRUE    *1
-#define USE_NEW_PUSH_DELAY     TRUE    *1
-#define USE_NEW_BLOCK_STYLE    TRUE    *1
+#define USE_NEW_STUFF          TRUE                            * 1
+
+#define USE_NEW_MOVE_STYLE     TRUE    * USE_NEW_STUFF         * 1
+#define USE_NEW_MOVE_DELAY     TRUE    * USE_NEW_STUFF         * 1
+#define USE_NEW_PUSH_DELAY     TRUE    * USE_NEW_STUFF         * 1
+#define USE_NEW_BLOCK_STYLE    TRUE    * USE_NEW_STUFF         * 1 * 1
+#define USE_NEW_SP_SLIPPERY    TRUE    * USE_NEW_STUFF         * 1
+#define USE_NEW_RANDOMIZE      TRUE    * USE_NEW_STUFF         * 1
 
 /* for DigField() */
 #define DF_NO_PUSH             0
@@ -392,18 +396,6 @@ 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,
@@ -792,6 +784,11 @@ static void InitPlayerField(int x, int y, int element, boolean init_game)
                           (player->block_last_field ? 7 : 1) :
                           (player->block_last_field ? 7 : 1));
 #endif
+
+#if 0
+    printf("::: block_last_field == %d, block_delay = %d\n",
+          player->block_last_field, player->block_delay);
+#endif
 #endif
 
     if (!options.network || player->connected)
@@ -1183,7 +1180,7 @@ static void resolve_group_element(int group_element, int recursion_depth)
 
 /*
   =============================================================================
- InitGameEngine()
 InitGameEngine()
   -----------------------------------------------------------------------------
   initialize game engine due to level / tape version number
   =============================================================================
@@ -1812,6 +1809,11 @@ void InitGame()
          player->element_nr = some_player->element_nr;
 #endif
 
+#if USE_NEW_BLOCK_STYLE
+         player->block_last_field = some_player->block_last_field;
+         player->block_delay = some_player->block_delay;
+#endif
+
          StorePlayer[jx][jy] = player->element_nr;
          player->jx = player->last_jx = jx;
          player->jy = player->last_jy = jy;
@@ -4633,8 +4635,15 @@ inline static void TurnRoundExt(int x, int y)
     xx = x + move_xy[MovDir[x][y]].x;
     yy = y + move_xy[MovDir[x][y]].y;
 
+#if 1
+    /* !!! this bugfix breaks at least BD2K3, level 010 !!! */
+    if (!IN_LEV_FIELD(xx, yy) ||
+        (!IS_FREE(xx, yy) && !IS_FOOD_PIG(Feld[xx][yy])))
+      MovDir[x][y] = old_move_dir;
+#else
     if (!IS_FREE(xx, yy) && !IS_FOOD_PIG(Feld[xx][yy]))
       MovDir[x][y] = old_move_dir;
+#endif
 
     MovDelay[x][y] = 0;
   }
@@ -5428,13 +5437,39 @@ void StartMoving(int x, int y)
        can_fall_both = (can_fall_left && can_fall_right);
       }
 
+#if USE_NEW_SP_SLIPPERY
+      /* !!! better use the same properties as for custom elements here !!! */
+      else if (game.engine_version >= VERSION_IDENT(3,1,1,0) &&
+              can_fall_both && IS_SP_ELEMENT(Feld[x][y + 1]))
+      {
+       can_fall_right = FALSE;         /* slip down on left side */
+       can_fall_both = FALSE;
+      }
+#endif
+
+#if 1
+      if (can_fall_both)
+      {
+       if (game.emulation == EMU_BOULDERDASH ||
+           element == EL_BD_ROCK || element == EL_BD_DIAMOND)
+         can_fall_right = FALSE;       /* slip down on left side */
+       else
+         can_fall_left = !(can_fall_right = RND(2));
+
+       can_fall_both = FALSE;
+      }
+#endif
+
       if (can_fall_any)
       {
+#if 0
        if (can_fall_both &&
            (game.emulation != EMU_BOULDERDASH &&
             element != EL_BD_ROCK && element != EL_BD_DIAMOND))
          can_fall_left = !(can_fall_right = RND(2));
+#endif
 
+       /* if not determined otherwise, prefer left side for slipping down */
        InitMovingField(x, y, can_fall_left ? MV_LEFT : MV_RIGHT);
        started_moving = TRUE;
       }
@@ -9159,7 +9194,7 @@ void GameActions()
   }
 #endif
 
-#if 1
+#if USE_NEW_RANDOMIZE
   /* use random number generator in every frame to make it less predictable */
   if (game.engine_version >= VERSION_IDENT(3,1,1,0))
     RND(1);
@@ -9925,20 +9960,30 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     player->actual_frame_counter = FrameCounter;
     player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
+#if 0
+    printf("::: %06d: %d,%d: %d (%d) [%d]\n",
+          FrameCounter,
+          last_jx, last_jy, Feld[last_jx][last_jy], EL_EXPLOSION,
+          player->block_delay);
+#endif
+
 #if USE_NEW_BLOCK_STYLE
+
+#if 0
+    if (player->block_delay <= 0)
+      printf("::: ALERT! block_delay == %d\n", player->block_delay);
+#endif
+
     if (player->block_delay > 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 + 1;
-#else
-      ChangeDelay[last_jx][last_jy] = player->block_last_field_delay;
-#endif
     }
 #else
 #if USE_NEW_MOVE_STYLE
-    if (player->block_last_field &&
+    if ((game.engine_version < VERSION_IDENT(3,1,1,0) ||
+        player->block_last_field) &&
        Feld[last_jx][last_jy] == EL_EMPTY)
       Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
 #else