X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=41b328b240d99b30d68619e1f7f534c24eb5a27a;hb=1e196be4c0a2f1edf823b3a0e5a14a146317686e;hp=267dd58dcee849948b96a9f58df68c2a960ba17e;hpb=2fe0fbc2a34fd4b50081f1829931dea3ca2c4c1c;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 267dd58d..41b328b2 100644 --- a/src/tape.c +++ b/src/tape.c @@ -20,6 +20,7 @@ void TapeStartRecording() { time_t zeit1 = time(NULL); struct tm *zeit2 = localtime(&zeit1); + int i; if (!TAPE_IS_STOPPED(tape)) TapeStop(); @@ -35,9 +36,12 @@ void TapeStartRecording() tape.date = 10000*(zeit2->tm_year%100) + 100*zeit2->tm_mon + zeit2->tm_mday; tape.random_seed = InitRND(NEW_RANDOMIZE); - DrawVideoDisplay(VIDEO_STATE_REC_ON,0); - DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date); - DrawVideoDisplay(VIDEO_STATE_TIME_ON,0); + for(i=0; i=MAX_TAPELEN-1) + if (tape.counter >= MAX_TAPELEN-1) { TapeStopRecording(); return; @@ -85,7 +89,7 @@ void TapeRecordDelay() if (!tape.recording || tape.pausing) return; - if (tape.counter>=MAX_TAPELEN) + if (tape.counter >= MAX_TAPELEN) { TapeStopRecording(); return; @@ -105,15 +109,20 @@ void TapeRecordDelay() void TapeTogglePause() { + unsigned long state; + if (!tape.recording && !tape.playing) return; tape.pausing = !tape.pausing; tape.fast_forward = FALSE; tape.pause_before_death = FALSE; - DrawVideoDisplay(tape.pausing ? - VIDEO_STATE_PAUSE_ON : - VIDEO_STATE_PAUSE_OFF,0); + + state = (tape.pausing ? VIDEO_STATE_PAUSE_ON : VIDEO_STATE_PAUSE_OFF); + if (tape.playing) + state |= VIDEO_STATE_PBEND_OFF; + + DrawVideoDisplay(state, 0); } void TapeStartPlaying() @@ -133,9 +142,9 @@ void TapeStartPlaying() tape.fast_forward = FALSE; InitRND(tape.random_seed); - DrawVideoDisplay(VIDEO_STATE_PLAY_ON,0); - DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date); - DrawVideoDisplay(VIDEO_STATE_TIME_ON,0); + DrawVideoDisplay(VIDEO_STATE_PLAY_ON, 0); + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, 0); } void TapeStopPlaying() @@ -145,18 +154,18 @@ void TapeStopPlaying() tape.playing = FALSE; tape.pausing = FALSE; - DrawVideoDisplay(VIDEO_STATE_PLAY_OFF,0); + DrawVideoDisplay(VIDEO_STATE_PLAY_OFF, 0); } -int *TapePlayAction() +byte *TapePlayAction() { - static int joy[MAX_PLAYERS]; + static byte joy[MAX_PLAYERS]; int i; if (!tape.playing || tape.pausing) return(NULL); - if (tape.counter>=tape.length) + if (tape.counter >= tape.length) { TapeStop(); return(NULL); @@ -169,36 +178,39 @@ int *TapePlayAction() for(i=0; i tape.length_seconds - PAUSE_SECONDS_BEFORE_DEATH) + if (TimePlayed > tape.length_seconds - PAUSE_SECONDS_BEFORE_DEATH) { TapeTogglePause(); return(FALSE); } } - if (tape.counter>=tape.length) + if (tape.counter >= tape.length) { TapeStop(); return(TRUE); @@ -221,8 +233,8 @@ void TapeStop() DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0); if (tape.date && tape.length) { - DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date); - DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds); + DrawVideoDisplay(VIDEO_STATE_DATE_ON, tape.date); + DrawVideoDisplay(VIDEO_STATE_TIME_ON, tape.length_seconds); } } @@ -242,5 +254,5 @@ unsigned int GetTapeLength() for(i=0;i