Merge pull request #1233 from trigger-death/clear-sceney-filter

Clear scenery tool now as options
This commit is contained in:
Ted John 2015-06-06 01:13:17 +01:00
commit 2c540f19cf
8 changed files with 109 additions and 49 deletions

View File

@ -3605,3 +3605,6 @@ STR_5268 :{SMALLFONT}{BLACK}Audio
STR_5269 :{SMALLFONT}{BLACK}Controls STR_5269 :{SMALLFONT}{BLACK}Controls
STR_5270 :{SMALLFONT}{BLACK}Miscellaneous 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

BIN
resources/g2/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

BIN
resources/g2/15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

BIN
resources/g2/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@ -364,6 +364,9 @@ enum {
SPR_G2_TAB_TREE = SPR_G2_BEGIN + 12, SPR_G2_TAB_TREE = SPR_G2_BEGIN + 12,
SPR_G2_TAB_PENCIL = SPR_G2_BEGIN + 13, 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 #endif

View File

@ -33,19 +33,26 @@ enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
WIDX_CLOSE, WIDX_CLOSE,
WIDX_PREVIEW, WIDX_PREVIEW,
WIDX_DECREMENT, WIDX_DECREMENT,
WIDX_INCREMENT WIDX_INCREMENT,
WIDX_SMALL_SCENERY,
WIDX_LARGE_SCENERY,
WIDX_FOOTPATH
}; };
rct_widget window_clear_scenery_widgets[] = { 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_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_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_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, 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_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 }, { WIDGETS_END },
}; };
static int window_clear_scenery_should_close(); static int window_clear_scenery_should_close();
static void window_clear_scenery_emptysub() { } static void window_clear_scenery_emptysub() { }
@ -100,13 +107,18 @@ void window_clear_scenery_open()
if (window_find_by_class(WC_CLEAR_SCENERY) != NULL) if (window_find_by_class(WC_CLEAR_SCENERY) != NULL)
return; 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->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_init_scroll_widgets(window);
window_push_others_below(window); window_push_others_below(window);
RCT2_GLOBAL(0x00F1AD62, uint32) = MONEY32_UNDEFINED; 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: case WIDX_PREVIEW:
window_clear_scenery_inputsize(w); window_clear_scenery_inputsize(w);
break; 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); colour_scheme_update(w);
// Set the preview image button to be pressed down // 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 // Update the preview image
window_clear_scenery_widgets[WIDX_PREVIEW].image = SPR_LAND_TOOL_SIZE_0 + RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); 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 // Draw cost amount
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x; 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) if (RCT2_GLOBAL(0x00F1AD62, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(0x00F1AD62, uint32) != 0)
gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x00F1AD62); gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x00F1AD62);
} }

View File

@ -49,6 +49,9 @@ rct_xy16 *gMapSelectionTiles = (rct_xy16*)0x009DE596;
bool LandPaintMode; bool LandPaintMode;
bool LandRightsMode; bool LandRightsMode;
bool gClearSmallScenery;
bool gClearLargeScenery;
bool gClearFootpath;
int _sub_6A876D_save_x; int _sub_6A876D_save_x;
int _sub_6A876D_save_y; int _sub_6A876D_save_y;
@ -1173,7 +1176,7 @@ restart_from_beginning:
type = map_element_get_type(mapElement); type = map_element_get_type(mapElement);
switch (type) { switch (type) {
case MAP_ELEMENT_TYPE_PATH: case MAP_ELEMENT_TYPE_PATH:
#ifdef CLEAR_SCENERY_REMOVES_PATHS if (gClearFootpath) {
cost = sub_6A67C0(x, y, mapElement->base_height, flags); cost = sub_6A67C0(x, y, mapElement->base_height, flags);
if (cost == MONEY32_UNDEFINED) if (cost == MONEY32_UNDEFINED)
return MONEY32_UNDEFINED; return MONEY32_UNDEFINED;
@ -1181,9 +1184,9 @@ restart_from_beginning:
totalCost += cost; totalCost += cost;
if (flags & 1) if (flags & 1)
goto restart_from_beginning; goto restart_from_beginning;
#endif } break;
break; case MAP_ELEMENT_TYPE_SCENERY:
case MAP_ELEMENT_TYPE_SCENERY:{ if (gClearSmallScenery) {
int eax = x * 32; int eax = x * 32;
int ebx = (mapElement->type << 8) | flags; int ebx = (mapElement->type << 8) | flags;
int ecx = y * 32; int ecx = y * 32;
@ -1199,8 +1202,9 @@ restart_from_beginning:
if (flags & 1) if (flags & 1)
goto restart_from_beginning; goto restart_from_beginning;
}break; } break;
case MAP_ELEMENT_TYPE_FENCE:{ case MAP_ELEMENT_TYPE_FENCE:
if (gClearSmallScenery) {
int eax = x * 32; int eax = x * 32;
int ebx = flags; int ebx = flags;
int ecx = y * 32; int ecx = y * 32;
@ -1216,7 +1220,26 @@ restart_from_beginning:
if (flags & 1) if (flags & 1)
goto restart_from_beginning; goto restart_from_beginning;
}break; } 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;
} }
} while (!map_element_is_last_for_tile(mapElement++)); } while (!map_element_is_last_for_tile(mapElement++));

View File

@ -246,6 +246,10 @@ extern rct_xy16 *gMapSelectionTiles;
extern bool LandPaintMode; extern bool LandPaintMode;
// Used in the land rights tool window to either buy land rights or construction rights // Used in the land rights tool window to either buy land rights or construction rights
extern bool LandRightsMode; 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_init(int size);
void map_update_tile_pointers(); void map_update_tile_pointers();