X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftape.c;h=becd0ad9affd199b714e7c3c663ede2383c65331;hp=e8fb1b7e4d86410763c02faa029bb28a912b935d;hb=c4dd9e14b72b528e82bc018fe2fa76b784221584;hpb=f772f882546ab982dc61074f298d6115c9909f32 diff --git a/src/tape.c b/src/tape.c index e8fb1b7e..becd0ad9 100644 --- a/src/tape.c +++ b/src/tape.c @@ -485,6 +485,9 @@ void TapeErase() for (i = 0; i < MAX_PLAYERS; i++) tape.player_participates[i] = FALSE; + + tape.centered_player_nr_next = -1; + tape.set_centered_player = FALSE; } static void TapeRewind() @@ -502,6 +505,9 @@ static void TapeRewind() tape.quick_resume = FALSE; tape.single_step = FALSE; + tape.centered_player_nr_next = -1; + tape.set_centered_player = FALSE; + InitRND(tape.random_seed); } @@ -585,8 +591,9 @@ void TapeStopRecording() MapTapeEjectButton(); } -void TapeRecordAction(byte action[MAX_PLAYERS]) +void TapeRecordAction(byte action_raw[MAX_PLAYERS]) { + byte action[MAX_PLAYERS]; int i; if (!tape.recording) /* (record action even when tape is paused) */ @@ -598,6 +605,19 @@ void TapeRecordAction(byte action[MAX_PLAYERS]) return; } + for (i = 0; i < MAX_PLAYERS; i++) + action[i] = action_raw[i]; + + if (tape.set_centered_player) + { + for (i = 0; i < MAX_PLAYERS; i++) + if (tape.centered_player_nr_next == i || + tape.centered_player_nr_next == -1) + action[i] |= SET_FOCUS; + + tape.set_centered_player = FALSE; + } + if (tape.pos[tape.counter].delay > 0) /* already stored action */ { boolean changed_events = FALSE; @@ -778,6 +798,21 @@ byte *TapePlayAction() for (i = 0; i < MAX_PLAYERS; i++) action[i] = tape.pos[tape.counter].action[i]; + tape.set_centered_player = FALSE; + tape.centered_player_nr_next = -999; + + for (i = 0; i < MAX_PLAYERS; i++) + { + if (action[i] & SET_FOCUS) + { + tape.set_centered_player = TRUE; + tape.centered_player_nr_next = + (tape.centered_player_nr_next == -999 ? i : -1); + } + + action[i] &= ~SET_FOCUS; + } + tape.delay_played++; if (tape.delay_played >= tape.pos[tape.counter].delay) {