1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Paint flat track

This commit is contained in:
Marijn van der Werf
2016-05-20 22:10:05 +02:00
parent 77bab8cd73
commit ed137f6fb8
2 changed files with 61 additions and 188 deletions

View File

@@ -56,6 +56,7 @@ enum
TUNNEL_6 = 6,
TUNNEL_7 = 7,
TUNNEL_8 = 8,
TUNNEL_10 = 0x0A,
TUNNEL_12 = 0x0C,
TUNNEL_14 = 0x0E
};

View File

@@ -21,94 +21,69 @@
#include "../ride_data.h"
#include "../track_data.h"
#include "../track_paint.h"
/* rct2: 0x007667AE */
static rct_xy16 loc_7667AE[] = {
{ .x = 0, .y = -1 },
{ .x = 1, .y = 0 },
{ .x = 0, .y = 1},
{ .x = -1, .y = 0 },
};
/* rct2: 0x007667AC */
static rct_xy16 loc_7667AC[] = {
{ .x = -1, .y = 0 },
{ .x = 0, .y = -1 },
{ .x = 1, .y = 0 },
{ .x = 0, .y = 1 },
};
#include "../../world/map.h"
enum {
SPR_MINI_GOLF_FLAT_NE_SW = 14404,
SPR_MINI_GOLF_FLAT_NW_SE,
SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW = 14406,
SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE,
SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW = 14408,
SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE,
SPR_MINI_GOLF_FLAT_SW_NE = 14404,
SPR_MINI_GOLF_FLAT_NW_SE = 14405,
SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE = 14406,
SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE = 14407,
SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE = 14408,
SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE = 14409,
SPR_MINI_GOLF_STATION_FLOOR = 14410,
SPR_MINI_GOLF_TURN_NW_SW = 14411,
SPR_MINI_GOLF_TURN_SW_NW = 14411,
SPR_MINI_GOLF_TURN_NW_NE = 14412,
SPR_MINI_GOLF_TURN_NE_SE = 14413,
SPR_MINI_GOLF_TURN_SE_SW = 14413,
};
/**
* rct2: 0x0087FA27
*/
static void mini_golf_flat_paint_setup_rot_0_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
uint32 image_id = SPR_MINI_GOLF_FLAT_NE_SW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 20, 1, height, 0, 0, height, get_current_rotation());
/** rct2: 0x0087F10C */
static void paint_mini_golf_track_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
uint32 imageId;
if (direction & 1) {
imageId = SPR_MINI_GOLF_FLAT_NW_SE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
paint_util_push_tunnel_right(height, TUNNEL_10);
} else {
imageId = SPR_MINI_GOLF_FLAT_SW_NE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
paint_util_push_tunnel_left(height, TUNNEL_10);
}
metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32));
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, direction), 0xFFFF, 0);
if (RCT2_GLOBAL(0x9DE57C, bool)) {
rct_map_element * surfaceElement = RCT2_GLOBAL(0x9E3250, rct_map_element *);
if (surfaceElement->base_height != mapElement->base_height || surfaceElement->properties.surface.slope & 0x1F) {
if (direction & 1) {
imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_NW_SE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 1, 32, 7, height, 10, 0, height + 2, get_current_rotation());
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NW_SE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(imageId, 0, 0, 1, 32, 7, height, 22, 0, height + 2, get_current_rotation());
} else {
imageId = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation());
uint32 eax = 0xFFFFFFFF | ((height / 16) & 0xFF);
RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax;
RCT2_GLOBAL(0x141F56A, uint8)++;
bool drawFences = false;
if (RCT2_GLOBAL(0x9DE57C, uint16) & 1) {
rct_map_element *highlight = RCT2_ADDRESS(0x009E3250, rct_map_element);
if (mapElement->base_height != highlight->base_height) {
drawFences = true;
} else {
// test byte ptr [edi+4], 1Fh
// jz loc_87FB74
imageId = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation());
}
}
}
if (drawFences) {
image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 10, height + 2, get_current_rotation());
image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 22, height + 2, get_current_rotation());
}
height += 32;
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) = 32;
}
paint_util_set_general_support_height(height + 32, 0x20);
}
/**
* rct2: 0x0087FB91
*/
static void mini_golf_flat_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
}
/**
* rct2: 0x0087F22C
*/
static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
/** rct2: 0x */
static void paint_mini_golf_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement)
{
rct_ride *ride = get_ride(rideIndex);
int ebx = ride->entrance_style;
uint32 flags = RideEntranceDefinitions[ride->entrance_style].flags;
uint32 flags = 0;
if (RCT2_GLOBAL(0x00F441A0, uint32) & 0x20000000) {
@@ -122,20 +97,18 @@ static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSe
sub_98197C(image_id, 0, 0, 32, 28, 1, height, 0, 0, height, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[get_current_rotation()].x) |
(((y / 32) + loc_7667AE[get_current_rotation()].y) << 8);
uint16 entranceLoc = 0;
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32);
image_id = SPR_MINI_GOLF_FLAT_FENCE_BACK_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, -10, 32, 1, 7, height, 0, 0, height + 1, get_current_rotation());
RCT2_GLOBAL(0xF441E8, uint32)++;
}
image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_NE_SW | RCT2_GLOBAL(0x00F441A0, uint32);
image_id = SPR_MINI_GOLF_FLAT_FENCE_FRONT_SW_NE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 10, 32, 1, 7, height, 0, 31, height + 2, get_current_rotation());
@@ -188,17 +161,11 @@ static void mini_golf_station_paint_setup_rot_0_1(uint8 rideIndex, uint8 trackSe
}
}
/**
* rct2: 0x0087F625
*/
static void mini_golf_station_paint_setup_rot_1_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
}
/**
* rct2: 0x00880C23
*/
static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
uint32 image_id = SPR_MINI_GOLF_TURN_NW_SW | RCT2_GLOBAL(0x00F44198, uint32);
uint32 image_id = SPR_MINI_GOLF_TURN_SW_NW | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 26, 24, 1, height, 6, 2, height, get_current_rotation());
metal_a_supports_paint_setup(3, 4, 0, height, RCT2_GLOBAL(0x00F4419C, uint32));
@@ -224,74 +191,11 @@ static void mini_golf_quarter_turn_paint_setup_nw_sw(uint8 rideIndex, uint8 trac
}
static void get_color_name(int color, char *buffer) {
char *COLOUR_NAMES[] = {
"COLOUR_BLACK",
"COLOUR_GREY",
"COLOUR_WHITE",
"COLOUR_DARK_PURPLE",
"COLOUR_LIGHT_PURPLE",
"COLOUR_BRIGHT_PURPLE",
"COLOUR_DARK_BLUE",
"COLOUR_LIGHT_BLUE",
"COLOUR_ICY_BLUE",
"COLOUR_TEAL",
"COLOUR_AQUAMARINE",
"COLOUR_SATURATED_GREEN",
"COLOUR_DARK_GREEN",
"COLOUR_MOSS_GREEN",
"COLOUR_BRIGHT_GREEN",
"COLOUR_OLIVE_GREEN",
"COLOUR_DARK_OLIVE_GREEN",
"COLOUR_BRIGHT_YELLOW",
"COLOUR_YELLOW",
"COLOUR_DARK_YELLOW",
"COLOUR_LIGHT_ORANGE",
"COLOUR_DARK_ORANGE",
"COLOUR_LIGHT_BROWN",
"COLOUR_SATURATED_BROWN",
"COLOUR_DARK_BROWN",
"COLOUR_SALMON_PINK",
"COLOUR_BORDEAUX_RED",
"COLOUR_SATURATED_RED",
"COLOUR_BRIGHT_RED",
"COLOUR_DARK_PINK",
"COLOUR_BRIGHT_PINK",
"COLOUR_LIGHT_PINK",
};
sprintf(buffer, "%s", COLOUR_NAMES[color]);
}
static void log_color(uint32 color) {
return;
int image_id = color & 0x7ffff;
int color_1 = (color >> 19) & 31;
int color_2 = (color >> 24) & 31;
int flags = color >> 29;
char color_1_name[128] = {0};
get_color_name(color_1, color_1_name);
char color_2_name[128] = {0};
get_color_name(color_2, color_2_name);
printf("image:%d, color A: %s, colorB: %s, flags:%X\n", image_id, color_1_name, color_2_name, flags);
}
/**
* rct2: 0x0088129C
*/
static void mini_golf_hole_a_paint_setup_0_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
//printf("----\n");
log_color(RCT2_GLOBAL(0x00F44198, uint32));
log_color(RCT2_GLOBAL(0x00F441A0, uint32));
log_color(RCT2_GLOBAL(0x00F441A4, uint32));
log_color(RCT2_GLOBAL(0x00F4419C, uint32));
log_color(RCT2_ADDRESS(0x00993CC4, uint32)[gConfigGeneral.construction_marker_colour]);
bool drewSupports = wooden_a_supports_paint_setup(0, 0, height, RCT2_GLOBAL(0x00F4419C, uint32), NULL);
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
@@ -344,62 +248,30 @@ static void mini_golf_hole_a_paint_setup_0(uint8 rideIndex, uint8 trackSequence,
TRACK_PAINT_FUNCTION get_track_paint_function_mini_golf(int trackType, int direction) {
switch (trackType) {
case TRACK_ELEM_FLAT:
if (direction == 0 || direction == 2) {
return mini_golf_flat_paint_setup_rot_0_2;
}
return mini_golf_flat_paint_setup_rot_1_3;
return paint_mini_golf_track_flat;
case TRACK_ELEM_25_DEG_UP:
// 0x0087F11C
break;
case TRACK_ELEM_FLAT_TO_25_DEG_UP:
// 0x0087F12C
break;
case TRACK_ELEM_25_DEG_UP_TO_FLAT:
// 0x0087F13C
break;
case TRACK_ELEM_25_DEG_DOWN:
// 0x0087F14C
break;
case TRACK_ELEM_FLAT_TO_25_DEG_DOWN:
// 0x0087F15C
break;
case TRACK_ELEM_25_DEG_DOWN_TO_FLAT:
// 0x0087F16C
break;
case TRACK_ELEM_BEGIN_STATION:
case TRACK_ELEM_MIDDLE_STATION:
case TRACK_ELEM_END_STATION:
if (direction == 0 || direction == 2) {
return mini_golf_station_paint_setup_rot_0_1;
}
return paint_mini_golf_station;
return mini_golf_station_paint_setup_rot_1_3;
case TRACK_ELEM_25_DEG_UP:
case TRACK_ELEM_FLAT_TO_25_DEG_UP:
case TRACK_ELEM_25_DEG_UP_TO_FLAT:
case TRACK_ELEM_25_DEG_DOWN:
case TRACK_ELEM_FLAT_TO_25_DEG_DOWN:
case TRACK_ELEM_25_DEG_DOWN_TO_FLAT:
case TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE:
if (direction == 0) return mini_golf_quarter_turn_paint_setup_nw_sw;
// 0x0087F1AC
break;
case TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE:
if (direction == 1) return mini_golf_quarter_turn_paint_setup_nw_sw;
// 0x0087F1BC
break;
case TRACK_ELEM_MINI_GOLF_HOLE_A:
if (direction == 0) return mini_golf_hole_a_paint_setup_0;
// 0x0087F1CC
break;
case TRACK_ELEM_MINI_GOLF_HOLE_B:
// 0x0087F1DC
break;
case TRACK_ELEM_MINI_GOLF_HOLE_C:
// 0x0087F1EC
break;
case TRACK_ELEM_MINI_GOLF_HOLE_D:
// 0x0087F1FC
break;
case TRACK_ELEM_MINI_GOLF_HOLE_E:
// 0x0087F20C
break;
return NULL;
}
return NULL;