rnd-20060310-1-src
[rocksndiamonds.git] / src / tools.c
index 4ce303450a2ec08fe552271eef51a8758dcd22f2..04b3c424867d5ab640265bdf8cec15703b55abb0 100644 (file)
@@ -903,10 +903,6 @@ void DrawLevelFieldThruMask(int x, int y)
   DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING);
 }
 
-#define TILE_GFX_ELEMENT(x, y)                                             \
-       (GfxElement[x][y] != EL_UNDEFINED && Feld[x][y] != EL_EXPLOSION ?   \
-        GfxElement[x][y] : Feld[x][y])
-
 static void DrawLevelFieldCrumbledSandExt(int x, int y, int graphic, int frame)
 {
   Bitmap *src_bitmap;
@@ -1041,10 +1037,17 @@ void DrawLevelFieldCrumbledSand(int x, int y)
     return;
 
 #if 1
+  /*
+  if (Feld[x][y] == EL_ELEMENT_SNAPPING &&
+      GFX_CRUMBLED(GfxElement[x][y]))
+  */
+
   if (Feld[x][y] == EL_ELEMENT_SNAPPING &&
+      GfxElement[x][y] != EL_UNDEFINED &&
       GFX_CRUMBLED(GfxElement[x][y]))
   {
     DrawLevelFieldCrumbledSandDigging(x, y, GfxDir[x][y], GfxFrame[x][y]);
+
     return;
   }
 #endif
@@ -2020,7 +2023,9 @@ void DrawPlayer(struct PlayerInfo *player)
 
   if (player_is_moving && last_element == EL_EXPLOSION)
   {
-    int graphic = el_act2img(GfxElement[last_jx][last_jy], ACTION_EXPLODING);
+    int element = (GfxElement[last_jx][last_jy] != EL_UNDEFINED ?
+                  GfxElement[last_jx][last_jy] :  EL_EMPTY);
+    int graphic = el_act2img(element, ACTION_EXPLODING);
     int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
     int phase = ExplodePhase[last_jx][last_jy] - 1;
     int frame = getGraphicAnimationFrame(graphic, phase - delay);
@@ -3469,19 +3474,19 @@ em_object_mapping_list[] =
   },
   {
     Xeater_n,                          TRUE,   FALSE,
-    EL_YAMYAM,                         -1, -1
+    EL_YAMYAM_UP,                      -1, -1
   },
   {
-    Xeater_e,                          FALSE,  FALSE,
-    EL_YAMYAM,                         -1, -1
+    Xeater_e,                          TRUE,   FALSE,
+    EL_YAMYAM_RIGHT,                   -1, -1
   },
   {
-    Xeater_w,                          FALSE,  FALSE,
-    EL_YAMYAM,                         -1, -1
+    Xeater_w,                          TRUE,   FALSE,
+    EL_YAMYAM_LEFT,                    -1, -1
   },
   {
-    Xeater_s,                          FALSE,  FALSE,
-    EL_YAMYAM,                         -1, -1
+    Xeater_s,                          TRUE,   FALSE,
+    EL_YAMYAM_DOWN,                    -1, -1
   },
   {
     Yeater_n,                          FALSE,  FALSE,
@@ -4591,10 +4596,6 @@ em_object_mapping_list[] =
     Xalpha_copyr,                      TRUE,   FALSE,
     EL_CHAR('©'),                      -1, -1
   },
-  {
-    Xalpha_copyr,                      TRUE,   FALSE,
-    EL_CHAR('©'),                      -1, -1
-  },
 
   {
     Xboom_bug,                         FALSE,  FALSE,
@@ -5114,19 +5115,9 @@ int font2baseimg(int font_nr)
   return font_info[font_nr].special_graphic[GFX_SPECIAL_ARG_DEFAULT];
 }
 
-int getGameFrameDelay_EM(int native_em_game_frame_delay)
+void setCenteredPlayerNr_EM(int centered_player_nr)
 {
-  int game_frame_delay_value;
-
-  game_frame_delay_value =
-    (tape.playing && tape.fast_forward ? FfwdFrameDelay :
-     GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay :
-     GameFrameDelay);
-
-  if (tape.playing && tape.warp_forward && !tape.pausing)
-    game_frame_delay_value = 0;
-
-  return game_frame_delay_value;
+  game.centered_player_nr = game.centered_player_nr_next = centered_player_nr;
 }
 
 int getCenteredPlayerNr_EM()
@@ -5141,6 +5132,36 @@ int getCenteredPlayerNr_EM()
   return game.centered_player_nr;
 }
 
+int getActivePlayers_EM()
+{
+  int num_players = 0;
+  int i;
+
+  if (!tape.playing)
+    return -1;
+
+  for (i = 0; i < MAX_PLAYERS; i++)
+    if (tape.player_participates[i])
+      num_players++;
+
+  return num_players;
+}
+
+int getGameFrameDelay_EM(int native_em_game_frame_delay)
+{
+  int game_frame_delay_value;
+
+  game_frame_delay_value =
+    (tape.playing && tape.fast_forward ? FfwdFrameDelay :
+     GameFrameDelay == GAME_FRAME_DELAY ? native_em_game_frame_delay :
+     GameFrameDelay);
+
+  if (tape.playing && tape.warp_forward && !tape.pausing)
+    game_frame_delay_value = 0;
+
+  return game_frame_delay_value;
+}
+
 unsigned int InitRND(long seed)
 {
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)