From: Holger Schemel Date: Wed, 10 Jan 2018 10:21:03 +0000 (+0100) Subject: moved code for adding action to tape to separate function X-Git-Tag: 4.0.1.1~16 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3534d01a0c0c2693d3e1d55c6c0944e2b43ed9ce;p=rocksndiamonds.git moved code for adding action to tape to separate function --- diff --git a/src/tape.c b/src/tape.c index 5e55cb04..0fef94eb 100644 --- a/src/tape.c +++ b/src/tape.c @@ -662,33 +662,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 +692,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))