X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=38edafc59d6503b61e167c97f1ec16c1f8aadbe5;hb=3256486ac61f3b7e213973f5dd441e01197ae971;hp=5e55cb0453fad9166df5de9c971aaba03950abfc;hpb=43a15ee9fa750d3089d23d3e244b91d9019d81d2;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 5e55cb04..38edafc5 100644 --- a/src/tape.c +++ b/src/tape.c @@ -637,9 +637,6 @@ static void TapeAppendRecording() void TapeHaltRecording() { - if (!tape.recording) - return; - tape.counter++; // initialize delay for next tape entry (to be able to continue recording) @@ -653,7 +650,8 @@ void TapeHaltRecording() void TapeStopRecording() { - TapeHaltRecording(); + if (tape.recording) + TapeHaltRecording(); tape.recording = FALSE; tape.pausing = FALSE; @@ -662,33 +660,10 @@ void TapeStopRecording() MapTapeEjectButton(); } -void TapeRecordAction(byte action_raw[MAX_PLAYERS]) +void TapeAddAction(byte action[MAX_PLAYERS]) { - byte action[MAX_PLAYERS]; int i; - if (!tape.recording) /* (record action even when tape is paused) */ - return; - - if (tape.counter >= MAX_TAPE_LEN - 1) - { - TapeStopRecording(); - 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] |= KEY_SET_FOCUS; - - tape.set_centered_player = FALSE; - } - if (tape.pos[tape.counter].delay > 0) /* already stored action */ { boolean changed_events = FALSE; @@ -715,6 +690,36 @@ void TapeRecordAction(byte action_raw[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) */ + return; + + if (tape.counter >= MAX_TAPE_LEN - 1) + { + TapeStopRecording(); + 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] |= KEY_SET_FOCUS; + + tape.set_centered_player = FALSE; + } + + TapeAddAction(action); +} + void TapeTogglePause(boolean toggle_mode) { if (tape.playing && tape.pausing && (toggle_mode & TAPE_TOGGLE_PLAY_PAUSE))