rnd-20051210-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 10 Dec 2005 16:23:18 +0000 (17:23 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:49:43 +0000 (10:49 +0200)
* added image config suffix ".clone_from" to copy whole image settings

ChangeLog
src/conftime.h
src/game.c
src/main.h

index 276e83aa2edf47846dd4d0d50435b13246e370ce..4dc9d3566e0a0b051f448587373b053999eb7f7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2005-12-10
+       * added image config suffix ".clone_from" to copy whole image settings
+
 2005-12-05
        * fixed graphical bug with smashing elements falling faster than player
 
index 66a9e05b8525949f85e2b73c7cd7e68302afd6b6..c6713ecc32adcc80e8065a84e72b26f88c9fe922 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2005-12-10 14:42]"
+#define COMPILE_DATE_STRING "[2005-12-10 17:15]"
index 1c606b528b6888d76720480a64b8cd0c9c8447cd..06de1e48621fab80bf5e0595823c6814083eefd2 100644 (file)
@@ -1584,6 +1584,8 @@ void InitGame()
     player->move_delay       = game.initial_move_delay;
     player->move_delay_value = game.initial_move_delay_value;
 
+    player->move_delay_value_next = -1;
+
     player->move_delay_reset_counter = 0;
 
     player->push_delay       = -1;     /* initialized when pushing starts */
@@ -6725,11 +6727,12 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
          /* make sure that value is power of 2 */
          move_stepsize = (1 << log_2(move_stepsize));
 
-         stored_player[i].move_delay_value = TILEX / move_stepsize;
+         /* do no immediately change -- the player might just be moving */
+         stored_player[i].move_delay_value_next = TILEX / move_stepsize;
 
 #if 0
          printf("::: move_delay_value == %d [%d]\n",
-                stored_player[i].move_delay_value, action_arg_number);
+                stored_player[i].move_delay_value_next, action_arg_number);
 #endif
        }
       }
@@ -7071,7 +7074,8 @@ static void ChangeElement(int x, int y, int page)
   struct ElementChangeInfo *change = &ei->change_page[page];
 
 #ifdef DEBUG
-  if (!CAN_CHANGE(element) && !CAN_CHANGE(Back[x][y]))
+  if (!CAN_CHANGE_OR_HAS_ACTION(element) &&
+      !CAN_CHANGE_OR_HAS_ACTION(Back[x][y]))
   {
     printf("\n\n");
     printf("ChangeElement(): %d,%d: element = %d ('%s')\n",
@@ -7082,7 +7086,7 @@ static void ChangeElement(int x, int y, int page)
 #endif
 
   /* this can happen with classic bombs on walkable, changing elements */
-  if (!CAN_CHANGE(element))
+  if (!CAN_CHANGE_OR_HAS_ACTION(element))
   {
 #if 0
     if (!CAN_CHANGE(Back[x][y]))       /* prevent permanent repetition */
@@ -7096,24 +7100,30 @@ static void ChangeElement(int x, int y, int page)
   {
     ChangeDelay[x][y] = GET_CHANGE_DELAY(change) + 1;
 
-    ResetGfxAnimation(x, y);
-    ResetRandomAnimationValue(x, y);
+    if (change->can_change)
+    {
+      ResetGfxAnimation(x, y);
+      ResetRandomAnimationValue(x, y);
 
-    if (change->pre_change_function)
-      change->pre_change_function(x, y);
+      if (change->pre_change_function)
+       change->pre_change_function(x, y);
+    }
   }
 
   ChangeDelay[x][y]--;
 
   if (ChangeDelay[x][y] != 0)          /* continue element change */
   {
-    int graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
+    if (change->can_change)
+    {
+      int graphic = el_act_dir2img(element, GfxAction[x][y], GfxDir[x][y]);
 
-    if (IS_ANIMATED(graphic))
-      DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
+      if (IS_ANIMATED(graphic))
+       DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
 
-    if (change->change_function)
-      change->change_function(x, y);
+      if (change->change_function)
+       change->change_function(x, y);
+    }
   }
   else                                 /* finish element change */
   {
@@ -7133,11 +7143,17 @@ static void ChangeElement(int x, int y, int page)
       return;
     }
 
-    if (ChangeElementNow(x, y, element, page))
+    if (change->can_change)
     {
-      if (change->post_change_function)
-       change->post_change_function(x, y);
+      if (ChangeElementNow(x, y, element, page))
+      {
+       if (change->post_change_function)
+         change->post_change_function(x, y);
+      }
     }
+
+    if (change->has_action)
+      ExecuteCustomElementAction(x, y, element, page);
   }
 }
 
@@ -7192,9 +7208,13 @@ static boolean CheckTriggeredElementChangeExt(int trigger_element,
                ChangeEvent[x][y] = trigger_event;
                ChangeElement(x, y, p);
              }
-
+#if 1
+             else if (change->has_action)
+               ExecuteCustomElementAction(x, y, element, p);
+#else
              if (change->has_action)
                ExecuteCustomElementAction(x, y, element, p);
+#endif
            }
          }
 
@@ -7261,9 +7281,13 @@ static boolean CheckElementChangeExt(int x, int y,
 
        change_done = TRUE;
       }
-
+#if 1
+      else if (change->has_action)
+       ExecuteCustomElementAction(x, y, element, p);
+#else
       if (change->has_action)
        ExecuteCustomElementAction(x, y, element, p);
+#endif
     }
   }
 
@@ -7785,11 +7809,16 @@ void GameActions()
       printf("::: ChangeDelay == %d\n", ChangeDelay[x][y]);
 #endif
 
+#if 1
+      ChangeElement(x, y, page);
+#else
       if (CAN_CHANGE(element))
        ChangeElement(x, y, page);
 
-      if (HAS_ACTION(element) && ChangeDelay[x][y] == 0)
+      if (HAS_ACTION(element))
        ExecuteCustomElementAction(x, y, element, page);
+#endif
+
 #endif
 
       element = Feld[x][y];
@@ -8292,6 +8321,12 @@ boolean MovePlayerOneStep(struct PlayerInfo *player,
   player->jy = new_jy;
   StorePlayer[new_jx][new_jy] = player->element_nr;
 
+  if (player->move_delay_value_next != -1)
+  {
+    player->move_delay_value = player->move_delay_value_next;
+    player->move_delay_value_next = -1;
+  }
+
   player->MovPos =
     (dx > 0 || dy > 0 ? -1 : 1) * (TILEX - TILEX / player->move_delay_value);
 
@@ -8553,21 +8588,21 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     return;
 
 #if 0
-    printf("::: player->MovPos: %d -> %d\n",
-          player->MovPos,
-          player->MovPos + (player->MovPos > 0 ? -1 : 1) * move_stepsize);
+  printf("::: player->MovPos: %d -> %d\n",
+        player->MovPos,
+        player->MovPos + (player->MovPos > 0 ? -1 : 1) * move_stepsize);
 #endif
 
 #if USE_NEW_PLAYER_SPEED
-    if (player->MovPos != 0)
-    {
-      player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
-      player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
+  if (player->MovPos != 0)
+  {
+    player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
+    player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
-      /* before DrawPlayer() to draw correct player graphic for this case */
-      if (player->MovPos == 0)
-       CheckGravityMovement(player);
-    }
+    /* before DrawPlayer() to draw correct player graphic for this case */
+    if (player->MovPos == 0)
+      CheckGravityMovement(player);
+  }
 #else
   player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
   player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
index 1ab53e5bdcbf10fa5cd7ed8e217ebe4ab2351f4e..4bd3788e851223fb5f090bb45566af7e47946a66 100644 (file)
@@ -1620,6 +1620,7 @@ struct PlayerInfo
 
   int move_delay;
   int move_delay_value;
+  int move_delay_value_next;
   int move_delay_reset_counter;
 
   int push_delay;