From f36485557d7e0608eab8602d66af1ce189c0e9cf Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 10 Sep 2016 18:21:05 +0100 Subject: [PATCH] Integrate remaining globals in ride window --- src/paint/map_element/entrance.c | 2 +- src/paint/map_element/path.c | 2 +- src/paint/map_element/surface.c | 2 +- src/rct1/S4Importer.cpp | 2 +- src/rct2/S6Exporter.cpp | 2 +- src/rct2/S6Importer.cpp | 2 +- src/ride/track_paint.c | 2 +- src/scenario.h | 2 +- src/windows/ride.c | 28 +++++++++++----------------- src/world/map.c | 3 ++- src/world/map.h | 1 + 11 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/paint/map_element/entrance.c b/src/paint/map_element/entrance.c index c0ebf20648..024bb07f0f 100644 --- a/src/paint/map_element/entrance.c +++ b/src/paint/map_element/entrance.c @@ -262,7 +262,7 @@ void entrance_paint(uint8 direction, int height, rct_map_element* map_element){ RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS,sint16) + 0x20101689; - image_id -= RCT2_GLOBAL(0x01359208, sint16); + image_id -= gMapBaseZ; sub_98197C(image_id, 16, 16, 1, 1, 0, height, 31, 31, z + 64, get_current_rotation()); } diff --git a/src/paint/map_element/path.c b/src/paint/map_element/path.c index c6373fcee7..12a2ffb5b5 100644 --- a/src/paint/map_element/path.c +++ b/src/paint/map_element/path.c @@ -760,7 +760,7 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element) } uint32 imageId = (SPR_HEIGHT_MARKER_BASE + height / 16) | COLOUR_GREY << 19 | 0x20000000; imageId += get_height_marker_offset(); - imageId -= RCT2_GLOBAL(0x01359208, uint16); + imageId -= gMapBaseZ; sub_98196C(imageId, 16, 16, 1, 1, 0, height, get_current_rotation()); } diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index cfd4b9eed3..e481ade7f9 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -1030,7 +1030,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement) int image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16) | 0x20780000; image_id += get_height_marker_offset(); - image_id -= RCT2_GLOBAL(0x01359208, uint16); + image_id -= gMapBaseZ; sub_98196C(image_id, 16, 16, 1, 1, 0, height, rotation); } diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index 8efd564acb..897a124ca4 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -1284,7 +1284,7 @@ private: } mapElement++; } - RCT2_GLOBAL(0x01359208, uint16) = 7; + gMapBaseZ = 7; } void FixPaths() diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index d1215c7467..88d214e6b3 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -372,7 +372,7 @@ void S6Exporter::Export() // rct1_water_colour // pad_01358842 memcpy(_s6.research_items, gResearchItems, sizeof(_s6.research_items)); - _s6.word_01359208 = RCT2_GLOBAL(0x01359208, uint16); + _s6.map_base_z = gMapBaseZ; memcpy(_s6.scenario_name, gScenarioName, sizeof(_s6.scenario_name)); memcpy(_s6.scenario_description, gScenarioDetails, sizeof(_s6.scenario_description)); _s6.current_interest_rate = gBankLoanInterestRate; diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 68339b8c05..a175b6bd36 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -290,7 +290,7 @@ void S6Importer::Import() // rct1_water_colour // pad_01358842 memcpy(gResearchItems, _s6.research_items, sizeof(_s6.research_items)); - RCT2_GLOBAL(0x01359208, uint16) = _s6.word_01359208; + gMapBaseZ = _s6.map_base_z; memcpy(gScenarioName, _s6.scenario_name, sizeof(_s6.scenario_name)); memcpy(gScenarioDetails, _s6.scenario_description, sizeof(_s6.scenario_description)); gBankLoanInterestRate = _s6.current_interest_rate; diff --git a/src/ride/track_paint.c b/src/ride/track_paint.c index ffa82afcae..6cdfefe371 100644 --- a/src/ride/track_paint.c +++ b/src/ride/track_paint.c @@ -1292,7 +1292,7 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement) uint16 ax = RideData5[ride->type].z_offset; uint32 ebx = 0x20381689 + (height + 8) / 16; ebx += RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16); - ebx -= RCT2_GLOBAL(0x01359208, uint16); + ebx -= gMapBaseZ; sub_98197C(ebx, 16, 16, 1, 1, 0, height + ax + 3, 1000, 1000, 2047, get_current_rotation()); } } diff --git a/src/scenario.h b/src/scenario.h index 5bbc8bae8f..b8679c6fc1 100644 --- a/src/scenario.h +++ b/src/scenario.h @@ -272,7 +272,7 @@ typedef struct rct_s6_data { uint8 rct1_water_colour; uint8 pad_01358842[2]; rct_research_item research_items[500]; - uint16 word_01359208; + uint16 map_base_z; char scenario_name[64]; char scenario_description[256]; uint8 current_interest_rate; diff --git a/src/windows/ride.c b/src/windows/ride.c index 8903d007d2..f4ec1d04b1 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -14,7 +14,6 @@ *****************************************************************************/ #pragma endregion -#include "../addresses.h" #include "../audio/audio.h" #include "../cheats.h" #include "../config.h" @@ -5351,7 +5350,6 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi //therefore we set the last entry to use the no-separator format now, post-format set_format_arg(0 + ((numTimes - 1) * 4), uint16, STR_RIDE_TIME_ENTRY); } - RCT2_GLOBAL(0x013CE94E + (numTimes * 4), uint16) = STR_RIDE_TIME_ENTRY; set_format_arg(0 + (numTimes * 4), uint16, 0); set_format_arg(2 + (numTimes * 4), uint16, 0); set_format_arg(4 + (numTimes * 4), uint16, 0); @@ -5380,7 +5378,6 @@ static void window_ride_measurements_paint(rct_window *w, rct_drawpixelinfo *dpi //therefore we set the last entry to use the no-separator format now, post-format set_format_arg(0 + ((numLengths - 1) * 4), uint16, STR_RIDE_LENGTH_ENTRY); } - RCT2_GLOBAL(0x013CE94E + (numLengths * 4), uint16) = STR_RIDE_LENGTH_ENTRY; set_format_arg(0 + (numLengths * 4), uint16, 0); set_format_arg(2 + (numLengths * 4), uint16, 0); set_format_arg(4 + (numLengths * 4), uint16, 0); @@ -5690,7 +5687,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi int x, y, width, time, listType, colour, top, bottom, tmp; rct_string_id stringId; - gfx_clear(dpi, RCT2_GLOBAL(0x0141FC9D, uint8) * 0x01010101); + gfx_clear(dpi, ColourMapA[COLOUR_SATURATED_GREEN].darker * 0x01010101); widget = &window_ride_graphs_widgets[WIDX_GRAPH]; listType = w->list_information_type & 0xFF; @@ -5705,14 +5702,17 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi } // Vertical grid lines + const uint8 lightColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_light; + const uint8 darkColour = ColourMapA[COLOUR_SATURATED_GREEN].mid_dark; + time = 0; for (x = 0; x < dpi->x + dpi->width; x += 80) { if (x + 80 >= dpi->x) { - gfx_fill_rect(dpi, x + 0, dpi->y, x + 0, dpi->y + dpi->height - 1, RCT2_GLOBAL(0x0141FCA0, uint8)); - gfx_fill_rect(dpi, x + 16, dpi->y, x + 16, dpi->y + dpi->height - 1, RCT2_GLOBAL(0x0141FC9F, uint8)); - gfx_fill_rect(dpi, x + 32, dpi->y, x + 32, dpi->y + dpi->height - 1, RCT2_GLOBAL(0x0141FC9F, uint8)); - gfx_fill_rect(dpi, x + 48, dpi->y, x + 48, dpi->y + dpi->height - 1, RCT2_GLOBAL(0x0141FC9F, uint8)); - gfx_fill_rect(dpi, x + 64, dpi->y, x + 64, dpi->y + dpi->height - 1, RCT2_GLOBAL(0x0141FC9F, uint8)); + gfx_fill_rect(dpi, x + 0, dpi->y, x + 0, dpi->y + dpi->height - 1, lightColour); + gfx_fill_rect(dpi, x + 16, dpi->y, x + 16, dpi->y + dpi->height - 1, darkColour); + gfx_fill_rect(dpi, x + 32, dpi->y, x + 32, dpi->y + dpi->height - 1, darkColour); + gfx_fill_rect(dpi, x + 48, dpi->y, x + 48, dpi->y + dpi->height - 1, darkColour); + gfx_fill_rect(dpi, x + 64, dpi->y, x + 64, dpi->y + dpi->height - 1, darkColour); } time += 5; } @@ -5726,18 +5726,12 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi // Scale modifier if (listType == GRAPH_ALTITUDE) { - short unk = RCT2_GLOBAL(0x01359208, uint16); - yUnit -= RCT2_GLOBAL(0x01359208, uint16); - unk *= 2; - yUnit -= unk; + yUnit -= gMapBaseZ * 3; } for (y = widget->bottom - widget->top - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval) { // Minor / major line - colour = yUnit == 0 ? - RCT2_GLOBAL(0x0141FCA0, uint8) : - RCT2_GLOBAL(0x0141FC9F, uint8); - + colour = yUnit == 0 ? lightColour : darkColour; gfx_fill_rect(dpi, dpi->x, y, dpi->x + dpi->width - 1, y, colour); sint16 scaled_yUnit = yUnit; diff --git a/src/world/map.c b/src/world/map.c index a4240a5d2c..01ad9a867c 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -87,6 +87,7 @@ sint16 gMapSizeUnits; sint16 gMapSizeMinus2; sint16 gMapSize; sint16 gMapSizeMaxXY; +sint16 gMapBaseZ; #if defined(NO_RCT2) rct_map_element gMapElements[0x30000]; @@ -383,7 +384,7 @@ void map_init(int size) gMapSizeMinus2 = size * 32 - 2; gMapSize = size; gMapSizeMaxXY = size * 32 - 33; - RCT2_GLOBAL(0x01359208, sint16) = 7; + gMapBaseZ = 7; map_update_tile_pointers(); map_remove_out_of_range_elements(); climate_reset(CLIMATE_WARM); diff --git a/src/world/map.h b/src/world/map.h index 8042b0e452..b975b8b81e 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -338,6 +338,7 @@ extern sint16 gMapSizeUnits; extern sint16 gMapSizeMinus2; extern sint16 gMapSize; extern sint16 gMapSizeMaxXY; +extern sint16 gMapBaseZ; extern uint16 gMapSelectFlags; extern uint16 gMapSelectType;