rnd-20030119-1-src
[rocksndiamonds.git] / src / game.c
index 332da783035d540ce04ec1552087f136b78c67e3..533119c92b368df93d484018f33fd3d2b35a7b42 100644 (file)
 #define NUM_GAME_BUTTONS               6
 
 /* forward declaration for internal use */
+static void InitBeltMovement(void);
 static void CloseAllOpenTimegates(void);
 static void CheckGravityMovement(struct PlayerInfo *);
 static void KillHeroUnlessProtected(int, int);
 
-void PlaySoundLevel(int, int, int);
-void PlaySoundLevelAction(int, int, int);
-void PlaySoundLevelElementAction(int, int, int, int);
+static void PlaySoundLevel(int, int, int);
+static void PlaySoundLevelNearest(int, int, int);
+static void PlaySoundLevelAction(int, int, int);
+static void PlaySoundLevelElementAction(int, int, int, int);
 
 static void MapGameButtons();
 static void HandleGameButtons(struct GadgetInfo *);
 
 static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS];
 
-#define SND_ACTION_UNKNOWN             0
-#define SND_ACTION_WAITING             1
-#define SND_ACTION_MOVING              2
-#define SND_ACTION_DIGGING             3
-#define SND_ACTION_COLLECTING          4
-#define SND_ACTION_PASSING             5
-#define SND_ACTION_IMPACT              6
-#define SND_ACTION_PUSHING             7
-#define SND_ACTION_ACTIVATING          8
-#define SND_ACTION_ACTIVE              9
+#define IS_ANIMATED(g)         (graphic_info[g].anim_frames > 1)
+#define IS_LOOP_SOUND(s)       (sound_info[s].loop)
 
-#define NUM_SND_ACTIONS                        10
 
-static struct
+/* -------------------------------------------------------------------------
+   definition of elements that automatically change to other elements after
+   a specified time, eventually calling a function when changing
+   ------------------------------------------------------------------------- */
+
+/* forward declaration for changer functions */
+static void InitBuggyBase(int x, int y);
+static void WarnBuggyBase(int x, int y);
+
+static void InitTrap(int x, int y);
+static void ActivateTrap(int x, int y);
+static void ChangeActiveTrap(int x, int y);
+
+static void InitRobotWheel(int x, int y);
+static void RunRobotWheel(int x, int y);
+static void StopRobotWheel(int x, int y);
+
+static void InitTimegateWheel(int x, int y);
+static void RunTimegateWheel(int x, int y);
+
+struct ChangingElementInfo
 {
-  char *text;
-  int value;
-  boolean is_loop;
-} sound_action_properties[] =
+  int base_element;
+  int next_element;
+  int change_delay;
+  void (*pre_change_function)(int x, int y);
+  void (*change_function)(int x, int y);
+  void (*post_change_function)(int x, int y);
+};
+
+static struct ChangingElementInfo changing_element_list[] =
 {
-  /* insert _all_ loop sound actions here */
-  { ".waiting",                SND_ACTION_WAITING,     TRUE },
-  { ".moving",         SND_ACTION_MOVING,      TRUE }, /* continuos moving */
-  { ".active",         SND_ACTION_ACTIVE,      TRUE },
-  { ".growing",                SND_ACTION_UNKNOWN,     TRUE },
-  { ".attacking",      SND_ACTION_UNKNOWN,     TRUE },
-
-  /* other (non-loop) sound actions are optional */
-  { ".stepping",       SND_ACTION_MOVING,      FALSE }, /* discrete moving */
-  { ".digging",                SND_ACTION_DIGGING,     FALSE },
-  { ".collecting",     SND_ACTION_COLLECTING,  FALSE },
-  { ".passing",                SND_ACTION_PASSING,     FALSE },
-  { ".impact",         SND_ACTION_IMPACT,      FALSE },
-  { ".pushing",                SND_ACTION_PUSHING,     FALSE },
-  { ".activating",     SND_ACTION_ACTIVATING,  FALSE },
-  { NULL,              0,                      0 },
+  { EL_NUT_CRACKING,           EL_EMERALD,              6, NULL, NULL, NULL },
+  { EL_PEARL_BREAKING,         EL_EMPTY,                8, NULL, NULL, NULL },
+  { EL_EXIT_OPENING,           EL_EXIT_OPEN,           29, NULL, NULL, NULL },
+
+  { EL_SWITCHGATE_OPENING,     EL_SWITCHGATE_OPEN,     29, NULL, NULL, NULL },
+  { EL_SWITCHGATE_CLOSING,     EL_SWITCHGATE_CLOSED,   29, NULL, NULL, NULL },
+
+  { EL_TIMEGATE_OPENING,       EL_TIMEGATE_OPEN,       29, NULL, NULL, NULL },
+  { EL_TIMEGATE_CLOSING,       EL_TIMEGATE_CLOSED,     29, NULL, NULL, NULL },
+
+  { EL_SP_BUGGY_BASE,          EL_SP_BUGGY_BASE_ACTIVATING, 0,
+    InitBuggyBase, NULL, NULL },
+  { EL_SP_BUGGY_BASE_ACTIVATING,EL_SP_BUGGY_BASE_ACTIVE, 0,
+    InitBuggyBase, NULL, NULL },
+  { EL_SP_BUGGY_BASE_ACTIVE,   EL_SP_BUGGY_BASE,        0,
+    InitBuggyBase, WarnBuggyBase, NULL },
+
+  { EL_TRAP,                   EL_TRAP_ACTIVE,          0,
+    InitTrap, NULL, ActivateTrap },
+  { EL_TRAP_ACTIVE,            EL_TRAP,                31,
+    NULL, ChangeActiveTrap, NULL },
+
+  { EL_ROBOT_WHEEL_ACTIVE,     EL_ROBOT_WHEEL,          0,
+    InitRobotWheel, RunRobotWheel, StopRobotWheel },
+
+  { EL_TIMEGATE_SWITCH_ACTIVE, EL_TIMEGATE_SWITCH,      0,
+    InitTimegateWheel, RunTimegateWheel, NULL },
+
+  { EL_UNDEFINED,              EL_UNDEFINED,           -1, NULL        }
 };
-static int element_action_sound[MAX_NUM_ELEMENTS][NUM_SND_ACTIONS];
-static boolean is_loop_sound[NUM_SOUND_FILES];
 
-#define IS_LOOP_SOUND(x)       (is_loop_sound[x])
+static struct ChangingElementInfo changing_element[MAX_NUM_ELEMENTS];
+
+#define IS_AUTO_CHANGING(e)  (changing_element[e].base_element != EL_UNDEFINED)
+
 
 
 #ifdef DEBUG
@@ -191,7 +223,7 @@ static unsigned int getStateCheckSum(int counter)
     checksum += mult++ * Store[x][y];
     checksum += mult++ * Store2[x][y];
     checksum += mult++ * StorePlayer[x][y];
-    checksum += mult++ * Frame[x][y];
+    checksum += mult++ * ExplodePhase[x][y];
     checksum += mult++ * AmoebaNr[x][y];
     checksum += mult++ * JustStopped[x][y];
     checksum += mult++ * Stop[x][y];
@@ -292,6 +324,8 @@ static void InitField(int x, int y, boolean init_game)
          Feld[x][y] = EL_SP_MURPHY_CLONE;
          break;
        }
+
+       Feld[x][y] = EL_PLAYER1;
       }
       /* no break! */
     case EL_PLAYER1:
@@ -484,8 +518,8 @@ void DrawGameDoorValues()
   for (i=0; i<MAX_PLAYERS; i++)
     for (j=0; j<4; j++)
       if (stored_player[i].key[j])
-       DrawNewMiniGraphicExt(drawto, DX_KEYS + j * MINI_TILEX, DY_KEYS,
-                          GFX_SCHLUESSEL1 + j);
+       DrawMiniGraphicExt(drawto, DX_KEYS + j * MINI_TILEX, DY_KEYS,
+                          IMG_KEY1 + j);
 
   DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS,
           int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW);
@@ -498,96 +532,6 @@ void DrawGameDoorValues()
 }
 
 
-/*
-  =============================================================================
-  InitGameSound()
-  -----------------------------------------------------------------------------
-  initialize sound effect lookup table for element actions
-  =============================================================================
-*/
-
-void InitGameSound()
-{
-  int sound_effect_properties[NUM_SOUND_FILES];
-  int i, j;
-
-#if 0
-  debug_print_timestamp(0, NULL);
-#endif
-
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
-    for (j=0; j<NUM_SND_ACTIONS; j++)
-      element_action_sound[i][j] = -1;
-
-  for (i=0; i<NUM_SOUND_FILES; i++)
-  {
-    int len_effect_text = strlen(sound_files[i].token);
-
-    sound_effect_properties[i] = SND_ACTION_UNKNOWN;
-    is_loop_sound[i] = FALSE;
-
-    /* determine all loop sounds and identify certain sound classes */
-
-    for (j=0; sound_action_properties[j].text; j++)
-    {
-      int len_action_text = strlen(sound_action_properties[j].text);
-
-      if (len_action_text < len_effect_text &&
-         strcmp(&sound_files[i].token[len_effect_text - len_action_text],
-                sound_action_properties[j].text) == 0)
-      {
-       sound_effect_properties[i] = sound_action_properties[j].value;
-
-       if (sound_action_properties[j].is_loop)
-         is_loop_sound[i] = TRUE;
-      }
-    }
-
-    /* associate elements and some selected sound actions */
-
-    for (j=0; j<MAX_NUM_ELEMENTS; j++)
-    {
-      if (element_info[j].sound_class_name)
-      {
-       int len_class_text = strlen(element_info[j].sound_class_name);
-
-       if (len_class_text + 1 < len_effect_text &&
-           strncmp(sound_files[i].token,
-                   element_info[j].sound_class_name, len_class_text) == 0 &&
-           sound_files[i].token[len_class_text] == '.')
-       {
-         int sound_action_value = sound_effect_properties[i];
-
-         element_action_sound[j][sound_action_value] = i;
-       }
-      }
-    }
-  }
-
-#if 0
-  debug_print_timestamp(0, "InitGameEngine");
-#endif
-
-#if 0
-  /* TEST ONLY */
-  {
-    int element = EL_SAND;
-    int sound_action = SND_ACTION_DIGGING;
-    int j = 0;
-
-    while (sound_action_properties[j].text)
-    {
-      if (sound_action_properties[j].value == sound_action)
-       printf("element %d, sound action '%s'  == %d\n",
-              element, sound_action_properties[j].text,
-              element_action_sound[element][sound_action]);
-      j++;
-    }
-  }
-#endif
-}
-
-
 /*
   =============================================================================
   InitGameEngine()
@@ -636,18 +580,45 @@ static void InitGameEngine()
     for (i=0; i<ep_em_slippery_wall_num; i++)
     {
       if (level.em_slippery_gems)      /* special EM style gems behaviour */
-       Elementeigenschaften2[ep_em_slippery_wall[i]] |=
+       Properties2[ep_em_slippery_wall[i]] |=
          EP_BIT_EM_SLIPPERY_WALL;
       else
-       Elementeigenschaften2[ep_em_slippery_wall[i]] &=
+       Properties2[ep_em_slippery_wall[i]] &=
          ~EP_BIT_EM_SLIPPERY_WALL;
     }
 
     /* "EL_WALL_GROWING_ACTIVE" wasn't slippery for EM gems in version 2.0.1 */
     if (level.em_slippery_gems && game.engine_version > VERSION_IDENT(2,0,1))
-      Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] |= EP_BIT_EM_SLIPPERY_WALL;
+      Properties2[EL_WALL_GROWING_ACTIVE] |= EP_BIT_EM_SLIPPERY_WALL;
     else
-      Elementeigenschaften2[EL_WALL_GROWING_ACTIVE] &=~EP_BIT_EM_SLIPPERY_WALL;
+      Properties2[EL_WALL_GROWING_ACTIVE] &=~EP_BIT_EM_SLIPPERY_WALL;
+  }
+
+  /* initialize changing elements information */
+  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  {
+    changing_element[i].base_element = EL_UNDEFINED;
+    changing_element[i].next_element = EL_UNDEFINED;
+    changing_element[i].change_delay = -1;
+    changing_element[i].pre_change_function = NULL;
+    changing_element[i].change_function = NULL;
+    changing_element[i].post_change_function = NULL;
+  }
+
+  i = 0;
+  while (changing_element_list[i].base_element != EL_UNDEFINED)
+  {
+    struct ChangingElementInfo *ce = &changing_element_list[i];
+    int element = ce->base_element;
+
+    changing_element[element].base_element         = ce->base_element;
+    changing_element[element].next_element         = ce->next_element;
+    changing_element[element].change_delay         = ce->change_delay;
+    changing_element[element].pre_change_function  = ce->pre_change_function;
+    changing_element[element].change_function      = ce->change_function;
+    changing_element[element].post_change_function = ce->post_change_function;
+
+    i++;
   }
 }
 
@@ -794,12 +765,14 @@ void InitGame()
       Feld[x][y] = Ur[x][y];
       MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
       Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
-      Frame[x][y] = 0;
-      GfxAction[x][y] = GFX_ACTION_DEFAULT;
       AmoebaNr[x][y] = 0;
       JustStopped[x][y] = 0;
       Stop[x][y] = FALSE;
