1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
19 void TapeStartRecording()
21 time_t zeit1 = time(NULL);
22 struct tm *zeit2 = localtime(&zeit1);
24 if (!TAPE_IS_STOPPED(tape))
27 tape.level_nr = level_nr;
30 tape.pos[tape.counter].delay = 0;
31 tape.recording = TRUE;
35 tape.date = 10000*(zeit2->tm_year%100) + 100*zeit2->tm_mon + zeit2->tm_mday;
36 tape.random_seed = InitRND(NEW_RANDOMIZE);
38 DrawVideoDisplay(VIDEO_STATE_REC_ON,0);
39 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
40 DrawVideoDisplay(VIDEO_STATE_TIME_ON,0);
43 void TapeStopRecording()
50 for(i=0; i<MAX_PLAYERS; i++)
51 tape.pos[tape.counter].action[i] = 0;
54 tape.length = tape.counter;
55 tape.length_seconds = GetTapeLength();
56 tape.recording = FALSE;
58 DrawVideoDisplay(VIDEO_STATE_REC_OFF,0);
61 void TapeRecordAction(byte joy[MAX_PLAYERS])
65 if (!tape.recording || tape.pausing)
68 if (tape.counter>=MAX_TAPELEN-1)
74 for(i=0; i<MAX_PLAYERS; i++)
75 tape.pos[tape.counter].action[i] = joy[i];
78 tape.pos[tape.counter].delay = 0;
81 void TapeRecordDelay()
85 if (!tape.recording || tape.pausing)
88 if (tape.counter>=MAX_TAPELEN)
94 tape.pos[tape.counter].delay++;
96 if (tape.pos[tape.counter].delay >= 255)
98 for(i=0; i<MAX_PLAYERS; i++)
99 tape.pos[tape.counter].action[i] = 0;
102 tape.pos[tape.counter].delay = 0;
106 void TapeTogglePause()
108 if (!tape.recording && !tape.playing)
111 tape.pausing = !tape.pausing;
112 tape.fast_forward = FALSE;
113 tape.pause_before_death = FALSE;
114 DrawVideoDisplay(tape.pausing ?
115 VIDEO_STATE_PAUSE_ON :
116 VIDEO_STATE_PAUSE_OFF,0);
119 void TapeStartPlaying()
121 if (TAPE_IS_EMPTY(tape))
124 if (!TAPE_IS_STOPPED(tape))
128 tape.delay_played = 0;
129 tape.pause_before_death = FALSE;
130 tape.recording = FALSE;
132 tape.pausing = FALSE;
133 tape.fast_forward = FALSE;
134 InitRND(tape.random_seed);
136 DrawVideoDisplay(VIDEO_STATE_PLAY_ON,0);
137 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
138 DrawVideoDisplay(VIDEO_STATE_TIME_ON,0);
141 void TapeStopPlaying()
146 tape.playing = FALSE;
147 tape.pausing = FALSE;
148 DrawVideoDisplay(VIDEO_STATE_PLAY_OFF,0);
151 int *TapePlayAction()
153 static int joy[MAX_PLAYERS];
156 if (!tape.playing || tape.pausing)
159 if (tape.counter>=tape.length)
165 if (tape.delay_played == tape.pos[tape.counter].delay)
167 tape.delay_played = 0;
170 for(i=0; i<MAX_PLAYERS; i++)
171 joy[i] = tape.pos[tape.counter-1].action[i];
181 if (!tape.playing || tape.pausing)
184 if (tape.pause_before_death) /* STOP 10s BEFORE PLAYER GETS KILLED... */
186 if (!(FrameCounter % 5))
188 if (2*(FrameCounter/10) == FrameCounter/5)
189 DrawVideoDisplay(VIDEO_STATE_PAUSE_ON, VIDEO_DISPLAY_LABEL_ONLY);
191 DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF, VIDEO_DISPLAY_LABEL_ONLY);
194 if (level.time-TimeLeft > tape.length_seconds - PAUSE_SECONDS_BEFORE_DEATH)
201 if (tape.counter>=tape.length)
207 if (tape.delay_played < tape.pos[tape.counter].delay)
221 DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
222 if (tape.date && tape.length)
224 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
225 DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
234 unsigned int GetTapeLength()
236 unsigned int tape_length = 0;
239 if (TAPE_IS_EMPTY(tape))
242 for(i=0;i<tape.length;i++)
243 tape_length += tape.pos[i].delay;
245 return(tape_length * GAME_FRAME_DELAY / 100);