diff --git a/src/addresses.h b/src/addresses.h index 309ea273fa..3719994eea 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -47,7 +47,6 @@ // translate between scroll positions for drawing #define RCT2_ADDRESS_SCROLLING_MODE_POSITIONS 0x00992FB8 -#define RCT2_ADDRESS_LAND_TOOL_SIZE 0x009A9800 #define RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS 0x009A9804 #define RCT2_ADDRESS_MAP_TOOLTIP_ARGS 0x009A9808 @@ -537,6 +536,7 @@ #define RCT2_ADDRESS_X_END_POINT_GLOBAL 0x9ABDA8 //sint16 #define RCT2_ADDRESS_X_START_POINT_GLOBAL 0xEDF80C //sint16 #define RCT2_ADDRESS_DPI_LINE_LENGTH_GLOBAL 0x9ABDB0 //uint16 width+pitch +#define RCT2_ADDRESS_LAND_TOOL_SIZE 0x009A9800 #define RCT2_ADDRESS_SAVE_PROMPT_MODE 0x009A9802 #define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS 0x009AA00D #define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG 0x009AB4C6 diff --git a/src/windows/clear_scenery.c b/src/windows/clear_scenery.c index 3cbd3d3d55..cfea515a34 100644 --- a/src/windows/clear_scenery.c +++ b/src/windows/clear_scenery.c @@ -145,14 +145,14 @@ static void window_clear_scenery_mouseup(rct_window *w, int widgetIndex) break; case WIDX_DECREMENT: // Decrement land tool size, if it stays within the limit - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE,RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Increment land tool size, if it stays within the limit - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = min(MAXIMUM_TOOL_SIZE,RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); // Invalidate the window window_invalidate(w); @@ -187,7 +187,7 @@ static void window_clear_scenery_textinput(rct_window *w, int widgetIndex, char if (*end == '\0') { size=max(MINIMUM_TOOL_SIZE,size); size=min(MAXIMUM_TOOL_SIZE,size); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = size; + gLandToolSize = size; window_invalidate(w); } } @@ -225,8 +225,8 @@ static void window_clear_scenery_invalidate(rct_window *w) (gClearFootpath ? (1 << WIDX_FOOTPATH) : 0); // Update the preview image (for tool sizes up to 7) - window_clear_scenery_widgets[WIDX_PREVIEW].image = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) <= 7 ? - SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) : 0xFFFFFFFF; + window_clear_scenery_widgets[WIDX_PREVIEW].image = gLandToolSize <= 7 ? + SPR_LAND_TOOL_SIZE_0 + gLandToolSize : 0xFFFFFFFF; } /** @@ -242,8 +242,8 @@ static void window_clear_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi) // Draw number for tool sizes bigger than 7 x = w->x + (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2; y = w->y + (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2; - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { - gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + if (gLandToolSize > 7) { + gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &gLandToolSize); } // Draw cost amount diff --git a/src/windows/land.c b/src/windows/land.c index 8b6597cfa2..6eab51ef51 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -180,14 +180,14 @@ static void window_land_mouseup(rct_window *w, int widgetIndex) break; case WIDX_DECREMENT: // Decrement land tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Increment land tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = min(MAXIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); // Invalidate the window window_invalidate(w); @@ -315,7 +315,7 @@ static void window_land_textinput(rct_window *w, int widgetIndex, char *text) if (*end == '\0') { size = max(MINIMUM_TOOL_SIZE,size); size = min(MAXIMUM_TOOL_SIZE,size); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = size; + gLandToolSize = size; window_invalidate(w); } @@ -359,8 +359,8 @@ static void window_land_invalidate(rct_window *w) window_land_widgets[WIDX_FLOOR].image = SPR_FLOOR_TEXTURE_GRASS + _selectedFloorTexture; window_land_widgets[WIDX_WALL].image = SPR_WALL_TEXTURE_ROCK + _selectedWallTexture; // Update the preview image (for tool sizes up to 7) - window_land_widgets[WIDX_PREVIEW].image = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) <= 7 ? - SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) : + window_land_widgets[WIDX_PREVIEW].image = gLandToolSize <= 7 ? + SPR_LAND_TOOL_SIZE_0 + gLandToolSize : 0xFFFFFFFF; } @@ -377,10 +377,10 @@ static void window_land_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { + if (gLandToolSize > 7) { x = w->x + (previewWidget->left + previewWidget->right) / 2; y = w->y + (previewWidget->top + previewWidget->bottom) / 2; - gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &gLandToolSize); } else if (gLandMountainMode) { x = w->x + previewWidget->left; y = w->y + previewWidget->top; @@ -401,7 +401,7 @@ static void window_land_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 50; // Draw paint price - numTiles = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) * RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + numTiles = gLandToolSize * gLandToolSize; price = 0; if (gLandToolTerrainSurface != 255) price += numTiles * land_pricing[gLandToolTerrainSurface]; diff --git a/src/windows/land_rights.c b/src/windows/land_rights.c index f6ecd1042e..55d4fa0eae 100644 --- a/src/windows/land_rights.c +++ b/src/windows/land_rights.c @@ -135,14 +135,14 @@ static void window_land_rights_mouseup(rct_window *w, int widgetIndex) break; case WIDX_DECREMENT: // Decrement land rights tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Decrement land rights tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = min(MAXIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); // Invalidate the window window_invalidate(w); @@ -181,7 +181,7 @@ static void window_land_rights_textinput(rct_window *w, int widgetIndex, char *t if (*end == '\0') { size = max(MINIMUM_TOOL_SIZE,size); size = min(MAXIMUM_TOOL_SIZE,size); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = size; + gLandToolSize = size; window_invalidate(w); } } @@ -209,8 +209,8 @@ static void window_land_rights_invalidate(rct_window *w) w->pressed_widgets &= ~(1 << (!LandRightsMode ? WIDX_BUY_LAND_RIGHTS : WIDX_BUY_CONSTRUCTION_RIGHTS)); // Update the preview image - window_land_rights_widgets[WIDX_PREVIEW].image = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) <= 7 ? - SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) : + window_land_rights_widgets[WIDX_PREVIEW].image = gLandToolSize <= 7 ? + SPR_LAND_TOOL_SIZE_0 + gLandToolSize : 0xFFFFFFFF; } @@ -223,8 +223,8 @@ static void window_land_rights_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { - gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + if (gLandToolSize > 7) { + gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &gLandToolSize); } y = w->y + window_land_rights_widgets[WIDX_PREVIEW].bottom + 5; diff --git a/src/windows/map.c b/src/windows/map.c index 5ef04a4be6..0c393ad3ed 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -231,7 +231,7 @@ void window_map_open() window_map_center_on_view_point(); // Reset land tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + gLandToolSize = 1; } /** @@ -264,7 +264,7 @@ static void window_map_mouseup(rct_window *w, int widgetIndex) break; RCT2_GLOBAL(0xF1AD61, sint8) = 2; // Prevent mountain tool tool size. - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize); show_gridlines(); show_land_rights(); show_construction_rights(); @@ -303,13 +303,13 @@ static void window_map_mouseup(rct_window *w, int widgetIndex) break; case WIDX_LAND_TOOL_SMALLER: // Decrement land ownership tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); window_invalidate(w); break; case WIDX_LAND_TOOL_LARGER: // Increment land ownership tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = min(MAXIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); window_invalidate(w); break; @@ -332,9 +332,9 @@ static void window_map_mouseup(rct_window *w, int widgetIndex) if (tool_set(w, widgetIndex, 2)) break; - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 0; + gLandToolSize = 0; if (gPeepSpawns[0].x != UINT16_MAX && RCT2_GLOBAL(0x13573F8, sint16) != -1) { - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + gLandToolSize = 1; } show_gridlines(); @@ -543,7 +543,7 @@ static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, in if (land_tool_is_active()) { // Set land terrain - int landToolSize = max(1, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16)); + int landToolSize = max(1, gLandToolSize); int size = (landToolSize * 32) - 32; int radius = (landToolSize * 16) - 16; mapX = (mapX - radius) & 0xFFE0; @@ -570,7 +570,7 @@ static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, in ); } else if (widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS)) { // Set land rights - int landToolSize = max(1, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16)); + int landToolSize = max(1, gLandToolSize); int size = (landToolSize * 32) - 32; int radius = (landToolSize * 16) - 16; mapX = (mapX - radius) & 0xFFE0; @@ -611,7 +611,7 @@ static void window_map_textinput(rct_window *w, int widgetIndex, char *text) size = strtol(text, &end, 10); if (*end == '\0') { size = clamp(MINIMUM_TOOL_SIZE, size, MAXIMUM_TOOL_SIZE); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = size; + gLandToolSize = size; window_invalidate(w); } break; @@ -767,8 +767,8 @@ static void window_map_invalidate(rct_window *w) for (i = 0; i < 4; i++) w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].type = WWT_CHECKBOX; - w->widgets[WIDX_LAND_TOOL].image = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16) <= 7 ? - SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16) : + w->widgets[WIDX_LAND_TOOL].image = gLandToolSize <= 7 ? + SPR_LAND_TOOL_SIZE_0 + gLandToolSize : 0xFFFFFFFF; } } else { @@ -793,8 +793,8 @@ static void window_map_paint(rct_window *w, rct_drawpixelinfo *dpi) y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2; // Draw land tool size - if (widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS) && RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { - gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + if (widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS) && gLandToolSize > 7) { + gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &gLandToolSize); } y = w->y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; @@ -1139,7 +1139,7 @@ static void window_map_set_land_rights_tool_update(int x, int y) RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0); RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_TYPE, uint16) = 4; - int landToolSize = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16); + int landToolSize = gLandToolSize; if (landToolSize == 0) landToolSize = 1; @@ -1321,7 +1321,7 @@ static void window_map_set_peep_spawn_tool_down(int x, int y) mapZ = mapElement->base_height / 2; int peepSpawnIndex = 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16) != 1 && gPeepSpawns[0].x != 0xFFFF) + if (gLandToolSize != 1 && gPeepSpawns[0].x != 0xFFFF) peepSpawnIndex = 1; gPeepSpawns[peepSpawnIndex].x = mapX; @@ -1329,7 +1329,7 @@ static void window_map_set_peep_spawn_tool_down(int x, int y) gPeepSpawns[peepSpawnIndex].z = mapZ; gPeepSpawns[peepSpawnIndex].direction = direction; gfx_invalidate_screen(); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16) = peepSpawnIndex; + gLandToolSize = peepSpawnIndex; } /** diff --git a/src/windows/park.c b/src/windows/park.c index 8e990d8f0d..ea3bd885d4 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -757,7 +757,7 @@ void window_park_entrance_tool_update_land_rights(sint16 x, sint16 y){ state_changed++; } - sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + sint16 tool_size = gLandToolSize; if (tool_size == 0) tool_size = 1; @@ -1133,7 +1133,7 @@ void toggle_land_rights_window(rct_window *parkWindow, int widgetIndex) show_gridlines(); tool_set(parkWindow, widgetIndex, 2); gInputFlags |= INPUT_FLAG_6; - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + gLandToolSize = 1; window_land_rights_open(); } } diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index b8c01089c6..b559ad33bf 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -1684,7 +1684,7 @@ void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){ state_changed++; } - sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + sint16 tool_size = gLandToolSize; if (tool_size == 0) tool_size = 1; @@ -1763,7 +1763,7 @@ void top_toolbar_tool_update_land_paint(sint16 x, sint16 y){ state_changed++; } - sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + sint16 tool_size = gLandToolSize; if (tool_size == 0) tool_size = 1; @@ -1826,7 +1826,7 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){ return; } - sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + sint16 tool_size = gLandToolSize; rct_xy16 mapTile = { .x = x, .y = y }; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~(1 << 0); @@ -2044,7 +2044,7 @@ void top_toolbar_tool_update_water(sint16 x, sint16 y){ state_changed++; } - sint16 tool_size = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + sint16 tool_size = gLandToolSize; if (tool_size == 0) tool_size = 1; @@ -3147,7 +3147,7 @@ void toggle_land_window(rct_window *topToolbar, int widgetIndex) show_gridlines(); tool_set(topToolbar, widgetIndex, 18); gInputFlags |= INPUT_FLAG_6; - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + gLandToolSize = 1; window_land_open(); } } @@ -3164,7 +3164,7 @@ void toggle_clear_scenery_window(rct_window *topToolbar, int widgetIndex) show_gridlines(); tool_set(topToolbar, widgetIndex, 12); gInputFlags |= INPUT_FLAG_6; - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 2; + gLandToolSize = 2; window_clear_scenery_open(); } } @@ -3181,7 +3181,7 @@ void toggle_water_window(rct_window *topToolbar, int widgetIndex) show_gridlines(); tool_set(topToolbar, widgetIndex, 19); gInputFlags |= INPUT_FLAG_6; - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + gLandToolSize = 1; window_water_open(); } } diff --git a/src/windows/water.c b/src/windows/water.c index ad5a33ad14..4155c66023 100644 --- a/src/windows/water.c +++ b/src/windows/water.c @@ -143,14 +143,14 @@ static void window_water_mouseup(rct_window *w, int widgetIndex) break; case WIDX_DECREMENT: // Decrement land tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = max(MINIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Increment land tool size - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = min(MAXIMUM_TOOL_SIZE, RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); // Invalidate the window window_invalidate(w); @@ -173,7 +173,7 @@ static void window_water_textinput(rct_window *w, int widgetIndex, char *text) if (*end == '\0') { size = max(MINIMUM_TOOL_SIZE,size); size = min(MAXIMUM_TOOL_SIZE,size); - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = size; + gLandToolSize = size; window_invalidate(w); } @@ -209,10 +209,10 @@ static void window_water_invalidate(rct_window *w) w->pressed_widgets |= (1 << WIDX_PREVIEW); // Update the preview image - //window_water_widgets[WIDX_PREVIEW].image = SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + //window_water_widgets[WIDX_PREVIEW].image = SPR_LAND_TOOL_SIZE_0 + gLandToolSize; - window_water_widgets[WIDX_PREVIEW].image = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) <= 7 ? - SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) : + window_water_widgets[WIDX_PREVIEW].image = gLandToolSize <= 7 ? + SPR_LAND_TOOL_SIZE_0 + gLandToolSize : 0xFFFFFFFF; } @@ -230,8 +230,8 @@ static void window_water_paint(rct_window *w, rct_drawpixelinfo *dpi) window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { - gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); + if (gLandToolSize > 7) { + gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &gLandToolSize); } y = w->y + window_water_widgets[WIDX_PREVIEW].bottom + 5; diff --git a/src/world/map.c b/src/world/map.c index 9ed46d323d..30d76cd956 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -70,6 +70,7 @@ bool gClearSmallScenery; bool gClearLargeScenery; bool gClearFootpath; +uint16 gLandToolSize; money32 gLandToolRaiseCost; money32 gLandToolLowerCost; uint8 gLandToolTerrainSurface; diff --git a/src/world/map.h b/src/world/map.h index f4f5e3a74e..7c534a9a16 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -295,6 +295,7 @@ extern bool gClearSmallScenery; extern bool gClearLargeScenery; extern bool gClearFootpath; +extern uint16 gLandToolSize; extern money32 gLandToolRaiseCost; extern money32 gLandToolLowerCost; extern uint8 gLandToolTerrainSurface;