Start cleanup/harmonisation of paint code

This commit is contained in:
Marijn van der Werf 2016-05-17 19:10:25 +02:00
parent cc0c3cc077
commit f3a563db8e
9 changed files with 393 additions and 897 deletions

View File

@ -24,6 +24,7 @@
#include "../../ride/ride_data.h"
#include "../../world/entrance.h"
#include "../../world/footpath.h"
#include "map_element.h"
/**
*
@ -103,14 +104,10 @@ void ride_entrance_exit_paint(uint8 direction, int height, rct_map_element* map_
sub_98199C(transparant_image_id, 0, 0, lengthX, lengthY, ah, height, (direction & 1) ? 28 : 2, (direction & 1) ? 2 : 28, height, get_current_rotation());
}
uint32 eax = 0xFFFF0600 | ((height / 16) & 0xFF);
if (direction & 1){
RCT2_ADDRESS(0x009E30B6, uint32)[RCT2_GLOBAL(0x141F56B, uint8) / 2] = eax;
RCT2_GLOBAL(0x141F56B, uint8)++;
}
else{
RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax;
RCT2_GLOBAL(0x141F56A, uint8)++;
if (direction & 1) {
paint_util_push_tunnel_right(height, TUNNEL_6);
} else {
paint_util_push_tunnel_left(height, TUNNEL_6);
}
if (!is_exit &&

View File

@ -277,3 +277,56 @@ static void sub_68B3FB(int x, int y)
RCT2_GLOBAL(0x9DE574, uint32_t) = dword_9DE574;
} while (!map_element_is_last_for_tile(map_element++));
}
void paint_util_push_tunnel_left(uint16 height, uint8 type)
{
uint32 eax = 0xFFFF0000 | ((height / 16) & 0xFF) | type << 8;
RCT2_ADDRESS(0x009E3138, uint32)[RCT2_GLOBAL(0x141F56A, uint8) / 2] = eax;
RCT2_GLOBAL(0x141F56A, uint8)++;
}
void paint_util_push_tunnel_right(uint16 height, uint8 type)
{
uint32 eax = 0xFFFF0000 | ((height / 16) & 0xFF) | type << 8;
RCT2_ADDRESS(0x009E30B6, uint32)[RCT2_GLOBAL(0x141F56B, uint8) / 2] = eax;
RCT2_GLOBAL(0x141F56B, uint8)++;
}
void paint_util_set_general_support_height(uint16 height, uint8 flags)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, uint16) >= height) {
return;
}
paint_util_force_set_general_support_height(height, flags);
}
void paint_util_force_set_general_support_height(uint16 height, uint8 flags)
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, uint16) = height;
RCT2_GLOBAL(0x141E9DA, uint8) = flags;
}
const uint segment_offsets[9] = {
SEGMENT_B4,
SEGMENT_B8,
SEGMENT_BC,
SEGMENT_C0,
SEGMENT_C4,
SEGMENT_C8,
SEGMENT_CC,
SEGMENT_D0,
SEGMENT_D4
};
void paint_util_set_segment_support_height(int segments, uint16 height, uint8 flags)
{
for (int s = 0; s < 9; s++) {
if (segments & segment_offsets[s]) {
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = height;
if (height != 0xFFFF) {
RCT2_GLOBAL(0x0141E9B6 + s * 4, uint8) = flags;
}
}
}
}

View File

@ -20,6 +20,45 @@
#include "../../common.h"
#include "../../world/map.h"
typedef enum edge
{
EDGE_NE = (1 << 0),
EDGE_SE = (1 << 1),
EDGE_SW = (1 << 2),
EDGE_NW = (1 << 3),
EDGE_BOTTOMLEFT = EDGE_SW,
EDGE_BOTTOMRIGHT = EDGE_SE,
EDGE_TOPLEFT = EDGE_NW,
EDGE_TOPRIGHT = EDGE_NE
} edge;
enum
{
SEGMENT_B4 = (1 << 0), // 0
SEGMENT_CC = (1 << 1), // 6
SEGMENT_BC = (1 << 2), // 2
SEGMENT_D4 = (1 << 3), // 8
SEGMENT_C0 = (1 << 4), // 3
SEGMENT_D0 = (1 << 5), // 7
SEGMENT_B8 = (1 << 6), // 1
SEGMENT_C8 = (1 << 7), // 5
SEGMENT_C4 = (1 << 8), // 4
};
static const int SEGMENTS_ALL = SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4;
enum
{
TUNNEL_6 = 6,
};
void paint_util_push_tunnel_left(uint16 height, uint8 type);
void paint_util_push_tunnel_right(uint16 height, uint8 type);
void paint_util_set_general_support_height(uint16 height, uint8 flags);
void paint_util_force_set_general_support_height(uint16 height, uint8 flags);
void paint_util_set_segment_support_height(int segments, uint16 height, uint8 flags);
void map_element_paint_setup(int x, int y);
void entrance_paint(uint8 direction, int height, rct_map_element* map_element);

View File

@ -21,6 +21,7 @@
#include "../../config.h"
#include "../../peep/staff.h"
#include "../../world/map.h"
#include "map_element.h"
const uint8 byte_97B444[] = {
0, 2, 1, 3, 8, 10, 9, 11, 4, 6,
@ -303,20 +304,6 @@ const uint32 dword_97B898[][2] = {
{SPR_TERRAIN_GRASS_MOWED, SPR_TERRAIN_GRASS_MOWED_GRID}
};
enum
{
SEGMENT_B4 = (1 << 0),
SEGMENT_B8 = (1 << 1),
SEGMENT_BC = (1 << 2),
SEGMENT_C0 = (1 << 3),
SEGMENT_C4 = (1 << 4),
SEGMENT_C8 = (1 << 5),
SEGMENT_CC = (1 << 6),
SEGMENT_D0 = (1 << 7),
SEGMENT_D4 = (1 << 8),
};
typedef struct tile_descriptor tile_descriptor;
struct tile_descriptor
@ -327,22 +314,6 @@ struct tile_descriptor
corner_height corner_heights;
};
static void paint_setup_set_segment_support_height(int flags, uint16 height, uint8 segment_flags)
{
for (int s = 0; s < 9; s++) {
if (flags & (1 << s)) {
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = height;
RCT2_GLOBAL(0x0141E9B6 + s * 4, uint8) = segment_flags;
}
}
}
static void paint_setup_set_support_height(uint16 height, uint8 segment_flags)
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PAINT_TILE_MAX_HEIGHT, uint16) = height;
RCT2_GLOBAL(0x0141E9DA, uint8) = segment_flags;
}
uint8 viewport_surface_paint_setup_get_relative_slope(rct_map_element * mapElement, int rotation)
{
uint8 slope = mapElement->properties.surface.slope;
@ -354,15 +325,6 @@ uint8 viewport_surface_paint_setup_get_relative_slope(rct_map_element * mapEleme
return ebx | di;
}
enum edge
{
EDGE_BOTTOMLEFT,
EDGE_BOTTOMRIGHT,
EDGE_TOPLEFT,
EDGE_TOPRIGHT
};
typedef struct viewport_surface_paint_struct_0 {
uint32 var_00;
uint32 var_04;
@ -1552,12 +1514,12 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 00 00 00
// 00 00
// 00
paint_setup_set_segment_support_height(
paint_util_set_segment_support_height(
SEGMENT_B4 | SEGMENT_B8 | SEGMENT_BC | SEGMENT_C0 | SEGMENT_C4 | SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4,
height,
0
);
paint_setup_set_support_height(height, 0);
paint_util_force_set_general_support_height(height, 0);
break;
case 1:
@ -1567,11 +1529,11 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 01 01 01
// 1B 1B
// 1B
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, height, 0);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 1);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_C0, height + 6 + 6, 0x1B);
paint_setup_set_support_height(height, 1);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, height, 0);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 1);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_C0, height + 6 + 6, 0x1B);
paint_util_force_set_general_support_height(height, 1);
break;
case 2:
@ -1581,11 +1543,11 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 17 02 00
// 17 00
// 02
paint_setup_set_segment_support_height(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, height, 0);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 2);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_B8, height + 6 + 6, 0x17);
paint_setup_set_support_height(height, 2);
paint_util_set_segment_support_height(SEGMENT_BC | SEGMENT_CC | SEGMENT_D4, height, 0);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 2);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_B8, height + 6 + 6, 0x17);
paint_util_force_set_general_support_height(height, 2);
break;
case 3:
@ -1595,10 +1557,10 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 03 03 03
// 03 03
// 03
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2, 3);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 3);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2 + 6 + 6, 3);
paint_setup_set_support_height(height, 3);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2, 3);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 3);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2 + 6 + 6, 3);
paint_util_force_set_general_support_height(height, 3);
break;
case 4:
@ -1608,11 +1570,11 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 04 04 04
// 00 00
// 00
paint_setup_set_segment_support_height(SEGMENT_C0 | SEGMENT_D0 | SEGMENT_D4, height, 0);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 4);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_B4, height + 6 + 6, 0x1E);
paint_setup_set_support_height(height, 4);
paint_util_set_segment_support_height(SEGMENT_C0 | SEGMENT_D0 | SEGMENT_D4, height, 0);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 4);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_B4, height + 6 + 6, 0x1E);
paint_util_force_set_general_support_height(height, 4);
break;
case 5:
@ -1622,12 +1584,12 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 05 05 05 ░░ ░░ ░░
// 1B 1B ▒▒ ▒▒
// 1B ▓▓
paint_setup_set_segment_support_height(SEGMENT_B4, height + 6 + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 5);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_C0, height + 6 + 6, 0x1B);
paint_setup_set_support_height(height, 5);
paint_util_set_segment_support_height(SEGMENT_B4, height + 6 + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height, 5);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_C0, height + 6 + 6, 0x1B);
paint_util_force_set_general_support_height(height, 5);
break;
case 6:
@ -1637,10 +1599,10 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 06 06 06 ▓▓ ▒▒ ░░
// 06 06 ▒▒ ░░
// 06 ░░
paint_setup_set_segment_support_height(SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0, height + 2, 6);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 6);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4, height + 2 + 6 + 6, 6);
paint_setup_set_support_height(height, 6);
paint_util_set_segment_support_height(SEGMENT_BC | SEGMENT_D4 | SEGMENT_C0, height + 2, 6);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 6);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_B4, height + 2 + 6 + 6, 6);
paint_util_force_set_general_support_height(height, 6);
break;
case 7:
@ -1650,113 +1612,113 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
// 00 07 17 ▓▓ ▓▓ ░░
// 00 17 ▓▓ ▒▒
// 07 ▓▓
paint_setup_set_segment_support_height(SEGMENT_BC, height + 4, 0x17);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 7);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0 | SEGMENT_B8, height + 4 + 6 + 6, 0);
paint_setup_set_support_height(height, 7);
paint_util_set_segment_support_height(SEGMENT_BC, height + 4, 0x17);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 7);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0 | SEGMENT_B8, height + 4 + 6 + 6, 0);
paint_util_force_set_general_support_height(height, 7);
break;
case 8:
// loc_6620D8
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D0, height, 0);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 8);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_BC, height + 6 + 6, 0x1D);
paint_setup_set_support_height(height, 8);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C8 | SEGMENT_D0, height, 0);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 8);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_BC, height + 6 + 6, 0x1D);
paint_util_force_set_general_support_height(height, 8);
break;
case 9:
// loc_66216D
paint_setup_set_support_height(height, 9);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8, height + 2, 9);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 9);
paint_setup_set_segment_support_height(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, height + 2 + 6 + 6, 9);
paint_util_force_set_general_support_height(height, 9);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_B8, height + 2, 9);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C4 | SEGMENT_CC, height + 2 + 6, 9);
paint_util_set_segment_support_height(SEGMENT_C0 | SEGMENT_D4 | SEGMENT_BC, height + 2 + 6 + 6, 9);
break;
case 10:
// loc_662206
paint_setup_set_support_height(height, 0xA);
paint_setup_set_segment_support_height(SEGMENT_B8, height + 6 + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 0xA);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_BC, height + 6 + 6, 0x1D);
paint_util_force_set_general_support_height(height, 0xA);
paint_util_set_segment_support_height(SEGMENT_B8, height + 6 + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height, 0xA);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_BC, height + 6 + 6, 0x1D);
break;
case 11:
// loc_66229B
paint_setup_set_support_height(height, 0xB);
paint_setup_set_segment_support_height(SEGMENT_B4, height + 4, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xB);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C0, height + 4 + 6 + 6, 0);
paint_util_force_set_general_support_height(height, 0xB);
paint_util_set_segment_support_height(SEGMENT_B4, height + 4, 0x1B);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xB);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4 | SEGMENT_C0, height + 4 + 6 + 6, 0);
break;
case 12:
// loc_662334
paint_setup_set_support_height(height, 0xC);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2, 0xC);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 0xC);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2 + 6 + 6, 0xC);
paint_util_force_set_general_support_height(height, 0xC);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_D0 | SEGMENT_C0, height + 2, 0xC);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_C4 | SEGMENT_D4, height + 2 + 6, 0xC);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_CC | SEGMENT_BC, height + 2 + 6 + 6, 0xC);
break;
case 13:
// loc_6623CD
paint_setup_set_support_height(height, 0xD);
paint_setup_set_segment_support_height(SEGMENT_B8, height + 4, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0xD);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, height + 4 + 6 + 6, 0);
paint_util_force_set_general_support_height(height, 0xD);
paint_util_set_segment_support_height(SEGMENT_B8, height + 4, 0x1D);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0xD);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4 | SEGMENT_BC, height + 4 + 6 + 6, 0);
break;
case 14:
// loc_662466
paint_setup_set_support_height(height, 0xE);
paint_setup_set_segment_support_height(SEGMENT_C0, height + 4, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xE);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC | SEGMENT_B4, height + 4 + 6 + 6, 0);
paint_util_force_set_general_support_height(height, 0xE);
paint_util_set_segment_support_height(SEGMENT_C0, height + 4, 0x1E);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0xE);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC | SEGMENT_B4, height + 4 + 6 + 6, 0);
break;
case 23:
// loc_6624FF
paint_setup_set_support_height(height, 0x17);
paint_setup_set_segment_support_height(SEGMENT_BC, height + 4, 0x17);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6 + 6 + 6, 0x17);
paint_setup_set_segment_support_height(SEGMENT_B8, height + 4 + 6 + 6 + 6 + 6, 0x17);
paint_util_force_set_general_support_height(height, 0x17);
paint_util_set_segment_support_height(SEGMENT_BC, height + 4, 0x17);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6 + 6 + 6, 0x17);
paint_util_set_segment_support_height(SEGMENT_B8, height + 4 + 6 + 6 + 6 + 6, 0x17);
break;
case 27:
// loc_6625A0
paint_setup_set_support_height(height, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_B4, height + 4, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1B);
paint_setup_set_segment_support_height(SEGMENT_C0, height + 4 + 6 + 6 + 6 + 6, 0x1B);
paint_util_force_set_general_support_height(height, 0x1B);
paint_util_set_segment_support_height(SEGMENT_B4, height + 4, 0x1B);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1B);
paint_util_set_segment_support_height(SEGMENT_C0, height + 4 + 6 + 6 + 6 + 6, 0x1B);
break;
case 29:
// loc_662641
paint_setup_set_support_height(height, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_B8, height + 4, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1D);
paint_setup_set_segment_support_height(SEGMENT_BC, height + 4 + 6 + 6 + 6 + 6, 0x1D);
paint_util_force_set_general_support_height(height, 0x1D);
paint_util_set_segment_support_height(SEGMENT_B8, height + 4, 0x1D);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_D0, height + 4 + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C4 | SEGMENT_C0, height + 4 + 6 + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_D4, height + 4 + 6 + 6 + 6, 0x1D);
paint_util_set_segment_support_height(SEGMENT_BC, height + 4 + 6 + 6 + 6 + 6, 0x1D);
break;
case 30:
// loc_6626E2
paint_setup_set_support_height(height, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_C0, height + 4, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6 + 6 + 6, 0x1E);
paint_setup_set_segment_support_height(SEGMENT_B4, height + 4 + 6 + 6 + 6 + 6, 0x1E);
paint_util_force_set_general_support_height(height, 0x1E);
paint_util_set_segment_support_height(SEGMENT_C0, height + 4, 0x1E);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_D4, height + 4 + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_B8 | SEGMENT_C4 | SEGMENT_BC, height + 4 + 6 + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC, height + 4 + 6 + 6 + 6, 0x1E);
paint_util_set_segment_support_height(SEGMENT_B4, height + 4 + 6 + 6 + 6 + 6, 0x1E);
break;
}

View File

@ -56,34 +56,6 @@ static void crooked_house_paint_support_heights() {
RCT2_GLOBAL(0x0141E9D4, uint16) = 0xFFFF;
}
enum {
SEGMENT_B4 = (1 << 0),
SEGMENT_B8 = (1 << 1),
SEGMENT_BC = (1 << 2),
SEGMENT_C0 = (1 << 3),
SEGMENT_C4 = (1 << 4),
SEGMENT_C8 = (1 << 5),
SEGMENT_CC = (1 << 6),
SEGMENT_D0 = (1 << 7),
SEGMENT_D4 = (1 << 8),
};
static void crooked_house_paint_support_height(int flags, uint16 height, uint8 segment_flags) {
for (int s = 0; s < 9; s++) {
if (flags & (1 << s)) {
RCT2_GLOBAL(0x0141E9B4 + s * 4, uint16) = height;
RCT2_GLOBAL(0x0141E9B6 + s * 4, uint8) = segment_flags;
}
}
}
static void crooked_house_paint_max_height(int height) {
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(0x00141E9DA, uint8) = 0x20;
}
}
static void crooked_house_fence_top_left(rct_ride *ride, int height, rct_map_element *mapElement) {
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.entrance.index & 0x70) >> 4;
@ -180,7 +152,7 @@ static void crooked_house_paint_setup_889F08(uint8 rideIndex, uint8 trackSequenc
crooked_house_paint_supports(direction, height);
crooked_house_paint_floor(height, 22137);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
paint_util_set_general_support_height(height + 128, 0x20);
}
static void crooked_house_paint_setup_889FCC(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -193,9 +165,9 @@ static void crooked_house_paint_setup_889FCC(uint8 rideIndex, uint8 trackSequenc
height += 2;
crooked_house_paint_support_heights();
crooked_house_paint_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, height, 0x20);
paint_util_set_segment_support_height(SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC, height, 0x20);
crooked_house_paint_max_height(height + 126);
paint_util_set_general_support_height(height + 126, 0x20);
}
static void crooked_house_paint_setup_88A1D0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -210,9 +182,9 @@ static void crooked_house_paint_setup_88A1D0(uint8 rideIndex, uint8 trackSequenc
height += 2;
crooked_house_paint_support_heights();
crooked_house_paint_support_height(SEGMENT_CC | SEGMENT_BC | SEGMENT_D4, height, 0x20);
paint_util_set_segment_support_height(SEGMENT_CC | SEGMENT_BC | SEGMENT_D4, height, 0x20);
crooked_house_paint_max_height(height + 126);
paint_util_set_general_support_height(height + 126, 0x20);
}
static void crooked_house_paint_setup_88A392(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -227,9 +199,9 @@ static void crooked_house_paint_setup_88A392(uint8 rideIndex, uint8 trackSequenc
height += 2;
crooked_house_paint_support_heights();
crooked_house_paint_support_height(SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0, height, 0x20);
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0, height, 0x20);
crooked_house_paint_max_height(height + 126);
paint_util_set_general_support_height(height + 126, 0x20);
}
static void crooked_house_paint_setup_88A554(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -244,9 +216,9 @@ static void crooked_house_paint_setup_88A554(uint8 rideIndex, uint8 trackSequenc
height += 2;
crooked_house_paint_support_heights();
crooked_house_paint_support_height(SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4, height, 0x20);
paint_util_set_segment_support_height(SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4, height, 0x20);
crooked_house_paint_max_height(height + 126);
paint_util_set_general_support_height(height + 126, 0x20);
}
@ -260,7 +232,7 @@ static void crooked_house_paint_setup_88A97C(uint8 rideIndex, uint8 trackSequenc
sub_88ABA4(direction, 0, 224, 1, height);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
paint_util_set_general_support_height(height + 128, 0x20);
}
static void crooked_house_paint_setup_88A821(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -271,7 +243,7 @@ static void crooked_house_paint_setup_88A821(uint8 rideIndex, uint8 trackSequenc
crooked_house_fence_top_left(ride, height, mapElement);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
paint_util_set_general_support_height(height + 128, 0x20);
}
static void crooked_house_paint_setup_88A6C6(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
@ -281,7 +253,7 @@ static void crooked_house_paint_setup_88A6C6(uint8 rideIndex, uint8 trackSequenc
rct_ride *ride = get_ride(rideIndex);
crooked_house_fence_top_right(ride, height, mapElement);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
paint_util_set_general_support_height(height + 128, 0x20);
}
// bottom center
@ -295,7 +267,7 @@ static void crooked_house_paint_setup_88AA90(uint8 rideIndex, uint8 trackSequenc
//sub_88ABA4(rideIndex, 224, 0, 3, height);
crooked_house_paint_support_heights();
crooked_house_paint_max_height(height + 128);
paint_util_set_general_support_height(height + 128, 0x20);
}
TRACK_PAINT_FUNCTION crooked_house_paint_setup_functions[][9] = {

View File

@ -19,38 +19,6 @@
#include "../../paint/supports.h"
#include "../track_paint.h"
/* rct2: 0x007485D8 (same as loc_7667AC) */
static rct_xy16 dword_7485D8[] = {
{.x = -1, .y = 0},
{.x = 0, .y = -1},
{.x = 1, .y = 0},
{.x = 0, .y = 1},
};
/* rct2: 0x007485D8 (same as loc_7667AC) */
static rct_xy16 dword_7485da[] = {
{.x = 0, .y = -1},
{.x = 1, .y = 0},
{.x = 0, .y = 1},
{.x = -1, .y = 0},
};
/* 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 },
};
enum {
SPIRAL_SLIDE_LEFT_R0 = 20548,
SPIRAL_SLIDE_CENTER_R0 = 20549,
@ -82,7 +50,7 @@ enum {
SPIRAL_SLIDE_PEEP = 20568, // 46 sprites per direction
};
static void spiral_slide_paint_tile_back(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
static void spiral_slide_paint_tile_back(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
@ -90,24 +58,15 @@ static void spiral_slide_paint_tile_back(uint8 rideIndex, uint8 trackSequence, u
image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 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);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride *ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
if (track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_TOP_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, get_current_rotation());
}
entranceLoc =
((x / 32) + loc_7667AC[get_current_rotation()].x) |
(((y / 32) + loc_7667AC[get_current_rotation()].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
if (track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_TOP_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, get_current_rotation());
}
@ -129,7 +88,7 @@ static void spiral_slide_paint_tile_back(uint8 rideIndex, uint8 trackSequence, u
}
}
static void spiral_slide_paint_tile_right(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
static void spiral_slide_paint_tile_right(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
@ -137,21 +96,18 @@ static void spiral_slide_paint_tile_right(uint8 rideIndex, uint8 trackSequence,
image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + dword_7485D8[get_current_rotation()].x) |
(((y / 32) + dword_7485D8[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride *ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
if (track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_TOP_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, 0);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, get_current_rotation());
}
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation()); //TODO 1, 32
if (track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation());
}
if (direction == 0) image_id = SPIRAL_SLIDE_RIGHT_R0 | RCT2_GLOBAL(0x00F44198, uint32);
if (direction == 1) image_id = SPIRAL_SLIDE_RIGHT_R1 | RCT2_GLOBAL(0x00F44198, uint32);
@ -177,7 +133,7 @@ static void spiral_slide_paint_tile_right(uint8 rideIndex, uint8 trackSequence,
}
}
static void spiral_slide_paint_tile_left(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
static void spiral_slide_paint_tile_left(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
@ -185,23 +141,18 @@ static void spiral_slide_paint_tile_left(uint8 rideIndex, uint8 trackSequence, u
image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + dword_7485da[get_current_rotation()].x) |
(((y / 32) + dword_7485da[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride *ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
if (track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_TOP_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, 0);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, get_current_rotation());
}
// Fence
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation());
if (track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation());
}
if (direction == 0) image_id = SPIRAL_SLIDE_LEFT_R0 | RCT2_GLOBAL(0x00F44198, uint32);
if (direction == 1) image_id = SPIRAL_SLIDE_LEFT_R1 | RCT2_GLOBAL(0x00F44198, uint32);
@ -227,7 +178,7 @@ static void spiral_slide_paint_tile_left(uint8 rideIndex, uint8 trackSequence, u
}
}
static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
@ -235,13 +186,18 @@ static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence,
image_id = ((direction & 1) ? SPIRAL_SLIDE_BASE_B : SPIRAL_SLIDE_BASE_A) | RCT2_GLOBAL(0x00F4419C, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
// Fence 1
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation());
rct_ride *ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
// Fence 2
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation());
if (track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_LEFT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation());
}
if (track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation())) {
image_id = SPIRAL_SLIDE_FENCE_BOTTOM_RIGHT | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation());
}
if (direction == 1) {
image_id = SPIRAL_SLIDE_INSIDE_R1 | RCT2_GLOBAL(0x00F44198, uint32);
@ -267,7 +223,6 @@ static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence,
}
rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
rct_ride *ride = get_ride(rideIndex);
if (dpi->zoom_level == 0 && ride->slide_in_use != 0) {
uint8 slide_progress = ride->spiral_slide_progress;
if (slide_progress != 0) {
@ -323,11 +278,19 @@ static void spiral_slide_paint_tile_front(uint8 rideIndex, uint8 trackSequence,
}
}
const uint8 track_map_2x2[][4] = {
{0, 1, 2, 3},
{1, 3, 0, 2},
{3, 2, 1, 0},
{2, 0, 3, 1}
};
/**
* rct: 0x007485E8
* rct: 0x007485C8
*/
static void spiral_slide_paint_setup_rot_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
static void paint_spiral_slide(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
trackSequence = track_map_2x2[direction][trackSequence];
switch (trackSequence) {
case 0: spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); break;
case 1: spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); break;
@ -336,42 +299,6 @@ static void spiral_slide_paint_setup_rot_0(uint8 rideIndex, uint8 trackSequence,
}
}
/**
* rct: 0x00748DE4
*/
static void spiral_slide_paint_setup_rot_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
switch (trackSequence) {
case 0: spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); break;
case 1: spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); break;
case 2: spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); break;
case 3: spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); break;
}
}
/**
* rct: 0x00749628
*/
static void spiral_slide_paint_setup_rot_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
switch (trackSequence) {
case 0: spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); break;
case 1: spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); break;
case 2: spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); break;
case 3: spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); break;
}
}
/**
* rct: 0x00749E6C
*/
static void spiral_slide_paint_setup_rot_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element *mapElement) {
switch (trackSequence) {
case 0: spiral_slide_paint_tile_left(rideIndex, trackSequence, direction, height, mapElement); break;
case 1: spiral_slide_paint_tile_back(rideIndex, trackSequence, direction, height, mapElement); break;
case 2: spiral_slide_paint_tile_front(rideIndex, trackSequence, direction, height, mapElement); break;
case 3: spiral_slide_paint_tile_right(rideIndex, trackSequence, direction, height, mapElement); break;
}
}
/**
* rct2: 0x0074840C
*/
@ -380,12 +307,5 @@ TRACK_PAINT_FUNCTION get_track_paint_function_spiral_slide(int trackType, int di
return NULL;
}
switch (direction) {
case 0: return spiral_slide_paint_setup_rot_0;
case 1: return spiral_slide_paint_setup_rot_1;
case 2: return spiral_slide_paint_setup_rot_2;
case 3: return spiral_slide_paint_setup_rot_3;
}
return NULL;
return paint_spiral_slide;
}

