diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0db50943d1..29c39f73b2 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -6,6 +6,7 @@ - Fix: [#5768] Prevent loading non-existent title sequences. - Fix: [#5858] Crash when using custom ride with no colour presets. - Fix: [#5872] Incorrect OpenGL rendering of masked sprites +- Improved: The land tool buttons can now be held down to increase/decrease size. - Improved: [#5859] OpenGL rendering performance - Improved: [#5863] Switching drawing engines no longer requires the application to restart. diff --git a/src/openrct2/windows/clear_scenery.c b/src/openrct2/windows/clear_scenery.c index 46ba386c89..4a2ce6f8d4 100644 --- a/src/openrct2/windows/clear_scenery.c +++ b/src/openrct2/windows/clear_scenery.c @@ -54,6 +54,7 @@ rct_widget window_clear_scenery_widgets[] = { static void window_clear_scenery_close(rct_window *w); static void window_clear_scenery_mouseup(rct_window *w, rct_widgetindex widgetIndex); +static void window_clear_scenery_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget); static void window_clear_scenery_update(rct_window *w); static void window_clear_scenery_invalidate(rct_window *w); static void window_clear_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -64,7 +65,7 @@ static rct_window_event_list window_clear_scenery_events = { window_clear_scenery_close, window_clear_scenery_mouseup, NULL, - NULL, + window_clear_scenery_mousedown, NULL, NULL, window_clear_scenery_update, @@ -107,6 +108,7 @@ void window_clear_scenery_open() 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); + window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT); window_init_scroll_widgets(window); window_push_others_below(window); @@ -139,20 +141,6 @@ static void window_clear_scenery_mouseup(rct_window *w, rct_widgetindex widgetIn case WIDX_CLOSE: window_close(w); break; - case WIDX_DECREMENT: - // Decrement land tool size, if it stays within the limit - 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 - gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); - - // Invalidate the window - window_invalidate(w); - break; case WIDX_PREVIEW: window_clear_scenery_inputsize(w); break; @@ -171,6 +159,26 @@ static void window_clear_scenery_mouseup(rct_window *w, rct_widgetindex widgetIn } } +static void window_clear_scenery_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget) +{ + switch (widgetIndex) { + case WIDX_DECREMENT: + // Decrement land tool size, if it stays within the limit + 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 + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); + + // Invalidate the window + window_invalidate(w); + break; + } +} + static void window_clear_scenery_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { sint32 size; @@ -201,6 +209,7 @@ static void window_clear_scenery_inputsize(rct_window *w) */ static void window_clear_scenery_update(rct_window *w) { + w->frame_no++; // Close window if another tool is open if (!clear_scenery_tool_is_active()) window_close(w); diff --git a/src/openrct2/windows/land.c b/src/openrct2/windows/land.c index b3bbe9b23e..4f49a70da7 100644 --- a/src/openrct2/windows/land.c +++ b/src/openrct2/windows/land.c @@ -126,6 +126,7 @@ void window_land_open() (1 << WIDX_MOUNTAINMODE) | (1 << WIDX_PAINTMODE) | (1 << WIDX_PREVIEW); + window->hold_down_widgets = (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT); window_init_scroll_widgets(window); window_push_others_below(window); @@ -161,20 +162,6 @@ static void window_land_mouseup(rct_window *w, rct_widgetindex widgetIndex) case WIDX_CLOSE: window_close(w); break; - case WIDX_DECREMENT: - // Decrement land tool size - gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); - - // Invalidate the window - window_invalidate(w); - break; - case WIDX_INCREMENT: - // Increment land tool size - gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); - - // Invalidate the window - window_invalidate(w); - break; case WIDX_MOUNTAINMODE: gLandMountainMode ^= 1; gLandPaintMode = 0; @@ -207,6 +194,20 @@ static void window_land_mousedown(rct_window *w, rct_widgetindex widgetIndex, rc case WIDX_PREVIEW: window_land_inputsize(w); break; + case WIDX_DECREMENT: + // Decrement land tool size + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); + + // Invalidate the window + window_invalidate(w); + break; + case WIDX_INCREMENT: + // Increment land tool size + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); + + // Invalidate the window + window_invalidate(w); + break; } } diff --git a/src/openrct2/windows/land_rights.c b/src/openrct2/windows/land_rights.c index b8c8670560..078d1ff2c1 100644 --- a/src/openrct2/windows/land_rights.c +++ b/src/openrct2/windows/land_rights.c @@ -53,6 +53,7 @@ static rct_widget window_land_rights_widgets[] = { static void window_land_rights_close(rct_window *w); static void window_land_rights_mouseup(rct_window *w, rct_widgetindex widgetIndex); +static void window_land_rights_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget); static void window_land_rights_update(rct_window *w); static void window_land_rights_invalidate(rct_window *w); static void window_land_rights_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -69,7 +70,7 @@ static rct_window_event_list window_land_rights_events = { window_land_rights_close, window_land_rights_mouseup, NULL, - NULL, + window_land_rights_mousedown, NULL, NULL, window_land_rights_update, @@ -114,6 +115,7 @@ void window_land_rights_open() 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); + window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT); window_init_scroll_widgets(window); window_push_others_below(window); @@ -150,20 +152,6 @@ static void window_land_rights_mouseup(rct_window *w, rct_widgetindex widgetInde case WIDX_CLOSE: window_close(w); break; - case WIDX_DECREMENT: - // Decrement land rights tool size - gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); - - // Invalidate the window - window_invalidate(w); - break; - case WIDX_INCREMENT: - // Decrement land rights tool size - gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); - - // Invalidate the window - window_invalidate(w); - break; case WIDX_PREVIEW: window_land_rights_inputsize(w); break; @@ -190,6 +178,26 @@ static void window_land_rights_mouseup(rct_window *w, rct_widgetindex widgetInde } } +static void window_land_rights_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget) +{ + switch (widgetIndex) { + case WIDX_DECREMENT: + // Decrement land rights tool size + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); + + // Invalidate the window + window_invalidate(w); + break; + case WIDX_INCREMENT: + // Decrement land rights tool size + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); + + // Invalidate the window + window_invalidate(w); + break; + } +} + static void window_land_rights_textinput(rct_window *w, rct_widgetindex widgetIndex, char *text) { sint32 size; @@ -216,6 +224,7 @@ static void window_land_rights_inputsize(rct_window *w) static void window_land_rights_update(rct_window *w) { + w->frame_no++; // Close window if another tool is open if (!land_rights_tool_is_active()) window_close(w); diff --git a/src/openrct2/windows/map.c b/src/openrct2/windows/map.c index 335083c6c8..938778be10 100644 --- a/src/openrct2/windows/map.c +++ b/src/openrct2/windows/map.c @@ -242,7 +242,9 @@ void window_map_open() w->hold_down_widgets = (1 << WIDX_MAP_SIZE_SPINNER_UP) | - (1 << WIDX_MAP_SIZE_SPINNER_DOWN); + (1 << WIDX_MAP_SIZE_SPINNER_DOWN) | + (1 << WIDX_LAND_TOOL_LARGER) | + (1 << WIDX_LAND_TOOL_SMALLER); window_init_scroll_widgets(w); @@ -335,18 +337,6 @@ static void window_map_mouseup(rct_window *w, rct_widgetindex widgetIndex) if (_activeTool & 4) _activeTool &= 0xF4; - window_invalidate(w); - break; - case WIDX_LAND_TOOL_SMALLER: - // Decrement land ownership tool size - gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); - - window_invalidate(w); - break; - case WIDX_LAND_TOOL_LARGER: - // Increment land ownership tool size - gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); - window_invalidate(w); break; case WIDX_BUILD_PARK_ENTRANCE: @@ -419,6 +409,18 @@ static void window_map_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct case WIDX_MAP_SIZE_SPINNER_DOWN: map_window_decrease_map_size(); break; + case WIDX_LAND_TOOL_SMALLER: + // Decrement land ownership tool size + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); + + window_invalidate(w); + break; + case WIDX_LAND_TOOL_LARGER: + // Increment land ownership tool size + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); + + window_invalidate(w); + break; } } diff --git a/src/openrct2/windows/water.c b/src/openrct2/windows/water.c index ed19f3215c..9fd8f2deb0 100644 --- a/src/openrct2/windows/water.c +++ b/src/openrct2/windows/water.c @@ -47,6 +47,7 @@ static rct_widget window_water_widgets[] = { static void window_water_close(rct_window *w); static void window_water_mouseup(rct_window *w, rct_widgetindex widgetIndex); +static void window_water_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget *widget); static void window_water_update(rct_window *w); static void window_water_invalidate(rct_window *w); static void window_water_paint(rct_window *w, rct_drawpixelinfo *dpi); @@ -57,7 +58,7 @@ static rct_window_event_list window_water_events = { window_water_close, window_water_mouseup, NULL, - NULL, + window_water_mousedown, NULL, NULL, window_water_update, @@ -107,6 +108,7 @@ void window_water_open() ); window->widgets = window_water_widgets; window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW); + window->hold_down_widgets = (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT); window_init_scroll_widgets(window); window_push_others_below(window); @@ -136,23 +138,29 @@ static void window_water_mouseup(rct_window *w, rct_widgetindex widgetIndex) case WIDX_CLOSE: window_close(w); break; + case WIDX_PREVIEW: + window_water_inputsize(w); + break; + } +} + +static void window_water_mousedown(rct_window *w, rct_widgetindex widgetIndex, rct_widget* widget) +{ + switch (widgetIndex) { case WIDX_DECREMENT: // Decrement land tool size - gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize-1); + gLandToolSize = max(MINIMUM_TOOL_SIZE, gLandToolSize - 1); // Invalidate the window window_invalidate(w); break; case WIDX_INCREMENT: // Increment land tool size - gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize+1); + gLandToolSize = min(MAXIMUM_TOOL_SIZE, gLandToolSize + 1); // Invalidate the window window_invalidate(w); break; - case WIDX_PREVIEW: - window_water_inputsize(w); - break; } }