Integrate / remove various GLOBALs

This commit is contained in:
Ted John 2016-09-17 15:51:06 +01:00
parent 9d37b8bb9c
commit c2ca1316e8
7 changed files with 22 additions and 16 deletions

View File

@ -35,6 +35,7 @@
#ifdef NO_RCT2
uint8 g141E9DB;
uint16 gUnk141E9DC;
rct_xy16 gPaintMapPosition;
bool gDidPassSurface;
rct_map_element * gSurfaceElement;
@ -65,7 +66,7 @@ void map_element_paint_setup(int x, int y)
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_force_set_general_support_height(-1, 0);
g141E9DB = 0;
RCT2_GLOBAL(0x0141E9DC, uint32) = 0xFFFF;
gUnk141E9DC = 0xFFFF;
sub_68B3FB(x, y);
} else {
@ -87,7 +88,7 @@ void sub_68B2B7(int x, int y)
) {
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
paint_util_force_set_general_support_height(-1, 0);
RCT2_GLOBAL(0x0141E9DC, uint32) = 0xFFFF;
gUnk141E9DC = 0xFFFF;
g141E9DB = G141E9DB_FLAG_2;
sub_68B3FB(x, y);

View File

@ -76,6 +76,7 @@ enum
#ifdef NO_RCT2
extern uint8 g141E9DB;
extern uint16 gUnk141E9DC;
extern rct_xy16 gPaintMapPosition;
extern bool gDidPassSurface;
extern rct_map_element * gSurfaceElement;
@ -86,6 +87,7 @@ extern uint8 gRightTunnelCount;
extern uint8 gVerticalTunnelHeight;
#else
#define g141E9DB RCT2_GLOBAL(0x0141E9DB, uint8)
#define gUnk141E9DC RCT2_GLOBAL(0x0141E9DC, uint16)
#define gPaintMapPosition RCT2_GLOBAL(0x009DE574, rct_xy16)
#define gDidPassSurface RCT2_GLOBAL(0x009DE57C, bool)
#define gSurfaceElement RCT2_GLOBAL(0x009E3250, rct_map_element *)

View File

@ -955,10 +955,9 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
5
};
RCT2_GLOBAL(0x00F3EF6C, rct_footpath_entry*) = footpathEntry;
for (sint8 i = 3; i > -1; --i) {
if (!(edges & (1 << i))) {
path_b_supports_paint_setup(supports[i], ax, height, imageFlags);
path_b_supports_paint_setup(supports[i], ax, height, imageFlags, footpathEntry);
}
}

View File

@ -1345,7 +1345,6 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
#endif
}
RCT2_GLOBAL(0x009E3298, uint16) = 0;
if (mapElement->properties.surface.terrain & 0x1F) {
// loc_6615A9: (water height)
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_WATER;
@ -1353,9 +1352,8 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
uint16 localHeight = height + 16;
uint16 waterHeight = (mapElement->properties.surface.terrain & 0x1F) * 16;
RCT2_GLOBAL(0x009E3298, uint16) = waterHeight;
if (!gTrackDesignSaveMode) {
RCT2_GLOBAL(0x0141E9DC, uint16) = waterHeight;
gUnk141E9DC = waterHeight;
int image_offset = 0;
if (waterHeight <= localHeight) {

View File

@ -424,7 +424,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
// Draw repeated supports for left over space
while (height != 0) {
if ((z & 16) == 0 && height >= 2 && z + 16 != RCT2_GLOBAL(0x00141E9DC, uint16)) {
if ((z & 16) == 0 && height >= 2 && z + 16 != gUnk141E9DC) {
// Full support
int imageId = WoodenSupportImageIds[supportType].full | imageColourFlags;
uint8 ah = special == 2 ? 23 : 28;
@ -505,9 +505,9 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
int originalSegment = segment;
const uint8 rotation = get_current_rotation();
RCT2_GLOBAL(0x009E3294, sint16) = -1;
sint16 unk9E3294 = -1;
if (height < gSupportSegments[segment].height){
RCT2_GLOBAL(0x009E3294, sint16) = height;
unk9E3294 = height;
height -= word_97B142[supportType];
if (height < 0)
@ -621,7 +621,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
height += z;
}
gSupportSegments[segment].height = RCT2_GLOBAL(0x009E3294, sint16);
gSupportSegments[segment].height = unk9E3294;
gSupportSegments[segment].slope = 0x20;
height = originalHeight;
@ -684,19 +684,28 @@ bool metal_b_supports_paint_setup(int supportType, uint8 segment, int special, i
*/
bool path_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, rct_footpath_entry * pathEntry, bool * underground)
{
#if NO_RCT2
return 0;
#else
RCT2_GLOBAL(0xF3EF6C, rct_footpath_entry *) = pathEntry;
int eax = special, ebx = 0, ecx = 0, edx = height, esi = 0, _edi = supportType, ebp = imageColourFlags;
RCT2_CALLFUNC_X(0x006A2ECC, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp);
return eax & 0xFF;
#endif
}
/**
*
* rct2: 0x006A326B
*/
bool path_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags)
bool path_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, rct_footpath_entry * pathEntry)
{
#if NO_RCT2
return 0;
#else
RCT2_GLOBAL(0xF3EF6C, rct_footpath_entry *) = pathEntry;
int eax = special, ebx = supportType, ecx = 0, edx = height, esi = 0, _edi = 0, ebp = imageColourFlags;
RCT2_CALLFUNC_X(0x006A326B, &eax, &ebx, &ecx, &edx, &esi, &_edi, &ebp);
return eax & 0xFF;
#endif
}

View File

@ -31,6 +31,6 @@ bool wooden_b_supports_paint_setup(int supportType, int special, int height, uin
bool metal_a_supports_paint_setup(int supportType, int segment, int special, int height, uint32 imageColourFlags);
bool metal_b_supports_paint_setup(int supportType, uint8 segment, int special, int height, uint32 imageColourFlags);
bool path_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, rct_footpath_entry * pathEntry, bool * underground);
bool path_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags);
bool path_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, rct_footpath_entry * pathEntry);
#endif

View File

@ -1727,9 +1727,6 @@ static void paint_junior_rc_station_track(uint8 rideIndex, uint8 trackSequence,
imageId &= 0x7FFFF;
}
RCT2_GLOBAL(0x00F441E8, uint32) = imageId;
RCT2_GLOBAL(0x00F441E4, uint32) = imageId;
bool isBraked = (bool)(mapElement->flags & MAP_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED);
if (direction == 0 || direction == 2) {