Partially integrate surface variables

This commit is contained in:
Marijn van der Werf 2016-09-10 23:38:45 +02:00
parent ba453db01f
commit c5d947c1aa
6 changed files with 16 additions and 10 deletions

View File

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

View File

@ -68,12 +68,16 @@ typedef struct tunnel_entry {
} tunnel_entry;
#ifdef NO_RCT2
extern bool gDidPassSurface;
extern rct_map_element * gSurfaceElement;
extern tunnel_entry gLeftTunnels[65];
extern uint8 gLeftTunnelCount;
extern tunnel_entry gRightTunnels[65];
extern uint8 gRightTunnelCount;
extern uint8 gVerticalTunnelHeight;
#else
#define gDidPassSurface RCT2_GLOBAL(0x009DE57C, bool)
#define gSurfaceElement RCT2_GLOBAL(0x009E3250, rct_map_element *)
#define gLeftTunnels RCT2_ADDRESS(0x009E3138, tunnel_entry)
#define gLeftTunnelCount RCT2_GLOBAL(0x0141F56A, uint8)
#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;
}
if (!RCT2_GLOBAL(0x9DE57C, bool)) {
if (!gDidPassSurface) {
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 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());
} else {
uint32 image_id;
@ -915,14 +915,14 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
}
// Below Surface
if (!RCT2_GLOBAL(0x9DE57C, bool)) {
if (!gDidPassSurface) {
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 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());
}
else {

View File

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

View File

@ -449,7 +449,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
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 || RCT2_GLOBAL(0x009DEA58, paint_struct*) == 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);
hasSupports = true;
} else {

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)
{
if (!RCT2_GLOBAL(0x9DE57C, bool)) {
if (!gDidPassSurface) {
// Should be above ground (have passed surface rendering)
return false;
}
rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *);
rct_map_element * surfaceElement = gSurfaceElement;
if (surfaceElement->base_height != mapElement->base_height) {
return true;
}