+ int sound_action = ACTION_WALKING;
+
+ if (element >= EL_GATE_1 && element <= EL_GATE_4)
+ {
+ if (!player->key[element - EL_GATE_1])
+ return MF_NO_ACTION;
+ }
+ else if (element >= EL_GATE_1_GRAY && element <= EL_GATE_4_GRAY)
+ {
+ if (!player->key[element - EL_GATE_1_GRAY])
+ return MF_NO_ACTION;
+ }
+ else if (element == EL_EXIT_OPEN || element == EL_SP_EXIT_OPEN)
+ {
+ sound_action = ACTION_PASSING; /* player is passing exit */
+ }
+ else if (element == EL_EMPTY)
+ {
+ sound_action = ACTION_MOVING; /* nothing to walk on */
+ }
+
+ /* play sound from background or player, whatever is available */
+ if (element_info[element].sound[sound_action] != SND_UNDEFINED)
+ PlaySoundLevelElementAction(x, y, element, sound_action);
+ else
+ PlaySoundLevelElementAction(x, y, player->element_nr, sound_action);
+
+ break;
+ }
+ else if (IS_PASSABLE(element))
+ {
+ if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
+ return MF_NO_ACTION;
+
+ if (element >= EL_EM_GATE_1 && element <= EL_EM_GATE_4)
+ {
+ if (!player->key[element - EL_EM_GATE_1])
+ return MF_NO_ACTION;
+ }
+ else if (element >= EL_EM_GATE_1_GRAY && element <= EL_EM_GATE_4_GRAY)
+ {
+ if (!player->key[element - EL_EM_GATE_1_GRAY])
+ return MF_NO_ACTION;
+ }
+
+ /* automatically move to the next field with double speed */
+ player->programmed_action = move_direction;
+ DOUBLE_PLAYER_SPEED(player);
+
+ PlaySoundLevelAction(x, y, ACTION_PASSING);
+