Merge pull request #4203 from janisozaur/integration

Integration commits from #4181
This commit is contained in:
Ted John 2016-08-03 21:21:27 +01:00 committed by GitHub
commit 70853d65d6
14 changed files with 98 additions and 55 deletions

View File

@ -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

View File

@ -677,9 +677,9 @@ enum {
STR_RIDE_STATS_ALTITUDE = 1416,
STR_RIDE_STATS_VERT_G = 1417,
STR_RIDE_STATS_LAT_G = 1418,
STR_RIDE_STATS_VELOCITY_FORMAT = 1419, // Unused
STR_RIDE_STATS_VELOCITY_FORMAT = 1419,
STR_RIDE_STATS_ALTITUDE_FORMAT = 1420,
STR_RIDE_STATS_G_FORCE_FORMAT = 1421, // Unused
STR_RIDE_STATS_G_FORCE_FORMAT = 1421,
STR_LOGGING_DATA_FROM_TIP = 1422,
STR_QUEUE_LINE_PATH_TIP = 1423,
STR_FOOTPATH_TIP = 1424,

View File

@ -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) {

View File

@ -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;
}
}
}

View File

@ -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[];

View File

@ -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)

View File

@ -748,7 +748,7 @@ static void sub_68F41A(rct_peep *peep, int index)
uint8 sprite_type = PEEP_SPRITE_TYPE_23;
if (peep->state != PEEP_STATE_PATROLLING)
sprite_type = PEEP_SPRITE_TYPE_3;
sprite_type = PEEP_SPRITE_TYPE_SECURITY;
if (peep->sprite_type == sprite_type)
return;
@ -1757,7 +1757,7 @@ static void peep_update_falling(rct_peep* peep){
if (peep->item_standard_flags & PEEP_ITEM_BALLOON) {
peep->item_standard_flags &= ~PEEP_ITEM_BALLOON;
if (peep->sprite_type == 19 && peep->x != (sint16)0x8000) {
if (peep->sprite_type == PEEP_SPRITE_TYPE_19 && peep->x != (sint16) 0x8000) {
create_balloon(peep->x, peep->y, height, peep->balloon_colour, 0);
peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY;
peep_update_sprite_type(peep);
@ -1893,7 +1893,7 @@ static void peep_update_sitting(rct_peep* peep){
return;
}
if (peep->sprite_type == 0x15){
if (peep->sprite_type == PEEP_SPRITE_TYPE_UMBRELLA) {
peep_try_get_up_from_sitting(peep);
return;
}
@ -1916,7 +1916,7 @@ static void peep_update_sitting(rct_peep* peep){
peep_try_get_up_from_sitting(peep);
return;
}
if (peep->sprite_type == 0x13 || peep->sprite_type == 0x1E){
if (peep->sprite_type == PEEP_SPRITE_TYPE_19 || peep->sprite_type == PEEP_SPRITE_TYPE_30) {
peep_try_get_up_from_sitting(peep);
return;
}
@ -4439,7 +4439,7 @@ static void peep_update_queuing(rct_peep* peep){
sub_693C9E(peep);
if (peep->action < 0xFE)return;
if (peep->sprite_type == 0){
if (peep->sprite_type == PEEP_SPRITE_TYPE_NORMAL) {
if (peep->time_in_queue >= 2000 && (0xFFFF & scenario_rand()) <= 119){
// Eat Food/Look at watch
peep->action = PEEP_ACTION_EAT_FOOD;

View File

@ -343,7 +343,20 @@ enum PEEP_ITEM {
enum PEEP_SPRITE_TYPE {
PEEP_SPRITE_TYPE_NORMAL = 0,
PEEP_SPRITE_TYPE_3 = 3,
PEEP_SPRITE_TYPE_HANDYMAN = 1,
PEEP_SPRITE_TYPE_MECHANIC = 2,
PEEP_SPRITE_TYPE_SECURITY = 3,
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA = 4,
PEEP_SPRITE_TYPE_ENTERTAINER_TIGER = 5,
PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT = 6,
PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN = 7,
PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA = 8,
PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN = 9,
PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT = 10,
PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT = 11,
PEEP_SPRITE_TYPE_ENTERTAINER_BANDIT = 12,
PEEP_SPRITE_TYPE_ENTERTAINER_SHERIFF = 13,
PEEP_SPRITE_TYPE_ENTERTAINER_PIRATE = 14,
PEEP_SPRITE_TYPE_19 = 19,
PEEP_SPRITE_TYPE_UMBRELLA = 21,
PEEP_SPRITE_TYPE_23 = 23,
@ -352,6 +365,7 @@ enum PEEP_SPRITE_TYPE {
PEEP_SPRITE_TYPE_NAUSEOUS = 27,
PEEP_SPRITE_TYPE_VERY_NAUSEOUS = 28,
PEEP_SPRITE_TYPE_REQUIRE_BATHROOM = 29,
PEEP_SPRITE_TYPE_30 = 30,
PEEP_SPRITE_TYPE_WATCHING = 38
};

View File

@ -247,7 +247,15 @@ static money32 staff_hire_new_staff_member(uint8 staff_type, uint8 flags, sint16
STR_ENTERTAINER_X,
};
uint8 sprite_type = RCT2_ADDRESS(0x009929FC, uint8)[staff_type];
/* rct2: 0x009929FC */
static const uint8 spriteTypes[] = {
PEEP_SPRITE_TYPE_HANDYMAN,
PEEP_SPRITE_TYPE_MECHANIC,
PEEP_SPRITE_TYPE_SECURITY,
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA,
};
uint8 sprite_type = spriteTypes[staff_type];
newPeep->name_string_idx = staffNames[staff_type];
newPeep->sprite_type = sprite_type;

View File

@ -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;
}
}

View File

@ -621,7 +621,7 @@ static void window_guest_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
window_draw_widgets(w, dpi);
// Tab 1 image
i = (_window_guest_list_selected_tab == 0 ? w->list_information_type & 0x0FFFFFFFC : 0);
i += g_sprite_entries[0].sprite_image->base_image + 1;
i += g_sprite_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_image->base_image + 1;
i |= 0xA1600000;
gfx_draw_sprite(
dpi,

View File

@ -2007,7 +2007,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
sprite_idx += (w->frame_no / 8) % 8;
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_3].left, w->y + w->widgets[WIDX_TAB_3].top, 0);
sprite_idx = g_sprite_entries[0].sprite_image->base_image + 1;
sprite_idx = g_sprite_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_image->base_image + 1;
if (w->page == WINDOW_PARK_PAGE_GUESTS)
sprite_idx += w->var_492 & 0xFFFFFFFC;

View File

@ -1256,6 +1256,21 @@ static const window_ride_colour_preview TrackColourPreviews[] = {
{ SPR_RIDE_DESIGN_PREVIEW_LIM_LAUNCHED_ROLLER_COASTER_TRACK, SPR_RIDE_DESIGN_PREVIEW_LIM_LAUNCHED_ROLLER_COASTER_SUPPORTS},
};
typedef struct rct_window_graphs_y_axis {
uint8 interval;
sint8 unit;
sint8 unit_interval;
rct_string_id label;
} rct_window_graphs_y_axis;
/** rct2: 0x0098DD98 */
static const rct_window_graphs_y_axis window_graphs_y_axi[] = {
{11, 0, 10, STR_RIDE_STATS_VELOCITY_FORMAT}, // GRAPH_VELOCITY
{10, 0, 15, STR_RIDE_STATS_ALTITUDE_FORMAT}, // GRAPH_ALTITUDE
{13, -3, 1, STR_RIDE_STATS_G_FORCE_FORMAT}, // GRAPH_VERTICAL
{13, -4, 1, STR_RIDE_STATS_G_FORCE_FORMAT}, // GRAPH_LATERAL
};
static void window_ride_draw_tab_image(rct_drawpixelinfo *dpi, rct_window *w, int page, int spriteIndex)
{
int widgetIndex = WIDX_TAB_1 + page;
@ -1386,7 +1401,7 @@ static void window_ride_draw_tab_customer(rct_drawpixelinfo *dpi, rct_window *w)
if (w->page == WINDOW_RIDE_PAGE_CUSTOMER)
spriteIndex = w->var_492 & ~3;
spriteIndex += g_sprite_entries[0].sprite_image->base_image;
spriteIndex += g_sprite_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_image->base_image;
spriteIndex += 1;
spriteIndex |= 0xA9E00000;
@ -5723,13 +5738,13 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
// Horizontal grid lines
y = widget->bottom - widget->top - 13;
short yUnit = RCT2_GLOBAL(0x0098DD9A + (listType * 8), uint16);
rct_string_id stringID = RCT2_GLOBAL(0x0098DD9E + (listType * 8), rct_string_id);
short yUnitInterval = RCT2_GLOBAL(0x0098DD9C + (listType * 8), uint16);
short yInterval = RCT2_GLOBAL(0x0098DD98 + (listType * 8), uint16);
short yUnit = window_graphs_y_axi[listType].unit;
rct_string_id stringID = window_graphs_y_axi[listType].label;
short yUnitInterval = window_graphs_y_axi[listType].unit_interval;
short yInterval = window_graphs_y_axi[listType].interval;
// Scale modifier
if (stringID == STR_RIDE_STATS_ALTITUDE_FORMAT) {
if (listType == GRAPH_ALTITUDE) {
short unk = RCT2_GLOBAL(0x01359208, uint16);
yUnit -= RCT2_GLOBAL(0x01359208, uint16);
unk *= 2;
@ -5746,7 +5761,7 @@ static void window_ride_graphs_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi
sint16 scaled_yUnit = yUnit;
// Scale modifier
if (stringID == STR_RIDE_STATS_ALTITUDE_FORMAT)
if (listType == GRAPH_ALTITUDE)
scaled_yUnit /= 2;
gfx_draw_string_left(dpi, stringID, &scaled_yUnit, 0, w->scrolls[0].h_left + 1, y - 4);

View File

@ -546,7 +546,7 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Handymen tab image
i = (selectedTab == 0 ? (w->list_information_type & ~3) : 0);
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982710, int), int)[0] + 1;
i += g_sprite_entries[PEEP_SPRITE_TYPE_HANDYMAN].sprite_image->base_image + 1;
i |= 0x20000000;
i |= gStaffHandymanColour << 19;
gfx_draw_sprite(
@ -558,7 +558,7 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Mechanic tab image
i = (selectedTab == 1 ? (w->list_information_type & ~3) : 0);
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982718, int), int)[0] + 1;
i += g_sprite_entries[PEEP_SPRITE_TYPE_MECHANIC].sprite_image->base_image + 1;
i |= 0x20000000;
i |= gStaffMechanicColour << 19;
gfx_draw_sprite(
@ -570,7 +570,7 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Security tab image
i = (selectedTab == 2 ? (w->list_information_type & ~3) : 0);
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982720, int), int)[0] + 1;
i += g_sprite_entries[PEEP_SPRITE_TYPE_SECURITY].sprite_image->base_image + 1;
i |= 0x20000000;
i |= gStaffSecurityColour << 19;
gfx_draw_sprite(
@ -591,7 +591,7 @@ void window_staff_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
)) {
// Entertainers tab image
i = (selectedTab == 3 ? (w->list_information_type & ~3) : 0);
i += RCT2_ADDRESS(RCT2_GLOBAL(0x00982738, int), int)[0] + 1;
i += g_sprite_entries[PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT].sprite_image->base_image + 1;
gfx_draw_sprite(&sprite_dpi, i, 0x0F, 0x17, 0);
}