Decompiled top_toolbar tool events

Also fixed bug with land rights tool gridlines
This commit is contained in:
Robert Jordan 2015-06-26 11:40:37 -04:00
parent 7527a74d7d
commit 9ad21599a3
3 changed files with 57 additions and 3 deletions

View File

@ -2170,6 +2170,7 @@ void show_gridlines()
}
}
RCT2_GLOBAL(0x009E32B0, uint8)++;
printf("gridline_state: %i\n", RCT2_GLOBAL(0x009E32B0, uint8));
}
/**
@ -2181,6 +2182,7 @@ void hide_gridlines()
rct_window *mainWindow;
RCT2_GLOBAL(0x009E32B0, uint8)--;
printf("gridline_state: %i\n", RCT2_GLOBAL(0x009E32B0, uint8));
if (RCT2_GLOBAL(0x009E32B0, uint8) == 0) {
if ((mainWindow = window_get_main()) != NULL) {
if (!gConfigGeneral.always_show_gridlines) {

View File

@ -1176,7 +1176,8 @@ static void window_park_init_viewport(rct_window *w)
void toggle_land_rights_window(rct_window *parkWindow, int widgetIndex)
{
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 14) {
if ((RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) & INPUT_FLAG_TOOL_ACTIVE) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == WC_PARK_INFORMATION &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == WIDX_BUY_LAND_RIGHTS) {
tool_cancel();
}
else {

View File

@ -178,6 +178,8 @@ static void window_top_toolbar_dropdown();
static void window_top_toolbar_tool_update();
static void window_top_toolbar_tool_down();
static void window_top_toolbar_tool_drag();
static void window_top_toolbar_tool_up();
static void window_top_toolbar_tool_abort();
static void window_top_toolbar_invalidate();
static void window_top_toolbar_paint();
@ -194,8 +196,8 @@ static void* window_top_toolbar_events[] = {
window_top_toolbar_tool_update, // editor: 0x0066fB0E
window_top_toolbar_tool_down, // editor: 0x0066fB5C
window_top_toolbar_tool_drag, // editor: 0x0066fB37
(void*)0x0066CC5B, // editor: 0x0066fC44
(void*)0x0066CA58, // editor: 0x0066fA74
window_top_toolbar_tool_up, // editor: 0x0066fC44 (Exactly the same)
window_top_toolbar_tool_abort, // editor: 0x0066fA74 (Exactly the same)
window_top_toolbar_emptysub,
window_top_toolbar_emptysub,
window_top_toolbar_emptysub,
@ -2723,6 +2725,55 @@ static void window_top_toolbar_tool_drag()
}
}
/**
*
* rct2: 0x0066CC5B
*/
static void window_top_toolbar_tool_up()
{
short widgetIndex, x, y;
rct_window *w;
window_tool_get_registers(w, widgetIndex, x, y);
switch (widgetIndex) {
case WIDX_LAND:
map_invalidate_selection_rect();
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x12;
break;
case WIDX_WATER:
map_invalidate_selection_rect();
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x13;
break;
case WIDX_CLEAR_SCENERY:
map_invalidate_selection_rect();
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TOOL, uint8) = 0x0C;
break;
}
}
/**
*
* rct2: 0x0066CA58
*/
static void window_top_toolbar_tool_abort()
{
short widgetIndex, x, y;
rct_window* w;
window_tool_get_registers(w, widgetIndex, x, y);
switch (widgetIndex) {
case WIDX_LAND:
case WIDX_WATER:
case WIDX_CLEAR_SCENERY:
hide_gridlines();
break;
}
}
void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
int num_items = 4;