+ for (xx=0; xx<lev_fieldx; xx++)
+ {
+ int element = Feld[xx][yy];
+
+ if (IS_BELT_SWITCH(element))
+ {
+ int e_belt_nr = getBeltNrFromSwitchElement(element);
+
+ if (e_belt_nr == belt_nr)
+ {
+ Feld[xx][yy] = belt_base_element[belt_nr] + belt_dir_nr;
+ DrawLevelField(xx, yy);
+ }
+ }
+ else if (belt_dir == MV_NO_MOVING && IS_BELT(element))
+ {
+ int e_belt_nr = getBeltNrFromElement(element);
+
+ if (e_belt_nr == belt_nr)
+ DrawLevelField(xx, yy); /* set belt to parking position */
+ }
+ }
+ }
+}
+
+static void ToggleSwitchgateSwitch(int x, int y)
+{
+ int xx, yy;
+
+ game.switchgate_pos = !game.switchgate_pos;
+
+ for (yy=0; yy<lev_fieldy; yy++)
+ {
+ for (xx=0; xx<lev_fieldx; xx++)
+ {
+ int element = Feld[xx][yy];
+
+ if (element == EL_SWITCHGATE_SWITCH_1 ||
+ element == EL_SWITCHGATE_SWITCH_2)
+ {
+ Feld[xx][yy] = EL_SWITCHGATE_SWITCH_1 + game.switchgate_pos;
+ DrawLevelField(xx, yy);
+ }
+ else if (element == EL_SWITCHGATE_OPEN ||
+ element == EL_SWITCHGATE_OPENING)
+ {
+ Feld[xx][yy] = EL_SWITCHGATE_CLOSING;
+ PlaySoundLevel(xx, yy, SND_SWITCHGATE_CLOSING);
+ }
+ else if (element == EL_SWITCHGATE_CLOSED ||
+ element == EL_SWITCHGATE_CLOSING)
+ {
+ Feld[xx][yy] = EL_SWITCHGATE_OPENING;
+ PlaySoundLevel(xx, yy, SND_SWITCHGATE_OPENING);
+ }
+ }
+ }
+}
+
+static void RedrawAllLightSwitchesAndInvisibleElements()
+{
+ int x, y;
+
+ for (y=0; y<lev_fieldy; y++)
+ {
+ for (x=0; x<lev_fieldx; x++)
+ {
+ int element = Feld[x][y];
+
+ if (element == EL_LIGHT_SWITCH_OFF &&
+ game.light_time_left > 0)
+ {
+ Feld[x][y] = EL_LIGHT_SWITCH_ON;
+ DrawLevelField(x, y);
+ }
+ else if (element == EL_LIGHT_SWITCH_ON &&
+ game.light_time_left == 0)
+ {
+ Feld[x][y] = EL_LIGHT_SWITCH_OFF;
+ DrawLevelField(x, y);
+ }
+
+ if (element == EL_INVISIBLE_STEEL ||
+ element == EL_UNSICHTBAR ||
+ element == EL_SAND_INVISIBLE)
+ DrawLevelField(x, y);
+ }
+ }
+}
+
+static void ToggleLightSwitch(int x, int y)
+{
+ int element = Feld[x][y];
+
+ game.light_time_left =
+ (element == EL_LIGHT_SWITCH_OFF ?
+ level.time_light * FRAMES_PER_SECOND : 0);
+
+ RedrawAllLightSwitchesAndInvisibleElements();
+}
+
+static void ActivateTimegateSwitch(int x, int y)
+{
+ int xx, yy;
+
+ game.timegate_time_left = level.time_timegate * FRAMES_PER_SECOND;
+
+ for (yy=0; yy<lev_fieldy; yy++)
+ {
+ for (xx=0; xx<lev_fieldx; xx++)
+ {
+ int element = Feld[xx][yy];
+
+ if (element == EL_TIMEGATE_CLOSED ||
+ element == EL_TIMEGATE_CLOSING)
+ {
+ Feld[xx][yy] = EL_TIMEGATE_OPENING;
+ PlaySoundLevel(xx, yy, SND_TIMEGATE_OPENING);
+ }
+
+ /*
+ else if (element == EL_TIMEGATE_SWITCH_ON)
+ {
+ Feld[xx][yy] = EL_TIMEGATE_SWITCH_OFF;
+ DrawLevelField(xx, yy);
+ }
+ */
+
+ }
+ }
+
+ Feld[x][y] = EL_TIMEGATE_SWITCH_ON;
+}
+
+void Impact(int x, int y)
+{
+ boolean lastline = (y == lev_fieldy-1);
+ boolean object_hit = FALSE;
+ int element = Feld[x][y];
+ int smashed = 0;
+
+ if (!lastline) /* check if element below was hit */
+ {
+ if (Feld[x][y+1] == EL_PLAYER_IS_LEAVING)
+ return;
+
+ object_hit = (!IS_FREE(x, y+1) && (!IS_MOVING(x, y+1) ||
+ MovDir[x][y+1]!=MV_DOWN ||
+ MovPos[x][y+1]<=TILEY/2));
+ if (object_hit)
+ smashed = MovingOrBlocked2Element(x, y+1);
+ }
+
+ if (!lastline && smashed == EL_SALZSAEURE) /* element falls into acid */
+ {
+ Blurb(x, y);
+ return;
+ }
+
+ if ((element == EL_BOMBE ||
+ element == EL_SP_DISK_ORANGE ||
+ element == EL_DX_SUPABOMB) &&
+ (lastline || object_hit)) /* element is bomb */
+ {
+ Bang(x, y);
+ return;
+ }
+ else if (element == EL_PEARL)
+ {
+ Feld[x][y] = EL_PEARL_BREAKING;
+ PlaySoundLevel(x, y, SND_PEARL_BREAKING);
+ return;
+ }
+
+ if (element == EL_TROPFEN && (lastline || object_hit)) /* acid drop */
+ {
+ if (object_hit && IS_PLAYER(x, y+1))
+ KillHeroUnlessProtected(x, y+1);
+ else if (object_hit && smashed == EL_PINGUIN)
+ Bang(x, y+1);
+ else