Merge pull request #1549 from zsilencer/bugfixes

fix #1002
This commit is contained in:
Ted John 2015-07-05 16:07:01 +01:00
commit c0220df0ac
25 changed files with 91 additions and 77 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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));
}
/**

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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) |

View File

@ -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);

View File

@ -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,

View File

@ -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);
}

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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];

View File

@ -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,