/* at least one (default: the first) player participates in every tape */
tape.num_participating_players = 1;
+
+ tape.level_nr = level_nr;
+ tape.counter = 0;
+ tape.changed = FALSE;
+
+ tape.recording = FALSE;
+ tape.playing = FALSE;
+ tape.pausing = FALSE;
}
void OLD_LoadTape(int level_nr)
}
}
- tape->level_nr = level_nr;
- tape->counter = 0;
- tape->changed = FALSE;
-
- tape->recording = FALSE;
- tape->playing = FALSE;
- tape->pausing = FALSE;
-
return chunk_size;
}
return chunk_size_expected;
}
-#if DEBUG
- printf("\nTAPE OF LEVEL %d\n", level_nr);
-#endif
-
for(i=0; i<tape->length; i++)
{
if (i >= MAX_TAPELEN)
if (tape->player_participates[j])
tape->pos[i].action[j] = fgetc(file);
-
-#if DEBUG
- {
- int x = tape->pos[i].action[j];
-
- printf("%d:%02x ", j, x);
- printf("[%c%c%c%c|%c%c] - ",
- (x & JOY_LEFT ? '<' : ' '),
- (x & JOY_RIGHT ? '>' : ' '),
- (x & JOY_UP ? '^' : ' '),
- (x & JOY_DOWN ? 'v' : ' '),
- (x & JOY_BUTTON_1 ? '1' : ' '),
- (x & JOY_BUTTON_2 ? '2' : ' '));
- }
-#endif
-
}
tape->pos[i].delay = fgetc(file);
-#if DEBUG
- printf("[%03d]\n", tape->pos[i].delay);
-#endif
-
if (tape->file_version == FILE_VERSION_1_0)
{
/* eliminate possible diagonal moves in old tapes */
Request("tape saved !", REQ_CONFIRM);
}
+void DumpTape(struct TapeInfo *tape)
+{
+ int i, j;
+
+ if (TAPE_IS_EMPTY(*tape))
+ {
+ Error(ERR_WARN, "no tape available for level %d", tape->level_nr);
+ return;
+ }
+
+ printf("\n");
+ printf("-------------------------------------------------------------------------------\n");
+ printf("TAPE OF LEVEL %d\n", tape->level_nr);
+ printf("-------------------------------------------------------------------------------\n");
+
+ for(i=0; i<tape->length; i++)
+ {
+ if (i >= MAX_TAPELEN)
+ break;
+
+ for(j=0; j<MAX_PLAYERS; j++)
+ {
+ if (tape->player_participates[j])
+ {
+ int action = tape->pos[i].action[j];
+
+ printf("%d:%02x ", j, action);
+ printf("[%c%c%c%c|%c%c] - ",
+ (action & JOY_LEFT ? '<' : ' '),
+ (action & JOY_RIGHT ? '>' : ' '),
+ (action & JOY_UP ? '^' : ' '),
+ (action & JOY_DOWN ? 'v' : ' '),
+ (action & JOY_BUTTON_1 ? '1' : ' '),
+ (action & JOY_BUTTON_2 ? '2' : ' '));
+ }
+ }
+
+ printf("(%03d)\n", tape->pos[i].delay);
+ }
+
+ printf("-------------------------------------------------------------------------------\n");
+}
+
void LoadScore(int level_nr)
{
int i;
if (TimeLeft)
{
- if (setup.sound_loops)
+ if (!tape.playing && setup.sound_loops)
PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP);
while(TimeLeft > 0)
{
- if (!setup.sound_loops)
+ if (!tape.playing && !setup.sound_loops)
PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT);
if (TimeLeft > 0 && !(TimeLeft % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
TimeLeft--;
DrawText(DX_TIME, DY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW);
BackToFront();
- Delay(10);
+
+ if (!tape.playing)
+ Delay(10);
}
- if (setup.sound_loops)
+ if (!tape.playing && setup.sound_loops)
StopSound(SND_SIRR);
}
else if (level.time == 0) /* level without time limit */
{
- if (setup.sound_loops)
+ if (!tape.playing && setup.sound_loops)
PlaySoundExt(SND_SIRR, PSND_MAX_VOLUME, PSND_MAX_RIGHT, PSND_LOOP);
while(TimePlayed < 999)
{
- if (!setup.sound_loops)
+ if (!tape.playing && !setup.sound_loops)
PlaySoundStereo(SND_SIRR, PSND_MAX_RIGHT);
if (TimePlayed < 999 && !(TimePlayed % 10))
RaiseScore(level.score[SC_ZEITBONUS]);
TimePlayed++;
DrawText(DX_TIME, DY_TIME, int2str(TimePlayed, 3), FS_SMALL, FC_YELLOW);
BackToFront();
- Delay(10);
+
+ if (!tape.playing)
+ Delay(10);
}
- if (setup.sound_loops)
+ if (!tape.playing && setup.sound_loops)
StopSound(SND_SIRR);
}
{
static byte stored_player_action[MAX_PLAYERS];
static int num_stored_actions = 0;
+#if 0
static boolean save_tape_entry = FALSE;
+#endif
boolean moved = FALSE, snapped = FALSE, bombed = FALSE;
int left = player_action & JOY_LEFT;
int right = player_action & JOY_RIGHT;
player_action &= JOY_BUTTON;
stored_player_action[player->index_nr] = player_action;
-#if 1
save_tape_entry = TRUE;
-#endif
}
else if (tape.playing && snapped)
SnapField(player, 0, 0); /* stop snapping */