mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove more map element paint globals
This commit is contained in:
parent
6c1d1c43e5
commit
a0f5f1243f
|
@ -32,13 +32,6 @@
|
||||||
#include "../../game.h"
|
#include "../../game.h"
|
||||||
#include "../supports.h"
|
#include "../supports.h"
|
||||||
|
|
||||||
#ifdef NO_RCT2
|
|
||||||
uint8 g141E9DB;
|
|
||||||
uint16 gUnk141E9DC;
|
|
||||||
bool gDidPassSurface;
|
|
||||||
rct_map_element * gSurfaceElement;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __TESTPAINT__
|
#ifdef __TESTPAINT__
|
||||||
uint16 testPaintVerticalTunnelHeight;
|
uint16 testPaintVerticalTunnelHeight;
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,8 +55,8 @@ void map_element_paint_setup(sint32 x, sint32 y)
|
||||||
) {
|
) {
|
||||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||||
paint_util_force_set_general_support_height(-1, 0);
|
paint_util_force_set_general_support_height(-1, 0);
|
||||||
g141E9DB = 0;
|
gPaintSession.Unk141E9DB = 0;
|
||||||
gUnk141E9DC = 0xFFFF;
|
gPaintSession.Unk141E9DC = 0xFFFF;
|
||||||
|
|
||||||
sub_68B3FB(x, y);
|
sub_68B3FB(x, y);
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,8 +78,8 @@ void sub_68B2B7(sint32 x, sint32 y)
|
||||||
) {
|
) {
|
||||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||||
paint_util_force_set_general_support_height(-1, 0);
|
paint_util_force_set_general_support_height(-1, 0);
|
||||||
gUnk141E9DC = 0xFFFF;
|
gPaintSession.Unk141E9DC = 0xFFFF;
|
||||||
g141E9DB = G141E9DB_FLAG_2;
|
gPaintSession.Unk141E9DB = G141E9DB_FLAG_2;
|
||||||
|
|
||||||
sub_68B3FB(x, y);
|
sub_68B3FB(x, y);
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,7 +233,7 @@ static void sub_68B3FB(sint32 x, sint32 y)
|
||||||
|
|
||||||
gPaintSession.SpritePosition.x = x;
|
gPaintSession.SpritePosition.x = x;
|
||||||
gPaintSession.SpritePosition.y = y;
|
gPaintSession.SpritePosition.y = y;
|
||||||
gDidPassSurface = false;
|
gPaintSession.DidPassSurface = false;
|
||||||
do {
|
do {
|
||||||
// Only paint map_elements below the clip height.
|
// Only paint map_elements below the clip height.
|
||||||
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (map_element->base_height > gClipHeight)) break;
|
if ((gCurrentViewportFlags & VIEWPORT_FLAG_PAINT_CLIP_TO_HEIGHT) && (map_element->base_height > gClipHeight)) break;
|
||||||
|
|
|
@ -75,18 +75,6 @@ enum
|
||||||
G141E9DB_FLAG_2 = 2,
|
G141E9DB_FLAG_2 = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef NO_RCT2
|
|
||||||
extern uint8 g141E9DB;
|
|
||||||
extern uint16 gUnk141E9DC;
|
|
||||||
extern bool gDidPassSurface;
|
|
||||||
extern rct_map_element * gSurfaceElement;
|
|
||||||
#else
|
|
||||||
#define g141E9DB RCT2_GLOBAL(0x0141E9DB, uint8)
|
|
||||||
#define gUnk141E9DC RCT2_GLOBAL(0x0141E9DC, uint16)
|
|
||||||
#define gDidPassSurface RCT2_GLOBAL(0x009DE57C, bool)
|
|
||||||
#define gSurfaceElement RCT2_GLOBAL(0x009E3250, rct_map_element *)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __TESTPAINT__
|
#ifdef __TESTPAINT__
|
||||||
extern uint16 testPaintVerticalTunnelHeight;
|
extern uint16 testPaintVerticalTunnelHeight;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -826,14 +826,14 @@ void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_fo
|
||||||
imageId += 51;
|
imageId += 51;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gDidPassSurface) {
|
if (!gPaintSession.DidPassSurface) {
|
||||||
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 || !gDidPassSurface) {
|
if (!hasFences || !gPaintSession.DidPassSurface) {
|
||||||
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;
|
||||||
|
@ -940,14 +940,14 @@ void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_foot
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below Surface
|
// Below Surface
|
||||||
if (!gDidPassSurface) {
|
if (!gPaintSession.DidPassSurface) {
|
||||||
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 || !gDidPassSurface) {
|
if (!hasFences || !gPaintSession.DidPassSurface) {
|
||||||
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 {
|
||||||
|
|
|
@ -992,8 +992,8 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo * dpi = gPaintSession.Unk140E9A8;
|
rct_drawpixelinfo * dpi = gPaintSession.Unk140E9A8;
|
||||||
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
|
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
|
||||||
gDidPassSurface = true;
|
gPaintSession.DidPassSurface = true;
|
||||||
gSurfaceElement = mapElement;
|
gPaintSession.SurfaceElement = mapElement;
|
||||||
|
|
||||||
uint16 zoomLevel = dpi->zoom_level;
|
uint16 zoomLevel = dpi->zoom_level;
|
||||||
|
|
||||||
|
@ -1379,7 +1379,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||||
uint16 waterHeight = map_get_water_height(mapElement) * 16;
|
uint16 waterHeight = map_get_water_height(mapElement) * 16;
|
||||||
|
|
||||||
if (!gTrackDesignSaveMode) {
|
if (!gTrackDesignSaveMode) {
|
||||||
gUnk141E9DC = waterHeight;
|
gPaintSession.Unk141E9DC = waterHeight;
|
||||||
|
|
||||||
sint32 image_offset = 0;
|
sint32 image_offset = 0;
|
||||||
if (waterHeight <= localHeight) {
|
if (waterHeight <= localHeight) {
|
||||||
|
@ -1531,7 +1531,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
|
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
|
||||||
g141E9DB |= G141E9DB_FLAG_1;
|
gPaintSession.Unk141E9DB |= G141E9DB_FLAG_1;
|
||||||
|
|
||||||
switch (surfaceShape) {
|
switch (surfaceShape) {
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -164,6 +164,10 @@ typedef struct paint_session
|
||||||
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
|
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
|
||||||
uint8 RightTunnelCount;
|
uint8 RightTunnelCount;
|
||||||
uint8 VerticalTunnelHeight;
|
uint8 VerticalTunnelHeight;
|
||||||
|
rct_map_element * SurfaceElement;
|
||||||
|
bool DidPassSurface;
|
||||||
|
uint8 Unk141E9DB;
|
||||||
|
uint16 Unk141E9DC;
|
||||||
} paint_session;
|
} paint_session;
|
||||||
|
|
||||||
extern paint_session gPaintSession;
|
extern paint_session gPaintSession;
|
||||||
|
@ -183,6 +187,10 @@ extern paint_session gPaintSession;
|
||||||
#define gRightTunnels RCT2_ADDRESS(0x009E30B6, tunnel_entry)
|
#define gRightTunnels RCT2_ADDRESS(0x009E30B6, tunnel_entry)
|
||||||
#define gRightTunnelCount RCT2_GLOBAL(0x0141F56B, uint8)
|
#define gRightTunnelCount RCT2_GLOBAL(0x0141F56B, uint8)
|
||||||
#define gVerticalTunnelHeight RCT2_GLOBAL(0x009E323C, uint8)
|
#define gVerticalTunnelHeight RCT2_GLOBAL(0x009E323C, uint8)
|
||||||
|
#define gSurfaceElement RCT2_GLOBAL(0x009E3250, rct_map_element *)
|
||||||
|
#define gDidPassSurface RCT2_GLOBAL(0x009DE57C, bool)
|
||||||
|
#define g141E9DB RCT2_GLOBAL(0x0141E9DB, uint8)
|
||||||
|
#define gUnk141E9DC RCT2_GLOBAL(0x0141E9DC, uint16)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** rct2: 0x00993CC4 */
|
/** rct2: 0x00993CC4 */
|
||||||
|
|
|
@ -351,7 +351,7 @@ bool wooden_a_supports_paint_setup(sint32 supportType, sint32 special, sint32 he
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ bool wooden_a_supports_paint_setup(sint32 supportType, sint32 special, sint32 he
|
||||||
|
|
||||||
// Draw repeated supports for left over space
|
// Draw repeated supports for left over space
|
||||||
while (height != 0) {
|
while (height != 0) {
|
||||||
if ((z & 16) == 0 && height >= 2 && z + 16 != gUnk141E9DC) {
|
if ((z & 16) == 0 && height >= 2 && z + 16 != gPaintSession.Unk141E9DC) {
|
||||||
// Full support
|
// Full support
|
||||||
sint32 imageId = WoodenSupportImageIds[supportType].full | imageColourFlags;
|
sint32 imageId = WoodenSupportImageIds[supportType].full | imageColourFlags;
|
||||||
uint8 ah = height == 2 ? 23 : 28;
|
uint8 ah = height == 2 ? 23 : 28;
|
||||||
|
@ -505,7 +505,7 @@ bool wooden_b_supports_paint_setup(sint32 supportType, sint32 special, sint32 he
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
if (underground != NULL) *underground = false; // AND
|
if (underground != NULL) *underground = false; // AND
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ bool wooden_b_supports_paint_setup(sint32 supportType, sint32 special, sint32 he
|
||||||
|
|
||||||
if (!skipTo663004) {
|
if (!skipTo663004) {
|
||||||
while (heightSteps > 0) {
|
while (heightSteps > 0) {
|
||||||
if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == gUnk141E9DC) {
|
if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == gPaintSession.Unk141E9DC) {
|
||||||
sub_98196C(
|
sub_98196C(
|
||||||
WoodenSupportImageIds[supportType].half | imageColourFlags,
|
WoodenSupportImageIds[supportType].half | imageColourFlags,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -691,7 +691,7 @@ bool metal_a_supports_paint_setup(uint8 supportType, uint8 segment, sint32 speci
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ bool metal_b_supports_paint_setup(uint8 supportType, uint8 segment, sint32 speci
|
||||||
return false; // AND
|
return false; // AND
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
return false; // AND
|
return false; // AND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,7 +1082,7 @@ bool path_a_supports_paint_setup(sint32 supportType, sint32 special, sint32 heig
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ bool path_a_supports_paint_setup(sint32 supportType, sint32 special, sint32 heig
|
||||||
}
|
}
|
||||||
|
|
||||||
while (heightSteps > 0) {
|
while (heightSteps > 0) {
|
||||||
if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == gUnk141E9DC) {
|
if (baseHeight & 0x10 || heightSteps == 1 || baseHeight + 16 == gPaintSession.Unk141E9DC) {
|
||||||
|
|
||||||
uint32 imageId = (supportType * 24) + pathEntry->bridge_image + 23;
|
uint32 imageId = (supportType * 24) + pathEntry->bridge_image + 23;
|
||||||
|
|
||||||
|
@ -1260,7 +1260,7 @@ bool path_b_supports_paint_setup(sint32 segment, sint32 special, sint32 height,
|
||||||
return false; // AND
|
return false; // AND
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(g141E9DB & G141E9DB_FLAG_1)) {
|
if (!(gPaintSession.Unk141E9DB & G141E9DB_FLAG_1)) {
|
||||||
return false; // AND
|
return false; // AND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,12 +443,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 (!gDidPassSurface) {
|
if (!gPaintSession.DidPassSurface) {
|
||||||
// Should be above ground (have passed surface rendering)
|
// Should be above ground (have passed surface rendering)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rct_map_element * surfaceElement = gSurfaceElement;
|
rct_map_element * surfaceElement = gPaintSession.SurfaceElement;
|
||||||
if (surfaceElement->base_height != mapElement->base_height) {
|
if (surfaceElement->base_height != mapElement->base_height) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -577,7 +577,7 @@ bool track_paint_util_draw_station_covers(enum edge_t edge, bool hasFence, const
|
||||||
|
|
||||||
bool track_paint_util_draw_station_covers_2(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant)
|
bool track_paint_util_draw_station_covers_2(enum edge_t edge, bool hasFence, const rct_ride_entrance_definition * entranceStyle, uint8 direction, uint16 height, uint8 stationVariant)
|
||||||
{
|
{
|
||||||
if (!(g141E9DB & (G141E9DB_FLAG_1 | G141E9DB_FLAG_2))) {
|
if (!(gPaintSession.Unk141E9DB & (G141E9DB_FLAG_1 | G141E9DB_FLAG_2))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue