1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Merge pull request #2697 from marijnvdwerf/get-ride-entry

Minimise direct usage of `RCT2_ADDRESS_RIDE_ENTRIES`
This commit is contained in:
Duncan
2016-01-11 23:09:43 +00:00
6 changed files with 23 additions and 24 deletions

View File

@@ -147,6 +147,9 @@
#define RCT2_ADDRESS_PATH_TYPES 0x009ADA14
#define RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES 0x009ADA54
#define RCT2_ADDRESS_SCENERY_SET_ENTRIES 0x009ADA90
#define RCT2_ADDRESS_PARK_ENTRANCE_ENTRIES 0x009ADADC
#define RCT2_ADDRESS_WATER_ENTRIES 0x009ADAE0
#define RCT2_ADDRESS_SCENARIO_TEXT_ENTRIES 0x009ADAE4
#define RCT2_ADDRESS_INSTALLED_OBJECT_LIST 0x009ADAE8
#define RCT2_ADDRESS_EDITOR_OBJECT_FLAGS_LIST 0x009ADAEC

View File

@@ -76,17 +76,17 @@ int object_entry_group_encoding[] = {
// 0x98D97C chunk address', 0x98D980 object_entries
rct_object_entry_group object_entry_groups[] = {
(uint8**)(0x009ACFA4 ), (rct_object_entry_extended*)(0x00F3F03C ), // rides
(uint8**)(0x009ACFA4 + (128 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (128 * 20)), // small scenery 0x009AD1A4, 0xF2FA3C
(uint8**)(0x009ACFA4 + (380 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (380 * 20)), // large scenery 0x009AD594, 0xF40DEC
(uint8**)(0x009ACFA4 + (508 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (508 * 20)), // walls 0x009AD794, 0xF417EC
(uint8**)(0x009ACFA4 + (636 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (636 * 20)), // banners 0x009AD994, 0xF421EC
(uint8**)(0x009ACFA4 + (668 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (668 * 20)), // paths 0x009ADA14, 0xF4246C
(uint8**)(0x009ACFA4 + (684 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (684 * 20)), // path bits 0x009ADA54, 0xF425AC
(uint8**)(0x009ACFA4 + (699 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (699 * 20)), // scenery sets 0x009ADA90, 0xF426D8
(uint8**)(0x009ACFA4 + (718 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (718 * 20)), // park entrance 0x009ADADC, 0xF42854
(uint8**)(0x009ACFA4 + (719 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (719 * 20)), // water 0x009ADAE0, 0xF42868
(uint8**)(0x009ACFA4 + (720 * 4)), (rct_object_entry_extended*)(0x00F3F03C + (720 * 20)) // scenario text 0x009ADAE4, 0xF4287C
(uint8**)(RCT2_ADDRESS_RIDE_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C ), // rides
(uint8**)(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (128 * 20)), // small scenery 0x009AD1A4, 0xF2FA3C
(uint8**)(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (380 * 20)), // large scenery 0x009AD594, 0xF40DEC
(uint8**)(RCT2_ADDRESS_WALL_SCENERY_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (508 * 20)), // walls 0x009AD794, 0xF417EC
(uint8**)(RCT2_ADDRESS_BANNER_SCENERY_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (636 * 20)), // banners 0x009AD994, 0xF421EC
(uint8**)(RCT2_ADDRESS_PATH_TYPES ), (rct_object_entry_extended*)(0x00F3F03C + (668 * 20)), // paths 0x009ADA14, 0xF4246C
(uint8**)(RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES), (rct_object_entry_extended*)(0x00F3F03C + (684 * 20)), // path bits 0x009ADA54, 0xF425AC
(uint8**)(RCT2_ADDRESS_SCENERY_SET_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (699 * 20)), // scenery sets 0x009ADA90, 0xF426D8
(uint8**)(RCT2_ADDRESS_PARK_ENTRANCE_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (718 * 20)), // park entrance 0x009ADADC, 0xF42854
(uint8**)(RCT2_ADDRESS_WATER_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (719 * 20)), // water 0x009ADAE0, 0xF42868
(uint8**)(RCT2_ADDRESS_SCENARIO_TEXT_ENTRIES ), (rct_object_entry_extended*)(0x00F3F03C + (720 * 20)) // scenario text 0x009ADAE4, 0xF4287C
};
static int object_list_cache_load(int totalFiles, uint64 totalFileSize, int fileDateModifiedChecksum);

View File

@@ -850,7 +850,7 @@ enum {
#define TURN_MASK_3_ELEMENTS 0x0700
#define TURN_MASK_4_PLUS_ELEMENTS 0xF800
// rct2: 0x009ACFA4
// rct2: 0x009ACFA4 (RCT2_ADDRESS_RIDE_ENTRIES)
extern rct_ride_type **gRideTypeList;
// rct2: 0x013628F8

View File

@@ -290,7 +290,6 @@ static void window_new_ride_populate_list()
uint8 currentCategory = _window_new_ride_current_tab;
ride_list_item *nextListItem = (ride_list_item*)0x00F43523;
rct_ride_type **rideEntries = (rct_ride_type**)0x009ACFA4;
// For each ride type in the view order list
for (i = 0; i < countof(RideTypeViewOrder); i++) {
@@ -326,7 +325,7 @@ static void window_new_ride_populate_list()
continue;
// Ride entries
rct_ride_type *rideEntry = rideEntries[rideEntryIndex];
rct_ride_type *rideEntry = GET_RIDE_ENTRY(rideEntryIndex);
// Check if ride is in this category
if (!gConfigInterface.select_by_track_type && (currentCategory != rideEntry->category[0] && currentCategory != rideEntry->category[1]))
@@ -773,8 +772,6 @@ static void window_new_ride_paint(rct_window *w, rct_drawpixelinfo *dpi)
*/
static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
rct_ride_type **rideEntries = (rct_ride_type**)0x009ACFA4;
if (_window_new_ride_current_tab == WINDOW_NEW_RIDE_PAGE_RESEARCH)
return;
@@ -793,7 +790,7 @@ static void window_new_ride_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, i
gfx_fill_rect_inset(dpi, x, y, x + 115, y + 115, w->colours[1], 0x80 | flags);
// Draw ride image with feathered border
rideEntry = rideEntries[listItem->entry_index];
rideEntry = GET_RIDE_ENTRY(listItem->entry_index);
int image_id = rideEntry->images_offset;
if (listItem->type != rideEntry->ride_type[0]) {
image_id++;
@@ -863,8 +860,7 @@ static int get_num_track_designs(ride_list_item item)
*/
static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixelinfo *dpi, ride_list_item item, int x, int y, int width)
{
rct_ride_type **rideEntries = (rct_ride_type**)0x009ACFA4;
rct_ride_type *rideEntry = rideEntries[item.entry_index];
rct_ride_type *rideEntry = GET_RIDE_ENTRY(item.entry_index);
// Ride name and description
rct_string_id rideName = rideEntry->name;

View File

@@ -350,7 +350,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp
if (RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) != RESEARCH_STAGE_DESIGNING) {
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*);
rct_ride_type *rideEntry = GET_RIDE_ENTRY(typeId & 0xFF);
stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ?
rideEntry->name :
((typeId >> 8) & 0xFF) + 2;
@@ -388,7 +388,7 @@ void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dp
int lastDevelopmentFormat;
if (typeId != 0xFFFFFFFF) {
if (typeId >= 0x10000) {
rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*);
rct_ride_type *rideEntry = GET_RIDE_ENTRY(typeId & 0xFF);
stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ?
rideEntry->name :
((typeId >> 8) & 0xFF) + 2;

View File

@@ -1114,7 +1114,7 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
return;
}
rct_scenery_entry* scenery_entry = RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)[map_element->properties.scenerymultiple.type & 0x3FF];
rct_scenery_entry *scenery_entry = g_largeSceneryEntries[map_element->properties.scenerymultiple.type & 0x3FF];
// Work out the base tile coordinates (Tile with index 0)
rct_xyz16 baseTile = {
@@ -1615,7 +1615,7 @@ static money32 map_set_land_height(int flags, int x, int y, int height, int styl
continue;
if(height + 4 < mapElement->base_height)
continue;
rct_scenery_entry *sceneryEntry = RCT2_ADDRESS(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES, rct_scenery_entry *)[mapElement->properties.scenery.type]; //sceneryEntry = eax
rct_scenery_entry *sceneryEntry = g_smallSceneryEntries[mapElement->properties.scenery.type]; //sceneryEntry = eax
if(sceneryEntry->small_scenery.height > 64 && RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_FORBID_TREE_REMOVAL)
{
map_obstruction_set_error_text(mapElement);
@@ -3333,7 +3333,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
return;
}
rct_scenery_entry* scenery_entry = RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)[entry_index];
rct_scenery_entry *scenery_entry = g_largeSceneryEntries[entry_index];
if (scenery_entry == (rct_scenery_entry *)0xFFFFFFFF)
{
log_warning("Invalid game command for scenery placement, entry_index = %u", entry_index);