rnd-20050627-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 27 Jun 2005 19:30:18 +0000 (21:30 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:49:10 +0000 (10:49 +0200)
* fixed bug causing "change when impact" on player not working
* fixed wrong priority of "hitting something" over "hitting <element>"
* fixed wrong priority of "hit by something" over "hit by <element>"

ChangeLog
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/libgame/system.c
src/libgame/system.h
src/main.h

index 80790f89f2e4c1cafdbdb7907296e1c4c7fbc11b..b37248b2e8da398b8d041632c1c7d63e6c6982bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-26
+       * fixed bug causing "change when impact" on player not working
+       * fixed wrong priority of "hitting something" over "hitting <element>"
+       * fixed wrong priority of "hit by something" over "hit by <element>"
+
 2005-06-14
        * fixed graphical bug which caused the player (being Murphy) to show
          collecting animations although the element was collected by penguin
index e4df14d9c797ea51bcb14e75f4af2cf62865cf2b..b8a6c3ad45dd9610497e46d2764a3e1e7653692f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2005-06-26 20:02]"
+#define COMPILE_DATE_STRING "[2005-06-27 21:21]"
index 0550f3e71131692d973f83ace88ad3bd14724aa1..1ff0015f889c41ee87b02bc6794cf8b70e7a6189 100644 (file)
@@ -1428,22 +1428,22 @@ static struct ValueTextInfo options_change_direct_action[] =
 
 static struct ValueTextInfo options_change_other_action[] =
 {
-  { CE_OTHER_GETS_TOUCHED,     "player touches"                },
-  { CE_OTHER_GETS_PRESSED,     "player presses"                },
-  { CE_OTHER_GETS_PUSHED,      "player pushes"                 },
-  { CE_OTHER_GETS_ENTERED,     "player enters"                 },
-  { CE_OTHER_GETS_LEFT,                "player leaves"                 },
-  { CE_OTHER_GETS_DIGGED,      "player digs"                   },
-  { CE_OTHER_GETS_COLLECTED,   "player collects"               },
-  { CE_OTHER_GETS_DROPPED,     "player drops/throws"           },
-  { CE_OTHER_IS_TOUCHING,      "touching"                      },
+  { CE_PLAYER_TOUCHES_X,       "player touches"                },
+  { CE_PLAYER_PRESSES_X,       "player presses"                },
+  { CE_PLAYER_PUSHES_X,                "player pushes"                 },
+  { CE_PLAYER_ENTERS_X,                "player enters"                 },
+  { CE_PLAYER_LEAVES_X,                "player leaves"                 },
+  { CE_PLAYER_DIGS_X,          "player digs"                   },
+  { CE_PLAYER_COLLECTS_X,      "player collects"               },
+  { CE_PLAYER_DROPS_X,         "player drops/throws"           },
+  { CE_TOUCHING_X,             "touching"                      },
 #if 1
-  { CE_OTHER_IS_HITTING,       "hitting"                       },
-  { CE_OTHER_GETS_HIT,         "hit by"                        },
+  { CE_HITTING_X,              "hitting"                       },
+  { CE_HIT_BY_X,               "hit by"                        },
 #endif
-  { CE_OTHER_IS_SWITCHING,     "switch of"                     },
-  { CE_OTHER_IS_CHANGING,      "change by page of"             },
-  { CE_OTHER_IS_EXPLODING,     "explosion of"                  },
+  { CE_SWITCH_OF_X,            "switch of"                     },
+  { CE_CHANGE_OF_X,            "change by page of"             },
+  { CE_EXPLOSION_OF_X,         "explosion of"                  },
 
   { -1,                                NULL                            }
 };
@@ -6174,20 +6174,20 @@ static void CopyCustomElementPropertiesToEditor(int element)
 
   /* set "change by other element action" selectbox help value */
   custom_element_change.other_action =
