1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-24 13:38:29 +02:00

Replace "by" for level authors with happy face

"by {author}" is a string that will cause a lot of localization-related
problems, which then become much worse when different languages and
levels can also need different fonts:

- If the author name is set to something in English instead of a name,
  then it'll come out a bit weird if your VVVVVV is set to a different
  language: "de various people", "por various people", etc. It's the
  same problem with Discord bots completing "playing" or "watching" in
  their statuses.

- Translators can't always fit "by" in two letters, and level creators
  have understandably always assumed, and will continue to assume, that
  "by" is two letters. So if you have your VVVVVV set to a language that
  translates "by" as something long, then:
  | by Various People and Others |
  ...may suddenly show up as something like:
  |thorer Various People and Othe|

- "by" and author may need mutually incompatible fonts. For example, a
  Japanese level in a Korean VVVVVV needs to be displayed with "by" in
  Korean characters and the author name with Japanese characters, which
  would need some very special code since languages may want to add
  text both before and after the name.

- It's very possible that some languages can't translate "by" without
  knowing the gender of the name, and I know some languages even
  inflect names in really interesting ways (adding and even replacing
  letters in first names, surnames, and anything in between, depending
  on gender and what else is in the sentence).

So to solve all of this, the "by" is now replaced by a 10x10 face from
sprites.png, like a :viridian: emote. See it as a kind of avatar next
to a username, to clarify and assert that this line is for the author's
name. It should be a fairly obvious/recognizable icon, it fixes all the
above problems, and it's a bonus that we now have more happy faces in
VVVVVV.
This commit is contained in:
Dav999-v 2023-01-31 00:41:46 +01:00 committed by Misa Elizabeth Kai
parent ed7379c41b
commit d1f6c1adf2
9 changed files with 37 additions and 29 deletions

View File

@ -35,7 +35,6 @@
<string english="secret lab" translation="laboratori secret" explanation="menu option"/>
<string english="play modes" translation="modes de joc" explanation="menu option"/>
<string english="ERROR: No levels found." translation="ERROR: No sha trobat cap nivell." explanation="" max="38*3"/>
<string english="by {author}" translation="de {author}" explanation="{author}: author of custom level, appears in the custom levels list and editor"/>
<string english="ERROR: This level has no start point!" translation="ERROR: Aquest nivell no té|cap punt dinici!" explanation="" max="38*5"/>
<string english="ERROR" translation="ERROR" explanation="title" max="20"/>
<string english="WARNING" translation="ADVERTIMENT" explanation="title" max="20"/>

View File

@ -35,7 +35,6 @@
<string english="secret lab" translation="" explanation="menu option"/>
<string english="play modes" translation="" explanation="menu option"/>
<string english="ERROR: No levels found." translation="" explanation="" max="38*3"/>
<string english="by {author}" translation="" explanation="{author}: author of custom level, appears in the custom levels list and editor"/>
<string english="ERROR: This level has no start point!" translation="" explanation="" max="38*5"/>
<string english="ERROR" translation="" explanation="title" max="20"/>
<string english="WARNING" translation="" explanation="title" max="20"/>

View File

@ -35,7 +35,6 @@
<string english="secret lab" translation="sekreta labo" explanation="menu option"/>
<string english="play modes" translation="ludreĝimoj" explanation="menu option"/>
<string english="ERROR: No levels found." translation="ERARO: Neniuj niveloj troviĝis." explanation="" max="38*3"/>
<string english="by {author}" translation="de {author}" explanation="{author}: author of custom level, appears in the custom levels list and editor"/>
<string english="ERROR: This level has no start point!" translation="ERARO: Tiu ĉi nivelo havas neniun komencejon!" explanation="" max="38*5"/>
<string english="ERROR" translation="ERARO" explanation="title" max="20"/>
<string english="WARNING" translation="AVERTO" explanation="title" max="20"/>

View File

@ -35,7 +35,6 @@
<string english="secret lab" translation="laboratorio secreto" explanation="menu option"/>
<string english="play modes" translation="jugar modos" explanation="menu option"/>
<string english="ERROR: No levels found." translation="ERROR: No se encontraron niveles." explanation="" max="38*3"/>
<string english="by {author}" translation="Por {author}" explanation="{author}: author of custom level, appears in the custom levels list and editor"/>
<string english="ERROR: This level has no start point!" translation="ERROR: Este nivel no tiene punto de inicio" explanation="" max="38*5"/>
<string english="ERROR" translation="" explanation="title" max="20"/>
<string english="WARNING" translation="" explanation="title" max="20"/>

View File

@ -35,7 +35,6 @@
<string english="secret lab" translation="geheim lab" explanation="menu option"/>
<string english="play modes" translation="spelmodi" explanation="menu option"/>
<string english="ERROR: No levels found." translation="FOUT: Geen levels gevonden." explanation="" max="38*3"/>
<string english="by {author}" translation="door {author}" explanation="{author}: author of custom level, appears in the custom levels list and editor"/>
<string english="ERROR: This level has no start point!" translation="FOUT: Dit level heeft geen startpunt!" explanation="" max="38*5"/>
<string english="ERROR" translation="FOUT" explanation="title" max="20"/>
<string english="WARNING" translation="WAARSCHUWING" explanation="title" max="20"/>

View File

@ -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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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",