rnd-20051228-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 28 Dec 2005 02:34:39 +0000 (03:34 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:50:06 +0000 (10:50 +0200)
* added change events "switched by player" and "player switches <e>"
* added change events "snapped by player" and "player snaps <e>"
* added "set player artwork: <element choice>" to CE action options
* added change event "move of <element>"

ChangeLog
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/main.h
src/tools.c

index d3ed1b8ee87058abdc55a7f319b029ba8ae3f211..50eb882acd24a91026ffb1a1f7fa930fa893e77c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 2005-12-27
        * changed "score for each 10 seconds/steps left" to "1 second/step"
        * added own score for collecting "extra time" instead of sharing it
+       * added change events "switched by player" and "player switches <e>"
+       * added change events "snapped by player" and "player snaps <e>"
+       * added "set player artwork: <element choice>" to CE action options
+       * added change event "move of <element>"
 
 2005-12-22
        * added "set player shield: off / normal / deadly" to CE action options
index 57c3fa1800bb184ebd1e9b74e03d877cad39a86e..c03ff7929266392c3278109f1daaf3ea4e8a1192 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2005-12-27 23:30]"
+#define COMPILE_DATE_STRING "[2005-12-28 03:11]"
index 2a4700546c28d3b07816007ffd1dc0c841b9960f..37641f11c9a008272547be6d9d5318ba10799772 100644 (file)
@@ -1482,6 +1482,8 @@ static struct ValueTextInfo options_change_direct_action[] =
 {
   { CE_TOUCHED_BY_PLAYER,      "touched by player"             },
   { CE_PRESSED_BY_PLAYER,      "pressed by player"             },
+  { CE_SWITCHED_BY_PLAYER,     "switched by player"            },
+  { CE_SNAPPED_BY_PLAYER,      "snapped by player"             },
   { CE_PUSHED_BY_PLAYER,       "pushed by player"              },
   { CE_ENTERED_BY_PLAYER,      "entered by player"             },
   { CE_LEFT_BY_PLAYER,         "left by player"                },
@@ -1503,6 +1505,8 @@ static struct ValueTextInfo options_change_other_action[] =
 {
   { CE_PLAYER_TOUCHES_X,       "player touches"                },
   { CE_PLAYER_PRESSES_X,       "player presses"                },
+  { CE_PLAYER_SWITCHES_X,      "player switches"               },
+  { CE_PLAYER_SNAPS_X,         "player snaps"                  },
   { CE_PLAYER_PUSHES_X,                "player pushes"                 },
   { CE_PLAYER_ENTERS_X,                "player enters"                 },
   { CE_PLAYER_LEAVES_X,                "player leaves"                 },
@@ -1515,6 +1519,7 @@ static struct ValueTextInfo options_change_other_action[] =
   { CE_SWITCH_OF_X,            "switch of"                     },
   { CE_CHANGE_OF_X,            "change by page of"             },
   { CE_EXPLOSION_OF_X,         "explosion of"                  },
+  { CE_MOVE_OF_X,              "move of"                       },
   { CE_VALUE_GETS_ZERO_OF_X,   "CE value gets 0 of"            },
 
   { -1,                                NULL                            }
@@ -1781,6 +1786,8 @@ static struct ValueTextInfo options_action_arg_artwork[] =
   { CA_ARG_ELEMENT_HEADLINE,   "[element]"                     },
   { CA_ARG_ELEMENT_TARGET,     "target"                        },
   { CA_ARG_ELEMENT_TRIGGER,    "trigger"                       },
+  { CA_ARG_UNDEFINED,          " "                             },
+  { CA_ARG_ELEMENT_RESET,      "reset"                         },
 
   { -1,                                NULL                            }
 };
@@ -6259,6 +6266,8 @@ static void CopyCustomElementPropertiesToEditor(int element)
   custom_element_change.direct_action =
     (HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
      HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
+     HAS_CHANGE_EVENT(element, CE_SWITCHED_BY_PLAYER) ? CE_SWITCHED_BY_PLAYER :
+     HAS_CHANGE_EVENT(element, CE_SNAPPED_BY_PLAYER) ? CE_SNAPPED_BY_PLAYER :
      HAS_CHANGE_EVENT(element, CE_PUSHED_BY_PLAYER) ? CE_PUSHED_BY_PLAYER :
      HAS_CHANGE_EVENT(element, CE_ENTERED_BY_PLAYER) ? CE_ENTERED_BY_PLAYER :
      HAS_CHANGE_EVENT(element, CE_LEFT_BY_PLAYER) ? CE_LEFT_BY_PLAYER :
@@ -6276,6 +6285,8 @@ static void CopyCustomElementPropertiesToEditor(int element)
   custom_element_change.other_action =
     (HAS_CHANGE_EVENT(element, CE_PLAYER_TOUCHES_X) ? CE_PLAYER_TOUCHES_X :
      HAS_CHANGE_EVENT(element, CE_PLAYER_PRESSES_X) ? CE_PLAYER_PRESSES_X :
+     HAS_CHANGE_EVENT(element, CE_PLAYER_SWITCHES_X) ? CE_PLAYER_SWITCHES_X :
+     HAS_CHANGE_EVENT(element, CE_PLAYER_SNAPS_X) ? CE_PLAYER_SNAPS_X :
      HAS_CHANGE_EVENT(element, CE_PLAYER_PUSHES_X) ? CE_PLAYER_PUSHES_X :
      HAS_CHANGE_EVENT(element, CE_PLAYER_ENTERS_X) ? CE_PLAYER_ENTERS_X :
      HAS_CHANGE_EVENT(element, CE_PLAYER_LEAVES_X) ? CE_PLAYER_LEAVES_X :
@@ -6288,6 +6299,7 @@ static void CopyCustomElementPropertiesToEditor(int element)
      HAS_CHANGE_EVENT(element, CE_SWITCH_OF_X) ? CE_SWITCH_OF_X :
      HAS_CHANGE_EVENT(element, CE_CHANGE_OF_X) ? CE_CHANGE_OF_X :
      HAS_CHANGE_EVENT(element, CE_EXPLOSION_OF_X) ? CE_EXPLOSION_OF_X :
+     HAS_CHANGE_EVENT(element, CE_MOVE_OF_X) ? CE_MOVE_OF_X :
      HAS_CHANGE_EVENT(element, CE_VALUE_GETS_ZERO_OF_X) ? CE_VALUE_GETS_ZERO_OF_X :
      custom_element_change.other_action);
 }
@@ -6393,6 +6405,8 @@ static void CopyCustomElementPropertiesToGame(int element)
   /* set player change event from checkbox and selectbox */
   custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE;
+  custom_element_change_events[CE_SWITCHED_BY_PLAYER] = FALSE;
+  custom_element_change_events[CE_SNAPPED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_PUSHED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
@@ -6410,6 +6424,8 @@ static void CopyCustomElementPropertiesToGame(int element)
   /* set other element action change event from checkbox and selectbox */
   custom_element_change_events[CE_PLAYER_TOUCHES_X] = FALSE;
   custom_element_change_events[CE_PLAYER_PRESSES_X] = FALSE;
+  custom_element_change_events[CE_PLAYER_SWITCHES_X] = FALSE;
+  custom_element_change_events[CE_PLAYER_SNAPS_X] = FALSE;
   custom_element_change_events[CE_PLAYER_PUSHES_X] = FALSE;
   custom_element_change_events[CE_PLAYER_ENTERS_X] = FALSE;
   custom_element_change_events[CE_PLAYER_LEAVES_X] = FALSE;
@@ -6422,6 +6438,7 @@ static void CopyCustomElementPropertiesToGame(int element)
   custom_element_change_events[CE_SWITCH_OF_X] = FALSE;
   custom_element_change_events[CE_CHANGE_OF_X] = FALSE;
   custom_element_change_events[CE_EXPLOSION_OF_X] = FALSE;
+  custom_element_change_events[CE_MOVE_OF_X] = FALSE;
   custom_element_change_events[CE_VALUE_GETS_ZERO_OF_X] = FALSE;
   custom_element_change_events[custom_element_change.other_action] =
     custom_element_change_events[CE_BY_OTHER_ACTION];
@@ -6679,6 +6696,9 @@ static void ModifyEditorDrawingArea(int drawingarea_id, int xsize, int ysize)
   int gadget_id = drawingarea_info[drawingarea_id].gadget_id;
   struct GadgetInfo *gi = level_editor_gadget[gadget_id];
 
+  drawingarea_info[drawingarea_id].area_xsize = xsize;
+  drawingarea_info[drawingarea_id].area_ysize = ysize;
+
   ModifyGadget(gi, GDI_AREA_SIZE, xsize, ysize, GDI_END);
 }
 
index b867a6b330228c75c9575b10e3534b824362ee43..d8695d7a6f64fef32245ed68b24f630430697ad2 100644 (file)
@@ -1456,8 +1456,9 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
     /* always start with reliable default values */
     setElementChangeInfoToDefaults(change);
 
+    /* bits 0 - 31 of "has_event[]" ... */
     event_bits = getFile32BitBE(file);
-    for (j = 0; j < NUM_CHANGE_EVENTS; j++)
+    for (j = 0; j < MIN(NUM_CHANGE_EVENTS, 32); j++)
       if (event_bits & (1 << j))
        change->has_event[j] = TRUE;
 
@@ -1496,8 +1497,11 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
     change->action_mode = getFile8Bit(file);
     change->action_arg = getFile16BitBE(file);
 
-    /* some free bytes for future change property values and padding */
-    ReadUnusedBytesFromFile(file, 1);
+    /* ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible) */
+    event_bits = getFile8Bit(file);
+    for (j = 32; j < NUM_CHANGE_EVENTS; j++)
+      if (event_bits & (1 << (j - 32)))
+       change->has_event[j] = TRUE;
   }
 
   /* mark this custom element as modified */
@@ -3496,12 +3500,13 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
   for (i = 0; i < ei->num_change_pages; i++)
   {
     struct ElementChangeInfo *change = &ei->change_page[i];
-    unsigned long event_bits = 0;
+    unsigned long event_bits;
 
-    for (j = 0; j < NUM_CHANGE_EVENTS; j++)
+    /* bits 0 - 31 of "has_event[]" ... */
+    event_bits = 0;
+    for (j = 0; j < MIN(NUM_CHANGE_EVENTS, 32); j++)
       if (change->has_event[j])
        event_bits |= (1 << j);
-
     putFile32BitBE(file, event_bits);
 
     putFile16BitBE(file, change->target_element);
@@ -3537,8 +3542,12 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
     putFile8Bit(file, change->action_mode);
     putFile16BitBE(file, change->action_arg);
 
-    /* some free bytes for future change property values and padding */
-    WriteUnusedBytesToFile(file, 1);
+    /* ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible) */
+    event_bits = 0;
+    for (j = 32; j < NUM_CHANGE_EVENTS; j++)
+      if (change->has_event[j])
+       event_bits |= (1 << (j - 32));
+    putFile8Bit(file, event_bits);
   }
 }
 
index aec9cfc3fbbf266cf1c0e4daf5d2df3edb457027..f7272d14a9e67ede968ad3461ace4cc7df37fbdb 100644 (file)
 
 /* forward declaration for internal use */
 
