rnd-20060226-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 26 Feb 2006 02:05:43 +0000 (03:05 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:50:54 +0000 (10:50 +0200)
* fixed bug with random value initialization when recording tapes
* fixed bug with playing single player tapes when team mode activated

ChangeLog
src/conftime.h
src/engines.h
src/files.c
src/game.c
src/game_em/convert.c
src/libgame/setup.c
src/screens.c
src/tools.c

index 80dee95832e2a2a2e97eaf2e194c5ca50193fb7d..38cc03097033e805cabaf65d1a4a910ed6990897 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-02-25
+       * fixed bug with random value initialization when recording tapes
+       * fixed bug with playing single player tapes when team mode activated
+
 2006-02-22
        * fixed little bug when trying to switch to player that does not exist
 
index 1baa07fce0adfd246246fcd3862765ddea66c33e..e6b147b4f8214691af69ea45a483ac977b323e7c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-02-25 18:03]"
+#define COMPILE_DATE_STRING "[2006-02-26 02:56]"
index 0b736da9dadc47ba53f3ba4ab32a86466dd16464..f89767c644f18701548fe9f45ee9ab6cc07a12a3 100644 (file)
@@ -27,6 +27,7 @@ extern void DrawAllGameValues(int, int, int, int, int);
 
 extern int getGameFrameDelay_EM(int);
 extern int getCenteredPlayerNr_EM();
+extern int getActivePlayers_EM();
 
 extern void PlayLevelSound_EM(int, int, int, int);
 extern void InitGraphicInfo_EM(void);
index 3f2d68b0cda9df7b4cbd371d81c9321602ae5508..0d4f895c34c050bd381c1df74a63ad641975b1f2 100644 (file)
@@ -4769,6 +4769,7 @@ void SaveTape(int nr)
 
 void DumpTape(struct TapeInfo *tape)
 {
+  int tape_frame_counter;
   int i, j;
 
   if (tape->no_valid_file)
@@ -4786,12 +4787,14 @@ void DumpTape(struct TapeInfo *tape)
   printf("Level series identifier: '%s'\n", tape->level_identifier);
   printf_line("-", 79);
 
+  tape_frame_counter = 0;
+
   for (i = 0; i < tape->length; i++)
   {
     if (i >= MAX_TAPE_LEN)
       break;
 
-    printf("%03d: ", i);
+    printf("%04d: ", i);
 
     for (j = 0; j < MAX_PLAYERS; j++)
     {
@@ -4810,7 +4813,10 @@ void DumpTape(struct TapeInfo *tape)
       }
     }
 
-    printf("(%03d)\n", tape->pos[i].delay);
+    printf("(%03d) ", tape->pos[i].delay);
+    printf("[%05d]\n", tape_frame_counter);
+
+    tape_frame_counter += tape->pos[i].delay;
   }
 
   printf_line("-", 79);
index 8fdc17e2f81893af4fb7da2d2f07f6e5141d40e8..64f521a9dd2c15cad2a6ea300bc779ed7d67c27c 100644 (file)
@@ -2099,7 +2099,7 @@ void InitGame()
 
   if (tape.playing)
   {
-    /* when playing a tape, eliminate all players which do not participate */
+    /* when playing a tape, eliminate all players who do not participate */
 
     for (i = 0; i < MAX_PLAYERS; i++)
     {
index e695f3735497af8c8443d68c97a0c2f010bcd19f..2935a10123be7a50c10443820dd03d93960f52ea 100644 (file)
@@ -903,6 +903,7 @@ void prepare_em_level(void)
 {
   int i, x, y;
   int players_left;
+  int num_tape_players;
 
   /* reset all runtime variables to their initial values */
 
@@ -969,7 +970,11 @@ void prepare_em_level(void)
     }
   }
 
-  if (!setup.team_mode)
+  num_tape_players = getActivePlayers_EM();
+
+  if (num_tape_players != -1)
+    lev.home_initial = MIN(lev.home_initial, num_tape_players);
+  else if (!setup.team_mode)
     lev.home_initial = MIN(lev.home_initial, 1);
 
   lev.home = lev.home_initial;
@@ -986,7 +991,12 @@ void prepare_em_level(void)
       }
       else
       {
-       native_em_level.cave[ply[i].x_initial][ply[i].y_initial] = Xblank;
+       int x = ply[i].x_initial;
+       int y = ply[i].y_initial;
+
+       native_em_level.cave[x][y] = Xblank;
+
+       Cave[y][x] = Next[y][x] = Draw[y][x] = Xblank;
       }
     }
   }
index 084bb3883182f0dde63b9505be2f3cb4b4689c26..f952cab57be96ae62f207eb4958afff2c6652c56 100644 (file)
@@ -2134,6 +2134,10 @@ void LoadLevelInfo()
   LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL));
 
 #if 1
+  /* after loading all level set information, clone the level directory tree
+     and remove all level sets without levels (these may still contain artwork
+     to be offered in the setup menu as "custom artwork", and are therefore
+     checked for existing artwork in the function "LoadLevelArtworkInfo()") */
   leveldir_first_all = leveldir_first;
   cloneTree(&leveldir_first, leveldir_first_all, TRUE);
 #endif
index bf212d76f65969cbeb1264aae0d71ccfa8392dbe..4a9e2ffbc97cb9a9a0d534f3ff57d0e2fe5d0bc0 100644 (file)
@@ -3184,6 +3184,27 @@ void HandleGameActions()
       for (i = 0; i < MAX_PLAYERS; i++)
        effective_action[i] = stored_player[i].effective_action;
 
+
+#if 0
+      printf("::: %s: ",
+            tape.playing ? "PLAYING" :
+            tape.recording ? "RECORDING" :
+            "STOPPED");
+
+      for (i = 1; i < MAX_PLAYERS; i++)
+       if ((recorded_player_action && recorded_player_action[i] != 0) ||
+           tape_action[i] != 0 ||
+           effective_action[i] != 0)
+         printf("::: -----------------> WARNING!\n");
+
+      printf("::: %08d: %08x [%08x] [%08x]\n",
+            FrameCounter,
+            (recorded_player_action ? recorded_player_action[0] : -1),
+            tape_action[0],
+            effective_action[0]);
+#endif
+
+
       GameActions_EM(effective_action);
     }
 #else
@@ -3249,8 +3270,15 @@ void HandleGameActions()
 void StartGameActions(boolean init_network_game, boolean record_tape,
                      long random_seed)
 {
+#if 1
+  unsigned long new_random_seed = InitRND(random_seed);
+
+  if (record_tape)
+    TapeStartRecording(new_random_seed);
+#else
   if (record_tape)
     TapeStartRecording(random_seed);
+#endif
 
 #if defined(NETWORK_AVALIABLE)
   if (init_network_game)
@@ -3265,7 +3293,9 @@ void StartGameActions(boolean init_network_game, boolean record_tape,
 
   game_status = GAME_MODE_PLAYING;
 
+#if 0
   InitRND(random_seed);
+#endif
 
   InitGame();
 }
index 4ce303450a2ec08fe552271eef51a8758dcd22f2..e49e0937a4ca0d879c7f42e09719033e5ccd0882 100644 (file)
@@ -5141,6 +5141,21 @@ int getCenteredPlayerNr_EM()
   return game.centered_player_nr;
 }
 
+int getActivePlayers_EM()
+{
+  int num_players = 0;
+  int i;
+
+  if (!tape.playing)
+    return -1;
+
+  for (i = 0; i < MAX_PLAYERS; i++)
+    if (tape.player_participates[i])
+      num_players++;
+
+  return num_players;
+}
+
 unsigned int InitRND(long seed)
 {
   if (level.game_engine_type == GAME_ENGINE_TYPE_EM)