diff --git a/desktop_version/lang/ca/strings.xml b/desktop_version/lang/ca/strings.xml index ae9df606..d3ad13b9 100644 --- a/desktop_version/lang/ca/strings.xml +++ b/desktop_version/lang/ca/strings.xml @@ -35,7 +35,6 @@ - diff --git a/desktop_version/lang/en/strings.xml b/desktop_version/lang/en/strings.xml index 6e2611f0..546d4770 100644 --- a/desktop_version/lang/en/strings.xml +++ b/desktop_version/lang/en/strings.xml @@ -35,7 +35,6 @@ - diff --git a/desktop_version/lang/eo/strings.xml b/desktop_version/lang/eo/strings.xml index 81f0e0d8..9cf3e318 100644 --- a/desktop_version/lang/eo/strings.xml +++ b/desktop_version/lang/eo/strings.xml @@ -35,7 +35,6 @@ - diff --git a/desktop_version/lang/es/strings.xml b/desktop_version/lang/es/strings.xml index e5806044..0d98ae0d 100644 --- a/desktop_version/lang/es/strings.xml +++ b/desktop_version/lang/es/strings.xml @@ -35,7 +35,6 @@ - diff --git a/desktop_version/lang/nl/strings.xml b/desktop_version/lang/nl/strings.xml index f4e6891b..ce4337fa 100644 --- a/desktop_version/lang/nl/strings.xml +++ b/desktop_version/lang/nl/strings.xml @@ -35,7 +35,6 @@ - diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index fe3c2dba..4bd700c5 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -360,15 +360,8 @@ static void editormenurender(int tr, int tg, int tb) { creator = translate_creator(cl.creator, &creator_is_gettext); } - char creatorline[SCREEN_WIDTH_CHARS + 1]; - vformat_buf( - creatorline, sizeof(creatorline), - loc::gettext("by {author}"), - "author:str", - creator.c_str() - ); int sp = SDL_max(10, font::height(PR_FONT_LEVEL)); - font::print(PR_CEN | (creator_is_gettext ? PR_FONT_INTERFACE : PR_FONT_LEVEL), -1, 60, creatorline, tr, tg, tb); + graphics.print_level_creator((creator_is_gettext ? PR_FONT_INTERFACE : PR_FONT_LEVEL), 60, creator, tr, tg, tb); if(ed.websitemod) { diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 7a9b80ca..f896d96f 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -444,6 +444,30 @@ void Graphics::printcrewnamestatus( int x, int y, int t, bool rescued ) font::print(0, x, y, status_text, r, g, b); } +void Graphics::print_level_creator( + const uint32_t print_flags, + const int y, + const std::string& creator, + const uint8_t r, + const uint8_t g, + const uint8_t b +) { + /* We now display a face instead of "by {author}" for several reasons: + * - "by" may be in a different language than the author and look weird ("por various people") + * - "by" will be longer in different languages and break the limit that levels assume + * - "by" and author may need mutually incompatible fonts, e.g. Japanese level in Korean VVVVVV + * - avoids likely grammar problems: male/female difference, name inflection in user-written text... + * - it makes sense to make it a face + * - if anyone is sad about this decision, the happy face will cheer them up anyway :D */ + int width_for_face = 17; + int total_width = width_for_face + font::len(print_flags, creator); + int face_x = (SCREEN_WIDTH_PIXELS-total_width)/2; + set_texture_color_mod(grphx.im_sprites, r, g, b); + draw_texture_part(grphx.im_sprites, face_x, y-1, 7, 2, 10, 10, 1, 1); + set_texture_color_mod(grphx.im_sprites, 255, 255, 255); + font::print(print_flags, face_x+width_for_face, y, creator, r, g, b); +} + int Graphics::set_render_target(SDL_Texture* texture) { const int result = SDL_SetRenderTarget(gameScreen.m_renderer, texture); diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index 45ff7ad9..0725fe97 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -167,6 +167,15 @@ public: void printcrewnamestatus(int x, int y, int t, bool rescued); + void print_level_creator( + uint32_t print_flags, + int y, + const std::string& creator, + uint8_t r, + uint8_t g, + uint8_t b + ); + int set_render_target(SDL_Texture* texture); int set_texture_color_mod(SDL_Texture* texture, Uint8 r, Uint8 g, Uint8 b); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 0752c541..373d5d76 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -207,15 +207,8 @@ static void menurender(void) uint32_t creator_flags = cl.ListOfMetaData[tmp].creator_is_gettext ? PR_FONT_INTERFACE : level_flags; font::print(title_flags | PR_2X | PR_CEN, -1, 15, cl.ListOfMetaData[tmp].title, tr, tg, tb); - char creatorline[SCREEN_WIDTH_CHARS + 1]; - vformat_buf( - creatorline, sizeof(creatorline), - loc::gettext("by {author}"), - "author:str", - cl.ListOfMetaData[tmp].creator.c_str() - ); int sp = SDL_max(10, font::height(level_flags)); - font::print(creator_flags | PR_CEN, -1, 40, creatorline, tr, tg, tb); + graphics.print_level_creator(creator_flags, 40, cl.ListOfMetaData[tmp].creator, tr, tg, tb); font::print(level_flags | PR_CEN, -1, 40+sp, cl.ListOfMetaData[tmp].website, tr, tg, tb); font::print(level_flags | PR_CEN, -1, 40+sp*3, cl.ListOfMetaData[tmp].Desc1, tr, tg, tb); font::print(level_flags | PR_CEN, -1, 40+sp*4, cl.ListOfMetaData[tmp].Desc2, tr, tg, tb); @@ -2604,15 +2597,8 @@ void maprender(void) uint32_t creator_flags = meta.creator_is_gettext ? PR_FONT_INTERFACE : PR_FONT_LEVEL; font::print(title_flags | PR_2X | PR_CEN, -1, FLIP(45, 8), meta.title, 196, 196, 255 - help.glow); - char buffer[SCREEN_WIDTH_CHARS + 1]; - vformat_buf( - buffer, sizeof(buffer), - loc::gettext("by {author}"), - "author:str", - meta.creator.c_str() - ); int sp = SDL_max(10, font::height(PR_FONT_LEVEL)); - font::print(creator_flags | PR_CEN, -1, FLIP(70, 8), buffer, 196, 196, 255 - help.glow); + graphics.print_level_creator(creator_flags, FLIP(70, 8), meta.creator, 196, 196, 255 - help.glow); font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp, 8), meta.website, 196, 196, 255 - help.glow); font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*3, 8), meta.Desc1, 196, 196, 255 - help.glow); font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*4, 8), meta.Desc2, 196, 196, 255 - help.glow); @@ -2623,6 +2609,7 @@ void maprender(void) int remaining = cl.numcrewmates() - game.crewmates(); + char buffer[SCREEN_WIDTH_CHARS + 1]; loc::gettext_plural_fill( buffer, sizeof(buffer), "{n_crew|wordy} crewmates remain",