+static void SetPlayerWaiting(struct PlayerInfo *, boolean);
 static void AdvanceFrameAndPlayerCounters(int);
 
 static boolean MovePlayerOneStep(struct PlayerInfo *, int, int, int, int);
@@ -680,7 +681,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game)
       }
       else
       {
-       stored_player[0].use_murphy_graphic = TRUE;
+       stored_player[0].use_murphy = TRUE;
       }
 
       Feld[x][y] = EL_PLAYER_1;
@@ -1473,6 +1474,28 @@ static void InitGameEngine()
       access_direction_list[i].direction;
 }
 
+int get_num_special_action(int element, int action_first, int action_last)
+{
+  int num_special_action = 0;
+  int i, j;
+
+  for (i = action_first; i <= action_last; i++)
+  {
+    boolean found = FALSE;
+
+    for (j = 0; j < NUM_DIRECTIONS; j++)
+      if (el_act_dir2img(element, i, j) !=
+         el_act_dir2img(element, ACTION_DEFAULT, j))
+       found = TRUE;
+
+    if (found)
+      num_special_action++;
+    else
+      break;
+  }
+
+  return num_special_action;
+}
 
 /*
   =============================================================================
@@ -1487,7 +1510,7 @@ void InitGame()
   boolean emulate_bd = TRUE;   /* unless non-BOULDERDASH elements found */
   boolean emulate_sb = TRUE;   /* unless non-SOKOBAN     elements found */
   boolean emulate_sp = TRUE;   /* unless non-SUPAPLEX    elements found */
