From c1400a12eb936cebf152848f07ef0931acecd723 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Mon, 20 Nov 2017 16:40:18 +0100 Subject: [PATCH] Allow separate ride and vehicle names per ride entry --- data/language/en-GB.txt | 25 ++++++++++++++++++++++ src/openrct2-ui/windows/NewRide.cpp | 4 ++++ src/openrct2-ui/windows/Ride.cpp | 19 +++++++++------- src/openrct2/localisation/LanguagePack.cpp | 1 + src/openrct2/management/Research.cpp | 4 ++++ src/openrct2/object/Object.cpp | 2 ++ src/openrct2/object/Object.h | 1 + src/openrct2/object/RideObject.cpp | 17 +++++++++++++++ src/openrct2/object/RideObject.h | 1 + src/openrct2/ride/ride.h | 4 ++++ 10 files changed, 70 insertions(+), 8 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 1079662b53..f857155dca 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4922,11 +4922,36 @@ STR_NAME :Top Spin STR_DESC :Passengers ride in a gondola suspended by large rotating arms, rotating forwards and backwards head-over-heels STR_CPTY :8 passengers +[BMSD] +STR_VEHN :Regular train + +[BMSU] +STR_VEHN :Stand-up train + +[BMFL] +STR_VEHN :Floorless train + +[WMMINE] +STR_VEHN :Mine cars + +[WMOUSE] +STR_VEHN :Mouse cars + +[STEEP1] +STR_VEHN :Horses + +[STEEP2] +STR_VEHN :Motorbikes + +[SBOX] +STR_VEHN :Soap boxes + #WW [CONDORRD] STR_NAME :Condor Ride STR_DESC :Riding in special harnesses below the track, riders experience the feeling of flight as they swoop through the air in Condor-shaped trains STR_CPTY :4 passengers per car +STR_VEHN :Condor train #WW [CONGAEEL] diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index e0b2d84445..c36d329746 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -1094,7 +1094,11 @@ static void window_new_ride_list_vehicles_for(const uint8 rideType, const rct_ri continue; } +#ifdef NO_RCT2 + const char * vehicleName = language_get_string(currentRideEntry->vehicleName); +#else const char * vehicleName = language_get_string(currentRideEntry->naming.name); +#endif if (numItems > 0) { diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index db059e2961..9a6d80d168 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2730,7 +2730,11 @@ static void window_ride_vehicle_mousedown(rct_window *w, rct_widgetindex widgetI selectedIndex = numItems; gDropdownItemsFormat[numItems] = STR_DROPDOWN_MENU_LABEL; +#ifdef NO_RCT2 + gDropdownItemsArgs[numItems] = (rideEntryIndex << 16) | currentRideEntry->vehicleName; +#else gDropdownItemsArgs[numItems] = (rideEntryIndex << 16) | currentRideEntry->naming.name; +#endif numItems++; } @@ -2826,7 +2830,11 @@ static void window_ride_vehicle_invalidate(rct_window *w) carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars; // Vehicle type +#ifdef NO_RCT2 + window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].text = rideEntry->vehicleName; +#else window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.name; +#endif // Always show a dropdown button when changing subtypes is allowed if ((rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) && !(gConfigInterface.select_by_track_type || gCheatsShowVehiclesFromOtherTrackTypes)) { window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].type = WWT_14; @@ -2922,14 +2930,9 @@ static void window_ride_vehicle_paint(rct_window *w, rct_drawpixelinfo *dpi) y += 5; // Capacity - void * loadedObject = object_manager_get_loaded_object_by_index(ride->subtype); - if (loadedObject != nullptr) - { - const utf8 * capacity = object_get_capacity(loadedObject); - set_format_arg(0, rct_string_id, STR_STRING); - set_format_arg(2, utf8 *, capacity); - gfx_draw_string_left(dpi, STR_CAPACITY, gCommonFormatArgs, COLOUR_BLACK, x, y); - } +#ifdef NO_RCT2 + gfx_draw_string_left(dpi, STR_CAPACITY, &rideEntry->capacity, COLOUR_BLACK, x, y); +#endif y += 5; if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE) || rideTypeShouldLoseSeparateFlag(rideEntry)) diff --git a/src/openrct2/localisation/LanguagePack.cpp b/src/openrct2/localisation/LanguagePack.cpp index ad6b1fee01..392ec3d727 100644 --- a/src/openrct2/localisation/LanguagePack.cpp +++ b/src/openrct2/localisation/LanguagePack.cpp @@ -569,6 +569,7 @@ public: if (String::Equals(identifier, "STR_NAME")) { stringId = 0; } else if (String::Equals(identifier, "STR_DESC")) { stringId = 1; } else if (String::Equals(identifier, "STR_CPTY")) { stringId = 2; } + else if (String::Equals(identifier, "STR_VEHN")) { stringId = 3; } else if (String::Equals(identifier, "STR_SCNR")) { stringId = 0; } else if (String::Equals(identifier, "STR_PARK")) { stringId = 1; } diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index 3f14e73d82..aa4f1512e0 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -292,7 +292,11 @@ void research_finish_item(uint32 entryIndex) rct_ride_name baseRideNaming = get_ride_naming(base_ride_type, rideEntry); set_format_arg(0, rct_string_id, baseRideNaming.name); +#ifdef NO_RCT2 + set_format_arg(2, rct_string_id, rideEntry->vehicleName); +#else set_format_arg(2, rct_string_id, rideEntry->naming.name); +#endif } } diff --git a/src/openrct2/object/Object.cpp b/src/openrct2/object/Object.cpp index 19ff6bddf0..8a593f813c 100644 --- a/src/openrct2/object/Object.cpp +++ b/src/openrct2/object/Object.cpp @@ -53,6 +53,8 @@ const utf8 * Object::GetString(uint8 index) const const utf8 * sz = GetOverrideString(index); if (sz == nullptr) { + // DAT objects do not contain separate ride and vehicle names + index = (index < OBJ_STRING_ID_VEHICLE_NAME) ? index : OBJ_STRING_ID_NAME; sz = GetStringTable()->GetString(index); } return sz != nullptr ? sz : ""; diff --git a/src/openrct2/object/Object.h b/src/openrct2/object/Object.h index 539cd7779d..a0e570a1b5 100644 --- a/src/openrct2/object/Object.h +++ b/src/openrct2/object/Object.h @@ -32,6 +32,7 @@ enum OBJ_STRING_ID OBJ_STRING_ID_PARK_NAME = 1, OBJ_STRING_ID_SCENARIO_DETAILS = 2, OBJ_STRING_ID_CAPACITY = 2, + OBJ_STRING_ID_VEHICLE_NAME = 3, }; interface IStream; diff --git a/src/openrct2/object/RideObject.cpp b/src/openrct2/object/RideObject.cpp index a12c1ba44e..7de634fffa 100644 --- a/src/openrct2/object/RideObject.cpp +++ b/src/openrct2/object/RideObject.cpp @@ -127,6 +127,10 @@ void RideObject::Load() GetStringTable()->Sort(); _legacyType.naming.name = language_allocate_object_string(GetName()); _legacyType.naming.description = language_allocate_object_string(GetDescription()); +#if defined(NO_RCT2) + _legacyType.capacity = language_allocate_object_string(GetCapacity()); + _legacyType.vehicleName = language_allocate_object_string(GetVehicleName()); +#endif _legacyType.images_offset = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount()); _legacyType.vehicle_preset_list = &_presetColours; @@ -302,10 +306,18 @@ void RideObject::Unload() { language_free_object_string(_legacyType.naming.name); language_free_object_string(_legacyType.naming.description); +#ifdef NO_RCT2 + language_free_object_string(_legacyType.capacity); + language_free_object_string(_legacyType.vehicleName); +#endif gfx_object_free_images(_legacyType.images_offset, GetImageTable()->GetCount()); _legacyType.naming.name = 0; _legacyType.naming.description = 0; +#ifdef NO_RCT2 + _legacyType.capacity = 0; + _legacyType.vehicleName = 0; +#endif _legacyType.images_offset = 0; } @@ -333,6 +345,11 @@ const utf8 * RideObject::GetCapacity() const return GetString(OBJ_STRING_ID_CAPACITY); } +const utf8 * RideObject::GetVehicleName() const +{ + return GetString(OBJ_STRING_ID_VEHICLE_NAME); +} + void RideObject::SetRepositoryItem(ObjectRepositoryItem * item) const { for (sint32 i = 0; i < RCT2_MAX_RIDE_TYPES_PER_RIDE_ENTRY; i++) diff --git a/src/openrct2/object/RideObject.h b/src/openrct2/object/RideObject.h index 97752303f2..34cfb4935b 100644 --- a/src/openrct2/object/RideObject.h +++ b/src/openrct2/object/RideObject.h @@ -44,6 +44,7 @@ public: const utf8 * GetDescription() const; const utf8 * GetCapacity() const; + const utf8 * GetVehicleName() const; void SetRepositoryItem(ObjectRepositoryItem * item) const override; diff --git a/src/openrct2/ride/ride.h b/src/openrct2/ride/ride.h index b943d68a11..0992de2eb5 100644 --- a/src/openrct2/ride/ride.h +++ b/src/openrct2/ride/ride.h @@ -125,6 +125,10 @@ typedef struct rct_ride_entry { uint8 category[RCT2_MAX_CATEGORIES_PER_RIDE]; // 0x1BE uint8 shop_item; // 0x1C0 uint8 shop_item_secondary; // 0x1C1 +#if defined(NO_RCT2) + rct_string_id capacity; + rct_string_id vehicleName; +#endif } rct_ride_entry; #if defined(PLATFORM_32BIT) && !defined(NO_RCT2) assert_struct_size(rct_ride_entry, 0x1c2);