+      ExplodePhase[x][y] = 0;
       ExplodeField[x][y] = EX_NO_EXPLOSION;
+
+      GfxFrame[x][y] = 0;
+      GfxAction[x][y] = ACTION_DEFAULT;
     }
   }
 
@@ -818,6 +791,8 @@ void InitGame()
     }
   }
 
+  InitBeltMovement();
+
   game.emulation = (emulate_bd ? EMU_BOULDERDASH :
                    emulate_sb ? EMU_SOKOBAN :
                    emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
@@ -957,7 +932,6 @@ void InitGame()
 
   DrawLevel();
   DrawAllPlayers();
-  FadeToFront();
 
   /* after drawing the level, correct some elements */
   if (game.timegate_time_left == 0)
@@ -967,9 +941,10 @@ void InitGame()
     BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
 
   redraw_mask |= REDRAW_FROM_BACKBUFFER;
+  FadeToFront();
 
   /* copy default game door content to main double buffer */
-  BlitBitmap(pix[PIX_DOOR], drawto,
+  BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
 
   if (level_nr < 100)
@@ -978,7 +953,7 @@ void InitGame()
   else
   {
     DrawTextExt(drawto, DX + XX_EMERALDS, DY + YY_EMERALDS,
-               int2str(level_nr, 3), FS_SMALL, FC_SPECIAL3);
+               int2str(level_nr, 3), FS_SMALL, FC_SPECIAL3, FONT_OPAQUE);
     BlitBitmap(drawto, drawto,
               DX + XX_EMERALDS, DY + YY_EMERALDS + 1,
               FONT5_XSIZE * 3, FONT5_YSIZE - 1,
@@ -996,7 +971,7 @@ void InitGame()
   MapTapeButtons();
 
   /* copy actual game door content to door double buffer for OpenDoor() */
-  BlitBitmap(drawto, pix[PIX_DB_DOOR],
+  BlitBitmap(drawto, bitmap_db_door,
             DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 
   OpenDoor(DOOR_OPEN_ALL);
@@ -1152,6 +1127,9 @@ void GameWon()
   if (local_player->MovPos)
     return;
 
+  if (tape.playing && tape.auto_play)
+    tape.auto_play_level_solved = TRUE;
+
   local_player->LevelSolved = FALSE;
 
   PlaySoundStereo(SND_GAME_WINNING, SOUND_MAX_RIGHT);
@@ -1214,7 +1192,7 @@ void GameWon()
 #endif
 
   /* Hero disappears */
-  DrawNewLevelField(ExitX, ExitY);
+  DrawLevelField(ExitX, ExitY);
   BackToFront();
 
   if (tape.playing)
@@ -1325,16 +1303,23 @@ int NewHiScore()
 
 void InitMovingField(int x, int y, int direction)
 {
+  int element = Feld[x][y];
   int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
   int newy = y + (direction == MV_UP   ? -1 : direction == MV_DOWN  ? +1 : 0);
 
+  if (!JustStopped[x][y] || direction != MovDir[x][y])
+    GfxFrame[x][y] = 0;
+
   MovDir[x][y] = direction;
   MovDir[newx][newy] = direction;
 
   if (Feld[newx][newy] == EL_EMPTY)
     Feld[newx][newy] = EL_BLOCKED;
 
-  GfxAction[x][y] = GFX_ACTION_MOVING;
+  if (direction == MV_DOWN && CAN_FALL(element))
+    GfxAction[x][y] = ACTION_FALLING;
+  else
+    GfxAction[x][y] = ACTION_MOVING;
 }
 
 void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
@@ -1445,85 +1430,48 @@ void RemoveMovingField(int x, int y)
   Feld[newx][newy] = EL_EMPTY;
   MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
   MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
-  GfxAction[oldx][oldy] = GfxAction[newx][newy] = GFX_ACTION_DEFAULT;
+  GfxAction[oldx][oldy] = GfxAction[newx][newy] = ACTION_DEFAULT;
 
-  DrawNewLevelField(oldx, oldy);
-  DrawNewLevelField(newx, newy);
+  DrawLevelField(oldx, oldy);
+  DrawLevelField(newx, newy);
 }
 
 void DrawDynamite(int x, int y)
 {
   int sx = SCREENX(x), sy = SCREENY(y);
-#if 0
-  int graphic = el2gfx(Feld[x][y]);
-#else
   int graphic = el2img(Feld[x][y]);
-#endif
   int frame;
 
   if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y))
     return;
 
   if (Store[x][y])
-#if 0
-    DrawGraphic(sx, sy, el2gfx(Store[x][y]));
-#else
-    DrawNewGraphic(sx, sy, el2img(Store[x][y]), 0);
-#endif
-
-#if 0
-  if (Feld[x][y] == EL_DYNAMITE_ACTIVE)
-  {
-    if ((frame = (96 - MovDelay[x][y]) / 12) > 6)
-      frame = 6;
-  }
-  else
-  {
-    if ((frame = ((96 - MovDelay[x][y]) / 6) % 8) > 3)
-      frame = 7 - frame;
-  }
-#else
-  frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]);
-#endif
+    DrawGraphic(sx, sy, el2img(Store[x][y]), 0);
 
-  /*
-  printf("-> %d: %d [%d]\n", graphic, frame, MovDelay[x][y]);
-  */
+  frame = getGraphicAnimationFrame(graphic, GfxFrame[x][y]);
 
-#if 0
-  if (game.emulation == EMU_SUPAPLEX)
-    DrawGraphic(sx, sy, GFX_SP_DISK_RED);
-  else if (Store[x][y])
-    DrawGraphicThruMask(sx, sy, graphic + frame);
-  else
-    DrawGraphic(sx, sy, graphic + frame);
-#else
   if (game.emulation == EMU_SUPAPLEX)
-    DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0);
+    DrawGraphic(sx, sy, IMG_SP_DISK_RED, frame);
   else if (Store[x][y])
-    DrawNewGraphicThruMask(sx, sy, graphic, frame);
+    DrawGraphicThruMask(sx, sy, graphic, frame);
   else
-    DrawNewGraphic(sx, sy, graphic, frame);
-#endif
+    DrawGraphic(sx, sy, graphic, frame);
 }
 
 void CheckDynamite(int x, int y)
 {
-  if (MovDelay[x][y])          /* dynamite is still waiting to explode */
+  int element = Feld[x][y];
+
+  if (MovDelay[x][y] != 0)     /* dynamite is still waiting to explode */
   {
     MovDelay[x][y]--;
-    if (MovDelay[x][y])
-    {
-      if (!(MovDelay[x][y] % 6))
-       PlaySoundLevelAction(x, y, SND_ACTION_ACTIVE);
 
-      if (IS_ACTIVE_BOMB(Feld[x][y]))
-      {
-       int delay = (Feld[x][y] == EL_DYNAMITE_ACTIVE ? 12 : 6);
+    if (MovDelay[x][y] != 0)
+    {
+      if (checkDrawLevelGraphicAnimation(x, y, el2img(element)))
+       DrawDynamite(x, y);
 
-       if (!(MovDelay[x][y] % delay))
-         DrawDynamite(x, y);
-      }
+      PlaySoundLevelAction(x, y, ACTION_ACTIVE);
 
       return;
     }
@@ -1670,7 +1618,7 @@ void Explode(int ex, int ey, int phase, int mode)
       Feld[x][y] = EL_EXPLOSION;
       MovDir[x][y] = MovPos[x][y] = 0;
       AmoebaNr[x][y] = 0;
-      Frame[x][y] = 1;
+      ExplodePhase[x][y] = 1;
       Stop[x][y] = TRUE;
     }
 
@@ -1686,7 +1634,7 @@ void Explode(int ex, int ey, int phase, int mode)
   x = ex;
   y = ey;
 
-  Frame[x][y] = (phase < last_phase ? phase + 1 : 0);
+  ExplodePhase[x][y] = (phase < last_phase ? phase + 1 : 0);
 
   if (phase == first_phase_after_start)
   {
@@ -1725,50 +1673,29 @@ void Explode(int ex, int ey, int phase, int mode)
     InitField(x, y, FALSE);
     if (CAN_MOVE(element) || COULD_MOVE(element))
       InitMovDir(x, y);
-    DrawNewLevelField(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)))
+  else if (phase >= delay && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
   {
-#if 0
-    int graphic = GFX_EXPLOSION;
-
-    if (game.emulation == EMU_SUPAPLEX)
-      graphic = (Store[x][y] == EL_SP_INFOTRON ?
-                GFX_SP_EXPLODE_INFOTRON :
-                GFX_SP_EXPLODE_EMPTY);
-
-    graphic += (phase / delay - 1);
-#else
-    int graphic = IMG_EXPLOSION;
-    int frame = (phase / delay - 1);
-
-    if (game.emulation == EMU_SUPAPLEX)
-      graphic = (Store[x][y] == EL_SP_INFOTRON ?
-                IMG_SP_EXPLOSION_INFOTRON :
-                IMG_SP_EXPLOSION);
-#endif
+    int stored = Store[x][y];
+    int graphic = (game.emulation != EMU_SUPAPLEX ? IMG_EXPLOSION :
+                  stored == EL_SP_INFOTRON ? IMG_SP_EXPLOSION_INFOTRON :
+                  IMG_SP_EXPLOSION);
+    int frame = getGraphicAnimationFrame(graphic, phase - delay);
 
     if (phase == delay)
       DrawCrumbledSand(SCREENX(x), SCREENY(y));
 
     if (IS_PFORTE(Store[x][y]))
     {
-      DrawNewLevelElement(x, y, Store[x][y]);
-#if 0
-      DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic);
-#else
-      DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame);
-#endif
+      DrawLevelElement(x, y, Store[x][y]);
+      DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame);
     }
     else
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), graphic);
-#else
-      DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
-#endif
+      DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame);
   }
 }
 
@@ -1898,14 +1825,9 @@ void Blurb(int x, int y)
   }
   else                                                         /* go on */
   {
-#if 0
-    int graphic =
-      (element == EL_ACID_SPLASH_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT);
-#else
     int graphic = (element == EL_ACID_SPLASH_LEFT ?
                   IMG_ACID_SPLASH_LEFT :
                   IMG_ACID_SPLASH_RIGHT);
-#endif
 
     if (!MovDelay[x][y])       /* initialize animation counter */
       MovDelay[x][y] = 9;
@@ -1914,20 +1836,77 @@ void Blurb(int x, int y)
     {
       MovDelay[x][y]--;
       if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-       DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2);
-#else
       {
-       int frame = getNewGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]);
+       int frame = getGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]);
 
-        DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+        DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame);
       }
-#endif
 
       if (!MovDelay[x][y])
       {
        Feld[x][y] = EL_EMPTY;
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
+      }
+    }
+  }
+}
+
+static void InitBeltMovement()
+{
+  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
+  };
+
+  int x, y, i, j;
+
+  /* set frame order for belt animation graphic according to belt direction */
+  for (i=0; i<4; i++)
+  {
+    int belt_nr = i;
+
+    for (j=0; j<3; j++)
+    {
+      int element = belt_base_active_element[belt_nr] + j;
+      int graphic = el2img(element);
+
+      if (game.belt_dir[i] == MV_LEFT)
+       graphic_info[graphic].anim_mode &= ~ANIM_REVERSE;
+      else
+       graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
+    }
+  }
+
+  for(y=0; y<lev_fieldy; y++)
+  {
+    for(x=0; x<lev_fieldx; x++)
+    {
+      int element = Feld[x][y];
+
+      for (i=0; i<4; i++)
+      {
+       if (IS_BELT(element) && game.belt_dir[i] != MV_NO_MOVING)
+       {
+         int e_belt_nr = getBeltNrFromBeltElement(element);
+         int belt_nr = i;
+
+         if (e_belt_nr == belt_nr)
+         {
+           int belt_part = Feld[x][y] - belt_base_element[belt_nr];
+
+           Feld[x][y] = belt_base_active_element[belt_nr] + belt_part;
+         }
+       }
       }
     }
   }
@@ -1986,9 +1965,9 @@ static void ToggleBeltSwitch(int x, int y)
     int graphic = el2img(element);
 
     if (belt_dir == MV_LEFT)
-      new_graphic_info[graphic].anim_mode &= ~ANIM_REVERSE;
+      graphic_info[graphic].anim_mode &= ~ANIM_REVERSE;
     else
-      new_graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
+      graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
   }
 
   for (yy=0; yy<lev_fieldy; yy++)
@@ -2004,7 +1983,7 @@ static void ToggleBeltSwitch(int x, int y)
        if (e_belt_nr == belt_nr)
        {
          Feld[xx][yy] = belt_base_switch_element[belt_nr] + belt_dir_nr;
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        }
       }
       else if (IS_BELT(element) && belt_dir != MV_NO_MOVING)
@@ -2016,7 +1995,7 @@ static void ToggleBeltSwitch(int x, int y)
          int belt_part = Feld[xx][yy] - belt_base_element[belt_nr];
 
          Feld[xx][yy] = belt_base_active_element[belt_nr] + belt_part;
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        }
       }
       else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING)
@@ -2028,7 +2007,7 @@ static void ToggleBeltSwitch(int x, int y)
          int belt_part = Feld[xx][yy] - belt_base_active_element[belt_nr];
 
          Feld[xx][yy] = belt_base_element[belt_nr] + belt_part;
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        }
       }
     }
@@ -2051,7 +2030,7 @@ static void ToggleSwitchgateSwitch(int x, int y)
          element == EL_SWITCHGATE_SWITCH_DOWN)
       {
        Feld[xx][yy] = EL_SWITCHGATE_SWITCH_UP + game.switchgate_pos;
-       DrawNewLevelField(xx, yy);
+       DrawLevelField(xx, yy);
       }
       else if (element == EL_SWITCHGATE_OPEN ||
               element == EL_SWITCHGATE_OPENING)
@@ -2097,13 +2076,13 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
          game.light_time_left > 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE;
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
       }
       else if (element == EL_LIGHT_SWITCH_ACTIVE &&
               game.light_time_left == 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH;
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL ||
               element == EL_INVISIBLE_WALL ||
@@ -2112,7 +2091,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left > 0)
          Feld[x][y] = getInvisibleActiveFromInvisibleElement(element);
 
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL_ACTIVE ||
               element == EL_INVISIBLE_WALL_ACTIVE ||
@@ -2121,7 +2100,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left == 0)
          Feld[x][y] = getInvisibleFromInvisibleActiveElement(element);
 
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
       }
     }
   }
@@ -2199,7 +2178,7 @@ void Impact(int x, int y)
   if ((element == EL_BOMB ||
        element == EL_SP_DISK_ORANGE ||
        element == EL_DX_SUPABOMB) &&
-      (lastline || object_hit))        /* element is bomb */
+      (lastline || object_hit))                /* element is bomb */
   {
     Bang(x, y);
     return;
@@ -2228,7 +2207,8 @@ void Impact(int x, int y)
   if (!lastline && object_hit)         /* check which object was hit */
   {
     if (CAN_CHANGE(element) && 
-       (smashed == EL_MAGIC_WALL || smashed == EL_BD_MAGIC_WALL))
+       (smashed == EL_MAGIC_WALL ||
+        smashed == EL_BD_MAGIC_WALL))
     {
       int xx, yy;
       int activated_magic_wall =
@@ -2249,29 +2229,31 @@ void Impact(int x, int y)
                            SND_BD_MAGIC_WALL_ACTIVATING));
     }
 
-    if (IS_PLAYER(x, y+1))
+    if (IS_PLAYER(x, y + 1))
     {
       KillHeroUnlessProtected(x, y+1);
       return;
     }
     else if (smashed == EL_PENGUIN)
     {
-      Bang(x, y+1);
+      Bang(x, y + 1);
       return;
     }
     else if (element == EL_BD_DIAMOND)
     {
       if (IS_ENEMY(smashed) && IS_BD_ELEMENT(smashed))
       {
-       Bang(x, y+1);
+       Bang(x, y + 1);
        return;
       }
     }
-    else if ((element == EL_SP_INFOTRON || element == EL_SP_ZONK) &&
-            (smashed == EL_SP_SNIKSNAK || smashed == EL_SP_ELECTRON ||
+    else if ((element == EL_SP_INFOTRON ||
+             element == EL_SP_ZONK) &&
+            (smashed == EL_SP_SNIKSNAK ||
+             smashed == EL_SP_ELECTRON ||
              smashed == EL_SP_DISK_ORANGE))
     {
-      Bang(x, y+1);
+      Bang(x, y + 1);
       return;
     }
     else if (element == EL_ROCK ||
@@ -2279,19 +2261,23 @@ void Impact(int x, int y)
             element == EL_BD_ROCK)
     {
       if (IS_ENEMY(smashed) ||
-         smashed == EL_BOMB || smashed == EL_SP_DISK_ORANGE ||
+         smashed == EL_BOMB ||
+         smashed == EL_SP_DISK_ORANGE ||
          smashed == EL_DX_SUPABOMB ||
-         smashed == EL_SATELLITE || smashed == EL_PIG ||
-         smashed == EL_DRAGON || smashed == EL_MOLE)
+         smashed == EL_SATELLITE ||
+         smashed == EL_PIG ||
+         smashed == EL_DRAGON ||
+         smashed == EL_MOLE)
       {
-       Bang(x, y+1);
+       Bang(x, y + 1);
        return;
       }
-      else if (!IS_MOVING(x, y+1))
+      else if (!IS_MOVING(x, y + 1))
       {
-       if (smashed == EL_LAMP || smashed == EL_LAMP_ACTIVE)
+       if (smashed == EL_LAMP ||
+           smashed == EL_LAMP_ACTIVE)
        {
-         Bang(x, y+1);
+         Bang(x, y + 1);
          return;
        }
        else if (smashed == EL_NUT)
@@ -2346,7 +2332,7 @@ void Impact(int x, int y)
 
   /* play sound of object that hits the ground */
   if (lastline || object_hit)
-    PlaySoundLevelElementAction(x, y, element, SND_ACTION_IMPACT);
+    PlaySoundLevelElementAction(x, y, element, ACTION_IMPACT);
 }
 
 void TurnRound(int x, int y)
@@ -2380,18 +2366,18 @@ void TurnRound(int x, int y)
 
   int element = Feld[x][y];
   int old_move_dir = MovDir[x][y];
-  int left_dir = turn[old_move_dir].left;
+  int left_dir  = turn[old_move_dir].left;
   int right_dir = turn[old_move_dir].right;
-  int back_dir = turn[old_move_dir].back;
+  int back_dir  = turn[old_move_dir].back;
 
-  int left_dx = move_xy[left_dir].x, left_dy = move_xy[left_dir].y;
-  int right_dx = move_xy[right_dir].x, right_dy = move_xy[right_dir].y;
-  int move_dx = move_xy[old_move_dir].x, move_dy = move_xy[old_move_dir].y;
-  int back_dx = move_xy[back_dir].x, back_dy = move_xy[back_dir].y;
+  int left_dx  = move_xy[left_dir].x,     left_dy  = move_xy[left_dir].y;
+  int right_dx = move_xy[right_dir].x,    right_dy = move_xy[right_dir].y;
+  int move_dx  = move_xy[old_move_dir].x, move_dy  = move_xy[old_move_dir].y;
+  int back_dx  = move_xy[back_dir].x,     back_dy  = move_xy[back_dir].y;
 
-  int left_x = x+left_dx, left_y = y+left_dy;
-  int right_x = x+right_dx, right_y = y+right_dy;
-  int move_x = x+move_dx, move_y = y+move_dy;
+  int left_x  = x + left_dx,  left_y  = y + left_dy;
+  int right_x = x + right_dx, right_y = y + right_dy;
+  int move_x  = x + move_dx,  move_y  = y + move_dy;
 
   if (element == EL_BUG || element == EL_BD_BUTTERFLY)
   {
@@ -2635,17 +2621,18 @@ void TurnRound(int x, int y)
     MovDir[x][y] = game.balloon_dir;
     MovDelay[x][y] = 0;
   }
-  else if (element == EL_SPRING_MOVING)
+  else if (element == EL_SPRING)
   {
-    if (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y) ||
-       (IN_LEV_FIELD(x, y+1) && IS_FREE(x, y+1)))
-    {
-      Feld[x][y] = EL_SPRING;
+    if ((MovDir[x][y] == MV_LEFT || MovDir[x][y] == MV_RIGHT) &&
+       (!IN_LEV_FIELD(move_x, move_y) || !IS_FREE(move_x, move_y) ||
+        (IN_LEV_FIELD(x, y + 1) && IS_FREE(x, y + 1))))
       MovDir[x][y] = MV_NO_MOVING;
-    }
+
     MovDelay[x][y] = 0;
   }
-  else if (element == EL_ROBOT || element == EL_SATELLITE || element == EL_PENGUIN)
+  else if (element == EL_ROBOT ||
+          element == EL_SATELLITE ||
+          element == EL_PENGUIN)
   {
     int attr_x = -1, attr_y = -1;
 
@@ -2674,7 +2661,7 @@ void TurnRound(int x, int y)
       }
     }
 
-    if (element == EL_ROBOT && ZX>=0 && ZY>=0)
+    if (element == EL_ROBOT && ZX >= 0 && ZY >= 0)
     {
       attr_x = ZX;
       attr_y = ZY;
@@ -2793,14 +2780,16 @@ static boolean JustBeingPushed(int x, int y)
 
 void StartMoving(int x, int y)
 {
+  static boolean use_spring_bug = TRUE;
+  boolean started_moving = FALSE;      /* some elements can fall _and_ move */
   int element = Feld[x][y];
 
   if (Stop[x][y])
     return;
 
-  GfxAction[x][y] = GFX_ACTION_DEFAULT;
+  GfxAction[x][y] = ACTION_DEFAULT;
 
-  if (CAN_FALL(element) && y<lev_fieldy-1)
+  if (CAN_FALL(element) && y < lev_fieldy - 1)
   {
     if ((x>0 && IS_PLAYER(x-1, y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1, y)))
       if (JustBeingPushed(x, y))
@@ -2811,6 +2800,8 @@ void StartMoving(int x, int y)
       if (IS_FREE(x, y+1))
       {
        InitMovingField(x, y, MV_DOWN);
+       started_moving = TRUE;
+
        Feld[x][y] = EL_QUICKSAND_EMPTYING;
        Store[x][y] = EL_ROCK;
        PlaySoundLevel(x, y, SND_QUICKSAND_EMPTYING);
@@ -2838,6 +2829,8 @@ void StartMoving(int x, int y)
             Feld[x][y+1] == EL_QUICKSAND_EMPTY)
     {
       InitMovingField(x, y, MV_DOWN);
+      started_moving = TRUE;
+
       Feld[x][y] = EL_QUICKSAND_FILLING;
       Store[x][y] = element;
       PlaySoundLevel(x, y, SND_QUICKSAND_FILLING);
@@ -2847,6 +2840,8 @@ void StartMoving(int x, int y)
       if (IS_FREE(x, y+1))
       {
        InitMovingField(x, y, MV_DOWN);
+       started_moving = TRUE;
+
        Feld[x][y] = EL_MAGIC_WALL_EMPTYING;
        Store[x][y] = EL_CHANGED(Store[x][y]);
       }
@@ -2873,6 +2868,8 @@ void StartMoving(int x, int y)
       if (IS_FREE(x, y+1))
       {
        InitMovingField(x, y, MV_DOWN);
+       started_moving = TRUE;
+
        Feld[x][y] = EL_BD_MAGIC_WALL_EMPTYING;
        Store[x][y] = EL_CHANGED2(Store[x][y]);
       }
@@ -2899,6 +2896,8 @@ void StartMoving(int x, int y)
              Feld[x][y+1] == EL_BD_MAGIC_WALL_ACTIVE))
     {
       InitMovingField(x, y, MV_DOWN);
+      started_moving = TRUE;
+
       Feld[x][y] =
        (Feld[x][y+1] == EL_MAGIC_WALL_ACTIVE ? EL_MAGIC_WALL_FILLING :
         EL_BD_MAGIC_WALL_FILLING);
@@ -2907,7 +2906,10 @@ void StartMoving(int x, int y)
     else if (CAN_SMASH(element) && Feld[x][y+1] == EL_ACID)
     {
       Blurb(x, y);
+
       InitMovingField(x, y, MV_DOWN);
+      started_moving = TRUE;
+
       Store[x][y] = EL_ACID;
     }
     else if (CAN_SMASH(element) && Feld[x][y+1] == EL_BLOCKED &&
@@ -2915,9 +2917,18 @@ void StartMoving(int x, int y)
     {
       Impact(x, y);
     }
+    else if (IS_FREE(x, y+1) && element == EL_SPRING && use_spring_bug)
+    {
+      if (MovDir[x][y] == MV_NO_MOVING)
+      {
+       InitMovingField(x, y, MV_DOWN);
+       started_moving = TRUE;
+      }
+    }
     else if (IS_FREE(x, y+1))
     {
       InitMovingField(x, y, MV_DOWN);
+      started_moving = TRUE;
     }
     else if (element == EL_AMOEBA_DROP)
     {
@@ -2955,6 +2966,7 @@ void StartMoving(int x, int y)
          left = !(right = RND(2));
 
        InitMovingField(x, y, left ? MV_LEFT : MV_RIGHT);
+       started_moving = TRUE;
       }
     }
     else if (IS_BELT_ACTIVE(Feld[x][y+1]))
@@ -2966,33 +2978,64 @@ void StartMoving(int x, int y)
 
       if ((belt_dir == MV_LEFT  && left_is_free) ||
          (belt_dir == MV_RIGHT && right_is_free))
+      {
        InitMovingField(x, y, belt_dir);
+       started_moving = TRUE;
+
+       GfxAction[x][y] = ACTION_DEFAULT;
+      }
     }
   }
-  else if (CAN_MOVE(element))
+
+  /* not "else if" because of EL_SPRING */
+  if (CAN_MOVE(element) && !started_moving)
   {
     int newx, newy;
 
-    if ((element == EL_SATELLITE || element == EL_BALLOON ||
-        element == EL_SPRING_MOVING)
+    if ((element == EL_SATELLITE ||
+        element == EL_BALLOON ||
+        element == EL_SPRING)
        && JustBeingPushed(x, y))
       return;
 
+#if 0
+#if 0
+    if (element == EL_SPRING && MovDir[x][y] == MV_DOWN)
+      Feld[x][y + 1] = EL_EMPTY;       /* was set to EL_BLOCKED above */
+#else
+    if (element == EL_SPRING && MovDir[x][y] != MV_NO_MOVING)
+    {
+      Moving2Blocked(x, y, &newx, &newy);
+      if (Feld[newx][newy] == EL_BLOCKED)
+       Feld[newx][newy] = EL_EMPTY;    /* was set to EL_BLOCKED above */
+    }
+#endif
+#endif
+
     if (!MovDelay[x][y])       /* start new movement phase */
     {
       /* all objects that can change their move direction after each step */
       /* (MAMPFER, MAMPFER2 and PACMAN go straight until they hit a wall  */
 
-      if (element!=EL_YAMYAM && element!=EL_DARK_YAMYAM && element!=EL_PACMAN)
+      if (element != EL_YAMYAM &&
+         element != EL_DARK_YAMYAM &&
+         element != EL_PACMAN)
       {
+#if 0
+  if (element == EL_SPRING)
+    printf("1--> %d\n", MovDir[x][y]);
+#endif
        TurnRound(x, y);
-
+#if 0
+  if (element == EL_SPRING)
+    printf("2--> %d\n", MovDir[x][y]);
+#endif
        if (MovDelay[x][y] && (element == EL_BUG ||
                               element == EL_SPACESHIP ||
                               element == EL_SP_SNIKSNAK ||
                               element == EL_SP_ELECTRON ||
                               element == EL_MOLE))
-         DrawNewLevelField(x, y);
+         DrawLevelField(x, y);
       }
     }
 
@@ -3003,22 +3046,13 @@ void StartMoving(int x, int y)
       if (element == EL_ROBOT ||
          element == EL_YAMYAM || element == EL_DARK_YAMYAM)
       {
-       int phase = MovDelay[x][y] % 8;
-
-       if (phase > 3)
-         phase = 7 - phase;
-
        if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-         DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element) + phase);
-#else
        {
          int graphic = el2img(element);
-         int frame = getNewGraphicAnimationFrame(graphic, MovDelay[x][y] % 8);
+         int frame = getGraphicAnimationFrame(graphic, MovDelay[x][y] % 8);
 
-         DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+         DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame);
        }
-#endif
 
        if (MovDelay[x][y] % 4 == 3)
        {
@@ -3029,30 +3063,18 @@ void StartMoving(int x, int y)
        }
       }
       else if (element == EL_SP_ELECTRON)