-  int i, j, k, x, y;
+  int i, j, x, y;
 
   InitGameEngine();
 
@@ -1531,7 +1554,8 @@ void InitGame()
     player->Frame = 0;
     player->StepFrame = 0;
 
-    player->use_murphy_graphic = FALSE;
+    player->use_murphy = FALSE;
+    player->artwork_element = player->element_nr;
 
     player->block_last_field = FALSE;  /* initialized in InitPlayerField() */
     player->block_delay_adjustment = 0;        /* initialized in InitPlayerField() */
@@ -1570,38 +1594,13 @@ void InitGame()
     player->special_action_bored = ACTION_DEFAULT;
     player->special_action_sleeping = ACTION_DEFAULT;
 
-    player->num_special_action_bored = 0;
-    player->num_special_action_sleeping = 0;
-
-    /* determine number of special actions for bored and sleeping animation */
-    for (j = ACTION_BORING_1; j <= ACTION_BORING_LAST; j++)
-    {
-      boolean found = FALSE;
-
-      for (k = 0; k < NUM_DIRECTIONS; k++)
-       if (el_act_dir2img(player->element_nr, j, k) !=
-           el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
-         found = TRUE;
-
-      if (found)
-       player->num_special_action_bored++;
-      else
-       break;
-    }
-    for (j = ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++)
-    {
-      boolean found = FALSE;
-
-      for (k = 0; k < NUM_DIRECTIONS; k++)
-       if (el_act_dir2img(player->element_nr, j, k) !=
-           el_act_dir2img(player->element_nr, ACTION_DEFAULT, k))
-         found = TRUE;
-
-      if (found)
-       player->num_special_action_sleeping++;
-      else
-       break;
-    }
+    /* set number of special actions for bored and sleeping animation */
+    player->num_special_action_bored =
+      get_num_special_action(player->artwork_element,
+                            ACTION_BORING_1, ACTION_BORING_LAST);
+    player->num_special_action_sleeping =
+      get_num_special_action(player->artwork_element,
+                            ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
 
     player->switch_x = -1;
     player->switch_y = -1;
@@ -1821,6 +1820,8 @@ void InitGame()
          player->element_nr = some_player->element_nr;
 #endif
 
+         player->artwork_element = some_player->artwork_element;
+
          player->block_last_field       = some_player->block_last_field;
          player->block_delay_adjustment = some_player->block_delay_adjustment;
 
@@ -3106,7 +3107,7 @@ void Explode(int ex, int ey, int phase, int mode)
            break;
        }
 
-       if (PLAYERINFO(ex, ey)->use_murphy_graphic)
+       if (PLAYERINFO(ex, ey)->use_murphy)
          Store[x][y] = EL_EMPTY;
       }
       else if (center_element == EL_MOLE)
