projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20051123-1-src
[rocksndiamonds.git]
/
src
/
tape.c
diff --git
a/src/tape.c
b/src/tape.c
index 66ca33c035107081a8ae9274c113ad9323db5794..4406288567f7453dd81a7da6b3fb7b253e922b9c 100644
(file)
--- a/
src/tape.c
+++ b/
src/tape.c
@@
-711,13
+711,19
@@
static void TapeRewind()
InitRND(tape.random_seed);
}
InitRND(tape.random_seed);
}
-void TapeStartRecording()
+static void TapeSetRandomSeed(long random_seed)
+{
+ tape.random_seed = InitRND(random_seed);
+}
+
+void TapeStartRecording(long random_seed)
{
if (!TAPE_IS_STOPPED(tape))
TapeStop();
TapeErase();
TapeRewind();
{
if (!TAPE_IS_STOPPED(tape))
TapeStop();
TapeErase();
TapeRewind();
+ TapeSetRandomSeed(random_seed);
tape.recording = TRUE;
tape.recording = TRUE;
@@
-732,7
+738,7
@@
void TapeStartRecording()
static void TapeStartGameRecording()
{
static void TapeStartGameRecording()
{
- TapeStartRecording();
+ TapeStartRecording(
NEW_RANDOMIZE
);
#if defined(NETWORK_AVALIABLE)
if (options.network)
#if defined(NETWORK_AVALIABLE)
if (options.network)
@@
-776,8
+782,10
@@
void TapeHaltRecording()
void TapeStopRecording()
{
void TapeStopRecording()
{
+#if 0
if (!tape.recording)
return;
if (!tape.recording)
return;
+#endif
TapeHaltRecording();
TapeHaltRecording();
@@
-800,7
+808,7
@@
void TapeRecordAction(byte action[MAX_PLAYERS])
return;
#endif
return;
#endif
- if (tape.counter >= MAX_TAPELEN - 1)
+ if (tape.counter >= MAX_TAPE
_
LEN - 1)
{
TapeStopRecording();
return;
{
TapeStopRecording();
return;
@@
-923,8
+931,10
@@
static void TapeStartGamePlaying()
void TapeStopPlaying()
{
void TapeStopPlaying()
{
+#if 0
if (!tape.playing)
return;
if (!tape.playing)
return;
+#endif
tape.playing = FALSE;
tape.pausing = FALSE;
tape.playing = FALSE;
tape.pausing = FALSE;
@@
-944,7
+954,7
@@
byte *TapePlayAction()
if (!tape.playing || tape.pausing)
return NULL;
if (!tape.playing || tape.pausing)
return NULL;
- if (tape.pause_before_death) /*
STOP 10s BEFORE PLAYER GETS KILLED...
*/
+ if (tape.pause_before_death) /*
stop 10 seconds before player gets killed
*/
{
if (!(FrameCounter % 20))
{
{
if (!(FrameCounter % 20))
{
@@
-965,6
+975,7
@@
byte *TapePlayAction()
if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
{
TapeTogglePause(TAPE_TOGGLE_MANUAL);
if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH)
{
TapeTogglePause(TAPE_TOGGLE_MANUAL);
+
return NULL;
}
}
return NULL;
}
}
@@
-983,6
+994,7
@@
byte *TapePlayAction()
DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY);
}
}
DrawVideoDisplay(VIDEO_STATE_WARP2_ON, VIDEO_DISPLAY_SYMBOL_ONLY);
}
}
+
#if 0
/* !!! this makes things much slower !!! */
else if (tape.warp_forward)
#if 0
/* !!! this makes things much slower !!! */
else if (tape.warp_forward)
@@
-1152,13
+1164,19
@@
void TapeQuickSave()
void TapeQuickLoad()
{
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))
{
if (tape.recording && !Request("Stop recording and load tape ?",
REQ_ASK | REQ_STAY_CLOSED))
{
- BlitBitmap(bitmap_db_door, bitmap_db_door,
- DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE,
- DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
- OpenDoor(DOOR_OPEN_1);
+ OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
return;
}
return;
}
@@
-1176,8
+1194,12
@@
void TapeQuickLoad()
tape.quick_resume = TRUE;
}
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);
+ }
}
}
}
}
@@
-1199,8
+1221,6
@@
void InsertSolutionTape()
* tape autoplay functions
* ------------------------------------------------------------------------- */
* tape autoplay functions
* ------------------------------------------------------------------------- */
-#define MAX_NUM_AUTOPLAY_LEVELS 1000
-
void AutoPlayTape()
{
static LevelDirTree *autoplay_leveldir = NULL;
void AutoPlayTape()
{
static LevelDirTree *autoplay_leveldir = NULL;
@@
-1208,7
+1228,9
@@
void AutoPlayTape()
static int autoplay_level_nr = -1;
static int num_levels_played = 0;
static int num_levels_solved = 0;
static int autoplay_level_nr = -1;
static int num_levels_played = 0;
static int num_levels_solved = 0;
- static boolean levels_failed[MAX_NUM_AUTOPLAY_LEVELS];
+ static int num_tape_missing = 0;
+ static boolean level_failed[MAX_TAPES_PER_SET];
+ static boolean tape_missing[MAX_TAPES_PER_SET];
int i;
if (autoplay_initialized)
int i;
if (autoplay_initialized)
@@
-1217,10
+1239,11
@@
void AutoPlayTape()
printf("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED");
num_levels_played++;
printf("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED");
num_levels_played++;
+
if (tape.auto_play_level_solved)
num_levels_solved++;
if (tape.auto_play_level_solved)
num_levels_solved++;
- else if (level_nr >= 0 && level_nr < MAX_
NUM_AUTOPLAY_LEVELS
)
- level
s
_failed[level_nr] = TRUE;
+ else if (level_nr >= 0 && level_nr < MAX_
TAPES_PER_SET
)
+ level_failed[level_nr] = TRUE;
}
else
{
}
else
{
@@
-1236,11
+1259,10
@@
void AutoPlayTape()
leveldir_current = autoplay_leveldir;
leveldir_current = autoplay_leveldir;
- if (global.autoplay_level_nr != -1)
- {
- autoplay_leveldir->first_level = global.autoplay_level_nr;
- autoplay_leveldir->last_level = global.autoplay_level_nr;
- }
+ if (autoplay_leveldir->first_level < 0)
+ autoplay_leveldir->first_level = 0;
+ if (autoplay_leveldir->last_level >= MAX_TAPES_PER_SET)
+ autoplay_leveldir->last_level = MAX_TAPES_PER_SET - 1;
autoplay_level_nr = autoplay_leveldir->first_level;
autoplay_level_nr = autoplay_leveldir->first_level;
@@
-1254,8
+1276,11
@@
void AutoPlayTape()
printf_line("=", 79);
printf("\n");
printf_line("=", 79);
printf("\n");
- for (i = 0; i < MAX_NUM_AUTOPLAY_LEVELS; i++)
- levels_failed[i] = FALSE;
+ for (i = 0; i < MAX_TAPES_PER_SET; i++)
+ {
+ level_failed[i] = FALSE;
+ tape_missing[i] = FALSE;
+ }
autoplay_initialized = TRUE;
}
autoplay_initialized = TRUE;
}
@@
-1264,6
+1289,9
@@
void AutoPlayTape()
{
level_nr = autoplay_level_nr++;
{
level_nr = autoplay_level_nr++;
+ if (!global.autoplay_all && !global.autoplay_level[level_nr])
+ continue;
+
TapeErase();
printf("Level %03d: ", level_nr);
TapeErase();
printf("Level %03d: ", level_nr);
@@
-1275,6
+1303,12
@@
void AutoPlayTape()
continue;
}
continue;
}
+#if 0
+ /* ACTIVATE THIS FOR LOADING/TESTING OF LEVELS ONLY */
+ printf("(only testing level)\n");
+ continue;
+#endif
+
LoadSolutionTape(level_nr);
#if 1
if (tape.no_valid_file)
LoadSolutionTape(level_nr);
#if 1
if (tape.no_valid_file)
@@
-1282,6
+1316,10
@@
void AutoPlayTape()
if (TAPE_IS_EMPTY(tape))
#endif
{
if (TAPE_IS_EMPTY(tape))
#endif
{
+ num_tape_missing++;
+ if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET)
+ tape_missing[level_nr] = TRUE;
+
printf("(no tape)\n");
continue;
}
printf("(no tape)\n");
continue;
}
@@
-1308,11
+1346,21
@@
void AutoPlayTape()
if (num_levels_played != num_levels_solved)
{
printf(", FAILED:");
if (num_levels_played != num_levels_solved)
{
printf(", FAILED:");
- for (i = 0; i < MAX_
NUM_AUTOPLAY_LEVELS
; i++)
- if (level
s
_failed[i])
+ for (i = 0; i < MAX_
TAPES_PER_SET
; i++)
+ if (level_failed[i])
printf(" %03d", i);
}
printf(" %03d", i);
}
+#if 0
+ if (num_tape_missing > 0)
+ {
+ printf(", NO TAPE:");
+ for (i = 0; i < MAX_TAPES_PER_SET; i++)
+ if (tape_missing[i])
+ printf(" %03d", i);
+ }
+#endif
+
printf("\n");
printf_line("=", 79);
printf("\n");
printf_line("=", 79);