mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Add macro for support height
This commit is contained in:
committed by
Michał Janiszewski
parent
7bfdbbd409
commit
0333eb760a
@@ -344,6 +344,7 @@
|
||||
|
||||
#define RCT2_ADDRESS_FONT_CHAR_WIDTH 0x0141E9E8
|
||||
|
||||
#define RCT2_ADDRESS_CURRENT_SUPPORT_SEGMENTS 0x0141E9B4
|
||||
#define RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT 0x0141E9D8
|
||||
|
||||
#define RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER 0x0141ED68
|
||||
|
||||
@@ -158,10 +158,7 @@ void fence_paint(uint8 direction, int height, rct_map_element * map_element)
|
||||
imageColourFlags &= 0x0DFFFFFFF;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) < height) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height;
|
||||
RCT2_GLOBAL(0x141E9DA, uint8) = 0x20;
|
||||
}
|
||||
paint_util_set_general_support_height(height, 0x20);
|
||||
|
||||
uint32 dword_141F710 = 0;
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8) & 1) {
|
||||
|
||||
@@ -272,18 +272,18 @@ static void sub_68B3FB(int x, int y)
|
||||
return;
|
||||
}
|
||||
|
||||
static const int segmentOffsets[][3] = {
|
||||
{0xB4, 0xCC, 0xBc},
|
||||
{0xC8, 0xC4, 0xD4},
|
||||
{0xB8, 0xD0, 0xC0},
|
||||
static const int segmentPositions[][3] = {
|
||||
{0, 6, 2},
|
||||
{5, 4, 8},
|
||||
{1, 7, 3},
|
||||
};
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
uint16 segmentHeight = RCT2_GLOBAL(0x0141E900 + segmentOffsets[y][x], uint16);
|
||||
uint16 segmentHeight = gSupportSegments[segmentPositions[y][x]].height;
|
||||
int imageColourFlats = 0b101111 << 19 | 0x40000000;
|
||||
if (segmentHeight == 0xFFFF) {
|
||||
segmentHeight = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16);
|
||||
segmentHeight = gSupport.height;
|
||||
// white: 0b101101
|
||||
imageColourFlats = 0b111011 << 19 | 0x40000000;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ void paint_util_push_tunnel_right(uint16 height, uint8 type)
|
||||
|
||||
void paint_util_set_general_support_height(sint16 height, uint8 slope)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) >= height) {
|
||||
if (gSupport.height >= height) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -325,8 +325,8 @@ void paint_util_set_general_support_height(sint16 height, uint8 slope)
|
||||
|
||||
void paint_util_force_set_general_support_height(sint16 height, uint8 slope)
|
||||
{
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) = height;
|
||||
RCT2_GLOBAL(0x141E9DA, uint8) = slope;
|
||||
gSupport.height = height;
|
||||
gSupport.slope = slope;
|
||||
}
|
||||
|
||||
const uint16 segment_offsets[9] = {
|
||||
@@ -345,9 +345,9 @@ void paint_util_set_segment_support_height(int segments, uint16 height, uint8 sl
|
||||
{
|
||||
for (int s = 0; s < 9; s++) {
|
||||
if (segments & segment_offsets[s]) {
|
||||
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = height;
|
||||
gSupportSegments[s].height = height;
|
||||
if (height != 0xFFFF) {
|
||||
RCT2_GLOBAL(0x0141E9B6 + s * 4, uint8) = slope;
|
||||
gSupportSegments[s].slope = slope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,15 @@ enum PAINT_STRUCT_FLAGS {
|
||||
PAINT_STRUCT_FLAG_IS_MASKED = (1 << 0)
|
||||
};
|
||||
|
||||
typedef struct support_height {
|
||||
uint16 height;
|
||||
uint8 slope;
|
||||
uint8 pad;
|
||||
} support_height;
|
||||
|
||||
#define gPaintInteractionType RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8)
|
||||
#define gSupportSegments RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_SUPPORT_SEGMENTS, support_height)
|
||||
#define gSupport RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, support_height)
|
||||
|
||||
/** rct2: 0x00993CC4 */
|
||||
extern const uint32 construction_markers[];
|
||||
|
||||
@@ -186,7 +186,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
|
||||
return false;
|
||||
}
|
||||
|
||||
int z = floor2(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16) + 15, 16);
|
||||
int z = floor2(gSupport.height + 15, 16);
|
||||
height -= z;
|
||||
if (height < 0) {
|
||||
if (underground != NULL) {
|
||||
@@ -201,7 +201,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
|
||||
int rotation = get_current_rotation();
|
||||
|
||||
// Draw base support (usually shaped to the slope)
|
||||
int slope = RCT2_GLOBAL(0x0141E9DA, uint8);
|
||||
int slope = gSupport.slope;
|
||||
if (slope & (1 << 5)) {
|
||||
// Above scenery (just put a base piece above it)
|
||||
drawFlatPiece = true;
|
||||
@@ -341,7 +341,7 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
|
||||
|
||||
const uint8 rotation = get_current_rotation();
|
||||
RCT2_GLOBAL(0x009E3294, sint16) = -1;
|
||||
if (height < RCT2_ADDRESS(0x0141E9B4, uint16)[segment * 2]){
|
||||
if (height < gSupportSegments[segment].height){
|
||||
RCT2_GLOBAL(0x009E3294, sint16) = height;
|
||||
|
||||
height -= RCT2_ADDRESS(0x0097B142, sint16)[supportType];
|
||||
@@ -351,16 +351,16 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
|
||||
uint8* esi = &(RCT2_ADDRESS(0x0097AF32, uint8)[rotation * 2]);
|
||||
|
||||
uint8 newSegment = esi[segment * 8];
|
||||
if (height <= RCT2_ADDRESS(0x0141E9B4, uint16)[newSegment * 2]) {
|
||||
if (height <= gSupportSegments[newSegment].height) {
|
||||
esi += 72;
|
||||
newSegment = esi[segment * 8];
|
||||
if (height <= RCT2_ADDRESS(0x0141E9B4, uint16)[newSegment * 2]) {
|
||||
if (height <= gSupportSegments[newSegment].height) {
|
||||
esi += 72;
|
||||
newSegment = esi[segment * 8];
|
||||
if (height <= RCT2_ADDRESS(0x0141E9B4, uint16)[newSegment * 2]) {
|
||||
if (height <= gSupportSegments[newSegment].height) {
|
||||
esi += 72;
|
||||
newSegment = esi[segment * 8];
|
||||
if (height <= RCT2_ADDRESS(0x0141E9B4, uint16)[newSegment * 2]) {
|
||||
if (height <= gSupportSegments[newSegment].height) {
|
||||
esi += 72;
|
||||
newSegment = esi[segment * 8];
|
||||
return true;
|
||||
@@ -386,23 +386,23 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
|
||||
segment = newSegment;
|
||||
}
|
||||
sint16 si = height;
|
||||
if (RCT2_ADDRESS(0x00141E9B4 + 2, uint8)[segment * 4] & (1 << 5) ||
|
||||
height - RCT2_ADDRESS(0x00141E9B4, uint16)[segment * 2] < 6 ||
|
||||
if (gSupportSegments[segment].slope & (1 << 5) ||
|
||||
height - gSupportSegments[segment].height < 6 ||
|
||||
RCT2_ADDRESS(0x0097B15C, uint16)[supportType * 2] == 0
|
||||
) {
|
||||
|
||||
height = RCT2_ADDRESS(0x00141E9B4, uint16)[segment * 2];
|
||||
height = gSupportSegments[segment].height;
|
||||
}else{
|
||||
sint8 xOffset = RCT2_ADDRESS(0x0097AF20, sint8)[segment * 2];
|
||||
sint8 yOffset = RCT2_ADDRESS(0x0097AF20 + 1, sint8)[segment * 2];
|
||||
|
||||
uint32 image_id = RCT2_ADDRESS(0x0097B15C, uint16)[supportType * 2];
|
||||
image_id += RCT2_ADDRESS(0x0097B404, sint16)[RCT2_ADDRESS(0x00141E9B4 + 2, sint16)[segment * 2] & 0x1F];
|
||||
image_id += RCT2_ADDRESS(0x0097B404, sint16)[gSupportSegments[segment].slope & 0x1F];
|
||||
image_id |= imageColourFlags;
|
||||
|
||||
sub_98196C(image_id, xOffset, yOffset, 0, 0, 5, RCT2_ADDRESS(0x0141E9B4, uint16)[segment * 2], rotation);
|
||||
sub_98196C(image_id, xOffset, yOffset, 0, 0, 5, gSupportSegments[segment].height, rotation);
|
||||
|
||||
height = RCT2_ADDRESS(0x0141E9B4, uint16)[segment * 2] + 6;
|
||||
height = gSupportSegments[segment].height + 6;
|
||||
}
|
||||
|
||||
|
||||
@@ -458,8 +458,8 @@ bool metal_a_supports_paint_setup(int supportType, int segment, int special, int
|
||||
height += z;
|
||||
}
|
||||
|
||||
RCT2_ADDRESS(0x00141E9B4, uint16)[segment * 2] = RCT2_GLOBAL(0x009E3294, sint16);
|
||||
RCT2_ADDRESS(0x00141E9B4 + 2, uint8)[segment * 4] = 0x20;
|
||||
gSupportSegments[segment].height = RCT2_GLOBAL(0x009E3294, sint16);
|
||||
gSupportSegments[segment].slope = 0x20;
|
||||
|
||||
height = originalHeight;
|
||||
if (special == 0)
|
||||
|
||||
@@ -104,10 +104,10 @@ static void chairlift_paint_util_draw_supports(int segments, uint16 height)
|
||||
if (!(segments & segment_offsets[s])) {
|
||||
continue;
|
||||
}
|
||||
uint16 temp = RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16);
|
||||
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, uint16);
|
||||
uint16 temp = gSupportSegments[s].height;
|
||||
gSupportSegments[s].height = gSupport.height;
|
||||
metal_a_supports_paint_setup(10, s, 0, height, RCT2_GLOBAL(0x00F4419C, uint32));
|
||||
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = temp;
|
||||
gSupportSegments[s].height = temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user