X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=e6fbcdab528e3082dcaca4c7d1cd11b58986d8e0;hb=005e27dc77775cbda39afc1daabc8d5f6011f575;hp=7f4545b5c591e172f09735c12c2142b741d063d3;hpb=074c00b42409c74e9c5856db1be03dced3a15ae9;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 7f4545b5..e6fbcdab 100644 --- a/src/tape.c +++ b/src/tape.c @@ -99,7 +99,7 @@ static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS]; #define VIDEO_FFWD_LABEL_XSIZE VIDEO_LABEL_XSIZE #define VIDEO_FFWD_LABEL_YSIZE VIDEO_LABEL_YSIZE #define VIDEO_FFWD_SYMBOL_XPOS VIDEO_SYMBOL_XPOS -#define VIDEO_FFWD_SYMBOL_YPOS 126 +#define VIDEO_FFWD_SYMBOL_YPOS 193 #define VIDEO_FFWD_SYMBOL_XSIZE 27 #define VIDEO_FFWD_SYMBOL_YSIZE VIDEO_SYMBOL_YSIZE @@ -108,7 +108,7 @@ static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS]; #define VIDEO_PBEND_LABEL_XSIZE VIDEO_LABEL_XSIZE #define VIDEO_PBEND_LABEL_YSIZE VIDEO_LABEL_YSIZE #define VIDEO_PBEND_SYMBOL_XPOS VIDEO_SYMBOL_XPOS -#define VIDEO_PBEND_SYMBOL_YPOS 126 +#define VIDEO_PBEND_SYMBOL_YPOS 221 #define VIDEO_PBEND_SYMBOL_XSIZE 27 #define VIDEO_PBEND_SYMBOL_YSIZE VIDEO_SYMBOL_YSIZE @@ -117,16 +117,16 @@ static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS]; #define VIDEO_WARP_LABEL_XSIZE VIDEO_LABEL_XSIZE #define VIDEO_WARP_LABEL_YSIZE VIDEO_LABEL_YSIZE #define VIDEO_WARP_SYMBOL_XPOS VIDEO_SYMBOL_XPOS -#define VIDEO_WARP_SYMBOL_YPOS 152 +#define VIDEO_WARP_SYMBOL_YPOS 165 #define VIDEO_WARP_SYMBOL_XSIZE 27 #define VIDEO_WARP_SYMBOL_YSIZE VIDEO_SYMBOL_YSIZE #define VIDEO_WARP2_SYMBOL_XPOS VIDEO_SYMBOL_XPOS -#define VIDEO_WARP2_SYMBOL_YPOS 139 +#define VIDEO_WARP2_SYMBOL_YPOS 152 #define VIDEO_WARP2_SYMBOL_XSIZE 27 #define VIDEO_WARP2_SYMBOL_YSIZE VIDEO_SYMBOL_YSIZE #define VIDEO_1STEP_SYMBOL_XPOS (VIDEO_SYMBOL_XPOS + 18) -#define VIDEO_1STEP_SYMBOL_YPOS 113 +#define VIDEO_1STEP_SYMBOL_YPOS 139 #define VIDEO_1STEP_SYMBOL_XSIZE (VIDEO_SYMBOL_XSIZE - 18) #define VIDEO_1STEP_SYMBOL_YSIZE VIDEO_SYMBOL_YSIZE @@ -654,10 +654,16 @@ void TapeDeactivateDisplayOff(boolean redraw_display) /* tape control functions */ /* ========================================================================= */ -void TapeErase() +static void TapeSetDate() { time_t epoch_seconds = time(NULL); - struct tm *time = localtime(&epoch_seconds); + struct tm *now = localtime(&epoch_seconds); + + tape.date = 10000 * (now->tm_year % 100) + 100 * now->tm_mon + now->tm_mday; +} + +void TapeErase() +{ int i; tape.length = 0; @@ -670,13 +676,14 @@ void TapeErase() tape.pos[tape.counter].delay = 0; tape.changed = TRUE; - tape.date = 10000*(time->tm_year % 100) + 100*time->tm_mon + time->tm_mday; tape.random_seed = InitRND(NEW_RANDOMIZE); tape.file_version = FILE_VERSION_ACTUAL; tape.game_version = GAME_VERSION_ACTUAL; tape.engine_version = level.game_version; + TapeSetDate(); + #if 0 printf("::: tape.engine_version = level.game_version = %d \n", level.game_version); @@ -727,7 +734,7 @@ static void TapeStartGameRecording() { TapeStartRecording(); -#if defined(PLATFORM_UNIX) +#if defined(NETWORK_AVALIABLE) if (options.network) SendToServer_StartPlaying(); else @@ -749,7 +756,10 @@ static void TapeAppendRecording() tape.recording = TRUE; tape.changed = TRUE; - DrawVideoDisplay(VIDEO_STATE_PLAY_OFF | VIDEO_STATE_REC_ON,0); + TapeSetDate(); + + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_PLAY_OFF | VIDEO_STATE_REC_ON, 0); } void TapeHaltRecording() @@ -766,8 +776,10 @@ void TapeHaltRecording() void TapeStopRecording() { +#if 0 if (!tape.recording) return; +#endif TapeHaltRecording(); @@ -913,8 +925,10 @@ static void TapeStartGamePlaying() void TapeStopPlaying() { +#if 0 if (!tape.playing) return; +#endif tape.playing = FALSE; tape.pausing = FALSE; @@ -952,7 +966,7 @@ byte *TapePlayAction() DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY); } - if (TimePlayed > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) + if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) { TapeTogglePause(TAPE_TOGGLE_MANUAL); return NULL; @@ -973,6 +987,8 @@ byte *TapePlayAction() DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY); } } +#if 0 + /* !!! this makes things much slower !!! */ else if (tape.warp_forward) { if ((FrameCounter / 20) % 2) @@ -982,6 +998,7 @@ byte *TapePlayAction() DrawVideoDisplay(VIDEO_STATE_WARP_ON, VIDEO_DISPLAY_SYMBOL_ONLY); } +#endif if (tape.counter >= tape.length) /* end of tape reached */ { @@ -1139,6 +1156,23 @@ void TapeQuickSave() void TapeQuickLoad() { + char *filename = getTapeFilename(level_nr); + + if (!fileExists(filename)) + { + Request("No tape for this level !", REQ_CONFIRM); + + return; + } + + if (tape.recording && !Request("Stop recording and load tape ?", + REQ_ASK | REQ_STAY_CLOSED)) + { + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + + return; + } + if (game_status == GAME_MODE_PLAYING || game_status == GAME_MODE_MAIN) { TapeStop(); @@ -1152,8 +1186,12 @@ void TapeQuickLoad() tape.quick_resume = TRUE; } - else - Request("No tape for this level !", REQ_CONFIRM); + else /* this should not happen (basically checked above) */ + { + int reopen_door = (game_status == GAME_MODE_PLAYING ? REQ_REOPEN : 0); + + Request("No tape for this level !", REQ_CONFIRM | reopen_door); + } } } @@ -1280,6 +1318,7 @@ void AutoPlayTape() printf("LEVELDIR '%s', SOLVED %d/%d (%d%%)", autoplay_leveldir->identifier, num_levels_solved, num_levels_played, (num_levels_played ? num_levels_solved * 100 / num_levels_played :0)); + if (num_levels_played != num_levels_solved) { printf(", FAILED:"); @@ -1287,6 +1326,7 @@ void AutoPlayTape() if (levels_failed[i]) printf(" %03d", i); } + printf("\n"); printf_line("=", 79); @@ -1534,9 +1574,15 @@ static void HandleTapeButtons(struct GadgetInfo *gi) } else /* AUTO PAUSE -> NORMAL PLAY */ { +#if 1 + if (tape.warp_forward) + TapeStopWarpForward(); +#else + tape.warp_forward = FALSE; +#endif tape.fast_forward = FALSE; tape.pause_before_death = FALSE; - tape.warp_forward = FALSE; + #if 1 DrawVideoDisplay(VIDEO_STATE_PBEND_OFF | VIDEO_STATE_PLAY_ON, 0); #else