From: Holger Schemel Date: Sun, 26 Feb 2006 02:05:43 +0000 (+0100) Subject: rnd-20060226-1-src X-Git-Tag: 3.2.0^2~63 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d9b86b7b2ebe0b2be3926656c3bbdcd060ee5811;p=rocksndiamonds.git rnd-20060226-1-src * fixed bug with random value initialization when recording tapes * fixed bug with playing single player tapes when team mode activated --- diff --git a/ChangeLog b/ChangeLog index 80dee958..38cc0309 100644 --- 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 diff --git a/src/conftime.h b/src/conftime.h index 1baa07fc..e6b147b4 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-02-25 18:03]" +#define COMPILE_DATE_STRING "[2006-02-26 02:56]" diff --git a/src/engines.h b/src/engines.h index 0b736da9..f89767c6 100644 --- a/src/engines.h +++ b/src/engines.h @@ -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); diff --git a/src/files.c b/src/files.c index 3f2d68b0..0d4f895c 100644 --- a/src/files.c +++ b/src/files.c @@ -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); diff --git a/src/game.c b/src/game.c index 8fdc17e2..64f521a9 100644 --- a/src/game.c +++ b/src/game.c @@ -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++) { diff --git a/src/game_em/convert.c b/src/game_em/convert.c index e695f373..2935a101 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -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; } } } diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 084bb388..f952cab5 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -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 diff --git a/src/screens.c b/src/screens.c index bf212d76..4a9e2ffb 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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(); } diff --git a/src/tools.c b/src/tools.c index 4ce30345..e49e0937 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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)