mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix clear scenery for network
This commit is contained in:
parent
04dedbcec4
commit
56f8954e27
|
@ -1653,13 +1653,11 @@ void top_toolbar_tool_update_scenery_clear(sint16 x, sint16 y){
|
|||
if (!state_changed)
|
||||
return;
|
||||
|
||||
money32 cost = map_clear_scenery(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16),
|
||||
0
|
||||
);
|
||||
int eax = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_X, sint16);
|
||||
int ecx = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, sint16);
|
||||
int edi = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16);
|
||||
int ebp = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16);
|
||||
money32 cost = game_do_command(eax, 0, ecx, 0, GAME_COMMAND_CLEAR_SCENERY, edi, ebp);
|
||||
|
||||
if (RCT2_GLOBAL(0x00F1AD62, money32) != cost){
|
||||
RCT2_GLOBAL(0x00F1AD62, money32) = cost;
|
||||
|
@ -2488,7 +2486,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),
|
||||
0,
|
||||
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
|
||||
GAME_COMMAND_CLEAR_SCENERY,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
||||
|
@ -2697,7 +2695,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),
|
||||
0,
|
||||
(gClearSmallScenery | gClearLargeScenery << 1 | gClearFootpath << 2),
|
||||
GAME_COMMAND_CLEAR_SCENERY,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, sint16),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, sint16)
|
||||
|
|
|
@ -1370,7 +1370,7 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
*
|
||||
* rct2: 0x0068DFE4
|
||||
*/
|
||||
money32 map_clear_scenery_from_tile(int x, int y, int flags)
|
||||
money32 map_clear_scenery_from_tile(int x, int y, int clear, int flags)
|
||||
{
|
||||
int type;
|
||||
money32 cost, totalCost;
|
||||
|
@ -1384,8 +1384,14 @@ restart_from_beginning:
|
|||
type = map_element_get_type(mapElement);
|
||||
switch (type) {
|
||||
case MAP_ELEMENT_TYPE_PATH:
|
||||
if (gClearFootpath) {
|
||||
cost = footpath_remove_real(x * 32, y * 32, mapElement->base_height, flags);
|
||||
if (clear & (1 << 2)) {
|
||||
int eax = x * 32;
|
||||
int ebx = flags;
|
||||
int ecx = y * 32;
|
||||
int edx = mapElement->base_height;
|
||||
int edi, ebp;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_PATH, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
||||
|
@ -1394,14 +1400,13 @@ restart_from_beginning:
|
|||
goto restart_from_beginning;
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY:
|
||||
if (gClearSmallScenery) {
|
||||
if (clear & (1 << 0)) {
|
||||
int eax = x * 32;
|
||||
int ebx = (mapElement->type << 8) | flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->properties.scenery.type << 8) | (mapElement->base_height);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_scenery(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
int edi, ebp;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_SCENERY, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -1412,14 +1417,13 @@ restart_from_beginning:
|
|||
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_FENCE:
|
||||
if (gClearSmallScenery) {
|
||||
if (clear & (1 << 0)) {
|
||||
int eax = x * 32;
|
||||
int ebx = flags;
|
||||
int ecx = y * 32;
|
||||
int edx = (mapElement->base_height << 8) | (mapElement->type & MAP_ELEMENT_DIRECTION_MASK);
|
||||
int esi, edi, ebp;
|
||||
game_command_remove_fence(&eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
cost = ebx;
|
||||
int edi, ebp;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_FENCE, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -1430,14 +1434,13 @@ restart_from_beginning:
|
|||
|
||||
} break;
|
||||
case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
|
||||
if (gClearLargeScenery) {
|
||||
if (clear & (1 << 1)) {
|
||||
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;
|
||||
int edi, ebp;
|
||||
cost = game_do_command(eax, ebx, ecx, edx, GAME_COMMAND_REMOVE_LARGE_SCENERY, edi, ebp);
|
||||
|
||||
if (cost == MONEY32_UNDEFINED)
|
||||
return MONEY32_UNDEFINED;
|
||||
|
@ -1454,7 +1457,7 @@ restart_from_beginning:
|
|||
return totalCost;
|
||||
}
|
||||
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags)
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags)
|
||||
{
|
||||
int x, y, z;
|
||||
money32 totalCost, cost;
|
||||
|
@ -1504,6 +1507,7 @@ void game_command_clear_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
(sint16)(*ecx & 0xFFFF),
|
||||
(sint16)(*edi & 0xFFFF),
|
||||
(sint16)(*ebp & 0xFFFF),
|
||||
*edx,
|
||||
*ebx & 0xFF
|
||||
);
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ int map_can_construct_with_clear_at(int x, int y, int zLow, int zHigh, void *cle
|
|||
int map_can_construct_at(int x, int y, int zLow, int zHigh, uint8 bl);
|
||||
void rotate_map_coordinates(sint16 *x, sint16 *y, int rotation);
|
||||
rct_xy16 coordinate_3d_to_2d(const rct_xyz16* coordinate_3d, int rotation);
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags);
|
||||
money32 map_clear_scenery(int x0, int y0, int x1, int y1, int clear, int flags);
|
||||
money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags);
|
||||
money32 map_place_fence(int type, int x, int y, int z, int edge, int primaryColour, int secondaryColour, int tertiaryColour, int flags);
|
||||
|
|
Loading…
Reference in New Issue