+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
-#define COMPILE_DATE_STRING "[2006-02-25 18:03]"
+#define COMPILE_DATE_STRING "[2006-02-26 02:56]"
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);
void DumpTape(struct TapeInfo *tape)
{
+ int tape_frame_counter;
int i, j;
if (tape->no_valid_file)
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++)
{
}
}
- 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);
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++)
{
{
int i, x, y;
int players_left;
+ int num_tape_players;
/* reset all runtime variables to their initial values */
}
}
- 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;
}
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;
}
}
}
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
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
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)
game_status = GAME_MODE_PLAYING;
+#if 0
InitRND(random_seed);
+#endif
InitGame();
}
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)