+ case EL_SWITCHGATE_SWITCH_1:
+ case EL_SWITCHGATE_SWITCH_2:
+ {
+ int xx, yy;
+
+ if (player->Switching)
+ return MF_ACTION;
+
+ player->Switching = TRUE;
+
+ 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_OEFFNEN);
+ }
+ else if (element == EL_SWITCHGATE_CLOSED ||
+ element == EL_SWITCHGATE_CLOSING)
+ {
+ Feld[xx][yy] = EL_SWITCHGATE_OPENING;
+ PlaySoundLevel(xx, yy, SND_OEFFNEN);
+ }
+ }
+ }
+
+ return MF_ACTION;
+ }
+ break;
+
+ case EL_LIGHT_SWITCH_OFF:
+ case EL_LIGHT_SWITCH_ON:
+ {
+ int xx, yy;
+
+ if (player->Switching)
+ return MF_ACTION;
+
+ player->Switching = TRUE;
+
+ game.light_time_left =
+ (element == EL_LIGHT_SWITCH_OFF ? 10 * FRAMES_PER_SECOND : 0);
+
+ for (yy=0; yy<lev_fieldy; yy++)
+ {
+ for (xx=0; xx<lev_fieldx; xx++)
+ {
+ int element = Feld[xx][yy];
+
+ if (element == EL_LIGHT_SWITCH_OFF &&
+ game.light_time_left > 0)
+ {
+ Feld[xx][yy] = EL_LIGHT_SWITCH_ON;
+ DrawLevelField(xx, yy);
+ }
+ else if (element == EL_LIGHT_SWITCH_ON &&
+ game.light_time_left == 0)
+ {
+ Feld[xx][yy] = EL_LIGHT_SWITCH_OFF;
+ DrawLevelField(xx, yy);
+ }
+
+ if (element == EL_INVISIBLE_STEEL ||
+ element == EL_UNSICHTBAR ||
+ element == EL_SAND_INVISIBLE)
+ DrawLevelField(xx, yy);
+ }
+ }
+
+ return MF_ACTION;
+ }
+ break;
+