added separate screen for showing level info before starting the game
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 9 Nov 2024 13:45:31 +0000 (14:45 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 9 Nov 2024 13:45:36 +0000 (14:45 +0100)
src/conf_gfx.c
src/conf_mus.c
src/conf_snd.c
src/main.c
src/main.h
src/screens.c

index a7ab28363547e2cd44b9056cafd8cf77c3a88997..da47a80d3e5310f52265919ddc13c77e631097c1 100644 (file)
@@ -8067,6 +8067,9 @@ struct ConfigInfo image_config[] =
   { "font.info.level",                                 UNDEFINED_FILENAME              },
   { "font.info.level.clone_from",                      "font.level_number"             },
 
+  { "font.info.story",                                 UNDEFINED_FILENAME              },
+  { "font.info.story.clone_from",                      "font.level_number"             },
+
   { "font.main.network_players",                       UNDEFINED_FILENAME              },
   { "font.main.network_players.clone_from",            "font.level_number"             },
 
@@ -8599,6 +8602,7 @@ struct ConfigInfo image_config[] =
   { "background.INFO[VERSION]",                                UNDEFINED_FILENAME              },
   { "background.INFO[LEVELSET]",                       UNDEFINED_FILENAME              },
   { "background.INFO[LEVEL]",                          UNDEFINED_FILENAME              },
+  { "background.INFO[STORY]",                          UNDEFINED_FILENAME              },
   { "background.SETUP",                                        UNDEFINED_FILENAME              },
   { "background.PLAYING",                              UNDEFINED_FILENAME              },
   { "background.DOOR",                                 UNDEFINED_FILENAME              },
@@ -9235,6 +9239,8 @@ struct ConfigInfo image_config[] =
   { "menu.draw_yoffset.INFO[LEVELSET]",                        "0"                             },
   { "menu.draw_xoffset.INFO[LEVEL]",                   "0"                             },
   { "menu.draw_yoffset.INFO[LEVEL]",                   "0"                             },
+  { "menu.draw_xoffset.INFO[STORY]",                   "0"                             },
+  { "menu.draw_yoffset.INFO[STORY]",                   "0"                             },
   { "menu.draw_xoffset.SETUP",                         "0"                             },
   { "menu.draw_yoffset.SETUP",                         "0"                             },
   { "menu.draw_xoffset.SETUP[GAME]",                   "0"                             },
@@ -9300,6 +9306,7 @@ struct ConfigInfo image_config[] =
   { "menu.left_spacing.INFO[VERSION]",                 "16"                            },
   { "menu.left_spacing.INFO[LEVELSET]",                        "16"                            },
   { "menu.left_spacing.INFO[LEVEL]",                   "16"                            },
+  { "menu.left_spacing.INFO[STORY]",                   "16"                            },
   { "menu.left_spacing.SETUP[INPUT]",                  "16"                            },
 
   { "menu.middle_spacing.SCOREINFO",                   "32"                            },
@@ -9316,6 +9323,7 @@ struct ConfigInfo image_config[] =
   { "menu.right_spacing.INFO[VERSION]",                        "16"                            },
   { "menu.right_spacing.INFO[LEVELSET]",               "16"                            },
   { "menu.right_spacing.INFO[LEVEL]",                  "16"                            },
+  { "menu.right_spacing.INFO[STORY]",                  "16"                            },
   { "menu.right_spacing.SETUP[INPUT]",                 "16"                            },
 
   { "menu.top_spacing.SCOREINFO",                      "96"                            },
@@ -9328,6 +9336,7 @@ struct ConfigInfo image_config[] =
   { "menu.top_spacing.INFO[VERSION]",                  "96"                            },
   { "menu.top_spacing.INFO[LEVELSET]",                 "96"                            },
   { "menu.top_spacing.INFO[LEVEL]",                    "96"                            },
+  { "menu.top_spacing.INFO[STORY]",                    "96"                            },
   { "menu.top_spacing.SETUP[INPUT]",                   "96"                            },
 
   { "menu.bottom_spacing.SCOREINFO",                   "32"                            },
@@ -9340,6 +9349,7 @@ struct ConfigInfo image_config[] =
   { "menu.bottom_spacing.INFO[VERSION]",               "32"                            },
   { "menu.bottom_spacing.INFO[LEVELSET]",              "32"                            },
   { "menu.bottom_spacing.INFO[LEVEL]",                 "32"                            },
+  { "menu.bottom_spacing.INFO[STORY]",                 "32"                            },
   { "menu.bottom_spacing.SETUP[INPUT]",                        "32"                            },
 
   { "menu.paragraph_spacing.SCOREINFO",                        "-2"                            },
@@ -9352,6 +9362,7 @@ struct ConfigInfo image_config[] =
   { "menu.paragraph_spacing.INFO[VERSION]",            "-2"                            },
   { "menu.paragraph_spacing.INFO[LEVELSET]",           "-3"                            },
   { "menu.paragraph_spacing.INFO[LEVEL]",              "-3"                            },
+  { "menu.paragraph_spacing.INFO[STORY]",              "-3"                            },
   { "menu.paragraph_spacing.SETUP[INPUT]",             "-1"                            },
 
   { "menu.headline1_spacing.SCOREINFO",                        "-2"                            },
@@ -9364,6 +9375,7 @@ struct ConfigInfo image_config[] =
   { "menu.headline1_spacing.INFO[VERSION]",            "-2"                            },
   { "menu.headline1_spacing.INFO[LEVELSET]",           "-2"                            },
   { "menu.headline1_spacing.INFO[LEVEL]",              "-2"                            },
+  { "menu.headline1_spacing.INFO[STORY]",              "-2"                            },
   { "menu.headline1_spacing.SETUP[INPUT]",             "-2"                            },
 
   { "menu.headline2_spacing.SCOREINFO",                        "-1"                            },
@@ -9376,6 +9388,7 @@ struct ConfigInfo image_config[] =
   { "menu.headline2_spacing.INFO[VERSION]",            "-1"                            },
   { "menu.headline2_spacing.INFO[LEVELSET]",           "-1"                            },
   { "menu.headline2_spacing.INFO[LEVEL]",              "-1"                            },
+  { "menu.headline2_spacing.INFO[STORY]",              "-1"                            },
   { "menu.headline2_spacing.SETUP[INPUT]",             "-1"                            },
 
   { "menu.line_spacing.SCOREINFO",                     "0"                             },
@@ -9388,6 +9401,7 @@ struct ConfigInfo image_config[] =
   { "menu.line_spacing.INFO[VERSION]",                 "0"                             },
   { "menu.line_spacing.INFO[LEVELSET]",                        "0"                             },
   { "menu.line_spacing.INFO[LEVEL]",                   "0"                             },
+  { "menu.line_spacing.INFO[STORY]",                   "0"                             },
   { "menu.line_spacing.SETUP[INPUT]",                  "0"                             },
 
   { "menu.extra_spacing.SCOREINFO",                    "2"                             },
@@ -9400,6 +9414,7 @@ struct ConfigInfo image_config[] =
   { "menu.extra_spacing.INFO[VERSION]",                        "2"                             },
   { "menu.extra_spacing.INFO[LEVELSET]",               "2"                             },
   { "menu.extra_spacing.INFO[LEVEL]",                  "2"                             },
+  { "menu.extra_spacing.INFO[STORY]",                  "2"                             },
   { "menu.extra_spacing.SETUP[INPUT]",                 "2"                             },
 
   { "menu.text.title.x",                               "-1"                            },
index 786035afde214a1882878f3dccbec3b3eda6ad6c..fdf27ea5adafa97119656282ec38284f4e00d188 100644 (file)
@@ -42,6 +42,7 @@ struct ConfigInfo music_config[] =
   { "background.INFO[VERSION]",                        UNDEFINED_FILENAME              },
   { "background.INFO[LEVELSET]",               UNDEFINED_FILENAME              },
   { "background.INFO[LEVEL]",                  UNDEFINED_FILENAME              },
+  { "background.INFO[STORY]",                  UNDEFINED_FILENAME              },
   { "background.SETUP",                                UNDEFINED_FILENAME              },
 
   { "background.titlescreen_initial_1",                UNDEFINED_FILENAME              },
index 5b351495e49730c167863fb47fee93725cec95be..e3bb555fa3772bfc19a1c6fe4cd3aafbba0d02ee 100644 (file)
@@ -425,6 +425,7 @@ struct ConfigInfo sound_config[] =
   { "background.INFO[VERSION]",                        UNDEFINED_FILENAME              },
   { "background.INFO[LEVELSET]",               UNDEFINED_FILENAME              },
   { "background.INFO[LEVEL]",                  UNDEFINED_FILENAME              },
+  { "background.INFO[STORY]",                  UNDEFINED_FILENAME              },
   { "background.SETUP",                                UNDEFINED_FILENAME              },
 
   { "background.titlescreen_initial_1",                UNDEFINED_FILENAME              },
index bf0e68ceb22bc9dac109d7622f56b2ccb86cfcf4..725a98d4b252ea724e1a2a79ee8552e5888c0972 100644 (file)
@@ -9380,6 +9380,7 @@ struct FontInfo font_info[NUM_FONTS + 1] =
   { "font.info.elements"       },
   { "font.info.levelset"       },
   { "font.info.level"          },
+  { "font.info.story"          },
   { "font.main.network_players"        },
 
   { NULL                       }
index e09fd3044f135dbdee599d09733975578e60f723..82d91550dce439f5892dd78bc6115621805442b2 100644 (file)
@@ -2857,6 +2857,7 @@ enum
   GFX_SPECIAL_ARG_INFO_VERSION,
   GFX_SPECIAL_ARG_INFO_LEVELSET,
   GFX_SPECIAL_ARG_INFO_LEVEL,
+  GFX_SPECIAL_ARG_INFO_STORY,
 
   NUM_SPECIAL_GFX_INFO_ARGS
 };
