From e76bddb82090a3a242b48e1f162dee5d0f22738c Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Mon, 9 Mar 2015 22:51:36 +0100 Subject: [PATCH 1/6] Extend max land ownership tool size to 64 --- src/windows/map.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/windows/map.c b/src/windows/map.c index c7e389f1dc..27e2faf360 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -231,9 +231,11 @@ static void window_map_mouseup() //RCT2_CALLPROC_EBPSAFE(0x0068CFC1); sint16 var_idx; rct_window* var_w; + //Maximum land ownership tool size + int land_tool_limit; window_widget_get_registers(var_w, var_idx); - + switch (var_idx) { case WIDX_CLOSE: @@ -290,18 +292,20 @@ static void window_map_mouseup() case WIDX_LAND_TOOL_SMALLER: --RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + land_tool_limit=1; - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) < 1) - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; + if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) < land_tool_limit) + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = land_tool_limit; window_invalidate(var_w); break; case WIDX_LAND_TOOL_LARGER: ++RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + land_tool_limit=64; - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 7; + if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > land_tool_limit) + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = land_tool_limit; window_invalidate(var_w); break; @@ -538,8 +542,8 @@ static void window_map_invalidate() w->widgets[WIDX_LAND_TOOL_LARGER].type = WWT_TRNBTN; for (i = 0; i < 4; i++) w->widgets[WIDX_LAND_OWNED_CHECKBOX + i].type = WWT_CHECKBOX; - w->widgets[WIDX_LAND_TOOL].image = SPR_LAND_TOOL_SIZE_0 + - RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, uint16); + 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) : 0xFFFFFFFF; } // if no tool is active: show the default scenario editor buttons } else { @@ -559,10 +563,23 @@ static void window_map_paint() int image_id; int i, x, y; + x = w->x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2; + y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2; + window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); + // FEATURE larger land tool size support + if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { + RCT2_GLOBAL(0x009BC677, char) = FORMAT_BLACK; + RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; + RCT2_GLOBAL(0x009BC679, char) = 0; + RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + gfx_draw_string_centred(dpi, 3165, x, y + 27, 0, (void*)0x013CE952); +} + y = w->y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; + // guest tab image (animated) image_id = SPR_TAB_GUESTS_0; if (w->selected_tab == 0) @@ -887,4 +904,4 @@ static void window_map_center_on_view_point() w_map->scrolls[0].h_left = cx; w_map->scrolls[0].v_top = dx; widget_scroll_update_thumbs(w_map, WIDX_MAP); -} \ No newline at end of file +} From 9340c99a1eab47261ff6894a2c111c691fb663cd Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Tue, 10 Mar 2015 10:21:46 +0100 Subject: [PATCH 2/6] Fix indentation --- src/windows/map.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/windows/map.c b/src/windows/map.c index 27e2faf360..2406028a2a 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -572,12 +572,12 @@ static void window_map_paint() // FEATURE larger land tool size support if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { - RCT2_GLOBAL(0x009BC677, char) = FORMAT_BLACK; - RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; - RCT2_GLOBAL(0x009BC679, char) = 0; - RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); - gfx_draw_string_centred(dpi, 3165, x, y + 27, 0, (void*)0x013CE952); -} + RCT2_GLOBAL(0x009BC677, char) = FORMAT_BLACK; + RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; + RCT2_GLOBAL(0x009BC679, char) = 0; + RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); + gfx_draw_string_centred(dpi, 3165, x, y + 27, 0, (void*)0x013CE952); + } y = w->y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5; // guest tab image (animated) From 1f80802dbff98285d7326a9cf89846b1a3f39142 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 11 Mar 2015 11:11:19 +0100 Subject: [PATCH 3/6] Fix terraforming tool sizes bigger than 7 being written to the map window --- src/windows/map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/windows/map.c b/src/windows/map.c index 2406028a2a..48b56f8ad6 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -571,7 +571,8 @@ static void window_map_paint() window_draw_widgets(w, dpi); // FEATURE larger land tool size support - if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { + if ((RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) && + (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP)) { RCT2_GLOBAL(0x009BC677, char) = FORMAT_BLACK; RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; RCT2_GLOBAL(0x009BC679, char) = 0; From 80571814c40853bf2fd91eb9b441cc805824e765 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 11 Mar 2015 11:26:55 +0100 Subject: [PATCH 4/6] Fix old land ownership tool sizes being written to the map window --- src/windows/map.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/windows/map.c b/src/windows/map.c index 48b56f8ad6..0d7db5cb98 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -203,6 +203,8 @@ static void window_map_close() RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, uint16) == w->number) { tool_cancel(); } + //Reset land tool size + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 0; } /** From 564e215051122631c4fc67039009d444166a614f Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 11 Mar 2015 12:16:32 +0100 Subject: [PATCH 5/6] Fix 'Map size:' text appearing when it should be hidden --- src/windows/map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/windows/map.c b/src/windows/map.c index 0d7db5cb98..7eb643f8e1 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -626,8 +626,8 @@ static void window_map_paint() } } else { if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && - (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) != WC_MAP) && - (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_SET_LAND_RIGHTS)) + (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP) && + (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) == WIDX_SET_LAND_RIGHTS)) return; gfx_draw_string_left(dpi, STR_MAP_SIZE, 0, 0, w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE_SPINNER].top + 1); From adfd678469369438b037c211d58bc69eccacb807 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 11 Mar 2015 12:39:18 +0100 Subject: [PATCH 6/6] Fix map tool sizes larger than 7 not being drawn correctly --- src/windows/map.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/windows/map.c b/src/windows/map.c index 7eb643f8e1..f93f5e0f5e 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -565,13 +565,13 @@ static void window_map_paint() int image_id; int i, x, y; - x = w->x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2; - y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2; - window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); + x = w->x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2; + y = w->y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2; + // FEATURE larger land tool size support if ((RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) && (RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_MAP)) { @@ -579,7 +579,7 @@ static void window_map_paint() RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; RCT2_GLOBAL(0x009BC679, char) = 0; RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); - gfx_draw_string_centred(dpi, 3165, x, y + 27, 0, (void*)0x013CE952); + gfx_draw_string_centred(dpi, 3165, x, y - 2, 0, (void*)0x013CE952); } y = w->y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5;