-    (HAS_CHANGE_EVENT(element, CE_OTHER_GETS_TOUCHED) ? CE_OTHER_GETS_TOUCHED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PRESSED) ? CE_OTHER_GETS_PRESSED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_PUSHED) ? CE_OTHER_GETS_PUSHED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_ENTERED) ? CE_OTHER_GETS_ENTERED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_LEFT) ? CE_OTHER_GETS_LEFT :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DIGGED) ? CE_OTHER_GETS_DIGGED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_COLLECTED) ? CE_OTHER_GETS_COLLECTED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_DROPPED) ? CE_OTHER_GETS_DROPPED :
-     HAS_CHANGE_EVENT(element, CE_OTHER_IS_TOUCHING) ? CE_OTHER_IS_TOUCHING :
-     HAS_CHANGE_EVENT(element, CE_OTHER_IS_HITTING) ? CE_OTHER_IS_HITTING :
-     HAS_CHANGE_EVENT(element, CE_OTHER_GETS_HIT) ? CE_OTHER_GETS_HIT :
-     HAS_CHANGE_EVENT(element, CE_OTHER_IS_SWITCHING) ? CE_OTHER_IS_SWITCHING :
-     HAS_CHANGE_EVENT(element, CE_OTHER_IS_CHANGING) ? CE_OTHER_IS_CHANGING :
-     HAS_CHANGE_EVENT(element, CE_OTHER_IS_EXPLODING) ? CE_OTHER_IS_EXPLODING :
+    (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_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 :
+     HAS_CHANGE_EVENT(element, CE_PLAYER_DIGS_X) ? CE_PLAYER_DIGS_X :
+     HAS_CHANGE_EVENT(element, CE_PLAYER_COLLECTS_X) ? CE_PLAYER_COLLECTS_X :
+     HAS_CHANGE_EVENT(element, CE_PLAYER_DROPS_X) ? CE_PLAYER_DROPS_X :
+     HAS_CHANGE_EVENT(element, CE_TOUCHING_X) ? CE_TOUCHING_X :
+     HAS_CHANGE_EVENT(element, CE_HITTING_X) ? CE_HITTING_X :
+     HAS_CHANGE_EVENT(element, CE_HIT_BY_X) ? CE_HIT_BY_X :
+     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 :
      custom_element_change.other_action);
 }
 
@@ -6363,20 +6363,20 @@ static void CopyCustomElementPropertiesToGame(int element)
     custom_element_change_events[CE_BY_DIRECT_ACTION];
 
   /* set other element action change event from checkbox and selectbox */
-  custom_element_change_events[CE_OTHER_GETS_TOUCHED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_PRESSED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_PUSHED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_ENTERED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_LEFT] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_DIGGED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_COLLECTED] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_DROPPED] = FALSE;
-  custom_element_change_events[CE_OTHER_IS_TOUCHING] = FALSE;
-  custom_element_change_events[CE_OTHER_IS_HITTING] = FALSE;
-  custom_element_change_events[CE_OTHER_GETS_HIT] = FALSE;
-  custom_element_change_events[CE_OTHER_IS_SWITCHING] = FALSE;
-  custom_element_change_events[CE_OTHER_IS_CHANGING] = FALSE;
-  custom_element_change_events[CE_OTHER_IS_EXPLODING] = FALSE;
+  custom_element_change_events[CE_PLAYER_TOUCHES_X] = FALSE;
+  custom_element_change_events[CE_PLAYER_PRESSES_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;
+  custom_element_change_events[CE_PLAYER_DIGS_X] = FALSE;
+  custom_element_change_events[CE_PLAYER_COLLECTS_X] = FALSE;
+  custom_element_change_events[CE_PLAYER_DROPS_X] = FALSE;
+  custom_element_change_events[CE_TOUCHING_X] = FALSE;
+  custom_element_change_events[CE_HITTING_X] = FALSE;
+  custom_element_change_events[CE_HIT_BY_X] = FALSE;
+  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[custom_element_change.other_action] =
     custom_element_change_events[CE_BY_OTHER_ACTION];
 
index 1ed2f7de5e480000a197291e6cc62d91da224ad4..93ab6bc8e1b564612179ae24109ec3be17b2684c 100644 (file)
@@ -2721,7 +2721,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename)
       }
 
       /* order of checking and copying events to be mapped is important */
-      for (j = CE_OTHER_GETS_COLLECTED; j >= CE_HITTING_SOMETHING; j--)
+      for (j = CE_PLAYER_COLLECTS_X; j >= CE_HITTING_SOMETHING; j--)
       {
        if (HAS_CHANGE_EVENT(element, j - 1))
        {
index ed511ad661728b37f43cddf69a21d001dad8e42c..dd8af0d3679aa16450f8a65fac907bd7aadab7ee 100644 (file)
@@ -51,6 +51,9 @@
 
 #define USE_IMPACT_BUGFIX              (TRUE   * USE_NEW_STUFF         * 1)
 
+#define USE_HITTING_SOMETHING_BUGFIX   (TRUE   * USE_NEW_STUFF         * 1)
+#define USE_HIT_BY_SOMETHING_BUGFIX    (TRUE   * USE_NEW_STUFF         * 1)
+
 
 /* for DigField() */
 #define DF_NO_PUSH             0
@@ -3207,7 +3210,7 @@ void RelocatePlayer(int jx, int jy, int el_player_raw)
                               player->index_bit, leave_side);
 
   CheckTriggeredElementChangeByPlayer(old_jx, old_jy, old_element,
-                                     CE_OTHER_GETS_LEFT,
+                                     CE_PLAYER_LEAVES_X,
                                      player->index_bit, leave_side);
 #endif
 
@@ -3259,7 +3262,7 @@ void RelocatePlayer(int jx, int jy, int el_player_raw)
                               player->index_bit, enter_side);
 
   CheckTriggeredElementChangeByPlayer(jx, jy, element,
-                                     CE_OTHER_GETS_ENTERED,
+                                     CE_PLAYER_ENTERS_X,
                                      player->index_bit, enter_side);
 #endif
 }
@@ -4030,7 +4033,7 @@ void Bang(int x, int y)
       break;
   }
 
-  CheckTriggeredElementChange(x, y, element, CE_OTHER_IS_EXPLODING);
+  CheckTriggeredElementChange(x, y, element, CE_EXPLOSION_OF_X);
 }
 
 void SplashAcid(int x, int y)
@@ -4398,6 +4401,10 @@ void Impact(int x, int y)
   int element = Feld[x][y];
   int smashed = EL_STEELWALL;
 
+#if 0
+  printf("IMPACT!\n");
+#endif
+
   if (!lastline)       /* check if element below was hit */
   {
     if (Feld[x][y + 1] == EL_PLAYER_IS_LEAVING)
@@ -4604,10 +4611,10 @@ void Impact(int x, int y)
          CheckElementChangeBySide(x, y + 1, smashed, element,
                                   CE_SWITCHED, CH_SIDE_TOP);
          CheckTriggeredElementChangeBySide(x, y + 1, smashed,
-                                           CE_OTHER_IS_SWITCHING,CH_SIDE_TOP);
+                                           CE_SWITCH_OF_X, CH_SIDE_TOP);
 #else
          CheckTriggeredElementChangeBySide(x, y + 1, smashed,
-                                           CE_OTHER_IS_SWITCHING,CH_SIDE_TOP);
+                                           CE_SWITCH_OF_X, CH_SIDE_TOP);
          CheckElementChangeBySide(x, y + 1, smashed, element,
                                   CE_SWITCHED, CH_SIDE_TOP);
 #endif
@@ -5813,8 +5820,8 @@ void StartMoving(int x, int y)
             WasJustMoving[x][y],
             HAS_ANY_CHANGE_EVENT(element, CE_HITTING_SOMETHING),
             HAS_ANY_CHANGE_EVENT(element, CE_HIT_BY_SOMETHING),
-            HAS_ANY_CHANGE_EVENT(element, CE_OTHER_IS_HITTING),
-            HAS_ANY_CHANGE_EVENT(element, CE_OTHER_GETS_HIT));
+            HAS_ANY_CHANGE_EVENT(element, CE_HITTING_X),
+            HAS_ANY_CHANGE_EVENT(element, CE_HIT_BY_X));
 #endif
 
 #if 1
@@ -6789,7 +6796,7 @@ void ContinueMoving(int x, int y)
 
     CheckElementChangeByPlayer(newx, newy, element, CE_PUSHED_BY_PLAYER,
                               player->index_bit, dig_side);
-    CheckTriggeredElementChangeByPlayer(newx,newy,element,CE_OTHER_GETS_PUSHED,
+    CheckTriggeredElementChangeByPlayer(newx,newy, element, CE_PLAYER_PUSHES_X,
                                        player->index_bit, dig_side);
   }
 #endif
