From: Holger Schemel Date: Sun, 2 Apr 2006 19:46:05 +0000 (+0200) Subject: rnd-20060402-2-src X-Git-Tag: 3.2.0^2~37 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=efbd589db2977f140135f247cd4aacfe6c546410;p=rocksndiamonds.git rnd-20060402-2-src * fixed bug when creating GE with walkable element under the player --- diff --git a/ChangeLog b/ChangeLog index a57b005d..33a18543 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2006-04-02 * fixed handling of over-large selectboxes (less error-prone now) + * fixed bug when creating GE with walkable element under the player 2006-04-01 * added use of "Insert" and "Delete" keys to navigate element list in diff --git a/src/conftime.h b/src/conftime.h index ad07cdb0..dfbc5f2c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-04-02 12:38]" +#define COMPILE_DATE_STRING "[2006-04-02 20:00]" diff --git a/src/game.c b/src/game.c index 9aab37fc..4f3b21ef 100644 --- a/src/game.c +++ b/src/game.c @@ -866,6 +866,32 @@ static int getBeltDirFromBeltSwitchElement(int element) return belt_move_dir[belt_dir_nr]; } +static int get_element_from_group_element(int element) +{ + if (IS_GROUP_ELEMENT(element)) + { + struct ElementGroupInfo *group = element_info[element].group; + int last_anim_random_frame = gfx.anim_random_frame; + int element_pos; + + if (group->choice_mode == ANIM_RANDOM) + gfx.anim_random_frame = RND(group->num_elements_resolved); + + element_pos = getAnimationFrame(group->num_elements_resolved, 1, + group->choice_mode, 0, + group->choice_pos); + + if (group->choice_mode == ANIM_RANDOM) + gfx.anim_random_frame = last_anim_random_frame; + + group->choice_pos++; + + element = group->element_resolved[element_pos]; + } + + return element; +} + static void InitPlayerField(int x, int y, int element, boolean init_game) { if (element == EL_SP_MURPHY) @@ -1128,6 +1154,11 @@ static void InitField(int x, int y, boolean init_game) #endif else if (IS_GROUP_ELEMENT(element)) { +#if 1 + Feld[x][y] = get_element_from_group_element(element); + + InitField(x, y, init_game); +#else struct ElementGroupInfo *group = element_info[element].group; int last_anim_random_frame = gfx.anim_random_frame; int element_pos; @@ -1147,6 +1178,7 @@ static void InitField(int x, int y, boolean init_game) Feld[x][y] = group->element_resolved[element_pos]; InitField(x, y, init_game); +#endif } break; } @@ -8250,22 +8282,26 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) static void CreateFieldExt(int x, int y, int element, boolean is_change) { + int old_element = Feld[x][y]; + int new_element = get_element_from_group_element(element); int previous_move_direction = MovDir[x][y]; #if USE_NEW_CUSTOM_VALUE int last_ce_value = CustomValue[x][y]; #endif - boolean add_player = (ELEM_IS_PLAYER(element) && - IS_WALKABLE(Feld[x][y])); + boolean add_player = (ELEM_IS_PLAYER(new_element) && + IS_WALKABLE(old_element)); +#if 0 /* check if element under player changes from accessible to unaccessible (needed for special case of dropping element which then changes) */ if (IS_PLAYER(x, y) && !PLAYER_EXPLOSION_PROTECTED(x, y) && - IS_ACCESSIBLE(Feld[x][y]) && !IS_ACCESSIBLE(element)) + IS_ACCESSIBLE(old_element) && !IS_ACCESSIBLE(new_element)) { Bang(x, y); return; } +#endif if (!add_player) { @@ -8274,30 +8310,44 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) else RemoveField(x, y); - Feld[x][y] = element; + Feld[x][y] = new_element; ResetGfxAnimation(x, y); ResetRandomAnimationValue(x, y); - if (element_info[Feld[x][y]].move_direction_initial == MV_START_PREVIOUS) + if (element_info[new_element].move_direction_initial == MV_START_PREVIOUS) MovDir[x][y] = previous_move_direction; #if USE_NEW_CUSTOM_VALUE - if (element_info[Feld[x][y]].use_last_ce_value) + if (element_info[new_element].use_last_ce_value) CustomValue[x][y] = last_ce_value; #endif InitField_WithBug1(x, y, FALSE); + new_element = Feld[x][y]; /* element may have changed */ + DrawLevelField(x, y); - if (GFX_CRUMBLED(Feld[x][y])) + if (GFX_CRUMBLED(new_element)) DrawLevelFieldCrumbledSandNeighbours(x, y); } +#if 1 + /* check if element under player changes from accessible to unaccessible + (needed for special case of dropping element which then changes) */ + if (IS_PLAYER(x, y) && !PLAYER_EXPLOSION_PROTECTED(x, y) && + IS_ACCESSIBLE(old_element) && !IS_ACCESSIBLE(new_element)) + { + Bang(x, y); + + return; + } +#endif + /* "ChangeCount" not set yet to allow "entered by player" change one time */ - if (ELEM_IS_PLAYER(element)) - RelocatePlayer(x, y, element); + if (ELEM_IS_PLAYER(new_element)) + RelocatePlayer(x, y, new_element); if (is_change) ChangeCount[x][y]++; /* count number of changes in the same frame */ diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index b4533014..5f092987 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -12,6 +12,8 @@ extern int centered_player_nr; #endif +#define USE_CHANGED_ACID_STUFF 1 + extern boolean checkIfAllPlayersFitToScreen(); static void check_player(struct PLAYER *); @@ -421,7 +423,7 @@ static void kill_player(struct PLAYER *ply) switch(Cave[y][x]) { -#if 1 +#if USE_CHANGED_ACID_STUFF case Xacid_1: case Xacid_2: case Xacid_3: @@ -684,7 +686,7 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) ply->y = y; break; -#if 1 +#if USE_CHANGED_ACID_STUFF case Xacid_1: case Xacid_2: case Xacid_3: @@ -693,12 +695,12 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xacid_6: case Xacid_7: case Xacid_8: -#endif if (Cave[y-1][x+1] == Xblank) Cave[y-1][x+1] = Yacid_splash_eB; if (Cave[y-1][x-1] == Xblank) Cave[y-1][x-1] = Yacid_splash_wB; play_element_sound(x, y, SAMPLE_acid, Xacid_1); +#endif case Xboom_android: case Xboom_1: @@ -718,7 +720,8 @@ static boolean player_digfield(struct PLAYER *ply, int dx, int dy) case Xtank_goe: case Xtank_gos: case Xtank_gow: -#if 0 + +#if !USE_CHANGED_ACID_STUFF case Xacid_1: case Xacid_2: case Xacid_3: