rnd-20021006-1-src
[rocksndiamonds.git] / src / game.c
index 2c5f0e9aabb2f693c3f3c3da9c6ba06d77c428ad..b82ede439a61eea86f45182870abb95d7f777524 100644 (file)
@@ -669,12 +669,14 @@ void InitGame()
 
   InitGameEngine();
 
+#if 0
 #if DEBUG
 #if USE_NEW_AMOEBA_CODE
   printf("Using new amoeba code.\n");
 #else
   printf("Using old amoeba code.\n");
 #endif
+#endif
 #endif
 
   /* don't play tapes over network */
@@ -793,6 +795,7 @@ void InitGame()
       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;
@@ -1211,7 +1214,7 @@ void GameWon()
 #endif
 
   /* Hero disappears */
-  DrawLevelField(ExitX, ExitY);
+  DrawNewLevelField(ExitX, ExitY);
   BackToFront();
 
   if (tape.playing)
@@ -1327,8 +1330,11 @@ void InitMovingField(int x, int y, int direction)
 
   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;
 }
 
 void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
@@ -1439,40 +1445,66 @@ 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;
 
-  DrawLevelField(oldx, oldy);
-  DrawLevelField(newx, newy);
+  DrawNewLevelField(oldx, oldy);
+  DrawNewLevelField(newx, newy);
 }
 
 void DrawDynamite(int x, int y)
 {
   int sx = SCREENX(x), sy = SCREENY(y);
+#if 0
   int graphic = el2gfx(Feld[x][y]);
-  int phase;
+#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 (Feld[x][y] == EL_DYNAMITE_ACTIVE)
   {
-    if ((phase = (96 - MovDelay[x][y]) / 12) > 6)
-      phase = 6;
+    if ((frame = (96 - MovDelay[x][y]) / 12) > 6)
+      frame = 6;
   }
   else
   {
-    if ((phase = ((96 - MovDelay[x][y]) / 6) % 8) > 3)
-      phase = 7 - phase;
+    if ((frame = ((96 - MovDelay[x][y]) / 6) % 8) > 3)
+      frame = 7 - frame;
   }
 
+#if 1
+  frame = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]);
+#endif
+
+  /*
+  printf("-> %d: %d [%d]\n", graphic, frame, MovDelay[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 + phase);
+    DrawGraphicThruMask(sx, sy, graphic + frame);
   else
-    DrawGraphic(sx, sy, graphic + phase);
+    DrawGraphic(sx, sy, graphic + frame);
+#else
+  if (game.emulation == EMU_SUPAPLEX)
+    DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0);
+  else if (Store[x][y])
+    DrawNewGraphicThruMask(sx, sy, graphic, frame);
+  else
+    DrawNewGraphic(sx, sy, graphic, frame);
+#endif
 }
 
 void CheckDynamite(int x, int y)
@@ -1508,7 +1540,8 @@ void CheckDynamite(int x, int y)
 void Explode(int ex, int ey, int phase, int mode)
 {
   int x, y;
-  int num_phase = 9, delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
+  int num_phase = 9;
+  int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
   int last_phase = num_phase * delay;
   int half_phase = (num_phase / 2) * delay;
   int first_phase_after_start = EX_PHASE_START + 1;
@@ -1692,13 +1725,14 @@ void Explode(int ex, int ey, int phase, int mode)
     InitField(x, y, FALSE);
     if (CAN_MOVE(element) || COULD_MOVE(element))
       InitMovDir(x, y);
-    DrawLevelField(x, y);
+    DrawNewLevelField(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)))
   {
+#if 0
     int graphic = GFX_EXPLOSION;
 
     if (game.emulation == EMU_SUPAPLEX)
@@ -1706,18 +1740,35 @@ void Explode(int ex, int ey, int phase, int mode)
                 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
+
     if (phase == delay)
       ErdreichAnbroeckeln(SCREENX(x), SCREENY(y));
 
-    graphic += (phase / delay - 1);
-
     if (IS_PFORTE(Store[x][y]))
     {
-      DrawLevelElement(x, y, 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
     }
     else
+#if 0
       DrawGraphic(SCREENX(x), SCREENY(y), graphic);
+#else
+      DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+#endif
   }
 }
 
@@ -1847,8 +1898,14 @@ void Blurb(int x, int y)
   }
   else                                                         /* go on */
   {
+#if 0
     int graphic =
       (element == EL_ACID_SPLASHING_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT);
+#else
+    int graphic = (element == EL_ACID_SPLASHING_LEFT ?
+                  IMG_ACID_SPLASHING_LEFT :
+                  IMG_ACID_SPLASHING_RIGHT);
+#endif
 
     if (!MovDelay[x][y])       /* initialize animation counter */
       MovDelay[x][y] = 9;
@@ -1857,12 +1914,20 @@ 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]);
+
+        DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      }
+#endif
 
       if (!MovDelay[x][y])
       {
        Feld[x][y] = EL_EMPTY;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
     }
   }
@@ -1903,7 +1968,7 @@ static void ToggleBeltSwitch(int x, int y)
   int belt_nr = getBeltNrFromBeltSwitchElement(element);
   int belt_dir_nr = (game.belt_dir_nr[belt_nr] + 1) % 4;
   int belt_dir = belt_move_dir[belt_dir_nr];
-  int xx, yy;
+  int xx, yy, i;
 
   if (!IS_BELT_SWITCH(element))
     return;
@@ -1914,6 +1979,18 @@ static void ToggleBeltSwitch(int x, int y)
   if (belt_dir_nr == 3)
     belt_dir_nr = 1;
 
+  /* set frame order for belt animation graphic according to belt direction */
+  for (i=0; i<3; i++)
+  {
+    int element = belt_base_active_element[belt_nr] + i;
+    int graphic = el2img(element);
+
+    if (belt_dir == MV_LEFT)
+      new_graphic_info[graphic].anim_mode &= ~ANIM_REVERSE;
+    else
+      new_graphic_info[graphic].anim_mode |=  ANIM_REVERSE;
+  }
+
   for (yy=0; yy<lev_fieldy; yy++)
   {
     for (xx=0; xx<lev_fieldx; xx++)
@@ -1927,7 +2004,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;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
       else if (IS_BELT(element) && belt_dir != MV_NO_MOVING)
@@ -1939,7 +2016,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;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
       else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING)
@@ -1951,7 +2028,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;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
     }
@@ -1974,7 +2051,7 @@ static void ToggleSwitchgateSwitch(int x, int y)
          element == EL_SWITCHGATE_SWITCH_DOWN)
       {
        Feld[xx][yy] = EL_SWITCHGATE_SWITCH_UP + game.switchgate_pos;
-       DrawLevelField(xx, yy);
+       DrawNewLevelField(xx, yy);
       }
       else if (element == EL_SWITCHGATE_OPEN ||
               element == EL_SWITCHGATE_OPENING)
@@ -2020,13 +2097,13 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
          game.light_time_left > 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_LIGHT_SWITCH_ACTIVE &&
               game.light_time_left == 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL ||
               element == EL_INVISIBLE_WALL ||
@@ -2035,7 +2112,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left > 0)
          Feld[x][y] = getInvisibleActiveFromInvisibleElement(element);
 
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL_ACTIVE ||
               element == EL_INVISIBLE_WALL_ACTIVE ||
@@ -2044,7 +2121,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left == 0)
          Feld[x][y] = getInvisibleFromInvisibleActiveElement(element);
 
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
     }
   }
@@ -2721,6 +2798,8 @@ void StartMoving(int x, int y)
   if (Stop[x][y])
     return;
 
+  GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
   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)))
@@ -2909,16 +2988,11 @@ void StartMoving(int x, int y)
        TurnRound(x, y);
 
        if (MovDelay[x][y] && (element == EL_BUG ||
-                              element == EL_SPACESHIP ||
-                              element == EL_SP_SNIKSNAK ||
-                              element == EL_SP_ELECTRON))
-         DrawNewLevelField(x, y);
-       else if (MovDelay[x][y] && (element == EL_BUG ||
                               element == EL_SPACESHIP ||
                               element == EL_SP_SNIKSNAK ||
                               element == EL_SP_ELECTRON ||
                               element == EL_MOLE))
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
       }
     }
 
@@ -2935,7 +3009,16 @@ void StartMoving(int x, int y)
          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);
+
+         DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+       }
+#endif
 
        if (MovDelay[x][y] % 4 == 3)
        {
@@ -2946,23 +3029,36 @@ void StartMoving(int x, int y)
        }
       }
       else if (element == EL_SP_ELECTRON)
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL);
+#if 0
+       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
+#else
+       DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
+#endif
       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
 
        for (i=1; i<=3; i++)
        {
          int xx = x + i*dx, yy = y + i*dy;
          int sx = SCREENX(xx), sy = SCREENY(yy);
+         int flame_graphic = graphic + (i - 1);
 
          if (!IN_LEV_FIELD(xx, yy) ||
              IS_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLOSION)
@@ -2979,13 +3075,17 @@ 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
          }
          else
          {
            if (Feld[xx][yy] == EL_FLAMES)
              Feld[xx][yy] = EL_EMPTY;
-           DrawLevelField(xx, yy);
+           DrawNewLevelField(xx, yy);
          }
        }
       }
@@ -3030,11 +3130,16 @@ void StartMoving(int x, int y)
       if (Feld[newx][newy] == EL_EXIT_OPEN)
       {
        Feld[x][y] = EL_EMPTY;
-       DrawLevelField(x, y);
+       DrawNewLevelField(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
 
        local_player->friends_still_needed--;
        if (!local_player->friends_still_needed &&
@@ -3046,7 +3151,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)
-         DrawLevelField(newx, newy);
+         DrawNewLevelField(newx, newy);
        else
          MovDir[x][y] = MV_NO_MOVING;
       }
@@ -3055,7 +3160,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
     }
@@ -3068,7 +3173,7 @@ void StartMoving(int x, int y)
        else
        {
          Feld[newx][newy] = EL_EMPTY;
-         DrawLevelField(newx, newy);
+         DrawNewLevelField(newx, newy);
        }
 
        PlaySoundLevel(x, y, SND_PIG_EATING);
@@ -3078,7 +3183,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
     }
@@ -3089,7 +3194,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
       else
@@ -3110,7 +3215,7 @@ void StartMoving(int x, int y)
          if (IS_PLAYER(x, y))
            DrawPlayerField(x, y);
          else
-           DrawLevelField(x, y);
+           DrawNewLevelField(x, y);
 
          PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
 
@@ -3132,7 +3237,7 @@ void StartMoving(int x, int y)
       else
       {
        Feld[newx][newy] = EL_EMPTY;
-       DrawLevelField(newx, newy);
+       DrawNewLevelField(newx, newy);
       }
 
       PlaySoundLevel(x, y, SND_YAMYAM_EATING);
@@ -3153,7 +3258,7 @@ void StartMoving(int x, int y)
       else
       {
        Feld[newx][newy] = EL_EMPTY;
-       DrawLevelField(newx, newy);
+       DrawNewLevelField(newx, newy);
       }
 
       PlaySoundLevel(x, y, SND_DARK_YAMYAM_EATING);
@@ -3205,26 +3310,26 @@ void StartMoving(int x, int y)
 #endif
       else if (element == EL_BUG || element == EL_SPACESHIP ||
               element == EL_SP_SNIKSNAK || element == EL_MOLE)
-#if 1
+#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_NORMAL);
+       DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, el2img(element));
 #endif
       else if (element == EL_SATELLITE)
 #if 0
-       DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, IMG_SATELLITE);
 #endif
       else if (element == EL_SP_ELECTRON)
 #if 0
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
 #endif
@@ -3296,7 +3401,7 @@ void ContinueMoving(int x, int y)
       };
 
       Feld[x][y] = EL_SAND;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
 
       for(i=0; i<4; i++)
       {
@@ -3306,7 +3411,7 @@ void ContinueMoving(int x, int y)
        yy = y + xy[i][1];
 
        if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_SAND)
-         DrawLevelField(xx, yy);       /* for "ErdreichAnbroeckeln()" */
+         DrawNewLevelField(xx, yy);    /* for "ErdreichAnbroeckeln()" */
       }
     }
 
@@ -3362,21 +3467,14 @@ void ContinueMoving(int x, int y)
     MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
     MovDelay[newx][newy] = 0;
 
+    GfxAction[newx][newy] = GfxAction[x][y];   /* keep action one frame */
+    GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
     if (!CAN_MOVE(element))
       MovDir[newx][newy] = 0;
 
-    if (element == EL_BUG || element == EL_SPACESHIP ||
-       element == EL_SP_SNIKSNAK || element == EL_PACMAN ||
-       element == EL_SP_ELECTRON)
-    {
-      DrawNewLevelField(x, y);
-      DrawNewLevelField(newx, newy);
-    }
-    else
-    {
-      DrawLevelField(x, y);
-      DrawLevelField(newx, newy);
-    }
+    DrawNewLevelField(x, y);
+    DrawNewLevelField(newx, newy);
 
     Stop[newx][newy] = TRUE;
     JustStopped[newx][newy] = 3;
@@ -3396,12 +3494,10 @@ void ContinueMoving(int x, int y)
   }
   else                         /* still moving on */
   {
-    if (element == EL_BUG || element == EL_SPACESHIP ||
-       element == EL_SP_SNIKSNAK || element == EL_PACMAN ||
-       element == EL_SP_ELECTRON)
-      DrawNewLevelField(x, y);
-    else
-      DrawLevelField(x, y);
+    if (GfxAction[x][y] == GFX_ACTION_DEFAULT)
+      GfxAction[x][y] = GFX_ACTION_MOVING;
+
+    DrawNewLevelField(x, y);
   }
 }
 
@@ -3572,7 +3668,7 @@ void AmoebeUmwandelnBD(int ax, int ay, int new_element)
        AmoebaNr[x][y] = 0;
        Feld[x][y] = new_element;
        InitField(x, y, FALSE);
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
        done = TRUE;
       }
     }
@@ -3607,13 +3703,22 @@ 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]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_CREATING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = Store[x][y];
       Store[x][y] = 0;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -3635,12 +3740,21 @@ 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]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_AMOEBA_SHRINKING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_EMPTY;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
 
       /* don't let mole enter this field in this cycle;
         (give priority to objects falling to this field from above) */
@@ -3665,7 +3779,7 @@ void AmoebeAbleger(int ax, int ay)
   if (!level.amoeba_speed)
   {
     Feld[ax][ay] = EL_AMOEBA_DEAD;
-    DrawLevelField(ax, ay);
+    DrawNewLevelField(ax, ay);
     return;
   }
 
@@ -3728,7 +3842,7 @@ void AmoebeAbleger(int ax, int ay)
       if (i == 4 && (!waiting_for_player || game.emulation == EMU_BOULDERDASH))
       {
        Feld[ax][ay] = EL_AMOEBA_DEAD;
-       DrawLevelField(ax, ay);
+       DrawNewLevelField(ax, ay);
        AmoebaCnt[AmoebaNr[ax][ay]]--;
 
        if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0)   /* amoeba is completely dead */
@@ -3791,7 +3905,7 @@ void AmoebeAbleger(int ax, int ay)
     return;
   }
 
-  DrawLevelField(newax, neway);
+  DrawNewLevelField(newax, neway);
 }
 
 void Life(int ax, int ay)
@@ -3843,7 +3957,7 @@ void Life(int ax, int ay)
       {
        Feld[xx][yy] = EL_EMPTY;
        if (!Stop[xx][yy])
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        Stop[xx][yy] = TRUE;
        changed = TRUE;
       }
@@ -3855,7 +3969,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])
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        Stop[xx][yy] = TRUE;
        changed = TRUE;
       }
@@ -3878,7 +3992,15 @@ 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);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_ROBOT_WHEEL_ACTIVE, frame);
+    }
+#endif
       if (!(MovDelay[x][y]%4))
        PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVE);
       return;
@@ -3886,7 +4008,7 @@ void RobotWheel(int x, int y)
   }
 
   Feld[x][y] = EL_ROBOT_WHEEL;
-  DrawLevelField(x, y);
+  DrawNewLevelField(x, y);
   if (ZX == x && ZY == y)
     ZX = ZY = -1;
 }
@@ -3902,8 +4024,16 @@ 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);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_SWITCH_ACTIVE, frame);
+    }
+#endif
       if (!(MovDelay[x][y]%4))
        PlaySoundLevel(x, y, SND_TIMEGATE_SWITCH_ACTIVE);
       return;
@@ -3911,17 +4041,21 @@ void TimegateWheel(int x, int y)
   }
 
   Feld[x][y] = EL_TIMEGATE_SWITCH;
-  DrawLevelField(x, y);
+  DrawNewLevelField(x, y);
   if (ZX == x && ZY == y)
     ZX = ZY = -1;
 }
 
 void Blubber(int x, int y)
 {
-  if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN)
-    DrawLevelField(x, y-1);
+#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_NORMAL);
+    DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP);
+#else
+  DrawNewGraphicAnimation(x, y, IMG_ACID);
+#endif
 }
 
 void NussKnacken(int x, int y)
@@ -3933,13 +4067,22 @@ void NussKnacken(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_CRACKINGNUT + 3 - MovDelay[x][y]/2);
+#else
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_NUT_CRACKING,
+                                             6 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_NUT_CRACKING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_EMERALD;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -3953,22 +4096,37 @@ void BreakingPearl(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_PEARL_BREAKING + 4 - MovDelay[x][y]/2);
+#else
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_PEARL_BREAKING,
+                                             8 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_PEARL_BREAKING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_EMPTY;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
 
-void SiebAktivieren(int x, int y, int typ)
+void SiebAktivieren(int x, int y, int type)
 {
-  int graphic = (typ == 1 ? GFX_MAGIC_WALL_FULL : GFX_MAGIC_WALL_BD_FULL) + 3;
+#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
 }
 
 void AusgangstuerPruefen(int x, int y)
@@ -4006,7 +4164,7 @@ void AusgangstuerOeffnen(int x, int y)
   int delay = 6;
 
   if (!MovDelay[x][y])         /* next animation frame */
-    MovDelay[x][y] = 5*delay;
+    MovDelay[x][y] = 5 * delay;
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
@@ -4015,19 +4173,32 @@ void AusgangstuerOeffnen(int x, int y)
     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
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_EXIT_OPENING,
+                                             29 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_EXIT_OPENING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_EXIT_OPEN;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
 
 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
 }
 
 void OpenSwitchgate(int x, int y)
@@ -4044,12 +4215,21 @@ void OpenSwitchgate(int x, int y)
     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
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_OPENING,
+                                             29 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_OPENING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_SWITCHGATE_OPEN;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4068,12 +4248,21 @@ void CloseSwitchgate(int x, int y)
     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
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_SWITCHGATE_CLOSING,
+                                             29 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_SWITCHGATE_CLOSING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_SWITCHGATE_CLOSED;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4092,12 +4281,21 @@ void OpenTimegate(int x, int y)
     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
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_OPENING,
+                                             29 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_OPENING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_TIMEGATE_OPEN;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4116,12 +4314,21 @@ void CloseTimegate(int x, int y)
     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
+    {
+      int frame = getNewGraphicAnimationFrame(IMG_TIMEGATE_CLOSING,
+                                             29 - MovDelay[x][y]);
+
+      DrawNewGraphic(SCREENX(x), SCREENY(y), IMG_TIMEGATE_CLOSING, frame);
+    }
+#endif
 
     if (!MovDelay[x][y])
     {
       Feld[x][y] = EL_TIMEGATE_CLOSED;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4151,7 +4358,11 @@ void EdelsteinFunkeln(int x, int y)
     return;
 
   if (Feld[x][y] == EL_BD_DIAMOND)
+#if 0
     DrawGraphicAnimation(x, y, GFX_EDELSTEIN_BD, 4, 4, ANIM_REVERSE);
+#else
+    DrawNewGraphicAnimation(x, y, IMG_BD_DIAMOND);
+#endif
   else
   {
     if (!MovDelay[x][y])       /* next animation frame */
@@ -4164,7 +4375,11 @@ void EdelsteinFunkeln(int x, int y)
       if (setup.direct_draw && MovDelay[x][y])
        SetDrawtoField(DRAW_BUFFERED);
 
+#if 0
       DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(Feld[x][y]));
+#else
+      DrawNewGraphic(SCREENX(x), SCREENY(y), el2img(Feld[x][y]), 0);
+#endif
 
       if (MovDelay[x][y])
       {
@@ -4173,14 +4388,24 @@ void EdelsteinFunkeln(int x, int y)
        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]);
+
+         DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), IMG_TWINKLE_WHITE,
+                                frame);
+       }
+#endif
 
        if (setup.direct_draw)
        {
          int dest_x, dest_y;
 
-         dest_x = FX + SCREENX(x)*TILEX;
-         dest_y = FY + SCREENY(y)*TILEY;
+         dest_x = FX + SCREENX(x) * TILEX;
+         dest_y = FY + SCREENY(y) * TILEY;
 
          BlitBitmap(drawto_field, window,
                     dest_x, dest_y, TILEX, TILEY, dest_x, dest_y);
@@ -4196,48 +4421,58 @@ void MauerWaechst(int x, int y)
   int delay = 6;
 
   if (!MovDelay[x][y])         /* next animation frame */
-    MovDelay[x][y] = 3*delay;
+    MovDelay[x][y] = 3 * delay;
 
   if (MovDelay[x][y])          /* wait some time before next frame */
   {
     int phase;
 
     MovDelay[x][y]--;
-    phase = 2-MovDelay[x][y]/delay;
+    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]);
+
+      DrawNewGraphic(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]))
-         DrawLevelField(x-1, y);
+       if (IN_LEV_FIELD(x - 1, y) && IS_MAUER(Feld[x - 1][y]))
+         DrawNewLevelField(x - 1, y);
       }
       else if (MovDir[x][y] == MV_RIGHT)
       {
-       if (IN_LEV_FIELD(x+1, y) && IS_MAUER(Feld[x+1][y]))
-         DrawLevelField(x+1, y);
+       if (IN_LEV_FIELD(x + 1, y) && IS_MAUER(Feld[x + 1][y]))
+         DrawNewLevelField(x + 1, y);
       }
       else if (MovDir[x][y] == MV_UP)
       {
-       if (IN_LEV_FIELD(x, y-1) && IS_MAUER(Feld[x][y-1]))
-         DrawLevelField(x, y-1);
+       if (IN_LEV_FIELD(x, y - 1) && IS_MAUER(Feld[x][y - 1]))
+         DrawNewLevelField(x, y - 1);
       }
       else
       {
-       if (IN_LEV_FIELD(x, y+1) && IS_MAUER(Feld[x][y+1]))
-         DrawLevelField(x, y+1);
+       if (IN_LEV_FIELD(x, y + 1) && IS_MAUER(Feld[x][y + 1]))
+         DrawNewLevelField(x, y + 1);
       }
 
       Feld[x][y] = Store[x][y];
       Store[x][y] = 0;
       MovDir[x][y] = MV_NO_MOVING;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4278,7 +4513,12 @@ 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
       new_wall = TRUE;
     }
     if (unten_frei)
@@ -4287,7 +4527,12 @@ 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
       new_wall = TRUE;
     }
   }
@@ -4301,7 +4546,12 @@ 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
       new_wall = TRUE;
     }
 
@@ -4311,13 +4561,18 @@ 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
       new_wall = TRUE;
     }
   }
 
   if (element == EL_WALL_GROWING && (links_frei || rechts_frei))
-    DrawLevelField(ax, ay);
+    DrawNewLevelField(ax, ay);
 
   if (!IN_LEV_FIELD(ax, ay-1) || IS_MAUER(Feld[ax][ay-1]))
     oben_massiv = TRUE;
@@ -4378,7 +4633,7 @@ void CheckForDragon(int x, int y)
        if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == EL_FLAMES)
        {
          Feld[xx][yy] = EL_EMPTY;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
        else
          break;
@@ -4400,7 +4655,11 @@ static void CheckBuggyBase(int x, int y)
     {
       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;
 
@@ -4427,7 +4686,16 @@ static void CheckBuggyBase(int x, int y)
        };
 
        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));
+
+          DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+       }
+#endif
 
        for (i=0; i<4; i++)
        {
@@ -4444,7 +4712,7 @@ static void CheckBuggyBase(int x, int y)
       }
 
       Feld[x][y] = EL_SP_BUGGY_BASE;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4491,7 +4759,15 @@ static void CheckTrap(int x, int y)
 
          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
            ErdreichAnbroeckeln(SCREENX(x), SCREENY(y));
          }
        }
@@ -4500,7 +4776,7 @@ static void CheckTrap(int x, int y)
       }
 
       Feld[x][y] = EL_TRAP;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
     }
   }
 }
@@ -4512,11 +4788,17 @@ static void DrawBeltAnimation(int x, int y, int element)
 
   if (belt_dir != MV_NO_MOVING)
   {
+#if 0
     int delay = 2;
-    int mode = (belt_dir == MV_LEFT ? ANIM_NORMAL : ANIM_REVERSE);
+    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);
+
+    DrawNewGraphicAnimation(x, y, graphic);
+#endif
 
     if (!(FrameCounter % 2))
       PlaySoundLevel(x, y, SND_CONVEYOR_BELT_ACTIVE);
@@ -4871,10 +5153,19 @@ void GameActions()
     else if (element == EL_TRAP || element == EL_TRAP_ACTIVE)
       CheckTrap(x, y);
     else if (element == EL_SP_TERMINAL)
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_NORMAL);
+#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)
     {
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL);
+#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);
@@ -4891,10 +5182,19 @@ void GameActions()
     else if (element == EL_TIMEGATE_CLOSING)
       CloseTimegate(x, y);
     else if (element == EL_EXTRA_TIME)
-      DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_NORMAL);
+#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)
     {
-      DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_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);
@@ -4902,7 +5202,12 @@ void GameActions()
     }
     else if (element == EL_SHIELD_DEADLY)
     {
-      DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_NORMAL);
+#if 0
+      DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_LOOP);
+#else
+      DrawNewGraphicAnimation(x, y, IMG_SHIELD_DEADLY);
+#endif
+
 #if 0
       if (!(FrameCounter % 4))
        PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);