View File

@ -26,50 +26,6 @@
#include "../track_data.h"
#include "../track_paint.h"
/**
*
* rct2: 0x0076687C
*/
static void top_spin_paint_tile_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 112;
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;
}
}
/* 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 },
};
/**
*
* rct2: 0x0142811C
@ -295,570 +251,118 @@ static void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 di
RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = VIEWPORT_INTERACTION_ITEM_RIDE;
}
const uint8 track_map_3x3[][9] = {
{0, 1, 2, 3, 4, 5, 6, 7, 8},
{0, 3, 5, 7, 2, 8, 1, 6, 4},
{0, 7, 8, 6, 5, 4, 3, 1, 2},
{0, 6, 4, 1, 8, 2, 7, 3, 5}
};
const uint8 edges_3x3[] = {
0,
EDGE_NE | EDGE_NW,
EDGE_NE,
EDGE_NE | EDGE_SE,
EDGE_NW,
EDGE_SE,
EDGE_SW | EDGE_NW,
EDGE_SW | EDGE_SE,
EDGE_SW,
};
enum {
SPR_FLOOR_CORK_SE_SW = 22134,
SPR_FLOOR_CORK_SW = 22135,
SPR_FLOOR_CORK_SE = 22136,
SPR_FLOOR_CORK = 22137,
SPR_FENCE_ROPE_NE = 22138,
SPR_FENCE_ROPE_SE = 22139,
SPR_FENCE_ROPE_SW = 22140,
SPR_FENCE_ROPE_NW = 22141,
};
/**
*
* rct2: 0x0076693F
* rct2: 0x0076679C
*/
static void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
static void paint_top_spin(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element * mapElement) {
trackSequence = track_map_3x3[direction][trackSequence];
uint32 imageId;
const uint8 rotation = get_current_rotation();
image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A0, uint32), NULL);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[rotation].x) |
(((y / 32) + loc_7667AE[rotation].y) << 8);
int edges = edges_3x3[trackSequence];
rct_ride *ride = get_ride(rideIndex);
rct_xy16 position = {RCT2_GLOBAL(0x009DE56A, sint16), RCT2_GLOBAL(0x009DE56E, sint16)};
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
if (edges & EDGE_SW && edges & EDGE_SE) {
imageId = SPR_FLOOR_CORK_SE_SW | RCT2_GLOBAL(0x00F44198, uint32);
} else if (edges & EDGE_SW) {
imageId = SPR_FLOOR_CORK_SW | RCT2_GLOBAL(0x00F44198, uint32);
} else if (edges & EDGE_SE) {
imageId = SPR_FLOOR_CORK_SE | RCT2_GLOBAL(0x00F44198, uint32);
} else {
imageId = SPR_FLOOR_CORK | RCT2_GLOBAL(0x00F44198, uint32);
}
sub_98197C(imageId, 0, 0, 32, 32, 1, height, 0, 0, height, get_current_rotation());
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, rotation);
if (edges & EDGE_NW && track_paint_util_has_fence(EDGE_NW, position, mapElement, ride, get_current_rotation())) {
imageId = SPR_FENCE_ROPE_NW | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(imageId, 0, 0, 32, 1, 7, height, 0, 2, height + 2, get_current_rotation());
}
if (edges & EDGE_SW && track_paint_util_has_fence(EDGE_SW, position, mapElement, ride, get_current_rotation())) {
imageId = SPR_FENCE_ROPE_SW | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(imageId, 0, 0, 1, 32, 7, height, 30, 0, height + 2, get_current_rotation());
}
if (edges & EDGE_NE && track_paint_util_has_fence(EDGE_NE, position, mapElement, ride, get_current_rotation())) {
imageId = SPR_FENCE_ROPE_NE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(imageId, 0, 0, 1, 32, 7, height, 0, 2, height + 2, get_current_rotation());
}
if (edges & EDGE_SE && track_paint_util_has_fence(EDGE_SE, position, mapElement, ride, get_current_rotation())) {
imageId = SPR_FENCE_ROPE_SE | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(imageId, 0, 0, 32, 1, 7, height, 0, 30, height + 2, get_current_rotation());
}
entranceLoc =
((x / 32) + loc_7667AC[rotation].x) |
(((y / 32) + loc_7667AC[rotation].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 0, 2, height + 2, rotation);
switch (trackSequence) {
case 0: top_spin_paint_vehicle(32, 32, rideIndex, direction, height, mapElement); break;
case 3: top_spin_paint_vehicle(32, -32, rideIndex, direction, height, mapElement); break;
case 5: top_spin_paint_vehicle(0, -32, rideIndex, direction, height, mapElement); break;
case 6: top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement); break;
case 7: top_spin_paint_vehicle(-32, -32, rideIndex, direction, height, mapElement); break;
case 8: top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement); break;
}
top_spin_paint_vehicle(32, 32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = height + 2;
RCT2_GLOBAL(0x141E9B6, uint16) = 32;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = height + 2;
RCT2_GLOBAL(0x141E9CA, uint16) = 32;
RCT2_GLOBAL(0x141E9CC, uint16) = height + 2;
RCT2_GLOBAL(0x141E9CE, uint16) = 32;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 110;
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;
int cornerSegments = 0;
switch (trackSequence) {
case 1:
// top
cornerSegments = SEGMENT_B4 | SEGMENT_C8 | SEGMENT_CC;
break;
case 3:
// right
cornerSegments = SEGMENT_CC | SEGMENT_BC | SEGMENT_D4;
break;
case 6:
// left
cornerSegments = SEGMENT_C8 | SEGMENT_B8 | SEGMENT_D0;
break;
case 7:
// bottom
cornerSegments = SEGMENT_D0 | SEGMENT_C0 | SEGMENT_D4;
break;
}
paint_util_set_segment_support_height(cornerSegments, height + 2, 0x20);
paint_util_set_segment_support_height(SEGMENTS_ALL & ~cornerSegments, 0xFFFF, 0);
paint_util_set_general_support_height(height + 112, 0x20);
}
/**
*
* rct2: 0x00767033
*/
static void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AC[rotation].x) |
(((y / 32) + loc_7667AC[rotation].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, rotation);
}
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 110;
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;
}
}
/**
*
* rct2: 0x0076718D
*/
static void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22137 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[rotation].x) |
(((y / 32) + loc_7667AE[rotation].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, rotation);
}
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 110;
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;
}
}
/**
*
* rct2: 0x00766B4C
*/
static void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AC[rotation].x) |
(((y / 32) + loc_7667AC[rotation].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22138 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 1, 32, 7, height, 2, 0, height + 2, rotation);
}
entranceLoc =
((x / 32) + loc_7667AC[(rotation + 3) & 3].x) |
(((y / 32) + loc_7667AC[(rotation + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, rotation);
}
top_spin_paint_vehicle(32, -32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = height + 2;
RCT2_GLOBAL(0x141E9BE, uint16) = 32;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = height + 2;
RCT2_GLOBAL(0x141E9CE, uint16) = 32;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = height + 2;
RCT2_GLOBAL(0x141E9D6, uint16) = 32;
height += 110;
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;
}
}
/**
*
* rct2: 0x007672E7
*/
static void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22136 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AC[(rotation + 3) & 3].x) |
(((y / 32) + loc_7667AC[(rotation + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 32, 1, 7, height, 0, 30, height + 2, rotation);
}
top_spin_paint_vehicle(0, -32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 112;
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;
}
}
/**
*
* rct2: 0x00766D09
*/
static void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[rotation].x) |
(((y / 32) + loc_7667AE[rotation].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22141 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98199C(image_id, 0, 0, 32, 1, 7, height, 0, 2, height + 2, rotation);
}
entranceLoc =
((x / 32) + loc_7667AE[(rotation + 1) & 3].x) |
(((y / 32) + loc_7667AE[(rotation + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 2, height + 2, rotation);
}
top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = height + 2;
RCT2_GLOBAL(0x141E9BA, uint16) = 32;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = height + 2;
RCT2_GLOBAL(0x141E9CA, uint16) = 32;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = height + 2;
RCT2_GLOBAL(0x141E9D2, uint16) = 32;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 110;
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;
}
}
/**
*
* rct2: 0x00766EC6
*/
static void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22134 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AE[(rotation + 1) & 3].x) |
(((y / 32) + loc_7667AE[(rotation + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 1, 28, 7, height, 29, 0, height + 3, rotation);
}
entranceLoc =
((x / 32) + loc_7667AC[(rotation + 3) & 3].x) |
(((y / 32) + loc_7667AC[(rotation + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 28, 1, 7, height, 0, 29, height + 3, rotation);
}
top_spin_paint_vehicle(-32, -32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = height + 2;
RCT2_GLOBAL(0x141E9C2, uint16) = 32;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = height + 2;
RCT2_GLOBAL(0x141E9D2, uint16) = 32;
RCT2_GLOBAL(0x141E9D4, uint16) = height + 2;
RCT2_GLOBAL(0x141E9D6, uint16) = 32;
height += 110;
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;
}
}
/**
*
* rct2: 0x007673FA
*/
static void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
uint32 image_id = RCT2_GLOBAL(0x00F441A0, uint32);
wooden_a_supports_paint_setup(direction & 1, 0, height, image_id, NULL);
const uint8 rotation = get_current_rotation();
image_id = 22135 | RCT2_GLOBAL(0x00F44198, uint32);
sub_98197C(image_id, 0, 0, 32, 32, 1, height, 0, 0, height, rotation);
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = get_ride(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AE[(rotation + 1) & 3].x) |
(((y / 32) + loc_7667AE[(rotation + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22140 | RCT2_GLOBAL(0x00F441A0, uint32);
sub_98197C(image_id, 0, 0, 1, 32, 7, height, 30, 0, height + 2, rotation);
}
top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9BC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9C8, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9CC, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D0, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9D4, uint16) = 0xFFFF;
height += 112;
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;
}
}
/**
*
* rct2: 0x007667BC
*/
static void top_spin_paint_setup_rot_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
switch (trackSequence)
{
case 0:
top_spin_paint_tile_0(rideIndex, trackSequence, direction, height, mapElement);
break;
case 1:
top_spin_paint_tile_1(rideIndex, trackSequence, direction, height, mapElement);
break;
case 2:
top_spin_paint_tile_2(rideIndex, trackSequence, direction, height, mapElement);
break;
case 3:
top_spin_paint_tile_3(rideIndex, trackSequence, direction, height, mapElement);
break;
case 4:
top_spin_paint_tile_4(rideIndex, trackSequence, direction, height, mapElement);
break;
case 5:
top_spin_paint_tile_5(rideIndex, trackSequence, direction, height, mapElement);
break;
case 6:
top_spin_paint_tile_6(rideIndex, trackSequence, direction, height, mapElement);
break;
case 7:
top_spin_paint_tile_7(rideIndex, trackSequence, direction, height, mapElement);
break;
case 8:
top_spin_paint_tile_8(rideIndex, trackSequence, direction, height, mapElement);
break;
}
return;
}
/**
*
* rct2: 0x007667EC
*/
static void top_spin_paint_setup_rot_1(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
switch (trackSequence)
{
case 0:
top_spin_paint_tile_0(rideIndex, trackSequence, direction, height, mapElement);
break;
case 1:
top_spin_paint_tile_3(rideIndex, trackSequence, direction, height, mapElement);
break;
case 2:
top_spin_paint_tile_5(rideIndex, trackSequence, direction, height, mapElement);
break;
case 3:
top_spin_paint_tile_7(rideIndex, trackSequence, direction, height, mapElement);
break;
case 4:
top_spin_paint_tile_2(rideIndex, trackSequence, direction, height, mapElement);
break;
case 5:
top_spin_paint_tile_8(rideIndex, trackSequence, direction, height, mapElement);
break;
case 6:
top_spin_paint_tile_1(rideIndex, trackSequence, direction, height, mapElement);
break;
case 7:
top_spin_paint_tile_6(rideIndex, trackSequence, direction, height, mapElement);
break;
case 8:
top_spin_paint_tile_4(rideIndex, trackSequence, direction, height, mapElement);
break;
}
return;
}
/**
*
* rct2: 0x0076681C
*/
static void top_spin_paint_setup_rot_2(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
switch (trackSequence)
{
case 0:
top_spin_paint_tile_0(rideIndex, trackSequence, direction, height, mapElement);
break;
case 1:
top_spin_paint_tile_7(rideIndex, trackSequence, direction, height, mapElement);
break;
case 2:
top_spin_paint_tile_8(rideIndex, trackSequence, direction, height, mapElement);
break;
case 3:
top_spin_paint_tile_6(rideIndex, trackSequence, direction, height, mapElement);
break;
case 4:
top_spin_paint_tile_5(rideIndex, trackSequence, direction, height, mapElement);
break;
case 5:
top_spin_paint_tile_4(rideIndex, trackSequence, direction, height, mapElement);
break;
case 6:
top_spin_paint_tile_3(rideIndex, trackSequence, direction, height, mapElement);
break;
case 7:
top_spin_paint_tile_1(rideIndex, trackSequence, direction, height, mapElement);
break;
case 8:
top_spin_paint_tile_2(rideIndex, trackSequence, direction, height, mapElement);
break;
}
return;
}
/**
*
* rct2: 0x0076684C
*/
static void top_spin_paint_setup_rot_3(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
switch (trackSequence)
{
case 0:
top_spin_paint_tile_0(rideIndex, trackSequence, direction, height, mapElement);
break;
case 1:
top_spin_paint_tile_6(rideIndex, trackSequence, direction, height, mapElement);
break;
case 2:
top_spin_paint_tile_4(rideIndex, trackSequence, direction, height, mapElement);
break;
case 3:
top_spin_paint_tile_1(rideIndex, trackSequence, direction, height, mapElement);
break;
case 4:
top_spin_paint_tile_8(rideIndex, trackSequence, direction, height, mapElement);
break;
case 5:
top_spin_paint_tile_2(rideIndex, trackSequence, direction, height, mapElement);
break;
case 6:
top_spin_paint_tile_7(rideIndex, trackSequence, direction, height, mapElement);
break;
case 7:
top_spin_paint_tile_3(rideIndex, trackSequence, direction, height, mapElement);
break;
case 8:
top_spin_paint_tile_5(rideIndex, trackSequence, direction, height, mapElement);
break;
}
return;
}
/* 0x0076659C */
TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction)
{
switch (trackType) {
case 123:
switch (direction) {
case 0: return top_spin_paint_setup_rot_0;
case 1: return top_spin_paint_setup_rot_1;
case 2: return top_spin_paint_setup_rot_2;
case 3: return top_spin_paint_setup_rot_3;
}
break;
if (trackType != 123) {
return NULL;
}
return NULL;
return paint_top_spin;
}

View File

@ -28,6 +28,50 @@
#include "ride_data.h"
#include "track_data.h"
#include "track_paint.h"
#include "../paint/map_element/map_element.h"
/* rct2: 0x007667AC */
static rct_xy16 loc_7667AC[] = {
{.x = -1, .y = 0},
{.x = 0, .y = -1},
{.x = 1, .y = 0},
{.x = 0, .y = 1},
};
/* rct2: 0x007667AE */
static rct_xy16 loc_7667AE[] = {
{.x = 0, .y = -1},
{.x = 1, .y = 0},
{.x = 0, .y = 1},
{.x = -1, .y = 0},
};
bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation)
{
rct_xy16 offset;
switch (edge) {
case EDGE_NE:
offset = loc_7667AC[rotation];
break;
case EDGE_SE:
offset = loc_7667AE[(rotation + 2) & 3];
break;
case EDGE_SW:
offset = loc_7667AC[(rotation + 2) & 3];
break;
case EDGE_NW:
offset = loc_7667AE[rotation];
break;
}
uint16 entranceLoc =
((position.x / 32) + offset.x) |
(((position.y / 32) + offset.y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
return (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc);
}
/**
*

View File

@ -18,6 +18,10 @@
#define _TRACK_PAINT_H
#include "../common.h"
#include "../world/map.h"
#include "../paint/map_element/map_element.h"
bool track_paint_util_has_fence(enum edge edge, rct_xy16 position, rct_map_element * mapElement, rct_ride * ride, uint8 rotation);
typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement);
typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction);
@ -29,6 +33,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int directi
TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_crooked_house(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_submarine_ride(int trackType, int direction);
TRACK_PAINT_FUNCTION get_track_paint_function_50_52_53_54(int trackType, int direction);
#endif