added limiting default number of game elements on info screen
authorHolger Schemel <info@artsoft.org>
Fri, 16 Dec 2022 17:55:12 +0000 (18:55 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 16 Dec 2022 17:55:12 +0000 (18:55 +0100)
src/screens.c

index 7c65db19170d22745c88cd15a2dd72b132867ddb..5fe48e3d68050d3670c67895a49d3ad2e848b2d5 100644 (file)
 #define MENU_SCREEN_INFO_YSIZE         (MENU_SCREEN_INFO_YBOTTOM -     \
                                         MENU_SCREEN_INFO_YSTART -      \
                                         TILEY / 2)
-#define MAX_INFO_ELEMENTS_ON_SCREEN    128
-#define STD_INFO_ELEMENTS_ON_SCREEN    (MENU_SCREEN_INFO_YSIZE /       \
+#define MAX_INFO_ELEMENTS_IN_ARRAY     128
+#define MAX_INFO_ELEMENTS_ON_SCREEN    (SYSIZE / TILEY)
+#define MAX_INFO_ELEMENTS              MIN(MAX_INFO_ELEMENTS_IN_ARRAY, \
+                                           MAX_INFO_ELEMENTS_ON_SCREEN)
+#define STD_INFO_ELEMENTS_ON_SCREEN    10
+#define DYN_INFO_ELEMENTS_ON_SCREEN    (MENU_SCREEN_INFO_YSIZE /       \
                                         MENU_SCREEN_INFO_YSTEP)
-#define NUM_INFO_ELEMENTS_FROM_CONF    \
+#define DEFAULT_INFO_ELEMENTS          MIN(STD_INFO_ELEMENTS_ON_SCREEN,\
+                                           DYN_INFO_ELEMENTS_ON_SCREEN)
+#define NUM_INFO_ELEMENTS_FROM_CONF                                    \
   (menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] > 0 ?            \
    menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] :                        \
-   MAX_MENU_ENTRIES_ON_SCREEN)
-#define NUM_INFO_ELEMENTS_ON_SCREEN    MIN(MIN(STD_INFO_ELEMENTS_ON_SCREEN, \
-                                                MAX_INFO_ELEMENTS_ON_SCREEN), \
-                                           NUM_INFO_ELEMENTS_FROM_CONF)
+   DEFAULT_INFO_ELEMENTS)
+#define NUM_INFO_ELEMENTS_ON_SCREEN    MIN(NUM_INFO_ELEMENTS_FROM_CONF,\
+                                           MAX_INFO_ELEMENTS)
 #define MAX_MENU_ENTRIES_ON_SCREEN     (SCR_FIELDY - MENU_SCREEN_START_YPOS)
 #define MAX_MENU_TEXT_LENGTH_BIG       13
 #define MAX_MENU_TEXT_LENGTH_MEDIUM    (MAX_MENU_TEXT_LENGTH_BIG * 2)
@@ -3012,8 +3017,8 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
 
 void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
 {
-  static int infoscreen_step[MAX_INFO_ELEMENTS_ON_SCREEN];
-  static int infoscreen_frame[MAX_INFO_ELEMENTS_ON_SCREEN];
+  static int infoscreen_step[MAX_INFO_ELEMENTS_IN_ARRAY];
+  static int infoscreen_frame[MAX_INFO_ELEMENTS_IN_ARRAY];
   int font_foot = MENU_INFO_FONT_FOOT;
   int xstart = mSX + MENU_SCREEN_INFO_SPACE_LEFT;
   int ystart = mSY + MENU_SCREEN_INFO_YSTART;