1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-20 22:33:02 +01:00

Refactor INPUT_FLAGS into FlagHolder

This commit is contained in:
Gymnasiast
2025-03-26 13:00:54 +01:00
parent 41dc87c68e
commit 2002f697e0
29 changed files with 81 additions and 105 deletions

View File

@@ -122,7 +122,7 @@ namespace OpenRCT2
GameHandleInputMouse(screenCoords, state);
}
if (_inputFlags & INPUT_FLAG_5)
if (gInputFlags.has(InputFlag::unk5))
{
GameHandleInputMouse(screenCoords, state);
}
@@ -392,11 +392,11 @@ namespace OpenRCT2
break;
}
if (!InputTestFlag(INPUT_FLAG_4))
if (!gInputFlags.has(InputFlag::unk4))
break;
if (w->classification != _dragWidget.window_classification || w->number != _dragWidget.window_number
|| !(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
|| !(gInputFlags.has(InputFlag::toolActive)))
{
break;
}
@@ -413,7 +413,7 @@ namespace OpenRCT2
_inputState = InputState::Reset;
if (_dragWidget.window_number == w->number)
{
if ((_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
if (gInputFlags.has(InputFlag::toolActive))
{
w = windowMgr->FindByNumber(
gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
@@ -422,7 +422,7 @@ namespace OpenRCT2
w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords);
}
}
else if (!(_inputFlags & INPUT_FLAG_4))
else if (!gInputFlags.has(InputFlag::unk4))
{
ViewportInteractionLeftClick(screenCoords);
}
@@ -552,7 +552,7 @@ namespace OpenRCT2
}
WindowUnfollowSprite(w);
// gInputFlags |= INPUT_FLAG_5;
// gInputFlags.set(InputFlag::unk5);
}
static void InputViewportDragContinue()
@@ -1084,12 +1084,12 @@ namespace OpenRCT2
gInputDragLast = screenCoords;
_dragWidget.window_classification = windowClass;
_dragWidget.window_number = windowNumber;
if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
if (gInputFlags.has(InputFlag::toolActive))
{
w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
if (w != nullptr)
{
InputSetFlag(INPUT_FLAG_4, true);
gInputFlags.set(InputFlag::unk4);
w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords);
}
}
@@ -1130,7 +1130,7 @@ namespace OpenRCT2
gPressedWidget.window_classification = windowClass;
gPressedWidget.window_number = windowNumber;
gPressedWidget.widget_index = widgetIndex;
_inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
gInputFlags.set(InputFlag::widgetPressed);
_inputState = InputState::WidgetPressed;
_clickRepeatTicks = gCurrentRealTimeTicks;
@@ -1163,7 +1163,7 @@ namespace OpenRCT2
switch (window->widgets[widgetId].type)
{
case WindowWidgetType::Viewport:
if (!(_inputFlags & INPUT_FLAG_TOOL_ACTIVE))
if (!gInputFlags.has(InputFlag::toolActive))
{
if (ViewportInteractionLeftOver(screenCoords))
{
@@ -1225,7 +1225,7 @@ namespace OpenRCT2
*/
void ProcessMouseTool(const ScreenCoordsXY& screenCoords)
{
if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
if (gInputFlags.has(InputFlag::toolActive))
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
@@ -1314,7 +1314,7 @@ namespace OpenRCT2
}
}
if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
if (gInputFlags.has(InputFlag::widgetPressed))
{
if (_inputState == InputState::DropdownActive)
{
@@ -1324,7 +1324,7 @@ namespace OpenRCT2
return;
}
_inputFlags |= INPUT_FLAG_WIDGET_PRESSED;
gInputFlags.set(InputFlag::widgetPressed);
windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, widgetIndex);
return;
case MouseState::LeftRelease:
@@ -1356,11 +1356,11 @@ namespace OpenRCT2
else
{
dropdown_index = -1;
if (_inputFlags & INPUT_FLAG_DROPDOWN_STAY_OPEN)
if (gInputFlags.has(InputFlag::dropdownStayOpen))
{
if (!(_inputFlags & INPUT_FLAG_DROPDOWN_MOUSE_UP))
if (!gInputFlags.has(InputFlag::dropdownMouseUp))
{
_inputFlags |= INPUT_FLAG_DROPDOWN_MOUSE_UP;
gInputFlags.set(InputFlag::dropdownMouseUp);
return;
}
}
@@ -1377,9 +1377,9 @@ namespace OpenRCT2
else
{
cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
if (gInputFlags.has(InputFlag::widgetPressed))
{
_inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
gInputFlags.unset(InputFlag::widgetPressed);
windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
}
@@ -1439,9 +1439,9 @@ namespace OpenRCT2
if (_inputState != InputState::DropdownActive)
{
// Hold down widget and drag outside of area??
if (_inputFlags & INPUT_FLAG_WIDGET_PRESSED)
if (gInputFlags.has(InputFlag::widgetPressed))
{
_inputFlags &= ~INPUT_FLAG_WIDGET_PRESSED;
gInputFlags.unset(InputFlag::widgetPressed);
windowMgr->InvalidateWidgetByNumber(cursor_w_class, cursor_w_number, cursor_widgetIndex);
}
return;
@@ -1681,12 +1681,12 @@ namespace OpenRCT2
}
mainWindow->savedViewPos.x += dx;
_inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
gInputFlags.set(InputFlag::viewportScrolling);
}
if (scrollScreenCoords.y != 0)
{
mainWindow->savedViewPos.y += dy;
_inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING;
gInputFlags.set(InputFlag::viewportScrolling);
}
}
} // namespace OpenRCT2

View File

@@ -773,7 +773,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
{
windowMgr->Close(*window);
}
else if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
else if (gInputFlags.has(InputFlag::toolActive))
{
ToolCancel();
}

View File

@@ -465,7 +465,7 @@ namespace OpenRCT2::Ui
break;
}
if (!(InputTestFlag(INPUT_FLAG_6)) || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)))
if (!gInputFlags.has(InputFlag::unk6) || !gInputFlags.has(InputFlag::toolActive))
{
auto* windowMgr = GetWindowManager();
if (windowMgr->FindByClass(WindowClass::RideConstruction) == nullptr

View File

@@ -900,7 +900,7 @@ namespace OpenRCT2::Ui
if (InputGetState() == InputState::WidgetPressed || InputGetState() == InputState::DropdownActive)
{
if (!(InputTestFlag(INPUT_FLAG_WIDGET_PRESSED)))
if (!gInputFlags.has(InputFlag::widgetPressed))
return false;
if (gPressedWidget.window_classification != w.classification)
return false;

View File

@@ -273,7 +273,7 @@ namespace OpenRCT2
return;
// Check window cursor is over
if (!(InputTestFlag(INPUT_FLAG_5)))
if (!gInputFlags.has(InputFlag::unk5))
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindFromPoint(cursorState->position);

View File

@@ -153,7 +153,7 @@ namespace OpenRCT2::Scripting
std::shared_ptr<ScTool> tool_get() const
{
if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
if (gInputFlags.has(InputFlag::toolActive))
{
return std::make_shared<ScTool>(_scriptEngine.GetContext());
}

View File

@@ -401,7 +401,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::ClearScenery);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::bulldozer);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
}
}
} // namespace OpenRCT2::Ui::Windows