@@ -6836,7 +6843,7 @@ void ContinueMoving(int x, int y)
                                 CE_HIT_BY_SOMETHING, opposite_direction);
 
        if (IS_CUSTOM_ELEMENT(hitting_element) &&
-           HAS_ANY_CHANGE_EVENT(hitting_element, CE_OTHER_IS_HITTING))
+           HAS_ANY_CHANGE_EVENT(hitting_element, CE_HITTING_X))
        {
          for (i = 0; i < element_info[hitting_element].num_change_pages; i++)
          {
@@ -6844,19 +6851,19 @@ void ContinueMoving(int x, int y)
              &element_info[hitting_element].change_page[i];
 
            if (change->can_change &&
-               change->has_event[CE_OTHER_IS_HITTING] &&
+               change->has_event[CE_HITTING_X] &&
                change->trigger_side & touched_side &&
                change->trigger_element == touched_element)
            {
              CheckElementChangeByPage(newx, newy, hitting_element,
-                                      touched_element, CE_OTHER_IS_HITTING,i);
+                                      touched_element, CE_HITTING_X, i);
              break;
            }
          }
        }
 
        if (IS_CUSTOM_ELEMENT(touched_element) &&
-           HAS_ANY_CHANGE_EVENT(touched_element, CE_OTHER_GETS_HIT))
+           HAS_ANY_CHANGE_EVENT(touched_element, CE_HIT_BY_X))
        {
          for (i = 0; i < element_info[touched_element].num_change_pages; i++)
          {
@@ -6864,12 +6871,12 @@ void ContinueMoving(int x, int y)
              &element_info[touched_element].change_page[i];
 
            if (change->can_change &&
-               change->has_event[CE_OTHER_GETS_HIT] &&
+               change->has_event[CE_HIT_BY_X] &&
                change->trigger_side & hitting_side &&
                change->trigger_element == hitting_element)
            {
              CheckElementChangeByPage(nextx, nexty, touched_element,
-                                      hitting_element, CE_OTHER_GETS_HIT, i);
+                                      hitting_element, CE_HIT_BY_X,i);
              break;
            }
          }
@@ -7946,7 +7953,7 @@ static boolean ChangeElementNow(int x, int y, int element, int page)
 
 #if 0
   /* !!! indirect change before direct change !!! */
-  CheckTriggeredElementChangeByPage(x,y,Feld[x][y], CE_OTHER_IS_CHANGING,page);
+  CheckTriggeredElementChangeByPage(x, y, Feld[x][y], CE_CHANGE_OF_X, page);
 #endif
 
   if (change->explode)
@@ -8115,7 +8122,7 @@ static boolean ChangeElementNow(int x, int y, int element, int page)
 
 #if 1
   /* this uses direct change before indirect change */
-  CheckTriggeredElementChangeByPage(x,y,old_element,CE_OTHER_IS_CHANGING,page);
+  CheckTriggeredElementChangeByPage(x, y, old_element, CE_CHANGE_OF_X, page);
 #endif
 
   return TRUE;
@@ -9905,7 +9912,7 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
 #if 0
   if (IS_CUSTOM_ELEMENT(Feld[jx][jy]))
   {
-    CheckTriggeredElementChangeBySide(jx, jy, Feld[jx][jy], CE_OTHER_GETS_LEFT,
+    CheckTriggeredElementChangeBySide(jx, jy, Feld[jx][jy], CE_PLAYER_LEAVES_X,
                                      leave_side);
     CheckElementChangeBySide(jx,jy, Feld[jx][jy],CE_LEFT_BY_PLAYER,leave_side);
   }
@@ -9913,7 +9920,7 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
   if (IS_CUSTOM_ELEMENT(Feld[new_jx][new_jy]))
   {
     CheckTriggeredElementChangeBySide(new_jx, new_jy, Feld[new_jx][new_jy],
-                                     CE_OTHER_GETS_ENTERED, enter_side);
+                                     CE_PLAYER_ENTERS_X, enter_side);
     CheckElementChangeBySide(new_jx, new_jy, Feld[new_jx][new_jy],
                             CE_ENTERED_BY_PLAYER, enter_side);
   }
@@ -10184,7 +10191,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
                                   player->index_bit, leave_side);
 
       CheckTriggeredElementChangeByPlayer(old_jx, old_jy, old_element,
-                                         CE_OTHER_GETS_LEFT,
+                                         CE_PLAYER_LEAVES_X,
                                          player->index_bit, leave_side);
 
       if (IS_CUSTOM_ELEMENT(new_element))
@@ -10192,7 +10199,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
                                   player->index_bit, enter_side);
 
       CheckTriggeredElementChangeByPlayer(jx, jy, new_element,
-                                         CE_OTHER_GETS_ENTERED,
+                                         CE_PLAYER_ENTERS_X,
                                          player->index_bit, enter_side);
 #endif
 
