added using native level name when showing story before game start
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 9 Nov 2024 15:50:45 +0000 (16:50 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 9 Nov 2024 15:50:47 +0000 (16:50 +0100)
src/files.c
src/main.h
src/screens.c

index 3844e66477298f89edbf074a92cc4572f11bd221..9496b89ef804ff87df059bf89f7ebd9fd64a6e31 100644 (file)
@@ -2395,12 +2395,15 @@ static void setLevelInfoToDefaults_Level(struct LevelInfo *level)
   level->encoding_16bit_amoeba = TRUE;
 
   // clear level name and level author string buffers
+  for (i = 0; i < MAX_OUTPUT_LINESIZE; i++)
+    level->name_native[i] = '\0';
   for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
     level->name[i] = '\0';
   for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
     level->author[i] = '\0';
 
   // set level name and level author to default values
+  strcpy(level->name_native, NAMELESS_LEVEL_NAME);
   strcpy(level->name, NAMELESS_LEVEL_NAME);
   strcpy(level->author, ANONYMOUS_NAME);
 
@@ -3255,6 +3258,8 @@ static int LoadLevel_NAME(File *file, int chunk_size, struct LevelInfo *level)
     level->name[i] = getFile8Bit(file);
   level->name[MAX_LEVEL_NAME_LEN] = 0;
 
+  strncpy(level->name_native, level->name, MAX_OUTPUT_LINESIZE);
+
   return chunk_size;
 }
 
@@ -4685,6 +4690,9 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
                            getStringPrint("%s / %d", cave_name_latin1, bd_level_nr + 1) :
                            getStringCopy(cave_name_latin1));
 
+  strncpy(level->name_native, cave_name_latin1, MAX_OUTPUT_LINESIZE);
+  level->name_native[MAX_OUTPUT_LINESIZE] = '\0';
+
   strncpy(level->name, cave_name_final, MAX_LEVEL_NAME_LEN);
   level->name[MAX_LEVEL_NAME_LEN] = '\0';
 
@@ -5351,6 +5359,7 @@ static void CopyNativeLevel_MM_to_RND(struct LevelInfo *level)
   level->df_laser_green = level_mm->df_laser_green;
   level->df_laser_blue  = level_mm->df_laser_blue;
 
+  strcpy(level->name_native, level_mm->name);
   strcpy(level->name, level_mm->name);
 
   // only overwrite author from 'levelinfo.conf' if author defined in level
@@ -6939,6 +6948,10 @@ static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level)
   level->envelope[0].autowrap = TRUE;
   level->envelope[0].centered = TRUE;
 
+  for (i = 0; i < level_name_len; i++)
+    level->name_native[i] = header[level_name_pos + 1 + i];
+  level->name_native[level_name_len] = '\0';
+
   for (i = 0; i < level_name_len; i++)
     level->name[i] = header[level_name_pos + 1 + i];
   level->name[level_name_len] = '\0';
index 3b22f2556ce50e18cba93fef1deefceffa8b7880..4422c99e43434f0f360240b283f0cd0689656c91 100644 (file)
@@ -3735,6 +3735,7 @@ struct LevelInfo
   boolean auto_count_gems;
   boolean rate_time_over_score;
 
+  char name_native[MAX_OUTPUT_LINESIZE + 1];
   char name[MAX_LEVEL_NAME_LEN + 1];
   char author[MAX_LEVEL_AUTHOR_LEN + 1];
 
index 779e7b31f8efa8ae1b0d1f9b49f6e7bb741c4704..f5f47981a92bb44c6551bd0d4c78db972f96b3dc 100644 (file)
@@ -1765,7 +1765,7 @@ static void DrawInfoScreen_Headline(int screen_nr, int num_screens,
     int max_text_len = SXSIZE / getFontWidth(FONT_TITLE_2);
     int max_name_len = max_text_len - text_format_len;
     char name_cut[max_name_len];
-    char *name_full = (info_mode == INFO_MODE_STORY ? level.name :
+    char *name_full = (info_mode == INFO_MODE_STORY ? level.name_native :
                        use_global_screens ? getProgramTitleString() :
                       leveldir_current->name);