@@ -3034,6 +3035,7 @@ enum
   FONT_INFO_ELEMENTS,
   FONT_INFO_LEVELSET,
   FONT_INFO_LEVEL,
+  FONT_INFO_STORY,
   FONT_MAIN_NETWORK_PLAYERS,
 
   NUM_FONTS
index 3be934856290d196aa8631eb0081e11488034385..19d086e4a7a961f17b19c91167e51f806aa67941 100644 (file)
@@ -38,8 +38,9 @@
 #define INFO_MODE_VERSION                      6
 #define INFO_MODE_LEVELSET                     7
 #define INFO_MODE_LEVEL                                8
+#define INFO_MODE_STORY                                9
 
-#define MAX_INFO_MODES                         9
+#define MAX_INFO_MODES                         10
 
 // screens on the setup screen
 // (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h)
@@ -733,7 +734,7 @@ static int align_yoffset = 0;
 
 // (there are no draw offset definitions needed for INFO_MODE_TITLE)
 #define DRAW_MODE_INFO(i)      ((i) >= INFO_MODE_TITLE &&                      \
-                                (i) <= INFO_MODE_LEVEL ? (i) :                 \
+                                (i) <= INFO_MODE_STORY ? (i) :                 \
                                 INFO_MODE_MAIN)
 
 #define DRAW_MODE_SETUP(i)     ((i) >= SETUP_MODE_MAIN &&                      \