@@ -3364,7 +3365,7 @@ void Bang(int x, int y)
   {
     struct PlayerInfo *player = PLAYERINFO(x, y);
 
-    element = Feld[x][y] = (player->use_murphy_graphic ? EL_SP_MURPHY :
+    element = Feld[x][y] = (player->use_murphy ? EL_SP_MURPHY :
                            player->element_nr);
   }
 
@@ -5667,15 +5668,17 @@ void ContinueMoving(int x, int y)
 
   if (pushed_by_player && !game.use_change_when_pushing_bug)
   {
-    int dig_side = MV_DIR_OPPOSITE(direction);
+    int push_side = MV_DIR_OPPOSITE(direction);
     struct PlayerInfo *player = PLAYERINFO(x, y);
 
     CheckElementChangeByPlayer(newx, newy, element, CE_PUSHED_BY_PLAYER,
-                              player->index_bit, dig_side);
+                              player->index_bit, push_side);
     CheckTriggeredElementChangeByPlayer(newx,newy, element, CE_PLAYER_PUSHES_X,
-                                       player->index_bit, dig_side);
+                                       player->index_bit, push_side);
   }
 
+  CheckTriggeredElementChangeBySide(x, y, element, CE_MOVE_OF_X, direction);
+
   TestIfElementTouchesCustomElement(x, y);     /* empty or new element */
 
   TestIfElementHitsCustomElement(newx, newy, direction);
@@ -6893,7 +6896,25 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
     {
       for (i = 0; i < MAX_PLAYERS; i++)
       {
-       int element = action_arg_element;
+       if (trigger_player_bits & (1 << i))
+       {
+         int artwork_element = action_arg_element;
+
+         if (action_arg == CA_ARG_ELEMENT_RESET)
+           artwork_element = stored_player[i].element_nr;
+
+         stored_player[i].artwork_element = artwork_element;
+
+         SetPlayerWaiting(&stored_player[i], FALSE);
+
+         /* set number of special actions for bored and sleeping animation */
+         stored_player[i].num_special_action_bored =
+           get_num_special_action(artwork_element,
+                                  ACTION_BORING_1, ACTION_BORING_LAST);
+         stored_player[i].num_special_action_sleeping =
+           get_num_special_action(artwork_element,
+                                  ACTION_SLEEPING_1, ACTION_SLEEPING_LAST);
+       }
       }
 
       break;
@@ -7496,24 +7517,24 @@ static boolean CheckElementChangeExt(int x, int y,
 static void PlayPlayerSound(struct PlayerInfo *player)
 {
   int jx = player->jx, jy = player->jy;
-  int element = player->element_nr;
+  int sound_element = player->artwork_element;
   int last_action = player->last_action_waiting;
   int action = player->action_waiting;
 
   if (player->is_waiting)
   {
     if (action != last_action)
-      PlayLevelSoundElementAction(jx, jy, element, action);
+      PlayLevelSoundElementAction(jx, jy, sound_element, action);
     else
-      PlayLevelSoundElementActionIfLoop(jx, jy, element, action);
+      PlayLevelSoundElementActionIfLoop(jx, jy, sound_element, action);
   }
   else
   {
     if (action != last_action)
-      StopSound(element_info[element].sound[last_action]);
+      StopSound(element_info[sound_element].sound[last_action]);
 
     if (last_action == ACTION_SLEEPING)
-      PlayLevelSoundElementAction(jx, jy, element, ACTION_AWAKENING);
+      PlayLevelSoundElementAction(jx, jy, sound_element, ACTION_AWAKENING);
   }
 }
 
@@ -7580,7 +7601,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
             last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ?
             last_special_action + 1 : ACTION_SLEEPING);
          int special_graphic =
-           el_act_dir2img(player->element_nr, special_action, move_dir);
+           el_act_dir2img(player->artwork_element, special_action, move_dir);
 
          player->anim_delay_counter =
            graphic_info[special_graphic].anim_delay_fixed +
@@ -7612,7 +7633,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
          int special_action =
            ACTION_BORING_1 + SimpleRND(player->num_special_action_bored);
          int special_graphic =
-           el_act_dir2img(player->element_nr, special_action, move_dir);
+           el_act_dir2img(player->artwork_element, special_action, move_dir);
 
          player->anim_delay_counter =
            graphic_info[special_graphic].anim_delay_fixed +
@@ -7934,6 +7955,8 @@ void GameActions()
       {
        RemoveField(x, y);
        DrawLevelField(x, y);
+
+       TestIfElementTouchesCustomElement(x, y);        /* for empty space */
       }
     }
 #endif
