diff --git a/src/management/research.c b/src/management/research.c index 97539e8727..2c348274d0 100644 --- a/src/management/research.c +++ b/src/management/research.c @@ -27,6 +27,7 @@ #include "../world/scenery.h" #include "news_item.h" #include "research.h" +#include "../rct1.h" const int _researchRate[] = { 0, 160, 250, 400 }; @@ -182,12 +183,12 @@ void research_finish_item(sint32 entryIndex) RCT2_ADDRESS(0x01357644, uint32)[ebx] = RCT2_ADDRESS(0x0097C5D4, uint32)[ebx]; } RCT2_ADDRESS(0x001357424, uint32)[rideEntryIndex >> 5] |= 1 << (rideEntryIndex & 0x1F); - if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) { + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry)) { for (i = 0; i < 128; i++) { rideEntry2 = GET_RIDE_ENTRY(i); if (rideEntry2 == (rct_ride_type*)-1) continue; - if (rideEntry2->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) + if ((rideEntry2->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !rideTypeShouldLoseSeparateFlag(rideEntry2)) continue; if (rideEntry2->ride_type[0] == base_ride_type || rideEntry2->ride_type[1] == base_ride_type || rideEntry2->ride_type[2] == base_ride_type) @@ -197,7 +198,7 @@ void research_finish_item(sint32 entryIndex) // I don't think 0x009AC06C is ever not 0, so probably redundant if (RCT2_GLOBAL(0x009AC06C, uint8) == 0) { - RCT2_GLOBAL(0x013CE952, rct_string_id) = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? + RCT2_GLOBAL(0x013CE952, rct_string_id) = ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) && !rideTypeShouldLoseSeparateFlag(rideEntry)) ? rideEntry->name : base_ride_type + 2; if (!gSilentResearch) news_item_add_to_queue(NEWS_ITEM_RESEARCH, 2249, entryIndex); @@ -351,9 +352,7 @@ void research_remove_non_separate_vehicle_types() researchItem->entryIndex >= 0x10000 ) { rct_ride_type *rideEntry = GET_RIDE_ENTRY(researchItem->entryIndex & 0xFF); - if (!(rideEntry->flags & - (RIDE_ENTRY_FLAG_SEPARATE_RIDE | - RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME))) { + if (!(rideEntry->flags & (RIDE_ENTRY_FLAG_SEPARATE_RIDE | RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) || rideTypeShouldLoseSeparateFlag(rideEntry)) { // Check if ride type already exists further up for a vehicle type that isn't displayed as a ride researchItem2 = researchItem - 1; do { @@ -362,9 +361,7 @@ void research_remove_non_separate_vehicle_types() researchItem2->entryIndex >= 0x10000 ) { rideEntry = GET_RIDE_ENTRY(researchItem2->entryIndex & 0xFF); - if (!(rideEntry->flags & - (RIDE_ENTRY_FLAG_SEPARATE_RIDE | - RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME))) { + if (!(rideEntry->flags & (RIDE_ENTRY_FLAG_SEPARATE_RIDE | RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) || rideTypeShouldLoseSeparateFlag(rideEntry)) { if (((researchItem->entryIndex >> 8) & 0xFF) == ((researchItem2->entryIndex >> 8) & 0xFF)) { // Remove item diff --git a/src/object.c b/src/object.c index 040ce1b51a..add50ce5fe 100644 --- a/src/object.c +++ b/src/object.c @@ -31,6 +31,7 @@ #include "world/entrance.h" #include "world/scenery.h" #include "scenario.h" +#include "rct1.h" int object_load_entry(const char *path, rct_object_entry *outEntry) { @@ -427,21 +428,9 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp ride_type->name = object_get_localised_text(&chunk, ecx, ebx, 0); ride_type->description = object_get_localised_text(&chunk, ecx, ebx, 1); + //TODO: Move to its own function when ride construction window is merged. if(gConfigInterface.select_by_track_type) { ride_type->enabledTrackPieces = 0xFFFFFFFFFFFFFFFF; - - bool remove_flag=true; - for(int j=0;j<3;j++) - { - if(ride_type_has_flag(ride_type->ride_type[j], RIDE_TYPE_FLAG_FLAT_RIDE)) - remove_flag=false; - if(ride_type->ride_type[j]==RIDE_TYPE_MAZE || ride_type->ride_type[j]==RIDE_TYPE_MINI_GOLF) - remove_flag=false; - } - if (remove_flag) { - ride_type->flags &=~RIDE_ENTRY_FLAG_SEPARATE_RIDE; - ride_type->flags &=~RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME; - } } object_get_localised_text(&chunk, ecx, ebx, 2); @@ -696,7 +685,7 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp int di = ride_type->ride_type[0] | (ride_type->ride_type[1] << 8) | (ride_type->ride_type[2] << 16); - if (ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) di |= 0x1000000; + if ((ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) && !rideTypeShouldLoseSeparateFlag(ride_type)) di |= 0x1000000; RCT2_GLOBAL(0xF433DD, uint32) = di; return 0;// flags; @@ -774,7 +763,7 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp int width = w->x + w->width - x - 4; int format_args = ride_type->description; - if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) + if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(ride_type)) { format_args = ride_type->ride_type[0]; if ((format_args & 0xFF) == 0xFF) diff --git a/src/object_list.c b/src/object_list.c index ad62ae9ba7..2531b1c7ae 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -25,6 +25,7 @@ #include "ride/track.h" #include "util/sawyercoding.h" #include "game.h" +#include "rct1.h" #define OBJECT_ENTRY_GROUP_COUNT 11 #define OBJECT_ENTRY_COUNT 721 @@ -735,7 +736,8 @@ static uint32 install_object_entry(rct_object_entry* entry, rct_object_entry* in // When made of two parts i.e Wooden Roller Coaster (Dream Woodie Cars) - if ((objectType == OBJECT_TYPE_RIDE) && !((((rct_ride_type*)chunk)->flags) & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) { + if (((objectType == OBJECT_TYPE_RIDE) && !((((rct_ride_type*)chunk)->flags) & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) && + !rideTypeShouldLoseSeparateFlag((rct_ride_type*)chunk)) { rct_ride_type* ride_type = (rct_ride_type*)chunk; rct_string_id obj_string = ride_type->ride_type[0]; if (obj_string == 0xFF){ diff --git a/src/rct1.c b/src/rct1.c index 2bba73c0c2..da29a29f83 100644 --- a/src/rct1.c +++ b/src/rct1.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "addresses.h" +#include "config.h" #include "interface/viewport.h" #include "interface/window.h" #include "localisation/localisation.h" @@ -1377,4 +1378,20 @@ bool vehicleIsHigherInHierarchy(int track_type, char *currentVehicleName, char * return false; } +bool rideTypeShouldLoseSeparateFlag(rct_ride_type *ride) +{ + if(!gConfigInterface.select_by_track_type) + return false; + + bool remove_flag=true; + for(int j=0;j<3;j++) + { + if(ride_type_has_flag(ride->ride_type[j], RIDE_TYPE_FLAG_FLAT_RIDE)) + remove_flag=false; + if(ride->ride_type[j]==RIDE_TYPE_MAZE || ride->ride_type[j]==RIDE_TYPE_MINI_GOLF) + remove_flag=false; + } + return remove_flag; +} + #pragma endregion diff --git a/src/rct1.h b/src/rct1.h index e6f948873a..c28f087653 100644 --- a/src/rct1.h +++ b/src/rct1.h @@ -360,5 +360,6 @@ bool rct1_read_sv4(const char *path, rct1_s4 *s4); void rct1_import_s4(rct1_s4 *s4); void rct1_fix_landscape(); bool vehicleIsHigherInHierarchy(int track_type, char *currentVehicleName, char *comparedVehicleName); +bool rideTypeShouldLoseSeparateFlag(rct_ride_type *ride); #endif diff --git a/src/ride/track.c b/src/ride/track.c index b1c03c105a..0b83008901 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -36,6 +36,7 @@ #include "ride.h" #include "track.h" #include "track_data.h" +#include "../rct1.h" /** * @@ -345,9 +346,8 @@ void track_list_populate(ride_list_item item, uint8* track_list_cache){ } else{ if (find_object_in_entry_group(track_object, &entry_type, &entry_index)){ - if (GET_RIDE_ENTRY(entry_index)->flags & - (RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME | - RIDE_ENTRY_FLAG_SEPARATE_RIDE)) + if ((GET_RIDE_ENTRY(entry_index)->flags & (RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME | RIDE_ENTRY_FLAG_SEPARATE_RIDE)) && + !rideTypeShouldLoseSeparateFlag(GET_RIDE_ENTRY(entry_index))) continue; } else{ @@ -397,7 +397,7 @@ void track_load_list(ride_list_item item) if (item.type < 0x80){ rct_ride_type* ride_type = gRideTypeList[item.entry_index]; - if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){ + if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(ride_type)){ item.entry_index = 0xFF; } } diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index cc5dd47865..898e42f2b6 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -28,6 +28,7 @@ #include "../object.h" #include "../world/scenery.h" #include "../interface/themes.h" +#include "../rct1.h" #pragma region Widgets @@ -198,14 +199,14 @@ static void research_rides_setup(){ rct_ride_type* ride_entry = GET_RIDE_ENTRY(object_index); uint8 master_found = 0; - if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){ + if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(ride_entry)){ for (uint8 rideType = 0; rideType < object_entry_group_counts[OBJECT_TYPE_RIDE]; rideType++){ rct_ride_type* master_ride = GET_RIDE_ENTRY(rideType); if (master_ride == NULL || (uint32)master_ride == 0xFFFFFFFF) continue; - if (master_ride->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) + if (master_ride->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE && !rideTypeShouldLoseSeparateFlag(master_ride)) continue; // If master ride not in use @@ -318,7 +319,7 @@ static rct_string_id research_item_get_name(uint32 researchItem) if (rideEntry == NULL || rideEntry == (rct_ride_type*)0xFFFFFFFF) return 0; - if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) + if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME && !rideTypeShouldLoseSeparateFlag(rideEntry)) return rideEntry->name; return ((researchItem >> 8) & 0xFF) + 2; diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index df55ab7ef2..667897c1ba 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -333,7 +333,7 @@ static void window_new_ride_populate_list() continue; // Skip if the vehicle isn't the preferred vehicle for this generic track type - if(gConfigInterface.select_by_track_type && !(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) { + if(gConfigInterface.select_by_track_type && (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry))) { if(strcmp(preferredVehicleName," \0")==0) { strcpy(preferredVehicleName,rideEntryName); preferredVehicleName[8]=0; @@ -349,7 +349,7 @@ static void window_new_ride_populate_list() } } - if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) { + if ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !rideTypeShouldLoseSeparateFlag(rideEntry)) { dh &= ~4; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; @@ -893,7 +893,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli // Ride name and description rct_string_id rideName = rideEntry->name; rct_string_id rideDescription = rideEntry->description; - if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) { + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(rideEntry)) { rideName = item.type + 2; rideDescription = item.type + 512; } diff --git a/src/windows/options.c b/src/windows/options.c index f9e592a518..52cda609b7 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -541,6 +541,7 @@ static void window_options_mouseup() config_save_default(); window_invalidate(w); window_invalidate_by_class(WC_RIDE); + window_invalidate_by_class(WC_CONSTRUCT_RIDE); break; case WIDX_DEBUGGING_TOOLS: gConfigGeneral.debugging_tools ^= 1; @@ -1174,10 +1175,6 @@ static void window_options_invalidate() else window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; - // This option sets several flags on object load, only make it changeable in the titles to prevent strange New Ride list behaviour - if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)) - w->disabled_widgets |= (1ULL << WIDX_SELECT_BY_TRACK_TYPE); - widget_set_checkbox_value(w, WIDX_SELECT_BY_TRACK_TYPE, gConfigInterface.select_by_track_type); widget_set_checkbox_value(w, WIDX_REAL_NAME_CHECKBOX, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES); widget_set_checkbox_value(w, WIDX_SAVE_PLUGIN_DATA_CHECKBOX, gConfigGeneral.save_plugin_data); diff --git a/src/windows/research.c b/src/windows/research.c index 4114e9b832..f33641ae5e 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -31,6 +31,7 @@ #include "../world/scenery.h" #include "dropdown.h" #include "../interface/themes.h" +#include "../rct1.h" enum { WINDOW_RESEARCH_PAGE_DEVELOPMENT, @@ -365,9 +366,9 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_NEXT_RESEARCH_ITEM, uint32); if (typeId >= 0x10000) { rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*); - stringId = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? + stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ? rideEntry->name : - (typeId & 0xFF00) + 2; + ((typeId >> 8) & 0xFF) + 2; } else { stringId = g_scenerySetEntries[typeId]->name; } @@ -403,7 +404,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp if (typeId != 0xFFFFFFFF) { if (typeId >= 0x10000) { rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*); - stringId = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? + stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ? rideEntry->name : ((typeId >> 8) & 0xFF) + 2; diff --git a/src/windows/ride.c b/src/windows/ride.c index a5dfed63fe..b537a0d167 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -37,6 +37,7 @@ #include "../world/map.h" #include "../world/sprite.h" #include "dropdown.h" +#include "../rct1.h" #define var_496(w) RCT2_GLOBAL((int)w + 0x496, uint16) @@ -2597,7 +2598,7 @@ static void window_ride_vehicle_paint() gfx_draw_string_left(dpi, 3142, &stringId, 0, x, y); y += 15; - if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && var_496(w) > 1) { + if ((!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry)) && var_496(w) > 1) { // Excitement Factor factor = rideEntry->excitement_multipler; if (factor > 0) { diff --git a/src/windows/track_list.c b/src/windows/track_list.c index 33a9f7759e..d60afdfae5 100644 --- a/src/windows/track_list.c +++ b/src/windows/track_list.c @@ -29,6 +29,7 @@ #include "../sprites.h" #include "error.h" #include "../interface/themes.h" +#include "../rct1.h" enum { WIDX_BACKGROUND, @@ -358,7 +359,7 @@ static void window_track_list_invalidate() entry = GET_RIDE_ENTRY(_window_track_list_item.entry_index); stringId = entry->name; - if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) + if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry)) stringId = _window_track_list_item.type + 2; RCT2_GLOBAL(0x013CE952, uint16) = stringId;