2016-05-01 17:01:40 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2016-05-05 20:29:49 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-05 20:29:49 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-05 20:29:49 +02:00
|
|
|
*****************************************************************************/
|
2016-05-01 17:01:40 +02:00
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
#include "../../Context.h"
|
2017-11-30 18:17:06 +01:00
|
|
|
#include "../../Game.h"
|
2018-06-22 23:03:53 +02:00
|
|
|
#include "../../config/Config.h"
|
2021-09-11 18:53:14 +02:00
|
|
|
#include "../../core/Numerics.hpp"
|
2018-06-22 23:03:53 +02:00
|
|
|
#include "../../drawing/LightFX.h"
|
2021-11-26 15:49:52 +01:00
|
|
|
#include "../../entity/EntityRegistry.h"
|
2021-11-25 22:47:24 +01:00
|
|
|
#include "../../entity/Peep.h"
|
|
|
|
#include "../../entity/Staff.h"
|
2018-01-06 00:45:53 +01:00
|
|
|
#include "../../interface/Viewport.h"
|
2018-01-06 18:32:25 +01:00
|
|
|
#include "../../localisation/Localisation.h"
|
2021-09-03 19:19:42 +02:00
|
|
|
#include "../../object/FootpathObject.h"
|
|
|
|
#include "../../object/FootpathRailingsObject.h"
|
|
|
|
#include "../../object/FootpathSurfaceObject.h"
|
2018-01-02 20:36:42 +01:00
|
|
|
#include "../../object/ObjectList.h"
|
2021-09-03 19:19:42 +02:00
|
|
|
#include "../../object/ObjectManager.h"
|
2021-11-26 16:03:14 +01:00
|
|
|
#include "../../ride/Ride.h"
|
2017-10-17 13:51:47 +02:00
|
|
|
#include "../../ride/Track.h"
|
2018-03-19 23:28:40 +01:00
|
|
|
#include "../../ride/TrackDesign.h"
|
2018-01-10 00:00:09 +01:00
|
|
|
#include "../../ride/TrackPaint.h"
|
2018-01-11 10:59:26 +01:00
|
|
|
#include "../../world/Footpath.h"
|
2018-06-22 23:03:53 +02:00
|
|
|
#include "../../world/Map.h"
|
2018-01-11 10:59:26 +01:00
|
|
|
#include "../../world/Scenery.h"
|
2018-05-01 16:33:16 +02:00
|
|
|
#include "../../world/Surface.h"
|
2021-08-01 22:13:12 +02:00
|
|
|
#include "../../world/TileInspector.h"
|
2021-11-24 15:58:01 +01:00
|
|
|
#include "../Paint.h"
|
2017-12-14 10:34:12 +01:00
|
|
|
#include "../Supports.h"
|
2018-06-01 00:16:53 +02:00
|
|
|
#include "Paint.Surface.h"
|
2018-06-22 23:03:53 +02:00
|
|
|
#include "Paint.TileElement.h"
|
2016-05-01 17:01:40 +02:00
|
|
|
|
2021-08-01 22:13:12 +02:00
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
2018-06-15 14:09:14 +02:00
|
|
|
bool gPaintWidePathsAsGhost = false;
|
|
|
|
|
2021-10-17 15:31:56 +02:00
|
|
|
const uint8_t PathSlopeToLandSlope[] = {
|
2019-01-18 20:35:43 +01:00
|
|
|
TILE_ELEMENT_SLOPE_SW_SIDE_UP,
|
|
|
|
TILE_ELEMENT_SLOPE_NW_SIDE_UP,
|
|
|
|
TILE_ELEMENT_SLOPE_NE_SIDE_UP,
|
2021-10-17 15:31:56 +02:00
|
|
|
TILE_ELEMENT_SLOPE_SE_SIDE_UP,
|
2016-04-30 22:09:53 +02:00
|
|
|
};
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static constexpr const uint8_t byte_98D6E0[] = {
|
2021-10-17 15:31:56 +02:00
|
|
|
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,
|
2016-04-30 22:09:53 +02:00
|
|
|
};
|
|
|
|
|
2021-10-17 15:31:56 +02:00
|
|
|
// clang-format off
|
2018-06-20 17:28:51 +02:00
|
|
|
static constexpr const int16_t stru_98D804[][4] = {
|
2021-10-17 15:31:56 +02:00
|
|
|
{ 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 },
|
2016-04-30 22:09:53 +02:00
|
|
|
};
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
static constexpr const uint8_t byte_98D8A4[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0
|
2016-04-30 22:09:53 +02:00
|
|
|
};
|
2018-01-10 16:14:36 +01:00
|
|
|
// clang-format on
|
2016-04-30 22:09:53 +02:00
|
|
|
|
2018-01-16 23:53:27 +01:00
|
|
|
void path_paint_box_support(
|
2021-09-03 19:19:42 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, int32_t height, const FootpathPaintInfo& pathPaintInfo,
|
|
|
|
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
|
2018-01-16 23:53:27 +01:00
|
|
|
void path_paint_pole_support(
|
2021-09-03 19:19:42 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, int16_t height, const FootpathPaintInfo& pathPaintInfo,
|
|
|
|
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags);
|
2017-12-08 16:47:54 +01:00
|
|
|
|
2016-06-08 20:53:55 +02:00
|
|
|
/* rct2: 0x006A5AE5 */
|
2018-01-16 23:53:27 +01:00
|
|
|
static void path_bit_lights_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
paint_session* session, PathBitEntry* pathBitEntry, const PathElement& pathElement, int32_t height, uint8_t edges,
|
2018-06-22 23:03:53 +02:00
|
|
|
uint32_t pathBitImageFlags)
|
2018-01-16 23:53:27 +01:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2017-06-06 23:24:18 +02:00
|
|
|
height += 8;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 1;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 2, 16, height }, { 1, 1, 23 }, { 3, 16, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 2;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 30, height }, { 1, 0, 23 }, { 16, 29, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 3;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 30, 16, height }, { 0, 1, 23 }, { 29, 16, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 2, height }, { 1, 1, 23 }, { 16, 3, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rct2: 0x006A5C94 */
|
2018-01-16 23:53:27 +01:00
|
|
|
static void path_bit_bins_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
paint_session* session, PathBitEntry* pathBitEntry, const PathElement& pathElement, int32_t height, uint8_t edges,
|
2018-06-22 23:03:53 +02:00
|
|
|
uint32_t pathBitImageFlags)
|
2018-01-16 23:53:27 +01:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2017-06-06 23:24:18 +02:00
|
|
|
height += 8;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId;
|
2021-08-11 23:26:46 +02:00
|
|
|
bool binsAreVandalised = pathElement.IsBroken();
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 5;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-02-03 01:07:28 +01:00
|
|
|
bool binIsFull = false;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!binsAreVandalised)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId -= 4;
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Edges have been rotated around the rotation to check addition status
|
|
|
|
// this will also need to be rotated.
|
2021-09-11 18:53:14 +02:00
|
|
|
binIsFull = !(pathElement.GetAdditionStatus() & Numerics::ror8(0x3, (2 * session->CurrentRotation)));
|
2018-02-03 01:07:28 +01:00
|
|
|
if (binIsFull)
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 8;
|
|
|
|
}
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2018-12-05 19:29:51 +01:00
|
|
|
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 7, 16, height }, { 1, 1, 7 }, { 7, 16, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 6;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-02-03 01:07:28 +01:00
|
|
|
bool binIsFull = false;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!binsAreVandalised)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId -= 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Edges have been rotated around the rotation to check addition status
|
|
|
|
// this will also need to be rotated.
|
2021-09-11 18:53:14 +02:00
|
|
|
binIsFull = !(pathElement.GetAdditionStatus() & Numerics::ror8(0xC, (2 * session->CurrentRotation)));
|
2018-02-03 01:07:28 +01:00
|
|
|
if (binIsFull)
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 8;
|
|
|
|
}
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2018-12-05 19:29:51 +01:00
|
|
|
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 25, height }, { 1, 1, 7 }, { 16, 25, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 7;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-02-03 01:07:28 +01:00
|
|
|
bool binIsFull = false;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!binsAreVandalised)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId -= 4;
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Edges have been rotated around the rotation to check addition status
|
|
|
|
// this will also need to be rotated.
|
2021-09-11 18:53:14 +02:00
|
|
|
binIsFull = !(pathElement.GetAdditionStatus() & Numerics::ror8(0x30, (2 * session->CurrentRotation)));
|
2018-02-03 01:07:28 +01:00
|
|
|
if (binIsFull)
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 8;
|
|
|
|
}
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2018-12-05 19:29:51 +01:00
|
|
|
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 25, 16, height }, { 1, 1, 7 }, { 25, 16, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 8;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2018-02-03 01:07:28 +01:00
|
|
|
bool binIsFull = false;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!binsAreVandalised)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId -= 4;
|
2016-06-08 20:53:55 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Edges have been rotated around the rotation to check addition status
|
|
|
|
// this will also need to be rotated.
|
2021-09-11 18:53:14 +02:00
|
|
|
binIsFull = !(pathElement.GetAdditionStatus() & Numerics::ror8(0xC0, (2 * session->CurrentRotation)));
|
2018-02-03 01:07:28 +01:00
|
|
|
if (binIsFull)
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 8;
|
|
|
|
}
|
2016-11-13 20:17:49 +01:00
|
|
|
|
2018-12-05 19:29:51 +01:00
|
|
|
if (!(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) || binIsFull || binsAreVandalised)
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 7, height }, { 1, 1, 7 }, { 16, 7, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rct2: 0x006A5E81 */
|
2018-01-16 23:53:27 +01:00
|
|
|
static void path_bit_benches_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
paint_session* session, PathBitEntry* pathBitEntry, const PathElement& pathElement, int32_t height, uint8_t edges,
|
2018-06-22 23:03:53 +02:00
|
|
|
uint32_t pathBitImageFlags)
|
2018-01-16 23:53:27 +01:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 1;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 7, 16, height }, { 0, 16, 7 }, { 6, 8, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SE))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 2;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 25, height }, { 16, 0, 7 }, { 8, 23, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_SW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 3;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 25, 16, height }, { 0, 16, 7 }, { 23, 8, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(edges & EDGE_NW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId = pathBitEntry->image + 4;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsBroken())
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += 4;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 7, height }, { 16, 0, 7 }, { 8, 6, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-08 20:53:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rct2: 0x006A6008 */
|
2018-01-16 23:53:27 +01:00
|
|
|
static void path_bit_jumping_fountains_paint(
|
2021-06-03 22:23:00 +02:00
|
|
|
paint_session* session, PathBitEntry* pathBitEntry, int32_t height, uint32_t pathBitImageFlags, rct_drawpixelinfo* dpi)
|
2018-01-16 23:53:27 +01:00
|
|
|
{
|
2020-02-20 01:18:05 +01:00
|
|
|
if (dpi->zoom_level > 0)
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId = pathBitEntry->image;
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId |= pathBitImageFlags;
|
2016-06-09 20:47:36 +02:00
|
|
|
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId + 1, { 0, 0, height }, { 1, 1, 2 }, { 3, 3, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, imageId + 2, { 0, 0, height }, { 1, 1, 2 }, { 3, 29, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, imageId + 3, { 0, 0, height }, { 1, 1, 2 }, { 29, 29, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, imageId + 4, { 0, 0, height }, { 1, 1, 2 }, { 29, 3, height + 2 });
|
2016-06-08 20:53:55 +02:00
|
|
|
}
|
|
|
|
|
2016-04-30 22:09:53 +02:00
|
|
|
/**
|
|
|
|
* rct2: 0x006A4101
|
2017-10-31 12:57:40 +01:00
|
|
|
* @param tile_element (esi)
|
2016-04-30 22:09:53 +02:00
|
|
|
*/
|
2018-01-16 23:53:27 +01:00
|
|
|
static void sub_6A4101(
|
2021-09-08 15:40:35 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, uint16_t height, uint32_t connectedEdges, bool hasSupports,
|
2021-09-03 19:19:42 +02:00
|
|
|
const FootpathPaintInfo& pathPaintInfo, uint32_t imageFlags)
|
2016-04-30 22:09:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
uint32_t base_image_id = pathPaintInfo.RailingsImageId | imageFlags;
|
2019-01-20 21:38:38 +01:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsQueue())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-01-20 12:20:41 +01:00
|
|
|
uint8_t local_ebp = connectedEdges & 0x0F;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
switch ((pathElement.GetSlopeDirection() + session->CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
2018-01-03 10:57:37 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
case 0:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 22 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 22 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 21 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 21 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 23 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 23 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 20 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 20 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (local_ebp)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
case 1:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 17 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 17 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 18 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 18 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 17 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 20:45:25 +02:00
|
|
|
session, 18 + base_image_id, { 28, 0, height }, { 1, 28, 7 },
|
|
|
|
{ 28, 4, height + 2 }); // bound_box_offset_y seems to be a bug
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 25 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 19 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 19 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 15 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 15 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 18 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 19 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 26 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 8:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 16 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 16 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 9:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 16 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 17 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 24 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 10:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 14 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 14 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 12:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 16 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 20:45:25 +02:00
|
|
|
session, 19 + base_image_id, { 0, 28, height }, { 28, 1, 7 },
|
|
|
|
{ 4, 28, height + 2 }); // bound_box_offset_x seems to be a bug
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 27 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// purposely left empty
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-27 14:21:14 +02:00
|
|
|
if (!pathElement.HasQueueBanner() || (pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_NO_QUEUE_BANNER))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t direction = pathElement.GetQueueBannerDirection();
|
2017-06-06 23:24:18 +02:00
|
|
|
// Draw ride sign
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::Ride;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.GetSlopeDirection() == direction)
|
2017-06-06 23:24:18 +02:00
|
|
|
height += 16;
|
|
|
|
}
|
2018-02-12 23:25:46 +01:00
|
|
|
direction += session->CurrentRotation;
|
2017-06-06 23:24:18 +02:00
|
|
|
direction &= 3;
|
|
|
|
|
2019-10-31 00:19:14 +01:00
|
|
|
CoordsXYZ boundBoxOffsets = CoordsXYZ(BannerBoundBoxes[direction][0], height + 2);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-01-20 21:38:38 +01:00
|
|
|
uint32_t imageId = (direction << 1) + base_image_id + 28;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-01-03 10:57:37 +01:00
|
|
|
// Draw pole in the back
|
2021-08-20 22:01:57 +02:00
|
|
|
PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 21 }, boundBoxOffsets);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-01-03 10:57:37 +01:00
|
|
|
// Draw pole in the front and banner
|
2017-06-06 23:24:18 +02:00
|
|
|
boundBoxOffsets.x = BannerBoundBoxes[direction][1].x;
|
|
|
|
boundBoxOffsets.y = BannerBoundBoxes[direction][1].y;
|
|
|
|
imageId++;
|
2021-08-20 21:10:46 +02:00
|
|
|
PaintAddImageAsParent(session, imageId, { 0, 0, height }, { 1, 1, 21 }, boundBoxOffsets);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
direction--;
|
|
|
|
// If text shown
|
2021-08-11 23:26:46 +02:00
|
|
|
auto ride = get_ride(pathElement.GetRideIndex());
|
2019-08-08 13:45:17 +02:00
|
|
|
if (direction < 2 && ride != nullptr && imageFlags == 0)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
uint16_t scrollingMode = pathPaintInfo.ScrollingMode;
|
2017-06-06 23:24:18 +02:00
|
|
|
scrollingMode += direction;
|
|
|
|
|
2020-09-28 02:09:08 +02:00
|
|
|
auto ft = Formatter();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-06-10 08:09:58 +02:00
|
|
|
if (ride->status == RideStatus::Open && !(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-04-23 02:41:20 +02:00
|
|
|
ft.Add<rct_string_id>(STR_RIDE_ENTRANCE_NAME);
|
|
|
|
ride->FormatNameTo(ft);
|
2019-01-31 23:27:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-04-23 02:41:20 +02:00
|
|
|
ft.Add<rct_string_id>(STR_RIDE_ENTRANCE_CLOSED);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
if (gConfigGeneral.upper_case_banners)
|
|
|
|
{
|
2018-08-13 21:13:20 +02:00
|
|
|
format_string_to_upper(
|
2020-09-28 02:09:08 +02:00
|
|
|
gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-28 02:09:08 +02:00
|
|
|
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-02-27 18:15:44 +01:00
|
|
|
uint16_t stringWidth = gfx_get_string_width(gCommonStringFormatBuffer, FontSpriteBase::TINY);
|
2019-12-04 11:22:07 +01:00
|
|
|
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsChild(
|
2020-07-31 12:31:26 +02:00
|
|
|
session, scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK), 0, 0,
|
|
|
|
1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::Footpath;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (imageFlags != 0)
|
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::None;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:29:27 +01:00
|
|
|
uint32_t drawnCorners = 0;
|
2019-01-20 12:20:41 +01:00
|
|
|
// If the path is not drawn over the supports, then no corner sprites will be drawn (making double-width paths
|
|
|
|
// look like connected series of intersections).
|
2021-10-27 14:21:14 +02:00
|
|
|
if (pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-01-20 17:29:27 +01:00
|
|
|
drawnCorners = (connectedEdges & FOOTPATH_PROPERTIES_EDGES_CORNERS_MASK) >> 4;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
auto slopeRailingsSupported = !(pathPaintInfo.SurfaceFlags & FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS);
|
|
|
|
if ((hasSupports || slopeRailingsSupported) && pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
switch ((pathElement.GetSlopeDirection() + session->CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
2018-01-03 10:57:37 +01:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
case 0:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 8 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 8 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 7 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 7 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 9 + base_image_id, { 0, 4, height }, { 32, 1, 23 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 9 + base_image_id, { 0, 28, height }, { 32, 1, 23 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 6 + base_image_id, { 4, 0, height }, { 1, 32, 23 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 6 + base_image_id, { 28, 0, height }, { 1, 32, 23 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-08 15:40:35 +02:00
|
|
|
if (!hasSupports)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-20 12:20:41 +01:00
|
|
|
switch (connectedEdges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
case 0:
|
|
|
|
// purposely left empty
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 3 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 3 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 4 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 4 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 5 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 5 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 1 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 1 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 8:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 2 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 2 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
case 10:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 0 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 0 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 3 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 20:45:25 +02:00
|
|
|
session, 4 + base_image_id, { 28, 0, height }, { 1, 28, 7 },
|
|
|
|
{ 28, 4, height + 2 }); // bound_box_offset_y seems to be a bug
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_0))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 4 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 5 + base_image_id, { 0, 4, height }, { 28, 1, 7 }, { 0, 4, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_1))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 9:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 2 + base_image_id, { 28, 0, height }, { 1, 28, 7 }, { 28, 0, height + 2 });
|
|
|
|
PaintAddImageAsParent(session, 3 + base_image_id, { 0, 28, height }, { 28, 1, 7 }, { 0, 28, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_3))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 2 + base_image_id, { 4, 0, height }, { 1, 28, 7 }, { 4, 0, height + 2 });
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 20:45:25 +02:00
|
|
|
session, 5 + base_image_id, { 0, 28, height }, { 28, 1, 7 },
|
|
|
|
{ 4, 28, height + 2 }); // bound_box_offset_x seems to be a bug
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_2))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 1 + base_image_id, { 0, 4, height }, { 32, 1, 7 }, { 0, 4, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_0))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_1))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 13:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 1 + base_image_id, { 0, 28, height }, { 32, 1, 7 }, { 0, 28, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_2))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_3))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 14:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 0 + base_image_id, { 4, 0, height }, { 1, 32, 7 }, { 4, 0, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_1))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_2))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11:
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 0 + base_image_id, { 28, 0, height }, { 1, 32, 7 }, { 28, 0, height + 2 });
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_0))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_3))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_0))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 11 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_1))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 12 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 28, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_2))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 13 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 28, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-01-20 17:29:27 +01:00
|
|
|
if (!(drawnCorners & FOOTPATH_CORNER_3))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, 10 + base_image_id, { 0, 0, height }, { 4, 4, 7 }, { 0, 0, height + 2 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-04-30 22:09:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* rct2: 0x006A3F61
|
2021-08-11 23:26:46 +02:00
|
|
|
* @param pathElement (esp[0])
|
2018-01-03 10:57:37 +01:00
|
|
|
* @param connectedEdges (bp) (relative to the camera's rotation)
|
2016-04-30 22:09:53 +02:00
|
|
|
* @param height (dx)
|
2021-10-27 14:21:14 +02:00
|
|
|
* @param pathPaintInfo (0x00F3EF6C)
|
2016-06-14 21:33:56 +02:00
|
|
|
* @param imageFlags (0x00F3EF70)
|
|
|
|
* @param sceneryImageFlags (0x00F3EF74)
|
2016-04-30 22:09:53 +02:00
|
|
|
*/
|
2018-01-16 23:53:27 +01:00
|
|
|
static void sub_6A3F61(
|
2021-08-11 23:26:46 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, uint16_t connectedEdges, uint16_t height,
|
2021-09-03 19:19:42 +02:00
|
|
|
const FootpathPaintInfo& pathPaintInfo, uint32_t imageFlags, uint32_t sceneryImageFlags, bool hasSupports)
|
2016-04-30 22:09:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// eax --
|
|
|
|
// ebx --
|
|
|
|
// ecx
|
|
|
|
// edx
|
|
|
|
// esi --
|
|
|
|
// edi --
|
|
|
|
// ebp
|
|
|
|
// esp: [ esi, ???, 000]
|
|
|
|
|
|
|
|
// Probably drawing benches etc.
|
|
|
|
|
2018-12-18 16:40:28 +01:00
|
|
|
rct_drawpixelinfo* dpi = &session->DPI;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (dpi->zoom_level <= 1)
|
|
|
|
{
|
2019-06-04 20:34:39 +02:00
|
|
|
bool paintScenery = true;
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!gTrackDesignSaveMode)
|
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.HasAddition())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::FootpathItem;
|
2018-06-22 23:03:53 +02:00
|
|
|
if (sceneryImageFlags != 0)
|
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::None;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw additional path bits (bins, benches, lamps, queue screens)
|
2021-08-11 23:26:46 +02:00
|
|
|
auto* pathAddEntry = pathElement.GetAdditionEntry();
|
2018-02-03 01:07:28 +01:00
|
|
|
|
2018-12-05 22:59:15 +01:00
|
|
|
// Can be null if the object is not loaded.
|
2021-06-03 22:23:00 +02:00
|
|
|
if (pathAddEntry == nullptr)
|
2018-02-03 01:07:28 +01:00
|
|
|
{
|
2019-06-04 20:34:39 +02:00
|
|
|
paintScenery = false;
|
2018-02-03 01:07:28 +01:00
|
|
|
}
|
2019-06-04 20:34:39 +02:00
|
|
|
else if (
|
2021-08-11 23:26:46 +02:00
|
|
|
(session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES) && !(pathElement.IsBroken())
|
2021-06-07 14:40:27 +02:00
|
|
|
&& pathAddEntry->draw_type != PathBitDrawType::Bin)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-06-04 20:34:39 +02:00
|
|
|
paintScenery = false;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-06-04 20:34:39 +02:00
|
|
|
else
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-06-03 22:23:00 +02:00
|
|
|
switch (pathAddEntry->draw_type)
|
2019-06-04 20:34:39 +02:00
|
|
|
{
|
2021-06-07 14:40:27 +02:00
|
|
|
case PathBitDrawType::Light:
|
2019-06-04 20:34:39 +02:00
|
|
|
path_bit_lights_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
session, pathAddEntry, pathElement, height, static_cast<uint8_t>(connectedEdges),
|
2020-04-22 17:09:29 +02:00
|
|
|
sceneryImageFlags);
|
2019-06-04 20:34:39 +02:00
|
|
|
break;
|
2021-06-07 14:40:27 +02:00
|
|
|
case PathBitDrawType::Bin:
|
2019-06-04 20:34:39 +02:00
|
|
|
path_bit_bins_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
session, pathAddEntry, pathElement, height, static_cast<uint8_t>(connectedEdges),
|
2020-04-22 17:09:29 +02:00
|
|
|
sceneryImageFlags);
|
2019-06-04 20:34:39 +02:00
|
|
|
break;
|
2021-06-07 14:40:27 +02:00
|
|
|
case PathBitDrawType::Bench:
|
2019-06-04 20:34:39 +02:00
|
|
|
path_bit_benches_paint(
|
2021-08-11 23:26:46 +02:00
|
|
|
session, pathAddEntry, pathElement, height, static_cast<uint8_t>(connectedEdges),
|
2020-04-22 17:09:29 +02:00
|
|
|
sceneryImageFlags);
|
2019-06-04 20:34:39 +02:00
|
|
|
break;
|
2021-06-07 14:40:27 +02:00
|
|
|
case PathBitDrawType::JumpingFountain:
|
2021-06-03 22:23:00 +02:00
|
|
|
path_bit_jumping_fountains_paint(session, pathAddEntry, height, sceneryImageFlags, dpi);
|
2019-06-04 20:34:39 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::Footpath;
|
2019-06-04 20:34:39 +02:00
|
|
|
|
|
|
|
if (sceneryImageFlags != 0)
|
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::None;
|
2019-06-04 20:34:39 +02:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Redundant zoom-level check removed
|
|
|
|
|
2019-06-04 20:34:39 +02:00
|
|
|
if (paintScenery)
|
2021-09-03 19:19:42 +02:00
|
|
|
sub_6A4101(session, pathElement, height, connectedEdges, hasSupports, pathPaintInfo, imageFlags);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// This is about tunnel drawing
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t direction = (pathElement.GetSlopeDirection() + session->CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK;
|
|
|
|
bool sloped = pathElement.IsSloped();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (connectedEdges & EDGE_SE)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Bottom right of tile is a tunnel
|
2018-06-22 23:03:53 +02:00
|
|
|
if (sloped && direction == EDGE_NE)
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Path going down into the tunnel
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_right(session, height + 16, TUNNEL_PATH_AND_MINI_GOLF);
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else if (connectedEdges & EDGE_NE)
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Flat path with edge to the right (north-east)
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_right(session, height, TUNNEL_PATH_11);
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Path going up, or flat and not connected to the right
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_right(session, height, TUNNEL_PATH_AND_MINI_GOLF);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!(connectedEdges & EDGE_SW))
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bottom left of the tile is a tunnel
|
2018-06-22 23:03:53 +02:00
|
|
|
if (sloped && direction == EDGE_SE)
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Path going down into the tunnel
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_left(session, height + 16, TUNNEL_PATH_AND_MINI_GOLF);
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else if (connectedEdges & EDGE_NW)
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Flat path with edge to the left (north-west)
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_left(session, height, TUNNEL_PATH_11);
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-01-03 10:57:37 +01:00
|
|
|
// Path going up, or flat and not connected to the left
|
2020-05-09 23:54:47 +02:00
|
|
|
paint_util_push_tunnel_left(session, height, TUNNEL_PATH_AND_MINI_GOLF);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-04-30 22:09:53 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
static FootpathPaintInfo GetFootpathPaintInfo(const PathElement& pathEl)
|
|
|
|
{
|
|
|
|
FootpathPaintInfo pathPaintInfo;
|
|
|
|
|
|
|
|
const auto* surfaceDescriptor = pathEl.GetSurfaceDescriptor();
|
|
|
|
if (surfaceDescriptor != nullptr)
|
|
|
|
{
|
|
|
|
pathPaintInfo.SurfaceImageId = surfaceDescriptor->Image;
|
|
|
|
pathPaintInfo.SurfaceFlags = surfaceDescriptor->Flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto* railingsDescriptor = pathEl.GetRailingsDescriptor();
|
|
|
|
if (railingsDescriptor != nullptr)
|
|
|
|
{
|
|
|
|
pathPaintInfo.BridgeImageId = railingsDescriptor->BridgeImage;
|
|
|
|
pathPaintInfo.RailingsImageId = railingsDescriptor->RailingsImage;
|
|
|
|
pathPaintInfo.RailingFlags = railingsDescriptor->Flags;
|
|
|
|
pathPaintInfo.ScrollingMode = railingsDescriptor->ScrollingMode;
|
|
|
|
pathPaintInfo.SupportType = railingsDescriptor->SupportType;
|
|
|
|
pathPaintInfo.SupportColour = railingsDescriptor->SupportColour;
|
|
|
|
}
|
|
|
|
|
|
|
|
return pathPaintInfo;
|
|
|
|
}
|
|
|
|
|
2016-04-30 22:09:53 +02:00
|
|
|
/**
|
|
|
|
* rct2: 0x0006A3590
|
|
|
|
*/
|
2021-08-11 23:26:46 +02:00
|
|
|
void PaintPath(paint_session* session, uint16_t height, const PathElement& tileElement)
|
2016-04-30 22:09:53 +02:00
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::Footpath;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2019-01-18 20:35:43 +01:00
|
|
|
bool hasSupports = false;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t sceneryImageFlags = 0;
|
|
|
|
uint32_t imageFlags = 0;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (gTrackDesignSaveMode)
|
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.IsQueue())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.GetRideIndex() != gTrackDesignSaveRideIndex)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (!track_design_save_contains_tile_element(reinterpret_cast<const TileElement*>(&tileElement)))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-12-05 19:13:59 +01:00
|
|
|
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(EnumValue(FilterPaletteID::Palette46));
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-05 19:29:51 +01:00
|
|
|
if (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
|
2018-01-11 00:26:19 +01:00
|
|
|
{
|
2020-12-05 19:13:59 +01:00
|
|
|
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(EnumValue(FilterPaletteID::Palette46));
|
2018-01-11 00:26:19 +01:00
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.AdditionIsGhost())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-12-04 10:12:42 +01:00
|
|
|
sceneryImageFlags = CONSTRUCTION_MARKER;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.IsGhost())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-12-29 19:09:15 +01:00
|
|
|
session->InteractionType = ViewportInteractionItem::None;
|
2017-12-04 10:12:42 +01:00
|
|
|
imageFlags = CONSTRUCTION_MARKER;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-08-11 23:26:46 +02:00
|
|
|
else if (TileInspector::IsElementSelected(reinterpret_cast<const TileElement*>(&tileElement)))
|
2021-08-01 22:13:12 +02:00
|
|
|
{
|
|
|
|
imageFlags |= CONSTRUCTION_MARKER;
|
|
|
|
sceneryImageFlags = CONSTRUCTION_MARKER;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-01-11 00:26:58 +01:00
|
|
|
// For debugging purpose, show blocked tiles with a colour
|
2021-08-11 23:26:46 +02:00
|
|
|
if (gPaintBlockedTiles && tileElement.IsBlockedByVehicle())
|
2018-01-11 00:26:58 +01:00
|
|
|
{
|
|
|
|
imageFlags = COLOUR_BRIGHT_GREEN << 19 | COLOUR_GREY << 24 | IMAGE_TYPE_REMAP;
|
|
|
|
}
|
|
|
|
|
2018-06-15 14:09:14 +02:00
|
|
|
// Draw wide flags as ghosts, leaving only the "walkable" paths to be drawn normally
|
2021-08-11 23:26:46 +02:00
|
|
|
if (gPaintWidePathsAsGhost && tileElement.IsWide())
|
2018-06-15 14:09:14 +02:00
|
|
|
{
|
|
|
|
imageFlags &= 0x7FFFF;
|
|
|
|
imageFlags |= CONSTRUCTION_MARKER;
|
|
|
|
}
|
|
|
|
|
2020-02-13 10:56:46 +01:00
|
|
|
auto surface = map_get_surface_element_at(session->MapPosition);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (surface == nullptr)
|
|
|
|
{
|
2019-01-18 20:35:43 +01:00
|
|
|
hasSupports = true;
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
2019-12-27 15:26:40 +01:00
|
|
|
else if (surface->GetBaseZ() != height)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
const auto* surfaceEntry = tileElement.GetSurfaceEntry();
|
|
|
|
const bool showUndergroundRailings = surfaceEntry == nullptr
|
|
|
|
|| !(surfaceEntry->Flags & FOOTPATH_ENTRY_FLAG_NO_SLOPE_RAILINGS);
|
|
|
|
if (surface->GetBaseZ() < height || showUndergroundRailings)
|
|
|
|
hasSupports = true;
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Diagonal path
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (surface->GetSlope() != PathSlopeToLandSlope[tileElement.GetSlopeDirection()])
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-01-18 20:35:43 +01:00
|
|
|
hasSupports = true;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-11 10:06:04 +02:00
|
|
|
if (surface->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-01-18 20:35:43 +01:00
|
|
|
hasSupports = true;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (gStaffDrawPatrolAreas != 0xFFFF)
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t staffIndex = gStaffDrawPatrolAreas;
|
|
|
|
uint8_t staffType = staffIndex & 0x7FFF;
|
2017-06-06 23:24:18 +02:00
|
|
|
bool is_staff_list = staffIndex & 0x8000;
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t patrolColour = COLOUR_LIGHT_BLUE;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!is_staff_list)
|
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
Staff* staff = GetEntity<Staff>(staffIndex);
|
|
|
|
if (staff == nullptr)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-07-26 18:42:02 +02:00
|
|
|
log_error("Invalid staff index for draw patrol areas!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!staff->IsPatrolAreaSet(session->MapPosition))
|
|
|
|
{
|
|
|
|
patrolColour = COLOUR_GREY;
|
|
|
|
}
|
2020-08-17 00:25:32 +02:00
|
|
|
staffType = static_cast<uint8_t>(staff->AssignedStaffType);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-17 00:25:32 +02:00
|
|
|
if (staff_is_patrol_area_set_for_type(static_cast<StaffType>(staffType), session->MapPosition))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t imageId = 2618;
|
2021-08-11 23:26:46 +02:00
|
|
|
int32_t patrolAreaBaseZ = tileElement.GetBaseZ();
|
|
|
|
if (tileElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
imageId = 2619 + ((tileElement.GetSlopeDirection() + session->CurrentRotation) & 3);
|
2019-12-31 09:33:27 +01:00
|
|
|
patrolAreaBaseZ += 16;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2020-10-23 09:04:56 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 19:59:32 +02:00
|
|
|
session, imageId | patrolColour << 19 | IMAGE_TYPE_REMAP, { 16, 16, patrolAreaBaseZ + 2 }, { 1, 1, 0 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 09:56:41 +02:00
|
|
|
if (PaintShouldShowHeightMarkers(session, VIEWPORT_FLAG_PATH_HEIGHTS))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
uint16_t heightMarkerBaseZ = tileElement.GetBaseZ() + 3;
|
|
|
|
if (tileElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2019-12-31 09:33:27 +01:00
|
|
|
heightMarkerBaseZ += 8;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2019-12-31 09:33:27 +01:00
|
|
|
uint32_t imageId = (SPR_HEIGHT_MARKER_BASE + heightMarkerBaseZ / 16) | COLOUR_GREY << 19 | IMAGE_TYPE_REMAP;
|
2017-06-06 23:24:18 +02:00
|
|
|
imageId += get_height_marker_offset();
|
|
|
|
imageId -= gMapBaseZ;
|
2021-03-08 16:09:45 +01:00
|
|
|
PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
auto pathPaintInfo = GetFootpathPaintInfo(tileElement);
|
|
|
|
if (pathPaintInfo.SupportType == RailingEntrySupportType::Pole)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
path_paint_pole_support(session, tileElement, height, pathPaintInfo, hasSupports, imageFlags, sceneryImageFlags);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path_paint_box_support(session, tileElement, height, pathPaintInfo, hasSupports, imageFlags, sceneryImageFlags);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-10-17 23:51:18 +02:00
|
|
|
|
2016-10-24 14:06:44 +02:00
|
|
|
#ifdef __ENABLE_LIGHTFX__
|
2018-06-22 23:03:53 +02:00
|
|
|
if (lightfx_is_available())
|
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (tileElement.HasAddition() && !(tileElement.IsBroken()))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
auto* pathAddEntry = tileElement.GetAdditionEntry();
|
2021-06-03 22:23:00 +02:00
|
|
|
if (pathAddEntry != nullptr && pathAddEntry->flags & PATH_BIT_FLAG_LAMP)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
if (!(tileElement.GetEdges() & EDGE_NE))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
|
|
|
lightfx_add_3d_light_magic_from_drawing_tile(
|
2020-08-04 16:55:14 +02:00
|
|
|
session->MapPosition, -16, 0, height + 23, LightType::Lantern3);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-08-11 23:26:46 +02:00
|
|
|
if (!(tileElement.GetEdges() & EDGE_SE))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-08-04 16:55:14 +02:00
|
|
|
lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 0, 16, height + 23, LightType::Lantern3);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-08-11 23:26:46 +02:00
|
|
|
if (!(tileElement.GetEdges() & EDGE_SW))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-08-04 16:55:14 +02:00
|
|
|
lightfx_add_3d_light_magic_from_drawing_tile(session->MapPosition, 16, 0, height + 23, LightType::Lantern3);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-08-11 23:26:46 +02:00
|
|
|
if (!(tileElement.GetEdges() & EDGE_NW))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
|
|
|
lightfx_add_3d_light_magic_from_drawing_tile(
|
2020-08-04 16:55:14 +02:00
|
|
|
session->MapPosition, 0, -16, height + 23, LightType::Lantern3);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-17 23:51:18 +02:00
|
|
|
#endif
|
2016-05-05 20:29:49 +02:00
|
|
|
}
|
2016-04-30 22:09:53 +02:00
|
|
|
|
2018-01-16 23:53:27 +01:00
|
|
|
void path_paint_box_support(
|
2021-09-03 19:19:42 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, int32_t height, const FootpathPaintInfo& pathPaintInfo,
|
|
|
|
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
|
2016-04-30 22:09:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Rol edges around rotation
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t edges = ((pathElement.GetEdges() << session->CurrentRotation) & 0xF)
|
|
|
|
| (((pathElement.GetEdges()) << session->CurrentRotation) >> 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t corners = (((pathElement.GetCorners()) << session->CurrentRotation) & 0xF)
|
|
|
|
| (((pathElement.GetCorners()) << session->CurrentRotation) >> 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-06-07 17:44:38 +02:00
|
|
|
CoordsXY boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] };
|
|
|
|
CoordsXY boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t edi = edges | (corners << 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
uint32_t imageId = pathPaintInfo.SurfaceImageId;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
imageId += ((pathElement.GetSlopeDirection() + session->CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
2018-06-22 23:03:53 +02:00
|
|
|
+ 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
imageId += byte_98D6E0[edi];
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!session->DidPassSurface)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
boundBoxOffset.x = 3;
|
|
|
|
boundBoxOffset.y = 3;
|
|
|
|
boundBoxSize.x = 26;
|
|
|
|
boundBoxSize.y = 26;
|
|
|
|
}
|
|
|
|
|
2017-10-11 18:16:25 +02:00
|
|
|
// By default, add 1 to the z bounding box to always clip above the surface
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t boundingBoxZOffset = 1;
|
2017-10-11 18:16:25 +02:00
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
// If we are on the same tile as a straight track, add the offset 2 so we
|
2017-10-11 18:16:25 +02:00
|
|
|
// can clip above gravel part of the track sprite
|
2021-09-24 20:05:50 +02:00
|
|
|
if (session->TrackElementOnSameHeight != nullptr)
|
2017-10-11 18:16:25 +02:00
|
|
|
{
|
2020-08-18 08:28:41 +02:00
|
|
|
if (session->TrackElementOnSameHeight->AsTrack()->GetTrackType() == TrackElemType::Flat)
|
2017-10-11 18:16:25 +02:00
|
|
|
{
|
|
|
|
boundingBoxZOffset = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 12:00:20 +01:00
|
|
|
if (!hasSupports || !session->DidPassSurface)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 22:01:57 +02:00
|
|
|
session, imageId | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
|
|
|
|
{ boundBoxOffset, height + boundingBoxZOffset });
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t image_id;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
image_id = ((pathElement.GetSlopeDirection() + session->CurrentRotation) & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
2021-09-03 19:19:42 +02:00
|
|
|
+ pathPaintInfo.BridgeImageId + 51;
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
image_id = byte_98D8A4[edges] + pathPaintInfo.BridgeImageId + 49;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 22:01:57 +02:00
|
|
|
session, image_id | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
|
|
|
|
{ boundBoxOffset, height + boundingBoxZOffset });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-10-27 14:21:14 +02:00
|
|
|
if (!pathElement.IsQueue() && !(pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// don't draw
|
2018-06-22 23:03:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsChild(
|
2018-07-21 13:51:54 +02:00
|
|
|
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
|
|
|
|
boundBoxOffset.y, height + boundingBoxZOffset);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
sub_6A3F61(session, pathElement, edi, height, pathPaintInfo, imageFlags, sceneryImageFlags, hasSupports);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t ax = 0;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
ax = ((pathElement.GetSlopeDirection() + session->CurrentRotation) & 0x3) + 1;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
auto supportType = byte_98D8A4[edges] == 0 ? 0 : 1;
|
|
|
|
path_a_supports_paint_setup(session, supportType, ax, height, imageFlags, pathPaintInfo, nullptr);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
|
|
|
height += 32;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
height += 16;
|
|
|
|
}
|
|
|
|
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_general_support_height(session, height, 0x20);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsQueue() || (pathElement.GetEdgesAndCorners() != 0xFF && hasSupports))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.GetEdgesAndCorners() == 0xFF)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & 1)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_CC, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & 2)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_D4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & 4)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_D0, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & 8)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C8, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-04-30 22:09:53 +02:00
|
|
|
}
|
|
|
|
|
2018-01-16 23:53:27 +01:00
|
|
|
void path_paint_pole_support(
|
2021-09-03 19:19:42 +02:00
|
|
|
paint_session* session, const PathElement& pathElement, int16_t height, const FootpathPaintInfo& pathPaintInfo,
|
|
|
|
bool hasSupports, uint32_t imageFlags, uint32_t sceneryImageFlags)
|
2016-04-30 22:09:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Rol edges around rotation
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t edges = ((pathElement.GetEdges() << session->CurrentRotation) & 0xF)
|
|
|
|
| (((pathElement.GetEdges()) << session->CurrentRotation) >> 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-06-07 17:44:38 +02:00
|
|
|
CoordsXY boundBoxOffset = { stru_98D804[edges][0], stru_98D804[edges][1] };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-06-07 17:44:38 +02:00
|
|
|
CoordsXY boundBoxSize = { stru_98D804[edges][2], stru_98D804[edges][3] };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
uint8_t corners = (((pathElement.GetCorners()) << session->CurrentRotation) & 0xF)
|
|
|
|
| (((pathElement.GetCorners()) << session->CurrentRotation) >> 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t edi = edges | (corners << 4);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
uint32_t imageId = pathPaintInfo.SurfaceImageId;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
imageId += ((pathElement.GetSlopeDirection() + session->CurrentRotation) & 3) + 16;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
else
|
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
imageId += byte_98D6E0[edi];
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Below Surface
|
2018-06-22 23:03:53 +02:00
|
|
|
if (!session->DidPassSurface)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
boundBoxOffset.x = 3;
|
|
|
|
boundBoxOffset.y = 3;
|
|
|
|
boundBoxSize.x = 26;
|
|
|
|
boundBoxSize.y = 26;
|
|
|
|
}
|
|
|
|
|
2017-10-11 18:16:25 +02:00
|
|
|
// By default, add 1 to the z bounding box to always clip above the surface
|
2018-06-20 17:28:51 +02:00
|
|
|
uint8_t boundingBoxZOffset = 1;
|
2017-10-11 18:16:25 +02:00
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
// If we are on the same tile as a straight track, add the offset 2 so we
|
2017-10-11 18:16:25 +02:00
|
|
|
// can clip above gravel part of the track sprite
|
2021-09-24 20:05:50 +02:00
|
|
|
if (session->TrackElementOnSameHeight != nullptr)
|
2017-10-11 18:16:25 +02:00
|
|
|
{
|
2020-08-18 08:28:41 +02:00
|
|
|
if (session->TrackElementOnSameHeight->AsTrack()->GetTrackType() == TrackElemType::Flat)
|
2017-10-11 18:16:25 +02:00
|
|
|
{
|
|
|
|
boundingBoxZOffset = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 12:00:20 +01:00
|
|
|
if (!hasSupports || !session->DidPassSurface)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 20:45:25 +02:00
|
|
|
session, imageId | imageFlags, { 0, 0, height }, { boundBoxSize.x, boundBoxSize.y, 0 },
|
|
|
|
{ boundBoxOffset.x, boundBoxOffset.y, height + boundingBoxZOffset });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
else
|
|
|
|
{
|
2018-06-20 17:28:51 +02:00
|
|
|
uint32_t bridgeImage;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2021-08-11 23:26:46 +02:00
|
|
|
bridgeImage = ((pathElement.GetSlopeDirection() + session->CurrentRotation)
|
2018-06-22 23:03:53 +02:00
|
|
|
& FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)
|
2021-09-03 19:19:42 +02:00
|
|
|
+ pathPaintInfo.BridgeImageId + 16;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:03:53 +02:00
|
|
|
else
|
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
bridgeImage = edges + pathPaintInfo.BridgeImageId;
|
2017-06-06 23:24:18 +02:00
|
|
|
bridgeImage |= imageFlags;
|
|
|
|
}
|
|
|
|
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsParent(
|
2021-08-20 22:01:57 +02:00
|
|
|
session, bridgeImage | imageFlags, { 0, 0, height }, { boundBoxSize, 0 },
|
|
|
|
{ boundBoxOffset, height + boundingBoxZOffset });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-10-27 14:21:14 +02:00
|
|
|
if (pathElement.IsQueue() || (pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2020-10-22 19:18:30 +02:00
|
|
|
PaintAddImageAsChild(
|
2018-07-21 13:51:54 +02:00
|
|
|
session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x,
|
|
|
|
boundBoxOffset.y, height + boundingBoxZOffset);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-03 19:19:42 +02:00
|
|
|
sub_6A3F61(session, pathElement, edi, height, pathPaintInfo, imageFlags, sceneryImageFlags,
|
|
|
|
hasSupports); // TODO: arguments
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t ax = 0;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
ax = 8;
|
|
|
|
}
|
|
|
|
|
2018-07-07 14:40:56 +02:00
|
|
|
uint8_t supports[] = {
|
|
|
|
6,
|
|
|
|
8,
|
|
|
|
7,
|
|
|
|
5,
|
|
|
|
};
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
for (int8_t i = 3; i > -1; --i)
|
|
|
|
{
|
|
|
|
if (!(edges & (1 << i)))
|
|
|
|
{
|
2021-09-03 19:19:42 +02:00
|
|
|
const int32_t extraFlags = (pathPaintInfo.SupportColour != COLOUR_NULL && !pathElement.IsGhost())
|
|
|
|
? SPRITE_ID_PALETTE_COLOUR_1(pathPaintInfo.SupportColour)
|
|
|
|
: 0;
|
|
|
|
path_b_supports_paint_setup(session, supports[i], ax, height, imageFlags | extraFlags, pathPaintInfo);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
height += 32;
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsSloped())
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
height += 16;
|
|
|
|
}
|
|
|
|
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_general_support_height(session, height, 0x20);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.IsQueue() || (pathElement.GetEdgesAndCorners() != 0xFF && hasSupports))
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENTS_ALL, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-11 23:26:46 +02:00
|
|
|
if (pathElement.GetEdgesAndCorners() == 0xFF)
|
2018-06-22 23:03:53 +02:00
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C8 | SEGMENT_CC | SEGMENT_D0 | SEGMENT_D4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & EDGE_NE)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_CC, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & EDGE_SE)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_D4, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & EDGE_SW)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_D0, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:03:53 +02:00
|
|
|
if (edges & EDGE_NW)
|
|
|
|
{
|
2017-09-03 02:56:56 +02:00
|
|
|
paint_util_set_segment_support_height(session, SEGMENT_C8, 0xFFFF, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2016-06-15 23:31:13 +02:00
|
|
|
}
|