View File

@@ -357,9 +357,9 @@ namespace OpenRCT2::Ui::Windows
const ScreenCoordsXY& screenPos, int32_t extray, ColourWithFlags colour, uint8_t customItemHeight, uint8_t flags,
size_t num_items, int32_t width, size_t prefRowsPerColumn)
{
InputSetFlag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
gInputFlags.unset(InputFlag::dropdownStayOpen, InputFlag::dropdownMouseUp);
if (flags & Dropdown::Flag::StayOpen || Config::Get().interface.TouchEnhancements)
InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
gInputFlags.set(InputFlag::dropdownStayOpen);
WindowDropdownClose();
@@ -392,9 +392,9 @@ namespace OpenRCT2::Ui::Windows
int32_t x, int32_t y, int32_t extray, ColourWithFlags colour, uint8_t flags, int32_t numItems, int32_t itemWidth,
int32_t itemHeight, int32_t numColumns)
{
InputSetFlag(static_cast<INPUT_FLAGS>(INPUT_FLAG_DROPDOWN_STAY_OPEN | INPUT_FLAG_DROPDOWN_MOUSE_UP), false);
gInputFlags.unset(InputFlag::dropdownStayOpen, InputFlag::dropdownMouseUp);
if (flags & Dropdown::Flag::StayOpen || Config::Get().interface.TouchEnhancements)
InputSetFlag(INPUT_FLAG_DROPDOWN_STAY_OPEN, true);
gInputFlags.set(InputFlag::dropdownStayOpen);
// Close existing dropdown
WindowDropdownClose();

View File

@@ -253,7 +253,7 @@ namespace OpenRCT2::Ui::Windows
pressed_widgets |= 1LL << WIDX_TAB;
ToolSet(*this, WIDX_LIST, Tool::entranceDown);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
}
void OnMouseUp(WidgetIndex widgetIndex) override

View File

@@ -222,7 +222,7 @@ namespace OpenRCT2::Ui::Windows
ToolCancel();
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
@@ -333,7 +333,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;
@@ -350,7 +350,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL;
ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::crosshair);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;

View File

@@ -890,7 +890,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::Land);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::digDown);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
}
}
} // namespace OpenRCT2::Ui::Windows

View File

@@ -108,7 +108,7 @@ namespace OpenRCT2::Ui::Windows
_landRightsMode = mode;
ToolSet(*this, widgetIndex, Tool::upArrow);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
if (kLandRightsVisibleByMode[EnumValue(mode)])
ShowLandRights();

View File

@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
// Check for cursor movement
_cursorHoldDuration++;
if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (InputTestFlag(INPUT_FLAG_5))
if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (gInputFlags.has(InputFlag::unk5))
|| InputGetState() == InputState::ViewportRight)
_cursorHoldDuration = 0;

View File

@@ -316,7 +316,7 @@ namespace OpenRCT2::Ui::Windows
: ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceRideIndex = rideId;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
RideConstructionInvalidateCurrentTrack();

View File

@@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows
if (!ToolSet(*this, 0, Tool::walkDown))
{
ShowGridlines();
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
SetPatrolAreaToRender(_staffId);
GfxInvalidateScreen();
}

View File

@@ -2444,7 +2444,7 @@ namespace OpenRCT2::Ui::Windows
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
RideConstructionInvalidateCurrentTrack();
if (_rideConstructionState != RideConstructionState::EntranceExit)
{
@@ -2470,7 +2470,7 @@ namespace OpenRCT2::Ui::Windows
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
RideConstructionInvalidateCurrentTrack();
if (_rideConstructionState != RideConstructionState::EntranceExit)
{
@@ -3671,7 +3671,7 @@ namespace OpenRCT2::Ui::Windows
if (w != nullptr)
{
ToolSet(*w, WIDX_CONSTRUCT, Tool::crosshair);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
_trackPlaceCtrlState = false;
_trackPlaceShiftState = false;
}

View File

@@ -3300,7 +3300,7 @@ namespace OpenRCT2::Ui::Windows
{
auto* toolWindow = ContextOpenWindow(WindowClass::Scenery);
ToolSet(*toolWindow, WIDX_SCENERY_BACKGROUND, Tool::arrow);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
}
}
} // namespace OpenRCT2::Ui::Windows

View File

@@ -150,7 +150,7 @@ namespace OpenRCT2::Ui::Windows
gTooltipCloseTimeout = 0;
gTooltipWidget.window_classification = WindowClass::Null;
InputSetState(InputState::Normal);
InputSetFlag(INPUT_FLAG_4, false);
gInputFlags.unset(InputFlag::unk4);
}
void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords)

View File

