From: Holger Schemel Date: Thu, 6 Nov 2014 14:51:14 +0000 (+0100) Subject: fixed layout for 'level set info' to support custom playfield size X-Git-Tag: 4.0.0.0-rc1~317 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8cc68926ca9cff638248abcc38372983bb663cfc;p=rocksndiamonds.git fixed layout for 'level set info' to support custom playfield size --- diff --git a/ChangeLog b/ChangeLog index 96408bca..9f949af9 100644 --- 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 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index a505fbf1..58bb898c 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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" }, diff --git a/src/conftime.h b/src/conftime.h index eabe26b1..6eb8ff89 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-11-02 01:32" +#define COMPILE_DATE_STRING "2014-11-06 15:30" diff --git a/src/screens.c b/src/screens.c index ca4e669a..cf81e97d 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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); }