mirror of https://github.com/OpenRCT2/OpenRCT2.git
Clean up ride naming
This commit is contained in:
parent
a24f2fba6a
commit
fa5ec031f1
|
@ -25,6 +25,7 @@
|
|||
#include <openrct2/input.h>
|
||||
#include <openrct2/interface/widget.h>
|
||||
#include <openrct2/localisation/localisation.h>
|
||||
#include <openrct2/management/research.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/util/util.h>
|
||||
#include <openrct2/world/scenery.h>
|
||||
|
@ -193,7 +194,8 @@ static void research_rides_setup(){
|
|||
gEditorSelectedObjects[OBJECT_TYPE_RIDE][ride->subtype] |= 1;
|
||||
}
|
||||
|
||||
for (rct_research_item* research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_END; research++){
|
||||
for (rct_research_item* research = gResearchItems; research->entryIndex != RESEARCHED_ITEMS_END; research++)
|
||||
{
|
||||
if (research->entryIndex & RESEARCH_ENTRY_FLAG_RIDE_ALWAYS_RESEARCHED)
|
||||
continue;
|
||||
|
||||
|
@ -201,15 +203,16 @@ static void research_rides_setup(){
|
|||
if ((research->entryIndex & 0xFFFFFF) < 0x10000)
|
||||
continue;
|
||||
|
||||
uint8 ride_base_type = (research->entryIndex >> 8) & 0xFF;
|
||||
uint8 ride_base_type = research_get_ride_base_type(research->entryIndex);
|
||||
|
||||
uint8 object_index = research->entryIndex & 0xFF;
|
||||
rct_ride_entry* ride_entry = get_ride_entry(object_index);
|
||||
|
||||
bool master_found = false;
|
||||
if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE)){
|
||||
|
||||
for (uint8 rideType = 0; rideType < object_entry_group_counts[OBJECT_TYPE_RIDE]; rideType++){
|
||||
if (!(ride_entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE))
|
||||
{
|
||||
for (uint8 rideType = 0; rideType < object_entry_group_counts[OBJECT_TYPE_RIDE]; rideType++)
|
||||
{
|
||||
rct_ride_entry* master_ride = get_ride_entry(rideType);
|
||||
if (master_ride == nullptr || (intptr_t)master_ride == -1)
|
||||
continue;
|
||||
|
@ -221,14 +224,17 @@ static void research_rides_setup(){
|
|||
if (!(gEditorSelectedObjects[OBJECT_TYPE_RIDE][rideType] & (1 << 0)))
|
||||
continue;
|
||||
|
||||
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++) {
|
||||
if (master_ride->ride_type[j] == ride_base_type) {
|
||||
for (uint8 j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
|
||||
{
|
||||
if (master_ride->ride_type[j] == ride_base_type)
|
||||
{
|
||||
master_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (master_found) {
|
||||
if (master_found)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -319,30 +325,6 @@ static void research_remove_flags()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068563D
|
||||
*/
|
||||
static rct_string_id research_item_get_name(uint32 researchItem)
|
||||
{
|
||||
if (researchItem < 0x10000) {
|
||||
rct_scenery_set_entry *sceneryEntry = get_scenery_group_entry(researchItem & 0xFF);
|
||||
if (sceneryEntry == nullptr || sceneryEntry == (rct_scenery_set_entry*)-1)
|
||||
return 0;
|
||||
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
|
||||
rct_ride_entry *rideEntry = get_ride_entry(researchItem & 0xFF);
|
||||
if (rideEntry == nullptr || rideEntry == (rct_ride_entry*)-1)
|
||||
return 0;
|
||||
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)
|
||||
return rideEntry->name;
|
||||
|
||||
return ((researchItem >> 8) & 0xFF) + 2;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00685A93
|
||||
|
|
|
@ -183,7 +183,7 @@ void research_finish_item(sint32 entryIndex)
|
|||
|
||||
if (entryIndex >= 0x10000) {
|
||||
// Ride
|
||||
sint32 base_ride_type = (entryIndex >> 8) & 0xFF;
|
||||
sint32 base_ride_type = research_get_ride_base_type(entryIndex);
|
||||
sint32 rideEntryIndex = entryIndex & 0xFF;
|
||||
rct_ride_entry *rideEntry = get_ride_entry(rideEntryIndex);
|
||||
|
||||
|
@ -232,13 +232,13 @@ void research_finish_item(sint32 entryIndex)
|
|||
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)
|
||||
{
|
||||
set_format_arg(0, rct_string_id, rideEntry->name);
|
||||
set_format_arg(0, rct_string_id, rideEntry->naming.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Makes sure the correct track name is displayed,
|
||||
// e.g. Hyper-Twister instead of Steel Twister.
|
||||
set_format_arg(0, rct_string_id, get_friendly_track_type_name(base_ride_type, rideEntry));
|
||||
set_format_arg(0, rct_string_id, research_get_friendly_base_ride_type_name(base_ride_type, rideEntry));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -247,7 +247,7 @@ void research_finish_item(sint32 entryIndex)
|
|||
if (!rideTypeShouldLoseSeparateFlag(rideEntry))
|
||||
{
|
||||
availabilityString = STR_NEWS_ITEM_RESEARCH_NEW_RIDE_AVAILABLE;
|
||||
set_format_arg(0, rct_string_id, rideEntry->name);
|
||||
set_format_arg(0, rct_string_id, rideEntry->naming.name);
|
||||
}
|
||||
// If a vehicle is the first to be invented for its ride group, show the ride group name.
|
||||
else if (!ride_type_was_invented_before || (ride_type_has_ride_groups(base_ride_type) && !ride_group_was_invented_before))
|
||||
|
@ -264,12 +264,14 @@ void research_finish_item(sint32 entryIndex)
|
|||
rct_ride_name baseRideNaming = get_ride_naming(base_ride_type, rideEntry);
|
||||
|
||||
set_format_arg(0, rct_string_id, baseRideNaming.name);
|
||||
set_format_arg(2, rct_string_id, rideEntry->name);
|
||||
set_format_arg(2, rct_string_id, rideEntry->naming.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gSilentResearch) {
|
||||
if (gConfigNotifications.ride_researched) {
|
||||
if (!gSilentResearch)
|
||||
{
|
||||
if (gConfigNotifications.ride_researched)
|
||||
{
|
||||
news_item_add_to_queue(NEWS_ITEM_RESEARCH, availabilityString, entryIndex);
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +442,7 @@ void research_remove_non_separate_vehicle_types()
|
|||
rideEntry = get_ride_entry(researchItem2->entryIndex & 0xFF);
|
||||
if (!(rideEntry->flags & (RIDE_ENTRY_FLAG_SEPARATE_RIDE | RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME))) {
|
||||
|
||||
if (((researchItem->entryIndex >> 8) & 0xFF) == ((researchItem2->entryIndex >> 8) & 0xFF)) {
|
||||
if (research_get_ride_base_type(researchItem->entryIndex) == research_get_ride_base_type(researchItem2->entryIndex)) {
|
||||
// Remove item
|
||||
researchItem2 = researchItem;
|
||||
do {
|
||||
|
@ -712,3 +714,76 @@ void reset_researched_ride_types_and_entries()
|
|||
gResearchedRideEntries[i] = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068563D
|
||||
*/
|
||||
rct_string_id research_item_get_name(uint32 researchItem)
|
||||
{
|
||||
if (researchItem >= 0x10000)
|
||||
{
|
||||
rct_ride_entry *rideEntry = get_ride_entry(researchItem & 0xFF);
|
||||
if (rideEntry == NULL || rideEntry == (rct_ride_entry*)-1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME)
|
||||
{
|
||||
return rideEntry->naming.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 baseRideType = research_get_ride_base_type(researchItem);
|
||||
// Makes sure the correct track name is displayed, e.g. Hyper-Twister instead of Steel Twister.
|
||||
return research_get_friendly_base_ride_type_name(baseRideType, rideEntry);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rct_scenery_set_entry *sceneryEntry = get_scenery_group_entry(researchItem & 0xFF);
|
||||
if (sceneryEntry == NULL || sceneryEntry == (rct_scenery_set_entry*)-1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return sceneryEntry->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8 research_get_ride_base_type(sint32 researchItem)
|
||||
{
|
||||
return (researchItem >> 8) & 0xFF;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the name of the base ride type or ride group, as seen in the research window.
|
||||
*/
|
||||
rct_string_id research_get_friendly_base_ride_type_name(uint8 trackType, rct_ride_entry * rideEntry)
|
||||
{
|
||||
if (!gConfigInterface.select_by_track_type)
|
||||
{
|
||||
if (trackType == RIDE_TYPE_TWISTER_ROLLER_COASTER)
|
||||
{
|
||||
return STR_HYPER_TWISTER_GROUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RideNaming[trackType].name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ride_type_has_ride_groups(trackType))
|
||||
{
|
||||
const ride_group * rideGroup = get_ride_group(trackType, rideEntry);
|
||||
return rideGroup->naming.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RideNaming[trackType].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define _RESEARCH_H_
|
||||
|
||||
#include "../common.h"
|
||||
#include "../ride/ride.h"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef struct rct_research_item {
|
||||
|
@ -118,6 +119,9 @@ bool track_piece_is_available_for_ride_type(uint8 rideType, sint32 trackType);
|
|||
bool scenery_is_invented(uint16 sceneryItem);
|
||||
void reset_researched_scenery_items();
|
||||
void reset_researched_ride_types_and_entries();
|
||||
rct_string_id research_item_get_name(uint32 researchItem);
|
||||
uint8 research_get_ride_base_type(sint32 researchItem);
|
||||
rct_string_id research_get_friendly_base_ride_type_name(uint8 trackType, rct_ride_entry * rideEntry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -127,8 +127,8 @@ void RideObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
|
|||
void RideObject::Load()
|
||||
{
|
||||
GetStringTable()->Sort();
|
||||
_legacyType.name = language_allocate_object_string(GetName());
|
||||
_legacyType.description = language_allocate_object_string(GetDescription());
|
||||
_legacyType.naming.name = language_allocate_object_string(GetName());
|
||||
_legacyType.naming.description = language_allocate_object_string(GetDescription());
|
||||
_legacyType.images_offset = gfx_object_allocate_images(GetImageTable()->GetImages(), GetImageTable()->GetCount());
|
||||
_legacyType.vehicle_preset_list = &_presetColours;
|
||||
|
||||
|
@ -302,12 +302,12 @@ void RideObject::Load()
|
|||
|
||||
void RideObject::Unload()
|
||||
{
|
||||
language_free_object_string(_legacyType.name);
|
||||
language_free_object_string(_legacyType.description);
|
||||
language_free_object_string(_legacyType.naming.name);
|
||||
language_free_object_string(_legacyType.naming.description);
|
||||
gfx_object_free_images(_legacyType.images_offset, GetImageTable()->GetCount());
|
||||
|
||||
_legacyType.name = 0;
|
||||
_legacyType.description = 0;
|
||||
_legacyType.naming.name = 0;
|
||||
_legacyType.naming.description = 0;
|
||||
_legacyType.images_offset = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -6258,9 +6258,9 @@ static void ride_set_name_to_vehicle_default(Ride * ride, rct_ride_entry * rideE
|
|||
ride_name_args name_args;
|
||||
|
||||
ride->name = 1;
|
||||
ride->name_arguments_type_name = rideEntry->name;
|
||||
ride->name_arguments_type_name = rideEntry->naming.name;
|
||||
rct_string_id rideNameStringId = 0;
|
||||
name_args.type_name = rideEntry->name;
|
||||
name_args.type_name = rideEntry->naming.name;
|
||||
name_args.number = 0;
|
||||
|
||||
do {
|
||||
|
@ -6279,27 +6279,6 @@ static void ride_set_name_to_vehicle_default(Ride * ride, rct_ride_entry * rideE
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the name of the track type or ride group, as seen in the research window.
|
||||
*/
|
||||
rct_string_id get_friendly_track_type_name(uint8 trackType, rct_ride_entry * rideEntry)
|
||||
{
|
||||
if (!gConfigInterface.select_by_track_type) {
|
||||
if (trackType == RIDE_TYPE_TWISTER_ROLLER_COASTER) {
|
||||
return STR_HYPER_TWISTER_GROUP;
|
||||
} else {
|
||||
return RideNaming[trackType].name;
|
||||
}
|
||||
} else {
|
||||
if (ride_type_has_ride_groups(trackType)) {
|
||||
const ride_group * rideGroup = get_ride_group(trackType, rideEntry);
|
||||
return rideGroup->naming.name;
|
||||
} else {
|
||||
return RideNaming[trackType].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return the name of the ride, as seen in the New Ride window.
|
||||
*/
|
||||
|
|
|
@ -95,13 +95,7 @@ assert_struct_size(rct_ride_name, 4);
|
|||
* size: unknown
|
||||
*/
|
||||
typedef struct rct_ride_entry {
|
||||
union {
|
||||
rct_ride_name naming;
|
||||
struct {
|
||||
rct_string_id name; // 0x000
|
||||
rct_string_id description; // 0x002
|
||||
};
|
||||
};
|
||||
rct_ride_name naming;
|
||||
uint32 images_offset; // 0x004
|
||||
uint32 flags; // 0x008
|
||||
uint8 ride_type[RCT2_MAX_RIDE_TYPES_PER_RIDE_ENTRY];// 0x00C
|
||||
|
@ -1081,7 +1075,6 @@ void game_command_set_ride_setting(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32
|
|||
sint32 ride_get_refund_price(sint32 ride_id);
|
||||
bool shop_item_is_photo(sint32 shopItem);
|
||||
bool shop_item_has_common_price(sint32 shopItem);
|
||||
rct_string_id get_friendly_track_type_name(uint8 trackType, rct_ride_entry * rideEntry);
|
||||
rct_ride_name get_ride_naming(uint8 rideType, rct_ride_entry * rideEntry);
|
||||
void game_command_create_ride(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
void game_command_callback_ride_construct_new(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
|
|
|
@ -934,7 +934,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
|
|||
rct_ride_name rideNaming;
|
||||
|
||||
// Ride name and description
|
||||
rideNaming = get_ride_naming(item.type , rideEntry);
|
||||
rideNaming = get_ride_naming(item.type, rideEntry);
|
||||
set_format_arg(0, rct_string_id, rideNaming.name);
|
||||
set_format_arg(2, rct_string_id, rideNaming.description);
|
||||
gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, width, STR_NEW_RIDE_NAME_AND_DESCRIPTION, COLOUR_BLACK);
|
||||
|
|
|
@ -349,19 +349,12 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp
|
|||
} else {
|
||||
// Research type
|
||||
stringId = STR_RESEARCH_UNKNOWN;
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH) {
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_INITIAL_RESEARCH)
|
||||
{
|
||||
stringId = ResearchCategoryNames[gResearchNextCategory];
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_DESIGNING) {
|
||||
uint32 typeId = gResearchNextItem;
|
||||
if (typeId >= 0x10000) {
|
||||
uint8 baseRideType = (typeId >> 8) & 0xFF;
|
||||
rct_ride_entry *rideEntry = get_ride_entry(typeId & 0xFF);
|
||||
stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ?
|
||||
rideEntry->name :
|
||||
get_friendly_track_type_name(baseRideType, rideEntry); // Makes sure the correct track name is displayed, e.g. Hyper-Twister instead of Steel Twister.
|
||||
} else {
|
||||
stringId = get_scenery_group_entry(typeId)->name;
|
||||
}
|
||||
if (gResearchProgressStage != RESEARCH_STAGE_DESIGNING)
|
||||
{
|
||||
stringId = research_item_get_name(gResearchNextItem);
|
||||
}
|
||||
}
|
||||
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 296, STR_RESEARCH_TYPE_LABEL, COLOUR_BLACK);
|
||||
|
@ -392,25 +385,11 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp
|
|||
|
||||
uint32 typeId = gResearchLastItemSubject;
|
||||
rct_string_id lastDevelopmentFormat;
|
||||
if (typeId != 0xFFFFFFFF) {
|
||||
if (typeId >= 0x10000) {
|
||||
rct_ride_entry *rideEntry = get_ride_entry(typeId & 0xFF);
|
||||
if (rideEntry == nullptr) {
|
||||
return;
|
||||
}
|
||||
stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ?
|
||||
rideEntry->name :
|
||||
((typeId >> 8) & 0xFF) + 2;
|
||||
if (typeId != 0xFFFFFFFF)
|
||||
{
|
||||
stringId = research_item_get_name(typeId);
|
||||
lastDevelopmentFormat = (typeId >= 0x10000) ? STR_RESEARCH_RIDE_LABEL : STR_RESEARCH_SCENERY_LABEL;
|
||||
|
||||
lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL;
|
||||
} else {
|
||||
rct_scenery_set_entry *sse = get_scenery_group_entry(typeId);
|
||||
if (sse == nullptr) {
|
||||
return;
|
||||
}
|
||||
stringId = sse->name;
|
||||
lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL;
|
||||
}
|
||||
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 266, lastDevelopmentFormat, COLOUR_BLACK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2734,7 +2734,7 @@ static void window_ride_vehicle_mousedown(rct_window *w, rct_widgetindex widgetI
|
|||
selectedIndex = numItems;
|
||||
|
||||
gDropdownItemsFormat[numItems] = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItemsArgs[numItems] = (rideEntryIndex << 16) | currentRideEntry->name;
|
||||
gDropdownItemsArgs[numItems] = (rideEntryIndex << 16) | currentRideEntry->naming.name;
|
||||
|
||||
numItems++;
|
||||
}
|
||||
|
@ -2830,7 +2830,7 @@ static void window_ride_vehicle_invalidate(rct_window *w)
|
|||
carsPerTrain = ride->num_cars_per_train - rideEntry->zero_cars;
|
||||
|
||||
// Vehicle type
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].text = rideEntry->name;
|
||||
window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].text = rideEntry->naming.name;
|
||||
// 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,7 +2922,7 @@ static void window_ride_vehicle_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
y = w->y + 64;
|
||||
|
||||
// Description
|
||||
y += gfx_draw_string_left_wrapped(dpi, &rideEntry->description, x, y, 300, STR_BLACK_STRING, COLOUR_BLACK);
|
||||
y += gfx_draw_string_left_wrapped(dpi, &rideEntry->naming.description, x, y, 300, STR_BLACK_STRING, COLOUR_BLACK);
|
||||
y += 5;
|
||||
|
||||
// Capacity
|
||||
|
|
Loading…
Reference in New Issue