rnd-19981205-2
[rocksndiamonds.git] / src / files.c
index be7bd1a1aa84b01c27732517fb0798904c88d193..21309b825bf505ea3fc4ba98271d55874a3f0fb0 100644 (file)
@@ -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);
@@ -443,6 +443,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<MAX_PLAYERS; i++)
+    tape.player_participates[i] = FALSE;
+
+  /* at least one (default: the first) player participates in every tape */
+  num_participating_players = 1;
+
   if (!(file = fopen(filename, "r")))
     return;
 
@@ -491,7 +502,7 @@ void LoadTape(int level_nr)
     for(i=0; i<TAPE_HEADER_UNUSED; i++)                /* skip unused header bytes */
       fgetc(file);
 
-    /* check which players participate in this tape recording */
+    /* since version 1.2, tapes store which players participate in the tape */
     num_participating_players = 0;
     for(i=0; i<MAX_PLAYERS; i++)
     {
@@ -538,10 +549,6 @@ void LoadTape(int level_nr)
     {
       tape.pos[i].action[j] = MV_NO_MOVING;
 
-      /* pre-1.2 tapes store data for only one player */
-      if (file_version == FILE_VERSION_1_0 && j > 0)
-       continue;
-
       if (tape.player_participates[j])
        tape.pos[i].action[j] = fgetc(file);
     }
@@ -1144,16 +1151,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<MAX_PLAYERS; i++)