From 90a176e848f9a21c6352c8b9aba303441fcfc27a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 12 Jun 2004 23:00:45 +0200 Subject: [PATCH] rnd-20040612-3-src * internal change of how the player blocks the last field when moving --- ChangeLog | 1 + src/conftime.h | 2 +- src/files.c | 26 ++++++++++++++++++++++---- src/game.c | 44 +++++++++++++++++++++++++++----------------- src/main.h | 8 +++++--- 5 files changed, 56 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 732e0ff2..4cd0933a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 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 2004-06-11 * fixed bug with wrong door state after trying to quickload empty tape diff --git a/src/conftime.h b/src/conftime.h index 73a88170..95f18fba 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-06-12 17:19]" +#define COMPILE_DATE_STRING "[2004-06-12 22:29]" diff --git a/src/files.c b/src/files.c index 3d4670f0..3989a22a 100644 --- a/src/files.c +++ b/src/files.c @@ -159,14 +159,17 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->double_speed = FALSE; level->initial_gravity = FALSE; level->em_slippery_gems = FALSE; - level->block_last_field = FALSE; - level->sp_block_last_field = TRUE; level->instant_relocation = FALSE; level->can_pass_to_walkable = FALSE; level->grow_into_diggable = TRUE; + level->block_last_field = FALSE; /* EM does not block by default */ + level->sp_block_last_field = TRUE; /* SP blocks the last field */ + level->block_delay = 8; /* when blocking, block 8 frames */ + level->sp_block_delay = 9; /* SP indeed blocks 9 frames, not 8 */ + level->can_move_into_acid_bits = ~0; /* everything can move into acid */ - level->dont_collide_with_bits = ~0; /* always deadly when colliding */ + level->dont_collide_with_bits = ~0; /* always deadly when colliding */ level->use_spring_bug = FALSE; level->use_step_counter = FALSE; @@ -2197,9 +2200,11 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) if (level->game_version == VERSION_IDENT(2,0,1,0)) level->em_slippery_gems = TRUE; + /* springs could be pushed over pits before (pre-release version) 2.2.0 */ if (level->game_version < VERSION_IDENT(2,2,0,0)) level->use_spring_bug = TRUE; + /* only few elements were able to actively move into acid before 3.1.0 */ if (level->game_version < VERSION_IDENT(3,1,0,0)) { int i, j; @@ -2229,8 +2234,21 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) } } } + +#if 1 + /* blocking the last field when moving was corrected in version 3.1.1 */ + if (level->game_version < VERSION_IDENT(3,1,1,0)) + { + /* 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); + + level->block_last_field = TRUE; + level->sp_block_last_field = TRUE; + } +#endif } - else + else /* always use the latest game engine version */ { #if 0 printf("\n::: ALWAYS USE LATEST ENGINE FOR THIS LEVEL: [%d] '%s'\n", diff --git a/src/game.c b/src/game.c index a8389022..19678381 100644 --- a/src/game.c +++ b/src/game.c @@ -28,7 +28,7 @@ #define USE_NEW_AMOEBA_CODE FALSE /* EXPERIMENTAL STUFF */ -#define USE_NEW_MOVE_STYLE TRUE *0 +#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 @@ -774,10 +774,6 @@ 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; @@ -785,10 +781,18 @@ 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 USE_NEW_BLOCK_STYLE +#if 1 + player->block_delay = (player->block_last_field ? + (element == EL_SP_MURPHY ? + level.sp_block_delay : + level.block_delay) : 0); +#else + player->block_delay = (element == EL_SP_MURPHY ? + (player->block_last_field ? 7 : 1) : + (player->block_last_field ? 7 : 1)); +#endif +#endif if (!options.network || player->connected) { @@ -1408,8 +1412,11 @@ 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 */ + /* set SP push delay to just enough to push under a falling zonk */ + int delay = (game.engine_version >= VERSION_IDENT(3,1,1,0) ? 8 : 6); + + element_info[i].push_delay_fixed = delay; + element_info[i].push_delay_random = 0; #else element_info[i].push_delay_fixed = 6; /* just enough to escape ... */ element_info[i].push_delay_random = 0; /* ... from falling zonk */ @@ -1539,8 +1546,7 @@ void InitGame() player->use_murphy_graphic = FALSE; player->block_last_field = FALSE; /* initialized in InitPlayerField() */ - player->block_delay = 0; - player->block_delay_value = -1; /* initialized in InitPlayerField() */ + player->block_delay = -1; /* initialized in InitPlayerField() */ player->can_fall_into_acid = CAN_MOVE_INTO_ACID(player->element_nr); @@ -6441,7 +6447,8 @@ void ContinueMoving(int x, int y) /* give the player one last chance (one more frame) to move away */ if (CAN_FALL(element) && direction == MV_DOWN && (newy == lev_fieldy - 1 || !IS_FREE(x, newy + 1)) && - !IS_PLAYER(x, newy + 1)) + (!IS_PLAYER(x, newy + 1) || + game.engine_version < VERSION_IDENT(3,1,1,0))) Impact(x, newy); #else if (CAN_FALL(element) && direction == MV_DOWN && @@ -8657,6 +8664,7 @@ void GameActions() Changed[x][y] = CE_BITMASK_DEFAULT; ChangeEvent[x][y] = CE_BITMASK_DEFAULT; +#if USE_NEW_BLOCK_STYLE /* this must be handled before main playfield loop */ if (Feld[x][y] == EL_PLAYER_IS_LEAVING) { @@ -8664,6 +8672,7 @@ void GameActions() if (MovDelay[x][y] <= 0) RemoveField(x, y); } +#endif #if DEBUG if (ChangePage[x][y] != -1 && ChangeDelay[x][y] != 1) @@ -9874,7 +9883,8 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) /* (currently, the player is forced to wait eight frames before he can try again!!!) */ - player->move_delay = 0; /* allow direct movement in the next frame */ + if (game.engine_version >= VERSION_IDENT(3,1,1,0)) + player->move_delay = 0; /* allow direct movement in the next frame */ #endif } @@ -9910,12 +9920,12 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) player->GfxPos = move_stepsize * (player->MovPos / move_stepsize); #if USE_NEW_BLOCK_STYLE - if (player->block_delay_value > 0 && + 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_value + 1; + MovDelay[last_jx][last_jy] = player->block_delay + 1; #else ChangeDelay[last_jx][last_jy] = player->block_last_field_delay; #endif diff --git a/src/main.h b/src/main.h index 009736ff..506fecb5 100644 --- a/src/main.h +++ b/src/main.h @@ -1382,7 +1382,6 @@ struct PlayerInfo boolean block_last_field; int block_delay; - int block_delay_value; boolean can_fall_into_acid; @@ -1512,13 +1511,16 @@ struct LevelInfo boolean double_speed; boolean initial_gravity; boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */ - boolean block_last_field; /* player blocks previous field while moving */ - boolean sp_block_last_field; /* player blocks previous field while moving */ boolean use_spring_bug; /* for compatibility with old levels */ boolean instant_relocation; /* no visual delay when relocating player */ boolean can_pass_to_walkable; /* player can pass to empty or walkable tile */ boolean grow_into_diggable; /* amoeba can grow into anything diggable */ + boolean block_last_field; /* player blocks previous field while moving */ + boolean sp_block_last_field; /* player blocks previous field while moving */ + int block_delay; /* delay for blocking previous field */ + int sp_block_delay; /* delay for blocking previous field */ + /* ('int' instead of 'boolean' because used as selectbox value in editor) */ int use_step_counter; /* count steps instead of seconds for level */ -- 2.34.1