X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=919bd418455f9749b5490bf4445de947b3371a05;hb=a5a80a3aeba9c0c91d52ce1e3ec3860a55ccf4d3;hp=ff5f6199ef6f5c482e5d75d8cbb32a644a92b71a;hpb=bc1cfd142117805ee16aadb9143aa9c8980cf94e;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index ff5f6199..919bd418 100644 --- a/src/tape.c +++ b/src/tape.c @@ -356,20 +356,26 @@ void DrawVideoDisplaySymbol(unsigned int state) DrawVideoDisplay(state, VIDEO_DISPLAY_SYMBOL_ONLY); } -void DrawVideoDisplayPlayState() +void DrawVideoDisplayCurrentState() { int state = 0; DrawVideoDisplay(VIDEO_STATE_OFF, 0); - state |= VIDEO_STATE_PLAY_ON; - if (tape.pausing) - { state |= VIDEO_STATE_PAUSE_ON; + + if (tape.recording) + { + state |= VIDEO_STATE_REC_ON; + + if (tape.single_step) + state |= VIDEO_STATE_1STEP_ON; } - else + else if (tape.playing) { + state |= VIDEO_STATE_PLAY_ON; + if (tape.deactivate_display) state |= VIDEO_STATE_WARP2_ON; else if (tape.warp_forward) @@ -673,38 +679,28 @@ void TapeTogglePause(boolean toggle_manual) if (tape.single_step && toggle_manual) tape.single_step = FALSE; - DrawVideoDisplayPlayState(); + DrawVideoDisplayCurrentState(); - if (tape.warp_forward) + if (tape.deactivate_display) { if (tape.pausing) - { TapeDeactivateDisplayOff(game_status == GAME_MODE_PLAYING); - } - else if (tape.deactivate_display) - { - TapeDeactivateDisplayOn(); - - DrawVideoDisplaySymbol(VIDEO_STATE_WARP_ON); - } else - { - DrawVideoDisplaySymbol(VIDEO_STATE_WARP2_ON); - } + TapeDeactivateDisplayOn(); + } - if (tape.quick_resume) - { - tape.quick_resume = FALSE; + if (tape.quick_resume) + { + tape.quick_resume = FALSE; - TapeStopWarpForward(); - TapeAppendRecording(); + TapeStopWarpForward(); + TapeAppendRecording(); - if (!CheckEngineSnapshotSingle()) - SaveEngineSnapshotSingle(); + if (!CheckEngineSnapshotSingle()) + SaveEngineSnapshotSingle(); - // restart step/move snapshots after quick loading tape - SaveEngineSnapshotToListInitial(); - } + // restart step/move snapshots after quick loading tape + SaveEngineSnapshotToListInitial(); } if (setup.show_snapshot_buttons && @@ -775,9 +771,6 @@ byte *TapePlayAction() { if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) { - tape.fast_forward = FALSE; - tape.pause_before_end = FALSE; - TapeStopWarpForward(); TapeTogglePause(TAPE_TOGGLE_MANUAL); @@ -785,27 +778,38 @@ byte *TapePlayAction() } } - if (update_video_display && !tape.deactivate_display) - { - if (tape.pause_before_end) - DrawVideoDisplayLabel(VIDEO_STATE_PBEND(update_draw_label_on)); - else if (tape.fast_forward) - DrawVideoDisplayLabel(VIDEO_STATE_FFWD(update_draw_label_on)); - - if (tape.warp_forward) - DrawVideoDisplaySymbol(VIDEO_STATE_WARP2_ON); - } - if (tape.counter >= tape.length) /* end of tape reached */ { if (tape.warp_forward && !tape.auto_play) + { + TapeStopWarpForward(); TapeTogglePause(TAPE_TOGGLE_MANUAL); + } else + { TapeStop(); + } return NULL; } + if (update_video_display && !tape.deactivate_display) + { + int state = 0; + + if (tape.warp_forward) + state |= VIDEO_STATE_WARP(update_draw_label_on); + else if (tape.fast_forward) + state |= VIDEO_STATE_FFWD(update_draw_label_on); + + if (tape.pause_before_end) + state |= VIDEO_STATE_PBEND(update_draw_label_on); + + // draw labels and symbols separately to prevent labels overlapping symbols + DrawVideoDisplayLabel(state); + DrawVideoDisplaySymbol(state); + } + for (i = 0; i < MAX_PLAYERS; i++) action[i] = tape.pos[tape.counter].action[i]; @@ -877,43 +881,28 @@ unsigned int GetTapeLengthSeconds() static void TapeStartWarpForward() { + tape.fast_forward = TRUE; tape.warp_forward = TRUE; + tape.deactivate_display = TRUE; - if (!tape.fast_forward && !tape.pause_before_end) - { - tape.pausing = FALSE; - tape.pause_before_end = TRUE; - tape.deactivate_display = TRUE; + tape.pausing = FALSE; - TapeDeactivateDisplayOn(); + TapeDeactivateDisplayOn(); - DrawVideoDisplay(VIDEO_STATE_PBEND_ON, 0); - DrawVideoDisplaySymbol(VIDEO_STATE_WARP_ON); - } - else - { - DrawVideoDisplaySymbol(VIDEO_STATE_WARP2_ON); - } + DrawVideoDisplayCurrentState(); } static void TapeStopWarpForward() { - int state = VIDEO_STATE_PAUSE(tape.pausing); - - if (tape.deactivate_display) - tape.pause_before_end = FALSE; - + tape.fast_forward = FALSE; tape.warp_forward = FALSE; tape.deactivate_display = FALSE; - TapeDeactivateDisplayOff(game_status == GAME_MODE_PLAYING); + tape.pause_before_end = FALSE; - state |= VIDEO_STATE_WARP_OFF; - state |= (tape.pause_before_end ? VIDEO_STATE_PBEND_ON : - tape.fast_forward ? VIDEO_STATE_FFWD_ON : - VIDEO_STATE_PLAY_ON); + TapeDeactivateDisplayOff(game_status == GAME_MODE_PLAYING); - DrawVideoDisplay(state, 0); + DrawVideoDisplayCurrentState(); } static void TapeSingleStep() @@ -1323,35 +1312,32 @@ static void HandleTapeButtonsExt(int id) case TAPE_CTRL_ID_EXTRA: if (tape.playing) { - if (!tape.warp_forward) /* PLAY -> WARP FORWARD PLAY */ - { - TapeStartWarpForward(); - } - else if (tape.pausing) /* PAUSE -> WARP FORWARD PLAY */ - { - TapeTogglePause(TAPE_TOGGLE_MANUAL); - } - else /* WARP FORWARD PLAY -> PLAY */ - { - TapeStopWarpForward(); - } + tape.pause_before_end = !tape.pause_before_end; + + DrawVideoDisplayCurrentState(); } else if (tape.recording) + { TapeSingleStep(); + } break; case TAPE_CTRL_ID_STOP: TapeStop(); + break; case TAPE_CTRL_ID_PAUSE: TapeTogglePause(TAPE_TOGGLE_MANUAL); + break; case TAPE_CTRL_ID_RECORD: if (TAPE_IS_STOPPED(tape)) + { TapeStartGameRecording(); + } else if (tape.pausing) { if (tape.playing) /* PLAY -> PAUSE -> RECORD */ @@ -1359,6 +1345,7 @@ static void HandleTapeButtonsExt(int id) else TapeTogglePause(TAPE_TOGGLE_MANUAL); } + break; case TAPE_CTRL_ID_PLAY: @@ -1383,42 +1370,38 @@ static void HandleTapeButtonsExt(int id) // continue playing in normal mode tape.fast_forward = FALSE; tape.warp_forward = FALSE; - tape.pause_before_end = FALSE; tape.deactivate_display = FALSE; + tape.pause_before_end = FALSE; + TapeTogglePause(TAPE_TOGGLE_MANUAL); } - else if (tape.warp_forward && - !tape.fast_forward) /* WARP FORWARD PLAY -> PLAY */ + else if (!tape.fast_forward) /* PLAY -> FFWD */ { - TapeStopWarpForward(); + tape.fast_forward = TRUE; } - else if (!tape.fast_forward) /* PLAY -> FAST FORWARD PLAY */ + else if (!tape.warp_forward) /* FFWD -> WARP */ { - tape.fast_forward = TRUE; - - DrawVideoDisplay(VIDEO_STATE_FFWD_ON, 0); + tape.warp_forward = TRUE; } - else if (!tape.pause_before_end) /* FFWD PLAY -> AUTO PAUSE */ + else if (!tape.deactivate_display) /* WARP -> WARP BLIND */ { - tape.pause_before_end = TRUE; - - DrawVideoDisplay(VIDEO_STATE_FFWD_OFF | VIDEO_STATE_PBEND_ON, 0); + tape.deactivate_display = TRUE; - if (tape.warp_forward) - DrawVideoDisplaySymbol(VIDEO_STATE_WARP2_ON); + TapeDeactivateDisplayOn(); } - else /* AUTO PAUSE -> NORMAL PLAY */ + else /* WARP BLIND -> PLAY */ { - if (tape.warp_forward) - TapeStopWarpForward(); - tape.fast_forward = FALSE; - tape.pause_before_end = FALSE; + tape.warp_forward = FALSE; + tape.deactivate_display = FALSE; - DrawVideoDisplay(VIDEO_STATE_PBEND_OFF | VIDEO_STATE_PLAY_ON, 0); + TapeDeactivateDisplayOff(game_status == GAME_MODE_PLAYING); } + + DrawVideoDisplayCurrentState(); } + break; default: