rnd-20031109-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 9 Nov 2003 12:55:02 +0000 (13:55 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:28 +0000 (10:44 +0200)
* fixed tape recording when player is created from CE element change

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

index 64c29de7be2002eebe239a1e58f24499b6c3cd7f..088f29306d9b310c884268a4044d72be90dc253b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
+2003-11-08
+       * fixed tape recording when player is created from CE element change
+
 2003-11-04
        * introduced "turning..." action graphic for elements with move delay
+         (non-CE: bug, spaceship, sniksnak, mole, pacman, yamyam)
+
+2003-11-03
+       * prevent "extended" changed elements from delay change in same frame
 
 2003-11-02
        * fixed bug when pushing element that can move away to the side
index 67bc7ca05e8dae8de41cdbe840e6af2ac3efa85a..1b9fd4ee5ff2fcc296ca78abd0d7197f486d98bd 100644 (file)
@@ -889,7 +889,7 @@ struct ConfigInfo image_config[] =
   { "bug.moving.down.delay",                   "4"                     },
   { "bug.moving.down.offset",                  "128"                   },
   { "bug.turning_from_right.up",               "RocksMore.pcx"         },
-  { "bug.turning_from_right.up.xpos",          "1"                     },
+  { "bug.turning_from_right.up.xpos",          "0"                     },
   { "bug.turning_from_right.up.ypos",          "6"                     },
   { "bug.turning_from_right.up.frames",                "4"                     },
   { "bug.turning_from_right.up.delay",         "2"                     },
@@ -925,13 +925,13 @@ struct ConfigInfo image_config[] =
   { "bug.turning_from_up.right.delay",         "2"                     },
   { "bug.turning_from_up.right.anim_mode",     "linear"                },
   { "bug.turning_from_left.up",                        "RocksMore.pcx"         },
-  { "bug.turning_from_left.up.xpos",           "12"                    },
+  { "bug.turning_from_left.up.xpos",           "13"                    },
   { "bug.turning_from_left.up.ypos",           "6"                     },
   { "bug.turning_from_left.up.frames",         "4"                     },
   { "bug.turning_from_left.up.delay",          "2"                     },
   { "bug.turning_from_left.up.anim_mode",      "linear"                },
   { "bug.turning_from_down.left",              "RocksMore.pcx"         },
-  { "bug.turning_from_down.left.xpos",         "8"                     },
+  { "bug.turning_from_down.left.xpos",         "9"                     },
   { "bug.turning_from_down.left.ypos",         "6"                     },
   { "bug.turning_from_down.left.frames",       "4"                     },
   { "bug.turning_from_down.left.delay",                "2"                     },
@@ -983,7 +983,7 @@ struct ConfigInfo image_config[] =
   { "spaceship.moving.down.delay",             "4"                     },
   { "spaceship.moving.down.offset",            "128"                   },
   { "spaceship.turning_from_right.up",         "RocksMore.pcx"         },
-  { "spaceship.turning_from_right.up.xpos",    "1"                     },
+  { "spaceship.turning_from_right.up.xpos",    "0"                     },
   { "spaceship.turning_from_right.up.ypos",    "5"                     },
   { "spaceship.turning_from_right.up.frames",  "4"                     },
   { "spaceship.turning_from_right.up.delay",   "2"                     },
@@ -1019,13 +1019,13 @@ struct ConfigInfo image_config[] =
   { "spaceship.turning_from_up.right.delay",   "2"                     },
   { "spaceship.turning_from_up.right.anim_mode","linear"               },
   { "spaceship.turning_from_left.up",          "RocksMore.pcx"         },
-  { "spaceship.turning_from_left.up.xpos",     "12"                    },
+  { "spaceship.turning_from_left.up.xpos",     "13"                    },
   { "spaceship.turning_from_left.up.ypos",     "5"                     },
   { "spaceship.turning_from_left.up.frames",   "4"                     },
   { "spaceship.turning_from_left.up.delay",    "2"                     },
   { "spaceship.turning_from_left.up.anim_mode",        "linear"                },
   { "spaceship.turning_from_down.left",                "RocksMore.pcx"         },
-  { "spaceship.turning_from_down.left.xpos",   "8"                     },
+  { "spaceship.turning_from_down.left.xpos",   "9"                     },
   { "spaceship.turning_from_down.left.ypos",   "5"                     },
   { "spaceship.turning_from_down.left.frames", "4"                     },
   { "spaceship.turning_from_down.left.delay",  "2"                     },
index 9cdc242954161cbb341bbb13762be0d4bb7e3a5f..412582041c593633f77ceb45029690da950e9b51 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-11-08 16:59]"
+#define COMPILE_DATE_STRING "[2003-11-09 01:50]"
index c7dc1009585d5f62aa1f9dbbaa497858ec7fafe9..cfb239c97717b8c1f120ee7153eaf2240b04bc8a 100644 (file)
@@ -5904,6 +5904,100 @@ static boolean CheckElementChange(int x, int y, int element, int trigger_event)
   return CheckElementSideChange(x, y, element, CH_SIDE_ANY, trigger_event, -1);
 }
 