@@ -104,7 +104,7 @@ namespace OpenRCT2::Ui::Windows
SetWidgets(_trackPlaceWidgets);
WindowInitScrollWidgets(*this);
ToolSet(*this, WIDX_PRICE, Tool::crosshair);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
WindowPushOthersRight(*this);
ShowGridlines();
_miniPreview.resize(TRACK_MINI_PREVIEW_SIZE);

View File

@@ -447,7 +447,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::Water);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::waterDown);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
}
}
} // namespace OpenRCT2::Ui::Windows

View File

@@ -677,9 +677,9 @@ void GameLoadOrQuitNoSavePrompt()
auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::CloseSavePrompt);
GameActions::Execute(&loadOrQuitAction);
ToolCancel();
if (InputTestFlag(INPUT_FLAG_5))
if (gInputFlags.has(InputFlag::unk5))
{
InputSetFlag(INPUT_FLAG_5, false);
gInputFlags.unset(InputFlag::unk5);
}
GameResetSpeed();
gFirstTimeSaving = true;

View File

@@ -190,9 +190,9 @@ namespace OpenRCT2
{
if (InputGetState() == InputState::Reset || InputGetState() == InputState::Normal)
{
if (InputTestFlag(INPUT_FLAG_VIEWPORT_SCROLLING))
if (gInputFlags.has(InputFlag::viewportScrolling))
{
InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false);
gInputFlags.unset(InputFlag::viewportScrolling);
break;
}
}
@@ -211,7 +211,7 @@ namespace OpenRCT2
if (!gOpenRCT2Headless)
{
InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false);
gInputFlags.unset(InputFlag::viewportScrolling);
}
// Always perform autosave check, even when paused

View File

@@ -15,7 +15,7 @@
namespace OpenRCT2
{
InputState _inputState;
uint8_t _inputFlags;
InputFlags gInputFlags;
WidgetRef gHoverWidget;
WidgetRef gPressedWidget;
@@ -40,28 +40,6 @@ namespace OpenRCT2
ContextInputHandleKeyboard(false);
}
void InputSetFlag(INPUT_FLAGS flag, bool on)
{
if (on)
{
_inputFlags |= flag;
}
else
{
_inputFlags &= ~flag;
}
}
bool InputTestFlag(INPUT_FLAGS flag)
{
return _inputFlags & flag;
}
void InputResetFlags()
{
_inputFlags = 0;
}
void InputSetState(InputState state)
{
_inputState = state;

View File

@@ -9,34 +9,36 @@
#pragma once
#include "core/FlagHolder.hpp"
#include "interface/Window.h"
namespace OpenRCT2
{
enum INPUT_FLAGS
enum InputFlag
{
INPUT_FLAG_WIDGET_PRESSED = (1 << 0),
widgetPressed,
// The dropdown can stay open if the mouse is released, set on flag Dropdown::Flag::StayOpen
INPUT_FLAG_DROPDOWN_STAY_OPEN = (1 << 1),
// The dropdown can stay open if the mouse is released, set on flag Dropdown::Flag::StayOpen.
dropdownStayOpen,
// The mouse has been released and the dropdown is still open
// INPUT_FLAG_DROPDOWN_STAY_OPEN is already set if this happens
INPUT_FLAG_DROPDOWN_MOUSE_UP = (1 << 2),
// The mouse has been released and the dropdown is still open.
// InputFlag::dropdownStayOpen is already set if this happens.
dropdownMouseUp,
INPUT_FLAG_TOOL_ACTIVE = (1 << 3),
toolActive,
// Left click on a viewport
INPUT_FLAG_4 = (1 << 4),
unk4,
INPUT_FLAG_5 = (1 << 5),
unk5,
// Some of the map tools (clear, footpath, scenery)
// never read as far as I know.
INPUT_FLAG_6 = (1 << 6),
unk6,
INPUT_FLAG_VIEWPORT_SCROLLING = (1 << 7)
viewportScrolling,
};
using InputFlags = FlagHolder<uint8_t, InputFlag>;
enum class InputState
{
@@ -61,16 +63,12 @@ namespace OpenRCT2
// TODO: Move to openrct2-ui and make static again
extern InputState _inputState;
extern uint8_t _inputFlags;
extern InputFlags gInputFlags;
extern uint32_t _tooltipNotShownTimeout;
void TitleHandleKeyboardInput();
void GameHandleKeyboardInput();
void InputSetFlag(INPUT_FLAGS flag, bool on);
bool InputTestFlag(INPUT_FLAGS flag);
void InputResetFlags();
void InputSetState(InputState state);
InputState InputGetState();

View File

@@ -147,7 +147,7 @@ GameActions::Result PeepPickupAction::Execute() const
if (_owner == NetworkGetCurrentPlayerId())
{
// prevent tool_cancel()
InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, false);
gInputFlags.unset(InputFlag::toolActive);
}
}

View File

@@ -102,7 +102,7 @@ namespace OpenRCT2
WindowInitAll();
// ?
InputResetFlags();
gInputFlags.clearAll();
InputSetState(InputState::Reset);
gPressedWidget.window_classification = WindowClass::Null;
gPickupPeepImage = ImageId();

View File

@@ -629,7 +629,7 @@ static constexpr float kWindowScrollLocations[][2] = {
bool isToolActive(WindowClass cls)
{
return InputTestFlag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == cls;
return gInputFlags.has(InputFlag::toolActive) && gCurrentToolWidget.window_classification == cls;
}
bool isToolActive(WindowClass cls, rct_windownumber number)
@@ -662,7 +662,7 @@ static constexpr float kWindowScrollLocations[][2] = {
*/
bool ToolSet(const WindowBase& w, WidgetIndex widgetIndex, Tool tool)
{
if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
if (gInputFlags.has(InputFlag::toolActive))
{
if (w.classification == gCurrentToolWidget.window_classification && w.number == gCurrentToolWidget.window_number
&& widgetIndex == gCurrentToolWidget.widget_index)
@@ -674,9 +674,9 @@ static constexpr float kWindowScrollLocations[][2] = {
ToolCancel();
}
InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, true);
InputSetFlag(INPUT_FLAG_4, false);
InputSetFlag(INPUT_FLAG_6, false);
gInputFlags.set(InputFlag::toolActive);
gInputFlags.unset(InputFlag::unk4);
gInputFlags.unset(InputFlag::unk6);
gCurrentToolId = tool;
gCurrentToolWidget.window_classification = w.classification;
gCurrentToolWidget.window_number = w.number;
@@ -690,9 +690,9 @@ static constexpr float kWindowScrollLocations[][2] = {
*/
void ToolCancel()
{
if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
if (gInputFlags.has(InputFlag::toolActive))
{
InputSetFlag(INPUT_FLAG_TOOL_ACTIVE, false);
gInputFlags.unset(InputFlag::toolActive);
MapInvalidateSelectionRect();
MapInvalidateMapSelectionTiles();

View File

@@ -883,7 +883,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement)
gRideEntranceExitPlaceType = entranceType;
gRideEntranceExitPlaceRideIndex = rideIndex;
gRideEntranceExitPlaceStationIndex = stationIndex;
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
if (_rideConstructionState != RideConstructionState::EntranceExit)
{
gRideEntranceExitPlacePreviousRideConstructionState = _rideConstructionState;
@@ -1073,7 +1073,7 @@ int32_t RideInitialiseConstructionWindow(Ride& ride)
w = ride_create_or_find_construction_window(ride.id);
ToolSet(*w, WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT, Tool::crosshair);
InputSetFlag(INPUT_FLAG_6, true);
gInputFlags.set(InputFlag::unk6);
_currentlySelectedTrack = ride.getRideTypeDescriptor().StartTrackPiece;
_currentTrackPitchEnd = TrackPitch::None;

View File

@@ -158,7 +158,7 @@ void TitleScene::Tick()
// update_weather_animation();
}
InputSetFlag(INPUT_FLAG_VIEWPORT_SCROLLING, false);
gInputFlags.unset(InputFlag::viewportScrolling);
ContextHandleInput();