Merge pull request #4405 from marijnvdwerf/integrate/various-paint

Partially integrate various paint variables
This commit is contained in:
Ted John 2016-09-10 23:02:15 +01:00 committed by GitHub
commit 2f8b307ab7
10 changed files with 40 additions and 24 deletions

View File

@ -34,6 +34,8 @@
#include "../supports.h" #include "../supports.h"
#ifdef NO_RCT2 #ifdef NO_RCT2
bool gDidPassSurface;
rct_map_element * gSurfaceElement;
tunnel_entry gLeftTunnels[65]; tunnel_entry gLeftTunnels[65];
uint8 gLeftTunnelCount; uint8 gLeftTunnelCount;
tunnel_entry gRightTunnels[65]; tunnel_entry gRightTunnels[65];
@ -228,7 +230,7 @@ static void sub_68B3FB(int x, int y)
RCT2_GLOBAL(0x9DE568, sint16) = x; RCT2_GLOBAL(0x9DE568, sint16) = x;
RCT2_GLOBAL(0x9DE56C, sint16) = y; RCT2_GLOBAL(0x9DE56C, sint16) = y;
RCT2_GLOBAL(0x9DE57C, uint16) = 0; gDidPassSurface = false;
do { do {
int direction = (map_element->type + rotation) & MAP_ELEMENT_DIRECTION_MASK; int direction = (map_element->type + rotation) & MAP_ELEMENT_DIRECTION_MASK;
int height = map_element->base_height * 8; int height = map_element->base_height * 8;

View File

@ -68,12 +68,16 @@ typedef struct tunnel_entry {
} tunnel_entry; } tunnel_entry;
#ifdef NO_RCT2 #ifdef NO_RCT2
extern bool gDidPassSurface;
extern rct_map_element * gSurfaceElement;
extern tunnel_entry gLeftTunnels[65]; extern tunnel_entry gLeftTunnels[65];
extern uint8 gLeftTunnelCount; extern uint8 gLeftTunnelCount;
extern tunnel_entry gRightTunnels[65]; extern tunnel_entry gRightTunnels[65];
extern uint8 gRightTunnelCount; extern uint8 gRightTunnelCount;
extern uint8 gVerticalTunnelHeight; extern uint8 gVerticalTunnelHeight;
#else #else
#define gDidPassSurface RCT2_GLOBAL(0x009DE57C, bool)
#define gSurfaceElement RCT2_GLOBAL(0x009E3250, rct_map_element *)
#define gLeftTunnels RCT2_ADDRESS(0x009E3138, tunnel_entry) #define gLeftTunnels RCT2_ADDRESS(0x009E3138, tunnel_entry)
#define gLeftTunnelCount RCT2_GLOBAL(0x0141F56A, uint8) #define gLeftTunnelCount RCT2_GLOBAL(0x0141F56A, uint8)
#define gRightTunnels RCT2_ADDRESS(0x009E30B6, tunnel_entry) #define gRightTunnels RCT2_ADDRESS(0x009E30B6, tunnel_entry)

View File

@ -801,14 +801,14 @@ void loc_6A37C9(rct_map_element * mapElement, int height, rct_footpath_entry * f
imageId += 51; imageId += 51;
} }
if (!RCT2_GLOBAL(0x9DE57C, bool)) { if (!gDidPassSurface) {
boundBoxOffset.x = 3; boundBoxOffset.x = 3;
boundBoxOffset.y = 3; boundBoxOffset.y = 3;
boundBoxSize.x = 26; boundBoxSize.x = 26;
boundBoxSize.y = 26; boundBoxSize.y = 26;
} }
if (!hasFences || !RCT2_GLOBAL(0x9DE57C, bool)) { if (!hasFences || !gDidPassSurface) {
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation()); sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
} else { } else {
uint32 image_id; uint32 image_id;
@ -915,14 +915,14 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
} }
// Below Surface // Below Surface
if (!RCT2_GLOBAL(0x9DE57C, bool)) { if (!gDidPassSurface) {
boundBoxOffset.x = 3; boundBoxOffset.x = 3;
boundBoxOffset.y = 3; boundBoxOffset.y = 3;
boundBoxSize.x = 26; boundBoxSize.x = 26;
boundBoxSize.y = 26; boundBoxSize.y = 26;
} }
if (!hasFences || !RCT2_GLOBAL(0x9DE57C, bool)) { if (!hasFences || !gDidPassSurface) {
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation()); sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
} }
else { else {

View File

@ -964,8 +964,8 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
{ {
rct_drawpixelinfo * dpi = unk_140E9A8; rct_drawpixelinfo * dpi = unk_140E9A8;
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN; gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
RCT2_GLOBAL(0x9DE57C, uint16) |= 1; // Probably a boolean indicating 'above surface' gDidPassSurface = true;
RCT2_GLOBAL(0x9E3250, rct_map_element *) = mapElement; gSurfaceElement = mapElement;
uint16 zoomLevel = dpi->zoom_level; uint16 zoomLevel = dpi->zoom_level;

View File

@ -321,6 +321,10 @@ const uint16 word_97B3C4[] = {
0, 0,
}; };
#ifdef NO_RCT2
paint_struct * gWoodenSupportsPrependTo;
#endif
/** /**
* Adds paint structs for wooden supports. * Adds paint structs for wooden supports.
* rct2: 0x006629BC * rct2: 0x006629BC
@ -449,14 +453,14 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
unk_supports_desc_bound_box bBox = byte_97B23C[special].bounding_box; unk_supports_desc_bound_box bBox = byte_97B23C[special].bounding_box;
if (byte_97B23C[special].var_6 == 0 || RCT2_GLOBAL(0x009DEA58, uint32) == 0) { if (byte_97B23C[special].var_6 == 0 || gWoodenSupportsPrependTo == NULL) {
sub_98197C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation); sub_98197C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation);
hasSupports = true; hasSupports = true;
} else { } else {
hasSupports = true; hasSupports = true;
paint_struct* ps = sub_98198C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation); paint_struct* ps = sub_98198C(imageId, 0, 0, bBox.length.x, bBox.length.y, bBox.length.z, z, bBox.offset.x, bBox.offset.y, bBox.offset.z + z, rotation);
if (ps != NULL) { if (ps != NULL) {
paint_struct* edi = RCT2_GLOBAL(0x009DEA58, paint_struct*); paint_struct* edi = gWoodenSupportsPrependTo;
edi->var_20 = ps; edi->var_20 = ps;
} }
} }

View File

@ -20,6 +20,12 @@
#include "../common.h" #include "../common.h"
#include "../world/footpath.h" #include "../world/footpath.h"
#ifdef NO_RCT2
extern paint_struct * gWoodenSupportsPrependTo;
#else
#define gWoodenSupportsPrependTo RCT2_GLOBAL(0x009DEA58, paint_struct *)
#endif
bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, bool* underground); bool wooden_a_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags, bool* underground);
bool wooden_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags); bool wooden_b_supports_paint_setup(int supportType, int special, int height, uint32 imageColourFlags);
bool metal_a_supports_paint_setup(int supportType, int segment, int special, int height, uint32 imageColourFlags); bool metal_a_supports_paint_setup(int supportType, int segment, int special, int height, uint32 imageColourFlags);

View File

@ -271,7 +271,7 @@ static void paint_virginia_reel_track_25_deg_up(uint8 rideIndex, uint8 trackSequ
} }
if (direction == 1 || direction == 2) { if (direction == 1 || direction == 2) {
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
} }
switch (direction) { switch (direction) {
@ -316,14 +316,14 @@ static void paint_virginia_reel_track_flat_to_25_deg_up(uint8 rideIndex, uint8 t
break; break;
case 1: case 1:
ps = sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 27, 32, 2, height, 2, 0, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
wooden_a_supports_paint_setup(1, 2, height, gTrackColours[SCHEME_SUPPORTS], NULL); wooden_a_supports_paint_setup(1, 2, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_push_tunnel_right(height, TUNNEL_8); paint_util_push_tunnel_right(height, TUNNEL_8);
break; break;
case 2: case 2:
ps = sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 32, 27, 2, height, 0, 2, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
wooden_a_supports_paint_setup(0, 3, height, gTrackColours[SCHEME_SUPPORTS], NULL); wooden_a_supports_paint_setup(0, 3, height, gTrackColours[SCHEME_SUPPORTS], NULL);
paint_util_push_tunnel_left(height, TUNNEL_8); paint_util_push_tunnel_left(height, TUNNEL_8);
@ -360,7 +360,7 @@ static void paint_virginia_reel_track_25_deg_up_to_flat(uint8 rideIndex, uint8 t
} }
if (direction == 1 || direction == 2) { if (direction == 1 || direction == 2) {
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
} }
switch (direction) { switch (direction) {

View File

@ -444,12 +444,12 @@ static paint_struct * mini_golf_paint_util_7c(
static bool mini_golf_paint_util_should_draw_fence(rct_map_element * mapElement) static bool mini_golf_paint_util_should_draw_fence(rct_map_element * mapElement)
{ {
if (!RCT2_GLOBAL(0x9DE57C, bool)) { if (!gDidPassSurface) {
// Should be above ground (have passed surface rendering) // Should be above ground (have passed surface rendering)
return false; return false;
} }
rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *); rct_map_element * surfaceElement = gSurfaceElement;
if (surfaceElement->base_height != mapElement->base_height) { if (surfaceElement->base_height != mapElement->base_height) {
return true; return true;
} }

View File

@ -173,7 +173,7 @@ static void paint_go_karts_track_25_deg_up(uint8 rideIndex, uint8 trackSequence,
} }
if (direction == 1 || direction == 2) { if (direction == 1 || direction == 2) {
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
} }
imageId = go_karts_track_pieces_25_deg_up[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = go_karts_track_pieces_25_deg_up[direction][1] | gTrackColours[SCHEME_TRACK];
@ -220,7 +220,7 @@ static void paint_go_karts_track_flat_to_25_deg_up(uint8 rideIndex, uint8 trackS
} }
if (direction == 1 || direction == 2) { if (direction == 1 || direction == 2) {
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
} }
imageId = go_karts_track_pieces_flat_to_25_deg_up[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = go_karts_track_pieces_flat_to_25_deg_up[direction][1] | gTrackColours[SCHEME_TRACK];
@ -267,7 +267,7 @@ static void paint_go_karts_track_25_deg_up_to_flat(uint8 rideIndex, uint8 trackS
} }
if (direction == 1 || direction == 2) { if (direction == 1 || direction == 2) {
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
} }
imageId = go_karts_track_pieces_25_deg_up_to_flat[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = go_karts_track_pieces_25_deg_up_to_flat[direction][1] | gTrackColours[SCHEME_TRACK];

View File

@ -310,7 +310,7 @@ static void paint_river_rapids_track_25_deg(uint8 direction, int height, const u
case 1: case 1:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 24, 32, 4, height, 4, 0, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 24, 32, 4, height, 4, 0, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 1, 32, 34, height, 27, 0, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 1, 32, 34, height, 27, 0, height + 16, get_current_rotation());
@ -322,7 +322,7 @@ static void paint_river_rapids_track_25_deg(uint8 direction, int height, const u
case 2: case 2:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 32, 24, 4, height, 0, 4, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 32, 24, 4, height, 0, 4, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 32, 1, 34, height, 0, 27, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 32, 1, 34, height, 0, 27, height + 16, get_current_rotation());
@ -367,7 +367,7 @@ static void paint_river_rapids_track_25_deg_to_flat_a(uint8 direction, int heigh
case 1: case 1:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 24, 32, 4, height, 4, 0, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 24, 32, 4, height, 4, 0, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 1, 32, 18, height, 27, 0, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 1, 32, 18, height, 27, 0, height + 16, get_current_rotation());
@ -379,7 +379,7 @@ static void paint_river_rapids_track_25_deg_to_flat_a(uint8 direction, int heigh
case 2: case 2:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 32, 24, 4, height, 0, 4, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 32, 24, 4, height, 0, 4, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 32, 1, 18, height, 0, 27, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 32, 1, 18, height, 0, 27, height + 16, get_current_rotation());
@ -424,7 +424,7 @@ static void paint_river_rapids_track_25_deg_to_flat_b(uint8 direction, int heigh
case 1: case 1:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 24, 32, 11, height, 4, 0, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 24, 32, 11, height, 4, 0, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 1, 32, 26, height, 27, 0, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 1, 32, 26, height, 27, 0, height + 16, get_current_rotation());
@ -436,7 +436,7 @@ static void paint_river_rapids_track_25_deg_to_flat_b(uint8 direction, int heigh
case 2: case 2:
imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][0] | gTrackColours[SCHEME_TRACK];
ps = sub_98197C(imageId, 0, 0, 32, 24, 11, height, 0, 4, height, get_current_rotation()); ps = sub_98197C(imageId, 0, 0, 32, 24, 11, height, 0, 4, height, get_current_rotation());
RCT2_GLOBAL(0x009DEA58, paint_struct*) = ps; gWoodenSupportsPrependTo = ps;
imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK]; imageId = sprites[direction][1] | gTrackColours[SCHEME_TRACK];
sub_98197C(imageId, 0, 0, 32, 1, 26, height, 0, 27, height + 16, get_current_rotation()); sub_98197C(imageId, 0, 0, 32, 1, 26, height, 0, 27, height + 16, get_current_rotation());