fixed layout for 'level set info' to support custom playfield size
authorHolger Schemel <info@artsoft.org>
Thu, 6 Nov 2014 14:51:14 +0000 (15:51 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 6 Nov 2014 15:06:52 +0000 (16:06 +0100)
ChangeLog
src/conf_gfx.c
src/conftime.h
src/screens.c

index 96408bca0b424dea0487687d4bd78deccc664a2a..9f949af9c193913f00a1d79e41dfd5ee24abcb3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2014-11-06
+       * fixed layout for "level set info" to support custom playfield size
+
 2014-11-02
        * fixed bug with not updating default bitmap pointer for scaled images
        * fixed redraw/fade bugs when redefining the playfield size or position
index a505fbf180ac90b39795cac511f77f686ba62dde..58bb898c42219ac0a048447c53d247372e482349 100644 (file)
@@ -5726,10 +5726,10 @@ struct ConfigInfo image_config[] =
   { "titlemessage_5.post_delay",               ARG_DEFAULT             },
   { "titlemessage_5.auto_delay",               ARG_DEFAULT             },
 
-  { "readme.x",                                        "272"                   },
-  { "readme.y",                                        "150"                   },
-  { "readme.width",                            "480"                   },
-  { "readme.height",                           "364"                   },
+  { "readme.x",                                        "-1"                    },
+  { "readme.y",                                        "-1"                    },
+  { "readme.width",                            "-1"                    },
+  { "readme.height",                           "-1"                    },
   { "readme.chars",                            "-1"                    },
   { "readme.lines",                            "-1"                    },
   { "readme.align",                            "center"                },
index eabe26b16a19ef53def94e7c0ab4765ff95f6684..6eb8ff89341930b1149514d00de33e1b8f619e20 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2014-11-02 01:32"
+#define COMPILE_DATE_STRING "2014-11-06 15:30"
index ca4e669ac05707cb747a48ee70fbec41b331d5a8..cf81e97d68c673192c94612c863b327c70609482 100644 (file)
@@ -2090,7 +2090,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
   int ystart2 = mSY - SY + 150;
   int ybottom = mSY - SY + SYSIZE - 20;
 
-  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
+  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO);
 
   FadeOut(REDRAW_FIELD);
 
@@ -3017,6 +3017,42 @@ void DrawInfoScreen_LevelSet()
 {
   struct TitleMessageInfo *tmi = &readme;
   char *filename = getLevelSetInfoFilename();
+  char *title = "Level Set Information:";
+  int ystart1 = mSY - SY + 100;
+  int ystart2 = mSY - SY + 150;
+  int ybottom = mSY - SY + SYSIZE - 20;
+
+  if (filename == NULL)
+  {
+    DrawInfoScreen_NotAvailable(title, "No information for this level set.");
+
+    return;
+  }
+
+  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
+
+  FadeOut(REDRAW_FIELD);
+
+  ClearField();
+  DrawHeadline();
+
+  DrawTextSCentered(ystart1, FONT_TEXT_1, title);
+
+  /* if x position set to "-1", automatically determine by playfield width */
+  if (tmi->x == -1)
+    tmi->x = SXSIZE / 2;
+
+  /* if y position set to "-1", use static default value */
+  if (tmi->y == -1)
+    tmi->y = 150;
+
+  /* if width set to "-1", automatically determine by playfield width */
+  if (tmi->width == -1)
+    tmi->width = SXSIZE - 2 * TILEX;
+
+  /* if height set to "-1", automatically determine by playfield height */
+  if (tmi->height == -1)
+    tmi->height = SYSIZE - 20 - tmi->y - 10;
 
   /* if chars set to "-1", automatically determine by text and font width */
   if (tmi->chars == -1)
@@ -3030,25 +3066,12 @@ void DrawInfoScreen_LevelSet()
   else
     tmi->height = tmi->lines * getFontHeight(tmi->font);
 
-  SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
-
-  FadeOut(REDRAW_FIELD);
-
-  ClearField();
-  DrawHeadline();
-
-  DrawTextCentered(mSY + 100, FONT_TEXT_1, "Level Set Information:");
-
-  if (filename != NULL)
-    DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
-                filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
-                tmi->autowrap, tmi->centered, tmi->parse_comments);
-  else
-    DrawTextCentered(mSY + ALIGNED_TEXT_YPOS(tmi), FONT_TEXT_2,
-                    "No information for this level set.");
+  DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
+              filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
+              tmi->autowrap, tmi->centered, tmi->parse_comments);
 
-  DrawTextCentered(mSY + SYSIZE - 20, FONT_TEXT_4,
-                  "Press any key or button for info menu");
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
+                   "Press any key or button for info menu");
 
   FadeIn(REDRAW_FIELD);
 }