#define CHUNK_SIZE_NONE -1 /* do not write chunk size */
#define FILE_VERS_CHUNK_SIZE 8 /* size of file version chunk */
#define LEVEL_HEADER_SIZE 80 /* size of level file header */
-#define LEVEL_HEADER_UNUSED 7 /* unused level header bytes */
+#define LEVEL_HEADER_UNUSED 4 /* unused level header bytes */
#define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */
#define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */
#define LEVEL_CHUNK_CNT3_HEADER 16 /* size of level CNT3 header */
level->block_last_field = FALSE;
level->sp_block_last_field = TRUE;
- level->use_spring_bug = FALSE;
-
level->can_move_into_acid_bits = ~0; /* everything can move into acid */
+ level->dont_collide_with_bits = ~0; /* always deadly when colliding */
+ level->use_spring_bug = FALSE;
level->use_step_counter = FALSE;
level->use_custom_template = FALSE;
BorderElement = EL_STEELWALL;
- level->no_level_file = FALSE;
+ level->no_valid_file = FALSE;
if (leveldir_current == NULL) /* only when dumping level */
return;
level->block_last_field = (getFile8Bit(file) == 1 ? TRUE : FALSE);
level->sp_block_last_field = (getFile8Bit(file) == 1 ? TRUE : FALSE);
+ level->can_move_into_acid_bits = getFile32BitBE(file);
+ level->dont_collide_with_bits = getFile8Bit(file);
level->use_spring_bug = (getFile8Bit(file) == 1 ? TRUE : FALSE);
-
- level->can_move_into_acid_bits = getFile16BitBE(file);
-
level->use_step_counter = (getFile8Bit(file) == 1 ? TRUE : FALSE);
ReadUnusedBytesFromFile(file, LEVEL_HEADER_UNUSED);
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
if (level != &level_template)
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "CAVE") != 0)
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of level file '%s'", filename);
fclose(file);
return;
if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL))
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of level file '%s'", filename);
fclose(file);
return;
if ((level->file_version = getFileVersionFromCookieString(cookie)) == -1)
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unsupported version of level file '%s'", filename);
fclose(file);
return;
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
/* position file stream to the requested level inside the level package */
if (fseek(file, nr * SP_LEVEL_SIZE, SEEK_SET) != 0)
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot fseek level '%s' -- using empty level", filename);
if (level->game_version < VERSION_IDENT(2,2,0,0))
level->use_spring_bug = TRUE;
- if (level->game_version < VERSION_IDENT(3,0,9,0))
+ if (level->game_version < VERSION_IDENT(3,1,0,0))
{
int i, j;
level->can_move_into_acid_bits = 0; /* nothing can move into acid */
+ level->dont_collide_with_bits = 0; /* nothing is deadly when colliding */
setMoveIntoAcidProperty(level, EL_ROBOT, TRUE);
setMoveIntoAcidProperty(level, EL_SATELLITE, TRUE);
putFile8Bit(file, (level->block_last_field ? 1 : 0));
putFile8Bit(file, (level->sp_block_last_field ? 1 : 0));
+ putFile32BitBE(file, level->can_move_into_acid_bits);
+ putFile8Bit(file, level->dont_collide_with_bits);
putFile8Bit(file, (level->use_spring_bug ? 1 : 0));
-
- putFile16BitBE(file, level->can_move_into_acid_bits);
-
putFile8Bit(file, (level->use_step_counter ? 1 : 0));
WriteUnusedBytesToFile(file, LEVEL_HEADER_UNUSED);
void DumpLevel(struct LevelInfo *level)
{
+ if (level->no_valid_file)
+ {
+ Error(ERR_WARN, "cannot dump -- no valid level file found");
+
+ return;
+ }
+
printf_line("-", 79);
printf("Level xxx (file version %08d, game version %08d)\n",
level->file_version, level->game_version);
tape.recording = FALSE;
tape.playing = FALSE;
tape.pausing = FALSE;
+
+ tape.no_valid_file = FALSE;
}
static int LoadTape_VERS(FILE *file, int chunk_size, struct TapeInfo *tape)
setTapeInfoToDefaults();
if (!(file = fopen(filename, MODE_READ)))
+ {
+ tape.no_valid_file = TRUE;
+
+#if 0
+ Error(ERR_WARN, "cannot read tape '%s' -- using empty tape", filename);
+#endif
+
return;
+ }
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "RND1") == 0)
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "TAPE") != 0)
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of tape file '%s'", filename);
fclose(file);
return;
if (!checkCookieString(cookie, TAPE_COOKIE_TMPL))
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of tape file '%s'", filename);
fclose(file);
return;
if ((tape.file_version = getFileVersionFromCookieString(cookie)) == -1)
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unsupported version of tape file '%s'", filename);
fclose(file);
return;
{
int i, j;
+#if 1
+ if (tape->no_valid_file)
+ {
+ Error(ERR_WARN, "cannot dump -- no valid tape file found");
+
+ return;
+ }
+#else
if (TAPE_IS_EMPTY(*tape))
{
Error(ERR_WARN, "no tape available for level %d", tape->level_nr);
+
return;
}
+#endif
printf_line("-", 79);
printf("Tape of Level %03d (file version %08d, game version %08d)\n",