mirror of https://github.com/OpenRCT2/OpenRCT2.git
use new create_window_centred function
This commit is contained in:
parent
06da706e1a
commit
66c302eb3d
|
@ -462,7 +462,7 @@ rct_window *window_create_centred(int width, int height, uint32 *event_handlers,
|
|||
int x, y;
|
||||
|
||||
x = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width) / 2;
|
||||
y = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height) / 2;
|
||||
y = max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height) / 2);
|
||||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ void window_about_open()
|
|||
if (window != NULL)
|
||||
return;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 200,
|
||||
max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 165),
|
||||
window = window_create_centred(
|
||||
400,
|
||||
330,
|
||||
(uint32*)window_about_events,
|
||||
|
|
|
@ -93,13 +93,7 @@ void window_ride_demolish_prompt_open(int rideIndex){
|
|||
if (w != NULL)
|
||||
return;
|
||||
|
||||
// Find center of the screen.
|
||||
int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
|
||||
int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
|
||||
int x = screen_width / 2 - WW / 2;
|
||||
int y = screen_height / 2 - WH / 2;
|
||||
|
||||
w = window_create(x, y, WW, WH, (uint32*)window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, 0);
|
||||
w = window_create_centred(WW, WH, (uint32*)window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, 0);
|
||||
w->widgets = window_ride_demolish_widgets;
|
||||
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_DEMOLISH);
|
||||
window_init_scroll_widgets(w);
|
||||
|
|
|
@ -415,9 +415,7 @@ void window_editor_inventions_list_open()
|
|||
|
||||
sub_685901();
|
||||
|
||||
w = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 600) / 2,
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 400) / 2),
|
||||
w = window_create_centred(
|
||||
600,
|
||||
400,
|
||||
(uint32*)window_editor_inventions_list_events,
|
||||
|
|
|
@ -207,9 +207,7 @@ void window_editor_object_selection_open()
|
|||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
window_editor_object_selection_select_default_objects();
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300,
|
||||
max(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200, 28),
|
||||
window = window_create_centred(
|
||||
600,
|
||||
400,
|
||||
(uint32*)window_editor_object_selection_events,
|
||||
|
|
|
@ -254,9 +254,7 @@ void window_editor_objective_options_open()
|
|||
if (w != NULL)
|
||||
return;
|
||||
|
||||
w = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 450) / 2,
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 228) / 2),
|
||||
w = window_create_centred(
|
||||
450,
|
||||
228,
|
||||
(uint32*)window_objective_options_main_events,
|
||||
|
|
|
@ -339,9 +339,7 @@ void window_editor_scenario_options_open()
|
|||
if (w != NULL)
|
||||
return;
|
||||
|
||||
w = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 280) / 2,
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 148) / 2),
|
||||
w = window_create_centred(
|
||||
280,
|
||||
148,
|
||||
window_editor_scenario_options_page_events[0],
|
||||
|
|
|
@ -264,9 +264,7 @@ rct_window *window_mapgen_open()
|
|||
|
||||
w = window_bring_to_front_by_class(WC_MAPGEN);
|
||||
if (w == NULL) {
|
||||
w = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 300) / 2,
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 200) / 2,
|
||||
w = window_create_centred(
|
||||
300,
|
||||
200,
|
||||
window_mapgen_page_events[0],
|
||||
|
|
|
@ -88,9 +88,7 @@ void window_music_credits_open()
|
|||
if (window != NULL)
|
||||
return;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 255,
|
||||
max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 157),
|
||||
window = window_create_centred(
|
||||
510,
|
||||
314,
|
||||
(uint32*)window_music_credits_events,
|
||||
|
|
|
@ -88,9 +88,7 @@ void window_publisher_credits_open()
|
|||
if (window != NULL)
|
||||
return;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 210,
|
||||
max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 192),
|
||||
window = window_create_centred(
|
||||
420,
|
||||
384,
|
||||
(uint32*)window_publisher_credits_events,
|
||||
|
|
|
@ -109,7 +109,7 @@ static void* window_save_prompt_events[] = {
|
|||
*/
|
||||
void window_save_prompt_open()
|
||||
{
|
||||
int stringId, x, y;
|
||||
int stringId, width, height;
|
||||
rct_window* window;
|
||||
unsigned short prompt_mode;
|
||||
rct_widget *widgets;
|
||||
|
@ -135,8 +135,8 @@ void window_save_prompt_open()
|
|||
(1 << WQIDX_CLOSE) |
|
||||
(1 << WQIDX_OK) |
|
||||
(1 << WQIDX_CANCEL);
|
||||
x = 177;
|
||||
y = 34;
|
||||
width = 177;
|
||||
height = 34;
|
||||
} else {
|
||||
widgets = window_save_prompt_widgets;
|
||||
enabled_widgets =
|
||||
|
@ -144,19 +144,17 @@ void window_save_prompt_open()
|
|||
(1 << WIDX_SAVE) |
|
||||
(1 << WIDX_DONT_SAVE) |
|
||||
(1 << WIDX_CANCEL);
|
||||
x = 260;
|
||||
y = 50;
|
||||
width = 260;
|
||||
height = 50;
|
||||
}
|
||||
|
||||
window = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - x / 2,
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - y / 2),
|
||||
x,
|
||||
y,
|
||||
(uint32*)window_save_prompt_events,
|
||||
WC_SAVE_PROMPT,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT
|
||||
);
|
||||
window = window_create_centred(
|
||||
width,
|
||||
height,
|
||||
(uint32*)window_save_prompt_events,
|
||||
WC_SAVE_PROMPT,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT
|
||||
);
|
||||
|
||||
window->widgets = widgets;
|
||||
window->enabled_widgets = enabled_widgets;
|
||||
|
|
|
@ -91,13 +91,7 @@ void window_staff_fire_prompt_open(rct_peep* peep){
|
|||
return;
|
||||
}
|
||||
|
||||
// Find center of the screen.
|
||||
int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
|
||||
int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
|
||||
int x = screen_width / 2 - WW / 2;
|
||||
int y = screen_height / 2 - WH / 2;
|
||||
|
||||
rct_window* w = window_create(x, y, WW, WH, (uint32*)0x992C3C, 0x1A, 0);
|
||||
rct_window* w = window_create_centred(WW, WH, (uint32*)0x992C3C, 0x1A, 0);
|
||||
w->widgets = window_staff_fire_widgets;
|
||||
w->enabled_widgets |= (1 << WIDX_CLOSE) | (1 << WIDX_YES) | (1 << WIDX_CANCEL);
|
||||
|
||||
|
|
|
@ -130,9 +130,7 @@ void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id t
|
|||
int height = no_lines * 10 + WH;
|
||||
|
||||
// Window will be in the center of the screen
|
||||
rct_window* w = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - WW / 2,
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - height / 2,
|
||||
rct_window* w = window_create_centred(
|
||||
WW,
|
||||
height,
|
||||
(uint32*)window_text_input_events,
|
||||
|
|
|
@ -111,9 +111,7 @@ void window_scenarioselect_open()
|
|||
// Load scenario list
|
||||
scenario_load_list();
|
||||
|
||||
window = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2) - 305,
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - 167),
|
||||
window = window_create_centred(
|
||||
610,
|
||||
334,
|
||||
(uint32*)window_scenarioselect_events,
|
||||
|
|
|
@ -150,9 +150,7 @@ void window_track_manage_open()
|
|||
|
||||
window_close_by_class(WC_MANAGE_TRACK_DESIGN);
|
||||
|
||||
w = window_create(
|
||||
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 250) / 2),
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 44) / 2,
|
||||
w = window_create_centred(
|
||||
250,
|
||||
44,
|
||||
(uint32*)window_track_manage_events,
|
||||
|
|
Loading…
Reference in New Issue