diff --git a/src/audio/audio.c b/src/audio/audio.c index d50c1b4ab1..d46df9f61e 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -1764,10 +1764,10 @@ void audio_init2(int device) ride_music->rideid = -1; } } + + // Used by original code for directsound if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 1 << 4)) { - gConfigSound.forced_software_buffering = RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B78, uint32) || RCT2_GLOBAL(0x001425B74, uint32) != RCT2_GLOBAL(0x001425B7C, uint32); RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= 1 << 4; - config_save_default(); } // When all sound code is reversed this can be removed. @@ -1881,4 +1881,4 @@ void stop_vehicle_sounds() vehicle_sound->id = 0xFFFF; } } -} \ No newline at end of file +} diff --git a/src/config.c b/src/config.c index 3b67f62c26..9849a759d6 100644 --- a/src/config.c +++ b/src/config.c @@ -186,8 +186,6 @@ config_property_definition _interfaceDefinitions[] = { }; config_property_definition _soundDefinitions[] = { - { offsetof(sound_configuration, forced_software_buffering), "forced_software_buffering", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, - { offsetof(sound_configuration, sound_quality), "sound_quality", CONFIG_VALUE_TYPE_UINT8, 2, NULL }, { offsetof(sound_configuration, title_music), "title_music", CONFIG_VALUE_TYPE_UINT8, 2, NULL }, { offsetof(sound_configuration, sound), "sound", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, { offsetof(sound_configuration, ride_music), "ride_music", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, @@ -749,8 +747,9 @@ void config_apply_to_old_addresses() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = gConfigGeneral.measurement_format; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = gConfigGeneral.temperature_format; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = gConfigGeneral.construction_marker_colour; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = gConfigSound.sound_quality; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = gConfigSound.forced_software_buffering; + // Force best sound quality and software buffering, for original code. + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 2; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (gConfigGeneral.measurement_format + 1) * 256; if (gConfigGeneral.show_height_as_units) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; @@ -830,9 +829,9 @@ void config_dat_load() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= !CONFIG_FLAG_SAVE_PLUGIN_DATA; } - //sound configuration - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = gConfigSound.sound_quality; - RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = gConfigSound.forced_software_buffering; + //sound configuration: force software buffering and best quality + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = 2; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = 1; // Line below is temporaraly disabled until all config is in the new format. //if (RCT2_GLOBAL(0x009AB4C6, sint8) == 1) @@ -1389,4 +1388,4 @@ static theme_property_definition *themes_get_property_def(theme_section_definiti return NULL; } -#pragma endregion \ No newline at end of file +#pragma endregion diff --git a/src/config.h b/src/config.h index ce98146be4..cb75fbbdc5 100644 --- a/src/config.h +++ b/src/config.h @@ -89,13 +89,6 @@ enum { MEASUREMENT_FORMAT_METRIC }; -enum{ - SOUND_QUALITY_LOW, - SOUND_QUALITY_MEDIUM, - SOUND_QUALITY_HIGH - -}; - enum { AUTOSAVE_EVERY_WEEK, AUTOSAVE_EVERY_2_WEEKS, @@ -151,8 +144,6 @@ typedef struct { } interface_configuration; typedef struct { - sint8 forced_software_buffering; - sint8 sound_quality; uint8 title_music; uint8 sound; uint8 ride_music; diff --git a/src/diagnostic.h b/src/diagnostic.h index 4b63bb29c5..21029db312 100644 --- a/src/diagnostic.h +++ b/src/diagnostic.h @@ -53,6 +53,7 @@ void diagnostic_log_with_location(int diagnosticLevel, const char *file, const c #define log_error(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_ERROR, format, ## __VA_ARGS__) #define log_warning(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_WARNING, format, ## __VA_ARGS__) #define log_verbose(format, ...) diagnostic_log(DIAGNOSTIC_LEVEL_VERBOSE, format, ## __VA_ARGS__) +#define log_info(format, ...) diagnostic_log_macro(DIAGNOSTIC_LEVEL_INFORMATION, format, ## __VA_ARGS__) #endif diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 0eb9dbc32e..a0b460984b 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -1000,6 +1000,7 @@ enum { STR_CHEAT_HAPPY_GUESTS = 2764, STR_CHEAT_LARGE_TRAM_GUESTS = 2765, STR_CHEAT_NAUSEA = 5254, + STR_CHEAT_EXPLODE = 5285, // Misc. STR_CHEAT_FREEZE_CLIMATE = 2767, @@ -1032,6 +1033,7 @@ enum { STR_CHEAT_TIP_HAPPY_GUESTS = 2683, STR_CHEAT_TIP_LARGE_TRAM_GUESTS = 2684, STR_CHEAT_TIP_NAUSEA = 5255, + STR_CHEAT_TIP_EXPLODE = 5286, // Cheat tab tips STR_FINANCIAL_CHEATS_TIP = 5178, 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/peep/peep.h b/src/peep/peep.h index a9260f3cb0..837590b826 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -573,6 +573,7 @@ int peep_get_easteregg_name_id(rct_peep *peep); int peep_is_mechanic(rct_peep *peep); int peep_has_food(rct_peep* peep); void peep_sprite_remove(rct_peep* peep); +void peep_remove(rct_peep* peep); void peep_window_state_update(rct_peep* peep); void peep_decrement_num_riders(rct_peep* peep); diff --git a/src/ride/ride.c b/src/ride/ride.c index 7711c75350..4a6cc985d4 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/cheats.c b/src/windows/cheats.c index 58b5a10691..6254912de5 100644 --- a/src/windows/cheats.c +++ b/src/windows/cheats.c @@ -61,6 +61,7 @@ enum WINDOW_CHEATS_WIDGET_IDX { WIDX_HAPPY_GUESTS = 8, //Same as HIGH_MONEY as it is also the 8th widget but on a different page WIDX_TRAM_GUESTS, WIDX_NAUSEA_GUESTS, + WIDX_EXPLODE_GUESTS, WIDX_FREEZE_CLIMATE = 8, WIDX_OPEN_CLOSE_PARK, WIDX_ZERO_CLEARANCE, @@ -131,6 +132,7 @@ static rct_widget window_cheats_guests_widgets[] = { { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(1), HPL(1), STR_CHEAT_HAPPY_GUESTS, STR_NONE}, // happy guests { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(3), HPL(3), STR_CHEAT_LARGE_TRAM_GUESTS, STR_NONE}, // large tram { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(5), HPL(5), STR_CHEAT_NAUSEA, STR_NONE}, // nausea + { WWT_CLOSEBOX, 1, XPL(0), WPL(0), YPL(7), HPL(7), STR_CHEAT_EXPLODE, STR_NONE}, // explode guests { WIDGETS_END }, }; @@ -331,7 +333,7 @@ static void* window_cheats_page_events[] = { static uint32 window_cheats_page_enabled_widgets[] = { (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HIGH_MONEY) | (1 << WIDX_PARK_ENTRANCE_FEE), - (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS) | (1 << WIDX_NAUSEA_GUESTS), + (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_HAPPY_GUESTS) | (1 << WIDX_TRAM_GUESTS) | (1 << WIDX_NAUSEA_GUESTS) | (1 << WIDX_EXPLODE_GUESTS), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_FREEZE_CLIMATE) | (1 << WIDX_OPEN_CLOSE_PARK) | (1 << WIDX_ZERO_CLEARANCE) | (1 << WIDX_WEATHER_SUN) | (1 << WIDX_WEATHER_THUNDER) | (1 << WIDX_CLEAR_GRASS) | (1 << WIDX_MOWED_GRASS) | (1 << WIDX_WATER_PLANTS) | (1 << WIDX_FIX_VANDALISM) | (1 << WIDX_REMOVE_LITTER) | (1 << WIDX_WIN_SCENARIO) | (1 << WIDX_UNLOCK_ALL_PRICES) | (1 << WIDX_SANDBOX_MODE), (1 << WIDX_CLOSE) | (1 << WIDX_TAB_1) | (1 << WIDX_TAB_2) | (1 << WIDX_TAB_3) | (1 << WIDX_TAB_4) | (1 << WIDX_RENEW_RIDES) | (1 << WIDX_REMOVE_SIX_FLAGS) | (1 << WIDX_MAKE_DESTRUCTIBLE) | (1 << WIDX_FIX_ALL) | (1 << WIDX_FAST_LIFT_HILL) | (1 << WIDX_DISABLE_BRAKES_FAILURE) | (1 << WIDX_DISABLE_ALL_BREAKDOWNS) }; @@ -522,6 +524,20 @@ static void cheat_make_guests_nauseous() peep->flags |= PEEP_FLAGS_NAUSEA; } +static void cheat_explode_guests() +{ + int sprite_index; + rct_peep *peep; + + FOR_ALL_GUESTS(sprite_index, peep) { + unsigned int rand = scenario_rand(); + if ((rand & 0x07) == 0) { + peep->flags |= PEEP_FLAGS_EXPLODE; + } + } + +} + #pragma endregion void window_cheats_open() @@ -594,6 +610,9 @@ static void window_cheats_guests_mouseup() case WIDX_NAUSEA_GUESTS: cheat_make_guests_nauseous(); break; + case WIDX_EXPLODE_GUESTS: + cheat_explode_guests(); + break; } } @@ -781,6 +800,7 @@ static void window_cheats_paint() gfx_draw_string_left(dpi, STR_CHEAT_TIP_HAPPY_GUESTS, NULL, 0, w->x + XPL(0) + TXTO, w->y + YPL(0) + TXTO); gfx_draw_string_left(dpi, STR_CHEAT_TIP_LARGE_TRAM_GUESTS, NULL, 0, w->x + XPL(0) + TXTO, w->y + YPL(2) + TXTO); gfx_draw_string_left(dpi, STR_CHEAT_TIP_NAUSEA, NULL, 0, w->x + XPL(0) + TXTO, w->y + YPL(4) + TXTO); + gfx_draw_string_left(dpi, STR_CHEAT_TIP_EXPLODE, NULL, 0, w->x + XPL(0) + TXTO, w->y + YPL(6) + TXTO); } } diff --git a/src/windows/options.c b/src/windows/options.c index 676ea86fa2..20e790f22b 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -1047,9 +1047,6 @@ static void window_options_invalidate() // music: on/off RCT2_GLOBAL(0x013CE952 + 8, uint16) = STR_OFF + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8); - // sound quality: low/medium/high - RCT2_GLOBAL(0x013CE952 + 10, uint16) = STR_SOUND_LOW + gConfigSound.sound_quality; - widget_set_checkbox_value(w, WIDX_SOUND_CHECKBOX, gConfigSound.sound); widget_set_checkbox_value(w, WIDX_MUSIC_CHECKBOX, RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_MUSIC, uint8)); diff --git a/src/windows/ride.c b/src/windows/ride.c index 9fb8e75cf2..0b34992697 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -5530,7 +5530,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); } /** @@ -5539,7 +5577,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;