mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
refactor window flags
This commit is contained in:
14
src/window.c
14
src/window.c
@@ -109,7 +109,7 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
||||
if (RCT2_NEW_WINDOW == &(RCT2_FIRST_WINDOW[12])) {
|
||||
// Close least recently used window
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_NEW_WINDOW; w++)
|
||||
if (!(w->flags & (WF_0 | WF_1 | WF_9)))
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_9)))
|
||||
break;
|
||||
|
||||
window_close(w);
|
||||
@@ -118,16 +118,16 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
||||
w = RCT2_NEW_WINDOW;
|
||||
|
||||
// Flags
|
||||
if (flags & WF_0) {
|
||||
if (flags & WF_STICK_TO_BACK) {
|
||||
for (; w >= RCT2_FIRST_WINDOW + 1; w--) {
|
||||
if ((w - 1)->flags & WF_1)
|
||||
if ((w - 1)->flags & WF_STICK_TO_FRONT)
|
||||
continue;
|
||||
if ((w - 1)->flags & WF_0)
|
||||
if ((w - 1)->flags & WF_STICK_TO_BACK)
|
||||
break;
|
||||
}
|
||||
} else if (!(flags & WF_1)) {
|
||||
} else if (!(flags & WF_STICK_TO_FRONT)) {
|
||||
for (; w >= RCT2_FIRST_WINDOW + 1; w--) {
|
||||
if (!((w - 1)->flags & WF_1))
|
||||
if (!((w - 1)->flags & WF_STICK_TO_FRONT))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
||||
w->flags = flags;
|
||||
|
||||
// Play sound
|
||||
if (!(flags & (WF_0 | WF_1)))
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
sound_play_panned(40, x + (width / 2));
|
||||
|
||||
w->number = 0;
|
||||
|
||||
@@ -186,8 +186,8 @@ typedef enum {
|
||||
WF_DISABLE_VP_SCROLL = 1 << 9,
|
||||
*/
|
||||
|
||||
WF_0 = (1 << 0),
|
||||
WF_1 = (1 << 1),
|
||||
WF_STICK_TO_BACK = (1 << 0),
|
||||
WF_STICK_TO_FRONT = (1 << 1),
|
||||
WF_TRANSPARENT = (1 << 4),
|
||||
WF_5 = (1 << 5),
|
||||
WF_RESIZABLE = (1 << 8),
|
||||
|
||||
@@ -239,7 +239,7 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1,
|
||||
window_dropdown_events,
|
||||
WC_DROPDOWN,
|
||||
0x02
|
||||
WF_STICK_TO_FRONT
|
||||
);
|
||||
w->widgets = window_dropdown_widgets;
|
||||
if (colour & 0x80)
|
||||
|
||||
@@ -114,7 +114,13 @@ void window_game_bottom_toolbar_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 32, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 32, window_game_bottom_toolbar_events, WC_BOTTOM_TOOLBAR, 0x32);
|
||||
window = window_create(
|
||||
0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 32,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 32,
|
||||
window_game_bottom_toolbar_events,
|
||||
WC_BOTTOM_TOOLBAR,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
|
||||
);
|
||||
window->widgets = window_game_bottom_toolbar_widgets;
|
||||
window->enabled_widgets |=
|
||||
(1 << WIDX_LEFT_OUTSET) |
|
||||
|
||||
@@ -120,7 +120,13 @@ void window_game_top_toolbar_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(0, 0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28, window_game_top_toolbar_events, WC_TOP_TOOLBAR, 0x32);
|
||||
window = window_create(
|
||||
0, 0,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28,
|
||||
window_game_top_toolbar_events,
|
||||
WC_TOP_TOOLBAR,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
|
||||
);
|
||||
window->widgets = window_game_top_toolbar_widgets;
|
||||
window->enabled_widgets |= (1 | 2 | 4 | 8 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100 | 0x200 | 0x400 | 0x800 |
|
||||
0x1000 | 0x2000 | 0x4000 | 0x8000 | 0x10000 | 0x20000);
|
||||
|
||||
@@ -38,7 +38,13 @@ void window_main_open()
|
||||
|
||||
main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
|
||||
main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
|
||||
window = window_create(0, 0, window_main_widgets[0].right, window_main_widgets[0].bottom, 0x0097C0BC, WC_MAIN_WINDOW, 0x01);
|
||||
window = window_create(
|
||||
0, 0,
|
||||
window_main_widgets[0].right, window_main_widgets[0].bottom,
|
||||
0x0097C0BC,
|
||||
WC_MAIN_WINDOW,
|
||||
WF_STICK_TO_BACK
|
||||
);
|
||||
window->widgets = main_widgets;
|
||||
|
||||
// RCT2_CALLPROC_X(0x006EB009, window->x, window->y, 0x4000000, 0x0FFF0FFF, window, 0, 0);
|
||||
|
||||
@@ -38,9 +38,11 @@ void window_title_exit_open()
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 40,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 64,
|
||||
40, 64, 0x0097BEFC, WC_TITLE_EXIT, 0x02
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 40, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 64,
|
||||
40, 64,
|
||||
0x0097BEFC,
|
||||
WC_TITLE_EXIT,
|
||||
WF_STICK_TO_FRONT
|
||||
);
|
||||
window->widgets = window_title_exit_widgets;
|
||||
window->enabled_widgets |= 1;
|
||||
|
||||
@@ -44,7 +44,7 @@ void window_title_logo_open()
|
||||
packs++;
|
||||
|
||||
// Create the window
|
||||
window = window_create(0, 0, 200, 106 + (10 * packs), 0x0097BF6C, WC_TITLE_LOGO, 0x02);
|
||||
window = window_create(0, 0, 200, 106 + (10 * packs), 0x0097BF6C, WC_TITLE_LOGO, WF_STICK_TO_FRONT);
|
||||
window->widgets = 0x009A9658; // mouse move bug in original game, keep this address and no crash happens
|
||||
window_init_scroll_widgets(window);
|
||||
window->flags |= 16;
|
||||
|
||||
@@ -89,9 +89,11 @@ void window_title_menu_open()
|
||||
rct_window* window;
|
||||
|
||||
window = window_create(
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 328) / 2,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 142,
|
||||
328, 82, window_title_menu_events, WC_TITLE_MENU, 0x02
|
||||
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 328) / 2, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 142,
|
||||
328, 82,
|
||||
window_title_menu_events,
|
||||
WC_TITLE_MENU,
|
||||
WF_STICK_TO_FRONT
|
||||
);
|
||||
window->widgets = window_title_menu_widgets;
|
||||
window->enabled_widgets |= (8 | 4 | 2 | 1);
|
||||
|
||||
@@ -118,7 +118,7 @@ void window_scenarioselect_open()
|
||||
334,
|
||||
window_scenarioselect_events,
|
||||
WC_SCENARIO_SELECT,
|
||||
0x400 | 0x02
|
||||
WF_STICK_TO_FRONT | WF_10
|
||||
);
|
||||
window->widgets = window_scenarioselect_widgets;
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
|
||||
x = clamp(0, x - (width / 2), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width);
|
||||
y = clamp(22, y + 26, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height - 40);
|
||||
|
||||
w = window_create(x, y, width, height, window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_1);
|
||||
w = window_create(x, y, width, height, window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);
|
||||
w->widgets = window_tooltip_widgets;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) = 0;
|
||||
|
||||
Reference in New Issue
Block a user