X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=963426033e02a9bb58a0013533e58364ff239137;hb=8c6f354ceb0f49857489ef2df0303e155e7f6846;hp=44bbc57bcbe440274f30575c61e5f462207c19ce;hpb=dfe534c10c9825cafd54961c60fc81a56691dc55;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 44bbc57b..96342603 100644 --- a/src/tape.c +++ b/src/tape.c @@ -22,12 +22,16 @@ /* tape button identifiers */ #define TAPE_CTRL_ID_EJECT 0 -#define TAPE_CTRL_ID_STOP 1 -#define TAPE_CTRL_ID_PAUSE 2 -#define TAPE_CTRL_ID_RECORD 3 -#define TAPE_CTRL_ID_PLAY 4 +#define TAPE_CTRL_ID_INDEX 1 +#define TAPE_CTRL_ID_STOP 2 +#define TAPE_CTRL_ID_PAUSE 3 +#define TAPE_CTRL_ID_RECORD 4 +#define TAPE_CTRL_ID_PLAY 5 -#define NUM_TAPE_BUTTONS 5 +#define NUM_TAPE_BUTTONS 6 + +/* values for tape handling */ +#define TAPE_PAUSE_SECONDS_BEFORE_DEATH 5 /* forward declaration for internal use */ static void HandleTapeButtons(struct GadgetInfo *); @@ -305,6 +309,7 @@ void TapeStartRecording() tape.changed = TRUE; tape.date = 10000*(zeit2->tm_year%100) + 100*zeit2->tm_mon + zeit2->tm_mday; tape.random_seed = InitRND(NEW_RANDOMIZE); + tape.game_version = GAME_VERSION_ACTUAL; for(i=0; i= MAX_TAPELEN-1) - { - TapeStopRecording(); - return; - } - for(i=0; i= MAX_TAPELEN) - { - TapeStopRecording(); - return; - } - - tape.pos[tape.counter].delay++; - - if (tape.pos[tape.counter].delay >= 255) - { - for(i=0; i= tape.length) - { - TapeStop(); - return(NULL); - } - - if (tape.delay_played == tape.pos[tape.counter].delay) - { - tape.delay_played = 0; - tape.counter++; - - for(i=0; i= tape.length) + if (tape.counter >= tape.length) /* end of tape reached */ { - TapeStop(); + if (tape.index_search) + TapeTogglePause(); + else + TapeStop(); + return NULL; } @@ -559,53 +494,6 @@ byte *TapePlayAction() return action; } -#endif - -#if 0 -boolean TapePlayDelay() -{ - if (!tape.playing || tape.pausing) - return(FALSE); - - if (tape.pause_before_death) /* STOP 10s BEFORE PLAYER GETS KILLED... */ - { - if (!(FrameCounter % 20)) - { - if ((FrameCounter / 20) % 2) - DrawVideoDisplay(VIDEO_STATE_PBEND_ON, VIDEO_DISPLAY_LABEL_ONLY); - else - DrawVideoDisplay(VIDEO_STATE_PBEND_OFF, VIDEO_DISPLAY_LABEL_ONLY); - } - - if (TimePlayed > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) - { - TapeTogglePause(); - return(FALSE); - } - } - - if (tape.counter >= tape.length) - { - TapeStop(); - return(TRUE); - } - - if (tape.delay_played < tape.pos[tape.counter].delay) - { - tape.delay_played++; - return(TRUE); - } - else - return(FALSE); -} - -#else - -boolean TapePlayDelay() -{ - return TRUE|FALSE; /* ...it doesn't matter at all */ -} -#endif void TapeStop() { @@ -648,6 +536,7 @@ unsigned int GetTapeLength() #define TAPE_BUTTON_YPOS 77 #define TAPE_BUTTON_EJECT_XPOS (TAPE_BUTTON_XPOS + 0 * TAPE_BUTTON_XSIZE) +#define TAPE_BUTTON_INDEX_XPOS (TAPE_BUTTON_XPOS + 0 * TAPE_BUTTON_XSIZE) #define TAPE_BUTTON_STOP_XPOS (TAPE_BUTTON_XPOS + 1 * TAPE_BUTTON_XSIZE) #define TAPE_BUTTON_PAUSE_XPOS (TAPE_BUTTON_XPOS + 2 * TAPE_BUTTON_XSIZE) #define TAPE_BUTTON_RECORD_XPOS (TAPE_BUTTON_XPOS + 3 * TAPE_BUTTON_XSIZE) @@ -665,6 +554,11 @@ static struct TAPE_CTRL_ID_EJECT, "eject tape" }, + { + TAPE_BUTTON_INDEX_XPOS, TAPE_BUTTON_YPOS, + TAPE_CTRL_ID_INDEX, + "index mark" + }, { TAPE_BUTTON_STOP_XPOS, TAPE_BUTTON_YPOS, TAPE_CTRL_ID_STOP, @@ -705,6 +599,12 @@ void CreateTapeButtons() gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset; gd_y = DOOR_GFX_PAGEY2 + gd_yoffset; + if (i == TAPE_CTRL_ID_INDEX) + { + gd_x1 = DOOR_GFX_PAGEX6 + gd_xoffset; + gd_x2 = DOOR_GFX_PAGEX5 + gd_xoffset; + } + gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, tapebutton_info[i].infotext, GDI_X, VX + gd_xoffset, @@ -726,12 +626,28 @@ void CreateTapeButtons() } } +void MapTapeEjectButton() +{ + UnmapGadget(tape_gadget[TAPE_CTRL_ID_INDEX]); + MapGadget(tape_gadget[TAPE_CTRL_ID_EJECT]); +} + +void MapTapeIndexButton() +{ + UnmapGadget(tape_gadget[TAPE_CTRL_ID_EJECT]); + MapGadget(tape_gadget[TAPE_CTRL_ID_INDEX]); +} + void MapTapeButtons() { int i; for (i=0; i PAUSING -> RECORDING */ { + if (tape.game_version != GAME_VERSION_ACTUAL && + !Request("This may break old version tape ! Append anyway ?", + REQ_ASK)) + break; + tape.pos[tape.counter].delay = tape.delay_played; tape.playing = FALSE; tape.recording = TRUE; tape.changed = TRUE; + tape.game_version = GAME_VERSION_ACTUAL; DrawVideoDisplay(VIDEO_STATE_PLAY_OFF | VIDEO_STATE_REC_ON,0); }