Skip to content

Commit f6588f8

Browse files
authored
allow repositioning the mainhall version strings (scp-fs2open#7257)
1 parent 21a3c80 commit f6588f8

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

code/menuui/mainhallmenu.cpp

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,9 +1804,20 @@ void main_hall_blit_version()
18041804
// get the length of the string
18051805
gr_get_string_size(&w, &h, version_string.c_str());
18061806

1807-
// print the string near the lower left corner
1807+
int version_x = Main_hall->fso_version_coords[0];
1808+
int version_y = Main_hall->fso_version_coords[1];
1809+
1810+
if (version_x < 0) {
1811+
version_x = 5;
1812+
}
1813+
1814+
if (version_y < 0) {
1815+
version_y = gr_screen.max_h_unscaled_zoomed - (h * 2 + 6);
1816+
}
1817+
1818+
// print the string near the lower left corner by default
18081819
gr_set_color_fast(&Color_bright_white);
1809-
gr_string(5, gr_screen.max_h_unscaled_zoomed - (h * 2 + 6), version_string.c_str(), GR_RESIZE_MENU_ZOOMED);
1820+
gr_string(version_x, version_y, version_string.c_str(), GR_RESIZE_MENU_ZOOMED);
18101821

18111822
font::set_font(old_font);
18121823
}
@@ -1837,9 +1848,20 @@ void main_hall_blit_mod()
18371848
// get the length of the string
18381849
gr_get_string_size(&w, &h, mod_string.c_str());
18391850

1840-
// print the string near the lower left corner
1851+
int mod_title_x = Main_hall->mod_title_coords[0];
1852+
int mod_title_y = Main_hall->mod_title_coords[1];
1853+
1854+
if (mod_title_x < 0) {
1855+
mod_title_x = 5;
1856+
}
1857+
1858+
if (mod_title_y < 0) {
1859+
mod_title_y = gr_screen.max_h_unscaled_zoomed - (h * 3 + 6);
1860+
}
1861+
1862+
// print the string near the lower left corner by default
18411863
gr_set_color_fast(&Color_bright_white);
1842-
gr_string(5, gr_screen.max_h_unscaled_zoomed - (h * 3 + 6), mod_string.c_str(), GR_RESIZE_MENU_ZOOMED);
1864+
gr_string(mod_title_x, mod_title_y, mod_string.c_str(), GR_RESIZE_MENU_ZOOMED);
18431865

18441866
font::set_font(old_font);
18451867
}
@@ -2482,6 +2504,16 @@ void parse_one_main_hall(bool replace, int num_resolutions, int &hall_idx, int &
24822504
stuff_boolean(&m->render_version);
24832505
}
24842506

2507+
if (optional_string("+Mod Title Position:")) {
2508+
stuff_int(&m->mod_title_coords[0]);
2509+
stuff_int(&m->mod_title_coords[1]);
2510+
}
2511+
2512+
if (optional_string("+FSO Version Position:")) {
2513+
stuff_int(&m->fso_version_coords[0]);
2514+
stuff_int(&m->fso_version_coords[1]);
2515+
}
2516+
24852517
// ambient sound
24862518
bool ambient_found = parse_iface_sound("+Ambient Sound:", &m->ambient_sound);
24872519
if (!ambient_found && first_time && main_hall_is_retail_vasudan(m))

code/menuui/mainhallmenu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class main_hall_defines
7777

7878
bool render_title = true;
7979
bool render_version = true;
80+
int mod_title_coords[2] = {-1, -1};
81+
int fso_version_coords[2] = {-1, -1};
8082

8183
interface_snd_id ambient_sound = InterfaceSounds::MAIN_HALL_AMBIENT;
8284

0 commit comments

Comments
 (0)