@@ -8900,6 +8923,9 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
       CheckTriggeredElementChangeByPlayer(jx, jy, new_element,
                                          CE_PLAYER_ENTERS_X,
                                          player->index_bit, enter_side);
+
+      CheckTriggeredElementChangeBySide(jx, jy, player->element_nr,
+                                       CE_MOVE_OF_X, move_direction);
     }
 
     if (game.engine_version >= VERSION_IDENT(3,0,7,0))
@@ -9475,7 +9501,7 @@ void BuryPlayer(struct PlayerInfo *player)
   if (!player->active)
     return;
 
-  PlayLevelSoundElementAction(jx, jy, player->element_nr, ACTION_DYING);
+  PlayLevelSoundElementAction(jx, jy, player->artwork_element, ACTION_DYING);
   PlayLevelSound(jx, jy, SND_GAME_LOSING);
 
   player->GameOver = TRUE;
@@ -9648,7 +9674,17 @@ int DigField(struct PlayerInfo *player,
 
   if (mode == DF_SNAP && !IS_SNAPPABLE(element) &&
       game.engine_version >= VERSION_IDENT(2,2,0,0))
+  {
+    CheckElementChangeByPlayer(x, y, element, CE_SNAPPED_BY_PLAYER,
+                              player->index_bit, dig_side);
+    CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+                                       player->index_bit, dig_side);
+
+    if (Feld[x][y] != element)         /* field changed by snapping */
+      return MF_ACTION;
+
     return MF_NO_ACTION;
+  }
 
   if (game.gravity && is_player && !player->is_auto_moving &&
       canFallDown(player) && move_direction != MV_DOWN &&
@@ -9685,7 +9721,7 @@ int DigField(struct PlayerInfo *player,
     if (element_info[sound_element].sound[sound_action] != SND_UNDEFINED)
       PlayLevelSoundElementAction(x, y, sound_element, sound_action);
     else
-      PlayLevelSoundElementAction(x, y, player->element_nr, sound_action);
+      PlayLevelSoundElementAction(x, y, player->artwork_element, sound_action);
   }
   else if (IS_PASSABLE(element) && canPassField(x, y, move_direction))
   {
@@ -9753,12 +9789,17 @@ int DigField(struct PlayerInfo *player,
 
     if (mode == DF_SNAP)
     {
-      TestIfElementTouchesCustomElement(x, y); /* for empty space */
-
 #if USE_NEW_SNAP_DELAY
       if (level.block_snap_field)
        setFieldForSnapping(x, y, element, move_direction);
+      else
+       TestIfElementTouchesCustomElement(x, y);        /* for empty space */
+#else
+      TestIfElementTouchesCustomElement(x, y);         /* for empty space */
 #endif
+
+      CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+                                         player->index_bit, dig_side);
     }
   }
   else if (IS_COLLECTIBLE(element))
@@ -9850,12 +9891,17 @@ int DigField(struct PlayerInfo *player,
 
     if (mode == DF_SNAP)
     {
-      TestIfElementTouchesCustomElement(x, y); /* for empty space */
-
 #if USE_NEW_SNAP_DELAY
       if (level.block_snap_field)
        setFieldForSnapping(x, y, element, move_direction);
+      else
+       TestIfElementTouchesCustomElement(x, y);        /* for empty space */
+#else
+      TestIfElementTouchesCustomElement(x, y);         /* for empty space */
 #endif
+
+      CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
+                                         player->index_bit, dig_side);
     }
   }
   else if (IS_PUSHABLE(element))
