OpenRCT2/src/openrct2/paint/map_element/path.c

1025 lines
35 KiB
C
Raw Normal View History

#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
2017-02-18 16:45:10 +01:00
#include "../../config/Config.h"
#include "../../game.h"
2016-04-30 22:09:53 +02:00
#include "../../interface/viewport.h"
#include "../../localisation/localisation.h"
#include "../../object_list.h"
#include "../../peep/staff.h"
2016-04-30 22:09:53 +02:00
#include "../../ride/track.h"
#include "../../ride/track_paint.h"
2016-04-30 22:09:53 +02:00
#include "../../world/footpath.h"
#include "../../world/scenery.h"
#include "../paint.h"
2016-06-05 20:56:57 +02:00
#include "../supports.h"
#include "map_element.h"
#include "surface.h"
#include "../../world/map.h"
2016-05-31 23:49:58 +02:00
#include "../../drawing/lightfx.h"
// #3628: Until path_paint is implemented, this variable is used by scrolling_text_setup
// to use the old string arguments array. Remove when scrolling_text_setup is no
// longer hooked.
bool TempForScrollText = false;
2016-04-30 22:09:53 +02:00
const uint8 byte_98D800[] = {
12, 9, 3, 6
};
const uint8 byte_98D6E0[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
0, 1, 2, 20, 4, 5, 6, 22, 8, 9, 10, 26, 12, 13, 14, 36,
0, 1, 2, 3, 4, 5, 21, 23, 8, 9, 10, 11, 12, 13, 33, 37,
0, 1, 2, 3, 4, 5, 6, 24, 8, 9, 10, 11, 12, 13, 14, 38,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 29, 30, 34, 39,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 40,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 35, 41,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 42,
0, 1, 2, 3, 4, 5, 6, 7, 8, 25, 10, 27, 12, 31, 14, 43,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 28, 12, 13, 14, 44,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 45,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 46,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 32, 14, 47,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 48,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 49,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 50
};
const sint16 stru_98D804[][4] = {
{3, 3, 26, 26},
{0, 3, 29, 26},
{3, 3, 26, 29},
{0, 3, 29, 29},
{3, 3, 29, 26},
{0, 3, 32, 26},
{3, 3, 29, 29},
{0, 3, 32, 29},
{3, 0, 26, 29},
{0, 0, 29, 29},
{3, 0, 26, 32},
{0, 0, 29, 32},
{3, 0, 29, 29},
{0, 0, 32, 29},
{3, 0, 29, 32},
{0, 0, 32, 32},
};
const uint8 byte_98D8A4[] = {
0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0
};
2017-01-29 11:15:29 +01:00
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
2016-04-30 22:09:53 +02:00
2017-01-29 11:15:29 +01:00
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags);
2016-04-30 22:09:53 +02:00
2016-06-08 20:53:55 +02:00
/* rct2: 0x006A5AE5 */
2017-01-04 22:17:08 +01:00
static void path_bit_lights_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) {
2016-06-08 20:53:55 +02:00
if (footpath_element_is_sloped(mapElement))
height += 8;
uint32 imageId;
if (!(edges & (1 << 0))) {
imageId = pathBitEntry->image + 1;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 2, 16, 1, 1, 23, height, 3, 16, height + 2, get_current_rotation());
}
if (!(edges & (1 << 1))) {
imageId = pathBitEntry->image + 2;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 16, 30, 1, 0, 23, height, 16, 29, height + 2, get_current_rotation());
}
if (!(edges & (1 << 2))) {
imageId = pathBitEntry->image + 3;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 30, 16, 0, 1, 23, height, 29, 16, height + 2, get_current_rotation());
}
if (!(edges & (1 << 3))) {
imageId = pathBitEntry->image + 4;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 16, 2, 1, 1, 23, height, 16, 3, height + 2, get_current_rotation());
}
}
/* rct2: 0x006A5C94 */
2017-01-04 22:17:08 +01:00
static void path_bit_bins_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) {
2016-06-08 20:53:55 +02:00
if (footpath_element_is_sloped(mapElement))
height += 8;
uint32 imageId;
if (!(edges & (1 << 0))) {
imageId = pathBitEntry->image + 5;
imageId |= pathBitImageFlags;
if (!(mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)) {
imageId -= 4;
2016-11-13 20:17:49 +01:00
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
if (!(mapElement->properties.path.addition_status & ror8(0x3,(2 * get_current_rotation()))))
2016-06-08 20:53:55 +02:00
imageId += 8;
}
2016-11-13 20:17:49 +01:00
2016-06-08 20:53:55 +02:00
sub_98197C(imageId, 7, 16, 1, 1, 7, height, 7, 16, height + 2, get_current_rotation());
}
if (!(edges & (1 << 1))) {
imageId = pathBitEntry->image + 6;
imageId |= pathBitImageFlags;
if (!(mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)) {
imageId -= 4;
2016-11-13 20:17:49 +01:00
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
if (!(mapElement->properties.path.addition_status & ror8(0xC, (2 * get_current_rotation()))))
2016-06-08 20:53:55 +02:00
imageId += 8;
}
2016-11-13 20:17:49 +01:00
2016-06-08 20:53:55 +02:00
sub_98197C(imageId, 16, 25, 1, 1, 7, height, 16, 25, height + 2, get_current_rotation());
}
if (!(edges & (1 << 2))) {
imageId = pathBitEntry->image + 7;
imageId |= pathBitImageFlags;
if (!(mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)) {
imageId -= 4;
2016-11-13 20:17:49 +01:00
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
if (!(mapElement->properties.path.addition_status & ror8(0x30, (2 * get_current_rotation()))))
2016-06-08 20:53:55 +02:00
imageId += 8;
}
2016-11-13 20:17:49 +01:00
2016-06-08 20:53:55 +02:00
sub_98197C(imageId, 25, 16, 1, 1, 7, height, 25, 16, height + 2, get_current_rotation());
}
if (!(edges & (1 << 3))) {
imageId = pathBitEntry->image + 8;
imageId |= pathBitImageFlags;
if (!(mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)) {
imageId -= 4;
2016-11-13 20:17:49 +01:00
// Edges have been rotated around the rotation to check addition status
// this will also need to be rotated.
if (!(mapElement->properties.path.addition_status & ror8(0xC0, (2 * get_current_rotation()))))
2016-06-08 20:53:55 +02:00
imageId += 8;
}
2016-11-13 20:17:49 +01:00
2016-06-08 20:53:55 +02:00
sub_98197C(imageId, 16, 7, 1, 1, 7, height, 16, 7, height + 2, get_current_rotation());
}
}
/* rct2: 0x006A5E81 */
2017-01-04 22:17:08 +01:00
static void path_bit_benches_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags) {
2016-06-09 20:47:36 +02:00
uint32 imageId;
if (!(edges & (1 << 0))) {
imageId = pathBitEntry->image + 1;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 7, 16, 0, 16, 7, height, 6, 8, height + 2, get_current_rotation());
}
if (!(edges & (1 << 1))) {
imageId = pathBitEntry->image + 2;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 16, 25, 16, 0, 7, height, 8, 23, height + 2, get_current_rotation());
}
if (!(edges & (1 << 2))) {
imageId = pathBitEntry->image + 3;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 25, 16, 0, 16, 7, height, 23, 8, height + 2, get_current_rotation());
}
if (!(edges & (1 << 3))) {
imageId = pathBitEntry->image + 4;
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN)
imageId += 4;
imageId |= pathBitImageFlags;
sub_98197C(imageId, 16, 7, 16, 0, 7, height, 8, 6, height + 2, get_current_rotation());
}
2016-06-08 20:53:55 +02:00
}
/* rct2: 0x006A6008 */
2017-01-04 22:17:08 +01:00
static void path_bit_jumping_fountains_paint(rct_scenery_entry* pathBitEntry, rct_map_element* mapElement, sint32 height, uint8 edges, uint32 pathBitImageFlags, rct_drawpixelinfo* dpi) {
2016-06-09 20:47:36 +02:00
if (dpi->zoom_level != 0)
return;
uint32 imageId = pathBitEntry->image;
imageId |= pathBitImageFlags;
sub_98197C(imageId + 1, 0, 0, 1, 1, 2, height, 3, 3, height + 2, get_current_rotation());
sub_98197C(imageId + 2, 0, 0, 1, 1, 2, height, 3, 29, height + 2, get_current_rotation());
sub_98197C(imageId + 3, 0, 0, 1, 1, 2, height, 29, 29, height + 2, get_current_rotation());
sub_98197C(imageId + 4, 0, 0, 1, 1, 2, height, 29, 3, height + 2, get_current_rotation());
2016-06-08 20:53:55 +02:00
}
2016-04-30 22:09:53 +02:00
/**
* rct2: 0x006A4101
* @param map_element (esi)
* @param (ecx)
* @param ebp (ebp)
* @param base_image_id (0x00F3EF78)
*/
static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp, bool word_F3F038, rct_footpath_entry * footpathEntry, uint32 base_image_id, uint32 imageFlags)
2016-04-30 22:09:53 +02:00
{
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(map_element)) {
2016-04-30 22:09:53 +02:00
uint8 local_ebp = ebp & 0x0F;
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(map_element)) {
2016-04-30 22:09:53 +02:00
switch ((map_element->properties.path.type + get_current_rotation()) & 0x03) {
case 0:
sub_98197C(95 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(95 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2, get_current_rotation());
break;
case 1:
sub_98197C(94 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(94 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2, get_current_rotation());
break;
case 2:
sub_98197C(96 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(96 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2, get_current_rotation());
break;
case 3:
sub_98197C(93 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(93 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2, get_current_rotation());
break;
}
} else {
switch (local_ebp) {
case 1:
sub_98197C(90 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(90 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 2:
sub_98197C(91 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(91 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
break;
case 3:
sub_98197C(90 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(91 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4, height + 2, get_current_rotation()); // bound_box_offset_y seems to be a bug
sub_98197C(98 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 4:
sub_98197C(92 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(92 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 5:
sub_98197C(88 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(88 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 6:
sub_98197C(91 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(92 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(99 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2, get_current_rotation());
break;
case 8:
sub_98197C(89 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(89 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
break;
case 9:
sub_98197C(89 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
sub_98197C(90 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
sub_98197C(97 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2, get_current_rotation());
break;
case 10:
sub_98197C(87 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(87 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2, get_current_rotation());
break;
case 12:
sub_98197C(89 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(92 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28, height + 2, get_current_rotation()); // bound_box_offset_x seems to be a bug
sub_98197C(100 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2, get_current_rotation());
break;
default:
// purposely left empty
break;
}
}
if (!(map_element->properties.path.type & 0x08)) {
return;
}
2016-06-05 19:35:02 +02:00
uint8 direction = ((map_element->type & 0xC0) >> 6);
2016-04-30 22:09:53 +02:00
// Draw ride sign
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
2016-06-05 19:35:02 +02:00
if (footpath_element_is_sloped(map_element)) {
if (footpath_element_get_slope_direction(map_element) == direction)
height += 16;
}
direction += get_current_rotation();
direction &= 3;
rct_xyz16 boundBoxOffsets = {
2016-09-17 15:01:08 +02:00
.x = BannerBoundBoxes[direction][0].x,
.y = BannerBoundBoxes[direction][0].y,
2016-06-05 19:35:02 +02:00
.z = height + 2
};
uint32 imageId = (direction << 1) + base_image_id + 101;
2016-11-13 20:17:49 +01:00
2016-06-05 19:35:02 +02:00
sub_98197C(imageId, 0, 0, 1, 1, 21, height, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation());
2016-09-17 15:01:08 +02:00
boundBoxOffsets.x = BannerBoundBoxes[direction][1].x;
boundBoxOffsets.y = BannerBoundBoxes[direction][1].y;
2016-06-05 19:35:02 +02:00
imageId++;
sub_98197C(imageId, 0, 0, 1, 1, 21, height, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation());
direction--;
// If text shown
2016-06-14 21:33:56 +02:00
if (direction < 2 && map_element->properties.path.ride_index != 255 && imageFlags == 0) {
uint16 scrollingMode = footpathEntry->scrolling_mode;
2016-06-05 19:35:02 +02:00
scrollingMode += direction;
set_format_arg(0, uint32, 0);
set_format_arg(4, uint32, 0);
rct_ride* ride = get_ride(map_element->properties.path.ride_index);
rct_string_id string_id = STR_RIDE_ENTRANCE_CLOSED;
if (ride->status == RIDE_STATUS_OPEN && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)){
set_format_arg(0, rct_string_id, ride->name);
2016-06-05 19:35:02 +02:00
set_format_arg(2, uint32, ride->name_arguments);
string_id = STR_RIDE_ENTRANCE_NAME;
}
if (gConfigGeneral.upper_case_banners) {
format_string_to_upper(gCommonStringFormatBuffer, 256, string_id, gCommonFormatArgs);
2016-06-05 19:35:02 +02:00
} else {
format_string(gCommonStringFormatBuffer, 256, string_id, gCommonFormatArgs);
2016-06-05 19:35:02 +02:00
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
2016-09-04 16:55:37 +02:00
uint16 string_width = gfx_get_string_width(gCommonStringFormatBuffer);
2016-06-05 19:35:02 +02:00
uint16 scroll = (gCurrentTicks / 2) % string_width;
sub_98199C(scrolling_text_setup(string_id, scroll, scrollingMode), 0, 0, 1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z, get_current_rotation());
}
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
2016-06-14 21:33:56 +02:00
if (imageFlags != 0) {
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
2016-06-05 19:35:02 +02:00
}
2016-04-30 22:09:53 +02:00
return;
}
// save ecx, ebp, esi
uint32 dword_F3EF80 = ebp;
2017-01-29 11:15:29 +01:00
if (!(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
2016-04-30 22:09:53 +02:00
dword_F3EF80 &= 0x0F;
}
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(map_element)) {
2016-04-30 22:09:53 +02:00
switch ((map_element->properties.path.type + get_current_rotation()) & 0x03) {
case 0:
sub_98197C(81 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(81 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2, get_current_rotation());
break;
case 1:
sub_98197C(80 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(80 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2, get_current_rotation());
break;
case 2:
sub_98197C(82 + base_image_id, 0, 4, 32, 1, 23, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(82 + base_image_id, 0, 28, 32, 1, 23, height, 0, 28, height + 2, get_current_rotation());
break;
case 3:
sub_98197C(79 + base_image_id, 4, 0, 1, 32, 23, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(79 + base_image_id, 28, 0, 1, 32, 23, height, 28, 0, height + 2, get_current_rotation());
break;
}
} else {
if (!word_F3F038) {
return;
}
uint8 local_ebp = ebp & 0x0F;
switch (local_ebp) {
case 0:
// purposely left empty
break;
case 1:
sub_98197C(76 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(76 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 2:
sub_98197C(77 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(77 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
break;
case 4:
sub_98197C(78 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(78 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 5:
sub_98197C(74 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(74 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2, get_current_rotation());
break;
case 8:
sub_98197C(75 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(75 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
break;
case 10:
sub_98197C(73 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2, get_current_rotation());
2016-06-10 19:33:43 +02:00
sub_98197C(73 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2, get_current_rotation());
2016-04-30 22:09:53 +02:00
break;
case 3:
sub_98197C(76 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
sub_98197C(77 + base_image_id, 28, 0, 1, 28, 7, height, 28, 4, height + 2, get_current_rotation()); // bound_box_offset_y seems to be a bug
if (!(dword_F3EF80 & 0x10)) {
sub_98197C(84 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2, get_current_rotation());
}
break;
case 6:
sub_98197C(77 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(78 + base_image_id, 0, 4, 28, 1, 7, height, 0, 4, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x20)) {
sub_98197C(85 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2, get_current_rotation());
}
break;
case 9:
sub_98197C(75 + base_image_id, 28, 0, 1, 28, 7, height, 28, 0, height + 2, get_current_rotation());
sub_98197C(76 + base_image_id, 0, 28, 28, 1, 7, height, 0, 28, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x80)) {
sub_98197C(83 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2, get_current_rotation());
}
break;
case 12:
sub_98197C(75 + base_image_id, 4, 0, 1, 28, 7, height, 4, 0, height + 2, get_current_rotation());
sub_98197C(78 + base_image_id, 0, 28, 28, 1, 7, height, 4, 28, height + 2, get_current_rotation()); // bound_box_offset_x seems to be a bug
if (!(dword_F3EF80 & 0x40)) {
sub_98197C(86 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2, get_current_rotation());
}
break;
case 7:
sub_98197C(74 + base_image_id, 0, 4, 32, 1, 7, height, 0, 4, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x10)) {
sub_98197C(84 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x20)) {
sub_98197C(85 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2, get_current_rotation());
}
break;
case 13:
sub_98197C(74 + base_image_id, 0, 28, 32, 1, 7, height, 0, 28, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x40)) {
sub_98197C(86 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x80)) {
sub_98197C(83 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2, get_current_rotation());
}
break;
case 14:
sub_98197C(73 + base_image_id, 4, 0, 1, 32, 7, height, 4, 0, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x20)) {
sub_98197C(85 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x40)) {
sub_98197C(86 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2, get_current_rotation());
}
break;
case 11:
sub_98197C(73 + base_image_id, 28, 0, 1, 32, 7, height, 28, 0, height + 2, get_current_rotation());
if (!(dword_F3EF80 & 0x10)) {
sub_98197C(84 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x80)) {
sub_98197C(83 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2, get_current_rotation());
}
break;
case 15:
if (!(dword_F3EF80 & 0x10)) {
sub_98197C(84 + base_image_id, 0, 0, 4, 4, 7, height, 0, 28, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x20)) {
sub_98197C(85 + base_image_id, 0, 0, 4, 4, 7, height, 28, 28, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x40)) {
sub_98197C(86 + base_image_id, 0, 0, 4, 4, 7, height, 28, 0, height + 2, get_current_rotation());
}
if (!(dword_F3EF80 & 0x80)) {
sub_98197C(83 + base_image_id, 0, 0, 4, 4, 7, height, 0, 0, height + 2, get_current_rotation());
}
break;
}
}
}
/**
* rct2: 0x006A3F61
* @param map_element (esp[0])
* @param bp (bp)
* @param height (dx)
2016-06-14 21:33:56 +02:00
* @param footpathEntry (0x00F3EF6C)
* @param imageFlags (0x00F3EF70)
* @param sceneryImageFlags (0x00F3EF74)
2016-04-30 22:09:53 +02:00
*/
static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height, rct_footpath_entry * footpathEntry, uint32 imageFlags, uint32 sceneryImageFlags, bool word_F3F038)
2016-04-30 22:09:53 +02:00
{
// eax --
// ebx --
// ecx
// edx
// esi --
// edi --
// ebp
// esp: [ esi, ???, 000]
// Probably drawing benches etc.
2016-06-15 23:31:13 +02:00
rct_drawpixelinfo * dpi = unk_140E9A8;
2016-04-30 22:09:53 +02:00
if (dpi->zoom_level <= 1) {
2016-09-10 19:03:25 +02:00
if (!gTrackDesignSaveMode) {
2016-04-30 22:09:53 +02:00
uint8 additions = map_element->properties.path.additions & 0xF;
if (additions != 0) {
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
2016-06-14 21:33:56 +02:00
if (sceneryImageFlags != 0) {
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
2016-04-30 22:09:53 +02:00
}
// Draw additional path bits (bins, benches, lamps, queue screens)
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
2016-06-09 21:10:50 +02:00
switch (sceneryEntry->path_bit.draw_type) {
case PATH_BIT_DRAW_TYPE_LIGHTS:
2016-06-14 21:33:56 +02:00
path_bit_lights_paint(sceneryEntry, map_element, height, (uint8)bp, sceneryImageFlags);
2016-06-08 20:53:55 +02:00
break;
2016-06-09 21:10:50 +02:00
case PATH_BIT_DRAW_TYPE_BINS:
2016-06-14 21:33:56 +02:00
path_bit_bins_paint(sceneryEntry, map_element, height, (uint8)bp, sceneryImageFlags);
2016-06-08 20:53:55 +02:00
break;
2016-06-09 21:10:50 +02:00
case PATH_BIT_DRAW_TYPE_BENCHES:
2016-06-14 21:33:56 +02:00
path_bit_benches_paint(sceneryEntry, map_element, height, (uint8)bp, sceneryImageFlags);
2016-06-08 20:53:55 +02:00
break;
2016-06-09 21:10:50 +02:00
case PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS:
2016-06-14 21:33:56 +02:00
path_bit_jumping_fountains_paint(sceneryEntry, map_element, height, (uint8)bp, sceneryImageFlags, dpi);
2016-06-08 20:53:55 +02:00
break;
}
2016-11-13 20:17:49 +01:00
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
2016-04-30 22:09:53 +02:00
2016-06-14 21:33:56 +02:00
if (sceneryImageFlags != 0) {
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
2016-04-30 22:09:53 +02:00
}
}
}
// Redundant zoom-level check removed
2016-06-14 21:33:56 +02:00
sub_6A4101(map_element, height, bp, word_F3F038, footpathEntry, footpathEntry->image | imageFlags, imageFlags);
2016-04-30 22:09:53 +02:00
}
// This is about tunnel drawing
uint8 direction = (map_element->properties.path.type + get_current_rotation()) & 0x03;
uint8 diagonal = map_element->properties.path.type & 0x04;
uint8 bl = direction | diagonal;
if (bp & 2) {
// Bottom right of tile is a tunnel
if (bl == 5) {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_right(height + 16, TUNNEL_10);
2016-04-30 22:09:53 +02:00
} else if (bp & 1) {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_right(height, TUNNEL_11);
2016-04-30 22:09:53 +02:00
} else {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_right(height, TUNNEL_10);
2016-04-30 22:09:53 +02:00
}
}
if (!(bp & 4)) {
return;
}
// Bottom left of the tile is a tunnel
if (bl == 6) {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_left(height + 16, TUNNEL_10);
2016-04-30 22:09:53 +02:00
} else if (bp & 8) {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_left(height , TUNNEL_11);
2016-04-30 22:09:53 +02:00
} else {
2016-06-11 11:47:44 +02:00
paint_util_push_tunnel_left(height , TUNNEL_10);
2016-04-30 22:09:53 +02:00
}
}
/**
* rct2: 0x0006A3590
*/
void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
{
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
2016-04-30 22:09:53 +02:00
bool word_F3F038 = false;
2016-06-14 21:33:56 +02:00
uint32 sceneryImageFlags = 0;
uint32 imageFlags = 0;
2016-04-30 22:09:53 +02:00
2016-09-10 19:03:25 +02:00
if (gTrackDesignSaveMode) {
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(map_element)) {
2016-09-10 19:03:25 +02:00
if (map_element->properties.path.ride_index != gTrackDesignSaveRideIndex) {
2016-04-30 22:09:53 +02:00
return;
}
}
2016-06-05 19:35:02 +02:00
if (!track_design_save_contains_map_element(map_element)) {
2016-06-14 21:33:56 +02:00
imageFlags = 0x21700000;
2016-04-30 22:09:53 +02:00
}
}
if (footpath_element_path_scenery_is_ghost(map_element)) {
2016-08-04 14:35:08 +02:00
sceneryImageFlags = construction_markers[gConfigGeneral.construction_marker_colour];
2016-04-30 22:09:53 +02:00
}
if (map_element->flags & MAP_ELEMENT_FLAG_GHOST) {
2016-06-11 11:47:44 +02:00
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
2016-08-04 14:35:08 +02:00
imageFlags = construction_markers[gConfigGeneral.construction_marker_colour];
2016-04-30 22:09:53 +02:00
}
sint16 x = gPaintMapPosition.x, y = gPaintMapPosition.y;
2016-04-30 22:09:53 +02:00
rct_map_element * surface = map_get_surface_element_at(x / 32, y / 32);
uint16 bl = height / 8;
if (surface == NULL) {
word_F3F038 = true;
} else if (surface->base_height != bl) {
word_F3F038 = true;
} else {
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(map_element)) {
2016-04-30 22:09:53 +02:00
// Diagonal path
if ((surface->properties.surface.slope & 0x1F) != byte_98D800[map_element->properties.path.type & 0x03]) {
word_F3F038 = true;
}
} else {
if (surface->properties.surface.slope & 0x1F) {
word_F3F038 = true;
}
}
}
2016-06-11 11:47:44 +02:00
if (gStaffDrawPatrolAreas != 0xFFFF) {
sint32 staffIndex = gStaffDrawPatrolAreas;
2016-04-30 22:09:53 +02:00
uint8 staffType = staffIndex & 0x7FFF;
2016-06-14 21:33:56 +02:00
bool is_staff_list = staffIndex & 0x8000;
2017-01-12 18:36:05 +01:00
x = gPaintMapPosition.x;
y = gPaintMapPosition.y;
2016-04-30 22:09:53 +02:00
uint8 patrolColour = COLOUR_LIGHT_BLUE;
2016-06-14 21:33:56 +02:00
if (!is_staff_list) {
2016-04-30 22:09:53 +02:00
rct_peep * staff = GET_PEEP(staffIndex);
2016-06-14 21:33:56 +02:00
if (!staff_is_patrol_area_set(staff->staff_id, x, y)) {
2016-04-30 22:09:53 +02:00
patrolColour = COLOUR_GREY;
}
2016-06-14 21:33:56 +02:00
staffType = staff->staff_type;
2016-04-30 22:09:53 +02:00
}
2016-09-10 16:17:18 +02:00
if (staff_is_patrol_area_set(200 + staffType, x, y)) {
2016-04-30 22:09:53 +02:00
uint32 imageId = 2618;
2017-01-04 22:17:08 +01:00
sint32 height2 = map_element->base_height * 8;
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(map_element)) {
2016-04-30 22:09:53 +02:00
imageId = 2619 + ((map_element->properties.path.type + get_current_rotation()) & 3);
2017-01-12 18:36:05 +01:00
height2 += 16;
2016-04-30 22:09:53 +02:00
}
2017-01-12 18:36:05 +01:00
sub_98196C(imageId | patrolColour << 19 | 0x20000000, 16, 16, 1, 1, 0, height2 + 2, get_current_rotation());
2016-04-30 22:09:53 +02:00
}
}
if (gCurrentViewportFlags & VIEWPORT_FLAG_PATH_HEIGHTS) {
2017-01-12 18:36:05 +01:00
uint16 height2 = 3 + map_element->base_height * 8;
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(map_element)) {
2017-01-12 18:36:05 +01:00
height2 += 8;
2016-04-30 22:09:53 +02:00
}
2017-01-12 18:36:05 +01:00
uint32 imageId = (SPR_HEIGHT_MARKER_BASE + height2 / 16) | COLOUR_GREY << 19 | 0x20000000;
2016-06-11 11:47:44 +02:00
imageId += get_height_marker_offset();
imageId -= gMapBaseZ;
2017-01-12 18:36:05 +01:00
sub_98196C(imageId, 16, 16, 1, 1, 0, height2, get_current_rotation());
2016-04-30 22:09:53 +02:00
}
uint8 pathType = (map_element->properties.path.type & 0xF0) >> 4;
2016-06-14 21:33:56 +02:00
rct_footpath_entry * footpathEntry = gFootpathEntries[pathType];
2016-04-30 22:09:53 +02:00
2017-01-29 11:15:29 +01:00
if (footpathEntry->support_type == FOOTPATH_ENTRY_SUPPORT_TYPE_POLE) {
path_paint_pole_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
2016-04-30 22:09:53 +02:00
} else {
2017-01-29 11:15:29 +01:00
path_paint_box_support(map_element, height, footpathEntry, word_F3F038, imageFlags, sceneryImageFlags);
2016-04-30 22:09:53 +02:00
}
2016-10-17 23:51:18 +02:00
2016-10-24 14:06:44 +02:00
#ifdef __ENABLE_LIGHTFX__
if (gConfigGeneral.enable_light_fx) {
if (footpath_element_has_path_scenery(map_element) && !(map_element->flags & MAP_ELEMENT_FLAG_BROKEN)) {
rct_scenery_entry *sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP) {
if (!(map_element->properties.path.edges & (1 << 0))) {
lightfx_add_3d_light_magic_from_drawing_tile(-16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
}
if (!(map_element->properties.path.edges & (1 << 1))) {
lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
}
if (!(map_element->properties.path.edges & (1 << 2))) {
lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
}
if (!(map_element->properties.path.edges & (1 << 3))) {
lightfx_add_3d_light_magic_from_drawing_tile(0, -16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
}
2016-10-17 23:51:18 +02:00
}
}
}
#endif
}
2016-04-30 22:09:53 +02:00
2017-01-29 11:15:29 +01:00
void path_paint_pole_support(rct_map_element * mapElement, sint32 height, rct_footpath_entry * footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
2016-04-30 22:09:53 +02:00
{
2016-06-14 21:33:56 +02:00
// Rol edges around rotation
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
(((mapElement->properties.path.edges & 0xF) << get_current_rotation()) >> 4);
uint8 corners = (((mapElement->properties.path.edges >> 4) << get_current_rotation()) & 0xF) |
(((mapElement->properties.path.edges >> 4) << get_current_rotation()) >> 4);
rct_xy16 boundBoxOffset = {.x =stru_98D804[edges][0], .y = stru_98D804[edges][1]};
rct_xy16 boundBoxSize = {.x =stru_98D804[edges][2], .y = stru_98D804[edges][3]};
uint16 edi = edges | (corners << 4);
uint32 imageId;
if (footpath_element_is_sloped(mapElement)) {
imageId = ((mapElement->properties.path.type + get_current_rotation()) & 3) + 16;
2016-04-30 22:09:53 +02:00
} else {
2016-06-14 21:33:56 +02:00
imageId = byte_98D6E0[edi];
2016-04-30 22:09:53 +02:00
}
2016-06-14 21:33:56 +02:00
imageId += footpathEntry->image;
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(mapElement)) {
2016-06-14 21:33:56 +02:00
imageId += 51;
2016-04-30 22:09:53 +02:00
}
2016-09-10 23:38:45 +02:00
if (!gDidPassSurface) {
2016-04-30 22:09:53 +02:00
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 26;
boundBoxSize.y = 26;
}
2016-09-10 23:38:45 +02:00
if (!hasFences || !gDidPassSurface) {
2016-06-14 21:33:56 +02:00
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
2016-04-30 22:09:53 +02:00
} else {
uint32 image_id;
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(mapElement)) {
image_id = ((mapElement->properties.path.type + get_current_rotation()) & 3) + footpathEntry->bridge_image + 51;
2016-04-30 22:09:53 +02:00
} else {
2016-06-14 21:33:56 +02:00
image_id = byte_98D8A4[edges] + footpathEntry->bridge_image + 49;
2016-04-30 22:09:53 +02:00
}
2016-06-14 21:33:56 +02:00
sub_98197C(image_id | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
2016-04-30 22:09:53 +02:00
2017-01-29 11:15:29 +01:00
if (!footpath_element_is_queue(mapElement) && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
2016-04-30 22:09:53 +02:00
// don't draw
} else {
2016-06-14 21:33:56 +02:00
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
2016-04-30 22:09:53 +02:00
}
}
2016-06-14 21:33:56 +02:00
sub_6A3F61(mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences);
2016-04-30 22:09:53 +02:00
uint16 ax = 0;
2016-06-14 21:33:56 +02:00
if (footpath_element_is_sloped(mapElement)) {
2016-06-12 19:00:30 +02:00
ax = ((mapElement->properties.path.type + get_current_rotation()) & 0x3) + 1;
2016-04-30 22:09:53 +02:00
}
2016-06-14 21:33:56 +02:00
if (byte_98D8A4[edges] == 0) {
path_a_supports_paint_setup(0, ax, height, imageFlags, footpathEntry, NULL);
2016-04-30 22:09:53 +02:00
} else {
2016-06-14 21:33:56 +02:00
path_a_supports_paint_setup(1, ax, height, imageFlags, footpathEntry, NULL);
2016-04-30 22:09:53 +02:00
}
height += 32;
2016-06-12 19:00:30 +02:00
if (footpath_element_is_sloped(mapElement)) {
2016-04-30 22:09:53 +02:00
height += 16;
}
2016-06-11 11:47:44 +02:00
paint_util_set_general_support_height(height, 0x20);
2016-04-30 22:09:53 +02:00
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(mapElement)
2016-06-12 19:00:30 +02:00
|| (mapElement->properties.path.edges != 0xFF && hasFences)
2016-04-30 22:09:53 +02:00
) {
2016-06-11 11:47:44 +02:00
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
return;
}
2016-06-12 19:00:30 +02:00
if (mapElement->properties.path.edges == 0xFF) {
2016-06-11 11:47:44 +02:00
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
return;
}
2016-06-11 11:47:44 +02:00
paint_util_set_segment_support_height(SEGMENT_C4, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
2016-06-11 11:47:44 +02:00
if (edges & 1) {
paint_util_set_segment_support_height(SEGMENT_CC, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
}
2016-06-11 11:47:44 +02:00
if (edges & 2) {
paint_util_set_segment_support_height(SEGMENT_D4, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
}
2016-06-11 11:47:44 +02:00
if (edges & 4) {
paint_util_set_segment_support_height(SEGMENT_D0, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
}
2016-06-11 11:47:44 +02:00
if (edges & 8) {
paint_util_set_segment_support_height(SEGMENT_C8, 0xFFFF, 0);
2016-04-30 22:09:53 +02:00
}
}
2017-01-29 11:15:29 +01:00
void path_paint_box_support(rct_map_element* mapElement, sint16 height, rct_footpath_entry* footpathEntry, bool hasFences, uint32 imageFlags, uint32 sceneryImageFlags)
2016-04-30 22:09:53 +02:00
{
2016-06-05 20:56:57 +02:00
// Rol edges around rotation
uint8 edges = ((mapElement->properties.path.edges << get_current_rotation()) & 0xF) |
2016-06-10 19:33:43 +02:00
(((mapElement->properties.path.edges & 0xF) << get_current_rotation()) >> 4);
2016-06-05 20:56:57 +02:00
rct_xy16 boundBoxOffset = {
.x = stru_98D804[edges][0],
.y = stru_98D804[edges][1]
};
rct_xy16 boundBoxSize = {
.x = stru_98D804[edges][2],
.y = stru_98D804[edges][3]
};
uint8 corners = (((mapElement->properties.path.edges >> 4) << get_current_rotation()) & 0xF) |
(((mapElement->properties.path.edges >> 4) << get_current_rotation()) >> 4);
uint16 edi = edges | (corners << 4);
uint32 imageId;
if (footpath_element_is_sloped(mapElement)) {
imageId = ((mapElement->properties.path.type + get_current_rotation()) & 3) + 16;
}
else {
imageId = byte_98D6E0[edi];
}
imageId += footpathEntry->image;
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(mapElement)) {
2016-06-05 20:56:57 +02:00
imageId += 51;
}
// Below Surface
2016-09-10 23:38:45 +02:00
if (!gDidPassSurface) {
2016-06-05 20:56:57 +02:00
boundBoxOffset.x = 3;
boundBoxOffset.y = 3;
boundBoxSize.x = 26;
boundBoxSize.y = 26;
}
2016-09-10 23:38:45 +02:00
if (!hasFences || !gDidPassSurface) {
2016-06-05 20:56:57 +02:00
sub_98197C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
}
else {
uint32 bridgeImage;
if (footpath_element_is_sloped(mapElement)) {
bridgeImage = ((mapElement->properties.path.type + get_current_rotation()) & 3) + footpathEntry->bridge_image + 16;
}
else {
bridgeImage = edges + footpathEntry->bridge_image;
bridgeImage |= imageFlags;
}
sub_98197C(bridgeImage | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(mapElement) || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_HAS_PATH_BASE_SPRITE)) {
2016-06-05 20:56:57 +02:00
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
}
}
sub_6A3F61(mapElement, edi, height, footpathEntry, imageFlags, sceneryImageFlags, hasFences); // TODO: arguments
uint16 ax = 0;
if (footpath_element_is_sloped(mapElement)) {
ax = 8;
}
uint8 supports[] = {
6,
8,
7,
5
};
for (sint8 i = 3; i > -1; --i) {
if (!(edges & (1 << i))) {
2016-09-17 16:51:06 +02:00
path_b_supports_paint_setup(supports[i], ax, height, imageFlags, footpathEntry);
2016-06-05 20:56:57 +02:00
}
}
height += 32;
if (footpath_element_is_sloped(mapElement)) {
height += 16;
}
paint_util_set_general_support_height(height, 0x20);
2016-11-13 20:17:49 +01:00
2017-01-29 11:15:29 +01:00
if (footpath_element_is_queue(mapElement)
2016-06-05 20:56:57 +02:00
|| (mapElement->properties.path.edges != 0xFF && hasFences)
) {
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
return;
}
if (mapElement->properties.path.edges == 0xFF) {
paint_util_set_segment_support_height(SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
return;
}
2016-06-05 20:56:57 +02:00
paint_util_set_segment_support_height(SEGMENT_C4, 0xFFFF, 0);
2016-06-05 20:56:57 +02:00
if (edges & 1) {
paint_util_set_segment_support_height(SEGMENT_CC, 0xFFFF, 0);
}
2016-06-05 20:56:57 +02:00
if (edges & 2) {
paint_util_set_segment_support_height(SEGMENT_D4, 0xFFFF, 0);
}
2016-06-05 20:56:57 +02:00
if (edges & 4) {
paint_util_set_segment_support_height(SEGMENT_D0, 0xFFFF, 0);
}
2016-06-05 20:56:57 +02:00
if (edges & 8) {
paint_util_set_segment_support_height(SEGMENT_C8, 0xFFFF, 0);
}
2016-06-15 23:31:13 +02:00
}