diff --git a/src/peep/peep.c b/src/peep/peep.c index af548a298f..0f6a976b9a 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1367,7 +1367,7 @@ static void peep_update_ride_sub_state_2_enter_ride(rct_peep* peep, rct_ride* ri else{ ride->total_profit += ride->price; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME; - RCT2_GLOBAL(0x0141F56C, uint8) = 20; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 20; RCT2_GLOBAL(0xF1AEC0, uint32) = 230; RCT2_CALLPROC_X(0x0069926C, 0, ride->price, 0, 0, (int)peep, 0, 0); diff --git a/src/ride/ride.c b/src/ride/ride.c index 8c340cb58b..652bb184a0 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -3082,7 +3082,7 @@ void ride_music_update_final() /* rct2: 0x006B5559 */ void game_command_set_ride_setting(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) { - RCT2_GLOBAL(0x141F56C, uint8) = 4; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 4; uint8 ride_id = *edx & 0xFF; rct_ride* ride = GET_RIDE(ride_id); @@ -3902,7 +3902,7 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e rideIndex = *edx & 0xFF; targetStatus = (*edx >> 8) & 0xFF; - RCT2_GLOBAL(0x0141F56C, uint8) = 4; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 4; ride = GET_RIDE(rideIndex); RCT2_GLOBAL(0x00F43484, uint32) = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32); @@ -4288,6 +4288,11 @@ void game_command_set_ride_appearance(int *eax, int *ebx, int *ecx, int *edx, in } *ebx = 0; } + +/** + * + * rct2: 0x006B53E9 + */ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp) { uint32 flags, shop_item; @@ -4310,7 +4315,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es //edx ride_number //ebp ride_type - RCT2_GLOBAL(0x141F56C, uint8) = 0x14; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 0x14; if (flags & 0x1) { if (!secondary_price) { shop_item = 0x1F; @@ -4323,7 +4328,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es } } // Check same price in park flags - if ((RCT2_GLOBAL(0x01358838, uint32) & (1 << (shop_item - (shop_item >= 0x20 ? 20 : 0)))) == 0) { + if ((shop_item < 32 ? RCT2_GLOBAL(0x01358838, uint32) & (1 << shop_item) : RCT2_GLOBAL(0x0135934C, uint32) & (1 << (shop_item - 32))) == 0) { ride->price = price; window_invalidate_by_class(WC_RIDE); return; @@ -4332,6 +4337,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es else { shop_item = ride_type->shop_item_secondary; if (shop_item == 0xFF) { + shop_item = RCT2_GLOBAL(0x0097D7CB + (ride->type * 4), uint8); if ((ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) == 0) { ride->price_secondary = price; window_invalidate_by_class(WC_RIDE); @@ -4339,7 +4345,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es } } // Check same price in park flags - if ((RCT2_GLOBAL(0x01358838, uint32) & (1 << (shop_item - (shop_item >= 0x20 ? 20 : 0)))) == 0) { + if ((shop_item < 32 ? RCT2_GLOBAL(0x01358838, uint32) & (1 << shop_item) : RCT2_GLOBAL(0x0135934C, uint32) & (1 << (shop_item - 32))) == 0) { ride->price_secondary = price; window_invalidate_by_class(WC_RIDE); return; @@ -4353,12 +4359,12 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es if (ride->type != RIDE_TYPE_TOILETS || shop_item != 0x1F) { if (ride_type->shop_item == shop_item) { ride->price = price; - window_invalidate_by_number(WC_RIDE, ride_number); + window_invalidate_by_number(WC_RIDE, count); } } else { ride->price = price; - window_invalidate_by_number(WC_RIDE, ride_number); + window_invalidate_by_number(WC_RIDE, count); } // If the shop item is the same or an on-ride photo if (ride_type->shop_item_secondary == shop_item || @@ -4366,7 +4372,7 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es (shop_item == 0x3 || shop_item == 0x20 || shop_item == 0x21 || shop_item == 0x22))) { ride->price_secondary = price; - window_invalidate_by_number(WC_RIDE, ride_number); + window_invalidate_by_number(WC_RIDE, count); } } count++; diff --git a/src/ride/track.c b/src/ride/track.c index df972c2ca3..290255e600 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -3209,7 +3209,7 @@ void game_command_place_track(int* eax, int* ebx, int* ecx, int* edx, int* esi, game_do_command_p(GAME_COMMAND_6, &_eax, &_ebx, &_ecx, &_edx, &_esi, &_edi, &_ebp); if (_ebx == MONEY32_UNDEFINED){ *ebx = MONEY32_UNDEFINED; - RCT2_GLOBAL(0x00141F56C, uint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 0; RCT2_GLOBAL(0x00F44121, money32) = MONEY32_UNDEFINED; return; } @@ -3243,7 +3243,7 @@ void game_command_place_track(int* eax, int* ebx, int* ecx, int* edx, int* esi, game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, rideIndex, GAME_COMMAND_7, 0, 0); *ebx = cost; RCT2_GLOBAL(0x00141E9AC, rct_string_id) = error_reason; - RCT2_GLOBAL(0x00141F56C, uint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 0; RCT2_GLOBAL(0x00F44121, money32) = cost; return; } @@ -3310,7 +3310,7 @@ void game_command_place_track(int* eax, int* ebx, int* ecx, int* edx, int* esi, ride_set_name(rideIndex, RCT2_ADDRESS(0x009E3504,const char)); - RCT2_GLOBAL(0x00141F56C, uint8) = 0; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 0; *ebx = RCT2_GLOBAL(0x00F44121, money32); *edi = rideIndex; } diff --git a/src/windows/ride.c b/src/windows/ride.c index ba2d5bee07..3954612577 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -5412,7 +5412,45 @@ static void window_ride_graphs_scrollpaint() */ static void window_ride_income_toggle_primary_price(rct_window *w) { - RCT2_CALLPROC_X(0x006ADEFD, 0, 0, 0, 0, (int)w, 0, 0); + rct_ride *ride; + rct_ride_type *ride_type; + uint32 newFlags, shop_item; + money16 price; + + ride = GET_RIDE(w->number); + ride_type = gRideTypeList[ride->subtype]; + + if (ride->type == RIDE_TYPE_TOILETS) { + shop_item = 0x1F; + } + else { + shop_item = ride_type->shop_item; + if (shop_item == 0xFFFF) + return; + } + if (shop_item == 0x3 || shop_item == 0x20 || shop_item == 0x21 || shop_item == 0x22) { + newFlags = RCT2_GLOBAL(0x01358838, uint32); + newFlags ^= (1 << 0x3); + game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + + newFlags = RCT2_GLOBAL(0x0135934C, uint32); + newFlags ^= (1 << 0x0) | (1 << 0x1) | (1 << 0x2); + game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + else { + if (shop_item < 32) { + newFlags = RCT2_GLOBAL(0x01358838, uint32); + newFlags ^= (1 << shop_item); + game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + else { + newFlags = RCT2_GLOBAL(0x0135934C, uint32); + newFlags ^= (1 << (shop_item - 32)); + game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + } + price = ride->price; + game_do_command(0, 1, 0, w->number, GAME_COMMAND_SET_RIDE_PRICE, price, 0); } /** @@ -5421,7 +5459,41 @@ static void window_ride_income_toggle_primary_price(rct_window *w) */ static void window_ride_income_toggle_secondary_price(rct_window *w) { - RCT2_CALLPROC_X(0x006AE06E, 0, 0, 0, 0, (int)w, 0, 0); + rct_ride *ride; + rct_ride_type *ride_type; + uint32 newFlags, shop_item; + money16 price; + + ride = GET_RIDE(w->number); + ride_type = gRideTypeList[ride->subtype]; + + shop_item = ride_type->shop_item_secondary; + if (shop_item == 0xFF) + shop_item = RCT2_GLOBAL(0x0097D7CB + (ride->type * 4), uint8); + + if (shop_item == 0x3 || shop_item == 0x20 || shop_item == 0x21 || shop_item == 0x22) { + newFlags = RCT2_GLOBAL(0x01358838, uint32); + newFlags ^= (1 << 0x3); + game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + + newFlags = RCT2_GLOBAL(0x0135934C, uint32); + newFlags ^= (1 << 0x0) | (1 << 0x1) | (1 << 0x2); + game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + else { + if (shop_item < 32) { + newFlags = RCT2_GLOBAL(0x01358838, uint32); + newFlags ^= (1 << shop_item); + game_do_command(0, 1, 0, (0x2 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + else { + newFlags = RCT2_GLOBAL(0x0135934C, uint32); + newFlags ^= (1 << (shop_item - 32)); + game_do_command(0, 1, 0, (0x3 << 8), GAME_COMMAND_SET_PARK_OPEN, newFlags, shop_item); + } + } + price = ride->price_secondary; + game_do_command(0, 1, 0, (1 << 8) | w->number, GAME_COMMAND_SET_RIDE_PRICE, price, 0); } /** diff --git a/src/world/footpath.c b/src/world/footpath.c index ffce750756..04e33da2c4 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -291,7 +291,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int { rct_map_element *mapElement; - RCT2_GLOBAL(0x0141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16; RCT2_GLOBAL(0x009DEA60, uint16) = y + 16; RCT2_GLOBAL(0x009DEA62, uint16) = z * 8; @@ -352,7 +352,7 @@ money32 footpath_remove_real(int x, int y, int z, int flags) { rct_map_element *mapElement; - RCT2_GLOBAL(0x0141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16; RCT2_GLOBAL(0x009DEA60, uint16) = y + 16; RCT2_GLOBAL(0x009DEA62, uint16) = z * 8; diff --git a/src/world/map.c b/src/world/map.c index 8d07e7b01a..753184a532 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -1298,7 +1298,7 @@ void game_command_clear_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi /* rct2: 0x00663CCD */ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surface_style, uint8 edge_style, uint8 flags) { - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; int x_mid, y_mid; @@ -1539,7 +1539,7 @@ void game_command_raise_land(int* eax, int* ebx, int* ecx, int* edx, int* esi, i } } } - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; RCT2_GLOBAL(0x009DEA5E, uint32) = x; RCT2_GLOBAL(0x009DEA60, uint32) = y; RCT2_GLOBAL(0x009DEA62, uint32) = z; @@ -1628,7 +1628,7 @@ void game_command_lower_land(int* eax, int* ebx, int* ecx, int* edx, int* esi, i } } } - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; RCT2_GLOBAL(0x009DEA5E, uint32) = x; RCT2_GLOBAL(0x009DEA60, uint32) = y; RCT2_GLOBAL(0x009DEA62, uint32) = z; @@ -1807,7 +1807,7 @@ void game_command_remove_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, uint8 base_height = (*edx >> 8); uint8 direction = *edx; - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; if(!(*ebx & 0x40) && RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) != 0){ RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; *ebx = MONEY32_UNDEFINED; @@ -1863,7 +1863,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, RCT2_GLOBAL(0x009DEA5E, uint32) = x + 16; RCT2_GLOBAL(0x009DEA60, uint32) = y + 16; RCT2_GLOBAL(0x009DEA62, uint32) = base_height * 16; - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; if(RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0){ if(sub_68B044() && x < 8192 && y < 8192){ rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); @@ -1938,7 +1938,7 @@ void game_command_place_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, */ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp) { - RCT2_GLOBAL(0x141F56C, uint8) = 12; + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12; int x = (uint16)*eax; int y = (uint16)*ecx; uint8 color2 = *edi >> 16;