rnd-20031004-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 4 Oct 2003 02:38:51 +0000 (04:38 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:04 +0000 (10:44 +0200)
* fixed bug when initializing font graphic structure
* fixed bug with animation mode "pingpong" when using only 1 frame
* fixed bug with extended change target introduced in 3.0.5
* fixed bug where passing over moving element doubles player speed
* fixed bug with elements continuing to move into push direction
* fixed bug with duplicated player when dropping bomb with shield on
* added "switching" event for custom elements ("pressing" only once)
* fixed switching bug (resetting flag when not switching but not idle)

ChangeLog
src/conftime.h
src/editor.c
src/events.c
src/game.c
src/init.c
src/libgame/toons.c
src/main.h

index 44de1e5d2a0244722482bd559cf1603f60663e42..8f53fa16a159d0c55f7465ec639fd3bc53704bd9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-10-03
+       * fixed bug when initializing font graphic structure
+       * fixed bug with animation mode "pingpong" when using only 1 frame
+       * fixed bug with extended change target introduced in 3.0.5
+       * fixed bug where passing over moving element doubles player speed
+       * fixed bug with elements continuing to move into push direction
+       * fixed bug with duplicated player when dropping bomb with shield on
+       * added "switching" event for custom elements ("pressing" only once)
+       * fixed switching bug (resetting flag when not switching but not idle)
+
 2003-09-29
        * fixed element tokens for certain file elements with ".active" etc.
 
index d981d6001f9ecf16339a43976ec3eaf311dffa41..1d8c0e6274515d6502ee2dd8baccabc181ecb462 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-09-29 02:43]"
+#define COMPILE_DATE_STRING "[2003-10-04 03:08]"
index b3495358db2f6e407f98f830ef620ce45b59dae5..0b9ad87861e15e2c3a0906bf7babe8d99290e4f2 100644 (file)
@@ -1114,6 +1114,7 @@ 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_PUSHED_BY_PLAYER,       "pushed by player ..."          },
   { CE_ENTERED_BY_PLAYER,      "entered by player ..."         },
   { CE_LEFT_BY_PLAYER,         "left by player ..."            },
@@ -1128,6 +1129,7 @@ static struct ValueTextInfo options_change_other_action[] =
 {
   { CE_OTHER_GETS_TOUCHED,     "player touches ..."            },
   { CE_OTHER_GETS_PRESSED,     "player presses ..."            },
+  { CE_OTHER_GETS_SWITCHED,    "player switches ..."           },
   { CE_OTHER_GETS_PUSHED,      "player pushes ..."             },
   { CE_OTHER_GETS_ENTERED,     "player enters ..."             },
   { CE_OTHER_GETS_LEFT,                "player leaves ..."             },
@@ -4589,6 +4591,7 @@ 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_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 :
@@ -4602,6 +4605,7 @@ static void CopyCustomElementPropertiesToEditor(int element)
   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_SWITCHED) ? CE_OTHER_GETS_SWITCHED :
      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 :
@@ -4705,6 +4709,7 @@ 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_PUSHED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_ENTERED_BY_PLAYER] = FALSE;
   custom_element_change_events[CE_LEFT_BY_PLAYER] = FALSE;
@@ -4718,6 +4723,7 @@ static void CopyCustomElementPropertiesToGame(int element)
   /* 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_SWITCHED] = 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;
index f060c0ff1d9ec1aa11df94b283fa994788efcb6e..96f4624df9df575da6d48ab02bf7d83124203812 100644 (file)
@@ -424,6 +424,7 @@ void HandleButton(int mx, int my, int button)
 
          printf("      Feld[%d][%d] == %d ('%s')\n", x,y, Feld[x][y],
                 element_info[Feld[x][y]].token_name);
+         printf("      Back[%d][%d] == %d\n", x,y, Back[x][y]);
          printf("      Store[%d][%d] == %d\n", x,y, Store[x][y]);
          printf("      Store2[%d][%d] == %d\n", x,y, Store2[x][y]);
          printf("      StorePlayer[%d][%d] == %d\n", x,y, StorePlayer[x][y]);
index 3b06f4856fb2cb11b508431468892ff008dde8f8..2062caa865f2ea33868c83e0ee0534bb35d60bc8 100644 (file)
@@ -2479,7 +2479,11 @@ void Bang(int x, int y)
   int element = Feld[x][y];
 #endif
 
+#if 1
+  if (IS_PLAYER(x, y) && !PLAYER_PROTECTED(x, y))
+#else
   if (IS_PLAYER(x, y))
+#endif
   {
     struct PlayerInfo *player = PLAYERINFO(x, y);
 
@@ -4491,6 +4495,12 @@ void ContinueMoving(int x, int y)
 
     Stop[newx][newy] = TRUE;   /* ignore this element until the next frame */
 
+    /* prevent pushed element from moving on in pushed direction */
+    if (pushed && CAN_MOVE(element) &&
+       element_info[element].move_pattern & MV_ANY_DIRECTION &&
+       !(element_info[element].move_pattern & MovDir[newx][newy]))
+      TurnRound(newx, newy);
+
     if (!pushed)       /* special case: moving object pushed by player */
       JustStopped[newx][newy] = 3;
 
@@ -5545,6 +5555,8 @@ static boolean ChangeElementNow(int x, int y, int element, int page)
          if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
            RemoveMovingField(ex, ey);
 
+         ChangeEvent[ex][ey] = ChangeEvent[x][y];
+
          ChangeElementNowExt(ex, ey, change->content[xx][yy]);
 
          something_has_changed = TRUE;
@@ -6696,6 +6708,10 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
 #if 1
     player->snapped = FALSE;
 #endif
+
+#if 1
+    player->Switching = FALSE;
+#endif
   }
   else
   {
@@ -7645,6 +7661,11 @@ int DigField(struct PlayerInfo *player,
        if (!IN_LEV_FIELD(nextx, nexty) || !IS_FREE(nextx, nexty))
          return MF_NO_ACTION;
 
+#if 1
+       if (CAN_MOVE(element))  /* only fixed elements can be passed! */
+         return MF_NO_ACTION;
+#endif
+
        if (element >= EL_EM_GATE_1 && element <= EL_EM_GATE_4)
        {
          if (!player->key[element - EL_EM_GATE_1])
@@ -7797,13 +7818,6 @@ int DigField(struct PlayerInfo *player,
          return MF_NO_ACTION;
 
 #if 1
-       /*
-       printf("::: %d [%d,%d,%d => %d]\n", MovDir[x][y],
-              CAN_MOVE(element), move_direction, getElementMoveStepsize(x, y),
-              (CAN_MOVE(element) && MovDir[x][y] == move_direction &&
-               getElementMoveStepsize(x, y) > MOVE_STEPSIZE_NORMAL) );
-       */
-
        /* do not push elements already moving away faster than player */
        if (CAN_MOVE(element) && MovDir[x][y] == move_direction &&
            ABS(getElementMoveStepsize(x, y)) > MOVE_STEPSIZE_NORMAL)
@@ -7899,8 +7913,20 @@ int DigField(struct PlayerInfo *player,
       else
       {
 #if 1
+
+#if 1
+       if (!player->Switching)
+       {
+         player->Switching = TRUE;
+         CheckTriggeredElementSideChange(x, y, element, dig_side,
+                                         CE_OTHER_GETS_SWITCHED);
+         CheckElementSideChange(x, y, element, dig_side,
+                                CE_SWITCHED_BY_PLAYER, -1);
+       }
+#endif
+
        CheckTriggeredElementSideChange(x, y, element, dig_side,
-                                   CE_OTHER_GETS_PRESSED);
+                                       CE_OTHER_GETS_PRESSED);
        CheckElementSideChange(x, y, element, dig_side,
                               CE_PRESSED_BY_PLAYER, -1);
 #else
index 8ec25b1df7d3436fa1c9d795f10d50a8d03a9a36..c7a199118fea2390f170d8c2bbdc212910a0a1a8 100644 (file)
@@ -291,8 +291,13 @@ void InitFontGraphicInfo()
   /* ---------- initialize font graphic definitions ---------- */
 
   /* always start with reliable default values (normal font graphics) */
+#if 1
+  for (i=0; i < NUM_FONTS; i++)
+    font_info[i].graphic = IMG_FONT_INITIAL_1;
+#else
   for (i=0; i < NUM_FONTS; i++)
     font_info[i].graphic = FONT_INITIAL_1;
+#endif
 
   /* initialize normal font/graphic mapping from static configuration */
   for (i=0; font_to_graphic[i].font_nr > -1; i++)
@@ -665,6 +670,34 @@ void InitElementGraphicInfo()
     }
   }
 
+#if 1
+  /* set animation mode to "none" for each graphic with only 1 frame */
+  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+  {
+    for (act=0; act<NUM_ACTIONS; act++)
+    {
+      int graphic = element_info[i].graphic[act];
+      int crumbled = element_info[i].crumbled[act];
+
+      if (graphic_info[graphic].anim_frames == 1)
+       graphic_info[graphic].anim_mode = ANIM_NONE;
+      if (graphic_info[crumbled].anim_frames == 1)
+       graphic_info[crumbled].anim_mode = ANIM_NONE;
+
+      for (dir=0; dir<NUM_DIRECTIONS; dir++)
+      {
+       graphic = element_info[i].direction_graphic[act][dir];
+       crumbled = element_info[i].direction_crumbled[act][dir];
+
+       if (graphic_info[graphic].anim_frames == 1)
+         graphic_info[graphic].anim_mode = ANIM_NONE;
+       if (graphic_info[crumbled].anim_frames == 1)
+         graphic_info[crumbled].anim_mode = ANIM_NONE;
+      }
+    }
+  }
+#endif
+
 #if 0
 #if DEBUG
   if (options.verbose)
@@ -842,6 +875,10 @@ static void set_graphic_parameters(int graphic, char **parameter_raw)
     graphic_info[graphic].anim_delay = 1;
 
   graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE];
+#if 0
+  if (graphic_info[graphic].anim_frames == 1)
+    graphic_info[graphic].anim_mode = ANIM_NONE;
+#endif
 
   /* automatically determine correct start frame, if not defined */
   if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE)
index 048696f6cd365fb4322959f5d7da4fcced91bfed..2d0a355014bd05595f2413d6f60d4b31a188da79 100644 (file)
@@ -48,7 +48,11 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_frame,
   }
   else if (mode & ANIM_PINGPONG)       /* oscillate (border frames once) */
   {
+#if 1
+    int max_anim_frames = (num_frames > 1 ? 2 * num_frames - 2 : 1);
+#else
     int max_anim_frames = 2 * num_frames - 2;
+#endif
 
     frame = (sync_frame % (delay * max_anim_frames)) / delay;
     frame = (frame < num_frames ? frame : max_anim_frames - frame);
index 4e64205b3a1ec20f734adb703f8148ef885a48aa..e860375cdecc20ae218d6356b9fe72bbdd79864c 100644 (file)
 #define CE_LEFT_BY_PLAYER      22
 #define CE_OTHER_GETS_ENTERED  23
 #define CE_OTHER_GETS_LEFT     24
+#define CE_SWITCHED_BY_PLAYER  25
+#define CE_OTHER_GETS_SWITCHED 26
 
-/* values for derived change events (determined from properties above) */
-#define CE_TOUCHING_SOME_SIDE  25      /* summarized left/right/up/down/any */
-
-#define NUM_CHANGE_EVENTS      26
+#define NUM_CHANGE_EVENTS      27
 
 #define CE_BITMASK_DEFAULT     0