-#if 0
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
-#else
-       DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
-#endif
+       DrawLevelElementAnimation(x, y, element);
       else if (element == EL_DRAGON)
       {
        int i;
        int dir = MovDir[x][y];
        int dx = (dir == MV_LEFT ? -1 : dir == MV_RIGHT ? +1 : 0);
        int dy = (dir == MV_UP   ? -1 : dir == MV_DOWN  ? +1 : 0);
-#if 0
-       int graphic = (dir == MV_LEFT   ? GFX_FLAMMEN_LEFT :
-                      dir == MV_RIGHT  ? GFX_FLAMMEN_RIGHT :
-                      dir == MV_UP     ? GFX_FLAMMEN_UP :
-                      dir == MV_DOWN   ? GFX_FLAMMEN_DOWN : GFX_LEERRAUM);
-       int phase = FrameCounter % 2;
-#else
        int graphic = (dir == MV_LEFT   ? IMG_FLAMES_LEFT1 :
                       dir == MV_RIGHT  ? IMG_FLAMES_RIGHT1 :
                       dir == MV_UP     ? IMG_FLAMES_UP1 :
                       dir == MV_DOWN   ? IMG_FLAMES_DOWN1 : IMG_EMPTY);
-       int frame = getNewGraphicAnimationFrame(graphic, -1);
-#endif
+       int frame = getGraphicAnimationFrame(graphic, -1);
 
        for (i=1; i<=3; i++)
        {
@@ -3075,24 +3097,20 @@ void StartMoving(int x, int y)
 
            Feld[xx][yy] = EL_FLAMES;
            if (IN_SCR_FIELD(sx, sy))
-#if 0
-             DrawGraphic(sx, sy, graphic + phase*3 + i-1);
-#else
-             DrawNewGraphic(sx, sy, flame_graphic, frame);
-#endif
+             DrawGraphic(sx, sy, flame_graphic, frame);
          }
          else
          {
            if (Feld[xx][yy] == EL_FLAMES)
              Feld[xx][yy] = EL_EMPTY;
-           DrawNewLevelField(xx, yy);
+           DrawLevelField(xx, yy);
          }
        }
       }
 
       if (MovDelay[x][y])      /* element still has to wait some time */
       {
-       PlaySoundLevelAction(x, y, SND_ACTION_WAITING);
+       PlaySoundLevelAction(x, y, ACTION_WAITING);
 
        return;
       }
@@ -3130,16 +3148,11 @@ void StartMoving(int x, int y)
       if (Feld[newx][newy] == EL_EXIT_OPEN)
       {
        Feld[x][y] = EL_EMPTY;
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
 
        PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT);
        if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
-#if 0
-         DrawGraphicThruMask(SCREENX(newx), SCREENY(newy), el2gfx(element));
-#else
-         DrawNewGraphicThruMask(SCREENX(newx), SCREENY(newy), el2img(element),
-                                0);
-#endif
+         DrawGraphicThruMask(SCREENX(newx),SCREENY(newy), el2img(element), 0);
 
        local_player->friends_still_needed--;
        if (!local_player->friends_still_needed &&
@@ -3151,7 +3164,7 @@ void StartMoving(int x, int y)
       else if (IS_MAMPF3(Feld[newx][newy]))
       {
        if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING)
-         DrawNewLevelField(newx, newy);
+         DrawLevelField(newx, newy);
        else
          MovDir[x][y] = MV_NO_MOVING;
       }
@@ -3160,7 +3173,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawNewLevelField(x, y);
+         DrawLevelField(x, y);
        return;
       }
     }
@@ -3173,7 +3186,7 @@ void StartMoving(int x, int y)
        else
        {
          Feld[newx][newy] = EL_EMPTY;
-         DrawNewLevelField(newx, newy);
+         DrawLevelField(newx, newy);
        }
 
        PlaySoundLevel(x, y, SND_PIG_EATING);
@@ -3183,7 +3196,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawNewLevelField(x, y);
+         DrawLevelField(x, y);
        return;
       }
     }
@@ -3194,7 +3207,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawNewLevelField(x, y);
+         DrawLevelField(x, y);
        return;
       }
       else
@@ -3215,7 +3228,7 @@ void StartMoving(int x, int y)
          if (IS_PLAYER(x, y))
            DrawPlayerField(x, y);
          else
-           DrawNewLevelField(x, y);
+           DrawLevelField(x, y);
 
          PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
 
@@ -3237,7 +3250,7 @@ void StartMoving(int x, int y)
       else
       {
        Feld[newx][newy] = EL_EMPTY;
-       DrawNewLevelField(newx, newy);
+       DrawLevelField(newx, newy);
       }
 
       PlaySoundLevel(x, y, SND_YAMYAM_EATING);
@@ -3258,7 +3271,7 @@ void StartMoving(int x, int y)
       else
       {
        Feld[newx][newy] = EL_EMPTY;
-       DrawNewLevelField(newx, newy);
+       DrawLevelField(newx, newy);
       }
 
       PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING);
@@ -3284,7 +3297,7 @@ void StartMoving(int x, int y)
       else     /* element == EL_PACMAN */
       {
        Feld[newx][newy] = EL_EMPTY;
-       DrawNewLevelField(newx, newy);
+       DrawLevelField(newx, newy);
        PlaySoundLevel(x, y, SND_PACMAN_EATING);
       }
     }
@@ -3303,48 +3316,28 @@ void StartMoving(int x, int y)
 
       if (element == EL_BUG || element == EL_SPACESHIP ||
          element == EL_SP_SNIKSNAK)
-#if 0
        DrawLevelField(x, y);
-#else
-       DrawNewLevelField(x, y);
-#endif
       else if (element == EL_BUG || element == EL_SPACESHIP ||
               element == EL_SP_SNIKSNAK || element == EL_MOLE)
-#if 0
        DrawLevelField(x, y);
-#else
-       DrawNewLevelField(x, y);
-#endif
       else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
-#if 0
-       DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP);
-#else
-       DrawNewGraphicAnimation(x, y, el2img(element));
-#endif
+       DrawLevelElementAnimation(x, y, element);
       else if (element == EL_SATELLITE)
-#if 0
-       DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP);
-#else
-       DrawNewGraphicAnimation(x, y, IMG_SATELLITE);
-#endif
+       DrawLevelElementAnimation(x, y, element);
       else if (element == EL_SP_ELECTRON)
-#if 0
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
-#else
-       DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
-#endif
+       DrawLevelElementAnimation(x, y, element);
 
       if (DONT_TOUCH(element))
        TestIfBadThingTouchesHero(x, y);
 
-      PlaySoundLevelAction(x, y, SND_ACTION_WAITING);
+      PlaySoundLevelAction(x, y, ACTION_WAITING);
 
       return;
     }
 
     InitMovingField(x, y, MovDir[x][y]);
 
-    PlaySoundLevelAction(x, y, SND_ACTION_MOVING);
+    PlaySoundLevelAction(x, y, ACTION_MOVING);
   }
 
   if (MovDir[x][y])
@@ -3357,7 +3350,7 @@ void ContinueMoving(int x, int y)
   int direction = MovDir[x][y];
   int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
   int dy = (direction == MV_UP   ? -1 : direction == MV_DOWN  ? +1 : 0);
-  int horiz_move = (dx!=0);
+  int horiz_move = (dx != 0);
   int newx = x + dx, newy = y + dy;
   int step = (horiz_move ? dx : dy) * TILEX / 8;
 
@@ -3374,8 +3367,8 @@ void ContinueMoving(int x, int y)
   else if (CAN_FALL(element) && horiz_move &&
           y < lev_fieldy-1 && IS_BELT_ACTIVE(Feld[x][y+1]))
     step /= 2;
-  else if (element == EL_SPRING_MOVING)
-    step*=2;
+  else if (element == EL_SPRING && horiz_move)
+    step *= 2;
 
 #if OLD_GAME_BEHAVIOUR
   else if (CAN_FALL(element) && horiz_move && !IS_SP_ELEMENT(element))
@@ -3401,7 +3394,7 @@ void ContinueMoving(int x, int y)
       };
 
       Feld[x][y] = EL_SAND;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
 
       for(i=0; i<4; i++)
       {
@@ -3411,7 +3404,7 @@ void ContinueMoving(int x, int y)
        yy = y + xy[i][1];
 
        if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
-         DrawNewLevelField(xx, yy);    /* for "DrawCrumbledSand()" */
+         DrawLevelField(xx, yy);       /* for "DrawCrumbledSand()" */
       }
     }
 
@@ -3468,14 +3461,25 @@ void ContinueMoving(int x, int y)
     MovDelay[newx][newy] = 0;
 
     GfxAction[newx][newy] = GfxAction[x][y];   /* keep action one frame */
-    GfxAction[x][y] = GFX_ACTION_DEFAULT;
+    GfxAction[x][y] = ACTION_DEFAULT;
 
+#if 0
     if (!CAN_MOVE(element))
       MovDir[newx][newy] = 0;
+#else
+    /*
+    if (CAN_FALL(element) && MovDir[newx][newy] == MV_DOWN)
+      MovDir[newx][newy] = 0;
+    */
+
+    if (!CAN_MOVE(element) ||
+       (element == EL_SPRING && MovDir[newx][newy] == MV_DOWN))
+      MovDir[newx][newy] = 0;
+#endif
+
+    DrawLevelField(x, y);
+    DrawLevelField(newx, newy);
 
-    DrawNewLevelField(x, y);
-    DrawNewLevelField(newx, newy);
-
     Stop[newx][newy] = TRUE;
     JustStopped[newx][newy] = 3;
 
@@ -3494,10 +3498,16 @@ void ContinueMoving(int x, int y)
   }
   else                         /* still moving on */
   {
-    if (GfxAction[x][y] == GFX_ACTION_DEFAULT)
-      GfxAction[x][y] = GFX_ACTION_MOVING;
+#if 0
+    if (GfxAction[x][y] == ACTION_DEFAULT)
+    {
+      printf("reset GfxAction...\n");
 
-    DrawNewLevelField(x, y);
+      GfxAction[x][y] = ACTION_MOVING;
+    }
+#endif
+
+    DrawLevelField(x, y);
   }
 }
 
@@ -3668,7 +3678,7 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element)
        AmoebaNr[x][y] = 0;
        Feld[x][y] = new_element;
        InitField(x, y, FALSE);
-       DrawNewLevelField(x, y);
+       DrawLevelField(x, y);
        done = TRUE;
       }
     }
@@ -3703,22 +3713,18 @@ void AmoebeWaechst(int x, int y)
   {
     MovDelay[x][y]--;
     if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_AMOEBING + 3 - MovDelay[x][y]/2);
-#else
     {
-      int frame = getNewGraphicAnimationFrame(IMG_AMOEBA_CREATING,
-                                             6 - MovDelay[x][y]);
+      int frame = getGraphicAnimationFrame(IMG_AMOEBA_CREATING,
+                                          6 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame);
+      DrawGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame);
     }
