1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Allow separate ride and vehicle names per ride entry

This commit is contained in:
Michael Steenbeek
2017-11-20 16:40:18 +01:00
parent 76dc490fca
commit c1400a12eb
10 changed files with 70 additions and 8 deletions

View File

@@ -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]

View File

@@ -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)
{

View File

@@ -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))

View File

@@ -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; }

View File

@@ -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
}
}

View File

@@ -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 : "";

View File

@@ -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;

View File

@@ -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++)

View File

@@ -44,6 +44,7 @@ public:
const utf8 * GetDescription() const;
const utf8 * GetCapacity() const;
const utf8 * GetVehicleName() const;
void SetRepositoryItem(ObjectRepositoryItem * item) const override;

View File

@@ -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);