X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=eb87f87e87cde86cf3ddaff1f08724a6317fa35f;hb=95d786b6fe8474c30a22f839751e0d04c7682ded;hp=2b089217ae9daba79e3c6d345ec153f5f8d9787e;hpb=34efaa3925a28cb95ecb05bf2c693c16f6edfe2f;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 2b089217..eb87f87e 100644 --- a/src/files.c +++ b/src/files.c @@ -58,7 +58,7 @@ #define LEVELSETUP_FILENAME "lvlsetup.cnf" #define LEVELINFO_FILENAME "lvlinfo.cnf" #define LEVELFILE_EXTENSION "lvl" -#define TAPEFILE_EXTENSION "rec" +#define TAPEFILE_EXTENSION "tap" #define SCOREFILE_EXTENSION "sco" #define ERROR_FILENAME "error.out" #endif @@ -155,7 +155,7 @@ static char *getScoreDir(char *level_subdir) static char *getLevelFilename(int nr) { static char *filename = NULL; - char basename[20 + strlen(LEVELFILE_EXTENSION)]; + char basename[MAX_FILENAME_LEN]; if (filename != NULL) free(filename); @@ -173,7 +173,7 @@ static char *getLevelFilename(int nr) static char *getTapeFilename(int nr) { static char *filename = NULL; - char basename[20 + strlen(LEVELFILE_EXTENSION)]; + char basename[MAX_FILENAME_LEN]; if (filename != NULL) free(filename); @@ -187,7 +187,7 @@ static char *getTapeFilename(int nr) static char *getScoreFilename(int nr) { static char *filename = NULL; - char basename[20 + strlen(LEVELFILE_EXTENSION)]; + char basename[MAX_FILENAME_LEN]; if (filename != NULL) free(filename); @@ -258,7 +258,8 @@ static void setLevelInfoToDefaults() 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); @@ -415,6 +445,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; @@ -443,6 +492,17 @@ void LoadTape(int level_nr) int file_version = FILE_VERSION_1_2; /* last version of tape files */ int chunk_length; + /* always start with reliable default values (empty tape) */ + TapeErase(); + + /* default values (also for pre-1.2 tapes) with only the first player */ + tape.player_participates[0] = TRUE; + for(i=1; i 0) - continue; - if (tape.player_participates[j]) tape.pos[i].action[j] = fgetc(file); } @@ -1144,16 +1200,16 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->player_name = getStringCopy(getLoginName()); si->sound = TRUE; - si->sound_loops = FALSE; - si->sound_music = FALSE; - si->sound_simple = FALSE; + si->sound_loops = TRUE; + si->sound_music = TRUE; + si->sound_simple = TRUE; si->toons = TRUE; si->double_buffering = TRUE; si->direct_draw = !si->double_buffering; - si->scroll_delay = FALSE; + si->scroll_delay = TRUE; si->soft_scrolling = TRUE; si->fading = FALSE; - si->autorecord = FALSE; + si->autorecord = TRUE; si->quick_doors = FALSE; for (i=0; i