-#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = Store[x][y];
       Store[x][y] = 0;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
     }
   }
 }
@@ -3740,21 +3746,17 @@ void AmoebaDisappearing(int x, int y)
   {
     MovDelay[x][y]--;
     if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_AMOEBING + MovDelay[x][y]/2);
-#else
     {
-      int frame = getNewGraphicAnimationFrame(IMG_AMOEBA_SHRINKING,
-                                             6 - MovDelay[x][y]);
+      int frame = getGraphicAnimationFrame(IMG_AMOEBA_SHRINKING,
+                                          6 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame);
+      DrawGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame);
     }
-#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_EMPTY;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
 
       /* don't let mole enter this field in this cycle;
         (give priority to objects falling to this field from above) */
@@ -3779,7 +3781,7 @@ void AmoebeAbleger(int ax, int ay)
   if (!level.amoeba_speed)
   {
     Feld[ax][ay] = EL_AMOEBA_DEAD;
-    DrawNewLevelField(ax, ay);
+    DrawLevelField(ax, ay);
     return;
   }
 
@@ -3842,7 +3844,7 @@ void AmoebeAbleger(int ax, int ay)
       if (i == 4 && (!waiting_for_player || game.emulation == EMU_BOULDERDASH))
       {
        Feld[ax][ay] = EL_AMOEBA_DEAD;
-       DrawNewLevelField(ax, ay);
+       DrawLevelField(ax, ay);
        AmoebaCnt[AmoebaNr[ax][ay]]--;
 
        if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0)   /* amoeba is completely dead */
@@ -3905,7 +3907,7 @@ void AmoebeAbleger(int ax, int ay)
     return;
   }
 
-  DrawNewLevelField(newax, neway);
+  DrawLevelField(newax, neway);
 }
 
 void Life(int ax, int ay)
@@ -3957,7 +3959,7 @@ void Life(int ax, int ay)
       {
        Feld[xx][yy] = EL_EMPTY;
        if (!Stop[xx][yy])
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        Stop[xx][yy] = TRUE;
        changed = TRUE;
       }
@@ -3969,7 +3971,7 @@ void Life(int ax, int ay)
        Feld[xx][yy] = element;
        MovDelay[xx][yy] = (element == EL_GAMEOFLIFE ? 0 : life_time-1);
        if (!Stop[xx][yy])
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        Stop[xx][yy] = TRUE;
        changed = TRUE;
       }
@@ -3981,6 +3983,23 @@ void Life(int ax, int ay)
                   SND_BIOMAZE_CREATING);
 }
 
+static void InitRobotWheel(int x, int y)
+{
+  MovDelay[x][y] = level.time_wheel * FRAMES_PER_SECOND;
+}
+
+static void RunRobotWheel(int x, int y)
+{
+  PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE);
+}
+
+static void StopRobotWheel(int x, int y)
+{
+  if (ZX == x && ZY == y)
+    ZX = ZY = -1;
+}
+
+#if 1
 void RobotWheel(int x, int y)
 {
   if (!MovDelay[x][y])         /* next animation frame */
@@ -3992,27 +4011,37 @@ void RobotWheel(int x, int y)
     if (MovDelay[x][y])
     {
       if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-       DrawGraphic(SCREENX(x), SCREENY(y), GFX_ABLENK+MovDelay[x][y]%4);
-#else
-    {
-      int frame = getNewGraphicAnimationFrame(IMG_ROBOT_WHEEL_ACTIVE, -1);
+      {
+       int frame = getGraphicAnimationFrame(IMG_ROBOT_WHEEL_ACTIVE, -1);
+
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame);
+      }
+
+      PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame);
-    }
-#endif
-      if (!(MovDelay[x][y]%4))
-       PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE);
       return;
     }
   }
 
   Feld[x][y] = EL_ROBOT_WHEEL;
-  DrawNewLevelField(x, y);
+  DrawLevelField(x, y);
+
   if (ZX == x && ZY == y)
     ZX = ZY = -1;
 }
+#endif
+
+static void InitTimegateWheel(int x, int y)
+{
+  MovDelay[x][y] = level.time_wheel * FRAMES_PER_SECOND;
+}
+
+static void RunTimegateWheel(int x, int y)
+{
+  PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE);
+}
 
+#if 1
 void TimegateWheel(int x, int y)
 {
   if (!MovDelay[x][y])         /* next animation frame */
@@ -4024,40 +4053,32 @@ void TimegateWheel(int x, int y)
     if (MovDelay[x][y])
     {
       if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-       DrawGraphic(SCREENX(x), SCREENY(y),
-                   GFX_TIMEGATE_SWITCH + MovDelay[x][y]%4);
-#else
-    {
-      int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_SWITCH_ACTIVE, -1);
+      {
+       int frame = getGraphicAnimationFrame(IMG_TIMEGATE_SWITCH_ACTIVE, -1);
+
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame);
+      }
+
+      PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame);
-    }
-#endif
-      if (!(MovDelay[x][y]%4))
-       PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE);
       return;
     }
   }
 
   Feld[x][y] = EL_TIMEGATE_SWITCH;
-  DrawNewLevelField(x, y);
+  DrawLevelField(x, y);
+
+  /* THIS HAS NO EFFECT AT ALL! */
+#if 1
+  /* !!! THIS LOOKS WRONG !!! */
   if (ZX == x && ZY == y)
     ZX = ZY = -1;
-}
-
-void Blubber(int x, int y)
-{
-#if 0
-  if (y > 0 && IS_MOVING(x, y - 1) && MovDir[x][y - 1] == MV_DOWN)
-    DrawNewLevelField(x, y - 1);
-  else
-    DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP);
-#else
-  DrawNewGraphicAnimation(x, y, IMG_ACID);
 #endif
+
 }
+#endif
 
+#if 1
 void NussKnacken(int x, int y)
 {
   if (!MovDelay[x][y])         /* next animation frame */
@@ -4066,27 +4087,26 @@ void NussKnacken(int x, int y)
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
     MovDelay[x][y]--;
-    if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y),
-                 GFX_CRACKINGNUT + 3 - MovDelay[x][y]/2);
-#else
+    if (MovDelay[x][y])
     {
-      int frame = getNewGraphicAnimationFrame(IMG_NUT_CRACKING,
-                                             6 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_NUT_CRACKING,
+                                            6 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame);
-    }
-#endif
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame);
+      }
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_EMERALD;
-      DrawNewLevelField(x, y);
+      return;
     }
   }
+
+  Feld[x][y] = EL_EMERALD;
+  DrawLevelField(x, y);
 }
+#endif
 
+#if 1
 void BreakingPearl(int x, int y)
 {
   if (!MovDelay[x][y])         /* next animation frame */
@@ -4095,41 +4115,33 @@ void BreakingPearl(int x, int y)
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
     MovDelay[x][y]--;
-    if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y),
-                 GFX_PEARL_BREAKING + 4 - MovDelay[x][y]/2);
-#else
+    if (MovDelay[x][y])
     {
-      int frame = getNewGraphicAnimationFrame(IMG_PEARL_BREAKING,
-                                             8 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_PEARL_BREAKING,
+                                            8 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame);
-    }
-#endif
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame);
+      }
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_EMPTY;
-      DrawNewLevelField(x, y);
+      return;
     }
   }
+
+  Feld[x][y] = EL_EMPTY;
+  DrawLevelField(x, y);
 }
+#endif
 
 void SiebAktivieren(int x, int y, int type)
 {
-#if 0
-  int graphic = (type == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3;
-
-  DrawGraphicAnimation(x, y, graphic, 4, 4, ANIM_REVERSE);
-#else
   int graphic = (type == 1 ? IMG_MAGIC_WALL_FULL : IMG_BD_MAGIC_WALL_FULL);
 
-  DrawNewGraphicAnimation(x, y, graphic);
-#endif
+  DrawLevelGraphicAnimation(x, y, graphic);
 }
 
-void AusgangstuerPruefen(int x, int y)
+void CheckExit(int x, int y)
 {
   if (local_player->gems_still_needed > 0 ||
       local_player->sokobanfields_still_needed > 0 ||
@@ -4138,27 +4150,20 @@ void AusgangstuerPruefen(int x, int y)
 
   Feld[x][y] = EL_EXIT_OPENING;
 
-  PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) :
-                (x > LEVELX(BX2) ? LEVELX(BX2) : x),
-                y < LEVELY(BY1) ? LEVELY(BY1) :
-                (y > LEVELY(BY2) ? LEVELY(BY2) : y),
-                SND_EXIT_OPENING);
+  PlaySoundLevelNearest(x, y, SND_EXIT_OPENING);
 }
 
-void AusgangstuerPruefen_SP(int x, int y)
+void CheckExitSP(int x, int y)
 {
   if (local_player->gems_still_needed > 0)
     return;
 
   Feld[x][y] = EL_SP_EXIT_OPEN;
 
-  PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) :
-                (x > LEVELX(BX2) ? LEVELX(BX2) : x),
-                y < LEVELY(BY1) ? LEVELY(BY1) :
-                (y > LEVELY(BY2) ? LEVELY(BY2) : y),
-                SND_SP_EXIT_OPENING);
+  PlaySoundLevelNearest(x, y, SND_SP_EXIT_OPENING);
 }
 
+#if 1
 void AusgangstuerOeffnen(int x, int y)
 {
   int delay = 6;
@@ -4171,36 +4176,29 @@ void AusgangstuerOeffnen(int x, int y)
     int tuer;
 
     MovDelay[x][y]--;
-    tuer = MovDelay[x][y]/delay;
-    if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_AUSGANG_AUF-tuer);
-#else
+    tuer = MovDelay[x][y] / delay;
+
+    if (!(MovDelay[x][y] % delay))
     {
-      int frame = getNewGraphicAnimationFrame(IMG_EXIT_OPENING,
-                                             29 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_EXIT_OPENING,
+                                            29 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame);
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame);
+      }
     }
-#endif
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_EXIT_OPEN;
-      DrawNewLevelField(x, y);
-    }
+    if (MovDelay[x][y])
+      return;
   }
-}
 
-void AusgangstuerBlinken(int x, int y)
-{
-#if 0
-  DrawGraphicAnimation(x, y, GFX_AUSGANG_AUF, 4, 4, ANIM_PINGPONG);
-#else
-  DrawNewGraphicAnimation(x, y, IMG_EXIT_OPEN);
-#endif
+  Feld[x][y] = EL_EXIT_OPEN;
+  DrawLevelField(x, y);
 }
+#endif
 
+#if 1
 void OpenSwitchgate(int x, int y)
 {
   int delay = 6;
@@ -4210,30 +4208,29 @@ void OpenSwitchgate(int x, int y)
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
-    int phase;
-
     MovDelay[x][y]--;
-    phase = MovDelay[x][y] / delay;
-    if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_OPEN - phase);
-#else
+
+    if (!(MovDelay[x][y] % delay))
     {
-      int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_OPENING,
-                                             29 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_SWITCHGATE_OPENING,
+                                            29 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame);
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame);
+      }
     }
-#endif
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_SWITCHGATE_OPEN;
-      DrawNewLevelField(x, y);
-    }
+    if (MovDelay[x][y])
+      return;
   }
+
+  Feld[x][y] = EL_SWITCHGATE_OPEN;
+  DrawLevelField(x, y);
 }
+#endif
 
+#if 1
 void CloseSwitchgate(int x, int y)
 {
   int delay = 6;
@@ -4243,30 +4240,29 @@ void CloseSwitchgate(int x, int y)
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
-    int phase;
-
     MovDelay[x][y]--;
-    phase = MovDelay[x][y] / delay;
-    if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_SWITCHGATE_CLOSED + phase);
-#else
+
+    if (!(MovDelay[x][y] % delay))
     {
-      int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING,
-                                             29 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING,
+                                            29 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame);
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame);
+      }
     }
-#endif
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_SWITCHGATE_CLOSED;
-      DrawNewLevelField(x, y);
-    }
+    if (MovDelay[x][y])
+      return;
   }
+
+  Feld[x][y] = EL_SWITCHGATE_CLOSED;
+  DrawLevelField(x, y);
 }
+#endif
 
+#if 1
 void OpenTimegate(int x, int y)
 {
   int delay = 6;
@@ -4276,30 +4272,29 @@ void OpenTimegate(int x, int y)
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
-    int phase;
-
     MovDelay[x][y]--;
-    phase = MovDelay[x][y] / delay;
-    if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_OPEN - phase);
-#else
+
+    if (!(MovDelay[x][y] % delay))
     {
-      int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_OPENING,
-                                             29 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_TIMEGATE_OPENING,
+                                            29 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame);
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame);
+      }
     }
-#endif
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_TIMEGATE_OPEN;
-      DrawNewLevelField(x, y);
-    }
+    if (MovDelay[x][y])
+      return;
   }
+
+  Feld[x][y] = EL_TIMEGATE_OPEN;
+  DrawLevelField(x, y);
 }
+#endif
 
