- case EL_EMPTY:
- case EL_SAND:
- case EL_INVISIBLE_SAND:
- case EL_INVISIBLE_SAND_ACTIVE:
- case EL_TRAP:
- case EL_SP_BASE:
- case EL_SP_BUGGY_BASE:
- case EL_SP_BUGGY_BASE_ACTIVATING:
- RemoveField(x, y);
-#if 1
- if (mode != DF_SNAP && element != EL_EMPTY)
- {
- GfxElement[x][y] = (CAN_BE_CRUMBLED(element) ? EL_SAND : element);
- player->is_digging = TRUE;
- }
-#endif
- PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING);
- break;
-
- case EL_EMERALD:
- case EL_BD_DIAMOND:
- case EL_EMERALD_YELLOW:
- case EL_EMERALD_RED:
- case EL_EMERALD_PURPLE:
- case EL_DIAMOND:
- case EL_SP_INFOTRON:
- case EL_PEARL:
- case EL_CRYSTAL:
- RemoveField(x, y);
-#if 1
- if (mode != DF_SNAP)
- {
- GfxElement[x][y] = element;
- player->is_collecting = TRUE;
- }
-#endif
- local_player->gems_still_needed -= (element == EL_DIAMOND ? 3 :
- element == EL_PEARL ? 5 :
- element == EL_CRYSTAL ? 8 : 1);
- if (local_player->gems_still_needed < 0)
- local_player->gems_still_needed = 0;
- RaiseScoreElement(element);
- DrawText(DX_EMERALDS, DY_EMERALDS,
- int2str(local_player->gems_still_needed, 3), FONT_TEXT_2);
- PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING);
- break;
-
- case EL_SPEED_PILL:
- RemoveField(x, y);
- player->move_delay_value = MOVE_DELAY_HIGH_SPEED;
- PlaySoundLevel(x, y, SND_SPEED_PILL_COLLECTING);
- break;
-
- case EL_ENVELOPE:
- Feld[x][y] = EL_EMPTY;
- PlaySoundLevel(x, y, SND_ENVELOPE_COLLECTING);
- break;
-
- case EL_EXTRA_TIME:
- RemoveField(x, y);
- if (level.time > 0)
- {
- TimeLeft += 10;
- DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FONT_TEXT_2);
- }
- PlaySoundStereo(SND_EXTRA_TIME_COLLECTING, SOUND_MIDDLE);
- break;
-
- case EL_SHIELD_NORMAL:
- RemoveField(x, y);
- player->shield_normal_time_left += 10;
- PlaySoundLevel(x, y, SND_SHIELD_NORMAL_COLLECTING);
- break;
-
- case EL_SHIELD_DEADLY:
- RemoveField(x, y);
- player->shield_normal_time_left += 10;
- player->shield_deadly_time_left += 10;
- PlaySoundLevel(x, y, SND_SHIELD_DEADLY_COLLECTING);
- break;
-
- case EL_DYNAMITE:
- case EL_SP_DISK_RED:
- RemoveField(x, y);
- player->dynamite++;
- player->use_disk_red_graphic = (element == EL_SP_DISK_RED);
- RaiseScoreElement(EL_DYNAMITE);
- DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3),
- FONT_TEXT_2);
- PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING);
- break;
-
- case EL_DYNABOMB_INCREASE_NUMBER:
- RemoveField(x, y);
- player->dynabomb_count++;
- player->dynabombs_left++;
- RaiseScoreElement(EL_DYNAMITE);
- PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_NUMBER_COLLECTING);
- break;
-
- case EL_DYNABOMB_INCREASE_SIZE:
- RemoveField(x, y);
- player->dynabomb_size++;
- RaiseScoreElement(EL_DYNAMITE);
- PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_SIZE_COLLECTING);
- break;
-
- case EL_DYNABOMB_INCREASE_POWER:
- RemoveField(x, y);
- player->dynabomb_xl = TRUE;
- RaiseScoreElement(EL_DYNAMITE);
- PlaySoundLevel(x, y, SND_DYNABOMB_INCREASE_POWER_COLLECTING);
- break;
-
- case EL_KEY_1:
- case EL_KEY_2:
- case EL_KEY_3:
- case EL_KEY_4:
- {
- int key_nr = element - EL_KEY_1;
- int graphic = el2edimg(element);
-
- RemoveField(x, y);
- player->key[key_nr] = TRUE;
- RaiseScoreElement(element);
- DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- graphic);
- DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- graphic);
- PlaySoundLevel(x, y, SND_CLASS_KEY_COLLECTING);
- break;
- }
-
- case EL_EM_KEY_1:
- case EL_EM_KEY_2:
- case EL_EM_KEY_3:
- case EL_EM_KEY_4:
- {
- int key_nr = element - EL_EM_KEY_1;
- int graphic = el2edimg(EL_KEY_1 + key_nr);
-
- RemoveField(x, y);
- player->key[key_nr] = TRUE;
- RaiseScoreElement(element);
- DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- graphic);
- DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
- graphic);
- PlaySoundLevel(x, y, SND_CLASS_KEY_COLLECTING);
- break;
- }
-
- case EL_ROBOT_WHEEL:
- Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE;
- ZX = x;
- ZY = y;
- DrawLevelField(x, y);
- PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING);
- return MF_ACTION;
- break;
-
- case EL_SP_TERMINAL:
- {
- int xx, yy;
-
- PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVATING);
-
- for (yy=0; yy<lev_fieldy; yy++)
- {
- for (xx=0; xx<lev_fieldx; xx++)
- {
- if (Feld[xx][yy] == EL_SP_DISK_YELLOW)
- Bang(xx, yy);
- else if (Feld[xx][yy] == EL_SP_TERMINAL)
- Feld[xx][yy] = EL_SP_TERMINAL_ACTIVE;
- }
- }
-
- return MF_ACTION;
- }
- break;
-
- case EL_CONVEYOR_BELT_1_SWITCH_LEFT:
- case EL_CONVEYOR_BELT_1_SWITCH_MIDDLE:
- case EL_CONVEYOR_BELT_1_SWITCH_RIGHT:
- case EL_CONVEYOR_BELT_2_SWITCH_LEFT:
- case EL_CONVEYOR_BELT_2_SWITCH_MIDDLE:
- case EL_CONVEYOR_BELT_2_SWITCH_RIGHT:
- case EL_CONVEYOR_BELT_3_SWITCH_LEFT:
- case EL_CONVEYOR_BELT_3_SWITCH_MIDDLE:
- case EL_CONVEYOR_BELT_3_SWITCH_RIGHT:
- case EL_CONVEYOR_BELT_4_SWITCH_LEFT:
- case EL_CONVEYOR_BELT_4_SWITCH_MIDDLE:
- case EL_CONVEYOR_BELT_4_SWITCH_RIGHT:
- if (!player->Switching)
- {
- player->Switching = TRUE;
- ToggleBeltSwitch(x, y);
- PlaySoundLevel(x, y, SND_CLASS_CONVEYOR_BELT_SWITCH_ACTIVATING);
- }
- return MF_ACTION;
- break;
-
- case EL_SWITCHGATE_SWITCH_UP:
- case EL_SWITCHGATE_SWITCH_DOWN:
- if (!player->Switching)
- {
- player->Switching = TRUE;
- ToggleSwitchgateSwitch(x, y);
- PlaySoundLevel(x, y, SND_CLASS_SWITCHGATE_SWITCH_ACTIVATING);
- }
- return MF_ACTION;
- break;
-
- case EL_LIGHT_SWITCH:
- case EL_LIGHT_SWITCH_ACTIVE:
- if (!player->Switching)
- {
- player->Switching = TRUE;
- ToggleLightSwitch(x, y);
- PlaySoundLevel(x, y, element == EL_LIGHT_SWITCH ?
- SND_LIGHT_SWITCH_ACTIVATING :
- SND_LIGHT_SWITCH_DEACTIVATING);
- }
- return MF_ACTION;
- break;
-
- case EL_TIMEGATE_SWITCH:
- ActivateTimegateSwitch(x, y);
- PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVATING);
-
- return MF_ACTION;
- break;
-
- case EL_BALLOON_SWITCH_LEFT:
- case EL_BALLOON_SWITCH_RIGHT:
- case EL_BALLOON_SWITCH_UP:
- case EL_BALLOON_SWITCH_DOWN:
- case EL_BALLOON_SWITCH_ANY:
- if (element == EL_BALLOON_SWITCH_ANY)
- game.balloon_dir = move_direction;
- else
- game.balloon_dir = (element == EL_BALLOON_SWITCH_LEFT ? MV_LEFT :
- element == EL_BALLOON_SWITCH_RIGHT ? MV_RIGHT :
- element == EL_BALLOON_SWITCH_UP ? MV_UP :
- element == EL_BALLOON_SWITCH_DOWN ? MV_DOWN :
- MV_NO_MOVING);
- PlaySoundLevel(x, y, SND_CLASS_BALLOON_SWITCH_ACTIVATING);
-
- return MF_ACTION;
- break;
-
- /* the following elements cannot be pushed by "snapping" */
- case EL_ROCK:
- case EL_BOMB:
- case EL_DX_SUPABOMB:
- case EL_NUT:
- case EL_TIME_ORB_EMPTY:
- case EL_SP_ZONK:
- case EL_SP_DISK_ORANGE:
- case EL_SPRING:
- if (mode == DF_SNAP)
- return MF_NO_ACTION;
-
- /* no "break" -- fall through to next case */
-
- /* the following elements can be pushed by "snapping" */
- case EL_BD_ROCK:
- if (dy)
- return MF_NO_ACTION;
-
- player->Pushing = TRUE;
-
-#if 0
- if (element == EL_ROCK)
- printf("::: wanna push [%d] [%d]\n",
- FrameCounter, player->push_delay_value);
-#endif
-
- if (!IN_LEV_FIELD(x+dx, y+dy) || !IS_FREE(x+dx, y+dy))
- return MF_NO_ACTION;
-
- if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
- return MF_NO_ACTION;
-
- if (player->push_delay == 0)
- player->push_delay = FrameCounter;
-#if 0
- if (!FrameReached(&player->push_delay, player->push_delay_value) &&
- !tape.playing &&
- element != EL_SPRING)
- return MF_NO_ACTION;
-#else
- if (!FrameReached(&player->push_delay, player->push_delay_value) &&
- !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
- element != EL_SPRING)
- return MF_NO_ACTION;
-#endif
-
- if (mode == DF_SNAP)
- {
- InitMovingField(x, y, move_direction);
- ContinueMoving(x, y);
- }
- else
- {
- RemoveField(x, y);
- Feld[x + dx][y + dy] = element;
- }
-
- if (element == EL_SPRING)
- {
- Feld[x + dx][y + dy] = EL_SPRING;
- MovDir[x + dx][y + dy] = move_direction;
- }
-
- player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8));
-
- DrawLevelField(x + dx, y + dy);
- PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING);
- break;
-
- case EL_GATE_1:
- case EL_GATE_2:
- case EL_GATE_3:
- case EL_GATE_4:
- if (!player->key[element - EL_GATE_1])
- return MF_NO_ACTION;
- break;
-
- case EL_GATE_1_GRAY:
- case EL_GATE_2_GRAY:
- case EL_GATE_3_GRAY:
- case EL_GATE_4_GRAY:
- if (!player->key[element - EL_GATE_1_GRAY])
- return MF_NO_ACTION;
- break;
-
- case EL_EM_GATE_1:
- case EL_EM_GATE_2:
- case EL_EM_GATE_3:
- case EL_EM_GATE_4:
- if (!player->key[element - EL_EM_GATE_1])
- return MF_NO_ACTION;
- if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
- return MF_NO_ACTION;
-
- /* automatically move to the next field with double speed */
- player->programmed_action = move_direction;
- DOUBLE_PLAYER_SPEED(player);
-
- PlaySoundLevel(x, y, SND_CLASS_GATE_PASSING);
- break;
-
- case EL_EM_GATE_1_GRAY:
- case EL_EM_GATE_2_GRAY:
- case EL_EM_GATE_3_GRAY:
- case EL_EM_GATE_4_GRAY:
- if (!player->key[element - EL_EM_GATE_1_GRAY])
- return MF_NO_ACTION;
- if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
- return MF_NO_ACTION;
-
- /* automatically move to the next field with double speed */
- player->programmed_action = move_direction;
- DOUBLE_PLAYER_SPEED(player);
-
-#if 1
- PlaySoundLevelAction(x, y, ACTION_PASSING);
-#else
- PlaySoundLevel(x, y, SND_GATE_PASSING);
-#endif
- break;
-
- case EL_SWITCHGATE_OPEN:
- case EL_TIMEGATE_OPEN:
- if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
- return MF_NO_ACTION;
-
- /* automatically move to the next field with double speed */
- player->programmed_action = move_direction;
- DOUBLE_PLAYER_SPEED(player);
-
- PlaySoundLevelElementAction(x, y, element, ACTION_PASSING);
- break;
-