mirror of https://github.com/OpenRCT2/OpenRCT2.git
Clear scenery tool now as options
Can now choose to clear small scenery, large scenery, and/or footpaths.
This commit is contained in:
parent
27484d1a27
commit
83fda8fc56
|
@ -3604,4 +3604,7 @@ STR_5267 :{SMALLFONT}{BLACK}Culture and Units
|
|||
STR_5268 :{SMALLFONT}{BLACK}Audio
|
||||
STR_5269 :{SMALLFONT}{BLACK}Controls
|
||||
STR_5270 :{SMALLFONT}{BLACK}Miscellaneous
|
||||
STR_5271 :{SMALLFONT}{BLACK}Twitch
|
||||
STR_5271 :{SMALLFONT}{BLACK}Twitch
|
||||
STR_5272 :{SMALLFONT}{BLACK}Small Scenery
|
||||
STR_5273 :{SMALLFONT}{BLACK}Large Scenery
|
||||
STR_5274 :{SMALLFONT}{BLACK}Footpaths
|
Binary file not shown.
After Width: | Height: | Size: 912 B |
Binary file not shown.
After Width: | Height: | Size: 720 B |
Binary file not shown.
After Width: | Height: | Size: 446 B |
Binary file not shown.
After Width: | Height: | Size: 725 B |
|
@ -364,6 +364,9 @@ enum {
|
|||
|
||||
SPR_G2_TAB_TREE = SPR_G2_BEGIN + 12,
|
||||
SPR_G2_TAB_PENCIL = SPR_G2_BEGIN + 13,
|
||||
SPR_G2_BUTTON_LARGE_SCENERY = SPR_G2_BEGIN + 14,
|
||||
SPR_G2_BUTTON_TREES = SPR_G2_BEGIN + 15,
|
||||
SPR_G2_BUTTON_FOOTPATH = SPR_G2_BEGIN + 16,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,19 +33,26 @@ enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
|
|||
WIDX_CLOSE,
|
||||
WIDX_PREVIEW,
|
||||
WIDX_DECREMENT,
|
||||
WIDX_INCREMENT
|
||||
WIDX_INCREMENT,
|
||||
WIDX_SMALL_SCENERY,
|
||||
WIDX_LARGE_SCENERY,
|
||||
WIDX_FOOTPATH
|
||||
};
|
||||
|
||||
rct_widget window_clear_scenery_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, 97, 0, 66, -1, STR_NONE }, // panel / background
|
||||
{ WWT_FRAME, 0, 0, 97, 0, 93, -1, STR_NONE }, // panel / background
|
||||
{ WWT_CAPTION, 0, 1, 96, 1, 14, STR_CLEAR_SCENERY, STR_WINDOW_TITLE_TIP }, // title bar
|
||||
{ WWT_CLOSEBOX, 0, 85, 95, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
|
||||
{ WWT_IMGBTN, 0, 27, 70, 17, 48, SPR_LAND_TOOL_SIZE_0, STR_NONE }, // preview box
|
||||
{ WWT_TRNBTN, 1, 28, 43, 18, 33, 0x20000000 | SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_TIP }, // decrement size
|
||||
{ WWT_TRNBTN, 1, 54, 69, 32, 47, 0x20000000 | SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP }, // increment size
|
||||
{ WWT_FLATBTN, 1, 7, 30, 53, 76, 0x20000000 | SPR_G2_BUTTON_TREES, 5272 }, // small scenery
|
||||
{ WWT_FLATBTN, 1, 37, 60, 53, 76, 0x20000000 | SPR_G2_BUTTON_LARGE_SCENERY, 5273 }, // large scenery
|
||||
{ WWT_FLATBTN, 1, 67, 90, 53, 76, 0x20000000 | SPR_G2_BUTTON_FOOTPATH, 5274 }, // footpaths
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
|
||||
static int window_clear_scenery_should_close();
|
||||
|
||||
static void window_clear_scenery_emptysub() { }
|
||||
|
@ -100,13 +107,18 @@ 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, 67, (uint32*)window_clear_scenery_events, WC_CLEAR_SCENERY, 0);
|
||||
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 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);
|
||||
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_init_scroll_widgets(window);
|
||||
window_push_others_below(window);
|
||||
|
||||
RCT2_GLOBAL(0x00F1AD62, uint32) = MONEY32_UNDEFINED;
|
||||
|
||||
gClearSmallScenery = true;
|
||||
gClearLargeScenery = false;
|
||||
gClearFootpath = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,6 +176,18 @@ static void window_clear_scenery_mouseup()
|
|||
case WIDX_PREVIEW:
|
||||
window_clear_scenery_inputsize(w);
|
||||
break;
|
||||
case WIDX_SMALL_SCENERY:
|
||||
gClearSmallScenery ^= 1;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_LARGE_SCENERY:
|
||||
gClearLargeScenery ^= 1;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_FOOTPATH:
|
||||
gClearFootpath ^= 1;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +244,10 @@ static void window_clear_scenery_invalidate()
|
|||
colour_scheme_update(w);
|
||||
|
||||
// Set the preview image button to be pressed down
|
||||
w->pressed_widgets |= (1 << WIDX_PREVIEW);
|
||||
w->pressed_widgets = (1 << WIDX_PREVIEW) |
|
||||
(gClearSmallScenery ? (1 << WIDX_SMALL_SCENERY) : 0) |
|
||||
(gClearLargeScenery ? (1 << WIDX_LARGE_SCENERY) : 0) |
|
||||
(gClearFootpath ? (1 << WIDX_FOOTPATH) : 0);
|
||||
|
||||
// Update the preview image
|
||||
window_clear_scenery_widgets[WIDX_PREVIEW].image = SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
||||
|
@ -242,7 +269,7 @@ static void window_clear_scenery_paint()
|
|||
|
||||
// Draw cost amount
|
||||
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x;
|
||||
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5;
|
||||
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5 + 27;
|
||||
if (RCT2_GLOBAL(0x00F1AD62, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(0x00F1AD62, uint32) != 0)
|
||||
gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x00F1AD62);
|
||||
}
|
||||
|
|
107
src/world/map.c
107
src/world/map.c
|
@ -49,6 +49,9 @@ rct_xy16 *gMapSelectionTiles = (rct_xy16*)0x009DE596;
|
|||
|
||||
bool LandPaintMode;
|
||||
bool LandRightsMode;
|
||||
bool gClearSmallScenery;
|
||||
bool gClearLargeScenery;
|
||||
bool gClearFootpath;
|
||||
|
||||
int _sub_6A876D_save_x;
|
||||
int _sub_6A876D_save_y;
|
||||
|
@ -1173,50 +1176,70 @@ restart_from_beginning:
|
|||
type = map_element_get_type(mapElement);
|
||||
switch (type) {
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
#ifdef CLEAR_SCENERY_REMOVES_PATHS
|
||||
cost = sub_6A67C0(x, y, mapElement->base_height, flags);
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
if (gClearFootpath) {
|
||||
cost = sub_6A67C0(x, y, mapElement->base_height, flags);
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
#endif
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
if (gClearSmallScenery) {
|
||||
int eax = x * 32;
|
||||
int ebx = (mapElement->type << 8) | flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->properties.scenery.type << 8) | (mapElement->base_height);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
if (gClearSmallScenery) {
|
||||
int eax = x * 32;
|
||||
int ebx = flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->base_height << 8) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
if (gClearLargeScenery) {
|
||||
int eax = x * 32;
|
||||
int ebx = flags | ((mapElement->type & MAP_ELEMENT_DIRECTION_MASK) << 8);
|
||||
int ecx = y * 32;
|
||||
int edx = mapElement->base_height | ((mapElement->properties.scenerymultiple.type >> 10) << 8);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_large_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
|
||||
} break;
|
||||
break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:{
|
||||
int eax = x * 32;
|
||||
int ebx = (mapElement->type << 8) | flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->properties.scenery.type << 8) | (mapElement->base_height);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
|
||||
}break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:{
|
||||
int eax = x * 32;
|
||||
int ebx = flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->base_height << 8) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
totalCost += cost;
|
||||
if (flags & 1)
|
||||
goto restart_from_beginning;
|
||||
|
||||
}break;
|
||||
}
|
||||
} while (!map_element_is_last_for_tile(mapElement++));
|
||||
|
||||
|
|
|
@ -246,6 +246,10 @@ extern rct_xy16 *gMapSelectionTiles;
|
|||
extern bool LandPaintMode;
|
||||
// Used in the land rights tool window to either buy land rights or construction rights
|
||||
extern bool LandRightsMode;
|
||||
// Used in the clear scenery tool
|
||||
extern bool gClearSmallScenery;
|
||||
extern bool gClearLargeScenery;
|
||||
extern bool gClearFootpath;
|
||||
|
||||
void map_init(int size);
|
||||
void map_update_tile_pointers();
|
||||
|
|
Loading…
Reference in New Issue