diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index 1b912d26aa..65415885a6 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -31,7 +31,8 @@ int gLastDrawStringX; int gLastDrawStringY; -uint8 _screenDirtyBlocks[5120]; +uint8* _screenDirtyBlocks = NULL; +int _screenDirtyBlocksSize = 0; #define MAX_RAIN_PIXELS 0xFFFE uint32 rainPixels[MAX_RAIN_PIXELS]; @@ -251,11 +252,24 @@ void gfx_invalidate_tile_if_zoomed(int x, int y, int base_height, int clearance_ */ void gfx_invalidate_screen() { - int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); gfx_set_dirty_blocks(0, 0, width, height); } +uint8* gfx_get_dirty_blocks() +{ + int size = RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, uint32); + if (_screenDirtyBlocksSize != size) { + if (_screenDirtyBlocks) { + _screenDirtyBlocks = realloc(_screenDirtyBlocks, size); + } else { + _screenDirtyBlocks = malloc(size); + } + } + return _screenDirtyBlocks; +} + /** * * rct2: 0x006E732D @@ -267,12 +281,12 @@ void gfx_invalidate_screen() void gfx_set_dirty_blocks(int left, int top, int right, int bottom) { int x, y; - uint8 *screenDirtyBlocks = RCT2_ADDRESS(0x00EDE408, uint8); + uint8 *screenDirtyBlocks = gfx_get_dirty_blocks(); left = max(left, 0); top = max(top, 0); - right = min(right, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)); - bottom = min(bottom, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)); + right = min(right, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)); + bottom = min(bottom, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)); if (left >= right) return; @@ -289,7 +303,7 @@ void gfx_set_dirty_blocks(int left, int top, int right, int bottom) for (y = top; y <= bottom; y++) for (x = left; x <= right; x++) - screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) + x] = 0xFF; + screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) + x] = 0xFF; } /** @@ -298,24 +312,24 @@ void gfx_set_dirty_blocks(int left, int top, int right, int bottom) */ void gfx_draw_all_dirty_blocks() { - int x, y, xx, yy, columns, rows; - uint8 *screenDirtyBlocks = RCT2_ADDRESS(0x00EDE408, uint8); + unsigned int x, y, xx, yy, columns, rows; + uint8 *screenDirtyBlocks = gfx_get_dirty_blocks(); - for (x = 0; x < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32); x++) { - for (y = 0; y < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32); y++) { - if (screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) + x] == 0) + for (x = 0; x < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32); x++) { + for (y = 0; y < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, uint32); y++) { + if (screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) + x] == 0) continue; // Determine columns - for (xx = x; xx < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32); xx++) - if (screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) + xx] == 0) + for (xx = x; xx < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32); xx++) + if (screenDirtyBlocks[y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) + xx] == 0) break; columns = xx - x; // Check rows - for (yy = y; yy < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32); yy++) + for (yy = y; yy < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, uint32); yy++) for (xx = x; xx < x + columns; xx++) - if (screenDirtyBlocks[yy * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) + xx] == 0) + if (screenDirtyBlocks[yy * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) + xx] == 0) goto endRowCheck; endRowCheck: @@ -328,18 +342,18 @@ void gfx_draw_all_dirty_blocks() static void gfx_draw_dirty_blocks(int x, int y, int columns, int rows) { int left, top, right, bottom; - uint8 *screenDirtyBlocks = RCT2_ADDRESS(0x00EDE408, uint8); + uint8 *screenDirtyBlocks = gfx_get_dirty_blocks(); // Unset dirty blocks for (top = y; top < y + rows; top++) for (left = x; left < x + columns; left++) - screenDirtyBlocks[top * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) + left] = 0; + screenDirtyBlocks[top * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) + left] = 0; // Determine region in pixels - left = max(0, x * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, sint16)); - top = max(0, y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, sint16)); - right = min(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), left + (columns * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, sint16))); - bottom = min(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16), top + (rows * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, sint16))); + left = max(0, x * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, uint16)); + top = max(0, y * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, uint16)); + right = min(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), left + (columns * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, uint16))); + bottom = min(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16), top + (rows * RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, uint16))); if (right <= left || bottom <= top) return; diff --git a/src/input.c b/src/input.c index 56c1218d94..d967cd4002 100644 --- a/src/input.c +++ b/src/input.c @@ -128,8 +128,8 @@ void game_handle_input() game_handle_input_mouse(x, y, state); } else if (x != 0x80000000) { - x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 1); - y = clamp(0, y, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 1); + x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 1); + y = clamp(0, y, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 1); game_handle_input_mouse(x, y, state); process_mouse_over(x, y); diff --git a/src/interface/console.c b/src/interface/console.c index 27bccea426..4d9852e112 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -99,7 +99,7 @@ void console_update() _consoleLeft = 0; _consoleTop = 0; - _consoleRight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); + _consoleRight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); _consoleBottom = 322; if (gConsoleOpen) { diff --git a/src/interface/viewport.c b/src/interface/viewport.c index ae8fc30c5b..71d6c5206a 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -356,8 +356,8 @@ void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){ if (w->flags & WF_7){ int left = max(viewport->x, 0); int top = max(viewport->y, 0); - int right = min(viewport->x + viewport->width, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)); - int bottom = min(viewport->y + viewport->height, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)); + int right = min(viewport->x + viewport->width, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)); + int bottom = min(viewport->y + viewport->height, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)); if (left >= right) return; if (top >= bottom) return; @@ -376,7 +376,7 @@ void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){ viewport->x = 0; } - int eax = viewport->x + viewport->width - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); + int eax = viewport->x + viewport->width - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); if (eax > 0){ viewport->width -= eax; viewport->view_width -= eax * zoom; @@ -394,7 +394,7 @@ void sub_6E7DE1(sint16 x, sint16 y, rct_window* w, rct_viewport* viewport){ viewport->y = 0; } - eax = viewport->y + viewport->height - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + eax = viewport->y + viewport->height - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); if (eax > 0){ viewport->height -= eax; viewport->view_height -= eax * zoom; diff --git a/src/interface/window.c b/src/interface/window.c index f5a23c6a66..a80ffa2238 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -1202,7 +1202,7 @@ void window_push_others_below(rct_window *w1) continue; // Check if there is room to push it down - if (w1->y + w1->height + 80 >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)) + if (w1->y + w1->height + 80 >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)) continue; // Invalidate the window's current area diff --git a/src/intro.c b/src/intro.c index e5d9e09bef..c4ddd3b2b9 100644 --- a/src/intro.c +++ b/src/intro.c @@ -38,8 +38,8 @@ static int _tick_counter; ///< Used mainly for timing but also for Y coordina void intro_update() { rct_drawpixelinfo *screenDPI = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo); - int screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - int screenHeight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + int screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + int screenHeight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); uint8 (*part) = RCT2_ADDRESS(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8); screen_intro_process_mouse_input(); diff --git a/src/management/news_item.c b/src/management/news_item.c index 188f17ba6e..101fbe6732 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -100,7 +100,7 @@ void news_item_update_current() newsItems[0].ticks++; if (newsItems[0].ticks == 1 && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 1)) { // Play sound - sound_play_panned(SOUND_NEWS_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2, 0, 0, 0); + sound_play_panned(SOUND_NEWS_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2, 0, 0, 0); } // Removal of current news item diff --git a/src/platform/shared.c b/src/platform/shared.c index 529b7ce9cd..8531d0a897 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -175,8 +175,8 @@ void platform_get_closest_resolution(int inWidth, int inHeight, int *outWidth, i void platform_draw() { - int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); if (gConfigGeneral.hardware_display) { void *pixels; @@ -239,8 +239,8 @@ static void platform_resize(int width, int height) { uint32 flags; - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) = width; - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) = height; + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) = width; + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) = height; platform_refresh_video(); @@ -457,7 +457,7 @@ void platform_process_messages() // Zoom gesture const int tolerance = 128; - int gesturePixels = (int)(_gestureRadius * RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)); + int gesturePixels = (int)(_gestureRadius * RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)); if (gesturePixels > tolerance) { _gestureRadius = 0; keyboard_shortcut_handle_command(SHORTCUT_ZOOM_VIEW_IN); @@ -730,8 +730,8 @@ int platform_get_cursor_pos(int* x, int* y) void platform_refresh_video() { - int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, gConfigGeneral.minimize_fullscreen_focus_loss ? "1" : "0"); @@ -830,8 +830,8 @@ static void platform_refresh_screenbuffer(int width, int height, int pitch) RCT2_GLOBAL(0x009ABDF0, uint8) = 6; RCT2_GLOBAL(0x009ABDF1, uint8) = 3; RCT2_GLOBAL(0x009ABDF2, uint8) = 1; - RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, sint16) = 64; - RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, sint16) = 8; - RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) = (width >> 6) + 1; - RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1; + RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, uint16) = 64; + RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, uint16) = 8; + RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, uint32) = (width >> 6) + 1; + RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, uint32) = (height >> 3) + 1; } \ No newline at end of file diff --git a/src/title.c b/src/title.c index 11b819e756..ad472457df 100644 --- a/src/title.c +++ b/src/title.c @@ -151,7 +151,7 @@ static void title_create_windows() window_title_exit_open(); window_title_options_open(); window_title_logo_open(); - window_resize_gui(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)); + window_resize_gui(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)); } /** diff --git a/src/windows/clear_scenery.c b/src/windows/clear_scenery.c index 88b2c670c7..e7b5f1ffec 100644 --- a/src/windows/clear_scenery.c +++ b/src/windows/clear_scenery.c @@ -107,7 +107,7 @@ void window_clear_scenery_open() if (window_find_by_class(WC_CLEAR_SCENERY) != NULL) return; - window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 94, (uint32*)window_clear_scenery_events, WC_CLEAR_SCENERY, 0); + window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 98, 29, 98, 94, (uint32*)window_clear_scenery_events, WC_CLEAR_SCENERY, 0); window->widgets = window_clear_scenery_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT) | (1 << WIDX_PREVIEW) | (1 << WIDX_SMALL_SCENERY) | (1 << WIDX_LARGE_SCENERY) | (1 << WIDX_FOOTPATH); diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index f8581cf490..6671284dd0 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -154,10 +154,10 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo width = _dropdown_item_width * _dropdown_num_columns + 3; int height = _dropdown_item_height * _dropdown_num_rows + 3; - if (x + width > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)) - x = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - width); - if (y + height > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)) - y = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - height); + if (x + width > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)) + x = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width); + if (y + height > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)) + y = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height); window_dropdown_widgets[WIDX_BACKGROUND].bottom = _dropdown_item_height * num_items + 3; window_dropdown_widgets[WIDX_BACKGROUND].right = _dropdown_item_width + 3; @@ -233,10 +233,10 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl // Calculate position and size width = _dropdown_item_width * _dropdown_num_columns + 3; height = _dropdown_item_height * _dropdown_num_rows + 3; - if (x + width > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)) - x = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - width); - if (y + height > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16)) - y = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - height); + if (x + width > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)) + x = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width); + if (y + height > RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16)) + y = max(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height); window_dropdown_widgets[WIDX_BACKGROUND].right = width; window_dropdown_widgets[WIDX_BACKGROUND].bottom = height; diff --git a/src/windows/editor_bottom_toolbar.c b/src/windows/editor_bottom_toolbar.c index 6f235769bf..dfc63d52db 100644 --- a/src/windows/editor_bottom_toolbar.c +++ b/src/windows/editor_bottom_toolbar.c @@ -128,8 +128,8 @@ void window_editor_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 = window_create(0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 32, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), 32, (uint32*)window_editor_bottom_toolbar_events, WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5); window->widgets = window_editor_bottom_toolbar_widgets; @@ -384,7 +384,7 @@ void window_editor_bottom_toolbar_invalidate() { colour_scheme_update_by_class(w, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) ? WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR : WC_EDITOR_TRACK_BOTTOM_TOOLBAR); - sint16 screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); + uint16 screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200; window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1; window_editor_bottom_toolbar_widgets[WIDX_NEXT_STEP_BUTTON].left = screenWidth - 198; diff --git a/src/windows/editor_main.c b/src/windows/editor_main.c index a9635b4e47..8cd6b408e8 100644 --- a/src/windows/editor_main.c +++ b/src/windows/editor_main.c @@ -72,8 +72,8 @@ void window_editor_main_open() { rct_window* window; - window_editor_main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - window_editor_main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + window_editor_main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + window_editor_main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); window = window_create(0, 0, window_editor_main_widgets[0].right, window_editor_main_widgets[0].bottom, (uint32*)window_editor_main_events, WC_MAIN_WINDOW, WF_STICK_TO_BACK); window->widgets = window_editor_main_widgets; diff --git a/src/windows/error.c b/src/windows/error.c index 531c40d00e..c3779f4b3e 100644 --- a/src/windows/error.c +++ b/src/windows/error.c @@ -124,11 +124,11 @@ void window_error_open(rct_string_id title, rct_string_id message) window_error_widgets[WIDX_BACKGROUND].bottom = height; x = RCT2_GLOBAL(0x0142406C, sint32) - (width / 2); - x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)); + x = clamp(0, x, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)); y = RCT2_GLOBAL(0x01424070, sint32) + 26; y = max(22, y); - maxY = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - height; + maxY = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height; if (y > maxY) { y = y - height - 40; y = min(y, maxY); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index d86e41ff3c..51850976d5 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -131,8 +131,8 @@ 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, + 0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 32, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), 32, (uint32*)window_game_bottom_toolbar_events, WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5 @@ -259,7 +259,7 @@ static void window_game_bottom_toolbar_invalidate() colour_scheme_update(w); // Anchor the middle and right panel to the right - x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); + x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); w->width = x; x--; window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right = x; diff --git a/src/windows/land.c b/src/windows/land.c index 8d456e9ba9..02bcd0961b 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -127,7 +127,7 @@ void window_land_open() if (window_find_by_class(WC_LAND) != NULL) return; - window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, (uint32*)window_land_events, WC_LAND, 0); + window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 98, 29, 98, 126, (uint32*)window_land_events, WC_LAND, 0); window->widgets = window_land_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | diff --git a/src/windows/land_rights.c b/src/windows/land_rights.c index 9a81fc3cbb..a9bdad8db6 100644 --- a/src/windows/land_rights.c +++ b/src/windows/land_rights.c @@ -104,7 +104,7 @@ void window_land_rights_open() if (window_find_by_class(WC_LAND_RIGHTS) != NULL) return; - window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 94, (uint32*)window_land_rights_events, WC_LAND_RIGHTS, 0); + window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 98, 29, 98, 94, (uint32*)window_land_rights_events, WC_LAND_RIGHTS, 0); window->widgets = window_land_rights_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW) | (1 << WIDX_BUY_LAND_RIGHTS) | (1 << WIDX_BUY_CONSTRUCTION_RIGHTS); diff --git a/src/windows/main.c b/src/windows/main.c index f56303b4c6..cd9e3ace06 100644 --- a/src/windows/main.c +++ b/src/windows/main.c @@ -70,8 +70,8 @@ void window_main_open() { rct_window* window; - window_main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); - window_main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16); + window_main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16); + window_main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16); window = window_create( 0, 0, window_main_widgets[0].right, window_main_widgets[0].bottom, diff --git a/src/windows/park.c b/src/windows/park.c index c22e6c127c..3226d91786 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -1754,8 +1754,8 @@ void window_park_objective_open() window->hold_down_widgets = window_park_page_hold_down_widgets[WINDOW_PARK_PAGE_OBJECTIVE]; window->event_handlers = (uint32*)window_park_objective_events; window_init_scroll_widgets(window); - window->x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2 - 115; - window->y = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2 - 87; + window->x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 115; + window->y = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 87; window_invalidate(window); } diff --git a/src/windows/scenery.c b/src/windows/scenery.c index aa495fd77b..0e3a18c127 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -423,7 +423,7 @@ void window_scenery_open() init_scenery(); window = window_create( - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - WINDOW_SCENERY_WIDTH, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - WINDOW_SCENERY_WIDTH, 0x1D, WINDOW_SCENERY_WIDTH, WINDOW_SCENERY_HEIGHT, diff --git a/src/windows/title_exit.c b/src/windows/title_exit.c index 37ea4942fd..18ebb3d74f 100644 --- a/src/windows/title_exit.c +++ b/src/windows/title_exit.c @@ -77,7 +77,7 @@ 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, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 40, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 64, 40, 64, (uint32*)window_title_exit_events, WC_TITLE_EXIT, diff --git a/src/windows/title_menu.c b/src/windows/title_menu.c index fc65c97a2c..5ce6858c31 100644 --- a/src/windows/title_menu.c +++ b/src/windows/title_menu.c @@ -93,7 +93,7 @@ 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, + (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 328) / 2, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 142, 328, 82, (uint32*)window_title_menu_events, WC_TITLE_MENU, diff --git a/src/windows/title_options.c b/src/windows/title_options.c index 39be909cbd..ee4e22be77 100644 --- a/src/windows/title_options.c +++ b/src/windows/title_options.c @@ -75,7 +75,7 @@ void window_title_options_open() rct_window* window; window = window_create( - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 80, 0, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 80, 0, 80, 12, (uint32*)window_title_options_events, WC_TITLE_OPTIONS, diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index 25e21e990f..45dce4a486 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -241,7 +241,7 @@ void window_top_toolbar_open() window = window_create( 0, 0, - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16), 28, (uint32*)window_top_toolbar_events, WC_TOP_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5 @@ -618,7 +618,7 @@ static void window_top_toolbar_invalidate() // Align right hand side toolbar buttons firstAlignment = 1; - x = max(640, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16)); + x = max(640, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16)); for (int i = 0; i < countof(right_aligned_widgets_order); ++i) { widgetIndex = right_aligned_widgets_order[i]; widget = &window_top_toolbar_widgets[widgetIndex]; diff --git a/src/windows/water.c b/src/windows/water.c index ff74724149..33eb360ed9 100644 --- a/src/windows/water.c +++ b/src/windows/water.c @@ -101,7 +101,7 @@ void window_water_open() return; window = window_create( - RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 76, + RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 76, 29, 76, 77,