X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=f5b3ab7b883d783c088bd11a20379611c4fc3a75;hb=ddaae9de458b7f07b05461101655a1da4c63b380;hp=5b22dcbd4f7d511af5972303033fe20a6f5bae44;hpb=268045d6b06349f1cf10d5cc6f9516b5caa20dea;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 5b22dcbd..f5b3ab7b 100644 --- a/src/game.c +++ b/src/game.c @@ -1032,6 +1032,7 @@ void InitGame() game.switchgate_pos = 0; game.balloon_dir = MV_NO_MOVING; game.explosions_delayed = TRUE; + game.current_gravity = level.initial_gravity; for (i=0; i<4; i++) { @@ -1893,7 +1894,7 @@ void Explode(int ex, int ey, int phase, int mode) PlaySoundLevelAction(ex, ey, ACTION_EXPLODING); /* remove things displayed in background while burning dynamite */ - if (!IS_INDESTRUCTIBLE(Back[ex][ey])) + if (Back[ex][ey] != EL_EMPTY && !IS_INDESTRUCTIBLE(Back[ex][ey])) Back[ex][ey] = 0; if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey)) @@ -1927,7 +1928,7 @@ void Explode(int ex, int ey, int phase, int mode) #if 1 -#if 1 +#if 0 if (IS_EXPLOSION_PROOF(element)) continue; #else @@ -1958,11 +1959,11 @@ void Explode(int ex, int ey, int phase, int mode) } /* save walkable background elements while explosion on same tile */ -#if 1 +#if 0 if (IS_INDESTRUCTIBLE(element)) Back[x][y] = element; #else - if (IS_INDESTRUCTIBLE(element) && IS_WALKABLE(element)) + if (IS_WALKABLE(element) && IS_INDESTRUCTIBLE(element)) Back[x][y] = element; #endif @@ -2136,6 +2137,9 @@ void Explode(int ex, int ey, int phase, int mode) InitMovDir(x, y); DrawLevelField(x, y); + if (CAN_BE_CRUMBLED(element)) + DrawLevelFieldCrumbledSandNeighbours(x, y); + if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present) StorePlayer[x][y] = 0; } @@ -2212,6 +2216,7 @@ void DynaExplode(int ex, int ey) Explode(x, y, EX_PHASE_START, EX_BORDER); + /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ if (element != EL_EMPTY && element != EL_SAND && element != EL_EXPLOSION && @@ -2522,14 +2527,16 @@ static int getInvisibleActiveFromInvisibleElement(int element) { return (element == EL_INVISIBLE_STEELWALL ? EL_INVISIBLE_STEELWALL_ACTIVE : element == EL_INVISIBLE_WALL ? EL_INVISIBLE_WALL_ACTIVE : - EL_INVISIBLE_SAND_ACTIVE); + element == EL_INVISIBLE_SAND ? EL_INVISIBLE_SAND_ACTIVE : + element); } static int getInvisibleFromInvisibleActiveElement(int element) { return (element == EL_INVISIBLE_STEELWALL_ACTIVE ? EL_INVISIBLE_STEELWALL : element == EL_INVISIBLE_WALL_ACTIVE ? EL_INVISIBLE_WALL : - EL_INVISIBLE_SAND); + element == EL_INVISIBLE_SAND_ACTIVE ? EL_INVISIBLE_SAND : + element); } static void RedrawAllLightSwitchesAndInvisibleElements() @@ -2695,7 +2702,7 @@ void Impact(int x, int y) return; } #if 1 - else if (impact && CheckElementChange(x, y, element, ACTION_IMPACT)) + else if (impact && CheckElementChange(x, y, element, CE_IMPACT)) { PlaySoundLevelElementAction(x, y, element, ACTION_IMPACT); @@ -3840,7 +3847,10 @@ void StartMoving(int x, int y) return; } - GfxAction[x][y] = ACTION_MOVING; + /* special case of "moving" animation of waiting elements (FIX THIS !!!); + for all other elements GfxAction will be set by InitMovingField() */ + if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY) + GfxAction[x][y] = ACTION_MOVING; } /* now make next step */ @@ -4053,7 +4063,8 @@ void StartMoving(int x, int y) TurnRound(x, y); #if 1 - DrawLevelElementAnimation(x, y, element); + if (GFX_ELEMENT(element) != EL_SAND) /* !!! FIX THIS (crumble) !!! */ + DrawLevelElementAnimation(x, y, element); #else if (element == EL_BUG || element == EL_SPACESHIP || @@ -4547,6 +4558,7 @@ void AmoebeAbleger(int ax, int ay) if (!IN_LEV_FIELD(x, y)) return; + /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ if (IS_FREE(x, y) || Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY) { @@ -4571,6 +4583,7 @@ void AmoebeAbleger(int ax, int ay) if (!IN_LEV_FIELD(x, y)) continue; + /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ if (IS_FREE(x, y) || Feld[x][y] == EL_SAND || Feld[x][y] == EL_QUICKSAND_EMPTY) { @@ -4715,6 +4728,7 @@ void Life(int ax, int ay) changed = TRUE; } } + /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ else if (IS_FREE(xx, yy) || Feld[xx][yy] == EL_SAND) { /* free border field */ if (nachbarn >= life[2] && nachbarn <= life[3]) @@ -5226,6 +5240,8 @@ static void ChangeElementNow(int x, int y, int element) if (!change->only_complete || complete_change) { + boolean something_has_changed = FALSE; + if (change->only_complete && change->use_random_change && RND(100) < change->random) return; @@ -5243,17 +5259,24 @@ static void ChangeElementNow(int x, int y, int element) ChangeElementNowExt(ex, ey, change->content[xx][yy]); + something_has_changed = TRUE; + /* for symmetry reasons, stop newly created border elements */ if (ex != x || ey != y) Stop[ex][ey] = TRUE; } } - return; + if (something_has_changed) + PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING); } } + else + { + ChangeElementNowExt(x, y, change->target_element); - ChangeElementNowExt(x, y, change->target_element); + PlaySoundLevelElementAction(x, y, element, ACTION_CHANGING); + } } static void ChangeElement(int x, int y) @@ -5795,6 +5818,7 @@ void GameActions() #endif element = Feld[x][y]; + /* !!! extend EL_SAND to anything diggable (but maybe not SP_BASE) !!! */ if (!IS_PLAYER(x,y) && (element == EL_EMPTY || element == EL_SAND || @@ -6064,7 +6088,7 @@ void ScrollLevel(int dx, int dy) static void CheckGravityMovement(struct PlayerInfo *player) { - if (level.gravity && !player->programmed_action) + if (game.current_gravity && !player->programmed_action) { int move_dir_vertical = player->action & (MV_UP | MV_DOWN); int move_dir_horizontal = player->action & (MV_LEFT | MV_RIGHT); @@ -6082,6 +6106,7 @@ static void CheckGravityMovement(struct PlayerInfo *player) (IN_LEV_FIELD(new_jx, new_jy) && (Feld[new_jx][new_jy] == EL_SP_BASE || Feld[new_jx][new_jy] == EL_SAND)); + /* !!! extend EL_SAND to anything diggable !!! */ if (field_under_player_is_free && !player_is_moving_to_valid_field && @@ -7057,6 +7082,12 @@ int DigField(struct PlayerInfo *player, !IS_FREE(nextx, nexty)) return MF_NO_ACTION; + if (element == EL_SP_GRAVITY_PORT_LEFT || + element == EL_SP_GRAVITY_PORT_RIGHT || + element == EL_SP_GRAVITY_PORT_UP || + element == EL_SP_GRAVITY_PORT_DOWN) + game.current_gravity = !game.current_gravity; + /* automatically move to the next field with double speed */ player->programmed_action = move_direction; DOUBLE_PLAYER_SPEED(player); @@ -7187,8 +7218,12 @@ int DigField(struct PlayerInfo *player, if (mode != DF_SNAP) { +#if 1 + GfxElement[x][y] = GFX_ELEMENT(element); +#else GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : GFX_ELEMENT(element)); +#endif player->is_digging = TRUE; }