+#if 1
+static byte PlayerActions(struct PlayerInfo *player, byte player_action)
+{
+#if 0
+  static byte stored_player_action[MAX_PLAYERS];
+  static int num_stored_actions = 0;
+#endif
+  boolean moved = FALSE, snapped = FALSE, dropped = FALSE;
+  int left     = player_action & JOY_LEFT;
+  int right    = player_action & JOY_RIGHT;
+  int up       = player_action & JOY_UP;
+  int down     = player_action & JOY_DOWN;
+  int button1  = player_action & JOY_BUTTON_1;
+  int button2  = player_action & JOY_BUTTON_2;
+  int dx       = (left ? -1    : right ? 1     : 0);
+  int dy       = (up   ? -1    : down  ? 1     : 0);
+
+#if 0
+  stored_player_action[player->index_nr] = 0;
+  num_stored_actions++;
+#endif
+
+#if 0
+  printf("::: player %d [%d]\n", player->index_nr, FrameCounter);
+#endif
+
+  if (!player->active || tape.pausing)
+    return 0;
+
+  if (player_action)
+  {
+#if 0
+    printf("::: player %d acts [%d]\n", player->index_nr, FrameCounter);
+#endif
+
+    if (button1)
+      snapped = SnapField(player, dx, dy);
+    else
+    {
+      if (button2)
+       dropped = DropElement(player);
+
+      moved = MovePlayer(player, dx, dy);
+    }
+
+    if (tape.single_step && tape.recording && !tape.pausing)
+    {
+      if (button1 || (dropped && !moved))
+      {
+       TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+       SnapField(player, 0, 0);                /* stop snapping */
+      }
+    }
+
+#if 1
+    return player_action;
+#else
+    stored_player_action[player->index_nr] = player_action;
+#endif
+  }
+  else
+  {
+#if 0
+    printf("::: player %d waits [%d]\n", player->index_nr, FrameCounter);
+#endif
+
+    /* no actions for this player (no input at player's configured device) */
+
+    DigField(player, 0, 0, 0, 0, DF_NO_PUSH);
+    SnapField(player, 0, 0);
+    CheckGravityMovement(player);
+
+    if (player->MovPos == 0)
+      InitPlayerGfxAnimation(player, ACTION_DEFAULT, player->MovDir);
+
+    if (player->MovPos == 0)   /* needed for tape.playing */
+      player->is_moving = FALSE;
+
+    return 0;
+  }
+
+#if 0
+  if (tape.recording && num_stored_actions >= MAX_PLAYERS)
+  {
+    printf("::: player %d recorded [%d]\n", player->index_nr, FrameCounter);
+
+    TapeRecordAction(stored_player_action);
+    num_stored_actions = 0;
+  }
+#endif
+}
+
+#else
+
 static void PlayerActions(struct PlayerInfo *player, byte player_action)
 {
   static byte stored_player_action[MAX_PLAYERS];
@@ -5921,11 +6015,15 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
   stored_player_action[player->index_nr] = 0;
   num_stored_actions++;
 
+  printf("::: player %d [%d]\n", player->index_nr, FrameCounter);
+
   if (!player->active || tape.pausing)
     return;
 
   if (player_action)
   {
+    printf("::: player %d acts [%d]\n", player->index_nr, FrameCounter);
+
     if (button1)
       snapped = SnapField(player, dx, dy);
     else
@@ -5949,6 +6047,8 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
   }
   else
   {
+    printf("::: player %d waits [%d]\n", player->index_nr, FrameCounter);
+
     /* no actions for this player (no input at player's configured device) */
 
     DigField(player, 0, 0, 0, 0, DF_NO_PUSH);
@@ -5964,10 +6064,13 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
 
   if (tape.recording && num_stored_actions >= MAX_PLAYERS)
   {
+    printf("::: player %d recorded [%d]\n", player->index_nr, FrameCounter);
+
     TapeRecordAction(stored_player_action);
     num_stored_actions = 0;
   }
 }
+#endif
 
 void GameActions()
 {
@@ -5977,6 +6080,9 @@ void GameActions()
   int i, x, y, element, graphic;
   byte *recorded_player_action;
   byte summarized_player_action = 0;
+#if 1
+  byte tape_action[MAX_PLAYERS];
+#endif
 
   if (game_status != GAME_MODE_PLAYING)
     return;
@@ -6039,7 +6145,7 @@ void GameActions()
   if (!options.network && !setup.team_mode)
     local_player->effective_action = summarized_player_action;
 
-  for (i=0; i<MAX_PLAYERS; i++)
+  for (i=0; i < MAX_PLAYERS; i++)
   {
     int actual_player_action = stored_player[i].effective_action;
 
@@ -6049,10 +6155,16 @@ void GameActions()
     if (recorded_player_action)
       actual_player_action = recorded_player_action[i];
 
-    PlayerActions(&stored_player[i], actual_player_action);
+    tape_action[i] = PlayerActions(&stored_player[i], actual_player_action);
+
     ScrollPlayer(&stored_player[i], SCROLL_GO_ON);
   }
 
+#if 1
+  if (tape.recording)
+    TapeRecordAction(tape_action);
+#endif
+
   network_player_action_received = FALSE;
 
   ScrollScreen(NULL, SCROLL_GO_ON);
@@ -6224,6 +6336,11 @@ void GameActions()
       {
        DrawLevelGraphicAnimationIfNeeded(x, y, graphic);
 
+#if 0
+       if (element == EL_BUG)
+         printf("::: %d, %d\n", graphic, GfxFrame[x][y]);
+#endif
+
 #if 0
        if (element == EL_MOLE)
          printf("::: %d, %d\n", graphic, GfxFrame[x][y]);