Further coding style enforcement (#972)
* Further coding style enforcement * Reduce the reptitiveness of some names
This commit is contained in:
parent
cacb426f6f
commit
8607b871b8
|
@ -228,10 +228,10 @@ namespace OpenLoco::Game
|
|||
Audio::pauseSound();
|
||||
Audio::unpauseSound();
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
Input::sub_407231();
|
||||
Input::resetFlag(Input::input_flags::flag5);
|
||||
Input::resetFlag(Input::Flags::flag5);
|
||||
}
|
||||
|
||||
Title::start();
|
||||
|
@ -263,10 +263,10 @@ namespace OpenLoco::Game
|
|||
Audio::pauseSound();
|
||||
Audio::unpauseSound();
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
Input::sub_407231();
|
||||
Input::resetFlag(Input::input_flags::flag5);
|
||||
Input::resetFlag(Input::Flags::flag5);
|
||||
}
|
||||
|
||||
Title::start();
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace OpenLoco::GameCommands
|
|||
{
|
||||
// 0x0043C369
|
||||
// NB: tutorial recording has been omitted.
|
||||
if (Tutorial::state() == Tutorial::tutorial_state::playing)
|
||||
if (Tutorial::state() == Tutorial::State::playing)
|
||||
{
|
||||
Tutorial::stop();
|
||||
}
|
||||
|
|
|
@ -1125,7 +1125,7 @@ namespace OpenLoco::Gfx
|
|||
engine->drawDirtyBlocks();
|
||||
}
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
call(0x004072EC); // NOP on _NO_LOCO_WIN32_
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace OpenLoco::Gui
|
|||
Windows::PlayerInfoPanel::open();
|
||||
Windows::TimePanel::open();
|
||||
|
||||
if (OpenLoco::Tutorial::state() != Tutorial::tutorial_state::none)
|
||||
if (OpenLoco::Tutorial::state() != Tutorial::State::none)
|
||||
{
|
||||
Windows::Tutorial::open();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace OpenLoco::Gui
|
|||
window = WindowManager::find(WindowType::tutorial);
|
||||
if (window)
|
||||
{
|
||||
if (Tutorial::state() == Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() == Tutorial::State::none)
|
||||
{
|
||||
WindowManager::close(window);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace OpenLoco::Interop;
|
|||
namespace OpenLoco::Input
|
||||
{
|
||||
loco_global<uint32_t, 0x00523368> _flags;
|
||||
static loco_global<uint8_t, 0x0052336D> _state;
|
||||
static loco_global<State, 0x0052336D> _state;
|
||||
static int32_t _cursor_drag_start_x;
|
||||
static int32_t _cursor_drag_start_y;
|
||||
loco_global<uint32_t, 0x00525374> _cursor_drag_state;
|
||||
|
@ -21,32 +21,32 @@ namespace OpenLoco::Input
|
|||
void init()
|
||||
{
|
||||
_flags = 0;
|
||||
_state = 0;
|
||||
_state = State::reset;
|
||||
}
|
||||
|
||||
bool hasFlag(input_flags value)
|
||||
bool hasFlag(uint32_t value)
|
||||
{
|
||||
return (_flags & (uint32_t)value) != 0;
|
||||
return (_flags & value) != 0;
|
||||
}
|
||||
|
||||
void setFlag(input_flags value)
|
||||
void setFlag(uint32_t value)
|
||||
{
|
||||
_flags |= (uint32_t)value;
|
||||
_flags |= value;
|
||||
}
|
||||
|
||||
void resetFlag(input_flags value)
|
||||
void resetFlag(uint32_t value)
|
||||
{
|
||||
_flags &= ~(uint32_t)value;
|
||||
_flags &= ~value;
|
||||
}
|
||||
|
||||
input_state state()
|
||||
State state()
|
||||
{
|
||||
return (input_state)*_state;
|
||||
return *_state;
|
||||
}
|
||||
|
||||
void state(input_state state)
|
||||
void state(State state)
|
||||
{
|
||||
_state = (uint8_t)state;
|
||||
_state = state;
|
||||
}
|
||||
|
||||
// 0x00406FEC
|
||||
|
|
|
@ -5,45 +5,45 @@
|
|||
|
||||
namespace OpenLoco::Input
|
||||
{
|
||||
enum class mouse_button : uint16_t
|
||||
enum class MouseButton : uint16_t
|
||||
{
|
||||
released = 0,
|
||||
left_pressed = 1,
|
||||
left_released = 2,
|
||||
right_pressed = 3,
|
||||
right_released = 4,
|
||||
leftPressed = 1,
|
||||
leftReleased = 2,
|
||||
rightPressed = 3,
|
||||
rightReleased = 4,
|
||||
};
|
||||
|
||||
enum class input_state
|
||||
enum class State : uint8_t
|
||||
{
|
||||
reset, // 0
|
||||
normal, // 1
|
||||
widget_pressed, // 2
|
||||
positioning_window, // 3
|
||||
viewport_right, // 4
|
||||
dropdown_active, // 5
|
||||
viewport_left, // 6
|
||||
scroll_left, // 7
|
||||
resizing, // 8
|
||||
scroll_right, // 9
|
||||
reset, // 0
|
||||
normal, // 1
|
||||
widgetPressed, // 2
|
||||
positioningWindow, // 3
|
||||
viewportRight, // 4
|
||||
dropdownActive, // 5
|
||||
viewportLeft, // 6
|
||||
scrollLeft, // 7
|
||||
resizing, // 8
|
||||
scrollRight, // 9
|
||||
};
|
||||
|
||||
enum class input_flags
|
||||
namespace Flags
|
||||
{
|
||||
widget_pressed = 1 << 0,
|
||||
flag1 = 1 << 1,
|
||||
flag2 = 1 << 2,
|
||||
tool_active = 1 << 3,
|
||||
flag4 = 1 << 4,
|
||||
flag5 = 1 << 5,
|
||||
flag6 = 1 << 6,
|
||||
viewport_scrolling = 1 << 7,
|
||||
};
|
||||
constexpr uint32_t widgetPressed = 1 << 0;
|
||||
constexpr uint32_t flag1 = 1 << 1;
|
||||
constexpr uint32_t flag2 = 1 << 2;
|
||||
constexpr uint32_t toolActive = 1 << 3;
|
||||
constexpr uint32_t flag4 = 1 << 4;
|
||||
constexpr uint32_t flag5 = 1 << 5;
|
||||
constexpr uint32_t flag6 = 1 << 6;
|
||||
constexpr uint32_t viewportScrolling = 1 << 7;
|
||||
}
|
||||
|
||||
namespace MapSelectionFlags
|
||||
{
|
||||
constexpr uint8_t unk_04 = 1 << 4; // Vehicle orders?
|
||||
constexpr uint8_t catchment_area = 1 << 5;
|
||||
constexpr uint8_t catchmentArea = 1 << 5;
|
||||
constexpr uint8_t unk_6 = 1 << 6;
|
||||
};
|
||||
|
||||
|
@ -57,11 +57,11 @@ namespace OpenLoco::Input
|
|||
|
||||
void init();
|
||||
void initMouse();
|
||||
bool hasFlag(input_flags value);
|
||||
void setFlag(input_flags value);
|
||||
void resetFlag(input_flags value);
|
||||
input_state state();
|
||||
void state(input_state);
|
||||
bool hasFlag(uint32_t value);
|
||||
void setFlag(uint32_t value);
|
||||
void resetFlag(uint32_t value);
|
||||
State state();
|
||||
void state(State);
|
||||
|
||||
Gfx::point_t getMouseLocation();
|
||||
Gfx::point_t getMouseLocation2();
|
||||
|
@ -98,8 +98,8 @@ namespace OpenLoco::Input
|
|||
void resetMapSelectionFlag(uint8_t flags);
|
||||
|
||||
void handleKeyboard();
|
||||
void handleMouse(int16_t x, int16_t y, mouse_button button);
|
||||
mouse_button getLastKnownButtonState();
|
||||
void handleMouse(int16_t x, int16_t y, MouseButton button);
|
||||
MouseButton getLastKnownButtonState();
|
||||
void enqueueMouseButton(int32_t button);
|
||||
void moveMouse(int32_t x, int32_t y, int32_t relX, int32_t relY);
|
||||
void sub_407218();
|
||||
|
|
|
@ -119,10 +119,10 @@ namespace OpenLoco::Input
|
|||
{
|
||||
switch (Tutorial::state())
|
||||
{
|
||||
case Tutorial::tutorial_state::none:
|
||||
case Tutorial::State::none:
|
||||
break;
|
||||
|
||||
case Tutorial::tutorial_state::playing:
|
||||
case Tutorial::State::playing:
|
||||
{
|
||||
const uint16_t next = Tutorial::nextInput();
|
||||
_keyModifier = next;
|
||||
|
@ -139,7 +139,7 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case Tutorial::tutorial_state::recording:
|
||||
case Tutorial::State::recording:
|
||||
{
|
||||
call(0x004BF005);
|
||||
break;
|
||||
|
@ -352,7 +352,7 @@ namespace OpenLoco::Input
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Tutorial::state() == Tutorial::tutorial_state::playing)
|
||||
if (Tutorial::state() == Tutorial::State::playing)
|
||||
{
|
||||
Tutorial::stop();
|
||||
continue;
|
||||
|
@ -368,15 +368,15 @@ namespace OpenLoco::Input
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Intro::state() == (Intro::intro_state)9)
|
||||
if (Intro::state() == (Intro::State)9)
|
||||
{
|
||||
Intro::state(Intro::intro_state::end);
|
||||
Intro::state(Intro::State::end);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Intro::state() != Intro::intro_state::none)
|
||||
if (Intro::state() != Intro::State::none)
|
||||
{
|
||||
Intro::state((Intro::intro_state)8);
|
||||
Intro::state((Intro::State)8);
|
||||
}
|
||||
|
||||
if (tryShortcut(Shortcut::sendMessage, nextKey->keyCode, _keyModifier))
|
||||
|
@ -389,13 +389,13 @@ namespace OpenLoco::Input
|
|||
|
||||
static void edgeScroll()
|
||||
{
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() != Tutorial::State::none)
|
||||
return;
|
||||
|
||||
if (Config::get().edge_scrolling == 0)
|
||||
return;
|
||||
|
||||
if (Input::state() != input_state::normal && Input::state() != input_state::dropdown_active)
|
||||
if (Input::state() != State::normal && Input::state() != State::dropdownActive)
|
||||
return;
|
||||
|
||||
if (hasKeyModifier(KeyModifier::shift) || hasKeyModifier(KeyModifier::control))
|
||||
|
@ -434,12 +434,12 @@ namespace OpenLoco::Input
|
|||
delta.y *= 1 << viewport->zoom;
|
||||
main->viewport_configurations[0].saved_view_x += delta.x;
|
||||
main->viewport_configurations[0].saved_view_y += delta.y;
|
||||
Input::setFlag(input_flags::viewport_scrolling);
|
||||
Input::setFlag(Flags::viewportScrolling);
|
||||
}
|
||||
|
||||
static void keyScroll()
|
||||
{
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() != Tutorial::State::none)
|
||||
return;
|
||||
|
||||
if (*_modalWindowType != WindowType::undefined)
|
||||
|
@ -480,7 +480,7 @@ namespace OpenLoco::Input
|
|||
delta.y *= 1 << viewport->zoom;
|
||||
main->viewport_configurations[0].saved_view_x += delta.x;
|
||||
main->viewport_configurations[0].saved_view_y += delta.y;
|
||||
Input::setFlag(input_flags::viewport_scrolling);
|
||||
Input::setFlag(Flags::viewportScrolling);
|
||||
}
|
||||
|
||||
// 0x004BE92A
|
||||
|
|
|
@ -24,15 +24,15 @@ using namespace OpenLoco::Ui::ViewportInteraction;
|
|||
|
||||
namespace OpenLoco::Input
|
||||
{
|
||||
static void stateScrollLeft(mouse_button cx, widget_index edx, Ui::window* window, Ui::widget_t* widget, int16_t x, int16_t y);
|
||||
static void stateScrollRight(const mouse_button button, const int16_t x, const int16_t y);
|
||||
static void stateResizing(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateWidgetPressed(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateNormal(mouse_button state, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateScrollLeft(MouseButton cx, widget_index edx, Ui::window* window, Ui::widget_t* widget, int16_t x, int16_t y);
|
||||
static void stateScrollRight(const MouseButton button, const int16_t x, const int16_t y);
|
||||
static void stateResizing(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateWidgetPressed(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateNormal(MouseButton state, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateNormalHover(int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateNormalLeft(int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void stateNormalRight(int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void statePositioningWindow(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void statePositioningWindow(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex);
|
||||
static void windowPositionEnd();
|
||||
|
||||
static void windowResizeBegin(int16_t x, int16_t y, Ui::window* window, Ui::widget_index widget_index);
|
||||
|
@ -45,7 +45,7 @@ namespace OpenLoco::Input
|
|||
|
||||
#pragma mark - Input
|
||||
|
||||
static loco_global<mouse_button, 0x001136FA0> _lastKnownButtonState;
|
||||
static loco_global<MouseButton, 0x001136FA0> _lastKnownButtonState;
|
||||
|
||||
static loco_global<string_id, 0x0050A018> _mapTooltipFormatArguments;
|
||||
|
||||
|
@ -170,13 +170,13 @@ namespace OpenLoco::Input
|
|||
|
||||
bool isDropdownActive(Ui::WindowType type, Ui::widget_index index)
|
||||
{
|
||||
if (state() != input_state::dropdown_active)
|
||||
if (state() != State::dropdownActive)
|
||||
return false;
|
||||
|
||||
if (*_pressedWindowType != type)
|
||||
return false;
|
||||
|
||||
if (!hasFlag(input_flags::widget_pressed))
|
||||
if (!hasFlag(Flags::widgetPressed))
|
||||
return false;
|
||||
|
||||
return _pressedWidgetIndex == index;
|
||||
|
@ -184,7 +184,7 @@ namespace OpenLoco::Input
|
|||
|
||||
bool isPressed(Ui::WindowType type, Ui::window_number number)
|
||||
{
|
||||
if (state() != input_state::widget_pressed)
|
||||
if (state() != State::widgetPressed)
|
||||
return false;
|
||||
|
||||
if (*_pressedWindowType != type)
|
||||
|
@ -193,7 +193,7 @@ namespace OpenLoco::Input
|
|||
if (_pressedWindowNumber != number)
|
||||
return false;
|
||||
|
||||
if (!hasFlag(input_flags::widget_pressed))
|
||||
if (!hasFlag(Flags::widgetPressed))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -219,14 +219,14 @@ namespace OpenLoco::Input
|
|||
{
|
||||
switch (Tutorial::state())
|
||||
{
|
||||
case Tutorial::tutorial_state::none:
|
||||
case Tutorial::State::none:
|
||||
{
|
||||
_cursorX2 = _cursorX;
|
||||
_cursorY2 = _cursorY;
|
||||
break;
|
||||
}
|
||||
|
||||
case Tutorial::tutorial_state::playing:
|
||||
case Tutorial::State::playing:
|
||||
{
|
||||
_cursorX2 = Tutorial::nextInput();
|
||||
_cursorY2 = Tutorial::nextInput();
|
||||
|
@ -234,7 +234,7 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case Tutorial::tutorial_state::recording:
|
||||
case Tutorial::State::recording:
|
||||
{
|
||||
call(0x004C6EC3);
|
||||
break;
|
||||
|
@ -244,7 +244,7 @@ namespace OpenLoco::Input
|
|||
|
||||
window* toolGetActiveWindow()
|
||||
{
|
||||
if (!hasFlag(input_flags::tool_active))
|
||||
if (!hasFlag(Flags::toolActive))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ namespace OpenLoco::Input
|
|||
|
||||
bool isToolActive(Ui::WindowType type)
|
||||
{
|
||||
if (!hasFlag(input_flags::tool_active))
|
||||
if (!hasFlag(Flags::toolActive))
|
||||
return false;
|
||||
|
||||
return (*_toolWindowType == type);
|
||||
|
@ -287,7 +287,7 @@ namespace OpenLoco::Input
|
|||
// TODO: Maybe create a an enum similar to TOOL_IDX in OpenRCT2 for tool (instead of uint8_t)
|
||||
bool toolSet(Ui::window* w, int16_t widgetIndex, uint8_t tool)
|
||||
{
|
||||
if (Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (Input::hasFlag(Input::Flags::toolActive))
|
||||
{
|
||||
if (w->type == *_toolWindowType && w->number == _toolWindowNumber
|
||||
&& widgetIndex == _toolWidgetIndex)
|
||||
|
@ -301,8 +301,8 @@ namespace OpenLoco::Input
|
|||
}
|
||||
}
|
||||
|
||||
Input::setFlag(Input::input_flags::tool_active);
|
||||
Input::resetFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::toolActive);
|
||||
Input::resetFlag(Input::Flags::flag6);
|
||||
_currentTool = tool;
|
||||
_toolWindowType = w->type;
|
||||
_toolWindowNumber = w->number;
|
||||
|
@ -313,9 +313,9 @@ namespace OpenLoco::Input
|
|||
// 0x004CE3D6
|
||||
void toolCancel()
|
||||
{
|
||||
if (Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (Input::hasFlag(Input::Flags::toolActive))
|
||||
{
|
||||
Input::resetFlag(Input::input_flags::tool_active);
|
||||
Input::resetFlag(Input::Flags::toolActive);
|
||||
|
||||
Map::TileManager::mapInvalidateSelectionRect();
|
||||
Map::TileManager::mapInvalidateMapSelectionTiles();
|
||||
|
@ -365,11 +365,11 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
#pragma mark - Mouse input
|
||||
static void stateViewportLeft(const mouse_button cx, const int16_t x, const int16_t y);
|
||||
static void stateViewportRight(const mouse_button cx, const int16_t x, const int16_t y);
|
||||
static void stateViewportLeft(const MouseButton cx, const int16_t x, const int16_t y);
|
||||
static void stateViewportRight(const MouseButton cx, const int16_t x, const int16_t y);
|
||||
|
||||
// 0x004C7174
|
||||
void handleMouse(int16_t x, int16_t y, mouse_button button)
|
||||
void handleMouse(int16_t x, int16_t y, MouseButton button)
|
||||
{
|
||||
_lastKnownButtonState = button;
|
||||
|
||||
|
@ -387,14 +387,14 @@ namespace OpenLoco::Input
|
|||
{
|
||||
if (window->type != *_modalWindowType)
|
||||
{
|
||||
if (button == mouse_button::left_pressed)
|
||||
if (button == MouseButton::leftPressed)
|
||||
{
|
||||
WindowManager::bringToFront(_modalWindowType);
|
||||
Audio::playSound(Audio::SoundId::error, x);
|
||||
return;
|
||||
}
|
||||
|
||||
if (button == mouse_button::right_pressed)
|
||||
if (button == MouseButton::rightPressed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -418,64 +418,64 @@ namespace OpenLoco::Input
|
|||
regs.bx = y;
|
||||
switch (state())
|
||||
{
|
||||
case input_state::reset:
|
||||
case State::reset:
|
||||
_tooltipCursorX = x;
|
||||
_tooltipCursorY = y;
|
||||
_tooltipTimeout = 0;
|
||||
_tooltipWindowType = Ui::WindowType::undefined;
|
||||
state(input_state::normal);
|
||||
resetFlag(input_flags::flag4);
|
||||
state(State::normal);
|
||||
resetFlag(Flags::flag4);
|
||||
stateNormal(button, x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
case input_state::normal:
|
||||
case State::normal:
|
||||
stateNormal(button, x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
case input_state::widget_pressed:
|
||||
case input_state::dropdown_active:
|
||||
case State::widgetPressed:
|
||||
case State::dropdownActive:
|
||||
stateWidgetPressed(button, x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
case input_state::positioning_window:
|
||||
case State::positioningWindow:
|
||||
statePositioningWindow(button, x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
case input_state::viewport_right:
|
||||
case State::viewportRight:
|
||||
stateViewportRight(button, x, y);
|
||||
break;
|
||||
|
||||
case input_state::viewport_left:
|
||||
case State::viewportLeft:
|
||||
stateViewportLeft(button, x, y);
|
||||
break;
|
||||
|
||||
case input_state::scroll_left:
|
||||
case State::scrollLeft:
|
||||
stateScrollLeft(button, widgetIndex, window, widget, x, y);
|
||||
break;
|
||||
|
||||
case input_state::resizing:
|
||||
case State::resizing:
|
||||
stateResizing(button, x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
case input_state::scroll_right:
|
||||
case State::scrollRight:
|
||||
stateScrollRight(button, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x004C7334
|
||||
static void stateViewportLeft(const mouse_button button, const int16_t x, const int16_t y)
|
||||
static void stateViewportLeft(const MouseButton button, const int16_t x, const int16_t y)
|
||||
{
|
||||
auto window = WindowManager::find(_dragWindowType, _dragWindowNumber);
|
||||
if (window == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
{
|
||||
// 0x4C735D
|
||||
auto viewport = window->viewports[0];
|
||||
|
@ -485,14 +485,14 @@ namespace OpenLoco::Input
|
|||
}
|
||||
if (viewport == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->type == _dragWindowType && window->number == _dragWindowNumber)
|
||||
{
|
||||
|
||||
if (Input::hasFlag(input_flags::tool_active))
|
||||
if (Input::hasFlag(Flags::toolActive))
|
||||
{
|
||||
auto tool = WindowManager::find(_toolWindowType, _toolWindowNumber);
|
||||
if (tool != nullptr)
|
||||
|
@ -504,14 +504,14 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::left_released:
|
||||
case MouseButton::leftReleased:
|
||||
{
|
||||
// 0x4C73C2
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
if (window->type != _dragWindowType || window->number != _dragWindowNumber)
|
||||
return;
|
||||
|
||||
if (hasFlag(input_flags::tool_active))
|
||||
if (hasFlag(Flags::toolActive))
|
||||
{
|
||||
auto tool = WindowManager::find(_toolWindowType, _toolWindowNumber);
|
||||
if (tool != nullptr)
|
||||
|
@ -519,7 +519,7 @@ namespace OpenLoco::Input
|
|||
tool->callToolDragEnd(_toolWidgetIndex);
|
||||
}
|
||||
}
|
||||
else if (!hasFlag(input_flags::flag4))
|
||||
else if (!hasFlag(Flags::flag4))
|
||||
{
|
||||
auto interaction = ViewportInteraction::getItemLeft(x, y);
|
||||
switch (interaction.type)
|
||||
|
@ -689,19 +689,19 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
// 0x004C74BB
|
||||
static void stateViewportRight(const mouse_button button, const int16_t x, const int16_t y)
|
||||
static void stateViewportRight(const MouseButton button, const int16_t x, const int16_t y)
|
||||
{
|
||||
auto window = WindowManager::find(_dragWindowType, _dragWindowNumber);
|
||||
if (window == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (button)
|
||||
{
|
||||
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
{
|
||||
// 4C74E4
|
||||
_ticksSinceDragStart += time_since_last_tick;
|
||||
|
@ -712,7 +712,7 @@ namespace OpenLoco::Input
|
|||
}
|
||||
if (vp == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -722,7 +722,7 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
Gfx::point_t dragOffset = { x, y };
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::playing)
|
||||
if (Tutorial::state() != Tutorial::State::playing)
|
||||
{
|
||||
// Fix #151: use relative drag from one frame to the next rather than
|
||||
// using the relative position from the message loop
|
||||
|
@ -746,15 +746,15 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::right_released:
|
||||
case MouseButton::rightReleased:
|
||||
{
|
||||
if (_ticksSinceDragStart > 500)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
auto interaction = ViewportInteraction::rightOver(_dragLastX, _dragLastY);
|
||||
|
||||
switch (interaction.type)
|
||||
|
@ -941,11 +941,11 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
// 0x004C71F6
|
||||
static void stateScrollLeft(const mouse_button button, const widget_index widgetIndex, Ui::window* const window, Ui::widget_t* const widget, const int16_t x, const int16_t y)
|
||||
static void stateScrollLeft(const MouseButton button, const widget_index widgetIndex, Ui::window* const window, Ui::widget_t* const widget, const int16_t x, const int16_t y)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
{
|
||||
if (widgetIndex != _pressedWidgetIndex || window->type != _pressedWindowType || window->number != _pressedWindowNumber)
|
||||
{
|
||||
|
@ -957,9 +957,9 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::left_released:
|
||||
case MouseButton::leftReleased:
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
ScrollView::clearPressedButtons(_pressedWindowType, _pressedWindowNumber, _pressedWidgetIndex);
|
||||
break;
|
||||
}
|
||||
|
@ -973,18 +973,18 @@ namespace OpenLoco::Input
|
|||
// regs.cx = (uint16_t)button;
|
||||
// regs.ax = x;
|
||||
// regs.bx = y;
|
||||
static void stateScrollRight(const mouse_button button, const int16_t x, const int16_t y)
|
||||
static void stateScrollRight(const MouseButton button, const int16_t x, const int16_t y)
|
||||
{
|
||||
auto window = WindowManager::find(_dragWindowType, _dragWindowNumber);
|
||||
if (window == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
{
|
||||
_ticksSinceDragStart += time_since_last_tick;
|
||||
if (x != 0 || y != 0)
|
||||
|
@ -998,9 +998,9 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::right_released:
|
||||
case MouseButton::rightReleased:
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
// in the original assembly code we load into registers values from _dragLastX, _dragLastY
|
||||
// if _ticksSinceDragStart <= 500, however the result was unused
|
||||
break;
|
||||
|
@ -1011,18 +1011,18 @@ namespace OpenLoco::Input
|
|||
}
|
||||
}
|
||||
|
||||
mouse_button getLastKnownButtonState()
|
||||
MouseButton getLastKnownButtonState()
|
||||
{
|
||||
return _lastKnownButtonState;
|
||||
}
|
||||
|
||||
// 0x004C7722
|
||||
static void stateResizing(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
static void stateResizing(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
{
|
||||
auto w = WindowManager::find(_dragWindowType, _dragWindowNumber);
|
||||
if (w == nullptr)
|
||||
{
|
||||
state(input_state::reset);
|
||||
state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1030,12 +1030,12 @@ namespace OpenLoco::Input
|
|||
int dx = 0, dy = 0;
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
doDefault = true;
|
||||
break;
|
||||
|
||||
case mouse_button::left_released:
|
||||
state(input_state::normal);
|
||||
case MouseButton::leftReleased:
|
||||
state(State::normal);
|
||||
_tooltipTimeout = 0;
|
||||
_tooltipWidgetIndex = _pressedWidgetIndex;
|
||||
_tooltipWindowType = _dragWindowType;
|
||||
|
@ -1125,18 +1125,18 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
// 0x004C7903
|
||||
static void statePositioningWindow(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
static void statePositioningWindow(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
{
|
||||
auto w = WindowManager::find(_dragWindowType, _dragWindowNumber);
|
||||
if (w == nullptr)
|
||||
{
|
||||
state(input_state::reset);
|
||||
state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
{
|
||||
y = std::clamp<int16_t>(y, 29, Ui::height() - 29);
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::left_released:
|
||||
case MouseButton::leftReleased:
|
||||
{
|
||||
windowPositionEnd();
|
||||
|
||||
|
@ -1202,14 +1202,14 @@ namespace OpenLoco::Input
|
|||
WindowManager::close(Ui::WindowType::dropdown, 0);
|
||||
window = WindowManager::find(_pressedWindowType, _pressedWindowNumber);
|
||||
|
||||
bool flagSet = hasFlag(input_flags::widget_pressed);
|
||||
resetFlag(input_flags::widget_pressed);
|
||||
bool flagSet = hasFlag(Flags::widgetPressed);
|
||||
resetFlag(Flags::widgetPressed);
|
||||
if (flagSet)
|
||||
{
|
||||
WindowManager::invalidateWidget(_pressedWindowType, _pressedWindowNumber, _pressedWidgetIndex);
|
||||
}
|
||||
|
||||
Input::state(input_state::normal);
|
||||
Input::state(State::normal);
|
||||
_tooltipTimeout = 0;
|
||||
_tooltipWidgetIndex = _pressedWidgetIndex;
|
||||
_tooltipWindowType = _pressedWindowType;
|
||||
|
@ -1283,7 +1283,7 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
// 0x004C7AE7
|
||||
static void stateWidgetPressed(mouse_button button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
static void stateWidgetPressed(MouseButton button, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
{
|
||||
_52334A = x;
|
||||
_52334C = y;
|
||||
|
@ -1291,11 +1291,11 @@ namespace OpenLoco::Input
|
|||
auto pressedWindow = WindowManager::find(_pressedWindowType, _pressedWindowNumber);
|
||||
if (pressedWindow == nullptr)
|
||||
{
|
||||
Input::state(input_state::reset);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input::state() == input_state::dropdown_active)
|
||||
if (Input::state() == State::dropdownActive)
|
||||
{
|
||||
if (_113DC78 & (1 << 0))
|
||||
{
|
||||
|
@ -1311,8 +1311,8 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
_pressedWindowType = Ui::WindowType::undefined;
|
||||
Input::resetFlag(input_flags::widget_pressed);
|
||||
Input::state(input_state::reset);
|
||||
Input::resetFlag(Flags::widgetPressed);
|
||||
Input::state(State::reset);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1322,7 +1322,7 @@ namespace OpenLoco::Input
|
|||
bool doShared = false;
|
||||
switch (button)
|
||||
{
|
||||
case mouse_button::released: // 0
|
||||
case MouseButton::released: // 0
|
||||
{
|
||||
if (window == nullptr)
|
||||
break;
|
||||
|
@ -1342,8 +1342,8 @@ namespace OpenLoco::Input
|
|||
window->callOnMouseDown(widgetIndex);
|
||||
}
|
||||
|
||||
bool flagSet = Input::hasFlag(input_flags::widget_pressed);
|
||||
Input::setFlag(input_flags::widget_pressed);
|
||||
bool flagSet = Input::hasFlag(Flags::widgetPressed);
|
||||
Input::setFlag(Flags::widgetPressed);
|
||||
if (!flagSet)
|
||||
{
|
||||
WindowManager::invalidateWidget(_pressedWindowType, _pressedWindowNumber, widgetIndex);
|
||||
|
@ -1356,8 +1356,8 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
}
|
||||
|
||||
case mouse_button::left_pressed: // 1
|
||||
if (Input::state() == input_state::dropdown_active)
|
||||
case MouseButton::leftPressed: // 1
|
||||
if (Input::state() == State::dropdownActive)
|
||||
{
|
||||
if (window != nullptr && widgetIndex != -1)
|
||||
{
|
||||
|
@ -1367,12 +1367,12 @@ namespace OpenLoco::Input
|
|||
}
|
||||
return;
|
||||
|
||||
case mouse_button::left_released: // 2
|
||||
case MouseButton::leftReleased: // 2
|
||||
doShared = true;
|
||||
break;
|
||||
|
||||
case mouse_button::right_pressed: // 3
|
||||
if (Input::state() == input_state::dropdown_active)
|
||||
case MouseButton::rightPressed: // 3
|
||||
if (Input::state() == State::dropdownActive)
|
||||
{
|
||||
doShared = true;
|
||||
}
|
||||
|
@ -1383,14 +1383,14 @@ namespace OpenLoco::Input
|
|||
|
||||
break;
|
||||
|
||||
case mouse_button::right_released:
|
||||
case MouseButton::rightReleased:
|
||||
return;
|
||||
}
|
||||
|
||||
if (doShared)
|
||||
{
|
||||
// 0x4C7BC7
|
||||
if (Input::state() == input_state::dropdown_active)
|
||||
if (Input::state() == State::dropdownActive)
|
||||
{
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -1406,10 +1406,10 @@ namespace OpenLoco::Input
|
|||
{
|
||||
if (window->type == *_pressedWindowType && window->number == _pressedWindowNumber && widgetIndex == _pressedWidgetIndex)
|
||||
{
|
||||
if (hasFlag(input_flags::flag1))
|
||||
if (hasFlag(Flags::flag1))
|
||||
{
|
||||
bool flagSet = hasFlag(input_flags::flag2);
|
||||
setFlag(input_flags::flag2);
|
||||
bool flagSet = hasFlag(Flags::flag2);
|
||||
setFlag(Flags::flag2);
|
||||
if (!flagSet)
|
||||
{
|
||||
return;
|
||||
|
@ -1426,7 +1426,7 @@ namespace OpenLoco::Input
|
|||
window = WindowManager::find(_pressedWindowType, _pressedWindowNumber);
|
||||
}
|
||||
|
||||
Input::state(input_state::normal);
|
||||
Input::state(State::normal);
|
||||
_tooltipTimeout = 0;
|
||||
_tooltipWidgetIndex = _pressedWidgetIndex;
|
||||
_tooltipWindowType = _pressedWindowType;
|
||||
|
@ -1446,17 +1446,17 @@ namespace OpenLoco::Input
|
|||
|
||||
// 0x4C7F02
|
||||
_clickRepeatTicks = 0;
|
||||
if (Input::state() != input_state::dropdown_active)
|
||||
if (Input::state() != State::dropdownActive)
|
||||
{
|
||||
bool flagSet = hasFlag(input_flags::widget_pressed);
|
||||
resetFlag(input_flags::widget_pressed);
|
||||
bool flagSet = hasFlag(Flags::widgetPressed);
|
||||
resetFlag(Flags::widgetPressed);
|
||||
if (flagSet)
|
||||
{
|
||||
WindowManager::invalidateWidget(_pressedWindowType, _pressedWindowNumber, _pressedWidgetIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (Input::state() == input_state::dropdown_active)
|
||||
if (Input::state() == State::dropdownActive)
|
||||
{
|
||||
if (window != nullptr && window->type == Ui::WindowType::dropdown)
|
||||
{
|
||||
|
@ -1471,17 +1471,17 @@ namespace OpenLoco::Input
|
|||
}
|
||||
|
||||
// 0x004C8048
|
||||
static void stateNormal(mouse_button state, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
static void stateNormal(MouseButton state, int16_t x, int16_t y, Ui::window* window, Ui::widget_t* widget, Ui::widget_index widgetIndex)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case mouse_button::left_pressed:
|
||||
case MouseButton::leftPressed:
|
||||
stateNormalLeft(x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
case mouse_button::right_pressed:
|
||||
case MouseButton::rightPressed:
|
||||
stateNormalRight(x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
case mouse_button::released:
|
||||
case MouseButton::released:
|
||||
stateNormalHover(x, y, window, widget, widgetIndex);
|
||||
break;
|
||||
|
||||
|
@ -1647,24 +1647,24 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
|
||||
case Ui::widget_type::viewport:
|
||||
state(input_state::viewport_left);
|
||||
state(State::viewportLeft);
|
||||
_dragLastX = x;
|
||||
_dragLastY = y;
|
||||
_dragWindowType = window->type;
|
||||
_dragWindowNumber = window->number;
|
||||
if (hasFlag(input_flags::tool_active))
|
||||
if (hasFlag(Flags::toolActive))
|
||||
{
|
||||
auto w = WindowManager::find(_toolWindowType, _toolWindowNumber);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->callToolDown(_toolWidgetIndex, x, y);
|
||||
setFlag(input_flags::flag4);
|
||||
setFlag(Flags::flag4);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Ui::widget_type::scrollview:
|
||||
state(input_state::scroll_left);
|
||||
state(State::scrollLeft);
|
||||
_pressedWidgetIndex = widgetIndex;
|
||||
_pressedWindowType = window->type;
|
||||
_pressedWindowNumber = window->number;
|
||||
|
@ -1682,8 +1682,8 @@ namespace OpenLoco::Input
|
|||
_pressedWidgetIndex = widgetIndex;
|
||||
_pressedWindowType = window->type;
|
||||
_pressedWindowNumber = window->number;
|
||||
setFlag(input_flags::widget_pressed);
|
||||
state(input_state::widget_pressed);
|
||||
setFlag(Flags::widgetPressed);
|
||||
state(State::widgetPressed);
|
||||
_clickRepeatTicks = 1;
|
||||
|
||||
WindowManager::invalidateWidget(window->type, window->number, widgetIndex);
|
||||
|
@ -1753,7 +1753,7 @@ namespace OpenLoco::Input
|
|||
|
||||
_5233AE = 0;
|
||||
_5233B2 = 0;
|
||||
setFlag(input_flags::flag5);
|
||||
setFlag(Flags::flag5);
|
||||
break;
|
||||
|
||||
case Ui::widget_type::scrollview:
|
||||
|
@ -1761,7 +1761,7 @@ namespace OpenLoco::Input
|
|||
|
||||
_5233AE = 0;
|
||||
_5233B2 = 0;
|
||||
setFlag(input_flags::flag5);
|
||||
setFlag(Flags::flag5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1771,7 +1771,7 @@ namespace OpenLoco::Input
|
|||
// 0x004C877D
|
||||
void windowPositionBegin(int16_t x, int16_t y, Ui::window* window, Ui::widget_index widget_index)
|
||||
{
|
||||
state(input_state::positioning_window);
|
||||
state(State::positioningWindow);
|
||||
_pressedWidgetIndex = widget_index;
|
||||
_dragLastX = x;
|
||||
_dragLastY = y;
|
||||
|
@ -1782,7 +1782,7 @@ namespace OpenLoco::Input
|
|||
|
||||
static void windowPositionEnd()
|
||||
{
|
||||
state(input_state::normal);
|
||||
state(State::normal);
|
||||
_tooltipTimeout = 0;
|
||||
_tooltipWidgetIndex = _pressedWidgetIndex;
|
||||
_tooltipWindowType = _dragWindowType;
|
||||
|
@ -1794,7 +1794,7 @@ namespace OpenLoco::Input
|
|||
// 0x004C85D1
|
||||
static void windowResizeBegin(int16_t x, int16_t y, Ui::window* window, Ui::widget_index widget_index)
|
||||
{
|
||||
state(input_state::resizing);
|
||||
state(State::resizing);
|
||||
_pressedWidgetIndex = widget_index;
|
||||
_dragLastX = x;
|
||||
_dragLastY = y;
|
||||
|
@ -1808,7 +1808,7 @@ namespace OpenLoco::Input
|
|||
static void viewportDragBegin(window* w)
|
||||
{
|
||||
w->flags &= ~Ui::WindowFlags::scrolling_to_location;
|
||||
state(input_state::viewport_right);
|
||||
state(State::viewportRight);
|
||||
_dragWindowType = w->type;
|
||||
_dragWindowNumber = w->number;
|
||||
_ticksSinceDragStart = 0;
|
||||
|
@ -1818,7 +1818,7 @@ namespace OpenLoco::Input
|
|||
|
||||
static void scrollDragBegin(int16_t x, int16_t y, Ui::window* window, Ui::widget_index widgetIndex)
|
||||
{
|
||||
state(input_state::scroll_right);
|
||||
state(State::scrollRight);
|
||||
_dragLastX = x;
|
||||
_dragLastY = y;
|
||||
_dragWindowType = window->type;
|
||||
|
@ -1937,7 +1937,7 @@ namespace OpenLoco::Input
|
|||
break;
|
||||
|
||||
case Ui::widget_type::viewport:
|
||||
if (Input::hasFlag(input_flags::tool_active))
|
||||
if (Input::hasFlag(Flags::toolActive))
|
||||
{
|
||||
// 3
|
||||
cursorId = (Ui::CursorId)*_currentTool;
|
||||
|
@ -1979,7 +1979,7 @@ namespace OpenLoco::Input
|
|||
ViewportInteraction::rightOver(x, y);
|
||||
}
|
||||
|
||||
if (Input::state() == Input::input_state::resizing)
|
||||
if (Input::state() == Input::State::resizing)
|
||||
{
|
||||
cursorId = Ui::CursorId::diagonalArrows;
|
||||
}
|
||||
|
|
|
@ -701,7 +701,7 @@ void OpenLoco::Interop::registerHooks()
|
|||
return 0;
|
||||
});
|
||||
|
||||
// Until handling of input_state::viewport_left has been implemented in mouse_input...
|
||||
// Until handling of State::viewportLeft has been implemented in mouse_input...
|
||||
registerHook(
|
||||
0x00490F6C,
|
||||
[](registers& regs) FORCE_ALIGN_ARG_POINTER -> uint8_t {
|
||||
|
|
|
@ -9,15 +9,15 @@ namespace OpenLoco::Intro
|
|||
|
||||
bool isActive()
|
||||
{
|
||||
return state() != intro_state::none;
|
||||
return state() != State::none;
|
||||
}
|
||||
|
||||
intro_state state()
|
||||
State state()
|
||||
{
|
||||
return (intro_state)*_state;
|
||||
return (State)*_state;
|
||||
}
|
||||
|
||||
void state(intro_state state)
|
||||
void state(State state)
|
||||
{
|
||||
_state = (uint8_t)state;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace OpenLoco::Intro
|
||||
{
|
||||
enum class intro_state
|
||||
enum class State
|
||||
{
|
||||
none,
|
||||
begin,
|
||||
|
@ -12,8 +12,8 @@ namespace OpenLoco::Intro
|
|||
};
|
||||
|
||||
bool isActive();
|
||||
intro_state state();
|
||||
void state(intro_state state);
|
||||
State state();
|
||||
void state(State state);
|
||||
|
||||
void update();
|
||||
}
|
||||
|
|
|
@ -434,9 +434,9 @@ namespace OpenLoco
|
|||
call(0x0043C88C);
|
||||
setScreenFlag(ScreenFlags::initialised);
|
||||
#ifdef _SHOW_INTRO_
|
||||
Intro::state(Intro::intro_state::begin);
|
||||
Intro::state(Intro::State::begin);
|
||||
#else
|
||||
Intro::state(Intro::intro_state::end);
|
||||
Intro::state(Intro::State::end);
|
||||
#endif
|
||||
Title::start();
|
||||
Gui::init();
|
||||
|
@ -611,7 +611,7 @@ namespace OpenLoco
|
|||
{
|
||||
addr<0x0050C1A2, uint32_t>() += time_since_last_tick;
|
||||
}
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() != Tutorial::State::none)
|
||||
{
|
||||
time_since_last_tick = 31;
|
||||
}
|
||||
|
@ -698,22 +698,22 @@ namespace OpenLoco
|
|||
{
|
||||
switch (Input::state())
|
||||
{
|
||||
case input_state::reset:
|
||||
case input_state::normal:
|
||||
case input_state::dropdown_active:
|
||||
if (Input::hasFlag(input_flags::viewport_scrolling))
|
||||
case State::reset:
|
||||
case State::normal:
|
||||
case State::dropdownActive:
|
||||
if (Input::hasFlag(Flags::viewportScrolling))
|
||||
{
|
||||
Input::resetFlag(input_flags::viewport_scrolling);
|
||||
Input::resetFlag(Flags::viewportScrolling);
|
||||
numUpdates = 1;
|
||||
}
|
||||
break;
|
||||
case input_state::widget_pressed: break;
|
||||
case input_state::positioning_window: break;
|
||||
case input_state::viewport_right: break;
|
||||
case input_state::viewport_left: break;
|
||||
case input_state::scroll_left: break;
|
||||
case input_state::resizing: break;
|
||||
case input_state::scroll_right: break;
|
||||
case State::widgetPressed: break;
|
||||
case State::positioningWindow: break;
|
||||
case State::viewportRight: break;
|
||||
case State::viewportLeft: break;
|
||||
case State::scrollLeft: break;
|
||||
case State::resizing: break;
|
||||
case State::scrollRight: break;
|
||||
}
|
||||
}
|
||||
addr<0x0052622E, int16_t>() += numUpdates;
|
||||
|
@ -748,7 +748,7 @@ namespace OpenLoco
|
|||
Audio::stopTitleMusic();
|
||||
}
|
||||
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::none && addr<0x0052532C, int32_t>() != 0 && addr<0x0113E2E4, int32_t>() < 0x40)
|
||||
if (Tutorial::state() != Tutorial::State::none && addr<0x0052532C, int32_t>() != 0 && addr<0x0113E2E4, int32_t>() < 0x40)
|
||||
{
|
||||
Tutorial::stop();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ using namespace OpenLoco::Interop;
|
|||
|
||||
namespace OpenLoco::Tutorial
|
||||
{
|
||||
static loco_global<uint8_t, 0x00508F19> _state;
|
||||
static loco_global<State, 0x00508F19> _state;
|
||||
|
||||
// The following two globals are unused, but left here for documentation purposes.
|
||||
static loco_global<uint16_t*, 0x009C86FC> _tutorialOffset;
|
||||
|
@ -29,9 +29,9 @@ namespace OpenLoco::Tutorial
|
|||
|
||||
constexpr Config::Resolution tutorialResolution = { 1024, 768 };
|
||||
|
||||
tutorial_state state()
|
||||
State state()
|
||||
{
|
||||
return (tutorial_state)*_state;
|
||||
return *_state;
|
||||
}
|
||||
|
||||
void registerHooks()
|
||||
|
@ -132,7 +132,7 @@ namespace OpenLoco::Tutorial
|
|||
StringIds::tutorial_3_string_1,
|
||||
};
|
||||
|
||||
*_state = static_cast<uint8_t>(tutorial_state::playing);
|
||||
*_state = State::playing;
|
||||
*_tutorialString = openingStringIds[*_tutorialNumber];
|
||||
|
||||
// Set up the scenario.
|
||||
|
@ -150,7 +150,7 @@ namespace OpenLoco::Tutorial
|
|||
// 0x0043C70E
|
||||
void stop()
|
||||
{
|
||||
*_state = static_cast<uint8_t>(tutorial_state::none);
|
||||
*_state = State::none;
|
||||
Gfx::invalidateScreen();
|
||||
Gui::resize();
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
namespace OpenLoco::Tutorial
|
||||
{
|
||||
enum class tutorial_state
|
||||
enum class State : uint8_t
|
||||
{
|
||||
none,
|
||||
playing,
|
||||
recording,
|
||||
};
|
||||
|
||||
tutorial_state state();
|
||||
State state();
|
||||
|
||||
void registerHooks();
|
||||
|
||||
|
|
|
@ -956,7 +956,7 @@ namespace OpenLoco::Ui
|
|||
#endif
|
||||
|
||||
// 0x004C6EE6
|
||||
static Input::mouse_button gameGetNextInput(uint32_t* x, int16_t* y)
|
||||
static Input::MouseButton gameGetNextInput(uint32_t* x, int16_t* y)
|
||||
{
|
||||
registers regs;
|
||||
call(0x004c6ee6, regs);
|
||||
|
@ -964,13 +964,13 @@ namespace OpenLoco::Ui
|
|||
*x = regs.eax;
|
||||
*y = regs.bx;
|
||||
|
||||
return (Input::mouse_button)regs.cx;
|
||||
return (Input::MouseButton)regs.cx;
|
||||
}
|
||||
|
||||
// 0x004CD422
|
||||
static void processMouseTool(int16_t x, int16_t y)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (!Input::hasFlag(Input::Flags::toolActive))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1000,7 +1000,7 @@ namespace OpenLoco::Ui
|
|||
{
|
||||
if (!isTitleMode() && !isEditorMode())
|
||||
{
|
||||
if (Tutorial::state() == Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() == Tutorial::State::none)
|
||||
{
|
||||
call(0x4C95A6);
|
||||
}
|
||||
|
@ -1054,25 +1054,25 @@ namespace OpenLoco::Ui
|
|||
|
||||
uint32_t x;
|
||||
int16_t y;
|
||||
Input::mouse_button state;
|
||||
while ((state = gameGetNextInput(&x, &y)) != Input::mouse_button::released)
|
||||
Input::MouseButton state;
|
||||
while ((state = gameGetNextInput(&x, &y)) != Input::MouseButton::released)
|
||||
{
|
||||
if (isTitleMode() && Intro::isActive() && state == Input::mouse_button::left_pressed)
|
||||
if (isTitleMode() && Intro::isActive() && state == Input::MouseButton::leftPressed)
|
||||
{
|
||||
if (Intro::state() == Intro::intro_state::state_9)
|
||||
if (Intro::state() == Intro::State::state_9)
|
||||
{
|
||||
Intro::state(Intro::intro_state::end);
|
||||
Intro::state(Intro::State::end);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Intro::state(Intro::intro_state::state_8);
|
||||
Intro::state(Intro::State::state_8);
|
||||
}
|
||||
}
|
||||
Input::handleMouse(x, y, state);
|
||||
}
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
Input::handleMouse(x, y, state);
|
||||
}
|
||||
|
@ -1100,13 +1100,13 @@ namespace OpenLoco::Ui
|
|||
|
||||
uint32_t x;
|
||||
int16_t y;
|
||||
Input::mouse_button state;
|
||||
while ((state = gameGetNextInput(&x, &y)) != Input::mouse_button::released)
|
||||
Input::MouseButton state;
|
||||
while ((state = gameGetNextInput(&x, &y)) != Input::MouseButton::released)
|
||||
{
|
||||
Input::handleMouse(x, y, state);
|
||||
}
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
Input::handleMouse(x, y, state);
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace OpenLoco::Ui::Dropdown
|
|||
_dropdownHighlightedIndex = -1;
|
||||
_dropdownDisabledItems = 0;
|
||||
_dropdownSelection = 0;
|
||||
Input::state(Input::input_state::dropdown_active);
|
||||
Input::state(Input::State::dropdownActive);
|
||||
}
|
||||
|
||||
// 0x004CC807 based on
|
||||
|
@ -322,12 +322,12 @@ namespace OpenLoco::Ui::Dropdown
|
|||
colour = Colour::translucent(colour);
|
||||
}
|
||||
|
||||
Input::resetFlag(Input::input_flags::flag1);
|
||||
Input::resetFlag(Input::input_flags::flag2);
|
||||
Input::resetFlag(Input::Flags::flag1);
|
||||
Input::resetFlag(Input::Flags::flag2);
|
||||
|
||||
if (flags & (1 << 7))
|
||||
{
|
||||
Input::setFlag(Input::input_flags::flag1);
|
||||
Input::setFlag(Input::Flags::flag1);
|
||||
}
|
||||
|
||||
flags &= ~(1 << 7);
|
||||
|
@ -631,7 +631,7 @@ namespace OpenLoco::Ui::Dropdown
|
|||
WindowManager::close(WindowType::dropdown, 0);
|
||||
_word_113DC78 = 0;
|
||||
|
||||
if (Input::state() != Input::input_state::widget_pressed || Input::hasFlag(Input::input_flags::widget_pressed))
|
||||
if (Input::state() != Input::State::widgetPressed || Input::hasFlag(Input::Flags::widgetPressed))
|
||||
{
|
||||
_word_113DC78 = _word_113DC78 | 1;
|
||||
}
|
||||
|
@ -659,12 +659,12 @@ namespace OpenLoco::Ui::Dropdown
|
|||
colour = Colour::translucent(colour);
|
||||
}
|
||||
|
||||
Input::resetFlag(Input::input_flags::flag1);
|
||||
Input::resetFlag(Input::input_flags::flag2);
|
||||
Input::resetFlag(Input::Flags::flag1);
|
||||
Input::resetFlag(Input::Flags::flag2);
|
||||
|
||||
if (flags & (1 << 7))
|
||||
{
|
||||
Input::setFlag(Input::input_flags::flag1);
|
||||
Input::setFlag(Input::Flags::flag1);
|
||||
}
|
||||
|
||||
flags &= ~(1 << 7);
|
||||
|
|
|
@ -1476,10 +1476,10 @@ namespace OpenLoco::Ui::WindowManager
|
|||
wheel += 17;
|
||||
}
|
||||
|
||||
if (Tutorial::state() != Tutorial::tutorial_state::none)
|
||||
if (Tutorial::state() != Tutorial::State::none)
|
||||
return;
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::flag5))
|
||||
if (Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
if (OpenLoco::isTitleMode())
|
||||
return;
|
||||
|
|
|
@ -846,7 +846,7 @@ namespace OpenLoco::Ui::Widget
|
|||
{
|
||||
isActivated = true;
|
||||
}
|
||||
else if (Input::state() == Input::input_state::widget_pressed)
|
||||
else if (Input::state() == Input::State::widgetPressed)
|
||||
{
|
||||
isActivated = Input::isPressed(w->type, w->number, index);
|
||||
}
|
||||
|
|
|
@ -1412,7 +1412,7 @@ namespace OpenLoco::Ui
|
|||
}
|
||||
|
||||
uint64_t pressed_widget = 0;
|
||||
if (Input::state() == Input::input_state::dropdown_active || Input::state() == Input::input_state::widget_pressed)
|
||||
if (Input::state() == Input::State::dropdownActive || Input::state() == Input::State::widgetPressed)
|
||||
{
|
||||
if (Input::isPressed(type, number))
|
||||
{
|
||||
|
|
|
@ -584,7 +584,7 @@ namespace OpenLoco::Ui::Windows::BuildVehicle
|
|||
case widx::tab_build_new_ships:
|
||||
{
|
||||
|
||||
if (Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (Input::hasFlag(Input::Flags::toolActive))
|
||||
{
|
||||
Input::toolCancel(window->type, window->number);
|
||||
}
|
||||
|
|
|
@ -1186,7 +1186,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
static void setLegendHover(window* self, int16_t x, int16_t y)
|
||||
{
|
||||
uint32_t selectedCargo = 0;
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
const auto location = Input::getMouseLocation2();
|
||||
auto* frontWindow = WindowManager::findAt(location);
|
||||
|
@ -1377,7 +1377,7 @@ namespace OpenLoco::Ui::Windows::CompanyList
|
|||
static void setLegendHover(window* self, int16_t x, int16_t y)
|
||||
{
|
||||
uint32_t selectedCompany = 0;
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
const auto location = Input::getMouseLocation2();
|
||||
auto* frontWindow = WindowManager::findAt(location);
|
||||
|
|
|
@ -878,7 +878,7 @@ namespace OpenLoco::Ui::Windows::CompanyWindow
|
|||
|
||||
case widx::build_hq:
|
||||
Input::toolSet(self, widgetIndex, 43);
|
||||
Input::setFlag(Input::input_flags::flag5);
|
||||
Input::setFlag(Input::Flags::flag5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
|
|||
Common::sub_49FEC7();
|
||||
WindowManager::viewportSetVisibility(WindowManager::ViewportVisibility::overgroundView);
|
||||
Input::toolSet(self, widx::construct, 12);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
|
||||
_constructionHover = 1;
|
||||
_byte_113607E = 0;
|
||||
|
|
|
@ -782,7 +782,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
// 0x004585B8
|
||||
static void onUpdate(window* self)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
auto cursor = Input::getMouseLocation();
|
||||
auto xPos = cursor.x;
|
||||
|
@ -817,7 +817,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = window_size.width;
|
||||
self->min_height = window_size.height;
|
||||
|
@ -831,7 +831,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
else
|
||||
{
|
||||
self->saved_view.mapX = 0;
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = window_size.width;
|
||||
self->min_height = window_size.height;
|
||||
|
@ -1041,7 +1041,7 @@ namespace OpenLoco::Ui::Windows::IndustryList
|
|||
self->max_height = NewIndustries::window_size.height;
|
||||
Input::toolSet(self, Common::widx::tab_new_industry, 40);
|
||||
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
Ui::Windows::showGridlines();
|
||||
byte_E0C3D9 = 0;
|
||||
dword_E0C39C = 0x80000000;
|
||||
|
|
|
@ -264,7 +264,7 @@ namespace OpenLoco::Ui::Windows::MapWindow
|
|||
{
|
||||
uint8_t i = 0;
|
||||
int16_t y = 0;
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
uint32_t cursorX = _cursorX2;
|
||||
uint32_t cursorY = _cursorY2;
|
||||
|
|
|
@ -302,7 +302,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
|
|||
file_entry entry = _files[index];
|
||||
|
||||
// Clicking a directory, with left mouse button?
|
||||
if (Input::state() == Input::input_state::scroll_left && entry.is_directory())
|
||||
if (Input::state() == Input::State::scrollLeft && entry.is_directory())
|
||||
{
|
||||
appendDirectory(entry.get_name().data());
|
||||
self->invalidate();
|
||||
|
@ -310,7 +310,7 @@ namespace OpenLoco::Ui::Windows::PromptBrowse
|
|||
}
|
||||
|
||||
// Clicking a file, with left mouse button?
|
||||
if (Input::state() == Input::input_state::scroll_left)
|
||||
if (Input::state() == Input::State::scrollLeft)
|
||||
{
|
||||
// Copy the selected filename without extension to text input buffer.
|
||||
inputSession.buffer = entry.get_name();
|
||||
|
|
|
@ -746,11 +746,11 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
|
||||
if (oldStationId != StationId::null)
|
||||
{
|
||||
if (Input::hasMapSelectionFlag(Input::MapSelectionFlags::catchment_area))
|
||||
if (Input::hasMapSelectionFlag(Input::MapSelectionFlags::catchmentArea))
|
||||
{
|
||||
WindowManager::invalidate(WindowType::station, oldStationId);
|
||||
sub_491BC6();
|
||||
Input::resetMapSelectionFlag(Input::MapSelectionFlags::catchment_area);
|
||||
Input::resetMapSelectionFlag(Input::MapSelectionFlags::catchmentArea);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@ namespace OpenLoco::Ui::Windows::Station
|
|||
auto station = StationManager::get(_lastSelectedStation);
|
||||
|
||||
station->setCatchmentDisplay(0);
|
||||
Input::setMapSelectionFlags(Input::MapSelectionFlags::catchment_area);
|
||||
Input::setMapSelectionFlags(Input::MapSelectionFlags::catchmentArea);
|
||||
|
||||
WindowManager::invalidate(WindowType::station, newStationId);
|
||||
|
||||
|
|
|
@ -230,7 +230,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void tabReset(window* self)
|
||||
{
|
||||
Input::toolSet(self, Common::widx::panel, 8);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
_byte_113649A = 0;
|
||||
_lastTreeCost = 0x80000000;
|
||||
self->var_83C = 0;
|
||||
|
@ -324,13 +324,13 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
// 0x004BBDA5
|
||||
static void onUpdate(window* self)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (!Input::hasFlag(Input::Flags::toolActive))
|
||||
WindowManager::close(self);
|
||||
|
||||
if (_toolWindowType != WindowType::terraform)
|
||||
WindowManager::close(self);
|
||||
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
auto cursor = Input::getMouseLocation();
|
||||
auto xPos = cursor.x;
|
||||
|
@ -365,7 +365,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -379,7 +379,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
else
|
||||
{
|
||||
self->saved_view.mapX = 0;
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -742,7 +742,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
|
||||
Input::toolSet(window, Common::widx::panel, 18);
|
||||
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void tabReset(window* self)
|
||||
{
|
||||
Input::toolSet(self, Common::widx::panel, 41);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
_raiseLandCost = 0x80000000;
|
||||
_adjustToolSize = _clearAreaToolSize;
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void tabReset(window* self)
|
||||
{
|
||||
Input::toolSet(self, Common::widx::panel, 18);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
for (auto i = 0; i < 32; i++)
|
||||
{
|
||||
auto landObj = ObjectManager::get<LandObject>(i);
|
||||
|
@ -1391,7 +1391,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void tabReset(window* self)
|
||||
{
|
||||
Input::toolSet(self, Common::widx::panel, 19);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
_raiseWaterCost = 0x80000000;
|
||||
_lowerWaterCost = 0x80000000;
|
||||
_adjustToolSize = _adjustWaterToolSize;
|
||||
|
@ -1690,7 +1690,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
static void tabReset(window* self)
|
||||
{
|
||||
Input::toolSet(self, Common::widx::panel, 15);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
_byte_113649A = 0;
|
||||
self->var_83C = 0;
|
||||
self->row_hover = -1;
|
||||
|
@ -1711,13 +1711,13 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
// 0x004BC23D
|
||||
static void onUpdate(window* self)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (!Input::hasFlag(Input::Flags::toolActive))
|
||||
WindowManager::close(self);
|
||||
|
||||
if (_toolWindowType != WindowType::terraform)
|
||||
WindowManager::close(self);
|
||||
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
auto cursor = Input::getMouseLocation();
|
||||
auto xPos = cursor.x;
|
||||
|
@ -1752,7 +1752,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -1766,7 +1766,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
else
|
||||
{
|
||||
self->saved_view.mapX = 0;
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -2007,7 +2007,7 @@ namespace OpenLoco::Ui::Windows::Terraform
|
|||
// 0x004BC78A, 0x004BCB0B
|
||||
static void onUpdate(window* self)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::tool_active))
|
||||
if (!Input::hasFlag(Input::Flags::toolActive))
|
||||
WindowManager::close(self);
|
||||
|
||||
if (_toolWindowType != WindowType::terraform)
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace OpenLoco::Ui::Windows::TileInspector
|
|||
static void activateMapSelectionTool(window* const self)
|
||||
{
|
||||
Input::toolSet(self, widx::panel, 42);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
}
|
||||
|
||||
window* open()
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace OpenLoco::Ui::Windows::ToolbarTop::Common
|
|||
auto mouseButtonUsed = Input::getLastKnownButtonState();
|
||||
window = WindowManager::getMainWindow();
|
||||
|
||||
if (itemIndex == 1 || mouseButtonUsed == Input::mouse_button::right_pressed)
|
||||
if (itemIndex == 1 || mouseButtonUsed == Input::MouseButton::rightPressed)
|
||||
{
|
||||
window->viewportRotateLeft();
|
||||
TownManager::updateLabels();
|
||||
|
|
|
@ -658,7 +658,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
self->frame_no++;
|
||||
self->callPrepareDraw();
|
||||
WindowManager::invalidateWidget(WindowType::townList, self->number, self->current_tab + Common::widx::tab_town_list);
|
||||
if ((!Input::hasFlag(Input::input_flags::tool_active)) || self->type != _toolWindowType || self->number != _toolWindowNumber)
|
||||
if ((!Input::hasFlag(Input::Flags::toolActive)) || self->type != _toolWindowType || self->number != _toolWindowNumber)
|
||||
{
|
||||
WindowManager::close(self);
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
self->width = windowSize.width;
|
||||
self->height = windowSize.height;
|
||||
Input::toolSet(self, Common::widx::tab_build_town, 38);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
Ui::Windows::showGridlines();
|
||||
}
|
||||
|
||||
|
@ -872,7 +872,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
// 0x0049AD51
|
||||
static void onUpdate(window* self)
|
||||
{
|
||||
if (!Input::hasFlag(Input::input_flags::flag5))
|
||||
if (!Input::hasFlag(Input::Flags::flag5))
|
||||
{
|
||||
auto cursor = Input::getMouseLocation();
|
||||
auto xPos = cursor.x;
|
||||
|
@ -906,7 +906,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
}
|
||||
else
|
||||
{
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -920,7 +920,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
else
|
||||
{
|
||||
self->saved_view.mapX = 0;
|
||||
if (Input::state() != Input::input_state::scroll_left)
|
||||
if (Input::state() != Input::State::scrollLeft)
|
||||
{
|
||||
self->min_width = windowSize.width;
|
||||
self->min_height = windowSize.height;
|
||||
|
@ -1260,7 +1260,7 @@ namespace OpenLoco::Ui::Windows::TownList
|
|||
tab = Common::widx::tab_build_misc_buildings;
|
||||
|
||||
Input::toolSet(self, tab, 39);
|
||||
Input::setFlag(Input::input_flags::flag6);
|
||||
Input::setFlag(Input::Flags::flag6);
|
||||
Ui::Windows::showGridlines();
|
||||
|
||||
static loco_global<uint8_t, 0x01135C60> byte_1135C60;
|
||||
|
|
Loading…
Reference in New Issue