+ InitMovDir(x, y);
+ DrawLevelField(x, y);
+
+ if (IS_PLAYER(x, y) && !PLAYERINFO(x,y)->present)
+ StorePlayer[x][y] = 0;
+ }
+ else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ {
+ int graphic = GFX_EXPLOSION;
+
+ if (game.emulation == EMU_SUPAPLEX)
+ graphic = (Store[x][y] == EL_SP_INFOTRON ?
+ GFX_SP_EXPLODE_INFOTRON :
+ GFX_SP_EXPLODE_EMPTY);
+
+ if (phase == delay)
+ ErdreichAnbroeckeln(SCREENX(x), SCREENY(y));
+
+ graphic += (phase / delay - 1);
+
+ if (IS_PFORTE(Store[x][y]))
+ {
+ DrawLevelElement(x, y, Store[x][y]);
+ DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic);
+ }
+ else
+ DrawGraphic(SCREENX(x), SCREENY(y), graphic);
+ }
+}
+
+void DynaExplode(int ex, int ey)
+{
+ int i, j;
+ int dynabomb_size = 1;
+ boolean dynabomb_xl = FALSE;
+ struct PlayerInfo *player;
+ static int xy[4][2] =
+ {
+ { 0, -1 },
+ { -1, 0 },
+ { +1, 0 },
+ { 0, +1 }
+ };
+
+ if (IS_ACTIVE_BOMB(Feld[ex][ey]))
+ {
+ player = &stored_player[Feld[ex][ey] - EL_DYNABOMB_PLAYER1_ACTIVE];
+ dynabomb_size = player->dynabomb_size;
+ dynabomb_xl = player->dynabomb_xl;
+ player->dynabombs_left++;
+ }
+
+ Explode(ex, ey, EX_PHASE_START, EX_CENTER);
+
+ for (i=0; i<4; i++)
+ {
+ for (j=1; j<=dynabomb_size; j++)
+ {
+ int x = ex + j * xy[i % 4][0];
+ int y = ey + j * xy[i % 4][1];
+ int element;
+
+ if (!IN_LEV_FIELD(x, y) || IS_MASSIVE(Feld[x][y]))
+ break;
+
+ element = Feld[x][y];
+
+ /* do not restart explosions of fields with active bombs */
+ if (element == EL_EXPLOSION && IS_ACTIVE_BOMB(Store2[x][y]))
+ continue;
+
+ Explode(x, y, EX_PHASE_START, EX_BORDER);
+
+ if (element != EL_EMPTY &&
+ element != EL_SAND &&
+ element != EL_EXPLOSION &&
+ !dynabomb_xl)
+ break;
+ }
+ }
+}
+
+void Bang(int x, int y)
+{
+ int element = Feld[x][y];
+
+ if (game.emulation == EMU_SUPAPLEX)
+ PlaySoundLevel(x, y, SND_SP_ELEMENT_EXPLODING);
+ else
+ PlaySoundLevel(x, y, SND_ELEMENT_EXPLODING);
+
+#if 0
+ if (IS_PLAYER(x, y)) /* remove objects that might cause smaller explosion */
+ element = EL_EMPTY;
+#endif
+
+ switch(element)
+ {
+ case EL_BUG:
+ case EL_SPACESHIP:
+ case EL_BD_BUTTERFLY:
+ case EL_BD_FIREFLY:
+ case EL_YAMYAM:
+ case EL_DARK_YAMYAM:
+ case EL_ROBOT:
+ case EL_PACMAN:
+ case EL_MOLE:
+ RaiseScoreElement(element);
+ Explode(x, y, EX_PHASE_START, EX_NORMAL);
+ break;
+ case EL_DYNABOMB_PLAYER1_ACTIVE:
+ case EL_DYNABOMB_PLAYER2_ACTIVE:
+ case EL_DYNABOMB_PLAYER3_ACTIVE:
+ case EL_DYNABOMB_PLAYER4_ACTIVE:
+ case EL_DYNABOMB_NR:
+ case EL_DYNABOMB_SZ:
+ case EL_DYNABOMB_XL:
+ DynaExplode(x, y);
+ break;
+ case EL_PENGUIN:
+ case EL_LAMP:
+ case EL_LAMP_ACTIVE:
+ if (IS_PLAYER(x, y))
+ Explode(x, y, EX_PHASE_START, EX_NORMAL);
+ else
+ Explode(x, y, EX_PHASE_START, EX_CENTER);
+ break;
+ default:
+ Explode(x, y, EX_PHASE_START, EX_NORMAL);
+ break;
+ }
+}
+
+void Blurb(int x, int y)
+{
+ int element = Feld[x][y];
+
+ if (element != EL_ACID_SPLASHING_LEFT &&
+ element != EL_ACID_SPLASHING_RIGHT) /* start */
+ {
+ PlaySoundLevel(x, y, SND_ACID_SPLASHING);
+ if (IN_LEV_FIELD(x-1, y) && IS_FREE(x-1, y) &&
+ (!IN_LEV_FIELD(x-1, y-1) ||
+ !CAN_FALL(MovingOrBlocked2Element(x-1, y-1))))
+ {
+ Feld[x-1][y] = EL_ACID_SPLASHING_LEFT;
+ }
+ if (IN_LEV_FIELD(x+1, y) && IS_FREE(x+1, y) &&
+ (!IN_LEV_FIELD(x+1, y-1) ||
+ !CAN_FALL(MovingOrBlocked2Element(x+1, y-1))))
+ {
+ Feld[x+1][y] = EL_ACID_SPLASHING_RIGHT;
+ }
+ }
+ else /* go on */
+ {
+ int graphic =
+ (element == EL_ACID_SPLASHING_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT);
+
+ if (!MovDelay[x][y]) /* initialize animation counter */
+ MovDelay[x][y] = 9;
+
+ if (MovDelay[x][y]) /* continue animation */
+ {
+ MovDelay[x][y]--;
+ if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+ DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2);
+
+ if (!MovDelay[x][y])
+ {
+ Feld[x][y] = EL_EMPTY;
+ DrawLevelField(x, y);
+ }
+ }
+ }
+}
+
+static void ToggleBeltSwitch(int x, int y)
+{
+ static int belt_base_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT,
+ EL_CONVEYOR_BELT2_LEFT,
+ EL_CONVEYOR_BELT3_LEFT,
+ EL_CONVEYOR_BELT4_LEFT
+ };
+ static int belt_base_active_element[4] =
+ {
+ EL_CONVEYOR_BELT1_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT2_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT3_LEFT_ACTIVE,
+ EL_CONVEYOR_BELT4_LEFT_ACTIVE
+ };
+ static int belt_base_switch_element[4] =
+ {
+ EL_CONVEYOR_BELT1_SWITCH_LEFT,
+ EL_CONVEYOR_BELT2_SWITCH_LEFT,
+ EL_CONVEYOR_BELT3_SWITCH_LEFT,
+ EL_CONVEYOR_BELT4_SWITCH_LEFT
+ };
+ static int belt_move_dir[4] =
+ {
+ MV_LEFT,
+ MV_NO_MOVING,
+ MV_RIGHT,
+ MV_NO_MOVING,
+ };
+
+ int element = Feld[x][y];
+ int belt_nr = getBeltNrFromBeltSwitchElement(element);
+ int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4;
+ int belt_dir = belt_move_dir[belt_dir_nr];
+ int xx, yy;
+
+ if (!IS_BELT_SWITCH(element))
+ return;
+
+ game.belt_dir_nr[belt_nr] = belt_dir_nr;
+ game.belt_dir[belt_nr] = belt_dir;
+
+ if (belt_dir_nr == 3)
+ belt_dir_nr = 1;
+
+ for (yy=0; yy<lev_fieldy; yy++)
+ {
+ for (xx=0; xx<lev_fieldx; xx++)
+ {
+ int element = Feld[xx][yy];
+
+ if (IS_BELT_SWITCH(element))
+ {
+ int e_belt_nr = getBeltNrFromBeltSwitchElement(element);
+
+ if (e_belt_nr == belt_nr)
+ {
+ Feld[xx][yy] = belt_base_switch_element[belt_nr] + belt_dir_nr;
+ DrawLevelField(xx, yy);
+ }
+ }
+ else if (IS_BELT(element) && belt_dir != MV_NO_MOVING)
+ {
+ int e_belt_nr = getBeltNrFromBeltElement(element);
+
+ if (e_belt_nr == belt_nr)
+ {
+ int belt_part = Feld[xx][yy] - belt_base_element[belt_nr];
+
+ Feld[xx][yy] = belt_base_active_element[belt_nr] + belt_part;
+ DrawLevelField(xx, yy);
+ }
+ }
+ else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING)
+ {
+ int e_belt_nr = getBeltNrFromBeltActiveElement(element);
+
+ if (e_belt_nr == belt_nr)
+ {
+ int belt_part = Feld[xx][yy] - belt_base_active_element[belt_nr];
+
+ Feld[xx][yy] = belt_base_element[belt_nr] + belt_part;
+ DrawLevelField(xx, yy);
+ }
+ }
+ }