@@ -10441,7 +10448,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
                                   player->index_bit, leave_side);
 
       CheckTriggeredElementChangeByPlayer(old_jx, old_jy, old_element,
-                                         CE_OTHER_GETS_LEFT,
+                                         CE_PLAYER_LEAVES_X,
                                          player->index_bit, leave_side);
 
       if (IS_CUSTOM_ELEMENT(new_element))
@@ -10449,7 +10456,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
                                   player->index_bit, enter_side);
 
       CheckTriggeredElementChangeByPlayer(jx, jy, new_element,
-                                         CE_OTHER_GETS_ENTERED,
+                                         CE_PLAYER_ENTERS_X,
                                          player->index_bit, enter_side);
 #endif
 
@@ -10586,11 +10593,11 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
       CheckElementChangeByPlayer(xx, yy, border_element, CE_TOUCHED_BY_PLAYER,
                                 player->index_bit, border_side);
       CheckTriggeredElementChangeByPlayer(xx, yy, border_element,
-                                         CE_OTHER_GETS_TOUCHED,
+                                         CE_PLAYER_TOUCHES_X,
                                          player->index_bit, border_side);
 #else
       CheckTriggeredElementChangeByPlayer(xx, yy, border_element,
-                                         CE_OTHER_GETS_TOUCHED,
+                                         CE_PLAYER_TOUCHES_X,
                                          player->index_bit, border_side);
       CheckElementChangeByPlayer(xx, yy, border_element, CE_TOUCHED_BY_PLAYER,
                                 player->index_bit, border_side);
@@ -10611,11 +10618,11 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
       CheckElementChangeByPlayer(x, y, center_element, CE_TOUCHED_BY_PLAYER,
                                 player->index_bit, center_side);
       CheckTriggeredElementChangeByPlayer(x, y, center_element,
-                                         CE_OTHER_GETS_TOUCHED,
+                                         CE_PLAYER_TOUCHES_X,
                                          player->index_bit, center_side);
 #else
       CheckTriggeredElementChangeByPlayer(x, y, center_element,
-                                         CE_OTHER_GETS_TOUCHED,
+                                         CE_PLAYER_TOUCHES_X,
                                          player->index_bit, center_side);
       CheckElementChangeByPlayer(x, y, center_element, CE_TOUCHED_BY_PLAYER,
                                 player->index_bit, center_side);
@@ -10678,7 +10685,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
 
     /* check for change of center element (but change it only once) */
     if (IS_CUSTOM_ELEMENT(center_element) &&
-       HAS_ANY_CHANGE_EVENT(center_element, CE_OTHER_IS_TOUCHING) &&
+       HAS_ANY_CHANGE_EVENT(center_element, CE_TOUCHING_X) &&
        !change_center_element)
     {
       for (j = 0; j < element_info[center_element].num_change_pages; j++)
@@ -10687,7 +10694,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
          &element_info[center_element].change_page[j];
 
        if (change->can_change &&
-           change->has_event[CE_OTHER_IS_TOUCHING] &&
+           change->has_event[CE_TOUCHING_X] &&
            change->trigger_side & border_side &&
 #if 1
            IS_EQUAL_OR_IN_GROUP(border_element, change->trigger_element)
@@ -10707,7 +10714,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
 
     /* check for change of border element */
     if (IS_CUSTOM_ELEMENT(border_element) &&
-       HAS_ANY_CHANGE_EVENT(border_element, CE_OTHER_IS_TOUCHING))
+       HAS_ANY_CHANGE_EVENT(border_element, CE_TOUCHING_X))
     {
       for (j = 0; j < element_info[border_element].num_change_pages; j++)
       {
@@ -10715,7 +10722,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
          &element_info[border_element].change_page[j];
 
        if (change->can_change &&
-           change->has_event[CE_OTHER_IS_TOUCHING] &&
+           change->has_event[CE_TOUCHING_X] &&
            change->trigger_side & center_side &&
 #if 1
            IS_EQUAL_OR_IN_GROUP(center_element, change->trigger_element)
@@ -10729,7 +10736,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
 #endif
 
          CheckElementChangeByPage(xx, yy, border_element, center_element,
-                                  CE_OTHER_IS_TOUCHING, j);
+                                  CE_TOUCHING_X, j);
          break;
        }
       }
@@ -10743,7 +10750,7 @@ void TestIfElementTouchesCustomElement(int x, int y)
 #endif
 
     CheckElementChangeByPage(x, y, center_element, border_trigger_element,
-                            CE_OTHER_IS_TOUCHING, center_element_change_page);
+                            CE_TOUCHING_X, center_element_change_page);
   }
 }
 
