From a6225ebf06c3fc44dc74d8d88e8b6ea4d90f7d19 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 24 Jun 2015 12:41:19 +0200 Subject: [PATCH 1/2] Add option to select by track type (RCT1 style); correct misspellings of 'separate' --- data/language/english_uk.txt | 70 +++---- src/config.c | 2 +- src/config.h | 2 +- src/drawing/sprite.c | 4 +- src/localisation/localisation.c | 6 +- src/management/research.c | 34 ++-- src/management/research.h | 6 +- src/object.c | 26 ++- src/object_list.c | 2 +- src/platform/windows.c | 8 +- src/rct1.c | 279 ++++++++++++++++++++++++++- src/rct1.h | 5 +- src/ride/ride.h | 4 +- src/ride/track.c | 6 +- src/windows/editor_inventions_list.c | 44 ++--- src/windows/loadsave.c | 10 +- src/windows/new_ride.c | 39 +++- src/windows/options.c | 14 +- src/windows/research.c | 6 +- src/windows/ride.c | 6 +- src/windows/top_toolbar.c | 6 +- src/windows/track_list.c | 2 +- 22 files changed, 455 insertions(+), 126 deletions(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 186ed63a0e..fa2d6ccb63 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -513,31 +513,31 @@ STR_0508 : STR_0509 : STR_0510 : STR_0511 : -STR_0512 : -STR_0513 : +STR_0512 :A compact roller coaster with a spiral lift hill and smooth, twisting drops. +STR_0513 :A looping roller coaster where the riders ride in a standing position STR_0514 :Trains suspended beneath the roller coaster track swing out to the side around corners -STR_0515 : +STR_0515 :A steel roller coaster with trains that are held beneath the track, with many complex and twisting track elements STR_0516 :A gentle roller coaster for people who haven't yet got the courage to face the larger rides STR_0517 :Passengers ride in miniature trains along a narrow-gauge railway track STR_0518 :Passengers travel in electric trains along a monorail track STR_0519 :Passengers ride in small cars hanging beneath the single-rail track, swinging freely from side to side around corners -STR_0520 : -STR_0521 : -STR_0522 : +STR_0520 :A dock platform where guests can drive/row personal watercraft on a body of water +STR_0521 :A fast and twisting roller coaster with tight turns and steep drops. Intensity is bound to be high. +STR_0522 :A smaller roller coaster where the riders sit above the track with no car around them STR_0523 :Riders travel slowly in powered vehicles along a track-based route STR_0524 : -STR_0525 : -STR_0526 : +STR_0525 :Riders career down a twisting track guided only by the curvature and banking of the semi-circular track +STR_0526 :Freefall car is pneumatically launched up a tall steel tower and then allowed to freefall down STR_0527 :A smooth steel-tracked roller coaster capable of vertical loops -STR_0528 : -STR_0529 : +STR_0528 :Riders travel in inflatable dinghies down a twisting semi-circular or completely enclosed tube track +STR_0529 :Mine train themes roller coaster trains career along steel roller coaster track made to look like old railway track STR_0530 :Cars hang from a steel cable which runs continuously from one end of the ride to the other and back again -STR_0531 : +STR_0531 :A compact steel-tracked roller coaster where the train travels through corkscrews and loops STR_0532 : STR_0533 : -STR_0534 : -STR_0535 : -STR_0536 : +STR_0534 :Self-drive petrol-engined go karts +STR_0535 :Log-shaped boats travel along a water channel, splashing down steep slopes to soak the riders +STR_0536 :Circular boats meander along a wide water channel, splashing through waterfalls and thrilling riders through foaming rapids STR_0537 : STR_0538 : STR_0539 : @@ -556,14 +556,14 @@ STR_0551 : STR_0552 : STR_0553 : STR_0554 :The car is accelerated out of the station along a long level track using Linear Induction Motors, then heads straight up a vertical spike of track, freefalling back down to return to the station -STR_0555 : -STR_0556 : +STR_0555 :Guests ride in an elevator up or down a vertical tower to get from one level to another +STR_0556 :Extra-wide cars descend completely vertical sloped track for the ultimate freefall roller coaster experience STR_0557 : STR_0558 : STR_0559 : STR_0560 : STR_0561 : -STR_0562 : +STR_0562 :Powered cars travel along a multi-level track past spooky scenery and special effects STR_0563 :Sitting in comfortable trains with only simple lap restraints riders enjoy giant smooth drops and twisting track as well as plenty of 'air time' over the hills STR_0564 :Running on wooden track, this coaster is fast, rough, noisy, and gives an 'out of control' riding experience with plenty of 'air time' STR_0565 :A simple wooden roller coaster capable of only gentle slopes and turns, where the cars are only kept on the track by side friction wheels and gravity @@ -572,38 +572,38 @@ STR_0567 :Sitting in seats suspended either side of the track, riders are pit STR_0568 : STR_0569 :Riding in special harnesses below the track, riders experience the feeling of flight as they swoop through the air STR_0570 : -STR_0571 : -STR_0572 : -STR_0573 : -STR_0574 : +STR_0571 :Circular cars spin around as they travel along the zig-zagging wooden track +STR_0572 :Large capacity boats travel along a wide water channel, propelled up slopes by a conveyer belt, accelerating down steep slopes to soak the riders with a gaint splash +STR_0573 :Powered helicoper shaped cars running on a steel track, controlled by the pedalling of the riders +STR_0574 :Riders are held in special harnesses in a lying-down position, travlling through twisted track and inversions either on their backs or facing the ground STR_0575 :Powered trains hanging from a single rail transport people around the park STR_0576 : -STR_0577 : +STR_0577 :Bogied cars run on wooden tracks, turning around on special reversing sections STR_0578 :Cars run along track enclosed by circular hoops, traversing steep drops and heartline twists STR_0579 : -STR_0580 : -STR_0581 : +STR_0580 :A giant steel roller coaster capable of smooth drops and hills of over 300ft +STR_0581 :A ring of seats is pulled to the top of a tall tower while gently rotating, then allowed to free-fall down, stopping gently at the bottom using magnetic brakes STR_0582 : STR_0583 : -STR_0584 : -STR_0585 : +STR_0584 :Special bicycles run on a steel monorail track, propelled by the pedalling of the riders +STR_0585 :Riders sit in pairs of seats suspended beneath the track as they loop and twist through tight inversions STR_0586 :Boat shaped cars run on roller coaster track to allow twisting curves and steep drops, splashing down into sections of water for gentle river sections -STR_0587 : -STR_0588 : +STR_0587 :After an exhilarating air-powered launch, the train speeds up a vertical track, over the top, and vertically down the other side to return to the station +STR_0588 :Individual cars run beneath a zig-zagging track with hairpin turns and sharp drops STR_0589 : -STR_0590 : -STR_0591 : +STR_0590 :Riders ride in a submerged submarine through an underwater course +STR_0591 :Raft-shaped boats gently meander around a river track STR_0592 : STR_0593 : STR_0594 : STR_0595 : STR_0596 : STR_0597 : -STR_0598 : +STR_0598 :Inverted roller coaster trains are accelerated out of the station to travel up a vertical spike of track, then reverse back through the station to travel backwards up another vertical spike of track STR_0599 :A compact roller coaster with individual cars and smooth twisting drops -STR_0600 : +STR_0600 :Powered mine trains career along a smooth and twisted track layout STR_0601 : -STR_0602 : +STR_0602 :Roller coaster trains are accelerated out of the station by linear induction motors to speed through twisting inversions STR_0603 :Guest {INT32} STR_0604 :Guest {INT32} STR_0605 :Guest {INT32} @@ -3455,7 +3455,7 @@ STR_3446 :Cancel Patrol Area # New strings, cleaner STR_5120 :Show finances button on toolbar STR_5121 :Show research button on toolbar -STR_5122 :Show all vehicles sharing a track/ride type +STR_5122 :Select rides by track type (like in RCT1) STR_5123 :Renew rides STR_5124 :No Six Flags STR_5125 :All destructable @@ -3710,4 +3710,4 @@ STR_5373 :Name {STRINGID} STR_5374 :Date {STRINGID} STR_5375 :{UP} STR_5376 :{DOWN} -#Strings 5377-5440 Reserved \ No newline at end of file +#Strings 5377-5440 Reserved diff --git a/src/config.c b/src/config.c index 37f32c9b60..36a16999e3 100644 --- a/src/config.c +++ b/src/config.c @@ -188,7 +188,7 @@ config_property_definition _interfaceDefinitions[] = { { offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, { offsetof(interface_configuration, toolbar_show_cheats), "toolbar_show_cheats", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, - { offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, + { offsetof(interface_configuration, select_by_track_type), "select_by_track_type", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, console_small_font), "console_small_font", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, current_theme_preset), "current_theme", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL }, }; diff --git a/src/config.h b/src/config.h index 0ad455ff07..b7469a7ab9 100644 --- a/src/config.h +++ b/src/config.h @@ -159,7 +159,7 @@ typedef struct { uint8 toolbar_show_finances; uint8 toolbar_show_research; uint8 toolbar_show_cheats; - uint8 allow_subtype_switching; + uint8 select_by_track_type; uint8 console_small_font; utf8string current_theme_preset; } interface_configuration; diff --git a/src/drawing/sprite.c b/src/drawing/sprite.c index c5ddced9ed..8fee10a0c7 100644 --- a/src/drawing/sprite.c +++ b/src/drawing/sprite.c @@ -495,7 +495,7 @@ void gfx_draw_sprite_palette_set(rct_drawpixelinfo *dpi, int image_id, int x, in return; } - //Its used super often so we will define it to a seperate variable. + //Its used super often so we will define it to a separate variable. int zoom_level = dpi->zoom_level; int zoom_amount = 1 << zoom_level; int zoom_mask = 0xFFFFFFFF << zoom_level; @@ -649,4 +649,4 @@ void gfx_draw_sprite_palette_set(rct_drawpixelinfo *dpi, int image_id, int x, in gfx_bmp_sprite_to_buffer(palette_pointer, unknown_pointer, source_pointer, dest_pointer, g1_source, dpi, height, width, image_type); free(new_source_pointer_start); return; -} \ No newline at end of file +} diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index 01cb13e66c..2a950495bf 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -193,7 +193,7 @@ void format_comma_separated_integer(char **dest, long long value) // Groups of three digits, right to left groupIndex = 0; while (value > 0) { - // Append group seperator + // Append group separator if (groupIndex == 3) { groupIndex = 0; @@ -261,7 +261,7 @@ void format_comma_separated_fixed_2dp(char **dest, long long value) // Groups of three digits, right to left groupIndex = 0; while (value > 0) { - // Append group seperator + // Append group separator if (groupIndex == 3) { groupIndex = 0; @@ -781,4 +781,4 @@ int win1252_to_utf8(utf8string dst, const char *src, int maxBufferLength) // TODO this supports only a maximum of 512 characters MultiByteToWideChar(CP_ACP, 0, src, -1, intermediateBuffer, 512); return WideCharToMultiByte(CP_UTF8, 0, intermediateBuffer, -1, dst, maxBufferLength, NULL, NULL); -} \ No newline at end of file +} diff --git a/src/management/research.c b/src/management/research.c index 383c21750a..97539e8727 100644 --- a/src/management/research.c +++ b/src/management/research.c @@ -44,7 +44,7 @@ bool gSilentResearch = false; */ void research_reset_items() { - gResearchItems[0].entryIndex = RESEARCHED_ITEMS_SEPERATOR; + gResearchItems[0].entryIndex = RESEARCHED_ITEMS_SEPARATOR; gResearchItems[1].entryIndex = RESEARCHED_ITEMS_END; gResearchItems[2].entryIndex = RESEARCHED_ITEMS_END_2; } @@ -57,7 +57,7 @@ void research_update_uncompleted_types() { int uncompletedResearchTypes = 0; rct_research_item *researchItem = gResearchItems; - while (researchItem++->entryIndex != RESEARCHED_ITEMS_SEPERATOR); + while (researchItem++->entryIndex != RESEARCHED_ITEMS_SEPARATOR); for (; researchItem->entryIndex != RESEARCHED_ITEMS_END; researchItem++) uncompletedResearchTypes |= (1 << researchItem->category); @@ -115,7 +115,7 @@ static void research_next_design() // Skip already researched items firstUnresearchedItem = gResearchItems; - while (firstUnresearchedItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR) + while (firstUnresearchedItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR) firstUnresearchedItem++; ignoreActiveResearchTypes = 0; @@ -145,13 +145,13 @@ static void research_next_design() RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS, uint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) = RESEARCH_STAGE_DESIGNING; - // Bubble research item up until it is above the researched items seperator + // Bubble research item up until it is above the researched items separator do { tmp = *researchItem; *researchItem = *(researchItem - 1); *(researchItem - 1) = tmp; researchItem--; - } while ((researchItem + 1)->entryIndex != RESEARCHED_ITEMS_SEPERATOR); + } while ((researchItem + 1)->entryIndex != RESEARCHED_ITEMS_SEPARATOR); research_invalidate_related_windows(); } @@ -182,12 +182,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_SEPERATE_RIDE)) { + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) { for (i = 0; i < 128; i++) { rideEntry2 = GET_RIDE_ENTRY(i); if (rideEntry2 == (rct_ride_type*)-1) continue; - if (rideEntry2->flags & RIDE_ENTRY_FLAG_SEPERATE_RIDE) + if (rideEntry2->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) 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 +197,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_SEPERATE_RIDE_NAME ? + RCT2_GLOBAL(0x013CE952, rct_string_id) = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? rideEntry->name : base_ride_type + 2; if (!gSilentResearch) news_item_add_to_queue(NEWS_ITEM_RESEARCH, 2249, entryIndex); @@ -320,7 +320,7 @@ void sub_684AC3(){ } - for (research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_SEPERATOR; research++){ + for (research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_SEPARATOR; research++){ research_finish_item(research->entryIndex); } @@ -346,25 +346,25 @@ void research_remove_non_separate_vehicle_types() loopBeginning: if ( researchItem != gResearchItems && - researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR && + researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR && researchItem->entryIndex != RESEARCHED_ITEMS_END && researchItem->entryIndex >= 0x10000 ) { rct_ride_type *rideEntry = GET_RIDE_ENTRY(researchItem->entryIndex & 0xFF); if (!(rideEntry->flags & - (RIDE_ENTRY_FLAG_SEPERATE_RIDE | - RIDE_ENTRY_FLAG_SEPERATE_RIDE_NAME))) { + (RIDE_ENTRY_FLAG_SEPARATE_RIDE | + RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME))) { // Check if ride type already exists further up for a vehicle type that isn't displayed as a ride researchItem2 = researchItem - 1; do { if ( - researchItem2->entryIndex != RESEARCHED_ITEMS_SEPERATOR && + researchItem2->entryIndex != RESEARCHED_ITEMS_SEPARATOR && researchItem2->entryIndex >= 0x10000 ) { rideEntry = GET_RIDE_ENTRY(researchItem2->entryIndex & 0xFF); if (!(rideEntry->flags & - (RIDE_ENTRY_FLAG_SEPERATE_RIDE | - RIDE_ENTRY_FLAG_SEPERATE_RIDE_NAME))) { + (RIDE_ENTRY_FLAG_SEPARATE_RIDE | + RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME))) { if (((researchItem->entryIndex >> 8) & 0xFF) == ((researchItem2->entryIndex >> 8) & 0xFF)) { // Remove item @@ -418,7 +418,7 @@ static void research_insert_researched(int entryIndex, int category) researchItem = gResearchItems; do { - if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPERATOR) { + if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) { // Insert slot researchItem2 = researchItem; while (researchItem2->entryIndex != RESEARCHED_ITEMS_END_2) { @@ -551,4 +551,4 @@ void game_command_set_research_funding(int* eax, int* ebx, int* ecx, int* edx, i } *ebx = 0; -} \ No newline at end of file +} diff --git a/src/management/research.h b/src/management/research.h index f2a0d4b3f6..6d6de71a0e 100644 --- a/src/management/research.h +++ b/src/management/research.h @@ -35,8 +35,8 @@ enum{ }; // Everything before this point has been researched -#define RESEARCHED_ITEMS_SEPERATOR -1 -// Everything before this point and after seperator still requires research +#define RESEARCHED_ITEMS_SEPARATOR -1 +// Everything before this point and after separator still requires research #define RESEARCHED_ITEMS_END -2 // Extra end of list entry. Unsure why? #define RESEARCHED_ITEMS_END_2 -3 @@ -85,4 +85,4 @@ void research_finish_item(sint32 entryIndex); void research_insert(int researched, int entryIndex, int category); void research_remove(sint32 entryIndex); -#endif \ No newline at end of file +#endif diff --git a/src/object.c b/src/object.c index 7e6609ec78..74f41deaf3 100644 --- a/src/object.c +++ b/src/object.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "addresses.h" +#include "config.h" #include "localisation/localisation.h" #include "object.h" #include "platform/platform.h" @@ -425,6 +426,25 @@ int paint_ride_entry(int flags, int ebx, int ecx, int edx, rct_drawpixelinfo* dp uint8_t* chunk = (uint8*)(ride_type + 1); ride_type->name = object_get_localised_text(&chunk, ecx, ebx, 0); ride_type->description = object_get_localised_text(&chunk, ecx, ebx, 1); + + if(gConfigInterface.select_by_track_type) { + ride_type->enabledTrackPieces=0xFFFFFFFF; + ride_type->enabledTrackPiecesAdditional=0xFFFFFFFF; + + 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); // Offset to Unknown struct ride_type->var_1AE = (uint32_t)chunk; @@ -677,7 +697,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_SEPERATE_RIDE_NAME) di |= 0x1000000; + if (ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) di |= 0x1000000; RCT2_GLOBAL(0xF433DD, uint32) = di; return 0;// flags; @@ -755,7 +775,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_SEPERATE_RIDE_NAME)) + if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) { format_args = ride_type->ride_type[0]; if ((format_args & 0xFF) == 0xFF) @@ -1645,4 +1665,4 @@ char *object_get_name(rct_object_entry *entry) pos += 4; return pos; -} \ No newline at end of file +} diff --git a/src/object_list.c b/src/object_list.c index e1493345ac..ad62ae9ba7 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -735,7 +735,7 @@ 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_SEPERATE_RIDE_NAME)) { + if ((objectType == OBJECT_TYPE_RIDE) && !((((rct_ride_type*)chunk)->flags) & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) { 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/platform/windows.c b/src/platform/windows.c index db17d1ffbc..558fa62918 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -320,15 +320,15 @@ unsigned int platform_get_ticks() void platform_get_user_directory(char *outPath, const char *subDirectory) { - char seperator[2] = { platform_get_path_separator(), 0 }; + char separator[2] = { platform_get_path_separator(), 0 }; if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, outPath))) { - strcat(outPath, seperator); + strcat(outPath, separator); strcat(outPath, "OpenRCT2"); - strcat(outPath, seperator); + strcat(outPath, separator); if (subDirectory != NULL && subDirectory[0] != 0) { strcat(outPath, subDirectory); - strcat(outPath, seperator); + strcat(outPath, separator); } } else { outPath[0] = 0; diff --git a/src/rct1.c b/src/rct1.c index 3dfd27ca60..14dde13b05 100644 --- a/src/rct1.c +++ b/src/rct1.c @@ -25,6 +25,7 @@ #include "management/finance.h" #include "object.h" #include "rct1.h" +#include "ride/ride.h" #include "scenario.h" #include "util/sawyercoding.h" #include "util/util.h" @@ -438,7 +439,7 @@ static void rct1_reset_research() rct_research_item *researchItem; researchItem = gResearchItems; - researchItem->entryIndex = RESEARCHED_ITEMS_SEPERATOR; + researchItem->entryIndex = RESEARCHED_ITEMS_SEPARATOR; researchItem++; researchItem->entryIndex = RESEARCHED_ITEMS_END; researchItem++; @@ -1102,4 +1103,278 @@ static const RCT1DefaultObjectsGroup RCT1DefaultObjects[10] = { { RCT1DefaultObjectsWater, countof(RCT1DefaultObjectsWater) } }; -#pragma endregion \ No newline at end of file +// Keep these in the same order as gVehicleHierarchies +char *SpiralRCObjectOrder[] = { "SPDRCR "}; +char *StandupRCObjectOrder[] = { "TOGST "}; +char *SuspendedSWRCObjectOrder[] = { "ARRSW1 ", "VEKVAMP ", "ARRSW2 "}; +char *InvertedRCObjectOrder[] = { "NEMT "}; +char *JuniorCoasterObjectOrder[] = { "ZLDB ", "ZLOG "}; +char *MiniatureRailwayObjectOrder[] = { "NRL ", "NRL2 ", "AML1 ", "TRAM1 "}; +char *MonorailObjectOrder[] = { "MONO1 ", "MONO2 ", "MONO3 "}; +char *MiniSuspendedRCObjectOrder[] = { "BATFL ", "SKYTR "}; +char *BoatRideObjectOrder[] = { "RBOAT ", "BBOAT ", "CBOAT ", "SWANS ", "TRIKE ","JSKI "}; +char *WoodenWMObjectOrder[] = { "WMOUSE ", "WMMINE "}; +char *SteeplechaseObjectOrder[] = { "STEEP1 ", "STEEP2 ", "SBOX "}; +char *CarRideObjectOrder[] = { "RCR ", "SPCAR ", "TRUCK1 ", "VCR ", "CTCAR "}; +char *LaunchedFFObjectOrder[] = { "SSC1 "}; +char *BobsleighRCObjectOrder[] = { "BOB1 ", "INTBOB "}; +char *ObservationTowerObjectOrder[] = { "OBS1 ", "OBS2 "}; +char *LoopingRCObjectOrder[] = { "SCHT1 "}; +char *DinghySlideObjectOrder[] = { "DING1 "}; +char *MineTrainRCObjectOrder[] = { "AMT1 "}; +char *ChairliftObjectOrder[] = { "CLIFT1 ", "CLIFT2 "}; +char *CorkscrewRCObjectOrder[] = { "ARRT1 ", "ARRT2 "}; +char *GoKartsObjectOrder[] = { "KART1 "}; +char *LogFlumeObjectOrder[] = { "LFB1 "}; +char *RiverRapidsObjectOrder[] = { "RAPBOAT "}; +char *ReverseFreefallRCObjectOrder[]= { "REVF1 "}; +char *LiftObjectOrder[] = { "LIFT1 "}; +char *VerticalDropRCObjectOrder[] = { "BMVD "}; +char *GhostTrainObjectOrder[] = { "GTC ", "HMCAR "}; +char *TwisterRCObjectOrder[] = { "BMSD ", "BMSU ", "BMFL ", "BMRB ", "GOLTR "}; +char *WoodenRCObjectOrder[] = { "PTCT1 ", "MFT ", "PTCT2 "}; +char *SideFrictionRCObjectOrder[] = { "SFRIC1 "}; +char *SteelWildMouseObjectOrder[] = { "SMC1 ", "SMC2 ", "WMSPIN "}; +char *MultiDimensionRCObjectOrder[] = { "ARRX "}; +char *FlyingRCObjectOrder[] = { "BMAIR "}; +char *VirginiaReelRCObjectOrder[] = { "VREEL "}; +char *SplashBoatsObjectOrder[] = { "SPBOAT "}; +char *MiniHelicoptersObjectOrder[] = { "HELICAR "}; +char *LayDownRCObjectOrder[] = { "VEKST "}; +char *SuspendedMonorailObjectOrder[]= { "SMONO "}; +char *ReverserRCObjectOrder[] = { "REVCAR "}; +char *HeartlineTwisterObjectOrder[] = { "UTCAR ", "UTCARR "}; +char *GigaRCObjectOrder[] = { "INTST "}; +char *RotoDropObjectOrder[] = { "GDROP1 "}; +char *MonorailCyclesObjectOrder[] = { "MONBK "}; +char *CompactInvertedRCObjectOrder[]= { "SLCT ", "SLCFO ", "VEKDV "}; +char *WaterRCObjectOrder[] = { "CSTBOAT "}; +char *AirPoweredRCObjectOrder[] = { "THCAR "}; +char *InvertedHairpinRCObjectOrder[]= { "IVMC1 "}; +char *SubmarineRideObjectOrder[] = { "SUBMAR "}; +char *RiverRaftsObjectOrder[] = { "RFTBOAT "}; +char *InvertedImpulseRCObjectOrder[]= { "INTINV "}; +char *MiniRCObjectOrder[] = { "WCATC ", "RCKC ", "JSTAR1 "}; +char *MineRideRCObjectOrder[] = { "PMT1 "}; +char *LIMLaunchedRCObjectOrder[] = { "PREMT1 "}; + +char **gVehicleHierarchies[0x60] = { + SpiralRCObjectOrder, // 0 Spiral Roller coaster + StandupRCObjectOrder, // 1 Stand Up Coaster + SuspendedSWRCObjectOrder, // 2 Suspended Swinging + InvertedRCObjectOrder, // 3 Inverted + JuniorCoasterObjectOrder, // 4 Junior RC / Steel Mini Coaster + MiniatureRailwayObjectOrder, // 5 Mini Railroad + MonorailObjectOrder, // 6 Monorail + MiniSuspendedRCObjectOrder, // 7 Mini Suspended Coaster + BoatRideObjectOrder, // 8 Boat ride + WoodenWMObjectOrder, // 9 Wooden Wild Mine/Mouse + SteeplechaseObjectOrder, // a Steeplechase/Motorbike/Soap Box Derby + CarRideObjectOrder, // b Car Ride + LaunchedFFObjectOrder, // c Launched Freefall + BobsleighRCObjectOrder, // d Bobsleigh Coaster + ObservationTowerObjectOrder, // e Observation Tower + LoopingRCObjectOrder, // f Looping Roller Coaster + DinghySlideObjectOrder, // 10 Dinghy Slide + MineTrainRCObjectOrder, // 11 Mine Train Coaster + ChairliftObjectOrder, // 12 Chairlift + CorkscrewRCObjectOrder, // 13 Corkscrew Roller Coaster + NULL, // 14 Maze, N/A + NULL, // 15 Spiral Slide, N/A + GoKartsObjectOrder, // 16 Go Karts + LogFlumeObjectOrder, // 17 Log Flume + RiverRapidsObjectOrder, // 18 River Rapids + NULL, // 19 Dodgems, N/A + NULL, // 1a Pirate Ship, N/A + NULL, // 1b Swinging Inverter Ship, N/A + NULL, // 1c Food Stall, N/A + NULL, // 1d (none), N/A + NULL, // 1e Drink Stall, N/A + NULL, // 1f (none), N/A + NULL, // 20 Shop (all types), N/A + NULL, // 21 Merry Go Round, N/A + NULL, // 22 Balloon Stall (maybe), N/A + NULL, // 23 Information Kiosk, N/A + NULL, // 24 Bathroom, N/A + NULL, // 25 Ferris Wheel, N/A + NULL, // 26 Motion Simulator, N/A + NULL, // 27 3D Cinema, N/A + NULL, // 28 Top Spin, N/A + NULL, // 29 Space Rings, N/A + ReverseFreefallRCObjectOrder, // 2a Reverse Freefall Coaster + LiftObjectOrder, // 2b Lift + VerticalDropRCObjectOrder, // 2c Vertical Drop Roller Coaster + NULL, // 2d ATM, N/A + NULL, // 2e Twist, N/A + NULL, // 2f Haunted House, N/A + NULL, // 30 First Aid, N/A + NULL, // 31 Circus Show, N/A + GhostTrainObjectOrder, // 32 Ghost Train + TwisterRCObjectOrder, // 33 Twister Roller Coaster + WoodenRCObjectOrder, // 34 Wooden Roller Coaster + SideFrictionRCObjectOrder, // 35 Side-Friction Roller Coaster + SteelWildMouseObjectOrder, // 36 Steel Wild Mouse + MultiDimensionRCObjectOrder, // 37 Multi Dimension Coaster + NULL, // 38 (none), N/A + FlyingRCObjectOrder, // 39 Flying Roller Coaster + NULL, // 3a (none), N/A + VirginiaReelRCObjectOrder, // 3b Virginia Reel + SplashBoatsObjectOrder, // 3c Splash Boats + MiniHelicoptersObjectOrder, // 3d Mini Helicopters + LayDownRCObjectOrder, // 3e Lay-down Roller Coaster + SuspendedMonorailObjectOrder, // 3f Suspended Monorail + NULL, // 40 (none), N/A + ReverserRCObjectOrder, // 41 Reverser Roller Coaster + HeartlineTwisterObjectOrder, // 42 Heartline Twister Roller Coaster + NULL, // 43 Mini Golf, N/A + GigaRCObjectOrder, // 44 Giga Coaster + RotoDropObjectOrder, // 45 Roto-Drop + NULL, // 46 Flying Saucers, N/A + NULL, // 47 Crooked House, N/A + MonorailCyclesObjectOrder, // 48 Monorail Cycles + CompactInvertedRCObjectOrder, // 49 Compact Inverted Coaster + WaterRCObjectOrder, // 4a Water Coaster + AirPoweredRCObjectOrder, // 4b Air Powered Vertical Coaster + InvertedHairpinRCObjectOrder, // 4c Inverted Hairpin Coaster + NULL, // 4d Magic Carpet, N/A + SubmarineRideObjectOrder, // 4e Submarine Ride + RiverRaftsObjectOrder, // 4f River Rafts + NULL, // 50 (none), N/A + NULL, // 51 Enterprise, N/A + NULL, // 52 (none), N/A + NULL, // 53 (none), N/A + NULL, // 54 (none), N/A + NULL, // 55 (none), N/A + InvertedImpulseRCObjectOrder, // 56 Inverted Impulse Coaster + MiniRCObjectOrder, // 57 Mini Roller Coaster + MineRideRCObjectOrder, // 58 Mine Ride + NULL, // 59 Unknown Ride + LIMLaunchedRCObjectOrder, // 60 LIM Launched Roller Coaster +}; + +const uint8 gRideCategories[0x60] = { + 2, // Spiral Roller coaster + 2, // Stand Up Coaster + 2, // Suspended Swinging + 2, // Inverted + 2, // Steel Mini Coaster + 0, // Mini Railroad + 0, // Monorail + 2, // Mini Suspended Coaster + 4, // Boat ride + 2, // Wooden Wild Mine/Mouse + 2, // Steeplechase/Motorbike/Soap Box Derby + 1, // Car Ride + 3, // Launched Freefall + 2, // Bobsleigh Coaster + 1, // Observation Tower + 2, // Looping Roller Coaster + 4, // Dinghy Slide + 2, // Mine Train Coaster + 0, // Chairlift + 2, // Corkscrew Roller Coaster + 1, // Maze + 1, // Spiral Slide + 3, // Go Karts + 4, // Log Flume + 4, // River Rapids + 1, // Dodgems + 3, // Pirate Ship + 3, // Swinging Inverter Ship + 5, // Food Stall + 255, // (none) + 5, // Drink Stall + 255, // (none) + 5, // Shop (all types) + 1, // Merry Go Round + 5, // Balloon Stall (maybe) + 5, // Information Kiosk + 5, // Bathroom + 1, // Ferris Wheel + 3, // Motion Simulator + 3, // 3D Cinema + 3, // Top Spin + 1, // Space Rings + 2, // Reverse Freefall Coaster + 0, // Elevator + 2, // Vertical Drop Roller Coaster + 5, // ATM + 3, // Twist + 1, // Haunted House + 5, // First Aid + 1, // Circus Show + 1, // Ghost Train + 2, // Twister Roller Coaster + 2, // Wooden Roller Coaster + 2, // Side-Friction Roller Coaster + 2, // Wild Mouse + 2, // Multi Dimension Coaster + 255, // (none) + 2, // Flying Roller Coaster + 255, // (none) + 2, // Virginia Reel + 4, // Splash Boats + 1, // Mini Helicopters + 2, // Lay-down Roller Coaster + 0, // Suspended Monorail + 255, // (none) + 2, // Reverser Roller Coaster + 2, // Heartline Twister Roller Coaster + 1, // Mini Golf + 2, // Giga Coaster + 3, // Roto-Drop + 1, // Flying Saucers + 1, // Crooked House + 1, // Monorail Cycles + 2, // Compact Inverted Coaster + 2, // Water Coaster + 2, // Air Powered Vertical Coaster + 2, // Inverted Hairpin Coaster + 3, // Magic Carpet + 4, // Submarine Ride + 4, // River Rafts + 255, // (none) + 3, // Enterprise + 255, // (none) + 255, // (none) + 255, // (none) + 255, // (none) + 2, // Inverted Impulse Coaster + 2, // Mini Roller Coaster + 2, // Mine Ride + 255, //59 Unknown Ride + 2 // LIM Launched Roller Coaster +}; + +/* This function keeps a list of the preferred vehicle for every generic track type, out of the available vehicle types in the current game. + It determines which picture is shown on the new ride tab and which train type is selected by default.*/ +bool vehicleIsHigherInHierarchy(int track_type, char *currentVehicleName, char *comparedVehicleName) +{ + if(currentVehicleName==NULL || comparedVehicleName==NULL || gVehicleHierarchies[track_type]==NULL) { + return false; + } + + int currentVehicleHierarchy; + int comparedVehicleHierarchy; + + currentVehicleHierarchy=255; + comparedVehicleHierarchy=255; + + for(int i=0;iflags & - (RIDE_ENTRY_FLAG_SEPERATE_RIDE_NAME | - RIDE_ENTRY_FLAG_SEPERATE_RIDE)) + (RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME | + RIDE_ENTRY_FLAG_SEPARATE_RIDE)) 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_SEPERATE_RIDE)){ + if (!(ride_type->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){ item.entry_index = 0xFF; } } diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index de90fbf90b..cc5dd47865 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -198,14 +198,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_SEPERATE_RIDE)){ + if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){ 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_SEPERATE_RIDE) + if (master_ride->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) continue; // If master ride not in use @@ -291,7 +291,7 @@ static void sub_685A79() research++){ // Clear the always researched flags. - if (research->entryIndex > RESEARCHED_ITEMS_SEPERATOR){ + if (research->entryIndex > RESEARCHED_ITEMS_SEPARATOR){ research->entryIndex &= 0x00FFFFFF; } } @@ -318,7 +318,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_SEPERATE_RIDE_NAME) + if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) return rideEntry->name; return ((researchItem >> 8) & 0xFF) + 2; @@ -334,7 +334,7 @@ static void research_items_shuffle() int i, ri, numNonResearchedItems; // Skip pre-researched items - for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) {} + for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) {} researchItem++; researchOrderBase = researchItem; @@ -362,19 +362,19 @@ static void research_items_make_all_unresearched() int sorted; do { sorted = 1; - for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) { + for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) { if (research_item_is_always_researched(researchItem)) continue; nextResearchItem = researchItem + 1; - if (nextResearchItem->entryIndex == RESEARCHED_ITEMS_SEPERATOR || research_item_is_always_researched(nextResearchItem)) { - // Bubble up always researched item or seperator + if (nextResearchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR || research_item_is_always_researched(nextResearchItem)) { + // Bubble up always researched item or separator researchItemTemp = *researchItem; *researchItem = *nextResearchItem; *nextResearchItem = researchItemTemp; sorted = 0; - if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPERATOR) + if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) break; } } @@ -385,12 +385,12 @@ static void research_items_make_all_researched() { rct_research_item *researchItem, researchItemTemp; - // Find seperator - for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) { } + // Find separator + for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) { } - // Move seperator below all items + // Move separator below all items for (; (researchItem + 1)->entryIndex != RESEARCHED_ITEMS_END; researchItem++) { - // Swap seperator with research item + // Swap separator with research item researchItemTemp = *researchItem; *researchItem = *(researchItem + 1); *(researchItem + 1) = researchItemTemp; @@ -450,11 +450,11 @@ static rct_research_item *window_editor_inventions_list_get_item_from_scroll_y(i if (scrollIndex != 0) { // Skip pre-researched items - for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) { } + for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) { } researchItem++; } - for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR && researchItem->entryIndex != RESEARCHED_ITEMS_END; researchItem++) { + for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR && researchItem->entryIndex != RESEARCHED_ITEMS_END; researchItem++) { y -= 10; if (y < 0) return researchItem; @@ -475,11 +475,11 @@ static rct_research_item *window_editor_inventions_list_get_item_from_scroll_y_i if (scrollIndex != 0) { // Skip pre-researched items - for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) { } + for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) { } researchItem++; } - for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR && researchItem->entryIndex != RESEARCHED_ITEMS_END; researchItem++) { + for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR && researchItem->entryIndex != RESEARCHED_ITEMS_END; researchItem++) { y -= 10; if (y < 0) return researchItem; @@ -627,7 +627,7 @@ static void window_editor_inventions_list_scrollgetheight() height = 0; // Count / skip pre-researched items - for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) + for (researchItem = gResearchItems; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) height += 10; if (scrollIndex == 1) { @@ -794,7 +794,7 @@ static void window_editor_inventions_list_paint() researchItem = _editorInventionsListDraggedItem; if (researchItem == NULL) researchItem = WindowHighlightedItem(w); - // If the research item is null or a list seperator. + // If the research item is null or a list separator. if (researchItem == NULL || researchItem->entryIndex < 0) return; @@ -855,11 +855,11 @@ static void window_editor_inventions_list_scrollpaint() if (scrollIndex == 1) { // Skip pre-researched items - for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPERATOR; researchItem++) { } + for (; researchItem->entryIndex != RESEARCHED_ITEMS_SEPARATOR; researchItem++) { } researchItem++; researchItemEndMarker = RESEARCHED_ITEMS_END; } else { - researchItemEndMarker = RESEARCHED_ITEMS_SEPERATOR; + researchItemEndMarker = RESEARCHED_ITEMS_SEPARATOR; } // Since this is now a do while need to conteract the +10 @@ -886,7 +886,7 @@ static void window_editor_inventions_list_scrollpaint() colour = 14; } - if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPERATOR || researchItem->entryIndex == RESEARCHED_ITEMS_END) + if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR || researchItem->entryIndex == RESEARCHED_ITEMS_END) continue; if (researchItem == _editorInventionsListDraggedItem) diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c index 976bcf1e88..0d3e733e5c 100644 --- a/src/windows/loadsave.c +++ b/src/windows/loadsave.c @@ -508,19 +508,19 @@ static void shorten_path(char* path, char* buffer, int available_width){ return; } - // Count path seperators - int path_seperators = 0; + // Count path separators + int path_separators = 0; for (int x = 0; x < length; x++) if (path[x] == platform_get_path_separator()) - path_seperators++; + path_separators++; // TODO: Replace with unicode ellipsis when supported strcpy(buffer, "..."); - // Abreviate beginning with xth seperator + // Abreviate beginning with xth separator int begin = -1; - for (int x = 0; x < path_seperators; x++){ + for (int x = 0; x < path_separators; x++){ do { begin++; } while (path[begin] != platform_get_path_separator()); diff --git a/src/windows/new_ride.c b/src/windows/new_ride.c index 759486796d..df55ab7ef2 100644 --- a/src/windows/new_ride.c +++ b/src/windows/new_ride.c @@ -24,6 +24,8 @@ #include "../game.h" #include "../management/news_item.h" #include "../management/research.h" +#include "../object.h" +#include "../rct1.h" #include "../ride/ride.h" #include "../localisation/localisation.h" #include "../world/scenery.h" @@ -279,8 +281,9 @@ void window_new_ride_init_vars() { } /** + * rct2: 0x006B6F3E * - * rct2: 0x006B6F3E + * Note: When the user has selection by track type enabled, the categories are determined by the track type, not those in the rct_ride_type. */ static void window_new_ride_populate_list() { @@ -296,6 +299,14 @@ static void window_new_ride_populate_list() if (rideType == RIDE_TYPE_NULL) continue; + if(gConfigInterface.select_by_track_type) { + if(gRideCategories[rideType]!=currentCategory) + continue; + } + + char preferredVehicleName[9]; + strcpy(preferredVehicleName," "); + quadIndex = rideType >> 5; bitIndex = rideType & 0x1F; if (RCT2_ADDRESS(0x01357404, uint32)[quadIndex] & (1 << bitIndex)) { @@ -305,6 +316,9 @@ static void window_new_ride_populate_list() // For each ride entry for this ride type while (*rideEntryIndexPtr != 255) { uint8 rideEntryIndex = *rideEntryIndexPtr++; + char rideEntryName[9]; + memcpy(rideEntryName,object_entry_groups[OBJECT_TYPE_RIDE].entries[rideEntryIndex].name,8); + rideEntryName[8]=0; quadIndex = rideEntryIndex >> 5; bitIndex = rideEntryIndex & 0x1F; @@ -315,10 +329,27 @@ static void window_new_ride_populate_list() rct_ride_type *rideEntry = rideEntries[rideEntryIndex]; // Check if ride is in this category - if (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1]) + if (!gConfigInterface.select_by_track_type && (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1])) continue; - if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPERATE_RIDE) { + // 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(strcmp(preferredVehicleName," \0")==0) { + strcpy(preferredVehicleName,rideEntryName); + preferredVehicleName[8]=0; + } + else { + if(vehicleIsHigherInHierarchy(rideType,preferredVehicleName,rideEntryName)) { + strcpy(preferredVehicleName,rideEntryName); + preferredVehicleName[8]=0; + } + else { + continue; + } + } + } + + if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) { dh &= ~4; nextListItem->type = rideType; nextListItem->entry_index = rideEntryIndex; @@ -862,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_SEPERATE_RIDE_NAME)) { + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) { rideName = item.type + 2; rideDescription = item.type + 512; } diff --git a/src/windows/options.c b/src/windows/options.c index dc9da836c0..70da76fabd 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -119,7 +119,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_SAVE_PLUGIN_DATA_CHECKBOX, WIDX_AUTOSAVE, WIDX_AUTOSAVE_DROPDOWN, - WIDX_ALLOW_SUBTYPE_SWITCHING, + WIDX_SELECT_BY_TRACK_TYPE, WIDX_TEST_UNFINISHED_TRACKS, WIDX_AUTO_STAFF_PLACEMENT, WIDX_DEBUGGING_TOOLS, @@ -214,7 +214,7 @@ static rct_widget window_options_misc_widgets[] = { { WWT_CHECKBOX, 2, 10, 299, 69, 80, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP }, { WWT_DROPDOWN, 1, 155, 299, 83, 94, STR_NONE, STR_NONE }, { WWT_DROPDOWN_BUTTON, 1, 288, 298, 84, 93, 876, STR_NONE }, - { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5122, STR_NONE }, // allow subtype + { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5122, STR_NONE }, // select by track type { WWT_CHECKBOX, 2, 10, 299, 114, 125, 5155, 5156 }, // test unfinished tracks { WWT_CHECKBOX, 2, 10, 299, 129, 140, 5343, STR_NONE }, // auto staff placement { WWT_CHECKBOX, 2, 10, 299, 144, 155, 5150, STR_NONE }, // enabled debugging tools @@ -362,7 +362,7 @@ static uint32 window_options_page_enabled_widgets[] = { (1 << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) | (1 << WIDX_AUTOSAVE) | (1 << WIDX_AUTOSAVE_DROPDOWN) | - (1 << WIDX_ALLOW_SUBTYPE_SWITCHING) | + (1 << WIDX_SELECT_BY_TRACK_TYPE) | (1 << WIDX_TEST_UNFINISHED_TRACKS) | (1 << WIDX_AUTO_STAFF_PLACEMENT) | (1 << WIDX_DEBUGGING_TOOLS) | @@ -522,8 +522,8 @@ static void window_options_mouseup() case WINDOW_OPTIONS_PAGE_MISC: switch (widgetIndex) { - case WIDX_ALLOW_SUBTYPE_SWITCHING: - gConfigInterface.allow_subtype_switching ^= 1; + case WIDX_SELECT_BY_TRACK_TYPE: + gConfigInterface.select_by_track_type ^= 1; config_save_default(); window_invalidate(w); window_invalidate_by_class(WC_RIDE); @@ -1136,7 +1136,7 @@ static void window_options_invalidate() else window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; - widget_set_checkbox_value(w, WIDX_ALLOW_SUBTYPE_SWITCHING, gConfigInterface.allow_subtype_switching); + 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); widget_set_checkbox_value(w, WIDX_TEST_UNFINISHED_TRACKS, gConfigGeneral.test_unfinished_tracks); @@ -1147,7 +1147,7 @@ static void window_options_invalidate() window_options_misc_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_AUTOSAVE].type = WWT_DROPDOWN; window_options_misc_widgets[WIDX_AUTOSAVE_DROPDOWN].type = WWT_DROPDOWN_BUTTON; - window_options_misc_widgets[WIDX_ALLOW_SUBTYPE_SWITCHING].type = WWT_CHECKBOX; + window_options_misc_widgets[WIDX_SELECT_BY_TRACK_TYPE].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_TEST_UNFINISHED_TRACKS].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_AUTO_STAFF_PLACEMENT].type = WWT_CHECKBOX; window_options_misc_widgets[WIDX_DEBUGGING_TOOLS].type = WWT_CHECKBOX; diff --git a/src/windows/research.c b/src/windows/research.c index 2d6cdfdb81..4114e9b832 100644 --- a/src/windows/research.c +++ b/src/windows/research.c @@ -365,7 +365,7 @@ 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_SEPERATE_RIDE_NAME ? + stringId = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? rideEntry->name : (typeId & 0xFF00) + 2; } else { @@ -403,7 +403,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_SEPERATE_RIDE_NAME ? + stringId = rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME ? rideEntry->name : ((typeId >> 8) & 0xFF) + 2; @@ -669,4 +669,4 @@ static void window_research_draw_tab_images(rct_drawpixelinfo *dpi, rct_window * window_research_draw_tab_image(dpi, w, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0); } -#pragma endregion \ No newline at end of file +#pragma endregion diff --git a/src/windows/ride.c b/src/windows/ride.c index c84958848f..042966f4f4 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -2362,7 +2362,7 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi rideEntryIndex = *currentRideEntryIndex; currentRideEntry = GET_RIDE_ENTRY(rideEntryIndex); // Skip if vehicle has the same track type, but not same subtype, unless subtype switching is enabled - if ((currentRideEntry->flags & (RIDE_ENTRY_FLAG_SEPERATE_RIDE | RIDE_ENTRY_FLAG_SEPERATE_RIDE_NAME)) && !gConfigInterface.allow_subtype_switching) + if ((currentRideEntry->flags & (RIDE_ENTRY_FLAG_SEPARATE_RIDE | RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) && !gConfigInterface.select_by_track_type) continue; quadIndex = rideEntryIndex >> 5; @@ -2523,7 +2523,7 @@ static void window_ride_vehicle_invalidate() // Vehicle type window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].image = rideEntry->name; // Always show a dropdown button when changing subtypes is allowed - if ((var_496(w) <= 1 || (rideEntry->flags & RIDE_ENTRY_FLAG_SEPERATE_RIDE)) && !gConfigInterface.allow_subtype_switching) { + if ((var_496(w) <= 1 || (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)) && !gConfigInterface.select_by_track_type) { window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].type = WWT_14; window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_EMPTY; w->enabled_widgets &= ~(1 << WIDX_VEHICLE_TYPE); @@ -2597,7 +2597,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_SEPERATE_RIDE) && var_496(w) > 1) { + if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && var_496(w) > 1) { // Excitement Factor factor = rideEntry->excitement_multipler; if (factor > 0) { diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index a0f542daef..bf256a54a2 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -70,15 +70,15 @@ enum { typedef enum { DDIDX_LOAD_GAME = 0, DDIDX_SAVE_GAME = 1, - // seperator + // separator DDIDX_ABOUT = 3, DDIDX_OPTIONS = 4, DDIDX_SCREENSHOT = 5, DDIDX_GIANT_SCREENSHOT = 6, - // seperator + // separator DDIDX_QUIT_TO_MENU = 8, DDIDX_EXIT_OPENRCT2 = 9, - // seperator + // separator DDIDX_ENABLE_TWITCH = 11 } FILE_MENU_DDIDX; diff --git a/src/windows/track_list.c b/src/windows/track_list.c index 416d6db0e1..33a9f7759e 100644 --- a/src/windows/track_list.c +++ b/src/windows/track_list.c @@ -358,7 +358,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_SEPERATE_RIDE_NAME)) + if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)) stringId = _window_track_list_item.type + 2; RCT2_GLOBAL(0x013CE952, uint16) = stringId; From 13106dba0862d70a330362be10dadd4317c5c734 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Wed, 24 Jun 2015 13:22:10 +0200 Subject: [PATCH 2/2] Only allow changing the option for select-by-ride-type in the title screen, to prevent strange behaviour --- data/language/english_uk.txt | 1 + src/windows/options.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index fa2d6ccb63..4c6e9b01a0 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3711,3 +3711,4 @@ STR_5374 :Date {STRINGID} STR_5375 :{UP} STR_5376 :{DOWN} #Strings 5377-5440 Reserved +STR_5441 :{SMALLFONT}{BLACK}Identifies rides by track type,{NEWLINE}so vehicles can be changed{NEWLINE}afterwards, like in RCT1. Only{NEWLINE}toggleable in the title screen. diff --git a/src/windows/options.c b/src/windows/options.c index 70da76fabd..1222cfb96b 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -214,7 +214,7 @@ static rct_widget window_options_misc_widgets[] = { { WWT_CHECKBOX, 2, 10, 299, 69, 80, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP }, { WWT_DROPDOWN, 1, 155, 299, 83, 94, STR_NONE, STR_NONE }, { WWT_DROPDOWN_BUTTON, 1, 288, 298, 84, 93, 876, STR_NONE }, - { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5122, STR_NONE }, // select by track type + { WWT_CHECKBOX, 2, 10, 299, 99, 110, 5122, 5441 }, // select by track type { WWT_CHECKBOX, 2, 10, 299, 114, 125, 5155, 5156 }, // test unfinished tracks { WWT_CHECKBOX, 2, 10, 299, 129, 140, 5343, STR_NONE }, // auto staff placement { WWT_CHECKBOX, 2, 10, 299, 144, 155, 5150, STR_NONE }, // enabled debugging tools @@ -1136,6 +1136,10 @@ 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);