@@ -10082,6 +10128,9 @@ int DigField(struct PlayerInfo *player,
     CheckTriggeredElementChangeByPlayer(x, y, element, CE_SWITCH_OF_X,
                                        player->index_bit, dig_side);
 
+    CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SWITCHES_X,
+                                       player->index_bit, dig_side);
+
     CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PRESSES_X,
                                        player->index_bit, dig_side);
 
@@ -10099,6 +10148,11 @@ int DigField(struct PlayerInfo *player,
                                 player->index_bit, dig_side);
       CheckTriggeredElementChangeByPlayer(x, y, element, CE_SWITCH_OF_X,
                                          player->index_bit, dig_side);
+
+      CheckElementChangeByPlayer(x, y, element, CE_SWITCHED_BY_PLAYER,
+                                player->index_bit, dig_side);
+      CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SWITCHES_X,
+                                         player->index_bit, dig_side);
     }
 
     CheckElementChangeByPlayer(x, y, element, CE_PRESSED_BY_PLAYER,
index e2bfa12bf7bd136384bae2603acd4f1f469576e5..7c73f4d0d6ca47e0a02382beb7f0df0b1807daeb 100644 (file)
 #define CE_HITTING_X                   28
 #define CE_HIT_BY_X                    29
 #define CE_BLOCKED                     30
+#define CE_SWITCHED_BY_PLAYER          31
+#define CE_PLAYER_SWITCHES_X           32
+#define CE_SNAPPED_BY_PLAYER           33
+#define CE_PLAYER_SNAPS_X              34
+#define CE_MOVE_OF_X                   35
 
-#define NUM_CHANGE_EVENTS              31
+#define NUM_CHANGE_EVENTS              36
 
 #define CE_BITMASK_DEFAULT             0
 
 #define CA_ARG_NUMBER_LEVEL_SCORE      (CA_ARG_NUMBER + 8)
 #define CA_ARG_NUMBER_HEADLINE         (CA_ARG_NUMBER + 999)
 #define CA_ARG_ELEMENT                 12000
-#define CA_ARG_ELEMENT_TARGET          (CA_ARG_ELEMENT + 0)
-#define CA_ARG_ELEMENT_TRIGGER         (CA_ARG_ELEMENT + 1)
+#define CA_ARG_ELEMENT_RESET           (CA_ARG_ELEMENT + 0)
+#define CA_ARG_ELEMENT_TARGET          (CA_ARG_ELEMENT + 1)
+#define CA_ARG_ELEMENT_TRIGGER         (CA_ARG_ELEMENT + 2)
 #define CA_ARG_ELEMENT_HEADLINE                (CA_ARG_ELEMENT + 999)
 #define CA_ARG_SPEED                   13000
 #define CA_ARG_SPEED_NOT_MOVING                (CA_ARG_SPEED + 0)
@@ -1667,7 +1673,8 @@ struct PlayerInfo
 
   int GfxAction;
 
-  boolean use_murphy_graphic;
+  boolean use_murphy;
+  int artwork_element;
 
   boolean block_last_field;
   int block_delay_adjustment;  /* needed for different engine versions */
index a2797839332a92db3510b692b4ddb87f35dae408..d310511196e7dc177f044c9317972abea7ab0467 100644 (file)
@@ -1750,7 +1750,7 @@ void DrawLevelElementAnimationIfNeeded(int x, int y, int element)
 
 static int getPlayerGraphic(struct PlayerInfo *player, int move_dir)
 {
-  if (player->use_murphy_graphic)
+  if (player->use_murphy)
   {
     /* this works only because currently only one player can be "murphy" ... */
     static int last_horizontal_dir = MV_LEFT;
@@ -1769,7 +1769,7 @@ static int getPlayerGraphic(struct PlayerInfo *player, int move_dir)
     return graphic;
   }
   else
-    return el_act_dir2img(player->element_nr, player->GfxAction, move_dir);
+    return el_act_dir2img(player->artwork_element, player->GfxAction,move_dir);
 }
 
 static boolean equalGraphics(int graphic1, int graphic2)