From 5eadacd4799f667e58a7f5876cf5499e420e6d61 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 28 Oct 2006 23:44:36 +0200 Subject: [PATCH] rnd-20061028-3-src < * fixed bug which caused elements with "change when digging " event --- ChangeLog | 6 +++++- src/conftime.h | 2 +- src/game.c | 29 ++++++++++++++++++++++++++--- src/init.c | 12 +++++++++++- src/main.c | 1 + src/main.h | 1 + 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee351ca0..8184cc3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ 2006-10-28 * fixed bug when displaying titlescreen with size less than element tile - * fixed bug which caused elements with "change when digging " event + * fixed bug that caused elements with "change when digging " event to change for _every_ digged element, not only those specified in + * fixed bug that caused impact style collision when dropping element one + tile over the player that can both fall down and smash players + * fixed bug that caused impact style collision when element changed to + falling/smashing element over the player immediately after movement 2006-10-24 * fixed bug that allowed making engine snapshots from the level editor diff --git a/src/conftime.h b/src/conftime.h index 8deef746..4490d2ae 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-10-28 14:24]" +#define COMPILE_DATE_STRING "[2006-10-28 22:48]" diff --git a/src/game.c b/src/game.c index 5cf59431..f0875a7a 100644 --- a/src/game.c +++ b/src/game.c @@ -57,6 +57,7 @@ #define USE_GFX_RESET_PLAYER_ARTWORK (USE_NEW_STUFF * 1) #define USE_FIX_KILLED_BY_NON_WALKABLE (USE_NEW_STUFF * 1) +#define USE_FIX_IMPACT_COLLISION (USE_NEW_STUFF * 1) /* for DigField() */ @@ -120,8 +121,9 @@ /* values for delayed check of falling and moving elements and for collision */ #define CHECK_DELAY_MOVING 3 -#define CHECK_DELAY_FALLING 3 +#define CHECK_DELAY_FALLING CHECK_DELAY_MOVING #define CHECK_DELAY_COLLISION 2 +#define CHECK_DELAY_IMPACT CHECK_DELAY_COLLISION /* values for initial player move delay (initial delay counter value) */ #define INITIAL_MOVE_DELAY_OFF -1 @@ -2037,6 +2039,7 @@ void InitGame() WasJustMoving[x][y] = 0; WasJustFalling[x][y] = 0; CheckCollision[x][y] = 0; + CheckImpact[x][y] = 0; Stop[x][y] = FALSE; Pushed[x][y] = FALSE; @@ -5634,9 +5637,14 @@ void StartMoving(int x, int y) Store[x][y] = EL_ACID; } - else if ((game.engine_version >= VERSION_IDENT(3,1,0,0) && + else if ( +#if USE_FIX_IMPACT_COLLISION + (game.engine_version >= VERSION_IDENT(3,1,0,0) && + CheckImpact[x][y] && !IS_FREE(x, y + 1)) || +#else + (game.engine_version >= VERSION_IDENT(3,1,0,0) && CheckCollision[x][y] && !IS_FREE(x, y + 1)) || - +#endif (game.engine_version >= VERSION_IDENT(3,0,7,0) && CAN_FALL(element) && WasJustFalling[x][y] && (Feld[x][y + 1] == EL_BLOCKED || IS_PLAYER(x, y + 1))) || @@ -5656,6 +5664,7 @@ void StartMoving(int x, int y) simply not covered here... :-/ ) */ CheckCollision[x][y] = 0; + CheckImpact[x][y] = 0; Impact(x, y); } @@ -6600,6 +6609,11 @@ void ContinueMoving(int x, int y) if ((!CAN_FALL(element) || direction == MV_DOWN) && check_collision_again) CheckCollision[newx][newy] = CHECK_DELAY_COLLISION; + +#if USE_FIX_IMPACT_COLLISION + if (CAN_FALL(element) && direction == MV_DOWN && check_collision_again) + CheckImpact[newx][newy] = CHECK_DELAY_IMPACT; +#endif } if (DONT_TOUCH(element)) /* object may be nasty to player or others */ @@ -9429,6 +9443,8 @@ void GameActions_RND() WasJustFalling[x][y]--; if (CheckCollision[x][y] > 0) CheckCollision[x][y]--; + if (CheckImpact[x][y] > 0) + CheckImpact[x][y]--; GfxFrame[x][y]++; @@ -12065,7 +12081,13 @@ boolean DropElement(struct PlayerInfo *player) nexty = dropy + GET_DY_FROM_DIR(move_direction); ChangeCount[dropx][dropy] = 0; /* allow at least one more change */ + +#if USE_FIX_IMPACT_COLLISION + /* do not cause impact style collision by dropping elements that can fall */ + CheckCollision[dropx][dropy] = CHECK_DELAY_COLLISION; +#else CheckCollision[dropx][dropy] = CHECK_DELAY_COLLISION; +#endif } player->drop_delay = GET_NEW_DROP_DELAY(drop_element); @@ -12747,6 +12769,7 @@ void SaveEngineSnapshot() SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(WasJustMoving)); SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(WasJustFalling)); SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(CheckCollision)); + SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(CheckImpact)); SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(Stop)); SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(Pushed)); diff --git a/src/init.c b/src/init.c index 0ef4dc37..ee3a1552 100644 --- a/src/init.c +++ b/src/init.c @@ -974,10 +974,18 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].post_delay = -1; graphic_info[graphic].auto_delay = -1; +#if 1 + /* optional zoom factor for scaling up the image to a larger size */ + if (parameter[GFX_ARG_SCALE_UP_FACTOR] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].scale_up_factor = parameter[GFX_ARG_SCALE_UP_FACTOR]; + if (graphic_info[graphic].scale_up_factor < 1) + graphic_info[graphic].scale_up_factor = 1; /* no scaling */ +#endif + #if 1 if (graphic_info[graphic].use_image_size) { - /* set default bitmap size (with scaling, but without small images) */ + /* set new default bitmap size (with scaling, but without small images) */ graphic_info[graphic].width = get_scaled_graphic_width(graphic); graphic_info[graphic].height = get_scaled_graphic_height(graphic); } @@ -1001,11 +1009,13 @@ static void set_graphic_parameters(int graphic) if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE) graphic_info[graphic].height = parameter[GFX_ARG_HEIGHT]; +#if 0 /* optional zoom factor for scaling up the image to a larger size */ if (parameter[GFX_ARG_SCALE_UP_FACTOR] != ARG_UNDEFINED_VALUE) graphic_info[graphic].scale_up_factor = parameter[GFX_ARG_SCALE_UP_FACTOR]; if (graphic_info[graphic].scale_up_factor < 1) graphic_info[graphic].scale_up_factor = 1; /* no scaling */ +#endif if (src_bitmap) { diff --git a/src/main.c b/src/main.c index 32d7fa7d..148abb54 100644 --- a/src/main.c +++ b/src/main.c @@ -59,6 +59,7 @@ short ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +short CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short AmoebaCnt[MAX_NUM_AMOEBA]; short AmoebaCnt2[MAX_NUM_AMOEBA]; diff --git a/src/main.h b/src/main.h index 70ea792a..5e519678 100644 --- a/src/main.h +++ b/src/main.h @@ -2479,6 +2479,7 @@ extern short ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +extern short CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; extern short AmoebaCnt[MAX_NUM_AMOEBA]; extern short AmoebaCnt2[MAX_NUM_AMOEBA]; -- 2.34.1