X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=e1765fd87b20cf655f72cd502cb43f269c8827bd;hb=667288cc3f60989bfc84ac50bb69dae0c7bb5b22;hp=21309b825bf505ea3fc4ba98271d55874a3f0fb0;hpb=3d97e3d9c20a984e70dae5e63e7c5069fb136c91;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 21309b82..e1765fd8 100644 --- a/src/files.c +++ b/src/files.c @@ -253,12 +253,15 @@ static void setLevelInfoToDefaults() level.dauer_ablenk = 10; level.amoebe_inhalt = EL_DIAMANT; + level.high_speed = FALSE; + strcpy(level.name, "Nameless Level"); for(i=0; i= FILE_VERSION_1_2) { - /* next check body chunk identifier and chunk length */ fgets(chunk, CHUNK_ID_LEN + 1, file); chunk_length = (fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file); + + /* look for optional content chunk */ + if (strcmp(chunk, "CONT") == 0 && chunk_length == 4 + 8 * 3 * 3) + { + fgetc(file); + MampferMax = fgetc(file); + fgetc(file); + fgetc(file); + + for(i=0; i<8; i++) + for(y=0; y<3; y++) + for(x=0; x<3; x++) + level.mampfer_inhalt[i][x][y] = fgetc(file); + + fgets(chunk, CHUNK_ID_LEN + 1, file); + chunk_length = + (fgetc(file)<<24) | (fgetc(file)<<16) | (fgetc(file)<<8) | fgetc(file); + } + + /* next check body chunk identifier and chunk length */ if (strcmp(chunk, "BODY") || chunk_length != lev_fieldx * lev_fieldy) { Error(ERR_WARN, "wrong 'BODY' chunk of level file '%s'", filename); @@ -365,6 +397,13 @@ void LoadLevel(int level_nr) if (level.time <= 10) /* minimum playing time of each level */ level.time = 10; + + if (file_version == FILE_VERSION_1_0) + { + Error(ERR_WARN, "level file '%s' has version number 1.0", filename); + Error(ERR_WARN, "using high speed movement for player"); + level.high_speed = TRUE; + } } void SaveLevel(int level_nr) @@ -415,6 +454,25 @@ void SaveLevel(int level_nr) for(i=0; i> 24) & 0xff, file); + fputc((chunk_length >> 16) & 0xff, file); + fputc((chunk_length >> 8) & 0xff, file); + fputc((chunk_length >> 0) & 0xff, file); + + fputc(EL_MAMPFER, file); + fputc(MampferMax, file); + fputc(0, file); + fputc(0, file); + + for(i=0; i<8; i++) + for(y=0; y<3; y++) + for(x=0; x<3; x++) + fputc(level.mampfer_inhalt[i][x][y], file); + fputs("BODY", file); /* chunk identifier for file body */ chunk_length = lev_fieldx * lev_fieldy;