mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
Extract tunnel/segment resetting
This commit is contained in:
@@ -38,9 +38,9 @@ uint16 gUnk141E9DC;
|
||||
rct_xy16 gPaintMapPosition;
|
||||
bool gDidPassSurface;
|
||||
rct_map_element * gSurfaceElement;
|
||||
tunnel_entry gLeftTunnels[65];
|
||||
tunnel_entry gLeftTunnels[TUNNEL_MAX_COUNT];
|
||||
uint8 gLeftTunnelCount;
|
||||
tunnel_entry gRightTunnels[65];
|
||||
tunnel_entry gRightTunnels[TUNNEL_MAX_COUNT];
|
||||
uint8 gRightTunnelCount;
|
||||
uint8 gVerticalTunnelHeight;
|
||||
#endif
|
||||
|
||||
@@ -80,15 +80,17 @@ enum
|
||||
G141E9DB_FLAG_2 = 2,
|
||||
};
|
||||
|
||||
#define TUNNEL_MAX_COUNT 65
|
||||
|
||||
#ifdef NO_RCT2
|
||||
extern uint8 g141E9DB;
|
||||
extern uint16 gUnk141E9DC;
|
||||
extern rct_xy16 gPaintMapPosition;
|
||||
extern bool gDidPassSurface;
|
||||
extern rct_map_element * gSurfaceElement;
|
||||
extern tunnel_entry gLeftTunnels[65];
|
||||
extern tunnel_entry gLeftTunnels[TUNNEL_MAX_COUNT];
|
||||
extern uint8 gLeftTunnelCount;
|
||||
extern tunnel_entry gRightTunnels[65];
|
||||
extern tunnel_entry gRightTunnels[TUNNEL_MAX_COUNT];
|
||||
extern uint8 gRightTunnelCount;
|
||||
extern uint8 gVerticalTunnelHeight;
|
||||
#else
|
||||
|
||||
@@ -632,7 +632,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge edge, uint8 height,
|
||||
// Normal walls
|
||||
while (curHeight > tunnelArray[0].height) {
|
||||
// TODO: Should probably be done by just keeping track of the current index
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64);
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * (TUNNEL_MAX_COUNT - 1));
|
||||
}
|
||||
|
||||
if (curHeight != tunnelArray[0].height) {
|
||||
@@ -680,7 +680,7 @@ static void viewport_surface_draw_land_side_bottom(enum edge edge, uint8 height,
|
||||
curHeight += stru_97B570[tunnelType][0];
|
||||
|
||||
// TODO: Should probably be done by just keeping track of the current index
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64);
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * (TUNNEL_MAX_COUNT - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge edge, uint8 height
|
||||
// Normal walls
|
||||
while (curHeight > tunnelArray[0].height) {
|
||||
// TODO: Should probably be done by just keeping track of the current index
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64);
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * (TUNNEL_MAX_COUNT - 1));
|
||||
}
|
||||
|
||||
sub_98196C(base_image_id, offset.x, offset.y, bounds.x, bounds.y, 15, curHeight * 16, rotation);
|
||||
@@ -948,7 +948,7 @@ static void viewport_surface_draw_water_side_bottom(enum edge edge, uint8 height
|
||||
curHeight += stru_97B570[tunnelType][0];
|
||||
|
||||
// TODO: Should probably be done by just keeping track of the current index
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * 64);
|
||||
memmove(&tunnelArray[0], &tunnelArray[1], sizeof(tunnel_entry) * (TUNNEL_MAX_COUNT - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1312,18 +1312,18 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||
log_verbose("eax: %d", eax);
|
||||
}
|
||||
|
||||
tunnel_entry backupLeftTunnels[65];
|
||||
tunnel_entry backupRightTunnels[65];
|
||||
tunnel_entry backupLeftTunnels[TUNNEL_MAX_COUNT];
|
||||
tunnel_entry backupRightTunnels[TUNNEL_MAX_COUNT];
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// The other code crashes mingw 4.8.2, as available on Travis
|
||||
for (int i = 0; i < 65; i++) {
|
||||
for (int i = 0; i < TUNNEL_MAX_COUNT; i++) {
|
||||
backupLeftTunnels[i] = gLeftTunnels[i];
|
||||
backupRightTunnels[i] = gRightTunnels[i];
|
||||
}
|
||||
#else
|
||||
memcpy(backupLeftTunnels, gLeftTunnels, sizeof(tunnel_entry) * 65);
|
||||
memcpy(backupRightTunnels, gRightTunnels, sizeof(tunnel_entry) * 65);
|
||||
memcpy(backupLeftTunnels, gLeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
memcpy(backupRightTunnels, gRightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
#endif
|
||||
|
||||
viewport_surface_draw_land_side_top(EDGE_TOPLEFT, height / 16, eax / 32, tileDescriptors[0], tileDescriptors[3]);
|
||||
@@ -1334,13 +1334,13 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// The other code crashes mingw 4.8.2, as available on Travis
|
||||
for (int i = 0; i < 65; i++) {
|
||||
for (int i = 0; i < TUNNEL_MAX_COUNT; i++) {
|
||||
gLeftTunnels[i] = backupLeftTunnels[i];
|
||||
gRightTunnels[i] = backupRightTunnels[i];
|
||||
}
|
||||
#else
|
||||
memcpy(gLeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * 65);
|
||||
memcpy(gRightTunnels, backupRightTunnels, sizeof(tunnel_entry) * 65);
|
||||
memcpy(gLeftTunnels, backupLeftTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
memcpy(gRightTunnels, backupRightTunnels, sizeof(tunnel_entry) * TUNNEL_MAX_COUNT);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user