@@ -10773,8 +10780,11 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
   touched_element = (IN_LEV_FIELD(hitx, hity) ?
                     MovingOrBlocked2Element(hitx, hity) : EL_STEELWALL);
 
+#if !USE_HITTING_SOMETHING_BUGFIX
+  /* "hitting something" is also true when hitting the playfield border */
   CheckElementChangeBySide(x, y, hitting_element, touched_element,
                           CE_HITTING_SOMETHING, direction);
+#endif
 
   if (IN_LEV_FIELD(hitx, hity))
   {
@@ -10796,11 +10806,13 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
     {
       int i;
 
+#if !USE_HIT_BY_SOMETHING_BUGFIX
       CheckElementChangeBySide(hitx, hity, touched_element, hitting_element,
                               CE_HIT_BY_SOMETHING, opposite_direction);
+#endif
 
       if (IS_CUSTOM_ELEMENT(hitting_element) &&
-         HAS_ANY_CHANGE_EVENT(hitting_element, CE_OTHER_IS_HITTING))
+         HAS_ANY_CHANGE_EVENT(hitting_element, CE_HITTING_X))
       {
        for (i = 0; i < element_info[hitting_element].num_change_pages; i++)
        {
@@ -10808,7 +10820,7 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
            &element_info[hitting_element].change_page[i];
 
          if (change->can_change &&
-             change->has_event[CE_OTHER_IS_HITTING] &&
+             change->has_event[CE_HITTING_X] &&
              change->trigger_side & touched_side &&
          
 #if 1
@@ -10819,14 +10831,14 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
              )
          {
            CheckElementChangeByPage(x, y, hitting_element, touched_element,
-                                    CE_OTHER_IS_HITTING, i);
+                                    CE_HITTING_X, i);
            break;
          }
        }
       }
 
       if (IS_CUSTOM_ELEMENT(touched_element) &&
-         HAS_ANY_CHANGE_EVENT(touched_element, CE_OTHER_GETS_HIT))
+         HAS_ANY_CHANGE_EVENT(touched_element, CE_HIT_BY_X))
       {
        for (i = 0; i < element_info[touched_element].num_change_pages; i++)
        {
@@ -10834,7 +10846,7 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
            &element_info[touched_element].change_page[i];
 
          if (change->can_change &&
-             change->has_event[CE_OTHER_GETS_HIT] &&
+             change->has_event[CE_HIT_BY_X] &&
              change->trigger_side & hitting_side &&
 #if 1
              IS_EQUAL_OR_IN_GROUP(hitting_element, change->trigger_element)
@@ -10844,13 +10856,24 @@ void TestIfElementHitsCustomElement(int x, int y, int direction)
              )
          {
            CheckElementChangeByPage(hitx, hity, touched_element,
-                                    hitting_element, CE_OTHER_GETS_HIT, i);
+                                    hitting_element, CE_HIT_BY_X, i);
            break;
          }
        }
       }
+
+#if USE_HIT_BY_SOMETHING_BUGFIX
+      CheckElementChangeBySide(hitx, hity, touched_element, hitting_element,
+                              CE_HIT_BY_SOMETHING, opposite_direction);
+#endif
     }
   }
+
+#if USE_HITTING_SOMETHING_BUGFIX
+  /* "hitting something" is also true when hitting the playfield border */
+  CheckElementChangeBySide(x, y, hitting_element, touched_element,
+                          CE_HITTING_SOMETHING, direction);
+#endif
 }
 
 #if 0