+#if 1
 void CloseTimegate(int x, int y)
 {
   int delay = 6;
@@ -4309,29 +4304,27 @@ void CloseTimegate(int x, int y)
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
-    int phase;
-
     MovDelay[x][y]--;
-    phase = MovDelay[x][y] / delay;
-    if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), GFX_TIMEGATE_CLOSED + phase);
-#else
+
+    if (!(MovDelay[x][y] % delay))
     {
-      int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_CLOSING,
-                                             29 - MovDelay[x][y]);
+      if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+      {
+       int frame = getGraphicAnimationFrame(IMG_TIMEGATE_CLOSING,
+                                            29 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame);
+       DrawGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame);
+      }
     }
-#endif
 
-    if (!MovDelay[x][y])
-    {
-      Feld[x][y] = EL_TIMEGATE_CLOSED;
-      DrawNewLevelField(x, y);
-    }
+    if (MovDelay[x][y])
+      return;
   }
+
+  Feld[x][y] = EL_TIMEGATE_CLOSED;
+  DrawLevelField(x, y);
 }
+#endif
 
 static void CloseAllOpenTimegates()
 {
@@ -4359,16 +4352,16 @@ void EdelsteinFunkeln(int x, int y)
 
   if (Feld[x][y] == EL_BD_DIAMOND)
 #if 0
-    DrawGraphicAnimation(x, y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE);
+    DrawLevelElementAnimation(x, y, el2img(Feld[x][y]));
 #else
-    DrawNewGraphicAnimation(x, y, IMG_BD_DIAMOND);
+    return;
 #endif
   else
   {
-    if (!MovDelay[x][y])       /* next animation frame */
+    if (MovDelay[x][y] == 0)   /* next animation frame */
       MovDelay[x][y] = 11 * !SimpleRND(500);
 
-    if (MovDelay[x][y])                /* wait some time before next frame */
+    if (MovDelay[x][y] != 0)   /* wait some time before next frame */
     {
       MovDelay[x][y]--;
 
@@ -4376,29 +4369,17 @@ void EdelsteinFunkeln(int x, int y)
        SetDrawtoField(DRAW_BUFFERED);
 
 #if 0
-      DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y]));
+      DrawGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0);
 #else
-      DrawNewGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0);
+      DrawLevelElementAnimation(x, y, Feld[x][y]);
 #endif
 
-      if (MovDelay[x][y])
+      if (MovDelay[x][y] != 0)
       {
-       int phase = (MovDelay[x][y]-1)/2;
-
-       if (phase > 2)
-         phase = 4-phase;
-
-#if 0
-       DrawGraphicThruMask(SCREENX(x), SCREENY(y), GFX_FUNKELN_WEISS + phase);
-#else
-       {
-         int frame = getNewGraphicAnimationFrame(IMG_TWINKLE_WHITE,
-                                                 10 - MovDelay[x][y]);
+       int frame = getGraphicAnimationFrame(IMG_TWINKLE_WHITE,
+                                            10 - MovDelay[x][y]);
 
-         DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE,
-                                frame);
-       }
-#endif
+       DrawGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE, frame);
 
        if (setup.direct_draw)
        {
@@ -4425,54 +4406,43 @@ void MauerWaechst(int x, int y)
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
-    int phase;
-
     MovDelay[x][y]--;
-    phase = 2 - MovDelay[x][y] / delay;
-#if 0
-    if (!(MovDelay[x][y]%delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-      DrawGraphic(SCREENX(x), SCREENY(y),
-                 (MovDir[x][y] == MV_LEFT  ? GFX_MAUER_LEFT  :
-                  MovDir[x][y] == MV_RIGHT ? GFX_MAUER_RIGHT :
-                  MovDir[x][y] == MV_UP    ? GFX_MAUER_UP    :
-                                             GFX_MAUER_DOWN  ) + phase);
-#else
+
     if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
     {
       int graphic = el_dir2img(Feld[x][y], MovDir[x][y]);
-      int frame = getNewGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]);
+      int frame = getGraphicAnimationFrame(graphic, 17 - MovDelay[x][y]);
 
-      DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      DrawGraphic(SCREENX(x), SCREENY(y), graphic, frame);
     }
-#endif
 
     if (!MovDelay[x][y])
     {
       if (MovDir[x][y] == MV_LEFT)
       {
        if (IN_LEV_FIELD(x - 1, y) && IS_MAUER(Feld[x - 1][y]))
-         DrawNewLevelField(x - 1, y);
+         DrawLevelField(x - 1, y);
       }
       else if (MovDir[x][y] == MV_RIGHT)
       {
        if (IN_LEV_FIELD(x + 1, y) && IS_MAUER(Feld[x + 1][y]))
-         DrawNewLevelField(x + 1, y);
+         DrawLevelField(x + 1, y);
       }
       else if (MovDir[x][y] == MV_UP)
       {
        if (IN_LEV_FIELD(x, y - 1) && IS_MAUER(Feld[x][y - 1]))
-         DrawNewLevelField(x, y - 1);
+         DrawLevelField(x, y - 1);
       }
       else
       {
        if (IN_LEV_FIELD(x, y + 1) && IS_MAUER(Feld[x][y + 1]))
-         DrawNewLevelField(x, y + 1);
+         DrawLevelField(x, y + 1);
       }
 
       Feld[x][y] = Store[x][y];
       Store[x][y] = 0;
       MovDir[x][y] = MV_NO_MOVING;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
     }
   }
 }
@@ -4513,12 +4483,8 @@ void MauerAbleger(int ax, int ay)
       Store[ax][ay-1] = element;
       MovDir[ax][ay-1] = MV_UP;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay-1)))
-#if 0
-       DrawGraphic(SCREENX(ax), SCREENY(ay-1), GFX_MAUER_UP);
-#else
-       DrawNewGraphic(SCREENX(ax), SCREENY(ay - 1),
-                      IMG_WALL_GROWING_ACTIVE_UP, 0);
-#endif
+       DrawGraphic(SCREENX(ax), SCREENY(ay - 1),
+                   IMG_WALL_GROWING_ACTIVE_UP, 0);
       new_wall = TRUE;
     }
     if (unten_frei)
@@ -4527,12 +4493,8 @@ void MauerAbleger(int ax, int ay)
       Store[ax][ay+1] = element;
       MovDir[ax][ay+1] = MV_DOWN;
       if (IN_SCR_FIELD(SCREENX(ax), SCREENY(ay+1)))
-#if 0
-       DrawGraphic(SCREENX(ax), SCREENY(ay+1), GFX_MAUER_DOWN);
-#else
-       DrawNewGraphic(SCREENX(ax), SCREENY(ay + 1),
-                      IMG_WALL_GROWING_ACTIVE_DOWN, 0);
-#endif
+       DrawGraphic(SCREENX(ax), SCREENY(ay + 1),
+                   IMG_WALL_GROWING_ACTIVE_DOWN, 0);
       new_wall = TRUE;
     }
   }
@@ -4546,12 +4508,8 @@ void MauerAbleger(int ax, int ay)
       Store[ax-1][ay] = element;
       MovDir[ax-1][ay] = MV_LEFT;
       if (IN_SCR_FIELD(SCREENX(ax-1), SCREENY(ay)))
-#if 0
-       DrawGraphic(SCREENX(ax-1), SCREENY(ay), GFX_MAUER_LEFT);
-#else
-       DrawNewGraphic(SCREENX(ax - 1), SCREENY(ay),
-                      IMG_WALL_GROWING_ACTIVE_LEFT, 0);
-#endif
+       DrawGraphic(SCREENX(ax - 1), SCREENY(ay),
+                   IMG_WALL_GROWING_ACTIVE_LEFT, 0);
       new_wall = TRUE;
     }
 
@@ -4561,18 +4519,14 @@ void MauerAbleger(int ax, int ay)
       Store[ax+1][ay] = element;
       MovDir[ax+1][ay] = MV_RIGHT;
       if (IN_SCR_FIELD(SCREENX(ax+1), SCREENY(ay)))
-#if 0
-       DrawGraphic(SCREENX(ax+1), SCREENY(ay), GFX_MAUER_RIGHT);
-#else
-       DrawNewGraphic(SCREENX(ax + 1), SCREENY(ay),
-                      IMG_WALL_GROWING_ACTIVE_RIGHT, 0);
-#endif
+       DrawGraphic(SCREENX(ax + 1), SCREENY(ay),
+                   IMG_WALL_GROWING_ACTIVE_RIGHT, 0);
       new_wall = TRUE;
     }
   }
 
   if (element == EL_WALL_GROWING && (links_frei || rechts_frei))
-    DrawNewLevelField(ax, ay);
+    DrawLevelField(ax, ay);
 
   if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1]))
     oben_massiv = TRUE;
@@ -4633,7 +4587,7 @@ void CheckForDragon(int x, int y)
        if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES)
        {
          Feld[xx][yy] = EL_EMPTY;
-         DrawNewLevelField(xx, yy);
+         DrawLevelField(xx, yy);
        }
        else
          break;
@@ -4642,96 +4596,155 @@ void CheckForDragon(int x, int y)
   }
 }
 
-static void CheckBuggyBase(int x, int y)
+static void InitBuggyBase(int x, int y)
 {
   int element = Feld[x][y];
+  int activating_delay = FRAMES_PER_SECOND / 4;
+
+  MovDelay[x][y] =
+    (element == EL_SP_BUGGY_BASE ?
+     2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND) - activating_delay :
+     element == EL_SP_BUGGY_BASE_ACTIVATING ?
+     activating_delay :
+     element == EL_SP_BUGGY_BASE_ACTIVE ?
+     1 * FRAMES_PER_SECOND + RND(1 * FRAMES_PER_SECOND) : 1);
+}
 
-  if (element == EL_SP_BUGGY_BASE)
+static void WarnBuggyBase(int x, int y)
+{
+  int i;
+  static int xy[4][2] =
   {
-    if (!MovDelay[x][y])       /* wait some time before activating base */
-      MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND);
+    { 0, -1 },
+    { -1, 0 },
+    { +1, 0 },
+    { 0, +1 }
+  };
 
-    if (MovDelay[x][y])
+  for (i=0; i<4; i++)
+  {
+    int xx = x + xy[i][0], yy = y + xy[i][1];
+
+    if (IS_PLAYER(xx, yy))
     {
-      MovDelay[x][y]--;
-      if (MovDelay[x][y] < 5 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-       DrawGraphic(SCREENX(x), SCREENY(y), GFX_SP_BUG_WARNING);
-#else
-        DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SP_BUGGY_BASE, 0);
-#endif
-      if (MovDelay[x][y])
-       return;
+      PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVE);
 
-      Feld[x][y] = EL_SP_BUGGY_BASE_ACTIVE;
+      break;
     }
   }
-  else if (element == EL_SP_BUGGY_BASE_ACTIVE)
+}
+
+#if 1
+void CheckBuggyBase(int x, int y)
+{
+  int element = Feld[x][y];
+
+  if (element == EL_SP_BUGGY_BASE)
   {
-    if (!MovDelay[x][y])       /* start activating buggy base */
-      MovDelay[x][y] = 1 * FRAMES_PER_SECOND + RND(1 * FRAMES_PER_SECOND);
+    if (MovDelay[x][y] == 0)   /* wait some time before activating base */
+    {
+      GfxFrame[x][y] = 0;
 
-    if (MovDelay[x][y])
+      InitBuggyBase(x, y);
+    }
+
+    MovDelay[x][y]--;
+
+    if (MovDelay[x][y] != 0)
     {
-      MovDelay[x][y]--;
-      if (MovDelay[x][y])
-      {
-       int i;
-       static int xy[4][2] =
-       {
-         { 0, -1 },
-         { -1, 0 },
-         { +1, 0 },
-         { 0, +1 }
-       };
+      DrawLevelElementAnimation(x, y, element);
+    }
+    else
+    {
+      Feld[x][y] = EL_SP_BUGGY_BASE_ACTIVATING;
+      DrawLevelField(x, y);
+    }
+  }
+  else if (element == EL_SP_BUGGY_BASE_ACTIVATING)
+  {
+    if (MovDelay[x][y] == 0)   /* display activation warning of buggy base */
+    {
+      GfxFrame[x][y] = 0;
 
-       if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-#if 0
-         DrawGraphic(SCREENX(x),SCREENY(y), GFX_SP_BUG_ACTIVE + SimpleRND(4));
-#else
-       {
-         int graphic = IMG_SP_BUGGY_BASE_ACTIVE;
-         int frame = getNewGraphicAnimationFrame(graphic, SimpleRND(100));
+      InitBuggyBase(x, y);
+    }
 
-          DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
-       }
-#endif
+    MovDelay[x][y]--;
 
-       for (i=0; i<4; i++)
-       {
-         int xx = x + xy[i][0], yy = y + xy[i][1];
+    if (MovDelay[x][y] != 0)
+    {
+      DrawLevelElementAnimation(x, y, element);
+    }
+    else
+    {
+      Feld[x][y] = EL_SP_BUGGY_BASE_ACTIVE;
+      DrawLevelField(x, y);
+    }
+  }
+  else if (element == EL_SP_BUGGY_BASE_ACTIVE)
+  {
+    if (MovDelay[x][y] == 0)   /* start activating buggy base */
+    {
+      GfxFrame[x][y] = 0;
 
-         if (IS_PLAYER(xx, yy))
-         {
-           PlaySoundLevel(x, y, SND_SP_BUGGY_BASE_ACTIVE);
-           break;
-         }
-       }
+      InitBuggyBase(x, y);
+    }
 
-       return;
-      }
+    MovDelay[x][y]--;
+
+    if (MovDelay[x][y] != 0)
+    {
+      DrawLevelElementAnimation(x, y, element);
 
+      WarnBuggyBase(x, y);
+    }
+    else
+    {
       Feld[x][y] = EL_SP_BUGGY_BASE;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
     }
   }
 }
+#endif
+
+static void InitTrap(int x, int y)
+{
+  MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND);
+}
+
+static void ActivateTrap(int x, int y)
+{
+  PlaySoundLevel(x, y, SND_TRAP_ACTIVATING);
+}
+
+static void ChangeActiveTrap(int x, int y)
+{
+  int graphic = IMG_TRAP_ACTIVE;
+
+  /* if animation frame already drawn, correct crumbled sand border */
+  if (IS_ANIMATED(graphic))
+    if (checkDrawLevelGraphicAnimation(x, y, graphic))
+      DrawCrumbledSand(SCREENX(x), SCREENY(y));
+}
 
-static void CheckTrap(int x, int y)
+#if 1
+void CheckTrap(int x, int y)
 {
   int element = Feld[x][y];
 
   if (element == EL_TRAP)
   {
-    if (!MovDelay[x][y])       /* wait some time before activating trap */
+    if (MovDelay[x][y] == 0)   /* wait some time before activating trap */
       MovDelay[x][y] = 2 * FRAMES_PER_SECOND + RND(5 * FRAMES_PER_SECOND);
 
-    if (MovDelay[x][y])
-    {
-      MovDelay[x][y]--;
-      if (MovDelay[x][y])
-       return;
+    MovDelay[x][y]--;
 
+    if (MovDelay[x][y] != 0)
+    {
+      /* do nothing while waiting */
+    }
+    else
+    {
       Feld[x][y] = EL_TRAP_ACTIVE;
       PlaySoundLevel(x, y, SND_TRAP_ACTIVATING);
     }
@@ -4741,46 +4754,29 @@ static void CheckTrap(int x, int y)
     int delay = 4;
     int num_frames = 8;
 
-    if (!MovDelay[x][y])       /* start activating trap */
-      MovDelay[x][y] = num_frames * delay;
-
-    if (MovDelay[x][y])
+    if (MovDelay[x][y] == 0)   /* start activating trap */
     {
-      MovDelay[x][y]--;
-
-      if (MovDelay[x][y])
-      {
-       if (!(MovDelay[x][y] % delay))
-       {
-         int phase = MovDelay[x][y]/delay;
-
-         if (phase >= num_frames/2)
-           phase = num_frames - phase;
-
-         if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
-         {
-#if 0
-           DrawGraphic(SCREENX(x),SCREENY(y), GFX_TRAP_INACTIVE + phase - 1);
-#else
-           int graphic = IMG_TRAP_ACTIVE;
-           int frame = getNewGraphicAnimationFrame(graphic,
-                                                   31 - MovDelay[x][y]);
-
-           DrawNewGraphic(SCREENX(x),SCREENY(y), graphic, frame);
-#endif
-           DrawCrumbledSand(SCREENX(x), SCREENY(y));
-         }
-       }
+      MovDelay[x][y] = num_frames * delay;
+      GfxFrame[x][y] = 0;
+    }
 
-       return;
-      }
+    MovDelay[x][y]--;
 
+    if (MovDelay[x][y] != 0)
+    {
+      if (DrawLevelElementAnimation(x, y, element))
+       DrawCrumbledSand(SCREENX(x), SCREENY(y));
+    }
+    else
+    {
       Feld[x][y] = EL_TRAP;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
     }
   }
 }
+#endif
 
+#if 1
 static void DrawBeltAnimation(int x, int y, int element)
 {
   int belt_nr = getBeltNrFromBeltActiveElement(element);
@@ -4788,20 +4784,46 @@ static void DrawBeltAnimation(int x, int y, int element)
 
   if (belt_dir != MV_NO_MOVING)
   {
-#if 0
-    int delay = 2;
-    int mode = ANIM_LOOP | (belt_dir == MV_LEFT ? 0 : ANIM_REVERSE);
-    int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7);
-
-    DrawGraphicAnimation(x, y, graphic, 8, delay, mode);
-#else
-    int graphic = el2img(element);
+    DrawLevelElementAnimation(x, y, element);
 
-    DrawNewGraphicAnimation(x, y, graphic);
+    if (!(FrameCounter % 2))
+      PlaySoundLevelAction(x, y, ACTION_ACTIVE);
+  }
+}
 #endif
 
-    if (!(FrameCounter % 2))
-      PlaySoundLevel(x, y, SND_CONVEYOR_BELT_ACTIVE);
+static void ChangeElement(int x, int y)
+{
+  int element = Feld[x][y];
+
+  if (MovDelay[x][y] == 0)             /* initialize element change */
+  {
+    MovDelay[x][y] = changing_element[element].change_delay + 1;
+    GfxFrame[x][y] = 0;
+
+    if (changing_element[element].pre_change_function)
+      changing_element[element].pre_change_function(x, y);
+  }
+
+  MovDelay[x][y]--;
+
+  if (MovDelay[x][y] != 0)             /* continue element change */
+  {
+    if (IS_ANIMATED(el2img(element)))
+      DrawLevelElementAnimation(x, y, element);
+
+    if (changing_element[element].change_function)
+      changing_element[element].change_function(x, y);
+  }
+  else                                 /* finish element change */
+  {
+    Feld[x][y] = changing_element[element].next_element;
+    GfxFrame[x][y] = 0;
+
+    DrawLevelField(x, y);
+
+    if (changing_element[element].post_change_function)
+      changing_element[element].post_change_function(x, y);
   }
 }
 
@@ -4895,6 +4917,7 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
     */
 #endif 
 
+    /* if the player does not move for some time, reset animation to start */
     if (++player->frame_reset_delay > player->move_delay_value)
       player->Frame = 0;
   }
@@ -4950,7 +4973,7 @@ void GameActions()
   static unsigned long action_delay = 0;
   unsigned long action_delay_value;
   int sieb_x = 0, sieb_y = 0;
-  int i, x, y, element;
+  int i, x, y, element, graphic;
   byte *recorded_player_action;
   byte summarized_player_action = 0;
 
@@ -5054,8 +5077,6 @@ void GameActions()
 #endif
 #endif
 
-
-
   FrameCounter++;
   TimeFrames++;
 
@@ -5065,6 +5086,8 @@ void GameActions()
     if (JustStopped[x][y] > 0)
       JustStopped[x][y]--;
 
+    GfxFrame[x][y]++;
+
 #if DEBUG
     if (IS_BLOCKED(x, y))
     {
@@ -5085,24 +5108,60 @@ void GameActions()
   for (y=0; y<lev_fieldy; y++) for (x=0; x<lev_fieldx; x++)
   {
     element = Feld[x][y];
+    graphic = el2img(element);
 
     if (IS_INACTIVE(element))
+    {
+
+#if 1
+      if (IS_ANIMATED(graphic))
+       DrawLevelGraphicAnimation(x, y, graphic);
+#endif
+
       continue;
+    }
 
     if (!IS_MOVING(x, y) && (CAN_FALL(element) || CAN_MOVE(element)))
     {
       StartMoving(x, y);
 
+#if 1
+#if 0
+      if (Feld[x][y] == EL_EMERALD &&
+         IS_ANIMATED(graphic) &&
+         !IS_MOVING(x, y))
+       DrawLevelGraphicAnimation(x, y, graphic);
+#else
+      if (IS_ANIMATED(graphic) &&
+         !IS_MOVING(x, y))
+       DrawLevelGraphicAnimation(x, y, graphic);
+#endif
+#endif
+
       if (IS_GEM(element) || element == EL_SP_INFOTRON)
        EdelsteinFunkeln(x, y);
     }
+
+#if 1
+    else if ((element == EL_ACID ||
+             element == EL_EXIT_OPEN ||
+             element == EL_SP_EXIT_OPEN ||
+             element == EL_SP_TERMINAL ||
+             element == EL_SP_TERMINAL_ACTIVE ||
+             element == EL_EXTRA_TIME ||
+             element == EL_SHIELD_NORMAL ||
+             element == EL_SHIELD_DEADLY) &&
+            IS_ANIMATED(graphic))
+      DrawLevelGraphicAnimation(x, y, graphic);
+#endif
+
     else if (IS_MOVING(x, y))
       ContinueMoving(x, y);
     else if (IS_ACTIVE_BOMB(element))
       CheckDynamite(x, y);
 #if 0
     else if (element == EL_EXPLOSION && !game.explosions_delayed)
-      Explode(x, y, Frame[x][y], EX_NORMAL);
+      Explode(x, y, ExplodePhase[x][y], EX_NORMAL);
 #endif
     else if (element == EL_AMOEBA_CREATING)
       AmoebeWaechst(x, y);
@@ -5116,29 +5175,29 @@ void GameActions()
 
     else if (element == EL_GAMEOFLIFE || element == EL_BIOMAZE)
       Life(x, y);
+#if 0
     else if (element == EL_ROBOT_WHEEL_ACTIVE)
       RobotWheel(x, y);
     else if (element == EL_TIMEGATE_SWITCH_ACTIVE)
       TimegateWheel(x, y);
-    else if (element == EL_ACID)
-      Blubber(x, y);
+#endif
     else if (element == EL_ACID_SPLASH_LEFT ||
             element == EL_ACID_SPLASH_RIGHT)
       Blurb(x, y);
+#if 0
     else if (element == EL_NUT_CRACKING)
       NussKnacken(x, y);
     else if (element == EL_PEARL_BREAKING)
       BreakingPearl(x, y);
+#endif
     else if (element == EL_EXIT_CLOSED)
-      AusgangstuerPruefen(x, y);
+      CheckExit(x, y);
     else if (element == EL_SP_EXIT_CLOSED)
-      AusgangstuerPruefen_SP(x, y);
+      CheckExitSP(x, y);
+#if 0
     else if (element == EL_EXIT_OPENING)
       AusgangstuerOeffnen(x, y);
-    else if (element == EL_EXIT_OPEN)
-      AusgangstuerBlinken(x, y);
-    else if (element == EL_SP_EXIT_OPEN)
-      ;                /* !!! ADD SOME (OPTIONAL) ANIMATIONS HERE !!! */
+#endif
     else if (element == EL_WALL_GROWING_ACTIVE)
       MauerWaechst(x, y);
     else if (element == EL_WALL_GROWING ||
@@ -5148,29 +5207,14 @@ void GameActions()
       MauerAbleger(x, y);
     else if (element == EL_FLAMES)
       CheckForDragon(x, y);
-    else if (element == EL_SP_BUGGY_BASE || element == EL_SP_BUGGY_BASE_ACTIVE)
+#if 0
+    else if (element == EL_SP_BUGGY_BASE ||
+            element == EL_SP_BUGGY_BASE_ACTIVATING ||
+            element == EL_SP_BUGGY_BASE_ACTIVE)
       CheckBuggyBase(x, y);
-    else if (element == EL_TRAP || element == EL_TRAP_ACTIVE)
+    else if (element == EL_TRAP ||
+            element == EL_TRAP_ACTIVE)
       CheckTrap(x, y);
-    else if (element == EL_SP_TERMINAL)
-#if 0
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_LOOP);
-#else
-      DrawNewGraphicAnimation(x, y, IMG_SP_TERMINAL);
-#endif
-    else if (element == EL_SP_TERMINAL_ACTIVE)
-    {
-#if 0
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_LOOP);
-#else
-      DrawNewGraphicAnimation(x, y, IMG_SP_TERMINAL_ACTIVE);
-#endif
-
-#if 0
-      if (!(FrameCounter % 4))
-       PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE);
-#endif
-    }
     else if (IS_BELT_ACTIVE(element))
       DrawBeltAnimation(x, y, element);
     else if (element == EL_SWITCHGATE_OPENING)
@@ -5181,38 +5225,20 @@ void GameActions()
       OpenTimegate(x, y);
     else if (element == EL_TIMEGATE_CLOSING)
       CloseTimegate(x, y);
-    else if (element == EL_EXTRA_TIME)
-#if 0
-      DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_LOOP);
-#else
-      DrawNewGraphicAnimation(x, y, IMG_EXTRA_TIME);
-#endif
-    else if (element == EL_SHIELD_NORMAL)
-    {
-#if 0
-      DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_LOOP);
-#else
-      DrawNewGraphicAnimation(x, y, IMG_SHIELD_NORMAL);
 #endif
 
-#if 0
-      if (!(FrameCounter % 4))
-       PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED);
-#endif
-    }
-    else if (element == EL_SHIELD_DEADLY)
-    {
-#if 0
-      DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_LOOP);
-#else
-      DrawNewGraphicAnimation(x, y, IMG_SHIELD_DEADLY);
-#endif
+    else if (IS_AUTO_CHANGING(element))
+      ChangeElement(x, y);
 
-#if 0
-      if (!(FrameCounter % 4))
-       PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);
+#if 1
+    else if (element == EL_EXPLOSION)
+      ;        /* drawing of correct explosion animation is handled separately */
+    else if (IS_ANIMATED(graphic))
+      DrawLevelGraphicAnimation(x, y, graphic);
 #endif
