Crew screen tweaks for custom levels.

See #1226 for a full overview with comparison images.
This commit is contained in:
mothbeanie 2025-04-12 13:41:30 -07:00 committed by GitHub
parent d419c6ed5b
commit b0d53e85a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 40 additions and 30 deletions

View file

@ -425,22 +425,23 @@ void Graphics::print_level_creator(
int width_for_face = 17; int width_for_face = 17;
int total_width = width_for_face + font::len(print_flags, creator.c_str()); int total_width = width_for_face + font::len(print_flags, creator.c_str());
int face_x, text_x, sprite_x; int face_x, text_x, sprite_x;
int offset_x = -7;
if (!font::is_rtl(print_flags)) if (!font::is_rtl(print_flags))
{ {
face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2; face_x = (SCREEN_WIDTH_PIXELS - total_width) / 2;
text_x = face_x + width_for_face; text_x = face_x + width_for_face;
sprite_x = 7; sprite_x = 0;
} }
else else
{ {
face_x = (SCREEN_WIDTH_PIXELS + total_width) / 2; face_x = (SCREEN_WIDTH_PIXELS + total_width) / 2;
text_x = face_x - width_for_face; text_x = face_x - width_for_face;
face_x -= 10; // sprite origin face_x -= 10; // sprite origin
sprite_x = 103; sprite_x = 96;
print_flags |= PR_RIGHT; print_flags |= PR_RIGHT;
} }
set_texture_color_mod(grphx.im_sprites, r, g, b); set_texture_color_mod(grphx.im_sprites, r, g, b);
draw_texture_part(grphx.im_sprites, face_x, y - 1, sprite_x, 2, 10, 10, 1, 1); draw_texture_part(grphx.im_sprites, face_x + offset_x, y - 3, sprite_x, 0, 24, 12, 1, 1);
set_texture_color_mod(grphx.im_sprites, 255, 255, 255); set_texture_color_mod(grphx.im_sprites, 255, 255, 255);
font::print(print_flags, text_x, y, creator, r, g, b); font::print(print_flags, text_x, y, creator, r, g, b);
} }

View file

@ -3102,26 +3102,30 @@ void maprender(void)
font::print(title_flags | PR_2X | PR_CEN, -1, FLIP(45, 8), meta.title, 196, 196, 255 - help.glow); font::print(title_flags | PR_2X | PR_CEN, -1, FLIP(45, 8), meta.title, 196, 196, 255 - help.glow);
int sp = SDL_max(10, font::height(PR_FONT_LEVEL)); int sp = SDL_max(10, font::height(PR_FONT_LEVEL));
int desc_pos = (cl.numcrewmates() > 0) ? 70 : 70 + (sp*2);
graphics.print_level_creator(creator_flags, FLIP(70, 8), meta.creator, 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, 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(desc_pos + 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); font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(desc_pos + sp*4, 8), meta.Desc2, 196, 196, 255 - help.glow);
if (sp <= 10) if (sp <= 10)
{ {
font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(70+sp*5, 8), meta.Desc3, 196, 196, 255 - help.glow); font::print(PR_FONT_LEVEL | PR_CEN, -1, FLIP(desc_pos + sp*5, 8), meta.Desc3, 196, 196, 255 - help.glow);
} }
int remaining = cl.numcrewmates() - game.crewmates(); if (cl.numcrewmates() > 0)
{
int remaining = cl.numcrewmates() - game.crewmates();
char buffer[SCREEN_WIDTH_CHARS + 1]; char buffer[SCREEN_WIDTH_CHARS + 1];
loc::gettext_plural_fill( loc::gettext_plural_fill(
buffer, sizeof(buffer), buffer, sizeof(buffer),
"{n_crew|wordy} crewmates remain", "{n_crew|wordy} crewmates remain",
"{n_crew|wordy} crewmate remains", "{n_crew|wordy} crewmate remains",
"n_crew:int", "n_crew:int",
remaining remaining
); );
font::print_wrap(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow); font::print_wrap(PR_CEN, -1, FLIP(165, 8), buffer, 196, 196, 255 - help.glow);
}
} }
else else
{ {
@ -3194,21 +3198,26 @@ void maprender(void)
} }
/* Stats. */ /* Stats. */
font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(52, 8), loc::gettext("[Trinkets found]"), 196, 196, 255 - help.glow); int deaths_pos = (cl.numtrinkets() > 0) ? 102 : 72;
char buffer[SCREEN_WIDTH_CHARS + 1]; int time_pos = (cl.numtrinkets() > 0) ? 152 : 132;
vformat_buf( if (cl.numtrinkets() > 0)
buffer, sizeof(buffer), {
loc::gettext("{n_trinkets|wordy} out of {max_trinkets|wordy}"), font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(52, 8), loc::gettext("[Trinkets found]"), 196, 196, 255 - help.glow);
"n_trinkets:int, max_trinkets:int", char buffer[SCREEN_WIDTH_CHARS + 1];
game.trinkets(), max_trinkets vformat_buf(
); buffer, sizeof(buffer),
font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(64, 8), buffer, 96, 96, 96); loc::gettext("{n_trinkets|wordy} out of {max_trinkets|wordy}"),
"n_trinkets:int, max_trinkets:int",
game.trinkets(), max_trinkets
);
font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(64, 8), buffer, 96, 96, 96);
}
font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(102, 8), loc::gettext("[Number of Deaths]"), 196, 196, 255 - help.glow); font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(deaths_pos, 8), loc::gettext("[Number of Deaths]"), 196, 196, 255 - help.glow);
font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(114, 8), help.String(game.deathcounts), 96, 96, 96); font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(deaths_pos + 12, 8), help.String(game.deathcounts), 96, 96, 96);
font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(152, 8), loc::gettext("[Time Taken]"), 196, 196, 255 - help.glow); font::print(PR_CEN | FLIP_PR_CJK_HIGH, -1, FLIP(time_pos, 8), loc::gettext("[Time Taken]"), 196, 196, 255 - help.glow);
font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(164, 8), game.timestring(), 96, 96, 96); font::print(PR_CEN | FLIP_PR_CJK_LOW, -1, FLIP(time_pos + 12, 8), game.timestring(), 96, 96, 96);
break; break;
} }
case 3: case 3: