1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 16:24:35 +01:00

Fix #7443: Construction arrows pulse at irregular intervals.

This commit is contained in:
Simon Jarrett
2020-10-03 18:41:56 +01:00
committed by Simon Jarrett
parent 26720eb345
commit 25ce8b3f6e
6 changed files with 36 additions and 44 deletions

View File

@@ -19,6 +19,7 @@
#include <openrct2/audio/audio.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/object/ObjectLimits.h>
#include <openrct2/platform/platform.h>
#include <openrct2/sprites.h>
#include <openrct2/world/Footpath.h>
#include <openrct2/world/Park.h>
@@ -27,6 +28,7 @@
static constexpr const rct_string_id WINDOW_TITLE = STR_FOOTPATHS;
static constexpr const int32_t WH = 381;
static constexpr const int32_t WW = 106;
static constexpr const uint16_t ARROW_PULSE_DURATION = 200;
// clang-format off
enum
@@ -129,7 +131,7 @@ static rct_window_event_list window_footpath_events([](auto& events)
// clang-format on
static money32 _window_footpath_cost;
static int8_t _window_footpath_provisional_path_arrow_timer;
static uint32_t _footpathConstructionNextArrowPulse = 0;
static uint8_t _lastUpdatedCameraRotation = UINT8_MAX;
static bool _footpathErrorOccured;
@@ -473,10 +475,13 @@ static void window_footpath_update_provisional_path_for_bridge_mode(rct_window*
widget_invalidate(w, WIDX_CONSTRUCT);
}
auto curTime = platform_get_ticks();
// Update little directional arrow on provisional bridge mode path
if (--_window_footpath_provisional_path_arrow_timer < 0)
if (_footpathConstructionNextArrowPulse < curTime)
{
_window_footpath_provisional_path_arrow_timer = 5;
_footpathConstructionNextArrowPulse = curTime + ARROW_PULSE_DURATION;
gFootpathProvisionalFlags ^= PROVISIONAL_PATH_FLAG_SHOW_ARROW;
CoordsXYZ footpathLoc;
footpath_get_next_path_info(&type, footpathLoc, &slope);
@@ -932,7 +937,6 @@ static void window_footpath_start_bridge_at_point(const ScreenCoordsXY& screenCo
gFootpathConstructFromPosition = { mapCoords, z };
gFootpathConstructDirection = direction;
gFootpathProvisionalFlags = 0;
_window_footpath_provisional_path_arrow_timer = 0;
gFootpathConstructSlope = 0;
gFootpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL;
gFootpathConstructValidDirections = INVALID_DIRECTION;