diff --git a/src/addresses.h b/src/addresses.h index f1dc347c96..8421dce109 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -349,6 +349,13 @@ #define RCT2_ADDRESS_TRACK_LIST 0x00F441EC +#define RCT2_ADDRESS_SCENERY_COST 0x00F64EB4 + +#define RCT2_ADDRESS_GHOST_SCENERY_X 0x00F64EC4 +#define RCT2_ADDRESS_GHOST_SCENERY_Y 0x00F64EC6 +#define RCT2_ADDRESS_GHOST_SCENERY_Z 0x00F64F09 +#define RCT2_ADDRESS_GHOST_SCENERY_TYPE 0x00F64F0D + #define RCT2_ADDRESS_CTRL_PRESS_Z_COORDINATE 0x00F64ECC #define RCT2_ADDRESS_SHIFT_PRESS_X_COORDINATE 0x00F64ECE #define RCT2_ADDRESS_SHIFT_PRESS_Y_COORDINATE 0x00F64ED0 diff --git a/src/windows/scenery.c b/src/windows/scenery.c index 3deb35e692..ea6a4388a2 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -470,8 +470,8 @@ void window_scenery_open() window->scenery.selected_scenery_id = -1; window->scenery.hover_counter = 0; window_push_others_below(window); - RCT2_GLOBAL(0x00F64F0D, uint8) = 0; - RCT2_GLOBAL(0x00F64EB4, uint32) = MONEY32_UNDEFINED; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32) = MONEY32_UNDEFINED; RCT2_GLOBAL(0x00F64EC0, uint16) = 0; window_scenery_is_repaint_scenery_tool_on = 0; // repaint colored scenery tool state window_scenery_is_build_cluster_tool_on = 0; // build cluster tool state @@ -639,7 +639,7 @@ static void window_scenery_mousedown(int widgetIndex, rct_window* w, rct_widget* if (widgetIndex >= WIDX_SCENERY_TAB_1 && widgetIndex <= WIDX_SCENERY_TAB_20) { window_scenery_active_tab_index = widgetIndex - WIDX_SCENERY_TAB_1; window_invalidate(w); - RCT2_GLOBAL(0x00F64EB4, uint32) = MONEY32_UNDEFINED; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32) = MONEY32_UNDEFINED; window_scenery_update_scroll(w); } } @@ -797,7 +797,7 @@ void window_scenery_scrollmousedown(rct_window *w, int scrollIndex, int x, int y window_scenery_is_repaint_scenery_tool_on &= 0xFE; sound_play_panned(4, (w->width >> 1) + w->x, 0, 0, 0); w->scenery.hover_counter = -16; - RCT2_GLOBAL(0x00F64EB4, uint32) = MONEY32_UNDEFINED; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32) = MONEY32_UNDEFINED; window_invalidate(w); } @@ -1021,8 +1021,8 @@ void window_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi) price = sceneryEntry->small_scenery.price * 10; } - if (w->scenery.selected_scenery_id == -1 && RCT2_GLOBAL(0x00F64EB4, uint32) != MONEY32_UNDEFINED) { - price = RCT2_GLOBAL(0x00F64EB4, uint32); + if (w->scenery.selected_scenery_id == -1 && RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32) != MONEY32_UNDEFINED) { + price = RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, uint32); } RCT2_GLOBAL(0x013CE952, uint32) = price; diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index f1b94142f5..b4c634c9ba 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -2083,18 +2083,18 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa parameter_2, GAME_COMMAND_PLACE_SCENERY, parameter_3, - RCT2_GLOBAL(0x00F64ED4, sint16)); + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16)); if (cost == MONEY32_UNDEFINED) return cost; - RCT2_GLOBAL(0x00F64EC4, sint16) = map_tile.x; - RCT2_GLOBAL(0x00F64EC6, sint16) = map_tile.y; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y; RCT2_GLOBAL(0x00F64EC0, uint16) = (uint16)(parameter_3 & 0xFFFF); RCT2_GLOBAL(0x00F64EDA, sint16) = selected_tab; mapElement = RCT2_GLOBAL(0x00F64EBC, rct_map_element*); - RCT2_GLOBAL(0x00F64F09, uint8) = mapElement->base_height; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height; RCT2_GLOBAL(0x00F64F0C, uint8) = mapElement->type; if (RCT2_GLOBAL(0x00F64F14, uint8) & (1 << 1)){ viewport_set_visibility(4); @@ -2103,7 +2103,7 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa viewport_set_visibility(5); } - RCT2_GLOBAL(0x00F64F0D, uint8) |= (1 << 0); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 0); break; case 1: // Path Bits @@ -2120,14 +2120,14 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa if (cost == MONEY32_UNDEFINED) return cost; - RCT2_GLOBAL(0x00F64EC4, sint16) = map_tile.x; - RCT2_GLOBAL(0x00F64EC6, sint16) = map_tile.y; - RCT2_GLOBAL(0x00F64F09, uint8) = (parameter_2 & 0xFF); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = (parameter_2 & 0xFF); RCT2_GLOBAL(0x00F64F0F, uint8) = ((parameter_1 >> 8) & 0xFF); RCT2_GLOBAL(0x00F64F10, uint8) = ((parameter_2 >> 8) & 0xFF); RCT2_GLOBAL(0x00F64EAC, uint32) = parameter_3; - RCT2_GLOBAL(0x00F64F0D, uint8) |= (1 << 1); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 1); break; case 2: // Walls @@ -2138,20 +2138,20 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa map_tile.y, parameter_2, GAME_COMMAND_PLACE_FENCE, - RCT2_GLOBAL(0x00F64ED4, uint16), + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, uint16), RCT2_GLOBAL(0x00F64F15, uint16)); if (cost == MONEY32_UNDEFINED) return cost; - RCT2_GLOBAL(0x00F64EC4, sint16) = map_tile.x; - RCT2_GLOBAL(0x00F64EC6, sint16) = map_tile.y; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y; RCT2_GLOBAL(0x00F64F11, uint8) = (parameter_2 & 0xFF); mapElement = RCT2_GLOBAL(0x00F64EBC, rct_map_element*); - RCT2_GLOBAL(0x00F64F09, uint8) = mapElement->base_height; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height; - RCT2_GLOBAL(0x00F64F0D, uint8) |= (1 << 2); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 2); break; case 3: // Large Scenery @@ -2163,17 +2163,17 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa parameter_2, GAME_COMMAND_PLACE_LARGE_SCENERY, parameter_3, - RCT2_GLOBAL(0x00F64ED4, uint16)); + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, uint16)); if (cost == MONEY32_UNDEFINED) return cost; - RCT2_GLOBAL(0x00F64EC4, sint16) = map_tile.x; - RCT2_GLOBAL(0x00F64EC6, sint16) = map_tile.y; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y; RCT2_GLOBAL(0x00F64EC0, uint8) = ((parameter_1 >> 8) & 0xFF); mapElement = RCT2_GLOBAL(0x00F64EBC, rct_map_element*); - RCT2_GLOBAL(0x00F64F09, uint8) = mapElement->base_height; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = mapElement->base_height; if (RCT2_GLOBAL(0x00F64F14, uint8) & (1 << 1)){ viewport_set_visibility(4); @@ -2182,7 +2182,7 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa viewport_set_visibility(5); } - RCT2_GLOBAL(0x00F64F0D, uint8) |= (1 << 3); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 3); break; case 4: // Banners @@ -2199,11 +2199,11 @@ money32 try_place_ghost_scenery(rct_xy16 map_tile, uint32 parameter_1, uint32 pa if (cost == MONEY32_UNDEFINED) return cost; - RCT2_GLOBAL(0x00F64EC4, sint16) = map_tile.x; - RCT2_GLOBAL(0x00F64EC6, sint16) = map_tile.y; - RCT2_GLOBAL(0x00F64F09, uint8) = (parameter_2 & 0xFF); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) = map_tile.x; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) = map_tile.y; + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) = (parameter_2 & 0xFF); RCT2_GLOBAL(0x00F64EC0, uint8) = ((parameter_2 >> 8) & 0xFF); - RCT2_GLOBAL(0x00F64F0D, uint8) |= (1 << 4); + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) |= (1 << 4); break; } @@ -2264,9 +2264,9 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ map_invalidate_selection_rect(); // If no change in ghost placement - if ((RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 0)) && - mapTile.x == RCT2_GLOBAL(0x00F64EC4, sint16) && - mapTile.y == RCT2_GLOBAL(0x00F64EC6, sint16) && + if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 0)) && + mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) && + mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) && (parameter2 & 0xFF) == RCT2_GLOBAL(0x00F64F0E, uint8)&& RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16) && RCT2_GLOBAL(0x00F64EDA, uint16) == selected_tab){ @@ -2297,7 +2297,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8; } - RCT2_GLOBAL(0x00F64EB4, money32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost; break; case 1: RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0); @@ -2310,10 +2310,10 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ map_invalidate_selection_rect(); // If no change in ghost placement - if ((RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 1)) && - mapTile.x == RCT2_GLOBAL(0x00F64EC4, sint16) && - mapTile.y == RCT2_GLOBAL(0x00F64EC6, sint16) && - (parameter2 & 0xFF) == RCT2_GLOBAL(0x00F64F09, uint8)){ + if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 1)) && + mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) && + mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) && + (parameter2 & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8)){ return; } @@ -2326,7 +2326,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ parameter3, selected_tab); - RCT2_GLOBAL(0x00F64EB4, money32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost; break; case 2: RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0); @@ -2339,9 +2339,9 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ map_invalidate_selection_rect(); // If no change in ghost placement - if ((RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 2)) && - mapTile.x == RCT2_GLOBAL(0x00F64EC4, sint16) && - mapTile.y == RCT2_GLOBAL(0x00F64EC6, sint16) && + if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 2)) && + mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) && + mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) && (parameter2 & 0xFF) == RCT2_GLOBAL(0x00F64F11, uint8) && RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16) ){ @@ -2373,7 +2373,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8; } - RCT2_GLOBAL(0x00F64EB4, money32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost; break; case 3: scenery = g_largeSceneryEntries[selected_scenery]; @@ -2400,9 +2400,9 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ map_invalidate_map_selection_tiles(); // If no change in ghost placement - if ((RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 3)) && - mapTile.x == RCT2_GLOBAL(0x00F64EC4, sint16) && - mapTile.y == RCT2_GLOBAL(0x00F64EC6, sint16) && + if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 3)) && + mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) && + mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) && RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) == RCT2_GLOBAL(0x00F64F0A, sint16) && (parameter3 & 0xFFFF) == RCT2_GLOBAL(0x00F64EDA, uint16)){ return; @@ -2433,7 +2433,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_Z_COORDINATE, sint16) += 8; } - RCT2_GLOBAL(0x00F64EB4, money32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost; break; case 4: RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) |= (1 << 0); @@ -2446,10 +2446,10 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ map_invalidate_selection_rect(); // If no change in ghost placement - if ((RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 4)) && - mapTile.x == RCT2_GLOBAL(0x00F64EC4, sint16) && - mapTile.y == RCT2_GLOBAL(0x00F64EC6, sint16) && - (parameter2 & 0xFF) == RCT2_GLOBAL(0x00F64F09, uint8) && + if ((RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 4)) && + mapTile.x == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16) && + mapTile.y == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16) && + (parameter2 & 0xFF) == RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8) && ((parameter2 >> 8) & 0xFF) == RCT2_GLOBAL(0x00F64EC0, uint8)){ return; } @@ -2463,7 +2463,7 @@ void top_toolbar_tool_update_scenery(sint16 x, sint16 y){ parameter3, selected_tab); - RCT2_GLOBAL(0x00F64EB4, money32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_SCENERY_COST, money32) = cost; break; } } diff --git a/src/world/scenery.c b/src/world/scenery.c index cbf9bf3ca3..fabf42ff24 100644 --- a/src/world/scenery.c +++ b/src/world/scenery.c @@ -111,18 +111,19 @@ void scenery_increase_age(int x, int y, rct_map_element *mapElement) } } - -/* 0x006E2712 */ +/* + * + * rct2: 0x006E2712 + */ void scenery_remove_ghost_tool_placement(){ sint16 x, y, z; - x = RCT2_GLOBAL(0x00F64EC4, sint16); - y = RCT2_GLOBAL(0x00F64EC6, sint16); - z = RCT2_GLOBAL(0x00F64F09, uint8); - - if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 0)){ - RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 0); + x = RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_X, sint16); + y = RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Y, sint16); + z = RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_Z, uint8); + if (RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 0)){ + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) &= ~(1 << 0); game_do_command( x, 105 | (RCT2_GLOBAL(0x00F64F0C, uint8) << 8), @@ -133,9 +134,8 @@ void scenery_remove_ghost_tool_placement(){ 0); } - if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 1)){ - RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 1); - + if (RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 1)){ + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) &= ~(1 << 1); rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); do{ @@ -157,9 +157,8 @@ void scenery_remove_ghost_tool_placement(){ } while (!map_element_is_last_for_tile(map_element++)); } - if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 2)){ - RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 2); - + if (RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 2)){ + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) &= ~(1 << 2); game_do_command( x, 105 | (RCT2_GLOBAL(0x00F64F0C, uint8) << 8), @@ -170,9 +169,8 @@ void scenery_remove_ghost_tool_placement(){ 0); } - if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 3)){ - RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 3); - + if (RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 3)){ + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) &= ~(1 << 3); game_do_command( x, 105 | (RCT2_GLOBAL(0x00F64EC0, uint8) << 8), @@ -183,9 +181,8 @@ void scenery_remove_ghost_tool_placement(){ 0); } - if (RCT2_GLOBAL(0x00F64F0D, uint8) & (1 << 4)){ - RCT2_GLOBAL(0x00F64F0D, uint8) &= ~(1 << 4); - + if (RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) & (1 << 4)){ + RCT2_GLOBAL(RCT2_ADDRESS_GHOST_SCENERY_TYPE, uint8) &= ~(1 << 4); game_do_command( x, 105,