mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
integrate land tool variables
This commit is contained in:
@@ -211,12 +211,6 @@
|
||||
#define RCT2_ADDRESS_HFONT 0x009E2DEC
|
||||
#define RCT2_ADDRESS_PROGRESSBAR_HWND 0x009E2DF8
|
||||
|
||||
|
||||
#define RCT2_ADDRESS_LAND_RAISE_COST 0x009E2E1C
|
||||
#define RCT2_ADDRESS_LAND_LOWER_COST 0x009E2E20
|
||||
#define RCT2_ADDRESS_SELECTED_TERRAIN_EDGE 0x009E2E24
|
||||
#define RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE 0x009E2E25
|
||||
|
||||
#define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28
|
||||
|
||||
//Every pixel changed by rain is stored.
|
||||
@@ -586,6 +580,11 @@
|
||||
#define RCT2_ADDRESS_GAME_PAUSED 0x009DEA6E
|
||||
#define RCT2_ADDRESS_WINDOW_DPI 0x009DEA74
|
||||
|
||||
#define RCT2_ADDRESS_LAND_RAISE_COST 0x009E2E1C
|
||||
#define RCT2_ADDRESS_LAND_LOWER_COST 0x009E2E20
|
||||
#define RCT2_ADDRESS_SELECTED_TERRAIN_EDGE 0x009E2E24
|
||||
#define RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE 0x009E2E25
|
||||
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_GHOST_X 0x009E32CC
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_GHOST_Y 0x009E32CE
|
||||
#define RCT2_ADDRESS_PARK_ENTRANCE_GHOST_Z 0x009E32D0
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -70,6 +70,11 @@ bool gClearSmallScenery;
|
||||
bool gClearLargeScenery;
|
||||
bool gClearFootpath;
|
||||
|
||||
money32 gLandToolRaiseCost;
|
||||
money32 gLandToolLowerCost;
|
||||
uint8 gLandToolTerrainSurface;
|
||||
uint8 gLandToolTerrainEdge;
|
||||
|
||||
static void tiles_init();
|
||||
static void map_update_grass_length(int x, int y, rct_map_element *mapElement);
|
||||
static void map_set_grass_length(int x, int y, rct_map_element *mapElement, int length);
|
||||
|
||||
@@ -295,6 +295,11 @@ extern bool gClearSmallScenery;
|
||||
extern bool gClearLargeScenery;
|
||||
extern bool gClearFootpath;
|
||||
|
||||
extern money32 gLandToolRaiseCost;
|
||||
extern money32 gLandToolLowerCost;
|
||||
extern uint8 gLandToolTerrainSurface;
|
||||
extern uint8 gLandToolTerrainEdge;
|
||||
|
||||
void map_init(int size);
|
||||
void map_update_tile_pointers();
|
||||
rct_map_element *map_get_first_element_at(int x, int y);
|
||||
|
||||
Reference in New Issue
Block a user