mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 07:14:31 +01:00
integrate land tool variables
This commit is contained in:
@@ -147,14 +147,14 @@ void window_land_open()
|
||||
window_init_scroll_widgets(window);
|
||||
window_push_others_below(window);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
|
||||
gLandToolTerrainSurface = 255;
|
||||
gLandToolTerrainEdge = 255;
|
||||
gLandMountainMode = false;
|
||||
gLandPaintMode = false;
|
||||
_selectedFloorTexture = 0;
|
||||
_selectedWallTexture = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = MONEY32_UNDEFINED;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = MONEY32_UNDEFINED;
|
||||
gLandToolRaiseCost = MONEY32_UNDEFINED;
|
||||
gLandToolLowerCost = MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,10 +276,10 @@ static void window_land_dropdown(rct_window *w, int widgetIndex, int dropdownInd
|
||||
_selectedFloorTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_FLOOR_TEXTURE_GRASS;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
|
||||
if (gLandToolTerrainSurface == type) {
|
||||
gLandToolTerrainSurface = 255;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = type;
|
||||
gLandToolTerrainSurface = type;
|
||||
_selectedFloorTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
@@ -292,10 +292,10 @@ static void window_land_dropdown(rct_window *w, int widgetIndex, int dropdownInd
|
||||
_selectedWallTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_WALL_TEXTURE_ROCK;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
|
||||
if (gLandToolTerrainEdge == type) {
|
||||
gLandToolTerrainEdge = 255;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = type;
|
||||
gLandToolTerrainEdge = type;
|
||||
_selectedWallTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
@@ -347,9 +347,9 @@ static void window_land_invalidate(rct_window *w)
|
||||
colour_scheme_update(w);
|
||||
|
||||
w->pressed_widgets = (1 << WIDX_PREVIEW);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) != 255)
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
w->pressed_widgets |= (1 << WIDX_FLOOR);
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) != 255)
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
w->pressed_widgets |= (1 << WIDX_WALL);
|
||||
if (gLandMountainMode)
|
||||
w->pressed_widgets |= (1 << WIDX_MOUNTAINMODE);
|
||||
@@ -391,21 +391,21 @@ static void window_land_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
y = w->y + previewWidget->bottom + 5;
|
||||
|
||||
// Draw raise cost amount
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) != 0)
|
||||
gfx_draw_string_centred(dpi, 984, x, y, 0, (void*)RCT2_ADDRESS_LAND_RAISE_COST);
|
||||
if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, 984, x, y, 0, &gLandToolRaiseCost);
|
||||
y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) != 0)
|
||||
gfx_draw_string_centred(dpi, 985, x, y, 0, (void*)RCT2_ADDRESS_LAND_LOWER_COST);
|
||||
if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, 985, x, y, 0, &gLandToolLowerCost);
|
||||
y += 50;
|
||||
|
||||
// Draw paint price
|
||||
numTiles = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) * RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
|
||||
price = 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) != 255)
|
||||
price += numTiles * land_pricing[RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8)];
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) != 255)
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
price += numTiles * land_pricing[gLandToolTerrainSurface];
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
price += numTiles * 100;
|
||||
|
||||
if (price != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) {
|
||||
|
||||
@@ -563,7 +563,7 @@ static void window_map_scrollmousedown(rct_window *w, int scrollIndex, int x, in
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
||||
GAME_COMMAND_FLAG_APPLY,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) | (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) << 8),
|
||||
gLandToolTerrainSurface | (gLandToolTerrainEdge << 8),
|
||||
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
||||
|
||||
@@ -587,10 +587,10 @@ static void window_mapgen_base_dropdown(rct_window *w, int widgetIndex, int drop
|
||||
_floorTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_FLOOR_TEXTURE_GRASS;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
|
||||
if (gLandToolTerrainSurface == type) {
|
||||
gLandToolTerrainSurface = 255;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = type;
|
||||
gLandToolTerrainSurface = type;
|
||||
_floorTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
@@ -603,10 +603,10 @@ static void window_mapgen_base_dropdown(rct_window *w, int widgetIndex, int drop
|
||||
_wallTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_WALL_TEXTURE_ROCK;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
|
||||
if (gLandToolTerrainEdge == type) {
|
||||
gLandToolTerrainEdge = 255;
|
||||
} else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = type;
|
||||
gLandToolTerrainEdge = type;
|
||||
_wallTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
@@ -922,11 +922,11 @@ static void window_mapgen_simplex_dropdown(rct_window *w, int widgetIndex, int d
|
||||
_floorTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_FLOOR_TEXTURE_GRASS;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
|
||||
if (gLandToolTerrainSurface == type) {
|
||||
gLandToolTerrainSurface = 255;
|
||||
}
|
||||
else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = type;
|
||||
gLandToolTerrainSurface = type;
|
||||
_floorTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
@@ -939,11 +939,11 @@ static void window_mapgen_simplex_dropdown(rct_window *w, int widgetIndex, int d
|
||||
_wallTexture :
|
||||
(uint32)gDropdownItemsArgs[dropdownIndex] - SPR_WALL_TEXTURE_ROCK;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) == type) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
|
||||
if (gLandToolTerrainEdge == type) {
|
||||
gLandToolTerrainEdge = 255;
|
||||
}
|
||||
else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = type;
|
||||
gLandToolTerrainEdge = type;
|
||||
_wallTexture = type;
|
||||
}
|
||||
window_invalidate(w);
|
||||
|
||||
@@ -1817,10 +1817,10 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
||||
money32 lower_cost = selection_lower_land(0);
|
||||
money32 raise_cost = selection_raise_land(0);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
||||
if (gLandToolRaiseCost != raise_cost ||
|
||||
gLandToolLowerCost != lower_cost){
|
||||
gLandToolRaiseCost = raise_cost;
|
||||
gLandToolLowerCost = lower_cost;
|
||||
window_invalidate_by_class(WC_LAND);
|
||||
}
|
||||
return;
|
||||
@@ -1838,10 +1838,10 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
||||
money32 lower_cost = MONEY32_UNDEFINED;
|
||||
money32 raise_cost = MONEY32_UNDEFINED;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
||||
if (gLandToolRaiseCost != raise_cost ||
|
||||
gLandToolLowerCost != lower_cost){
|
||||
gLandToolRaiseCost = raise_cost;
|
||||
gLandToolLowerCost = lower_cost;
|
||||
window_invalidate_by_class(WC_LAND);
|
||||
}
|
||||
return;
|
||||
@@ -1887,10 +1887,10 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
||||
money32 lower_cost = selection_lower_land(0);
|
||||
money32 raise_cost = selection_raise_land(0);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
||||
if (gLandToolRaiseCost != raise_cost ||
|
||||
gLandToolLowerCost != lower_cost){
|
||||
gLandToolRaiseCost = raise_cost;
|
||||
gLandToolLowerCost = lower_cost;
|
||||
window_invalidate_by_class(WC_LAND);
|
||||
}
|
||||
return;
|
||||
@@ -1902,10 +1902,10 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
||||
money32 lower_cost = MONEY32_UNDEFINED;
|
||||
money32 raise_cost = MONEY32_UNDEFINED;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
||||
if (gLandToolRaiseCost != raise_cost ||
|
||||
gLandToolLowerCost != lower_cost){
|
||||
gLandToolRaiseCost = raise_cost;
|
||||
gLandToolLowerCost = lower_cost;
|
||||
window_invalidate_by_class(WC_LAND);
|
||||
}
|
||||
return;
|
||||
@@ -1965,10 +1965,10 @@ void top_toolbar_tool_update_land(sint16 x, sint16 y){
|
||||
money32 lower_cost = selection_lower_land(0);
|
||||
money32 raise_cost = selection_raise_land(0);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) != raise_cost ||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) != lower_cost){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, money32) = raise_cost;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, money32) = lower_cost;
|
||||
if (gLandToolRaiseCost != raise_cost ||
|
||||
gLandToolLowerCost != lower_cost){
|
||||
gLandToolRaiseCost = raise_cost;
|
||||
gLandToolLowerCost = lower_cost;
|
||||
window_invalidate_by_class(WC_LAND);
|
||||
}
|
||||
}
|
||||
@@ -2583,7 +2583,7 @@ static void window_top_toolbar_tool_down(rct_window* w, int widgetIndex, int x,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
||||
1,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) | (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) << 8),
|
||||
gLandToolTerrainSurface | (gLandToolTerrainEdge << 8),
|
||||
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
||||
@@ -2673,15 +2673,15 @@ void window_top_toolbar_land_tool_drag(short x, short y)
|
||||
|
||||
selection_raise_land(GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
||||
gLandToolRaiseCost = MONEY32_UNDEFINED;
|
||||
gLandToolLowerCost = MONEY32_UNDEFINED;
|
||||
} else if (y_diff >= -tile_height) {
|
||||
gInputDragLastY -= tile_height;
|
||||
|
||||
selection_lower_land(GAME_COMMAND_FLAG_APPLY);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) = MONEY32_UNDEFINED;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) = MONEY32_UNDEFINED;
|
||||
gLandToolRaiseCost = MONEY32_UNDEFINED;
|
||||
gLandToolLowerCost = MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2788,7 +2788,7 @@ static void window_top_toolbar_tool_drag(rct_window* w, int widgetIndex, int x,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
||||
1,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) | (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) << 8),
|
||||
gLandToolTerrainSurface | (gLandToolTerrainEdge << 8),
|
||||
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
||||
|
||||
Reference in New Issue
Block a user