X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftape.c;h=a8ac4cea12a6d9974f541302ac0f85fb3e782abc;hp=5a879d12ac0af05f624130ea6d5adf7ed8fe4917;hb=0d02210d139e2e889d91d80015d54c5186dc347b;hpb=960545869c00aa3c8fc0068282f52ce55f4603c1 diff --git a/src/tape.c b/src/tape.c index 5a879d12..a8ac4cea 100644 --- a/src/tape.c +++ b/src/tape.c @@ -376,15 +376,18 @@ void DrawVideoDisplayCurrentState() { state |= VIDEO_STATE_PLAY_ON; - if (tape.deactivate_display) - state |= VIDEO_STATE_WARP2_ON; - else if (tape.warp_forward) - state |= VIDEO_STATE_WARP_ON; - else if (tape.fast_forward) - state |= VIDEO_STATE_FFWD_ON; - - if (tape.pause_before_end) - state |= VIDEO_STATE_PBEND_ON; + if (!tape.pausing) + { + if (tape.deactivate_display) + state |= VIDEO_STATE_WARP2_ON; + else if (tape.warp_forward) + state |= VIDEO_STATE_WARP_ON; + else if (tape.fast_forward) + state |= VIDEO_STATE_FFWD_ON; + + if (tape.pause_before_end) + state |= VIDEO_STATE_PBEND_ON; + } } // draw labels and symbols separately to prevent labels overlapping symbols @@ -401,8 +404,7 @@ void DrawCompleteVideoDisplay() gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy); /* draw tape buttons (forced) */ - UnmapTapeButtons(); - MapTapeButtons(); + RedrawOrRemapTapeButtons(); DrawVideoDisplay(VIDEO_ALL_OFF, 0); @@ -456,6 +458,44 @@ void TapeDeactivateDisplayOff(boolean redraw_display) } +/* ========================================================================= */ +/* tape logging functions */ +/* ========================================================================= */ + +void PrintTapeReplayProgress(boolean replay_finished) +{ + static unsigned int counter_last = -1; + unsigned int counter = Counter(); + unsigned int counter_seconds = counter / 1000; + + if (!replay_finished) + { + unsigned int counter_delay = 50; + + if (counter > counter_last + counter_delay) + { + PrintNoLog("\r"); + PrintNoLog("Level %03d [%02d:%02d]: [%02d:%02d] - playing tape ... ", + level_nr, tape.length_seconds / 60, tape.length_seconds % 60, + TapeTime / 60, TapeTime % 60); + + counter_last = counter; + } + } + else + { + PrintNoLog("\r"); + Print("Level %03d [%02d:%02d]: (%02d:%02d.%03d / %.2f %%) - %s.\n", + level_nr, tape.length_seconds / 60, tape.length_seconds % 60, + counter_seconds / 60, counter_seconds % 60, counter % 1000, + (float)counter / tape.length_seconds / 10, + tape.auto_play_level_solved ? "solved" : "NOT SOLVED"); + + counter_last = -1; + } +} + + /* ========================================================================= */ /* tape control functions */ /* ========================================================================= */ @@ -711,6 +751,9 @@ void TapeTogglePause(boolean toggle_mode) // restart step/move snapshots after quick loading tape SaveEngineSnapshotToListInitial(); + + // do not map undo/redo buttons after quick loading tape + return; } if (setup.show_snapshot_buttons && @@ -852,6 +895,9 @@ byte *TapePlayAction() tape.delay_played = 0; } + if (tape.auto_play) + PrintTapeReplayProgress(FALSE); + return action; } @@ -1050,7 +1096,7 @@ void AutoPlayTape() if (autoplay_initialized) { /* just finished auto-playing tape */ - Print("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED"); + PrintTapeReplayProgress(TRUE); num_levels_played++; @@ -1107,18 +1153,18 @@ void AutoPlayTape() TapeErase(); - Print("Level %03d: ", level_nr); - LoadLevel(level_nr); - if (level.no_valid_file) + + if (level.no_level_file || level.no_valid_file) { - Print("(no level)\n"); + Print("Level %03d: (no level)\n", level_nr); + continue; } #if 0 /* ACTIVATE THIS FOR LOADING/TESTING OF LEVELS ONLY */ - Print("(only testing level)\n"); + Print("Level %03d: (only testing level)\n", level_nr); continue; #endif @@ -1131,12 +1177,12 @@ void AutoPlayTape() { num_tape_missing++; - Print("(no tape)\n"); + Print("Level %03d: (no tape)\n", level_nr); continue; } - Print("playing tape ... "); + InitCounter(); TapeStartGamePlaying(); TapeStartWarpForward(global.autoplay_mode); @@ -1290,6 +1336,34 @@ void UnmapTapeButtons() UnmapGameButtons(); } +void RedrawTapeButtons() +{ + int i; + + for (i = 0; i < NUM_TAPE_BUTTONS; i++) + RedrawGadget(tape_gadget[i]); + + if (tape.show_game_buttons) + RedrawGameButtons(); + + // RedrawGadget() may have set REDRAW_ALL if buttons are defined off-area + redraw_mask &= ~REDRAW_ALL; +} + +void RedrawOrRemapTapeButtons() +{ + if (tape_gadget[TAPE_CTRL_ID_PLAY]->mapped) + { + // tape buttons already mapped + RedrawTapeButtons(); + } + else + { + UnmapTapeButtons(); + MapTapeButtons(); + } +} + static void HandleTapeButtonsExt(int id) { if (game_status != GAME_MODE_MAIN && game_status != GAME_MODE_PLAYING)