-    }
+
+    if (IS_BELT_ACTIVE(element))
+      PlaySoundLevelAction(x, y, ACTION_ACTIVE);
 
     if (game.magic_wall_active)
     {
@@ -5294,7 +5320,7 @@ void GameActions()
       if (ExplodeField[x][y])
        Explode(x, y, EX_PHASE_START, ExplodeField[x][y]);
       else if (element == EL_EXPLOSION)
-       Explode(x, y, Frame[x][y], EX_NORMAL);
+       Explode(x, y, ExplodePhase[x][y], EX_NORMAL);
 
       ExplodeField[x][y] = EX_NO_EXPLOSION;
     }
@@ -5329,13 +5355,13 @@ void GameActions()
              element == EL_MAGIC_WALL_FULL)
          {
            Feld[x][y] = EL_MAGIC_WALL_DEAD;
-           DrawNewLevelField(x, y);
+           DrawLevelField(x, y);
          }
          else if (element == EL_BD_MAGIC_WALL_ACTIVE ||
                   element == EL_BD_MAGIC_WALL_FULL)
          {
            Feld[x][y] = EL_BD_MAGIC_WALL_DEAD;
-           DrawNewLevelField(x, y);
+           DrawLevelField(x, y);
          }
        }
 
@@ -5489,14 +5515,14 @@ void ScrollLevel(int dx, int dy)
   {
     x = (dx == 1 ? BX1 : BX2);
     for (y=BY1; y<=BY2; y++)
-      DrawNewScreenField(x, y);
+      DrawScreenField(x, y);
   }
 
   if (dy)
   {
     y = (dy == 1 ? BY1 : BY2);
     for (x=BX1; x<=BX2; x++)
-      DrawNewScreenField(x, y);
+      DrawScreenField(x, y);
   }
 
   redraw_mask |= REDRAW_FIELD;
@@ -5624,7 +5650,8 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
     int original_move_delay_value = player->move_delay_value;
 
 #if DEBUG
-    printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES.\n");
+    printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%ld]\n",
+          tape.counter);
 #endif
 
     /* scroll remaining steps with finest movement resolution */
@@ -5728,7 +5755,11 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
   if (!(moved & MF_MOVING) && !player->Pushing)
     player->Frame = 0;
   else
+#if 0
     player->Frame = (player->Frame + 1) % 4;
+#else
+    player->Frame += 1 * 0;
+#endif
 
   if (moved & MF_MOVING)
   {
@@ -5737,7 +5768,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
     else if (old_jx == jx && old_jy != jy)
       player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP);
 
-    DrawNewLevelField(jx, jy); /* for "DrawCrumbledSand()" */
+    DrawLevelField(jx, jy);    /* for "DrawCrumbledSand()" */
 
     player->last_move_dir = player->MovDir;
     player->is_moving = TRUE;
@@ -5773,6 +5804,8 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
   {
     player->actual_frame_counter = FrameCounter;
     player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
+    if (player->Frame)
+      player->Frame += 1;
 
     if (Feld[last_jx][last_jy] == EL_EMPTY)
       Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
@@ -5785,6 +5818,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
 
   player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
   player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
+  player->Frame += 1;
 
   if (Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING)
     Feld[last_jx][last_jy] = EL_EMPTY;
@@ -6203,8 +6237,9 @@ int DigField(struct PlayerInfo *player,
     case EL_TRAP:
     case EL_SP_BASE:
     case EL_SP_BUGGY_BASE:
+    case EL_SP_BUGGY_BASE_ACTIVATING:
       RemoveField(x, y);
-      PlaySoundLevelElementAction(x, y, element, SND_ACTION_DIGGING);
+      PlaySoundLevelElementAction(x, y, element, ACTION_DIGGING);
       break;
 
     case EL_EMERALD:
@@ -6226,7 +6261,7 @@ int DigField(struct PlayerInfo *player,
       DrawText(DX_EMERALDS, DY_EMERALDS,
               int2str(local_player->gems_still_needed, 3),
               FS_SMALL, FC_YELLOW);
-      PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING);
+      PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING);
       break;
 
     case EL_SPEED_PILL:
@@ -6271,7 +6306,7 @@ int DigField(struct PlayerInfo *player,
       DrawText(DX_DYNAMITE, DY_DYNAMITE,
               int2str(local_player->dynamite, 3),
               FS_SMALL, FC_YELLOW);
-      PlaySoundLevelElementAction(x, y, element, SND_ACTION_COLLECTING);
+      PlaySoundLevelElementAction(x, y, element, ACTION_COLLECTING);
       break;
 
     case EL_DYNABOMB_NR:
@@ -6306,10 +6341,10 @@ int DigField(struct PlayerInfo *player,
       RemoveField(x, y);
       player->key[key_nr] = TRUE;
       RaiseScoreElement(element);
-      DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
-                        GFX_SCHLUESSEL1 + key_nr);
-      DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
-                        GFX_SCHLUESSEL1 + key_nr);
+      DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
+                        IMG_KEY1 + key_nr);
+      DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
+                        IMG_KEY1 + key_nr);
       PlaySoundLevel(x, y, SND_KEY_COLLECTING);
       break;
     }
@@ -6324,10 +6359,10 @@ int DigField(struct PlayerInfo *player,
       RemoveField(x, y);
       player->key[key_nr] = TRUE;
       RaiseScoreElement(element);
-      DrawNewMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
-                        GFX_SCHLUESSEL1 + key_nr);
-      DrawNewMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
-                        GFX_SCHLUESSEL1 + key_nr);
+      DrawMiniGraphicExt(drawto, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
+                        IMG_KEY1 + key_nr);
+      DrawMiniGraphicExt(window, DX_KEYS + key_nr * MINI_TILEX, DY_KEYS,
+                        IMG_KEY1 + key_nr);
       PlaySoundLevel(x, y, SND_KEY_COLLECTING);
       break;
     }
@@ -6336,7 +6371,7 @@ int DigField(struct PlayerInfo *player,
       Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE;
       ZX = x;
       ZY = y;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
       PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING);
       return MF_ACTION;
       break;
@@ -6481,19 +6516,19 @@ int DigField(struct PlayerInfo *player,
       else
       {
        RemoveField(x, y);
-       Feld[x+dx][y+dy] = element;
+       Feld[x + dx][y + dy] = element;
       }
 
       if (element == EL_SPRING)
       {
-       Feld[x+dx][y+dy] = EL_SPRING_MOVING;
-       MovDir[x+dx][y+dy] = move_direction;
+       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));
 
-      DrawNewLevelField(x + dx, y + dy);
-      PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING);
+      DrawLevelField(x + dx, y + dy);
+      PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING);
       break;
 
     case EL_GATE1:
@@ -6553,7 +6588,7 @@ int DigField(struct PlayerInfo *player,
       player->programmed_action = move_direction;
       DOUBLE_PLAYER_SPEED(player);
 
-      PlaySoundLevelElementAction(x, y, element, SND_ACTION_PASSING);
+      PlaySoundLevelElementAction(x, y, element, ACTION_PASSING);
       break;
 
     case EL_SP_PORT1_LEFT:
@@ -6662,7 +6697,7 @@ int DigField(struct PlayerInfo *player,
     case EL_LAMP:
       Feld[x][y] = EL_LAMP_ACTIVE;
       local_player->lights_still_needed--;
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
       PlaySoundLevel(x, y, SND_LAMP_ACTIVATING);
       return MF_ACTION;
       break;
@@ -6671,7 +6706,7 @@ int DigField(struct PlayerInfo *player,
       Feld[x][y] = EL_TIME_ORB_EMPTY;
       TimeLeft += 10;
       DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
-      DrawNewLevelField(x, y);
+      DrawLevelField(x, y);
       PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT);
       return MF_ACTION;
       break;
@@ -6751,13 +6786,13 @@ int DigField(struct PlayerInfo *player,
       {
        RemoveField(x, y);
        Feld[x+dx][y+dy] = element;
-       PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING);
+       PlaySoundLevelElementAction(x, y, element, ACTION_PUSHING);
       }
 
       player->push_delay_value = (element == EL_BALLOON ? 0 : 2);
 
-      DrawNewLevelField(x, y);
-      DrawNewLevelField(x + dx, y + dy);
+      DrawLevelField(x, y);
+      DrawLevelField(x + dx, y + dy);
 
       if (IS_SB_ELEMENT(element) &&
          local_player->sokobanfields_still_needed == 0 &&
@@ -6815,7 +6850,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy)
     return FALSE;
 
   player->snapped = TRUE;
-  DrawNewLevelField(x, y);
+  DrawLevelField(x, y);
   BackToFront();
 
   return TRUE;
@@ -6838,27 +6873,22 @@ boolean PlaceBomb(struct PlayerInfo *player)
   if (element != EL_EMPTY)
     Store[jx][jy] = element;
 
+  MovDelay[jx][jy] = 96;
+  GfxFrame[jx][jy] = 0;
+
   if (player->dynamite)
   {
     Feld[jx][jy] = EL_DYNAMITE_ACTIVE;
-    MovDelay[jx][jy] = 96;
     player->dynamite--;
+
     DrawText(DX_DYNAMITE, DY_DYNAMITE, int2str(local_player->dynamite, 3),
             FS_SMALL, FC_YELLOW);
     if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy)))
     {
-#if 0
       if (game.emulation == EMU_SUPAPLEX)
-       DrawGraphic(SCREENX(jx), SCREENY(jy), GFX_SP_DISK_RED);
+       DrawGraphic(SCREENX(jx), SCREENY(jy), IMG_SP_DISK_RED, 0);
       else
-       DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNAMIT);
-#else
-      if (game.emulation == EMU_SUPAPLEX)
-       DrawNewGraphic(SCREENX(jx), SCREENY(jy), IMG_SP_DISK_RED, 0);
-      else
-       DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy),
-                              IMG_DYNAMITE_ACTIVE, 0);
-#endif
+       DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), IMG_DYNAMITE_ACTIVE, 0);
     }
 
     PlaySoundLevel(jx, jy, SND_DYNAMITE_DROPPING);
@@ -6867,15 +6897,10 @@ boolean PlaceBomb(struct PlayerInfo *player)
   {
     Feld[jx][jy] =
       EL_DYNABOMB_PLAYER1_ACTIVE + (player->element_nr - EL_PLAYER1);
-    MovDelay[jx][jy] = 96;
     player->dynabombs_left--;
+
     if (IN_SCR_FIELD(SCREENX(jx), SCREENY(jy)))
-#if 0
-      DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), GFX_DYNABOMB);
-#else
-      DrawNewGraphicThruMask(SCREENX(jx), SCREENY(jy),
-                            el2img(Feld[jx][jy]), 0);
-#endif
+      DrawGraphicThruMask(SCREENX(jx), SCREENY(jy), el2img(Feld[jx][jy]), 0);
 
     PlaySoundLevel(jx, jy, SND_DYNABOMB_DROPPING);
   }
@@ -6883,7 +6908,7 @@ boolean PlaceBomb(struct PlayerInfo *player)
   return TRUE;
 }
 
-void PlaySoundLevel(int x, int y, int nr)
+static void PlaySoundLevel(int x, int y, int nr)
 {
   static int loop_sound_frame[NUM_SOUND_FILES];
   static int loop_sound_volume[NUM_SOUND_FILES];
@@ -6930,16 +6955,26 @@ void PlaySoundLevel(int x, int y, int nr)
   PlaySoundExt(nr, volume, stereo_position, type);
 }
 
-void PlaySoundLevelAction(int x, int y, int sound_action)
+static void PlaySoundLevelNearest(int x, int y, int sound_action)
+{
+  PlaySoundLevel(x < LEVELX(BX1) ? LEVELX(BX1) :
+                x > LEVELX(BX2) ? LEVELX(BX2) : x,
+                y < LEVELY(BY1) ? LEVELY(BY1) :
+                y > LEVELY(BY2) ? LEVELY(BY2) : y,
+                sound_action);
+}
+
+static void PlaySoundLevelAction(int x, int y, int sound_action)
 {
   PlaySoundLevelElementAction(x, y, Feld[x][y], sound_action);
 }
 
-void PlaySoundLevelElementAction(int x, int y, int element, int sound_action)
+static void PlaySoundLevelElementAction(int x, int y, int element,
+                                       int sound_action)
 {
-  int sound_effect = element_action_sound[element][sound_action];
+  int sound_effect = element_info[element].sound[sound_action];
 
-  if (sound_effect != -1)
+  if (sound_effect != SND_UNDEFINED)
     PlaySoundLevel(x, y, sound_effect);
 }
 
@@ -7086,7 +7121,7 @@ void CreateGameButtons()
 
   for (i=0; i<NUM_GAME_BUTTONS; i++)
   {
-    Bitmap *gd_bitmap = pix[PIX_DOOR];
+    Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
     struct GadgetInfo *gi;
     int button_type;
     boolean checked;
@@ -7146,6 +7181,14 @@ void CreateGameButtons()
   }
 }
 
+void FreeGameButtons()
+{
+  int i;
+
+  for (i=0; i<NUM_GAME_BUTTONS; i++)
+    FreeGadget(game_gadget[i]);
+}
+
 static void MapGameButtons()
 {
   int i;