rnd-20021117-1-src
[rocksndiamonds.git] / src / tools.c
index b3dca8a0b8e2616e44d004232646fc46c8f38182..493213367b73499b7da2075f98603ee8dde095e4 100644 (file)
@@ -700,18 +700,25 @@ void DrawPlayer(struct PlayerInfo *player)
 
   if (player_is_moving && last_element == EL_EXPLOSION)
   {
-    int frame = Frame[last_jx][last_jy];
-    int delay = 2;
+    int graphic = IMG_EXPLOSION;
+    int phase = Frame[last_jx][last_jy] - 1;
+    int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
+    int frame = (phase / delay - 1);
 
-    if (frame > 2)
-      DrawGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy), GFX_EXPLOSION,
-                         ((frame - 1) / delay - 1));
+    if (game.emulation == EMU_SUPAPLEX)
+      graphic = (Store[last_jx][last_jy] == EL_SP_INFOTRON ?
+                IMG_SP_EXPLOSION_INFOTRON :
+                IMG_SP_EXPLOSION);
+
+    if (frame >= 0)
+      DrawGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy), graphic, frame);
   }
 
   /* draw elements that stay over the player */
   /* handle the field the player is leaving ... */
   if (player_is_moving && IS_OVER_PLAYER(last_element))
     DrawLevelField(last_jx, last_jy);
+
   /* ... and the field the player is entering */
   if (IS_OVER_PLAYER(element))
     DrawLevelField(jx, jy);
@@ -1271,8 +1278,9 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
 
 inline static int getFramePosition(int x, int y)
 {
+  int frame_pos = -1;          /* default: global synchronization */
+#if 0
   int element = Feld[x][y];
-  int frame_pos = -1;
 
   if (element == EL_QUICKSAND_FULL ||
       element == EL_MAGIC_WALL_FULL ||
@@ -1280,6 +1288,9 @@ inline static int getFramePosition(int x, int y)
     frame_pos = -1;
   else if (IS_MOVING(x, y) || CAN_MOVE(element) || CAN_FALL(element))
     frame_pos = ABS(MovPos[x][y]) / (TILEX / 8);
+#else
+  frame_pos = ABS(MovPos[x][y]) / (TILEX / 8);
+#endif
 
   return frame_pos;
 }
@@ -1288,10 +1299,14 @@ inline static int getGfxAction(int x, int y)
 {
   int gfx_action = GFX_ACTION_DEFAULT;
 
+#if 0
   if (GfxAction[x][y] != GFX_ACTION_DEFAULT)
     gfx_action = GfxAction[x][y];
   else if (IS_MOVING(x, y))
     gfx_action = GFX_ACTION_MOVING;
+#else
+  gfx_action = GfxAction[x][y];
+#endif
 
   return gfx_action;
 }
@@ -1328,32 +1343,6 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
       frame = new_graphic_info[graphic].anim_frames - 1;
     }
   }
-#if 0
-  else if ((element == EL_ROCK ||
-           element == EL_SP_ZONK ||
-           element == EL_BD_ROCK ||
-           element == EL_SP_INFOTRON ||
-           IS_GEM(element))
-          && !cut_mode)
-  {
-    if (uy >= lev_fieldy-1 || !IS_BELT(Feld[ux][uy+1]))
-    {
-      if (element == EL_ROCK ||
-         element == EL_SP_ZONK ||
-         element == EL_BD_ROCK)
-      {
-       if (move_dir == MV_LEFT)
-         graphic += (4 - phase4) % 4;
-       else if (move_dir == MV_RIGHT)
-         graphic += phase4;
-       else
-         graphic += phase2 * 2;
-      }
-      else if (element != EL_SP_INFOTRON)
-       graphic += phase2;
-    }
-  }
-#endif
   else if (IS_AMOEBOID(element) || element == EL_AMOEBA_DRIPPING)
   {
     graphic = (element == EL_BD_AMOEBA ? IMG_BD_AMOEBA_PART1 :
@@ -2857,7 +2846,6 @@ int el2gfx_OLD(int element)
     case EL_TUBE_RIGHT_UP:             return GFX_TUBE_RIGHT_UP;
     case EL_TUBE_RIGHT_DOWN:           return GFX_TUBE_RIGHT_DOWN;
     case EL_SPRING:                    return GFX_SPRING;
-    case EL_SPRING_MOVING:             return GFX_SPRING;
     case EL_TRAP:                      return GFX_TRAP_INACTIVE;
     case EL_TRAP_ACTIVE:               return GFX_TRAP_ACTIVE;
     case EL_BD_WALL:                   return GFX_BD_WALL;