Add console command for painting segment heights (#3708)

This commit is contained in:
Marijn van der Werf 2016-05-23 11:29:11 +02:00 committed by Ted John
parent 03b8a5b1da
commit 603a255567
3 changed files with 48 additions and 0 deletions

View File

@ -39,6 +39,7 @@
#include "console.h"
#include "window.h"
#include "viewport.h"
#include "../paint/map_element/map_element.h"
#define CONSOLE_BUFFER_SIZE 8192
#define CONSOLE_BUFFER_2_SIZE 256
@ -625,6 +626,9 @@ static int cc_get(const utf8 **argv, int argc)
else if (strcmp(argv[0], "window_scale") == 0) {
console_printf("window_scale %.3f", gConfigGeneral.window_scale);
}
else if (strcmp(argv[0], "paint_segments") == 0) {
console_printf("paint_segments %d", gShowSupportSegmentHeights);
}
else {
console_writeline_warning("Invalid variable.");
}
@ -789,6 +793,11 @@ static int cc_set(const utf8 **argv, int argc)
platform_trigger_resize();
console_execute_silent("get window_scale");
}
else if (strcmp(argv[0], "paint_segments") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
gShowSupportSegmentHeights = (bool)(int_val[0]);
gfx_invalidate_screen();
console_execute_silent("get paint_segments");
}
else if (invalidArgs) {
console_writeline_error("Invalid arguments.");
}

View File

@ -124,6 +124,8 @@ static void blank_tiles_paint(int x, int y)
sub_98196C(3123, 0, 0, 32, 32, -1, 16, get_current_rotation());
}
bool gShowSupportSegmentHeights = false;
/**
*
* rct2: 0x0068B3FB
@ -261,6 +263,41 @@ static void sub_68B3FB(int x, int y)
}
RCT2_GLOBAL(0x9DE574, uint32_t) = dword_9DE574;
} while (!map_element_is_last_for_tile(map_element++));
if (!gShowSupportSegmentHeights) {
return;
}
if (map_element_get_type(map_element - 1) == MAP_ELEMENT_TYPE_SURFACE) {
return;
}
static const int segmentOffsets[][3] = {
{0xB4, 0xCC, 0xBc},
{0xC8, 0xC4, 0xD4},
{0xB8, 0xD0, 0xC0},
};
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
uint16 segmentHeight = RCT2_GLOBAL(0x0141E900 + segmentOffsets[y][x], uint16);
int imageColourFlats = 0b101111 << 19 | 0x40000000;
if (segmentHeight == 0xFFFF) {
segmentHeight = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, sint16);
// white: 0b101101
imageColourFlats = 0b111011 << 19 | 0x40000000;
}
int xOffset = y * 10;
int yOffset = -22 + x * 10;
paint_struct * ps = sub_98197C(5504 | imageColourFlats, xOffset, yOffset, 10, 10, 1, segmentHeight, xOffset + 1, yOffset + 16, segmentHeight, get_current_rotation());
if (ps != NULL) {
ps->flags &= PAINT_STRUCT_FLAG_IS_MASKED;
ps->colour_image_id = COLOUR_BORDEAUX_RED;
}
}
}
}
void paint_util_push_tunnel_left(uint16 height, uint8 type)

View File

@ -61,6 +61,8 @@ enum
TUNNEL_14 = 0x0E
};
extern bool gShowSupportSegmentHeights;
void paint_util_push_tunnel_left(uint16 height, uint8 type);
void paint_util_push_tunnel_right(uint16 height, uint8 type);