@@ -1757,12 +1758,14 @@ static void DrawInfoScreen_Headline(int screen_nr, int num_screens,
   }
   else
   {
-    char *text_format = (use_global_screens ? "for %s" : "for \"%s\"");
+    char *text_format = (info_mode == INFO_MODE_STORY ? "%s" :
+                         use_global_screens ? "for %s" : "for \"%s\"");
     int text_format_len = strlen(text_format) - strlen("%s");
     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 = (use_global_screens ? getProgramTitleString() :
+    char *name_full = (info_mode == INFO_MODE_STORY ? level.name :
+                       use_global_screens ? getProgramTitleString() :
                       leveldir_current->name);
 
     snprintf(name_cut, max_name_len, "%s", name_full);
@@ -4116,6 +4119,7 @@ static int getInfoScreenBackgroundImage_Generic(void)
          info_mode == INFO_MODE_VERSION  ? IMG_BACKGROUND_INFO_VERSION  :
          info_mode == INFO_MODE_LEVELSET ? IMG_BACKGROUND_INFO_LEVELSET :
          info_mode == INFO_MODE_LEVEL    ? IMG_BACKGROUND_INFO_LEVEL    :
+         info_mode == INFO_MODE_STORY    ? IMG_BACKGROUND_INFO_STORY    :
          IMG_BACKGROUND_INFO);
 }
 
@@ -4127,6 +4131,7 @@ static int getInfoScreenBackgroundSound_Generic(void)
          info_mode == INFO_MODE_VERSION  ? SND_BACKGROUND_INFO_VERSION  :
          info_mode == INFO_MODE_LEVELSET ? SND_BACKGROUND_INFO_LEVELSET :
          info_mode == INFO_MODE_LEVEL    ? SND_BACKGROUND_INFO_LEVEL    :
+         info_mode == INFO_MODE_STORY    ? SND_BACKGROUND_INFO_STORY    :
          SND_BACKGROUND_INFO);
 }
 
@@ -4138,6 +4143,7 @@ static int getInfoScreenBackgroundMusic_Generic(void)
          info_mode == INFO_MODE_VERSION  ? MUS_BACKGROUND_INFO_VERSION  :
          info_mode == INFO_MODE_LEVELSET ? MUS_BACKGROUND_INFO_LEVELSET :
          info_mode == INFO_MODE_LEVEL    ? MUS_BACKGROUND_INFO_LEVEL    :
+         info_mode == INFO_MODE_STORY    ? MUS_BACKGROUND_INFO_STORY    :
          MUS_BACKGROUND_INFO);
 }
 
@@ -4147,6 +4153,7 @@ static char *getInfoScreenFilename_Generic(int nr, boolean global)
          info_mode == INFO_MODE_PROGRAM  ? getProgramInfoFilename(nr)     :
          info_mode == INFO_MODE_LEVELSET ? getLevelSetInfoFilename(nr)    :
          info_mode == INFO_MODE_LEVEL    ? getLevelInfoFilename(level_nr) :
+         info_mode == INFO_MODE_STORY    ? getLevelInfoFilename(level_nr) :
          NULL);
 }
 
@@ -4154,6 +4161,7 @@ static char *getInfoScreenBuffer_Generic(void)
 {
   return (info_mode == INFO_MODE_LEVELSET ? getLevelSetInfoBuffer() :
          info_mode == INFO_MODE_LEVEL    ? getLevelInfoBuffer()    :
+         info_mode == INFO_MODE_STORY    ? getLevelInfoBuffer()    :
          NULL);
 }
 
@@ -4221,13 +4229,15 @@ static void DrawInfoScreen_GenericScreen(int screen_nr, int num_screens, int use
     tmi->parse_comments = TRUE;
   }
   else if (info_mode == INFO_MODE_LEVELSET ||
-           info_mode == INFO_MODE_LEVEL)
+           info_mode == INFO_MODE_LEVEL ||
+           info_mode == INFO_MODE_STORY)
   {
     tmi->autowrap = readme.autowrap;
     tmi->centered = readme.centered;
     tmi->parse_comments = readme.parse_comments;
 
-    tmi->font = (info_mode == INFO_MODE_LEVELSET ? FONT_INFO_LEVELSET : FONT_INFO_LEVEL);
+    tmi->font = (info_mode == INFO_MODE_LEVELSET ? FONT_INFO_LEVELSET :
+                 info_mode == INFO_MODE_LEVEL    ? FONT_INFO_LEVEL    : FONT_INFO_STORY);
   }
 
   SetWrappedText_GenericScreen(tmi, screen_nr, use_global_screens);
@@ -4366,7 +4376,8 @@ void HandleInfoScreen_Generic(int mx, int my, int dx, int dy, int button)
 
       text_no_info = "No level set info available.";
     }
-    else if (info_mode == INFO_MODE_LEVEL)
+    else if (info_mode == INFO_MODE_LEVEL ||
+             info_mode == INFO_MODE_STORY)
     {
       use_global_screens = FALSE;
 
@@ -4499,6 +4510,8 @@ static void DrawInfoScreen(void)
     DrawInfoScreen_Generic();
   else if (info_mode == INFO_MODE_LEVEL)
     DrawInfoScreen_Generic();
+  else if (info_mode == INFO_MODE_STORY)
+    DrawInfoScreen_Generic();
   else
     DrawInfoScreen_Main();
 }
@@ -4567,7 +4580,7 @@ boolean ShowInfoScreen_FromInitGame(void)
 
   levelset.level_story_shown[level_nr] = TRUE;
 
-  DrawInfoScreen_FromInitGame(INFO_MODE_LEVEL);
+  DrawInfoScreen_FromInitGame(INFO_MODE_STORY);
 
   return TRUE;
 }
@@ -4578,7 +4591,8 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
   if (button == MB_MENU_CONTINUE && (info_mode != INFO_MODE_CREDITS &&
                                      info_mode != INFO_MODE_PROGRAM &&
                                      info_mode != INFO_MODE_LEVELSET &&
-                                     info_mode != INFO_MODE_LEVEL))
+                                     info_mode != INFO_MODE_LEVEL &&
+                                     info_mode != INFO_MODE_STORY))
     button = MB_MENU_CHOICE;
 
   if (info_mode == INFO_MODE_TITLE)
@@ -4597,6 +4611,8 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
     HandleInfoScreen_Generic(mx, my, dx, dy, button);
   else if (info_mode == INFO_MODE_LEVEL)
     HandleInfoScreen_Generic(mx, my, dx, dy, button);
+  else if (info_mode == INFO_MODE_STORY)
+    HandleInfoScreen_Generic(mx, my, dx, dy, button);
   else
     HandleInfoScreen_Main(mx, my, dx, dy, button);
 }