#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
+
+#define USE_PUSH_BUGFIX TRUE * USE_NEW_STUFF * 1
/* for DigField() */
#define DF_NO_PUSH 0
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,
(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)
/*
=============================================================================
- InitGameEngine()
+ InitGameEngine()
-----------------------------------------------------------------------------
initialize game engine due to level / tape version number
=============================================================================
game.engine_version = (tape.playing ? tape.engine_version :
level.game_version);
+ /* ---------------------------------------------------------------------- */
+ /* set flags for bugs and changes according to active game engine version */
+ /* ---------------------------------------------------------------------- */
+
+ /*
+ Type of bug/change:
+ Before 3.1.0, custom elements that "change when pushing" changed directly
+ after the player started pushing them (until then handled in "DigField()").
+ Since 3.1.0, these custom elements are not changed until the "pushing"
+ move of the element is finished (now handled in "ContinueMoving()").
+
+ Affected levels/tapes:
+ The first condition is generally needed for all levels/tapes before version
+ 3.1.0, which might use the old behaviour before it was changed; known tapes
+ that are affected are some tapes from the level set "Walpurgis Gardens" by
+ Jamie Cullen.
+ The second condition is an exception from the above case and is needed for
+ the special case of tapes recorded with game (not engine!) version 3.1.0 or
+ above (including some development versions of 3.1.0), but before it was
+ known that this change would break tapes like the above and was fixed in
+ 3.1.1, so that the changed behaviour was active although the engine version
+ while recording maybe was before 3.1.0. There is at least one tape that is
+ affected by this exception, which is the tape for the one-level set "Bug
+ Machine" by Juergen Bonhagen.
+ */
+
+ game.use_bug_change_when_pushing =
+ (game.engine_version < VERSION_IDENT(3,1,0,0) &&
+ !(tape.playing &&
+ tape.game_version >= VERSION_IDENT(3,1,0,0) &&
+ tape.game_version < VERSION_IDENT(3,1,1,0)));
+
+ /* ---------------------------------------------------------------------- */
+
/* dynamically adjust element properties according to game engine version */
InitElementPropertiesEngine(game.engine_version);
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;
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 !!! [re-recorded] */
+ 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;
}
MovDir[x][y] = new_move_dir;
if (old_move_dir != new_move_dir)
+ {
+#if 1
+ MovDelay[x][y] = GET_NEW_MOVE_DELAY(element);
+#else
MovDelay[x][y] = 9;
+#endif
+ }
}
}
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;
}
#endif
#if 1
+
+#if USE_PUSH_BUGFIX
+#if 1
+ if (pushed_by_player && !game.use_bug_change_when_pushing)
+#else
+ if (pushed_by_player && game.engine_version >= VERSION_IDENT(3,1,0,0))
+#endif
+#else
if (pushed_by_player)
+#endif
+
{
#if 1
int dig_side = MV_DIR_OPPOSITE(direction);
#endif
#if 1
- /* for downwards compatibility, the following code emulates a fixed bug that
+ /* for backwards compatibility, the following code emulates a fixed bug that
occured when pushing elements (causing elements that just made their last
pushing step to already (if possible) make their first falling step in the
same game frame, which is bad); this code is also needed to use the famous
local_player->show_envelope = 0;
}
#endif
+
+#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);
+#endif
}
static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y)
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
else
player->push_delay_value = -1; /* get new value later */
+#if USE_PUSH_BUGFIX
+ /* now: check for element change _after_ element has been pushed! */
+#if 1
+ if (game.use_bug_change_when_pushing)
+#else
+ if (game.engine_version < VERSION_IDENT(3,1,0,0))
+#endif
+ {
+ CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
+ player->index_bit, dig_side);
+ CheckTriggeredElementChangeByPlayer(x,y,element,CE_OTHER_GETS_PUSHED,
+ player->index_bit, dig_side);
+ }
+
+#else
+
#if 1
/* check for element change _after_ element has been pushed! */
#else
#if 1
- /* !!! TEST ONLY !!! */
+ /* !!! TEST ONLY !!! */
CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
player->index_bit, dig_side);
CheckTriggeredElementChangeByPlayer(x, y, element,CE_OTHER_GETS_PUSHED,
CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
player->index_bit, dig_side);
#endif
+#endif
+
#endif
break;