@@ -11714,7 +11737,7 @@ int DigField(struct PlayerInfo *player,
 
        PlayLevelSoundElementAction(x, y, element, ACTION_DIGGING);
 
-       CheckTriggeredElementChangeByPlayer(x, y, element,CE_OTHER_GETS_DIGGED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_DIGS_X,
                                            player->index_bit, dig_side);
 
 #if 1
@@ -11812,7 +11835,7 @@ int DigField(struct PlayerInfo *player,
 
        if (is_player)
          CheckTriggeredElementChangeByPlayer(x, y, element,
-                                             CE_OTHER_GETS_COLLECTED,
+                                             CE_PLAYER_COLLECTS_X,
                                              player->index_bit, dig_side);
 
 #if 1
@@ -12036,7 +12059,7 @@ int DigField(struct PlayerInfo *player,
        {
          CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
                                     player->index_bit, dig_side);
-         CheckTriggeredElementChangeByPlayer(x,y,element,CE_OTHER_GETS_PUSHED,
+         CheckTriggeredElementChangeByPlayer(x,y, element, CE_PLAYER_PUSHES_X,
                                              player->index_bit, dig_side);
        }
 
@@ -12050,10 +12073,10 @@ int DigField(struct PlayerInfo *player,
        /* !!! TEST ONLY !!! */
        CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
                                   player->index_bit, dig_side);
-       CheckTriggeredElementChangeByPlayer(x, y, element,CE_OTHER_GETS_PUSHED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PUSHES_X,
                                            player->index_bit, dig_side);
 #else
-       CheckTriggeredElementChangeByPlayer(x, y, element,CE_OTHER_GETS_PUSHED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PUSHES_X,
                                            player->index_bit, dig_side);
        CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
                                   player->index_bit, dig_side);
@@ -12069,7 +12092,7 @@ int DigField(struct PlayerInfo *player,
        if (PLAYER_SWITCHING(player, x, y))
        {
          CheckTriggeredElementChangeByPlayer(x,y, element,
-                                             CE_OTHER_GETS_PRESSED,
+                                             CE_PLAYER_PRESSES_X,
                                              player->index_bit, dig_side);
 
          return MF_ACTION;
@@ -12163,10 +12186,10 @@ int DigField(struct PlayerInfo *player,
        }
 
        CheckTriggeredElementChangeByPlayer(x, y, element,
-                                           CE_OTHER_IS_SWITCHING,
+                                           CE_SWITCH_OF_X,
                                            player->index_bit, dig_side);
 
-       CheckTriggeredElementChangeByPlayer(x,y, element,CE_OTHER_GETS_PRESSED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PRESSES_X,
                                            player->index_bit, dig_side);
 
        return MF_ACTION;
@@ -12184,11 +12207,11 @@ int DigField(struct PlayerInfo *player,
          CheckElementChangeByPlayer(x, y, element, CE_SWITCHED,
                                     player->index_bit, dig_side);
          CheckTriggeredElementChangeByPlayer(x, y, element,
-                                             CE_OTHER_IS_SWITCHING,
+                                             CE_SWITCH_OF_X,
                                              player->index_bit, dig_side);
 #else
          CheckTriggeredElementChangeByPlayer(x, y, element,
-                                             CE_OTHER_IS_SWITCHING,
+                                             CE_SWITCH_OF_X,
                                              player->index_bit, dig_side);
          CheckElementChangeByPlayer(x, y, element, CE_SWITCHED,
                                     player->index_bit, dig_side);
@@ -12199,10 +12222,10 @@ int DigField(struct PlayerInfo *player,
        /* !!! TEST ONLY !!! (this breaks "machine", level 000) */
        CheckElementChangeByPlayer(x, y, element, CE_PRESSED_BY_PLAYER,
                                   player->index_bit, dig_side);
-       CheckTriggeredElementChangeByPlayer(x,y, element,CE_OTHER_GETS_PRESSED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PRESSES_X,
                                            player->index_bit, dig_side);
 #else
-       CheckTriggeredElementChangeByPlayer(x,y, element,CE_OTHER_GETS_PRESSED,
+       CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_PRESSES_X,
                                            player->index_bit, dig_side);
        CheckElementChangeByPlayer(x, y, element, CE_PRESSED_BY_PLAYER,
                                   player->index_bit, dig_side);
@@ -12423,11 +12446,11 @@ boolean DropElement(struct PlayerInfo *player)
     CheckElementChangeByPlayer(dropx, dropy, new_element, CE_DROPPED_BY_PLAYER,
                               player->index_bit, drop_side);
     CheckTriggeredElementChangeByPlayer(dropx, dropy, new_element,
-                                       CE_OTHER_GETS_DROPPED,
+                                       CE_PLAYER_DROPS_X,
                                        player->index_bit, drop_side);
 #else
     CheckTriggeredElementChangeByPlayer(dropx, dropy, new_element,
-                                       CE_OTHER_GETS_DROPPED,
+                                       CE_PLAYER_DROPS_X,
                                        player->index_bit, drop_side);
     CheckElementChangeByPlayer(dropx, dropy, new_element, CE_DROPPED_BY_PLAYER,
                               player->index_bit, drop_side);
index 1206c9ad391ccc6633a706bd7f5c8013978fbd2a..e3fbe001184e63468954f372cf5e14d380d8c771 100644 (file)
@@ -75,8 +75,23 @@ void InitProgramInfo(char *argv0,
                     char *cookie_prefix, char *filename_prefix,
                     int program_version)
 {
-  program.command_basename =
-    (strrchr(argv0, '/') ? strrchr(argv0, '/') + 1 : argv0);
+  char *argv0_copy = getStringCopy(argv0);
+  char *argv0_copy_last_slash = strrchr(argv0_copy, '/');
+
+  if (argv0_copy_last_slash != NULL)
+  {
+    program.command_basename = argv0_copy_last_slash + 1;
+    program.command_basepath = argv0_copy;
+    *argv0_copy_last_slash = '\0';
+  }
+  else
+  {
+    program.command_basename = argv0_copy;
+    program.command_basepath = ".";
+  }
+
+  printf("::: command_basepath == '%s'\n", program.command_basepath);
+  printf("::: command_basename == '%s'\n", program.command_basename);
 
   program.userdata_directory = userdata_directory;
   program.program_title = program_title;
index 6ced002e0f1c3992789d77b8eeb1fed1385c6efe..95c18af1076f911591faa3db707061bd4489d01f 100644 (file)
@@ -412,8 +412,9 @@ typedef int (*EventFilter)(const Event *);
 
 struct ProgramInfo
 {
-  char *command_basename;
-  char *userdata_directory;
+  char *command_basepath;      /* directory that contains the program */
+  char *command_basename;      /* base filename of the program binary */
+  char *userdata_directory;    /* personal user data directory */
 
   char *program_title;
   char *window_title;
index af3e7b4e187d4909df9ba9bc230de1054feef756..52d7fb81b57ffa5db7dbeee3179bd625b8b49984 100644 (file)
 #define CE_HITTING_SOMETHING   5
 #define CE_IMPACT              6
 #define CE_SMASHED             7
-#define CE_OTHER_IS_TOUCHING   8
-#define CE_OTHER_IS_CHANGING   9
-#define CE_OTHER_IS_EXPLODING  10
-#define CE_OTHER_GETS_TOUCHED  11
-#define CE_OTHER_GETS_PRESSED  12
-#define CE_OTHER_GETS_PUSHED   13
-#define CE_OTHER_GETS_COLLECTED        14
-#define CE_OTHER_GETS_DROPPED  15
+#define CE_TOUCHING_X          8
+#define CE_CHANGE_OF_X         9
+#define CE_EXPLOSION_OF_X      10
+#define CE_PLAYER_TOUCHES_X    11
+#define CE_PLAYER_PRESSES_X    12
+#define CE_PLAYER_PUSHES_X     13
+#define CE_PLAYER_COLLECTS_X   14
+#define CE_PLAYER_DROPS_X      15
 #define CE_BY_PLAYER_OBSOLETE  16      /* obsolete; now CE_BY_DIRECT_ACTION */
 #define CE_BY_COLLISION_OBSOLETE 17    /* obsolete; now CE_BY_DIRECT_ACTION */
 #define CE_BY_OTHER_ACTION     18      /* activates other element events */
 #define CE_BY_DIRECT_ACTION    19      /* activates direct element events */
-#define CE_OTHER_GETS_DIGGED   20
+#define CE_PLAYER_DIGS_X       20
 #define CE_ENTERED_BY_PLAYER   21
 #define CE_LEFT_BY_PLAYER      22
-#define CE_OTHER_GETS_ENTERED  23
-#define CE_OTHER_GETS_LEFT     24
+#define CE_PLAYER_ENTERS_X     23
+#define CE_PLAYER_LEAVES_X     24
 #define CE_SWITCHED            25
-#define CE_OTHER_IS_SWITCHING  26
+#define CE_SWITCH_OF_X         26
 #define CE_HIT_BY_SOMETHING    27
-#define CE_OTHER_IS_HITTING    28
-#define CE_OTHER_GETS_HIT      29
+#define CE_HITTING_X           28
+#define CE_HIT_BY_X            29
 #define CE_BLOCKED             30
 
 #define NUM_CHANGE_EVENTS      31