@@ -5024,13 +5329,13 @@ void GameActions()
              element == EL_MAGIC_WALL_FULL)
          {
            Feld[x][y] = EL_MAGIC_WALL_DEAD;
-           DrawLevelField(x, y);
+           DrawNewLevelField(x, y);
          }
          else if (element == EL_BD_MAGIC_WALL_ACTIVE ||
                   element == EL_BD_MAGIC_WALL_FULL)
          {
            Feld[x][y] = EL_BD_MAGIC_WALL_DEAD;
-           DrawLevelField(x, y);
+           DrawNewLevelField(x, y);
          }
        }
 
@@ -5184,13 +5489,14 @@ void ScrollLevel(int dx, int dy)
   {
     x = (dx == 1 ? BX1 : BX2);
     for (y=BY1; y<=BY2; y++)
-      DrawScreenField(x, y);
+      DrawNewScreenField(x, y);
   }
+
   if (dy)
   {
     y = (dy == 1 ? BY1 : BY2);
     for (x=BX1; x<=BX2; x++)
-      DrawScreenField(x, y);
+      DrawNewScreenField(x, y);
   }
 
   redraw_mask |= REDRAW_FIELD;
@@ -5431,7 +5737,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);
 
-    DrawLevelField(jx, jy);    /* for "ErdreichAnbroeckeln()" */
+    DrawNewLevelField(jx, jy); /* for "ErdreichAnbroeckeln()" */
 
     player->last_move_dir = player->MovDir;
     player->is_moving = TRUE;
@@ -6030,7 +6336,7 @@ int DigField(struct PlayerInfo *player,
       Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE;
       ZX = x;
       ZY = y;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
       PlaySoundLevel(x, y, SND_ROBOT_WHEEL_ACTIVATING);
       return MF_ACTION;
       break;
@@ -6186,7 +6492,7 @@ int DigField(struct PlayerInfo *player,
 
       player->push_delay_value = (element == EL_SPRING ? 0 : 2 + RND(8));
 
-      DrawLevelField(x+dx, y+dy);
+      DrawNewLevelField(x + dx, y + dy);
       PlaySoundLevelElementAction(x, y, element, SND_ACTION_PUSHING);
       break;
 
@@ -6356,7 +6662,7 @@ int DigField(struct PlayerInfo *player,
     case EL_LAMP:
       Feld[x][y] = EL_LAMP_ACTIVE;
       local_player->lights_still_needed--;
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
       PlaySoundLevel(x, y, SND_LAMP_ACTIVATING);
       return MF_ACTION;
       break;
@@ -6365,7 +6671,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);
-      DrawLevelField(x, y);
+      DrawNewLevelField(x, y);
       PlaySoundStereo(SND_TIME_ORB_FULL_COLLECTING, SOUND_MAX_RIGHT);
       return MF_ACTION;
       break;
@@ -6450,8 +6756,8 @@ int DigField(struct PlayerInfo *player,
 
       player->push_delay_value = (element == EL_BALLOON ? 0 : 2);
 
-      DrawLevelField(x, y);
-      DrawLevelField(x+dx, y+dy);
+      DrawNewLevelField(x, y);
+      DrawNewLevelField(x + dx, y + dy);
 
       if (IS_SB_ELEMENT(element) &&
          local_player->sokobanfields_still_needed == 0 &&
@@ -6509,7 +6815,7 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy)
     return FALSE;
 
   player->snapped = TRUE;
-  DrawLevelField(x, y);
+  DrawNewLevelField(x, y);
   BackToFront();
 
   return TRUE;
@@ -6541,10 +6847,18 @@ boolean PlaceBomb(struct PlayerInfo *player)
             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);
       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
     }
 
     PlaySoundLevel(jx, jy, SND_DYNAMITE_DROPPING);
@@ -6556,7 +6870,12 @@ boolean PlaceBomb(struct PlayerInfo *player)
     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
 
     PlaySoundLevel(jx, jy, SND_DYNABOMB_DROPPING);
   }