mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove snake_case in interface folder
This commit is contained in:
parent
28edbf9116
commit
5309c80e29
|
@ -145,7 +145,7 @@ public:
|
||||||
void Draw(rct_drawpixelinfo* dpi) override
|
void Draw(rct_drawpixelinfo* dpi) override
|
||||||
{
|
{
|
||||||
auto bgColour = ThemeGetColour(WindowClass::Chat, 0);
|
auto bgColour = ThemeGetColour(WindowClass::Chat, 0);
|
||||||
chat_draw(dpi, bgColour);
|
ChatDraw(dpi, bgColour);
|
||||||
_inGameConsole.Draw(dpi);
|
_inGameConsole.Draw(dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -609,7 +609,7 @@ public:
|
||||||
mainWindow->savedViewPos.y -= viewport->view_height >> 1;
|
mainWindow->savedViewPos.y -= viewport->view_height >> 1;
|
||||||
|
|
||||||
// Make sure the viewport has correct coordinates set.
|
// Make sure the viewport has correct coordinates set.
|
||||||
viewport_update_position(mainWindow);
|
ViewportUpdatePosition(mainWindow);
|
||||||
|
|
||||||
mainWindow->Invalidate();
|
mainWindow->Invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,7 @@ public:
|
||||||
const OpenGLFramebuffer& framebuffer = _drawingContext->GetFinalFramebuffer();
|
const OpenGLFramebuffer& framebuffer = _drawingContext->GetFinalFramebuffer();
|
||||||
framebuffer.Bind();
|
framebuffer.Bind();
|
||||||
framebuffer.GetPixels(_bitsDPI);
|
framebuffer.GetPixels(_bitsDPI);
|
||||||
std::string result = screenshot_dump_png(&_bitsDPI);
|
std::string result = ScreenshotDumpPNG(&_bitsDPI);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ void InputManager::ProcessChat(const InputEvent& e)
|
||||||
}
|
}
|
||||||
if (input != ChatInput::None)
|
if (input != ChatInput::None)
|
||||||
{
|
{
|
||||||
chat_input(input);
|
ChatInput(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1637,8 +1637,8 @@ void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords)
|
||||||
int32_t y = mainWindow->savedViewPos.y + viewport->view_height / 2;
|
int32_t y = mainWindow->savedViewPos.y + viewport->view_height / 2;
|
||||||
int32_t y_dy = mainWindow->savedViewPos.y + viewport->view_height / 2 + dy;
|
int32_t y_dy = mainWindow->savedViewPos.y + viewport->view_height / 2 + dy;
|
||||||
|
|
||||||
auto mapCoord = viewport_coord_to_map_coord({ x, y }, 0);
|
auto mapCoord = ViewportPosToMapPos({ x, y }, 0);
|
||||||
auto mapCoord_dy = viewport_coord_to_map_coord({ x, y_dy }, 0);
|
auto mapCoord_dy = ViewportPosToMapPos({ x, y_dy }, 0);
|
||||||
|
|
||||||
// Check if we're crossing the boundary
|
// Check if we're crossing the boundary
|
||||||
// Clamp to the map minimum value
|
// Clamp to the map minimum value
|
||||||
|
|
|
@ -794,15 +794,15 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
||||||
RegisterShortcut(ShortcutId::InterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", []() { ShortcutLoadGame(); });
|
RegisterShortcut(ShortcutId::InterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", []() { ShortcutLoadGame(); });
|
||||||
RegisterShortcut(ShortcutId::InterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", []() { ShortcutQuickSaveGame(); });
|
RegisterShortcut(ShortcutId::InterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", []() { ShortcutQuickSaveGame(); });
|
||||||
RegisterShortcut(ShortcutId::InterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
|
RegisterShortcut(ShortcutId::InterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
|
||||||
RegisterShortcut(ShortcutId::InterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", []() { screenshot_giant(); });
|
RegisterShortcut(ShortcutId::InterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", []() { ScreenshotGiant(); });
|
||||||
RegisterShortcut(ShortcutId::InterfaceMute, STR_SHORTCUT_MUTE_SOUND, []() { OpenRCT2::Audio::ToggleAllSounds(); });
|
RegisterShortcut(ShortcutId::InterfaceMute, STR_SHORTCUT_MUTE_SOUND, []() { OpenRCT2::Audio::ToggleAllSounds(); });
|
||||||
RegisterShortcut(ShortcutId::InterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, []() { ShortcutToggleClearanceChecks(); });
|
RegisterShortcut(ShortcutId::InterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, []() { ShortcutToggleClearanceChecks(); });
|
||||||
RegisterShortcut(ShortcutId::MultiplayerChat, STR_SEND_MESSAGE, "C", []() {
|
RegisterShortcut(ShortcutId::MultiplayerChat, STR_SEND_MESSAGE, "C", []() {
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||||
{
|
{
|
||||||
if (chat_available())
|
if (ChatAvailable())
|
||||||
{
|
{
|
||||||
chat_toggle();
|
ChatToggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
|
||||||
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gEditorStep != EditorStep::RollercoasterDesigner)
|
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gEditorStep != EditorStep::RollercoasterDesigner)
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
info = get_map_coordinates_from_pos(
|
info = GetMapCoordinatesFromPos(
|
||||||
screenCoords,
|
screenCoords,
|
||||||
EnumsToFlags(ViewportInteractionItem::Entity, ViewportInteractionItem::Ride, ViewportInteractionItem::ParkEntrance));
|
EnumsToFlags(ViewportInteractionItem::Entity, ViewportInteractionItem::Ride, ViewportInteractionItem::ParkEntrance));
|
||||||
auto tileElement = info.SpriteType != ViewportInteractionItem::Entity ? info.Element : nullptr;
|
auto tileElement = info.SpriteType != ViewportInteractionItem::Entity ? info.Element : nullptr;
|
||||||
|
@ -257,7 +257,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
|
||||||
|
|
||||||
constexpr auto flags = static_cast<int32_t>(
|
constexpr auto flags = static_cast<int32_t>(
|
||||||
~EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
~EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
||||||
info = get_map_coordinates_from_pos(screenCoords, flags);
|
info = GetMapCoordinatesFromPos(screenCoords, flags);
|
||||||
auto tileElement = info.Element;
|
auto tileElement = info.Element;
|
||||||
|
|
||||||
switch (info.SpriteType)
|
switch (info.SpriteType)
|
||||||
|
@ -768,7 +768,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
auto viewport = window->viewport;
|
auto viewport = window->viewport;
|
||||||
auto info = get_map_coordinates_from_pos_window(
|
auto info = GetMapCoordinatesFromPosWindow(
|
||||||
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
||||||
auto initialPos = info.Loc;
|
auto initialPos = info.Loc;
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
|
||||||
{
|
{
|
||||||
z = TileElementHeight(mapPos);
|
z = TileElementHeight(mapPos);
|
||||||
}
|
}
|
||||||
mapPos = viewport_coord_to_map_coord(initialVPPos, z);
|
mapPos = ViewportPosToMapPos(initialVPPos, z);
|
||||||
mapPos.x = std::clamp(mapPos.x, initialPos.x, initialPos.x + 31);
|
mapPos.x = std::clamp(mapPos.x, initialPos.x, initialPos.x + 31);
|
||||||
mapPos.y = std::clamp(mapPos.y, initialPos.y, initialPos.y + 31);
|
mapPos.y = std::clamp(mapPos.y, initialPos.y, initialPos.y + 31);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ namespace OpenRCT2::Scripting
|
||||||
if (dukHandler.is_function())
|
if (dukHandler.is_function())
|
||||||
{
|
{
|
||||||
auto ctx = dukHandler.context();
|
auto ctx = dukHandler.context();
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, Filter);
|
auto info = GetMapCoordinatesFromPos(screenCoords, Filter);
|
||||||
|
|
||||||
DukObject obj(dukHandler.context());
|
DukObject obj(dukHandler.context());
|
||||||
obj.Set("isDown", MouseDown);
|
obj.Set("isDown", MouseDown);
|
||||||
|
|
|
@ -803,7 +803,7 @@ namespace OpenRCT2::Ui::Windows
|
||||||
auto wheight = viewportWidget->height() - 1;
|
auto wheight = viewportWidget->height() - 1;
|
||||||
if (viewport == nullptr)
|
if (viewport == nullptr)
|
||||||
{
|
{
|
||||||
viewport_create(this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0)));
|
ViewportCreate(this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0)));
|
||||||
flags |= WF_NO_SCROLLING;
|
flags |= WF_NO_SCROLLING;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace OpenRCT2::Scripting
|
||||||
|
|
||||||
int32_t rotation_get() const
|
int32_t rotation_get() const
|
||||||
{
|
{
|
||||||
return get_current_rotation();
|
return GetCurrentRotation();
|
||||||
}
|
}
|
||||||
void rotation_set(int32_t value)
|
void rotation_set(int32_t value)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ namespace OpenRCT2::Scripting
|
||||||
auto w = GetWindow();
|
auto w = GetWindow();
|
||||||
if (w != nullptr)
|
if (w != nullptr)
|
||||||
{
|
{
|
||||||
while (get_current_rotation() != value)
|
while (GetCurrentRotation() != value)
|
||||||
{
|
{
|
||||||
WindowRotateCamera(*w, 1);
|
WindowRotateCamera(*w, 1);
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ namespace OpenRCT2::Scripting
|
||||||
if (viewport != nullptr)
|
if (viewport != nullptr)
|
||||||
{
|
{
|
||||||
auto centre = viewport->viewPos + ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 };
|
auto centre = viewport->viewPos + ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 };
|
||||||
auto coords = viewport_coord_to_map_coord(centre, 24);
|
auto coords = ViewportPosToMapPos(centre, 24);
|
||||||
|
|
||||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||||
auto obj = duk_push_object(ctx);
|
auto obj = duk_push_object(ctx);
|
||||||
|
@ -203,7 +203,7 @@ namespace OpenRCT2::Scripting
|
||||||
auto coords = GetCoordsFromObject(position);
|
auto coords = GetCoordsFromObject(position);
|
||||||
if (coords)
|
if (coords)
|
||||||
{
|
{
|
||||||
auto screenCoords = Translate3DTo2DWithZ(get_current_rotation(), *coords);
|
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), *coords);
|
||||||
auto left = screenCoords.x - (viewport->view_width / 2);
|
auto left = screenCoords.x - (viewport->view_width / 2);
|
||||||
auto top = screenCoords.y - (viewport->view_height / 2);
|
auto top = screenCoords.y - (viewport->view_height / 2);
|
||||||
SetViewLeftTop(left, top);
|
SetViewLeftTop(left, top);
|
||||||
|
|
|
@ -78,7 +78,7 @@ private:
|
||||||
void CreateViewport()
|
void CreateViewport()
|
||||||
{
|
{
|
||||||
Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
|
Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
|
||||||
viewport_create(
|
ViewportCreate(
|
||||||
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
|
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
|
||||||
(viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos));
|
(viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos));
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,7 @@ public:
|
||||||
|
|
||||||
// Close any other open windows such as options/colour schemes to prevent a crash.
|
// Close any other open windows such as options/colour schemes to prevent a crash.
|
||||||
WindowCloseAll();
|
WindowCloseAll();
|
||||||
// window_close(*w);
|
// WindowClose(*w);
|
||||||
|
|
||||||
// This function calls window_track_list_open
|
// This function calls window_track_list_open
|
||||||
ManageTracks();
|
ManageTracks();
|
||||||
|
|
|
@ -168,7 +168,7 @@ public:
|
||||||
|
|
||||||
WindowInitScrollWidgets(*this);
|
WindowInitScrollWidgets(*this);
|
||||||
WindowPushOthersRight(*this);
|
WindowPushOthersRight(*this);
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
|
|
||||||
ToolCancel();
|
ToolCancel();
|
||||||
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND;
|
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND;
|
||||||
|
@ -181,11 +181,11 @@ public:
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
FootpathProvisionalUpdate();
|
FootpathProvisionalUpdate();
|
||||||
viewport_set_visibility(0);
|
ViewportSetVisibility(0);
|
||||||
MapInvalidateMapSelectionTiles();
|
MapInvalidateMapSelectionTiles();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||||
WindowInvalidateByClass(WindowClass::TopToolbar);
|
WindowInvalidateByClass(WindowClass::TopToolbar);
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnUpdate() override
|
void OnUpdate() override
|
||||||
|
@ -194,7 +194,7 @@ public:
|
||||||
WindowFootpathUpdateProvisionalPathForBridgeMode();
|
WindowFootpathUpdateProvisionalPathForBridgeMode();
|
||||||
|
|
||||||
// #2502: The camera might have changed rotation, so we need to update which directional buttons are pressed
|
// #2502: The camera might have changed rotation, so we need to update which directional buttons are pressed
|
||||||
uint8_t currentRotation = get_current_rotation();
|
uint8_t currentRotation = GetCurrentRotation();
|
||||||
if (_lastUpdatedCameraRotation != currentRotation)
|
if (_lastUpdatedCameraRotation != currentRotation)
|
||||||
{
|
{
|
||||||
_lastUpdatedCameraRotation = currentRotation;
|
_lastUpdatedCameraRotation = currentRotation;
|
||||||
|
@ -438,7 +438,7 @@ public:
|
||||||
if (!IsWidgetDisabled(WIDX_CONSTRUCT))
|
if (!IsWidgetDisabled(WIDX_CONSTRUCT))
|
||||||
{
|
{
|
||||||
// Get construction image
|
// Get construction image
|
||||||
uint8_t direction = (_footpathConstructDirection + get_current_rotation()) % 4;
|
uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % 4;
|
||||||
uint8_t slope = 0;
|
uint8_t slope = 0;
|
||||||
if (gFootpathConstructSlope == 2)
|
if (gFootpathConstructSlope == 2)
|
||||||
{
|
{
|
||||||
|
@ -750,7 +750,7 @@ private:
|
||||||
void WindowFootpathMousedownDirection(int32_t direction)
|
void WindowFootpathMousedownDirection(int32_t direction)
|
||||||
{
|
{
|
||||||
FootpathProvisionalUpdate();
|
FootpathProvisionalUpdate();
|
||||||
_footpathConstructDirection = (direction - get_current_rotation()) & 3;
|
_footpathConstructDirection = (direction - GetCurrentRotation()) & 3;
|
||||||
_windowFootpathCost = MONEY32_UNDEFINED;
|
_windowFootpathCost = MONEY32_UNDEFINED;
|
||||||
WindowFootpathSetEnabledAndPressedWidgets();
|
WindowFootpathSetEnabledAndPressedWidgets();
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ private:
|
||||||
MapInvalidateSelectionRect();
|
MapInvalidateSelectionRect();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||||
|
|
||||||
auto info = get_map_coordinates_from_pos(
|
auto info = GetMapCoordinatesFromPos(
|
||||||
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
|
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
|
||||||
|
@ -902,7 +902,7 @@ private:
|
||||||
|
|
||||||
FootpathProvisionalUpdate();
|
FootpathProvisionalUpdate();
|
||||||
|
|
||||||
const auto info = get_map_coordinates_from_pos(
|
const auto info = GetMapCoordinatesFromPos(
|
||||||
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
|
@ -1048,7 +1048,7 @@ private:
|
||||||
|
|
||||||
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||||
{
|
{
|
||||||
viewport_set_visibility(1);
|
ViewportSetVisibility(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gFootpathConstructFromPosition = footpathLoc;
|
gFootpathConstructFromPosition = footpathLoc;
|
||||||
|
@ -1211,7 +1211,7 @@ private:
|
||||||
& ~((1LL << WIDX_DIRECTION_NW) | (1LL << WIDX_DIRECTION_NE) | (1LL << WIDX_DIRECTION_SW)
|
& ~((1LL << WIDX_DIRECTION_NW) | (1LL << WIDX_DIRECTION_NE) | (1LL << WIDX_DIRECTION_SW)
|
||||||
| (1LL << WIDX_DIRECTION_SE) | (1LL << WIDX_SLOPEDOWN) | (1LL << WIDX_LEVEL) | (1LL << WIDX_SLOPEUP));
|
| (1LL << WIDX_DIRECTION_SE) | (1LL << WIDX_SLOPEDOWN) | (1LL << WIDX_LEVEL) | (1LL << WIDX_SLOPEUP));
|
||||||
uint64_t disabledWidgets = 0;
|
uint64_t disabledWidgets = 0;
|
||||||
int32_t currentRotation = get_current_rotation();
|
int32_t currentRotation = GetCurrentRotation();
|
||||||
if (_footpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL)
|
if (_footpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL)
|
||||||
{
|
{
|
||||||
// Set pressed directional widget
|
// Set pressed directional widget
|
||||||
|
@ -1306,7 +1306,7 @@ public:
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t currentRotation = get_current_rotation();
|
int32_t currentRotation = GetCurrentRotation();
|
||||||
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? 1 : -1);
|
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? 1 : -1);
|
||||||
WindowFootpathMousedownDirection(turnedRotation);
|
WindowFootpathMousedownDirection(turnedRotation);
|
||||||
}
|
}
|
||||||
|
@ -1318,7 +1318,7 @@ public:
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t currentRotation = get_current_rotation();
|
int32_t currentRotation = GetCurrentRotation();
|
||||||
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? -1 : 1);
|
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? -1 : 1);
|
||||||
WindowFootpathMousedownDirection(turnedRotation);
|
WindowFootpathMousedownDirection(turnedRotation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -703,7 +703,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_update_smart_guest_follow(this, peep);
|
ViewportUpdateSmartFollowGuest(this, peep);
|
||||||
bool reCreateViewport = false;
|
bool reCreateViewport = false;
|
||||||
uint16_t origViewportFlags{};
|
uint16_t origViewportFlags{};
|
||||||
if (viewport != nullptr)
|
if (viewport != nullptr)
|
||||||
|
@ -726,7 +726,7 @@ private:
|
||||||
int32_t widgWidth = viewWidget.width() - 1;
|
int32_t widgWidth = viewWidget.width() - 1;
|
||||||
int32_t widgHeight = viewWidget.height() - 1;
|
int32_t widgHeight = viewWidget.height() - 1;
|
||||||
|
|
||||||
viewport_create(this, screenPos, widgWidth, widgHeight, focus.value());
|
ViewportCreate(this, screenPos, widgWidth, widgHeight, focus.value());
|
||||||
if (viewport != nullptr && reCreateViewport)
|
if (viewport != nullptr && reCreateViewport)
|
||||||
{
|
{
|
||||||
viewport->flags = origViewportFlags;
|
viewport->flags = origViewportFlags;
|
||||||
|
@ -923,7 +923,7 @@ private:
|
||||||
|
|
||||||
gPickupPeepImage = ImageId();
|
gPickupPeepImage = ImageId();
|
||||||
|
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionItemAll);
|
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -66,24 +66,24 @@ public:
|
||||||
|
|
||||||
gLandToolSize = 1;
|
gLandToolSize = 1;
|
||||||
|
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
|
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
|
|
||||||
show_land_rights();
|
ShowLandRights();
|
||||||
|
|
||||||
if (gLandRemainingConstructionSales == 0)
|
if (gLandRemainingConstructionSales == 0)
|
||||||
{
|
{
|
||||||
show_construction_rights();
|
ShowConstructionRights();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
if (gLandRemainingConstructionSales == 0)
|
if (gLandRemainingConstructionSales == 0)
|
||||||
{
|
{
|
||||||
hide_construction_rights();
|
HideConstructionRights();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the tool wasn't changed, turn tool off
|
// If the tool wasn't changed, turn tool off
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
{
|
{
|
||||||
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
|
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
|
||||||
_landRightsMode = LAND_RIGHTS_MODE_BUY_LAND;
|
_landRightsMode = LAND_RIGHTS_MODE_BUY_LAND;
|
||||||
show_land_rights();
|
ShowLandRights();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
{
|
{
|
||||||
ToolSet(*this, WIDX_BUY_CONSTRUCTION_RIGHTS, Tool::UpArrow);
|
ToolSet(*this, WIDX_BUY_CONSTRUCTION_RIGHTS, Tool::UpArrow);
|
||||||
_landRightsMode = LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS;
|
_landRightsMode = LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS;
|
||||||
show_construction_rights();
|
ShowConstructionRights();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
MapInvalidateSelectionRect();
|
MapInvalidateSelectionRect();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||||
|
|
||||||
auto mapTile = screen_get_map_xy(screenCoords, nullptr);
|
auto mapTile = ScreenGetMapXY(screenCoords, nullptr);
|
||||||
|
|
||||||
if (!mapTile.has_value())
|
if (!mapTile.has_value())
|
||||||
{
|
{
|
||||||
|
@ -321,11 +321,11 @@ public:
|
||||||
{
|
{
|
||||||
if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND)
|
if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND)
|
||||||
{
|
{
|
||||||
hide_land_rights();
|
HideLandRights();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hide_construction_rights();
|
HideConstructionRights();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1159,7 +1159,7 @@ static void WindowOverwritePromptMouseup(rct_window* w, WidgetIndex widgetIndex)
|
||||||
Select(_window_overwrite_prompt_path);
|
Select(_window_overwrite_prompt_path);
|
||||||
|
|
||||||
// As the LoadSaveWindow::Select function can change the order of the
|
// As the LoadSaveWindow::Select function can change the order of the
|
||||||
// windows we can't use window_close(w).
|
// windows we can't use WindowClose(w).
|
||||||
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
_mainWidgets[0].bottom = height;
|
_mainWidgets[0].bottom = height;
|
||||||
widgets = _mainWidgets;
|
widgets = _mainWidgets;
|
||||||
|
|
||||||
viewport_create(this, windowPos, width, height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0)));
|
ViewportCreate(this, windowPos, width, height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0)));
|
||||||
if (viewport != nullptr)
|
if (viewport != nullptr)
|
||||||
{
|
{
|
||||||
SetViewportFlags();
|
SetViewportFlags();
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
|
|
||||||
void OnDraw(rct_drawpixelinfo& dpi) override
|
void OnDraw(rct_drawpixelinfo& dpi) override
|
||||||
{
|
{
|
||||||
viewport_render(&dpi, viewport, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } });
|
ViewportRender(&dpi, viewport, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } });
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -154,7 +154,7 @@ public:
|
||||||
|
|
||||||
InitScrollWidgets();
|
InitScrollWidgets();
|
||||||
|
|
||||||
_rotation = get_current_rotation();
|
_rotation = GetCurrentRotation();
|
||||||
|
|
||||||
InitMap();
|
InitMap();
|
||||||
gWindowSceneryRotation = 0;
|
gWindowSceneryRotation = 0;
|
||||||
|
@ -201,9 +201,9 @@ public:
|
||||||
_activeTool = 2;
|
_activeTool = 2;
|
||||||
// Prevent mountain tool size.
|
// Prevent mountain tool size.
|
||||||
_landRightsToolSize = std::max<uint16_t>(MINIMUM_TOOL_SIZE, _landRightsToolSize);
|
_landRightsToolSize = std::max<uint16_t>(MINIMUM_TOOL_SIZE, _landRightsToolSize);
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
show_land_rights();
|
ShowLandRights();
|
||||||
show_construction_rights();
|
ShowConstructionRights();
|
||||||
break;
|
break;
|
||||||
case WIDX_LAND_OWNED_CHECKBOX:
|
case WIDX_LAND_OWNED_CHECKBOX:
|
||||||
_activeTool ^= 2;
|
_activeTool ^= 2;
|
||||||
|
@ -245,9 +245,9 @@ public:
|
||||||
gParkEntranceGhostExists = false;
|
gParkEntranceGhostExists = false;
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
|
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
show_land_rights();
|
ShowLandRights();
|
||||||
show_construction_rights();
|
ShowConstructionRights();
|
||||||
break;
|
break;
|
||||||
case WIDX_ROTATE_90:
|
case WIDX_ROTATE_90:
|
||||||
gWindowSceneryRotation = (gWindowSceneryRotation + 1) & 3;
|
gWindowSceneryRotation = (gWindowSceneryRotation + 1) & 3;
|
||||||
|
@ -256,9 +256,9 @@ public:
|
||||||
if (ToolSet(*this, widgetIndex, Tool::UpArrow))
|
if (ToolSet(*this, widgetIndex, Tool::UpArrow))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
show_land_rights();
|
ShowLandRights();
|
||||||
show_construction_rights();
|
ShowConstructionRights();
|
||||||
break;
|
break;
|
||||||
case WIDX_LAND_TOOL:
|
case WIDX_LAND_TOOL:
|
||||||
InputLandSize();
|
InputLandSize();
|
||||||
|
@ -323,9 +323,9 @@ public:
|
||||||
|
|
||||||
void OnUpdate() override
|
void OnUpdate() override
|
||||||
{
|
{
|
||||||
if (get_current_rotation() != _rotation)
|
if (GetCurrentRotation() != _rotation)
|
||||||
{
|
{
|
||||||
_rotation = get_current_rotation();
|
_rotation = GetCurrentRotation();
|
||||||
InitMap();
|
InitMap();
|
||||||
CentreMapOnViewPoint();
|
CentreMapOnViewPoint();
|
||||||
}
|
}
|
||||||
|
@ -405,22 +405,22 @@ public:
|
||||||
{
|
{
|
||||||
case WIDX_SET_LAND_RIGHTS:
|
case WIDX_SET_LAND_RIGHTS:
|
||||||
Invalidate();
|
Invalidate();
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
hide_land_rights();
|
HideLandRights();
|
||||||
hide_construction_rights();
|
HideConstructionRights();
|
||||||
break;
|
break;
|
||||||
case WIDX_BUILD_PARK_ENTRANCE:
|
case WIDX_BUILD_PARK_ENTRANCE:
|
||||||
ParkEntranceRemoveGhost();
|
ParkEntranceRemoveGhost();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
hide_land_rights();
|
HideLandRights();
|
||||||
hide_construction_rights();
|
HideConstructionRights();
|
||||||
break;
|
break;
|
||||||
case WIDX_PEOPLE_STARTING_POSITION:
|
case WIDX_PEOPLE_STARTING_POSITION:
|
||||||
Invalidate();
|
Invalidate();
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
hide_land_rights();
|
HideLandRights();
|
||||||
hide_construction_rights();
|
HideConstructionRights();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,7 +429,7 @@ public:
|
||||||
{
|
{
|
||||||
MapInvalidateSelectionRect();
|
MapInvalidateSelectionRect();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||||
auto mapCoords = screen_get_map_xy(screenCoords, nullptr);
|
auto mapCoords = ScreenGetMapXY(screenCoords, nullptr);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parkEntranceMapPosition.direction = (gWindowSceneryRotation - get_current_rotation()) & 3;
|
parkEntranceMapPosition.direction = (gWindowSceneryRotation - GetCurrentRotation()) & 3;
|
||||||
return parkEntranceMapPosition;
|
return parkEntranceMapPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ private:
|
||||||
if (mainWindow == nullptr || mainWindow->viewport == nullptr)
|
if (mainWindow == nullptr || mainWindow->viewport == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto offset = MiniMapOffsets[get_current_rotation()];
|
auto offset = MiniMapOffsets[GetCurrentRotation()];
|
||||||
|
|
||||||
// calculate centre view point of viewport and transform it to minimap coordinates
|
// calculate centre view point of viewport and transform it to minimap coordinates
|
||||||
|
|
||||||
|
@ -1001,7 +1001,7 @@ private:
|
||||||
int32_t pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + MAXIMUM_MAP_SIZE_TECHNICAL - 1;
|
int32_t pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + MAXIMUM_MAP_SIZE_TECHNICAL - 1;
|
||||||
auto destinationPosition = ScreenCoordsXY{ pos % MAP_WINDOW_MAP_SIZE, pos / MAP_WINDOW_MAP_SIZE };
|
auto destinationPosition = ScreenCoordsXY{ pos % MAP_WINDOW_MAP_SIZE, pos / MAP_WINDOW_MAP_SIZE };
|
||||||
auto destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x;
|
auto destination = _mapImageData.data() + (destinationPosition.y * MAP_WINDOW_MAP_SIZE) + destinationPosition.x;
|
||||||
switch (get_current_rotation())
|
switch (GetCurrentRotation())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
x = _currentLine * COORDS_XY_STEP;
|
x = _currentLine * COORDS_XY_STEP;
|
||||||
|
@ -1251,7 +1251,7 @@ private:
|
||||||
if (mainViewport == nullptr)
|
if (mainViewport == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto offset = MiniMapOffsets[get_current_rotation()];
|
auto offset = MiniMapOffsets[GetCurrentRotation()];
|
||||||
auto leftTop = ScreenCoordsXY{ (mainViewport->viewPos.x >> 5) + offset.x, (mainViewport->viewPos.y >> 4) + offset.y };
|
auto leftTop = ScreenCoordsXY{ (mainViewport->viewPos.x >> 5) + offset.x, (mainViewport->viewPos.y >> 4) + offset.y };
|
||||||
auto rightBottom = ScreenCoordsXY{ ((mainViewport->viewPos.x + mainViewport->view_width) >> 5) + offset.x,
|
auto rightBottom = ScreenCoordsXY{ ((mainViewport->viewPos.x + mainViewport->view_width) >> 5) + offset.x,
|
||||||
((mainViewport->viewPos.y + mainViewport->view_height) >> 4) + offset.y };
|
((mainViewport->viewPos.y + mainViewport->view_height) >> 4) + offset.y };
|
||||||
|
@ -1345,7 +1345,7 @@ private:
|
||||||
screenCoords.y = ((screenCoords.y + 8)) / 2;
|
screenCoords.y = ((screenCoords.y + 8)) / 2;
|
||||||
auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY();
|
auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY();
|
||||||
|
|
||||||
switch (get_current_rotation())
|
switch (GetCurrentRotation())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return location;
|
return location;
|
||||||
|
@ -1364,7 +1364,7 @@ private:
|
||||||
{
|
{
|
||||||
int32_t x = c.x, y = c.y;
|
int32_t x = c.x, y = c.y;
|
||||||
|
|
||||||
switch (get_current_rotation())
|
switch (GetCurrentRotation())
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
std::swap(x, y);
|
std::swap(x, y);
|
||||||
|
|
|
@ -101,13 +101,13 @@ public:
|
||||||
widgets = window_maze_construction_widgets;
|
widgets = window_maze_construction_widgets;
|
||||||
WindowInitScrollWidgets(*this);
|
WindowInitScrollWidgets(*this);
|
||||||
rideId = _currentRideIndex;
|
rideId = _currentRideIndex;
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
ride_construction_invalidate_current_track();
|
ride_construction_invalidate_current_track();
|
||||||
viewport_set_visibility(0);
|
ViewportSetVisibility(0);
|
||||||
|
|
||||||
MapInvalidateMapSelectionTiles();
|
MapInvalidateMapSelectionTiles();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
// selection tool should be cancelled.
|
// selection tool should be cancelled.
|
||||||
ToolCancel();
|
ToolCancel();
|
||||||
|
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
|
|
||||||
auto currentRide = get_ride(_currentRideIndex);
|
auto currentRide = get_ride(_currentRideIndex);
|
||||||
if (currentRide != nullptr)
|
if (currentRide != nullptr)
|
||||||
|
@ -155,7 +155,7 @@ public:
|
||||||
case WIDX_MAZE_DIRECTION_NE:
|
case WIDX_MAZE_DIRECTION_NE:
|
||||||
case WIDX_MAZE_DIRECTION_SE:
|
case WIDX_MAZE_DIRECTION_SE:
|
||||||
case WIDX_MAZE_DIRECTION_SW:
|
case WIDX_MAZE_DIRECTION_SW:
|
||||||
WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - get_current_rotation()) & 3);
|
WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - GetCurrentRotation()) & 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,7 +642,7 @@ private:
|
||||||
if (viewport == nullptr)
|
if (viewport == nullptr)
|
||||||
{
|
{
|
||||||
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
|
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
|
||||||
viewport_create(
|
ViewportCreate(
|
||||||
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
|
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
|
||||||
viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value());
|
viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value());
|
||||||
flags |= WF_NO_SCROLLING;
|
flags |= WF_NO_SCROLLING;
|
||||||
|
|
|
@ -189,7 +189,7 @@ public:
|
||||||
|
|
||||||
void OnToolAbort(WidgetIndex widgetIndex) override
|
void OnToolAbort(WidgetIndex widgetIndex) override
|
||||||
{
|
{
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
ClearPatrolAreaToRender();
|
ClearPatrolAreaToRender();
|
||||||
GfxInvalidateScreen();
|
GfxInvalidateScreen();
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ private:
|
||||||
{
|
{
|
||||||
if (!ToolSet(*this, 0, Tool::WalkDown))
|
if (!ToolSet(*this, 0, Tool::WalkDown))
|
||||||
{
|
{
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
SetPatrolAreaToRender(_staffId);
|
SetPatrolAreaToRender(_staffId);
|
||||||
GfxInvalidateScreen();
|
GfxInvalidateScreen();
|
||||||
|
|
|
@ -292,9 +292,9 @@ void WindowPlayerOverviewUpdate(rct_window* w)
|
||||||
bool scroll = true;
|
bool scroll = true;
|
||||||
|
|
||||||
// Use this spare window field for rotation check
|
// Use this spare window field for rotation check
|
||||||
if (w->var_4AE != get_current_rotation())
|
if (w->var_4AE != GetCurrentRotation())
|
||||||
{
|
{
|
||||||
w->var_4AE = get_current_rotation();
|
w->var_4AE = GetCurrentRotation();
|
||||||
scroll = false;
|
scroll = false;
|
||||||
}
|
}
|
||||||
WindowPlayerUpdateViewport(w, scroll);
|
WindowPlayerUpdateViewport(w, scroll);
|
||||||
|
@ -521,7 +521,7 @@ static void WindowPlayerSetPage(rct_window* w, int32_t page)
|
||||||
if (w->viewport == nullptr)
|
if (w->viewport == nullptr)
|
||||||
{
|
{
|
||||||
const auto focus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ());
|
const auto focus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ());
|
||||||
viewport_create(w, w->windowPos, w->width, w->height, focus);
|
ViewportCreate(w, w->windowPos, w->width, w->height, focus);
|
||||||
w->flags |= WF_NO_SCROLLING;
|
w->flags |= WF_NO_SCROLLING;
|
||||||
WindowEventInvalidateCall(w);
|
WindowEventInvalidateCall(w);
|
||||||
WindowPlayerUpdateViewport(w, false);
|
WindowPlayerUpdateViewport(w, false);
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ static void WindowRideInitViewport(rct_window* w)
|
||||||
int32_t width = view_widget.width() - 1;
|
int32_t width = view_widget.width() - 1;
|
||||||
int32_t height = view_widget.height() - 1;
|
int32_t height = view_widget.height() - 1;
|
||||||
|
|
||||||
viewport_create(w, screenPos, width, height, w->focus.value());
|
ViewportCreate(w, screenPos, width, height, w->focus.value());
|
||||||
|
|
||||||
w->flags |= WF_NO_SCROLLING;
|
w->flags |= WF_NO_SCROLLING;
|
||||||
w->Invalidate();
|
w->Invalidate();
|
||||||
|
@ -4248,7 +4248,7 @@ static int32_t WindowRideHasTrackColour(const Ride& ride, int32_t trackColour)
|
||||||
static void WindowRideSetTrackColourScheme(rct_window* w, const ScreenCoordsXY& screenPos)
|
static void WindowRideSetTrackColourScheme(rct_window* w, const ScreenCoordsXY& screenPos)
|
||||||
{
|
{
|
||||||
auto newColourScheme = static_cast<uint8_t>(w->ride_colour);
|
auto newColourScheme = static_cast<uint8_t>(w->ride_colour);
|
||||||
auto info = get_map_coordinates_from_pos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride));
|
auto info = GetMapCoordinatesFromPos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride));
|
||||||
|
|
||||||
if (info.SpriteType != ViewportInteractionItem::Ride)
|
if (info.SpriteType != ViewportInteractionItem::Ride)
|
||||||
return;
|
return;
|
||||||
|
@ -5514,7 +5514,7 @@ static void WindowRideMeasurementsTooldown(rct_window* w, WidgetIndex widgetInde
|
||||||
constexpr auto flags = EnumsToFlags(
|
constexpr auto flags = EnumsToFlags(
|
||||||
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
||||||
ViewportInteractionItem::LargeScenery);
|
ViewportInteractionItem::LargeScenery);
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, flags);
|
auto info = GetMapCoordinatesFromPos(screenCoords, flags);
|
||||||
switch (info.SpriteType)
|
switch (info.SpriteType)
|
||||||
{
|
{
|
||||||
case ViewportInteractionItem::Scenery:
|
case ViewportInteractionItem::Scenery:
|
||||||
|
@ -5539,7 +5539,7 @@ static void WindowRideMeasurementsTooldrag(rct_window* w, WidgetIndex widgetInde
|
||||||
auto flags = EnumsToFlags(
|
auto flags = EnumsToFlags(
|
||||||
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
|
||||||
ViewportInteractionItem::LargeScenery);
|
ViewportInteractionItem::LargeScenery);
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, flags);
|
auto info = GetMapCoordinatesFromPos(screenCoords, flags);
|
||||||
switch (info.SpriteType)
|
switch (info.SpriteType)
|
||||||
{
|
{
|
||||||
case ViewportInteractionItem::Scenery:
|
case ViewportInteractionItem::Scenery:
|
||||||
|
|
|
@ -213,7 +213,7 @@ public:
|
||||||
InitScrollWidgets();
|
InitScrollWidgets();
|
||||||
|
|
||||||
WindowPushOthersRight(*this);
|
WindowPushOthersRight(*this);
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
|
|
||||||
_currentTrackPrice = MONEY32_UNDEFINED;
|
_currentTrackPrice = MONEY32_UNDEFINED;
|
||||||
_currentBrakeSpeed2 = 8;
|
_currentBrakeSpeed2 = 8;
|
||||||
|
@ -243,7 +243,7 @@ public:
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
ride_construction_invalidate_current_track();
|
ride_construction_invalidate_current_track();
|
||||||
viewport_set_visibility(0);
|
ViewportSetVisibility(0);
|
||||||
|
|
||||||
MapInvalidateMapSelectionTiles();
|
MapInvalidateMapSelectionTiles();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||||
|
@ -255,7 +255,7 @@ public:
|
||||||
if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number)
|
if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number)
|
||||||
ToolCancel();
|
ToolCancel();
|
||||||
|
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
|
|
||||||
// If we demolish a currentRide all windows will be closed including the construction window,
|
// If we demolish a currentRide all windows will be closed including the construction window,
|
||||||
// the currentRide at this point is already gone.
|
// the currentRide at this point is already gone.
|
||||||
|
@ -2275,14 +2275,14 @@ private:
|
||||||
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
||||||
if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||||
{
|
{
|
||||||
viewport_set_visibility(1);
|
ViewportSetVisibility(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected)
|
const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected)
|
||||||
&& TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected);
|
&& TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected);
|
||||||
if (helixSelected || (_currentTrackSlopeEnd != TRACK_SLOPE_NONE))
|
if (helixSelected || (_currentTrackSlopeEnd != TRACK_SLOPE_NONE))
|
||||||
{
|
{
|
||||||
viewport_set_visibility(2);
|
ViewportSetVisibility(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2620,7 +2620,7 @@ private:
|
||||||
int16_t previewZOffset = ted.Definition.preview_z_offset;
|
int16_t previewZOffset = ted.Definition.preview_z_offset;
|
||||||
mapCoords.z -= previewZOffset;
|
mapCoords.z -= previewZOffset;
|
||||||
|
|
||||||
const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(get_current_rotation(), mapCoords);
|
const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), mapCoords);
|
||||||
|
|
||||||
dpi->x += rotatedScreenCoords.x - widgetWidth / 2;
|
dpi->x += rotatedScreenCoords.x - widgetWidth / 2;
|
||||||
dpi->y += rotatedScreenCoords.y - widgetHeight / 2 - 16;
|
dpi->y += rotatedScreenCoords.y - widgetHeight / 2 - 16;
|
||||||
|
@ -2930,7 +2930,7 @@ static std::optional<CoordsXY> RideGetPlacePositionFromScreenPosition(ScreenCoor
|
||||||
{
|
{
|
||||||
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)
|
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)
|
||||||
{
|
{
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, 0xFCCA);
|
auto info = GetMapCoordinatesFromPos(screenCoords, 0xFCCA);
|
||||||
if (info.SpriteType != ViewportInteractionItem::None)
|
if (info.SpriteType != ViewportInteractionItem::None)
|
||||||
{
|
{
|
||||||
_trackPlaceCtrlZ = info.Element->GetBaseZ();
|
_trackPlaceCtrlZ = info.Element->GetBaseZ();
|
||||||
|
@ -3002,7 +3002,7 @@ static std::optional<CoordsXY> RideGetPlacePositionFromScreenPosition(ScreenCoor
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto mapZ = _trackPlaceCtrlZ;
|
auto mapZ = _trackPlaceCtrlZ;
|
||||||
auto mapXYCoords = screen_get_map_xy_with_z(screenCoords, mapZ);
|
auto mapXYCoords = ScreenGetMapXYWithZ(screenCoords, mapZ);
|
||||||
if (mapXYCoords.has_value())
|
if (mapXYCoords.has_value())
|
||||||
{
|
{
|
||||||
mapCoords = mapXYCoords.value();
|
mapCoords = mapXYCoords.value();
|
||||||
|
|
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
InitScrollWidgets();
|
InitScrollWidgets();
|
||||||
ContentUpdateScroll();
|
ContentUpdateScroll();
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
gWindowSceneryRotation = 3;
|
gWindowSceneryRotation = 3;
|
||||||
gSceneryCtrlPressed = false;
|
gSceneryCtrlPressed = false;
|
||||||
gSceneryShiftPressed = false;
|
gSceneryShiftPressed = false;
|
||||||
|
@ -167,8 +167,8 @@ public:
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
SceneryRemoveGhostToolPlacement();
|
SceneryRemoveGhostToolPlacement();
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
viewport_set_visibility(0);
|
ViewportSetVisibility(0);
|
||||||
|
|
||||||
if (gWindowSceneryScatterEnabled)
|
if (gWindowSceneryScatterEnabled)
|
||||||
WindowCloseByClass(WindowClass::SceneryScatter);
|
WindowCloseByClass(WindowClass::SceneryScatter);
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
// Create viewport
|
// Create viewport
|
||||||
Widget& viewportWidget = window_sign_widgets[WIDX_VIEWPORT];
|
Widget& viewportWidget = window_sign_widgets[WIDX_VIEWPORT];
|
||||||
viewport_create(
|
ViewportCreate(
|
||||||
this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1,
|
this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1,
|
||||||
viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ }));
|
viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ }));
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public:
|
||||||
|
|
||||||
// Create viewport
|
// Create viewport
|
||||||
Widget* viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
|
Widget* viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
|
||||||
viewport_create(
|
ViewportCreate(
|
||||||
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1,
|
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1,
|
||||||
viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos }));
|
viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos }));
|
||||||
if (viewport != nullptr)
|
if (viewport != nullptr)
|
||||||
|
|
|
@ -658,7 +658,7 @@ private:
|
||||||
|
|
||||||
gPickupPeepImage = ImageId();
|
gPickupPeepImage = ImageId();
|
||||||
|
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionItemAll);
|
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ private:
|
||||||
int32_t viewportWidth = viewWidget.width() - 1;
|
int32_t viewportWidth = viewWidget.width() - 1;
|
||||||
int32_t viewportHeight = viewWidget.height() - 1;
|
int32_t viewportHeight = viewWidget.height() - 1;
|
||||||
|
|
||||||
viewport_create(this, screenPos, viewportWidth, viewportHeight, focus.value());
|
ViewportCreate(this, screenPos, viewportWidth, viewportHeight, focus.value());
|
||||||
flags |= WF_NO_SCROLLING;
|
flags |= WF_NO_SCROLLING;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON:
|
case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON:
|
||||||
if (!ToolSet(*this, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, Tool::Crosshair))
|
if (!ToolSet(*this, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, Tool::Crosshair))
|
||||||
{
|
{
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
SetPatrolAreaToRender(GetSelectedStaffType());
|
SetPatrolAreaToRender(GetSelectedStaffType());
|
||||||
GfxInvalidateScreen();
|
GfxInvalidateScreen();
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ public:
|
||||||
{
|
{
|
||||||
if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON)
|
if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON)
|
||||||
{
|
{
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
ToolCancel();
|
ToolCancel();
|
||||||
ClearPatrolAreaToRender();
|
ClearPatrolAreaToRender();
|
||||||
GfxInvalidateScreen();
|
GfxInvalidateScreen();
|
||||||
|
|
|
@ -579,7 +579,7 @@ public:
|
||||||
case WIDX_SURFACE_CHECK_CORNER_E:
|
case WIDX_SURFACE_CHECK_CORNER_E:
|
||||||
case WIDX_SURFACE_CHECK_CORNER_S:
|
case WIDX_SURFACE_CHECK_CORNER_S:
|
||||||
case WIDX_SURFACE_CHECK_CORNER_W:
|
case WIDX_SURFACE_CHECK_CORNER_W:
|
||||||
SurfaceToggleCorner(((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - get_current_rotation()) & 3);
|
SurfaceToggleCorner(((widgetIndex - WIDX_SURFACE_CHECK_CORNER_N) + 2 - GetCurrentRotation()) & 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WIDX_SURFACE_CHECK_DIAGONAL:
|
case WIDX_SURFACE_CHECK_DIAGONAL:
|
||||||
|
@ -606,7 +606,7 @@ public:
|
||||||
// 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top
|
// 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top
|
||||||
const int32_t eswn = (widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2;
|
const int32_t eswn = (widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2;
|
||||||
// Transform to world orientation
|
// Transform to world orientation
|
||||||
const int32_t index = (eswn - get_current_rotation()) & 3;
|
const int32_t index = (eswn - GetCurrentRotation()) & 3;
|
||||||
PathToggleEdge(
|
PathToggleEdge(
|
||||||
windowTileInspectorSelectedIndex,
|
windowTileInspectorSelectedIndex,
|
||||||
index + 4); // The corners are stored in the 4 most significant bits, hence the + 4
|
index + 4); // The corners are stored in the 4 most significant bits, hence the + 4
|
||||||
|
@ -621,7 +621,7 @@ public:
|
||||||
// 0 = NE, 1 = SE, 2 = SW, 3 = NW
|
// 0 = NE, 1 = SE, 2 = SW, 3 = NW
|
||||||
const int32_t neseswnw = (widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2;
|
const int32_t neseswnw = (widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2;
|
||||||
// Transform to world orientation
|
// Transform to world orientation
|
||||||
const int32_t index = (neseswnw - get_current_rotation()) & 3;
|
const int32_t index = (neseswnw - GetCurrentRotation()) & 3;
|
||||||
PathToggleEdge(windowTileInspectorSelectedIndex, index);
|
PathToggleEdge(windowTileInspectorSelectedIndex, index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -931,14 +931,14 @@ public:
|
||||||
bool mouseOnViewport = false;
|
bool mouseOnViewport = false;
|
||||||
if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z))
|
if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z))
|
||||||
{
|
{
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionFlags);
|
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags);
|
||||||
clickedElement = info.Element;
|
clickedElement = info.Element;
|
||||||
mapCoords = info.Loc;
|
mapCoords = info.Loc;
|
||||||
}
|
}
|
||||||
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
|
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
|
||||||
if (clickedElement == nullptr)
|
if (clickedElement == nullptr)
|
||||||
{
|
{
|
||||||
auto mouseCoords = screen_pos_to_map_pos(screenCoords, nullptr);
|
auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr);
|
||||||
if (mouseCoords.has_value())
|
if (mouseCoords.has_value())
|
||||||
{
|
{
|
||||||
mouseOnViewport = true;
|
mouseOnViewport = true;
|
||||||
|
@ -1729,7 +1729,7 @@ private:
|
||||||
TileElement* clickedElement = nullptr;
|
TileElement* clickedElement = nullptr;
|
||||||
if (ctrlIsHeldDown)
|
if (ctrlIsHeldDown)
|
||||||
{
|
{
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionFlags);
|
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags);
|
||||||
clickedElement = info.Element;
|
clickedElement = info.Element;
|
||||||
mapCoords = info.Loc;
|
mapCoords = info.Loc;
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1737,7 @@ private:
|
||||||
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
|
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
|
||||||
if (clickedElement == nullptr)
|
if (clickedElement == nullptr)
|
||||||
{
|
{
|
||||||
auto mouseCoords = screen_pos_to_map_pos(screenCoords, nullptr);
|
auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr);
|
||||||
if (!mouseCoords.has_value())
|
if (!mouseCoords.has_value())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1933,7 +1933,7 @@ private:
|
||||||
// quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
|
// quarterIndex is widget index relative to WIDX_SCENERY_CHECK_QUARTER_N, so a value from 0-3
|
||||||
openrct2_assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range");
|
openrct2_assert(quarterIndex >= 0 && quarterIndex < 4, "quarterIndex out of range");
|
||||||
auto modifyTile = TileModifyAction(
|
auto modifyTile = TileModifyAction(
|
||||||
_toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - get_current_rotation()) & 3);
|
_toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - GetCurrentRotation()) & 3);
|
||||||
GameActions::Execute(&modifyTile);
|
GameActions::Execute(&modifyTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,8 +1941,7 @@ private:
|
||||||
void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex)
|
void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex)
|
||||||
{
|
{
|
||||||
auto modifyTile = TileModifyAction(
|
auto modifyTile = TileModifyAction(
|
||||||
_toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex,
|
_toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex, (quadrantIndex + 2 - GetCurrentRotation()) & 3);
|
||||||
(quadrantIndex + 2 - get_current_rotation()) & 3);
|
|
||||||
GameActions::Execute(&modifyTile);
|
GameActions::Execute(&modifyTile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1950,7 +1949,7 @@ private:
|
||||||
{
|
{
|
||||||
openrct2_assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range");
|
openrct2_assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range");
|
||||||
// Make edgeIndex abstract
|
// Make edgeIndex abstract
|
||||||
edgeIndex = (edgeIndex - get_current_rotation()) & 3;
|
edgeIndex = (edgeIndex - GetCurrentRotation()) & 3;
|
||||||
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
|
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
|
||||||
GameActions::Execute(&modifyTile);
|
GameActions::Execute(&modifyTile);
|
||||||
}
|
}
|
||||||
|
@ -2104,16 +2103,16 @@ private:
|
||||||
widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13;
|
widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13;
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_SURFACE_CHECK_CORNER_N,
|
WIDX_SURFACE_CHECK_CORNER_N,
|
||||||
tileElement->AsSurface()->GetSlope() & (1 << ((2 - get_current_rotation()) & 3)));
|
tileElement->AsSurface()->GetSlope() & (1 << ((2 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_SURFACE_CHECK_CORNER_E,
|
WIDX_SURFACE_CHECK_CORNER_E,
|
||||||
tileElement->AsSurface()->GetSlope() & (1 << ((3 - get_current_rotation()) & 3)));
|
tileElement->AsSurface()->GetSlope() & (1 << ((3 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_SURFACE_CHECK_CORNER_S,
|
WIDX_SURFACE_CHECK_CORNER_S,
|
||||||
tileElement->AsSurface()->GetSlope() & (1 << ((0 - get_current_rotation()) & 3)));
|
tileElement->AsSurface()->GetSlope() & (1 << ((0 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_SURFACE_CHECK_CORNER_W,
|
WIDX_SURFACE_CHECK_CORNER_W,
|
||||||
tileElement->AsSurface()->GetSlope() & (1 << ((1 - get_current_rotation()) & 3)));
|
tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT);
|
WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT);
|
||||||
break;
|
break;
|
||||||
|
@ -2148,21 +2147,21 @@ private:
|
||||||
SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped());
|
SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped());
|
||||||
SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken());
|
SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken());
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_NE, tileElement->AsPath()->GetEdges() & (1 << ((0 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_NE, tileElement->AsPath()->GetEdges() & (1 << ((0 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_SE, tileElement->AsPath()->GetEdges() & (1 << ((1 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_SE, tileElement->AsPath()->GetEdges() & (1 << ((1 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_SW, tileElement->AsPath()->GetEdges() & (1 << ((2 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_SW, tileElement->AsPath()->GetEdges() & (1 << ((2 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_NW, tileElement->AsPath()->GetEdges() & (1 << ((3 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_NW, tileElement->AsPath()->GetEdges() & (1 << ((3 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_E, tileElement->AsPath()->GetCorners() & (1 << ((0 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_E, tileElement->AsPath()->GetCorners() & (1 << ((0 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_S, tileElement->AsPath()->GetCorners() & (1 << ((1 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_S, tileElement->AsPath()->GetCorners() & (1 << ((1 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_W, tileElement->AsPath()->GetCorners() & (1 << ((2 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_W, tileElement->AsPath()->GetCorners() & (1 << ((2 - GetCurrentRotation()) & 3)));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_PATH_CHECK_EDGE_N, tileElement->AsPath()->GetCorners() & (1 << ((3 - get_current_rotation()) & 3)));
|
WIDX_PATH_CHECK_EDGE_N, tileElement->AsPath()->GetCorners() & (1 << ((3 - GetCurrentRotation()) & 3)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TileElementType::Track:
|
case TileElementType::Track:
|
||||||
|
@ -2209,10 +2208,10 @@ private:
|
||||||
widgets[WIDX_SCENERY_CHECK_QUARTER_W].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1;
|
widgets[WIDX_SCENERY_CHECK_QUARTER_W].top = GBBT(propertiesAnchor, 1) - 5 + 7 * 1;
|
||||||
widgets[WIDX_SCENERY_CHECK_QUARTER_W].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_W].top + 13;
|
widgets[WIDX_SCENERY_CHECK_QUARTER_W].bottom = widgets[WIDX_SCENERY_CHECK_QUARTER_W].top + 13;
|
||||||
// This gets the relative rotation, by subtracting the camera's rotation, and wrapping it between 0-3 inclusive
|
// This gets the relative rotation, by subtracting the camera's rotation, and wrapping it between 0-3 inclusive
|
||||||
bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - get_current_rotation()) & 3);
|
bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - GetCurrentRotation()) & 3);
|
||||||
bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - get_current_rotation()) & 3);
|
bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - GetCurrentRotation()) & 3);
|
||||||
bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - get_current_rotation()) & 3);
|
bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - GetCurrentRotation()) & 3);
|
||||||
bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - get_current_rotation()) & 3);
|
bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - GetCurrentRotation()) & 3);
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N);
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E);
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_S, S);
|
||||||
|
@ -2228,10 +2227,10 @@ private:
|
||||||
widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1;
|
widgets[WIDX_SCENERY_CHECK_COLLISION_W].top = GBBT(propertiesAnchor, 2) + 5 + 7 * 1;
|
||||||
widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13;
|
widgets[WIDX_SCENERY_CHECK_COLLISION_W].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13;
|
||||||
auto occupiedQuadrants = tileElement->GetOccupiedQuadrants();
|
auto occupiedQuadrants = tileElement->GetOccupiedQuadrants();
|
||||||
N = (occupiedQuadrants & (1 << ((2 - get_current_rotation()) & 3))) != 0;
|
N = (occupiedQuadrants & (1 << ((2 - GetCurrentRotation()) & 3))) != 0;
|
||||||
E = (occupiedQuadrants & (1 << ((3 - get_current_rotation()) & 3))) != 0;
|
E = (occupiedQuadrants & (1 << ((3 - GetCurrentRotation()) & 3))) != 0;
|
||||||
S = (occupiedQuadrants & (1 << ((0 - get_current_rotation()) & 3))) != 0;
|
S = (occupiedQuadrants & (1 << ((0 - GetCurrentRotation()) & 3))) != 0;
|
||||||
W = (occupiedQuadrants & (1 << ((1 - get_current_rotation()) & 3))) != 0;
|
W = (occupiedQuadrants & (1 << ((1 - GetCurrentRotation()) & 3))) != 0;
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N);
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E);
|
||||||
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S);
|
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S);
|
||||||
|
@ -2320,16 +2319,16 @@ private:
|
||||||
widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1);
|
widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1);
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_BANNER_CHECK_BLOCK_NE,
|
WIDX_BANNER_CHECK_BLOCK_NE,
|
||||||
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - get_current_rotation()) & 3))));
|
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - GetCurrentRotation()) & 3))));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_BANNER_CHECK_BLOCK_SE,
|
WIDX_BANNER_CHECK_BLOCK_SE,
|
||||||
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - get_current_rotation()) & 3))));
|
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - GetCurrentRotation()) & 3))));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_BANNER_CHECK_BLOCK_SW,
|
WIDX_BANNER_CHECK_BLOCK_SW,
|
||||||
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - get_current_rotation()) & 3))));
|
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - GetCurrentRotation()) & 3))));
|
||||||
SetCheckboxValue(
|
SetCheckboxValue(
|
||||||
WIDX_BANNER_CHECK_BLOCK_NW,
|
WIDX_BANNER_CHECK_BLOCK_NW,
|
||||||
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - get_current_rotation()) & 3))));
|
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - GetCurrentRotation()) & 3))));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -419,9 +419,9 @@ static void WindowTopToolbarMouseup(rct_window* w, WidgetIndex widgetIndex)
|
||||||
OpenRCT2::Audio::ToggleAllSounds();
|
OpenRCT2::Audio::ToggleAllSounds();
|
||||||
break;
|
break;
|
||||||
case WIDX_CHAT:
|
case WIDX_CHAT:
|
||||||
if (chat_available())
|
if (ChatAvailable())
|
||||||
{
|
{
|
||||||
chat_toggle();
|
ChatToggle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -602,7 +602,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int
|
||||||
gScreenshotCountdown = 10;
|
gScreenshotCountdown = 10;
|
||||||
break;
|
break;
|
||||||
case DDIDX_GIANT_SCREENSHOT:
|
case DDIDX_GIANT_SCREENSHOT:
|
||||||
screenshot_giant();
|
ScreenshotGiant();
|
||||||
break;
|
break;
|
||||||
case DDIDX_FILE_BUG_ON_GITHUB:
|
case DDIDX_FILE_BUG_ON_GITHUB:
|
||||||
{
|
{
|
||||||
|
@ -840,7 +840,7 @@ static void WindowTopToolbarInvalidate(rct_window* w)
|
||||||
SPR_G2_MAP_EAST,
|
SPR_G2_MAP_EAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32_t mapImageId = _imageIdByRotation[get_current_rotation()];
|
uint32_t mapImageId = _imageIdByRotation[GetCurrentRotation()];
|
||||||
window_top_toolbar_widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::PaletteNull);
|
window_top_toolbar_widgets[WIDX_MAP].image = ImageId(mapImageId, FilterPaletteID::PaletteNull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,7 +1009,7 @@ static void RepaintSceneryToolDown(const ScreenCoordsXY& windowPos, WidgetIndex
|
||||||
auto flags = EnumsToFlags(
|
auto flags = EnumsToFlags(
|
||||||
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
|
||||||
ViewportInteractionItem::Banner);
|
ViewportInteractionItem::Banner);
|
||||||
auto info = get_map_coordinates_from_pos(windowPos, flags);
|
auto info = GetMapCoordinatesFromPos(windowPos, flags);
|
||||||
switch (info.SpriteType)
|
switch (info.SpriteType)
|
||||||
{
|
{
|
||||||
case ViewportInteractionItem::Scenery:
|
case ViewportInteractionItem::Scenery:
|
||||||
|
@ -1086,7 +1086,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
|
||||||
auto flags = EnumsToFlags(
|
auto flags = EnumsToFlags(
|
||||||
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
|
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
|
||||||
ViewportInteractionItem::Banner, ViewportInteractionItem::FootpathItem);
|
ViewportInteractionItem::Banner, ViewportInteractionItem::FootpathItem);
|
||||||
auto info = get_map_coordinates_from_pos(windowPos, flags);
|
auto info = GetMapCoordinatesFromPos(windowPos, flags);
|
||||||
switch (info.SpriteType)
|
switch (info.SpriteType)
|
||||||
{
|
{
|
||||||
case ViewportInteractionItem::Scenery:
|
case ViewportInteractionItem::Scenery:
|
||||||
|
@ -1099,7 +1099,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
|
||||||
WindowScenerySetSelectedItem(
|
WindowScenerySetSelectedItem(
|
||||||
{ SCENERY_TYPE_SMALL, entryIndex }, sceneryElement->GetPrimaryColour(),
|
{ SCENERY_TYPE_SMALL, entryIndex }, sceneryElement->GetPrimaryColour(),
|
||||||
sceneryElement->GetSecondaryColour(), std::nullopt,
|
sceneryElement->GetSecondaryColour(), std::nullopt,
|
||||||
sceneryElement->GetDirectionWithOffset(get_current_rotation()));
|
sceneryElement->GetDirectionWithOffset(GetCurrentRotation()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1124,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
|
||||||
WindowScenerySetSelectedItem(
|
WindowScenerySetSelectedItem(
|
||||||
{ SCENERY_TYPE_LARGE, entryIndex }, info.Element->AsLargeScenery()->GetPrimaryColour(),
|
{ SCENERY_TYPE_LARGE, entryIndex }, info.Element->AsLargeScenery()->GetPrimaryColour(),
|
||||||
info.Element->AsLargeScenery()->GetSecondaryColour(), std::nullopt,
|
info.Element->AsLargeScenery()->GetSecondaryColour(), std::nullopt,
|
||||||
(get_current_rotation() + info.Element->GetDirection()) & 3);
|
(GetCurrentRotation() + info.Element->GetDirection()) & 3);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1175,7 @@ static void Sub6E1F34UpdateScreenCoordsAndButtonsPressed(bool canRaiseItem, Scre
|
||||||
constexpr auto flags = EnumsToFlags(
|
constexpr auto flags = EnumsToFlags(
|
||||||
ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery,
|
ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery,
|
||||||
ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery);
|
ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery);
|
||||||
auto info = get_map_coordinates_from_pos(screenPos, flags);
|
auto info = GetMapCoordinatesFromPos(screenPos, flags);
|
||||||
|
|
||||||
if (info.SpriteType != ViewportInteractionItem::None)
|
if (info.SpriteType != ViewportInteractionItem::None)
|
||||||
{
|
{
|
||||||
|
@ -1269,7 +1269,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
// If CTRL not pressed
|
// If CTRL not pressed
|
||||||
if (!gSceneryCtrlPressed)
|
if (!gSceneryCtrlPressed)
|
||||||
{
|
{
|
||||||
auto gridCoords = screen_get_map_xy_quadrant(screenPos, &quadrant);
|
auto gridCoords = ScreenGetMapXYQuadrant(screenPos, &quadrant);
|
||||||
if (!gridCoords.has_value())
|
if (!gridCoords.has_value())
|
||||||
{
|
{
|
||||||
gridPos.SetNull();
|
gridPos.SetNull();
|
||||||
|
@ -1302,7 +1302,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
|
|
||||||
auto mapCoords = screen_get_map_xy_quadrant_with_z(screenPos, z, &quadrant);
|
auto mapCoords = ScreenGetMapXYQuadrantWithZ(screenPos, z, &quadrant);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
{
|
{
|
||||||
gridPos.SetNull();
|
gridPos.SetNull();
|
||||||
|
@ -1331,7 +1331,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
rotation = util_rand() & 0xFF;
|
rotation = util_rand() & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation -= get_current_rotation();
|
rotation -= GetCurrentRotation();
|
||||||
rotation &= 0x3;
|
rotation &= 0x3;
|
||||||
|
|
||||||
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
||||||
|
@ -1350,7 +1350,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
{
|
{
|
||||||
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water);
|
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water);
|
||||||
|
|
||||||
auto info = get_map_coordinates_from_pos(screenPos, flags);
|
auto info = GetMapCoordinatesFromPos(screenPos, flags);
|
||||||
gridPos = info.Loc;
|
gridPos = info.Loc;
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
|
@ -1384,7 +1384,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
auto coords = screen_get_map_xy_with_z(screenPos, z);
|
auto coords = ScreenGetMapXYWithZ(screenPos, z);
|
||||||
if (coords.has_value())
|
if (coords.has_value())
|
||||||
{
|
{
|
||||||
gridPos = *coords;
|
gridPos = *coords;
|
||||||
|
@ -1415,7 +1415,7 @@ static void Sub6E1F34SmallScenery(
|
||||||
rotation = util_rand() & 0xFF;
|
rotation = util_rand() & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation -= get_current_rotation();
|
rotation -= GetCurrentRotation();
|
||||||
rotation &= 0x3;
|
rotation &= 0x3;
|
||||||
|
|
||||||
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
||||||
|
@ -1443,7 +1443,7 @@ static void Sub6E1F34PathItem(
|
||||||
|
|
||||||
// Path bits
|
// Path bits
|
||||||
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::FootpathItem);
|
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::FootpathItem);
|
||||||
auto info = get_map_coordinates_from_pos(screenPos, flags);
|
auto info = GetMapCoordinatesFromPos(screenPos, flags);
|
||||||
gridPos = info.Loc;
|
gridPos = info.Loc;
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
|
@ -1487,7 +1487,7 @@ static void Sub6E1F34Wall(
|
||||||
// If CTRL not pressed
|
// If CTRL not pressed
|
||||||
if (!gSceneryCtrlPressed)
|
if (!gSceneryCtrlPressed)
|
||||||
{
|
{
|
||||||
auto gridCoords = screen_get_map_xy_side(screenPos, &edge);
|
auto gridCoords = ScreenGetMapXYSide(screenPos, &edge);
|
||||||
if (!gridCoords.has_value())
|
if (!gridCoords.has_value())
|
||||||
{
|
{
|
||||||
gridPos.SetNull();
|
gridPos.SetNull();
|
||||||
|
@ -1519,7 +1519,7 @@ static void Sub6E1F34Wall(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
auto mapCoords = screen_get_map_xy_side_with_z(screenPos, z, &edge);
|
auto mapCoords = ScreenGetMapXYSideWithZ(screenPos, z, &edge);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
{
|
{
|
||||||
gridPos.SetNull();
|
gridPos.SetNull();
|
||||||
|
@ -1610,7 +1610,7 @@ static void Sub6E1F34LargeScenery(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
auto coords = screen_get_map_xy_with_z(screenPos, z);
|
auto coords = ScreenGetMapXYWithZ(screenPos, z);
|
||||||
if (coords.has_value())
|
if (coords.has_value())
|
||||||
{
|
{
|
||||||
gridPos = *coords;
|
gridPos = *coords;
|
||||||
|
@ -1637,7 +1637,7 @@ static void Sub6E1F34LargeScenery(
|
||||||
gridPos = gridPos.ToTileStart();
|
gridPos = gridPos.ToTileStart();
|
||||||
|
|
||||||
Direction rotation = gWindowSceneryRotation;
|
Direction rotation = gWindowSceneryRotation;
|
||||||
rotation -= get_current_rotation();
|
rotation -= GetCurrentRotation();
|
||||||
rotation &= 0x3;
|
rotation &= 0x3;
|
||||||
|
|
||||||
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
|
||||||
|
@ -1665,7 +1665,7 @@ static void Sub6E1F34Banner(
|
||||||
|
|
||||||
// Banner
|
// Banner
|
||||||
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::FootpathItem);
|
constexpr auto flags = EnumsToFlags(ViewportInteractionItem::Footpath, ViewportInteractionItem::FootpathItem);
|
||||||
auto info = get_map_coordinates_from_pos(screenPos, flags);
|
auto info = GetMapCoordinatesFromPos(screenPos, flags);
|
||||||
gridPos = info.Loc;
|
gridPos = info.Loc;
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
|
@ -1675,7 +1675,7 @@ static void Sub6E1F34Banner(
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t rotation = gWindowSceneryRotation;
|
uint8_t rotation = gWindowSceneryRotation;
|
||||||
rotation -= get_current_rotation();
|
rotation -= GetCurrentRotation();
|
||||||
rotation &= 0x3;
|
rotation &= 0x3;
|
||||||
|
|
||||||
auto z = info.Element->GetBaseZ();
|
auto z = info.Element->GetBaseZ();
|
||||||
|
@ -2005,7 +2005,7 @@ static uint8_t TopToolbarToolUpdateLandPaint(const ScreenCoordsXY& screenPos)
|
||||||
MapInvalidateSelectionRect();
|
MapInvalidateSelectionRect();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||||
|
|
||||||
auto mapTile = screen_get_map_xy(screenPos, nullptr);
|
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
|
||||||
|
|
||||||
if (!mapTile.has_value())
|
if (!mapTile.has_value())
|
||||||
{
|
{
|
||||||
|
@ -2123,8 +2123,8 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos)
|
||||||
{
|
{
|
||||||
int32_t selectionType;
|
int32_t selectionType;
|
||||||
// Get selection type and map coordinates from mouse x,y position
|
// Get selection type and map coordinates from mouse x,y position
|
||||||
screen_pos_to_map_pos(screenPos, &selectionType);
|
ScreenPosToMapPos(screenPos, &selectionType);
|
||||||
mapTile = screen_get_map_xy_side(screenPos, &side);
|
mapTile = ScreenGetMapXYSide(screenPos, &side);
|
||||||
|
|
||||||
if (!mapTile.has_value())
|
if (!mapTile.has_value())
|
||||||
{
|
{
|
||||||
|
@ -2201,7 +2201,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get map coordinates and the side of the tile that is being hovered over
|
// Get map coordinates and the side of the tile that is being hovered over
|
||||||
mapTile = screen_get_map_xy_side(screenPos, &side);
|
mapTile = ScreenGetMapXYSide(screenPos, &side);
|
||||||
|
|
||||||
if (!mapTile.has_value())
|
if (!mapTile.has_value())
|
||||||
{
|
{
|
||||||
|
@ -2360,7 +2360,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos)
|
||||||
|
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
|
||||||
|
|
||||||
auto info = get_map_coordinates_from_pos(
|
auto info = GetMapCoordinatesFromPos(
|
||||||
screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
|
||||||
|
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
|
@ -2480,12 +2480,12 @@ static money64 TryPlaceGhostSmallScenery(
|
||||||
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||||
{
|
{
|
||||||
// Set underground on
|
// Set underground on
|
||||||
viewport_set_visibility(4);
|
ViewportSetVisibility(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set underground off
|
// Set underground off
|
||||||
viewport_set_visibility(5);
|
ViewportSetVisibility(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
|
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
|
||||||
|
@ -2561,12 +2561,12 @@ static money64 TryPlaceGhostLargeScenery(
|
||||||
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||||
{
|
{
|
||||||
// Set underground on
|
// Set underground on
|
||||||
viewport_set_visibility(4);
|
ViewportSetVisibility(4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set underground off
|
// Set underground off
|
||||||
viewport_set_visibility(5);
|
ViewportSetVisibility(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
|
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
|
||||||
|
@ -3262,7 +3262,7 @@ static void WindowTopToolbarToolAbort(rct_window* w, WidgetIndex widgetIndex)
|
||||||
case WIDX_LAND:
|
case WIDX_LAND:
|
||||||
case WIDX_WATER:
|
case WIDX_WATER:
|
||||||
case WIDX_CLEAR_SCENERY:
|
case WIDX_CLEAR_SCENERY:
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
default:
|
default:
|
||||||
|
@ -3809,7 +3809,7 @@ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_landToolBlocked = false;
|
_landToolBlocked = false;
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
ToolSet(*topToolbar, widgetIndex, Tool::DigDown);
|
ToolSet(*topToolbar, widgetIndex, Tool::DigDown);
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
ContextOpenWindow(WindowClass::Land);
|
ContextOpenWindow(WindowClass::Land);
|
||||||
|
@ -3829,7 +3829,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
ToolSet(*topToolbar, widgetIndex, Tool::Crosshair);
|
ToolSet(*topToolbar, widgetIndex, Tool::Crosshair);
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
ContextOpenWindow(WindowClass::ClearScenery);
|
ContextOpenWindow(WindowClass::ClearScenery);
|
||||||
|
@ -3850,7 +3850,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_landToolBlocked = false;
|
_landToolBlocked = false;
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
ToolSet(*topToolbar, widgetIndex, Tool::WaterDown);
|
ToolSet(*topToolbar, widgetIndex, Tool::WaterDown);
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
ContextOpenWindow(WindowClass::Water);
|
ContextOpenWindow(WindowClass::Water);
|
||||||
|
|
|
@ -82,21 +82,21 @@ public:
|
||||||
ToolSet(*this, WIDX_PRICE, Tool::Crosshair);
|
ToolSet(*this, WIDX_PRICE, Tool::Crosshair);
|
||||||
input_set_flag(INPUT_FLAG_6, true);
|
input_set_flag(INPUT_FLAG_6, true);
|
||||||
WindowPushOthersRight(*this);
|
WindowPushOthersRight(*this);
|
||||||
show_gridlines();
|
ShowGridlines();
|
||||||
_miniPreview.resize(TRACK_MINI_PREVIEW_SIZE);
|
_miniPreview.resize(TRACK_MINI_PREVIEW_SIZE);
|
||||||
_placementCost = MONEY32_UNDEFINED;
|
_placementCost = MONEY32_UNDEFINED;
|
||||||
_placementLoc.SetNull();
|
_placementLoc.SetNull();
|
||||||
_currentTrackPieceDirection = (2 - get_current_rotation()) & 3;
|
_currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnClose() override
|
void OnClose() override
|
||||||
{
|
{
|
||||||
ClearProvisional();
|
ClearProvisional();
|
||||||
viewport_set_visibility(0);
|
ViewportSetVisibility(0);
|
||||||
MapInvalidateMapSelectionTiles();
|
MapInvalidateMapSelectionTiles();
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||||
hide_gridlines();
|
HideGridlines();
|
||||||
_miniPreview.clear();
|
_miniPreview.clear();
|
||||||
_miniPreview.shrink_to_fit();
|
_miniPreview.shrink_to_fit();
|
||||||
_trackDesign = nullptr;
|
_trackDesign = nullptr;
|
||||||
|
@ -430,7 +430,7 @@ private:
|
||||||
|
|
||||||
void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max)
|
void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max)
|
||||||
{
|
{
|
||||||
const uint8_t rotation = (_currentTrackPieceDirection + get_current_rotation()) & 3;
|
const uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3;
|
||||||
|
|
||||||
CoordsXY curTrackStart = origin;
|
CoordsXY curTrackStart = origin;
|
||||||
uint8_t curTrackRotation = rotation;
|
uint8_t curTrackRotation = rotation;
|
||||||
|
@ -537,7 +537,7 @@ private:
|
||||||
|
|
||||||
void DrawMiniPreviewMaze(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max)
|
void DrawMiniPreviewMaze(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max)
|
||||||
{
|
{
|
||||||
uint8_t rotation = (_currentTrackPieceDirection + get_current_rotation()) & 3;
|
uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3;
|
||||||
for (const auto& mazeElement : td6->maze_elements)
|
for (const auto& mazeElement : td6->maze_elements)
|
||||||
{
|
{
|
||||||
auto rotatedMazeCoords = origin + TileCoordsXY{ mazeElement.x, mazeElement.y }.ToCoordsXY().Rotate(rotation);
|
auto rotatedMazeCoords = origin + TileCoordsXY{ mazeElement.x, mazeElement.y }.ToCoordsXY().Rotate(rotation);
|
||||||
|
|
|
@ -199,7 +199,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t direction;
|
int32_t direction;
|
||||||
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
|
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
|
||||||
if (mapCoords.has_value())
|
if (mapCoords.has_value())
|
||||||
{
|
{
|
||||||
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
|
||||||
|
@ -213,7 +213,7 @@ public:
|
||||||
void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||||
{
|
{
|
||||||
int32_t direction;
|
int32_t direction;
|
||||||
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
|
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
|
||||||
if (mapCoords.has_value())
|
if (mapCoords.has_value())
|
||||||
{
|
{
|
||||||
_dragging = true;
|
_dragging = true;
|
||||||
|
@ -229,7 +229,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t direction;
|
int32_t direction;
|
||||||
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
|
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
|
||||||
if (mapCoords)
|
if (mapCoords)
|
||||||
{
|
{
|
||||||
MapInvalidateSelectionRect();
|
MapInvalidateSelectionRect();
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
widgets = window_viewport_widgets;
|
widgets = window_viewport_widgets;
|
||||||
|
|
||||||
// Create viewport
|
// Create viewport
|
||||||
viewport_create(this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()));
|
ViewportCreate(this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()));
|
||||||
if (viewport == nullptr)
|
if (viewport == nullptr)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
auto* mainWindow = WindowGetMain();
|
auto* mainWindow = WindowGetMain();
|
||||||
if (mainWindow != nullptr)
|
if (mainWindow != nullptr)
|
||||||
{
|
{
|
||||||
auto info = get_map_coordinates_from_pos(
|
auto info = GetMapCoordinatesFromPos(
|
||||||
{ windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll);
|
{ windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll);
|
||||||
WindowScrollToLocation(*mainWindow, { info.Loc, TileElementHeight(info.Loc) });
|
WindowScrollToLocation(*mainWindow, { info.Loc, TileElementHeight(info.Loc) });
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,7 +461,7 @@ namespace OpenRCT2
|
||||||
gGameSoundsOff = !gConfigSound.MasterSoundEnabled;
|
gGameSoundsOff = !gConfigSound.MasterSoundEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
chat_init();
|
ChatInit();
|
||||||
CopyOriginalUserFilesOver();
|
CopyOriginalUserFilesOver();
|
||||||
|
|
||||||
if (!gOpenRCT2NoGraphics)
|
if (!gOpenRCT2NoGraphics)
|
||||||
|
@ -474,7 +474,7 @@ namespace OpenRCT2
|
||||||
}
|
}
|
||||||
|
|
||||||
input_reset_place_obj_modifier();
|
input_reset_place_obj_modifier();
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
|
|
||||||
_gameState = std::make_unique<GameState>();
|
_gameState = std::make_unique<GameState>();
|
||||||
_gameState->InitAll(DEFAULT_MAP_SIZE);
|
_gameState->InitAll(DEFAULT_MAP_SIZE);
|
||||||
|
@ -1205,7 +1205,7 @@ namespace OpenRCT2
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
chat_update();
|
ChatUpdate();
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
_scriptEngine.Tick();
|
_scriptEngine.Tick();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace Editor
|
||||||
gEditorStep = EditorStep::ObjectSelection;
|
gEditorStep = EditorStep::ObjectSelection;
|
||||||
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||||
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
|
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
rct_window* mainWindow = OpenEditorWindows();
|
rct_window* mainWindow = OpenEditorWindows();
|
||||||
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||||
LoadPalette();
|
LoadPalette();
|
||||||
|
@ -148,7 +148,7 @@ namespace Editor
|
||||||
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
||||||
gEditorStep = EditorStep::ObjectiveSelection;
|
gEditorStep = EditorStep::ObjectiveSelection;
|
||||||
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
|
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
OpenEditorWindows();
|
OpenEditorWindows();
|
||||||
FinaliseMainView();
|
FinaliseMainView();
|
||||||
gScreenAge = 0;
|
gScreenAge = 0;
|
||||||
|
@ -169,7 +169,7 @@ namespace Editor
|
||||||
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
||||||
SetAllLandOwned();
|
SetAllLandOwned();
|
||||||
gEditorStep = EditorStep::ObjectSelection;
|
gEditorStep = EditorStep::ObjectSelection;
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
rct_window* mainWindow = OpenEditorWindows();
|
rct_window* mainWindow = OpenEditorWindows();
|
||||||
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||||
LoadPalette();
|
LoadPalette();
|
||||||
|
@ -190,7 +190,7 @@ namespace Editor
|
||||||
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
||||||
SetAllLandOwned();
|
SetAllLandOwned();
|
||||||
gEditorStep = EditorStep::ObjectSelection;
|
gEditorStep = EditorStep::ObjectSelection;
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
rct_window* mainWindow = OpenEditorWindows();
|
rct_window* mainWindow = OpenEditorWindows();
|
||||||
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||||
LoadPalette();
|
LoadPalette();
|
||||||
|
@ -245,7 +245,7 @@ namespace Editor
|
||||||
gEditorStep = EditorStep::LandscapeEditor;
|
gEditorStep = EditorStep::LandscapeEditor;
|
||||||
gScreenAge = 0;
|
gScreenAge = 0;
|
||||||
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
OpenEditorWindows();
|
OpenEditorWindows();
|
||||||
FinaliseMainView();
|
FinaliseMainView();
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,7 +466,7 @@ void game_load_init()
|
||||||
OpenRCT2::Audio::StopAll();
|
OpenRCT2::Audio::StopAll();
|
||||||
if (!gLoadKeepWindowsOpen)
|
if (!gLoadKeepWindowsOpen)
|
||||||
{
|
{
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
game_create_windows();
|
game_create_windows();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -848,7 +848,7 @@ bool stop_silent_record()
|
||||||
|
|
||||||
void PrepareMapForSave()
|
void PrepareMapForSave()
|
||||||
{
|
{
|
||||||
viewport_set_saved_view();
|
ViewportSetSavedView();
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||||
|
|
|
@ -111,7 +111,7 @@ void GameState::Tick()
|
||||||
uint32_t numUpdates = 1;
|
uint32_t numUpdates = 1;
|
||||||
|
|
||||||
// 0x006E3AEC // screen_game_process_mouse_input();
|
// 0x006E3AEC // screen_game_process_mouse_input();
|
||||||
screenshot_check();
|
ScreenshotCheck();
|
||||||
game_handle_keyboard_input();
|
game_handle_keyboard_input();
|
||||||
|
|
||||||
if (game_is_not_paused() && gPreviewingTitleSequenceInGame)
|
if (game_is_not_paused() && gPreviewingTitleSequenceInGame)
|
||||||
|
@ -363,7 +363,7 @@ void GameState::UpdateLogic(LogicTimings* timings)
|
||||||
editor_open_windows_for_current_step();
|
editor_open_windows_for_current_step();
|
||||||
|
|
||||||
// Update windows
|
// Update windows
|
||||||
// window_dispatch_update_all();
|
// WindowDispatchUpdateAll();
|
||||||
|
|
||||||
// Start autosave timer after update
|
// Start autosave timer after update
|
||||||
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE)
|
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE)
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace OpenRCT2::Audio
|
||||||
volumeDown = 10;
|
volumeDown = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t rotation = get_current_rotation();
|
uint8_t rotation = GetCurrentRotation();
|
||||||
auto pos2 = Translate3DTo2DWithZ(rotation, location);
|
auto pos2 = Translate3DTo2DWithZ(rotation, location);
|
||||||
|
|
||||||
rct_viewport* viewport = nullptr;
|
rct_viewport* viewport = nullptr;
|
||||||
|
|
|
@ -21,7 +21,7 @@ static exitcode_t HandleBenchGfx(CommandLineArgEnumerator* argEnumerator)
|
||||||
{
|
{
|
||||||
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + argEnumerator->GetIndex();
|
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + argEnumerator->GetIndex();
|
||||||
int32_t argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
int32_t argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
||||||
int32_t result = cmdline_for_gfxbench(argv, argc);
|
int32_t result = CmdlineForGfxbench(argv, argc);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
return EXITCODE_FAIL;
|
return EXITCODE_FAIL;
|
||||||
|
|
|
@ -122,7 +122,7 @@ static std::vector<RecordedPaintSession> extract_paint_session(std::string_view
|
||||||
dpi.bits = static_cast<uint8_t*>(malloc(dpi.width * dpi.height));
|
dpi.bits = static_cast<uint8_t*>(malloc(dpi.width * dpi.height));
|
||||||
|
|
||||||
log_info("Obtaining sprite data...");
|
log_info("Obtaining sprite data...");
|
||||||
viewport_render(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } }, &sessions);
|
ViewportRender(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } }, &sessions);
|
||||||
|
|
||||||
free(dpi.bits);
|
free(dpi.bits);
|
||||||
drawing_engine_dispose();
|
drawing_engine_dispose();
|
||||||
|
@ -131,7 +131,7 @@ static std::vector<RecordedPaintSession> extract_paint_session(std::string_view
|
||||||
return sessions;
|
return sessions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is based on benchgfx_render_screenshots
|
// This function is based on BenchgfxRenderScreenshots
|
||||||
static void BM_paint_session_arrange(benchmark::State& state, const std::vector<RecordedPaintSession> inputSessions)
|
static void BM_paint_session_arrange(benchmark::State& state, const std::vector<RecordedPaintSession> inputSessions)
|
||||||
{
|
{
|
||||||
auto sessions = inputSessions;
|
auto sessions = inputSessions;
|
||||||
|
|
|
@ -43,7 +43,7 @@ static exitcode_t HandleScreenshot(CommandLineArgEnumerator* argEnumerator)
|
||||||
{
|
{
|
||||||
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + argEnumerator->GetIndex();
|
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + argEnumerator->GetIndex();
|
||||||
int32_t argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
int32_t argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
||||||
int32_t result = cmdline_for_screenshot(argv, argc, &_options);
|
int32_t result = CmdlineForScreenshot(argv, argc, &_options);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
{
|
{
|
||||||
return EXITCODE_FAIL;
|
return EXITCODE_FAIL;
|
||||||
|
|
|
@ -691,11 +691,11 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo* dpi, std::string_view tex
|
||||||
{
|
{
|
||||||
// As outlines are black, these texts should always use a darker shade
|
// As outlines are black, these texts should always use a darker shade
|
||||||
// of the foreground colour for font hinting.
|
// of the foreground colour for font hinting.
|
||||||
*dst = blendColours(colour, PALETTE_INDEX_0);
|
*dst = BlendColours(colour, PALETTE_INDEX_0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*dst = blendColours(colour, *dst);
|
*dst = BlendColours(colour, *dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ void lightfx_prepare_light_list()
|
||||||
auto* w = WindowGetMain();
|
auto* w = WindowGetMain();
|
||||||
if (w != nullptr)
|
if (w != nullptr)
|
||||||
{
|
{
|
||||||
// based on get_map_coordinates_from_pos_window
|
// based on GetMapCoordinatesFromPosWindow
|
||||||
rct_drawpixelinfo dpi;
|
rct_drawpixelinfo dpi;
|
||||||
dpi.x = entry->ViewCoords.x + offsetPattern[0 + pat * 2] / mapFrontDiv;
|
dpi.x = entry->ViewCoords.x + offsetPattern[0 + pat * 2] / mapFrontDiv;
|
||||||
dpi.y = entry->ViewCoords.y + offsetPattern[1 + pat * 2] / mapFrontDiv;
|
dpi.y = entry->ViewCoords.y + offsetPattern[1 + pat * 2] / mapFrontDiv;
|
||||||
|
@ -308,8 +308,7 @@ void lightfx_prepare_light_list()
|
||||||
PaintSession* session = PaintSessionAlloc(&dpi, w->viewport->flags);
|
PaintSession* session = PaintSessionAlloc(&dpi, w->viewport->flags);
|
||||||
PaintSessionGenerate(*session);
|
PaintSessionGenerate(*session);
|
||||||
PaintSessionArrange(*session);
|
PaintSessionArrange(*session);
|
||||||
auto info = set_interaction_info_from_paint_session(
|
auto info = SetInteractionInfoFromPaintSession(session, w->viewport->flags, ViewportInteractionItemAll);
|
||||||
session, w->viewport->flags, ViewportInteractionItemAll);
|
|
||||||
PaintSessionFree(session);
|
PaintSessionFree(session);
|
||||||
|
|
||||||
// log_warning("[%i, %i]", dpi->x, dpi->y);
|
// log_warning("[%i, %i]", dpi->x, dpi->y);
|
||||||
|
@ -438,7 +437,7 @@ void lightfx_update_viewport_settings()
|
||||||
rct_viewport* viewport = WindowGetViewport(mainWindow);
|
rct_viewport* viewport = WindowGetViewport(mainWindow);
|
||||||
_current_view_x_back = viewport->viewPos.x;
|
_current_view_x_back = viewport->viewPos.x;
|
||||||
_current_view_y_back = viewport->viewPos.y;
|
_current_view_y_back = viewport->viewPos.y;
|
||||||
_current_view_rotation_back = get_current_rotation();
|
_current_view_rotation_back = GetCurrentRotation();
|
||||||
_current_view_zoom_back = viewport->zoom;
|
_current_view_zoom_back = viewport->zoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -647,7 +646,7 @@ static void LightfxAdd3DLight(
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
entry->Position = loc;
|
entry->Position = loc;
|
||||||
entry->ViewCoords = Translate3DTo2DWithZ(get_current_rotation(), loc);
|
entry->ViewCoords = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
|
||||||
entry->Type = lightType;
|
entry->Type = lightType;
|
||||||
entry->LightIntensity = 0xFF;
|
entry->LightIntensity = 0xFF;
|
||||||
entry->LightHash = lightHash;
|
entry->LightHash = lightHash;
|
||||||
|
@ -661,7 +660,7 @@ static void LightfxAdd3DLight(
|
||||||
LightListEntry* entry = &_LightListBack[LightListCurrentCountBack++];
|
LightListEntry* entry = &_LightListBack[LightListCurrentCountBack++];
|
||||||
|
|
||||||
entry->Position = loc;
|
entry->Position = loc;
|
||||||
entry->ViewCoords = Translate3DTo2DWithZ(get_current_rotation(), loc);
|
entry->ViewCoords = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
|
||||||
entry->Type = lightType;
|
entry->Type = lightType;
|
||||||
entry->LightIntensity = 0xFF;
|
entry->LightIntensity = 0xFF;
|
||||||
entry->LightHash = lightHash;
|
entry->LightHash = lightHash;
|
||||||
|
@ -792,7 +791,7 @@ void LightfxAddLightsMagicVehicle(const Vehicle* vehicle)
|
||||||
|
|
||||||
void LightFxAddKioskLights(const CoordsXY& mapPosition, const int32_t height, const uint8_t zOffset)
|
void LightFxAddKioskLights(const CoordsXY& mapPosition, const int32_t height, const uint8_t zOffset)
|
||||||
{
|
{
|
||||||
uint8_t relativeRotation = (4 - get_current_rotation()) % 4;
|
uint8_t relativeRotation = (4 - GetCurrentRotation()) % 4;
|
||||||
CoordsXY lanternOffset1 = CoordsXY(0, 16).Rotate(relativeRotation);
|
CoordsXY lanternOffset1 = CoordsXY(0, 16).Rotate(relativeRotation);
|
||||||
CoordsXY lanternOffset2 = CoordsXY(16, 0).Rotate(relativeRotation);
|
CoordsXY lanternOffset2 = CoordsXY(16, 0).Rotate(relativeRotation);
|
||||||
lightfx_add_3d_light_magic_from_drawing_tile(
|
lightfx_add_3d_light_magic_from_drawing_tile(
|
||||||
|
@ -811,14 +810,14 @@ void LightFxAddKioskLights(const CoordsXY& mapPosition, const int32_t height, co
|
||||||
|
|
||||||
void LightFxAddShopLights(const CoordsXY& mapPosition, const uint8_t direction, const int32_t height, const uint8_t zOffset)
|
void LightFxAddShopLights(const CoordsXY& mapPosition, const uint8_t direction, const int32_t height, const uint8_t zOffset)
|
||||||
{
|
{
|
||||||
if (direction == (4 - get_current_rotation()) % 4) // Back Right Facing Stall
|
if (direction == (4 - GetCurrentRotation()) % 4) // Back Right Facing Stall
|
||||||
{
|
{
|
||||||
CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction);
|
CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction);
|
||||||
CoordsXY spotOffset2 = CoordsXY(-32, 4).Rotate(direction);
|
CoordsXY spotOffset2 = CoordsXY(-32, 4).Rotate(direction);
|
||||||
lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1);
|
lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::Spot1);
|
||||||
lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2);
|
lightfx_add_3d_light_magic_from_drawing_tile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::Spot2);
|
||||||
}
|
}
|
||||||
else if (direction == (7 - get_current_rotation()) % 4) // Back left Facing Stall
|
else if (direction == (7 - GetCurrentRotation()) % 4) // Back left Facing Stall
|
||||||
{
|
{
|
||||||
CoordsXY spotOffset1 = CoordsXY(-32, -8).Rotate(direction);
|
CoordsXY spotOffset1 = CoordsXY(-32, -8).Rotate(direction);
|
||||||
CoordsXY spotOffset2 = CoordsXY(-32, -4).Rotate(direction);
|
CoordsXY spotOffset2 = CoordsXY(-32, -4).Rotate(direction);
|
||||||
|
|
|
@ -275,7 +275,7 @@ void FASTCALL GfxDrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId image, co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string screenshot_dump()
|
std::string ScreenshotDump()
|
||||||
{
|
{
|
||||||
auto drawingEngine = GetDrawingEngine();
|
auto drawingEngine = GetDrawingEngine();
|
||||||
if (drawingEngine != nullptr)
|
if (drawingEngine != nullptr)
|
||||||
|
|
|
@ -1619,7 +1619,7 @@ static void scrolling_text_set_bitmap_for_ttf(
|
||||||
else if (use_hinting && src_pixel > fontDesc->hinting_threshold)
|
else if (use_hinting && src_pixel > fontDesc->hinting_threshold)
|
||||||
{
|
{
|
||||||
// Simulate font hinting by shading the background colour instead.
|
// Simulate font hinting by shading the background colour instead.
|
||||||
*dst = blendColours(colour, *dst);
|
*dst = BlendColours(colour, *dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Jump to next row
|
// Jump to next row
|
||||||
|
|
|
@ -259,7 +259,7 @@ void X8DrawingEngine::CopyRect(int32_t x, int32_t y, int32_t width, int32_t heig
|
||||||
|
|
||||||
std::string X8DrawingEngine::Screenshot()
|
std::string X8DrawingEngine::Screenshot()
|
||||||
{
|
{
|
||||||
return screenshot_dump_png(&_bitsDPI);
|
return ScreenshotDumpPNG(&_bitsDPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDrawingContext* X8DrawingEngine::GetDrawingContext()
|
IDrawingContext* X8DrawingEngine::GetDrawingContext()
|
||||||
|
|
|
@ -64,7 +64,7 @@ void EntityBase::Invalidate()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewports_invalidate(SpriteRect, maxZoom);
|
ViewportsInvalidate(SpriteRect, maxZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityBase::Serialise(DataSerialiser& stream)
|
void EntityBase::Serialise(DataSerialiser& stream)
|
||||||
|
|
|
@ -476,7 +476,7 @@ void EntityBase::MoveTo(const CoordsXYZ& newLocation)
|
||||||
|
|
||||||
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
|
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
|
||||||
{
|
{
|
||||||
auto screenCoords = Translate3DTo2DWithZ(get_current_rotation(), entityPos);
|
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
|
||||||
|
|
||||||
entity->SpriteRect = ScreenRect(
|
entity->SpriteRect = ScreenRect(
|
||||||
screenCoords - ScreenCoordsXY{ entity->sprite_width, entity->sprite_height_negative },
|
screenCoords - ScreenCoordsXY{ entity->sprite_width, entity->sprite_height_negative },
|
||||||
|
|
|
@ -88,7 +88,7 @@ void MoneyEffect::Create(money64 value, const CoordsXYZ& loc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rct_viewport* mainViewport = WindowGetViewport(mainWindow);
|
rct_viewport* mainViewport = WindowGetViewport(mainWindow);
|
||||||
auto mapPositionXY = screen_get_map_xy(
|
auto mapPositionXY = ScreenGetMapXY(
|
||||||
{ mainViewport->pos.x + (mainViewport->width / 2), mainViewport->pos.y + (mainViewport->height / 2) }, nullptr);
|
{ mainViewport->pos.x + (mainViewport->width / 2), mainViewport->pos.y + (mainViewport->height / 2) }, nullptr);
|
||||||
if (!mapPositionXY.has_value())
|
if (!mapPositionXY.has_value())
|
||||||
return;
|
return;
|
||||||
|
@ -126,8 +126,8 @@ void MoneyEffect::Update()
|
||||||
{
|
{
|
||||||
newZ += 1;
|
newZ += 1;
|
||||||
}
|
}
|
||||||
newY += _moneyEffectMoveOffset[get_current_rotation()].y;
|
newY += _moneyEffectMoveOffset[GetCurrentRotation()].y;
|
||||||
newX += _moneyEffectMoveOffset[get_current_rotation()].x;
|
newX += _moneyEffectMoveOffset[GetCurrentRotation()].x;
|
||||||
|
|
||||||
MoveTo({ newX, newY, newZ });
|
MoveTo({ newX, newY, newZ });
|
||||||
|
|
||||||
|
|
|
@ -40,59 +40,59 @@ static int32_t _chatWidth;
|
||||||
static int32_t _chatHeight;
|
static int32_t _chatHeight;
|
||||||
static TextInputSession* _chatTextInputSession;
|
static TextInputSession* _chatTextInputSession;
|
||||||
|
|
||||||
static const char* chat_history_get(uint32_t index);
|
static const char* ChatGetHistory(uint32_t index);
|
||||||
static uint32_t chat_history_get_time(uint32_t index);
|
static uint32_t ChatHistoryGetTime(uint32_t index);
|
||||||
static void chat_clear_input();
|
static void ChatClearInput();
|
||||||
static int32_t chat_history_draw_string(
|
static int32_t ChatHistoryDrawString(
|
||||||
rct_drawpixelinfo* dpi, const char* text, const ScreenCoordsXY& screenCoords, int32_t width);
|
rct_drawpixelinfo* dpi, const char* text, const ScreenCoordsXY& screenCoords, int32_t width);
|
||||||
|
|
||||||
bool chat_available()
|
bool ChatAvailable()
|
||||||
{
|
{
|
||||||
return network_get_mode() != NETWORK_MODE_NONE && network_get_status() == NETWORK_STATUS_CONNECTED
|
return network_get_mode() != NETWORK_MODE_NONE && network_get_status() == NETWORK_STATUS_CONNECTED
|
||||||
&& network_get_authstatus() == NetworkAuth::Ok;
|
&& network_get_authstatus() == NetworkAuth::Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_open()
|
void ChatOpen()
|
||||||
{
|
{
|
||||||
gChatOpen = true;
|
gChatOpen = true;
|
||||||
_chatTextInputSession = ContextStartTextInput(_chatCurrentLine, sizeof(_chatCurrentLine));
|
_chatTextInputSession = ContextStartTextInput(_chatCurrentLine, sizeof(_chatCurrentLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_close()
|
void ChatClose()
|
||||||
{
|
{
|
||||||
gChatOpen = false;
|
gChatOpen = false;
|
||||||
ContextStopTextInput();
|
ContextStopTextInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_toggle()
|
void ChatToggle()
|
||||||
{
|
{
|
||||||
if (gChatOpen)
|
if (gChatOpen)
|
||||||
{
|
{
|
||||||
chat_close();
|
ChatClose();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chat_open();
|
ChatOpen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_init()
|
void ChatInit()
|
||||||
{
|
{
|
||||||
std::memset(_chatHistory, 0x00, sizeof(_chatHistory));
|
std::memset(_chatHistory, 0x00, sizeof(_chatHistory));
|
||||||
std::memset(_chatHistoryTime, 0x00, sizeof(_chatHistoryTime));
|
std::memset(_chatHistoryTime, 0x00, sizeof(_chatHistoryTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_update()
|
void ChatUpdate()
|
||||||
{
|
{
|
||||||
// Flash the caret
|
// Flash the caret
|
||||||
_chatCaretTicks = (_chatCaretTicks + 1) % 30;
|
_chatCaretTicks = (_chatCaretTicks + 1) % 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
void ChatDraw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
{
|
{
|
||||||
thread_local std::string lineBuffer;
|
thread_local std::string lineBuffer;
|
||||||
|
|
||||||
if (!chat_available())
|
if (!ChatAvailable())
|
||||||
{
|
{
|
||||||
gChatOpen = false;
|
gChatOpen = false;
|
||||||
return;
|
return;
|
||||||
|
@ -110,19 +110,19 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
// Draw chat window
|
// Draw chat window
|
||||||
if (gChatOpen)
|
if (gChatOpen)
|
||||||
{
|
{
|
||||||
inputLineHeight = chat_string_wrapped_get_height(static_cast<void*>(&inputLine), _chatWidth - 10);
|
inputLineHeight = ChatStringWrappedGetHeight(static_cast<void*>(&inputLine), _chatWidth - 10);
|
||||||
_chatTop -= inputLineHeight;
|
_chatTop -= inputLineHeight;
|
||||||
|
|
||||||
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++)
|
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (chat_history_get(i)[0] == '\0')
|
if (ChatGetHistory(i)[0] == '\0')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineBuffer.assign(chat_history_get(i));
|
lineBuffer.assign(ChatGetHistory(i));
|
||||||
auto lineCh = lineBuffer.c_str();
|
auto lineCh = lineBuffer.c_str();
|
||||||
int32_t lineHeight = chat_string_wrapped_get_height(static_cast<void*>(&lineCh), _chatWidth - 10);
|
int32_t lineHeight = ChatStringWrappedGetHeight(static_cast<void*>(&lineCh), _chatWidth - 10);
|
||||||
_chatTop -= (lineHeight + 5);
|
_chatTop -= (lineHeight + 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,15 +164,15 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
// Draw chat history
|
// Draw chat history
|
||||||
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++, screenCoords.y -= stringHeight)
|
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++, screenCoords.y -= stringHeight)
|
||||||
{
|
{
|
||||||
uint32_t expireTime = chat_history_get_time(i) + 10000;
|
uint32_t expireTime = ChatHistoryGetTime(i) + 10000;
|
||||||
if (!gChatOpen && Platform::GetTicks() > expireTime)
|
if (!gChatOpen && Platform::GetTicks() > expireTime)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lineBuffer.assign(chat_history_get(i));
|
lineBuffer.assign(ChatGetHistory(i));
|
||||||
auto lineCh = lineBuffer.c_str();
|
auto lineCh = lineBuffer.c_str();
|
||||||
stringHeight = chat_history_draw_string(dpi, lineCh, screenCoords, _chatWidth - 10) + 5;
|
stringHeight = ChatHistoryDrawString(dpi, lineCh, screenCoords, _chatWidth - 10) + 5;
|
||||||
GfxSetDirtyBlocks(
|
GfxSetDirtyBlocks(
|
||||||
{ { screenCoords - ScreenCoordsXY{ 0, stringHeight } }, { screenCoords + ScreenCoordsXY{ _chatWidth, 20 } } });
|
{ { screenCoords - ScreenCoordsXY{ 0, stringHeight } }, { screenCoords + ScreenCoordsXY{ _chatWidth, 20 } } });
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_history_add(std::string_view s)
|
void ChatAddHistory(std::string_view s)
|
||||||
{
|
{
|
||||||
// Format a timestamp
|
// Format a timestamp
|
||||||
time_t timer{};
|
time_t timer{};
|
||||||
|
@ -234,7 +234,7 @@ void chat_history_add(std::string_view s)
|
||||||
CreateAudioChannel(SoundId::NewsItem, 0, MIXER_VOLUME_MAX, 0.5f, 1.5f, true);
|
CreateAudioChannel(SoundId::NewsItem, 0, MIXER_VOLUME_MAX, 0.5f, 1.5f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_input(ChatInput input)
|
void ChatInput(enum ChatInput input)
|
||||||
{
|
{
|
||||||
switch (input)
|
switch (input)
|
||||||
{
|
{
|
||||||
|
@ -243,35 +243,35 @@ void chat_input(ChatInput input)
|
||||||
{
|
{
|
||||||
network_send_chat(_chatCurrentLine);
|
network_send_chat(_chatCurrentLine);
|
||||||
}
|
}
|
||||||
chat_clear_input();
|
ChatClearInput();
|
||||||
chat_close();
|
ChatClose();
|
||||||
break;
|
break;
|
||||||
case ChatInput::Close:
|
case ChatInput::Close:
|
||||||
chat_close();
|
ChatClose();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* chat_history_get(uint32_t index)
|
static const char* ChatGetHistory(uint32_t index)
|
||||||
{
|
{
|
||||||
return _chatHistory[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
return _chatHistory[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t chat_history_get_time(uint32_t index)
|
static uint32_t ChatHistoryGetTime(uint32_t index)
|
||||||
{
|
{
|
||||||
return _chatHistoryTime[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
return _chatHistoryTime[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void chat_clear_input()
|
static void ChatClearInput()
|
||||||
{
|
{
|
||||||
_chatCurrentLine[0] = 0;
|
_chatCurrentLine[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is the same as gfx_draw_string_left_wrapped.
|
// This method is the same as gfx_draw_string_left_wrapped.
|
||||||
// But this adjusts the initial Y coordinate depending of the number of lines.
|
// But this adjusts the initial Y coordinate depending of the number of lines.
|
||||||
static int32_t chat_history_draw_string(
|
static int32_t ChatHistoryDrawString(
|
||||||
rct_drawpixelinfo* dpi, const char* text, const ScreenCoordsXY& screenCoords, int32_t width)
|
rct_drawpixelinfo* dpi, const char* text, const ScreenCoordsXY& screenCoords, int32_t width)
|
||||||
{
|
{
|
||||||
char buffer[CommonTextBufferSize];
|
char buffer[CommonTextBufferSize];
|
||||||
|
@ -300,7 +300,7 @@ static int32_t chat_history_draw_string(
|
||||||
|
|
||||||
// Wrap string without drawing, useful to get the height of a wrapped string.
|
// Wrap string without drawing, useful to get the height of a wrapped string.
|
||||||
// Almost the same as gfx_draw_string_left_wrapped
|
// Almost the same as gfx_draw_string_left_wrapped
|
||||||
int32_t chat_string_wrapped_get_height(void* args, int32_t width)
|
int32_t ChatStringWrappedGetHeight(void* args, int32_t width)
|
||||||
{
|
{
|
||||||
char buffer[CommonTextBufferSize];
|
char buffer[CommonTextBufferSize];
|
||||||
auto bufferPtr = buffer;
|
auto bufferPtr = buffer;
|
||||||
|
|
|
@ -30,16 +30,16 @@ enum class ChatInput : uint8_t
|
||||||
|
|
||||||
extern bool gChatOpen;
|
extern bool gChatOpen;
|
||||||
|
|
||||||
bool chat_available();
|
bool ChatAvailable();
|
||||||
void chat_open();
|
void ChatOpen();
|
||||||
void chat_close();
|
void ChatClose();
|
||||||
void chat_toggle();
|
void ChatToggle();
|
||||||
|
|
||||||
void chat_init();
|
void ChatInit();
|
||||||
void chat_update();
|
void ChatUpdate();
|
||||||
void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColour);
|
void ChatDraw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColour);
|
||||||
|
|
||||||
void chat_history_add(std::string_view s);
|
void ChatAddHistory(std::string_view s);
|
||||||
void chat_input(ChatInput input);
|
void ChatInput(ChatInput input);
|
||||||
|
|
||||||
int32_t chat_string_wrapped_get_height(void* args, int32_t width);
|
int32_t ChatStringWrappedGetHeight(void* args, int32_t width);
|
||||||
|
|
|
@ -34,7 +34,7 @@ enum
|
||||||
INDEX_COLOUR_11 = 254,
|
INDEX_COLOUR_11 = 254,
|
||||||
};
|
};
|
||||||
|
|
||||||
void colours_init_maps()
|
void ColoursInitMaps()
|
||||||
{
|
{
|
||||||
// Get colour maps from g1
|
// Get colour maps from g1
|
||||||
for (int32_t i = 0; i < COLOUR_COUNT; i++)
|
for (int32_t i = 0; i < COLOUR_COUNT; i++)
|
||||||
|
@ -106,7 +106,7 @@ namespace Colour
|
||||||
#ifndef NO_TTF
|
#ifndef NO_TTF
|
||||||
static uint8_t BlendColourMap[PALETTE_COUNT][PALETTE_COUNT] = { 0 };
|
static uint8_t BlendColourMap[PALETTE_COUNT][PALETTE_COUNT] = { 0 };
|
||||||
|
|
||||||
static uint8_t findClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue)
|
static uint8_t FindClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
{
|
{
|
||||||
int16_t closest = -1;
|
int16_t closest = -1;
|
||||||
int32_t closestDistance = INT32_MAX;
|
int32_t closestDistance = INT32_MAX;
|
||||||
|
@ -126,7 +126,7 @@ static uint8_t findClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue)
|
||||||
return closest;
|
return closest;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t blendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2)
|
uint8_t BlendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2)
|
||||||
{
|
{
|
||||||
const uint8_t cMin = std::min(paletteIndex1, paletteIndex2);
|
const uint8_t cMin = std::min(paletteIndex1, paletteIndex2);
|
||||||
const uint8_t cMax = std::max(paletteIndex1, paletteIndex2);
|
const uint8_t cMax = std::max(paletteIndex1, paletteIndex2);
|
||||||
|
@ -140,7 +140,7 @@ uint8_t blendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2)
|
||||||
uint8_t green = (gPalette[cMin].Green + gPalette[cMax].Green) / 2;
|
uint8_t green = (gPalette[cMin].Green + gPalette[cMax].Green) / 2;
|
||||||
uint8_t blue = (gPalette[cMin].Blue + gPalette[cMax].Blue) / 2;
|
uint8_t blue = (gPalette[cMin].Blue + gPalette[cMax].Blue) / 2;
|
||||||
|
|
||||||
BlendColourMap[cMin][cMax] = findClosestPaletteIndex(red, green, blue);
|
BlendColourMap[cMin][cMax] = FindClosestPaletteIndex(red, green, blue);
|
||||||
return BlendColourMap[cMin][cMax];
|
return BlendColourMap[cMin][cMax];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -211,7 +211,7 @@ struct rct_colour_map
|
||||||
|
|
||||||
extern rct_colour_map ColourMapA[COLOUR_COUNT];
|
extern rct_colour_map ColourMapA[COLOUR_COUNT];
|
||||||
|
|
||||||
void colours_init_maps();
|
void ColoursInitMaps();
|
||||||
|
|
||||||
namespace Colour
|
namespace Colour
|
||||||
{
|
{
|
||||||
|
@ -219,5 +219,5 @@ namespace Colour
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_TTF
|
#ifndef NO_TTF
|
||||||
uint8_t blendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2);
|
uint8_t BlendColours(const uint8_t paletteIndex1, const uint8_t paletteIndex2);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,15 +83,15 @@ static constexpr const char* ClimateNames[] = {
|
||||||
"cold",
|
"cold",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t console_parse_int(const std::string& src, bool* valid);
|
static int32_t ConsoleParseInt(const std::string& src, bool* valid);
|
||||||
static double console_parse_double(const std::string& src, bool* valid);
|
static double ConsoleParseDouble(const std::string& src, bool* valid);
|
||||||
|
|
||||||
static void console_write_all_commands(InteractiveConsole& console);
|
static void ConsoleWriteAllCommands(InteractiveConsole& console);
|
||||||
static int32_t cc_variables(InteractiveConsole& console, const arguments_t& argv);
|
static int32_t ConsoleCommandVariables(InteractiveConsole& console, const arguments_t& argv);
|
||||||
static int32_t cc_windows(InteractiveConsole& console, const arguments_t& argv);
|
static int32_t ConsoleCommandWindows(InteractiveConsole& console, const arguments_t& argv);
|
||||||
static int32_t cc_help(InteractiveConsole& console, const arguments_t& argv);
|
static int32_t ConsoleCommandHelp(InteractiveConsole& console, const arguments_t& argv);
|
||||||
|
|
||||||
static bool invalidArguments(bool* invalid, bool arguments);
|
static bool InvalidArguments(bool* invalid, bool arguments);
|
||||||
|
|
||||||
#define SET_FLAG(variable, flag, value) \
|
#define SET_FLAG(variable, flag, value) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -101,7 +101,7 @@ static bool invalidArguments(bool* invalid, bool arguments);
|
||||||
variable &= ~(flag); \
|
variable &= ~(flag); \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t console_parse_int(const std::string& src, bool* valid)
|
static int32_t ConsoleParseInt(const std::string& src, bool* valid)
|
||||||
{
|
{
|
||||||
utf8* end;
|
utf8* end;
|
||||||
int32_t value;
|
int32_t value;
|
||||||
|
@ -110,7 +110,7 @@ static int32_t console_parse_int(const std::string& src, bool* valid)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double console_parse_double(const std::string& src, bool* valid)
|
static double ConsoleParseDouble(const std::string& src, bool* valid)
|
||||||
{
|
{
|
||||||
utf8* end;
|
utf8* end;
|
||||||
double value;
|
double value;
|
||||||
|
@ -119,32 +119,32 @@ static double console_parse_double(const std::string& src, bool* valid)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_clear(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandClear(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
console.Clear();
|
console.Clear();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_close(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandClose(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
console.Close();
|
console.Close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_hide(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandHide(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
console.Hide();
|
console.Hide();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_echo(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandEcho(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
console.WriteLine(argv[0]);
|
console.WriteLine(argv[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandRides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
|
@ -188,8 +188,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
if (argv[1] == "type")
|
if (argv[1] == "type")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
int32_t type = console_parse_int(argv[3], &int_valid[1]);
|
int32_t type = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
if (!int_valid[0] || !int_valid[1])
|
if (!int_valid[0] || !int_valid[1])
|
||||||
{
|
{
|
||||||
console.WriteFormatLine("This command expects integer arguments");
|
console.WriteFormatLine("This command expects integer arguments");
|
||||||
|
@ -218,8 +218,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else if (argv[1] == "mode")
|
else if (argv[1] == "mode")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
int32_t mode = console_parse_int(argv[3], &int_valid[1]);
|
int32_t mode = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
if (!int_valid[0] || !int_valid[1])
|
if (!int_valid[0] || !int_valid[1])
|
||||||
{
|
{
|
||||||
console.WriteFormatLine("This command expects integer arguments");
|
console.WriteFormatLine("This command expects integer arguments");
|
||||||
|
@ -249,8 +249,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else if (argv[1] == "mass")
|
else if (argv[1] == "mass")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
int32_t mass = console_parse_int(argv[3], &int_valid[1]);
|
int32_t mass = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (ride_index < 0)
|
if (ride_index < 0)
|
||||||
{
|
{
|
||||||
|
@ -287,8 +287,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else if (argv[1] == "excitement")
|
else if (argv[1] == "excitement")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
ride_rating excitement = console_parse_int(argv[3], &int_valid[1]);
|
ride_rating excitement = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (ride_index < 0)
|
if (ride_index < 0)
|
||||||
{
|
{
|
||||||
|
@ -320,8 +320,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else if (argv[1] == "intensity")
|
else if (argv[1] == "intensity")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
ride_rating intensity = console_parse_int(argv[3], &int_valid[1]);
|
ride_rating intensity = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (ride_index < 0)
|
if (ride_index < 0)
|
||||||
{
|
{
|
||||||
|
@ -353,8 +353,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else if (argv[1] == "nausea")
|
else if (argv[1] == "nausea")
|
||||||
{
|
{
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
|
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
ride_rating nausea = console_parse_int(argv[3], &int_valid[1]);
|
ride_rating nausea = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (ride_index < 0)
|
if (ride_index < 0)
|
||||||
{
|
{
|
||||||
|
@ -388,7 +388,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
if (argv[2] == "all")
|
if (argv[2] == "all")
|
||||||
{
|
{
|
||||||
auto arg1 = console_parse_int(argv[3], &int_valid[0]);
|
auto arg1 = ConsoleParseInt(argv[3], &int_valid[0]);
|
||||||
if (argv.size() <= 4)
|
if (argv.size() <= 4)
|
||||||
{
|
{
|
||||||
auto price = arg1;
|
auto price = arg1;
|
||||||
|
@ -408,7 +408,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto rideType = arg1;
|
auto rideType = arg1;
|
||||||
auto price = console_parse_int(argv[4], &int_valid[1]);
|
auto price = ConsoleParseInt(argv[4], &int_valid[1]);
|
||||||
|
|
||||||
if (int_valid[0] && int_valid[1])
|
if (int_valid[0] && int_valid[1])
|
||||||
{
|
{
|
||||||
|
@ -429,8 +429,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int32_t rideId = console_parse_int(argv[2], &int_valid[0]);
|
int32_t rideId = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
money16 price = console_parse_int(argv[3], &int_valid[1]);
|
money16 price = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (!int_valid[0] || !int_valid[1])
|
if (!int_valid[0] || !int_valid[1])
|
||||||
{
|
{
|
||||||
|
@ -452,7 +452,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
|
@ -487,8 +487,8 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
int32_t int_val[3];
|
int32_t int_val[3];
|
||||||
bool int_valid[3] = { false };
|
bool int_valid[3] = { false };
|
||||||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
int_val[1] = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
|
|
||||||
if (int_valid[0] && int_valid[1])
|
if (int_valid[0] && int_valid[1])
|
||||||
{
|
{
|
||||||
|
@ -504,8 +504,8 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
int32_t int_val[2];
|
int32_t int_val[2];
|
||||||
bool int_valid[2] = { false };
|
bool int_valid[2] = { false };
|
||||||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
|
||||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
int_val[1] = ConsoleParseInt(argv[3], &int_valid[1]);
|
||||||
if (!int_valid[0])
|
if (!int_valid[0])
|
||||||
{
|
{
|
||||||
console.WriteLineError("Invalid staff ID");
|
console.WriteLineError("Invalid staff ID");
|
||||||
|
@ -541,7 +541,7 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
|
@ -677,7 +677,7 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
|
||||||
if (w != nullptr)
|
if (w != nullptr)
|
||||||
{
|
{
|
||||||
rct_viewport* viewport = WindowGetViewport(w);
|
rct_viewport* viewport = WindowGetViewport(w);
|
||||||
auto info = get_map_coordinates_from_pos(
|
auto info = GetMapCoordinatesFromPos(
|
||||||
{ viewport->view_width / 2, viewport->view_height / 2 }, EnumsToFlags(ViewportInteractionItem::Terrain));
|
{ viewport->view_width / 2, viewport->view_height / 2 }, EnumsToFlags(ViewportInteractionItem::Terrain));
|
||||||
|
|
||||||
auto tileMapCoord = TileCoordsXY(info.Loc);
|
auto tileMapCoord = TileCoordsXY(info.Loc);
|
||||||
|
@ -714,7 +714,7 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
else if (argv[0] == "current_rotation")
|
else if (argv[0] == "current_rotation")
|
||||||
{
|
{
|
||||||
console.WriteFormatLine("current_rotation %d", get_current_rotation());
|
console.WriteFormatLine("current_rotation %d", GetCurrentRotation());
|
||||||
}
|
}
|
||||||
else if (argv[0] == "host_timescale")
|
else if (argv[0] == "host_timescale")
|
||||||
{
|
{
|
||||||
|
@ -733,7 +733,7 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandSet(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (argv.size() > 1)
|
if (argv.size() > 1)
|
||||||
{
|
{
|
||||||
|
@ -747,8 +747,8 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (i + 1 < argv.size())
|
if (i + 1 < argv.size())
|
||||||
{
|
{
|
||||||
int_val[i] = console_parse_int(argv[i + 1], &int_valid[i]);
|
int_val[i] = ConsoleParseInt(argv[i + 1], &int_valid[i]);
|
||||||
double_val[i] = console_parse_double(argv[i + 1], &double_valid[i]);
|
double_val[i] = ConsoleParseDouble(argv[i + 1], &double_valid[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -759,7 +759,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[0] == "money" && invalidArguments(&invalidArgs, double_valid[0]))
|
if (argv[0] == "money" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
money32 money = ToMoney64FromGBP(double_val[0]);
|
money32 money = ToMoney64FromGBP(double_val[0]);
|
||||||
if (gCash != money)
|
if (gCash != money)
|
||||||
|
@ -778,7 +778,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get money");
|
console.Execute("get money");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "scenario_initial_cash" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "scenario_initial_cash" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::InitialCash, std::clamp(ToMoney64FromGBP(int_val[0]), 0.00_GBP, 1000000.00_GBP));
|
ScenarioSetSetting::InitialCash, std::clamp(ToMoney64FromGBP(int_val[0]), 0.00_GBP, 1000000.00_GBP));
|
||||||
|
@ -790,7 +790,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "current_loan" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "current_loan" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto amount = std::clamp(
|
auto amount = std::clamp(
|
||||||
ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, gMaxBankLoan);
|
ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, gMaxBankLoan);
|
||||||
|
@ -803,7 +803,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "max_loan" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "max_loan" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto amount = std::clamp(
|
auto amount = std::clamp(
|
||||||
ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, 5000000.00_GBP);
|
ToMoney64FromGBP(int_val[0]) - ToMoney64FromGBP(int_val[0] % 1000), 0.00_GBP, 5000000.00_GBP);
|
||||||
|
@ -816,7 +816,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_initial_cash" && invalidArguments(&invalidArgs, double_valid[0]))
|
else if (argv[0] == "guest_initial_cash" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::AverageCashPerGuest, std::clamp(ToMoney64FromGBP(double_val[0]), 0.00_GBP, 1000.00_GBP));
|
ScenarioSetSetting::AverageCashPerGuest, std::clamp(ToMoney64FromGBP(double_val[0]), 0.00_GBP, 1000.00_GBP));
|
||||||
|
@ -828,7 +828,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_initial_happiness" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "guest_initial_happiness" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::GuestInitialHappiness, CalculateGuestInitialHappiness(static_cast<uint8_t>(int_val[0])));
|
ScenarioSetSetting::GuestInitialHappiness, CalculateGuestInitialHappiness(static_cast<uint8_t>(int_val[0])));
|
||||||
|
@ -840,7 +840,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_initial_hunger" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "guest_initial_hunger" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::GuestInitialHunger, (std::clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1);
|
ScenarioSetSetting::GuestInitialHunger, (std::clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1);
|
||||||
|
@ -852,7 +852,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_initial_thirst" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "guest_initial_thirst" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::GuestInitialThirst, (std::clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1);
|
ScenarioSetSetting::GuestInitialThirst, (std::clamp(int_val[0], 1, 84) * 255 / 100 - 255) * -1);
|
||||||
|
@ -864,7 +864,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_prefer_less_intense_rides" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "guest_prefer_less_intense_rides" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::GuestsPreferLessIntenseRides, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::GuestsPreferLessIntenseRides, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -875,7 +875,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "guest_prefer_more_intense_rides" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "guest_prefer_more_intense_rides" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::GuestsPreferMoreIntenseRides, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::GuestsPreferMoreIntenseRides, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -886,7 +886,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "forbid_marketing_campaigns" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "forbid_marketing_campaigns" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidMarketingCampaigns, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidMarketingCampaigns, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -897,7 +897,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "forbid_landscape_changes" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "forbid_landscape_changes" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidLandscapeChanges, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidLandscapeChanges, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -908,7 +908,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "forbid_tree_removal" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "forbid_tree_removal" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidTreeRemoval, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidTreeRemoval, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -919,7 +919,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "forbid_high_construction" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "forbid_high_construction" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidHighConstruction, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ForbidHighConstruction, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -930,12 +930,12 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "pay_for_rides" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "pay_for_rides" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
SET_FLAG(gParkFlags, PARK_FLAGS_PARK_FREE_ENTRY, int_val[0]);
|
SET_FLAG(gParkFlags, PARK_FLAGS_PARK_FREE_ENTRY, int_val[0]);
|
||||||
console.Execute("get pay_for_rides");
|
console.Execute("get pay_for_rides");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "no_money" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "no_money" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto cheatSetAction = CheatSetAction(CheatType::NoMoney, int_val[0] != 0);
|
auto cheatSetAction = CheatSetAction(CheatType::NoMoney, int_val[0] != 0);
|
||||||
cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
cheatSetAction.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -946,7 +946,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&cheatSetAction);
|
GameActions::Execute(&cheatSetAction);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "difficult_park_rating" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "difficult_park_rating" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ParkRatingHigherDifficultyLevel, int_val[0]);
|
auto scenarioSetSetting = ScenarioSetSettingAction(ScenarioSetSetting::ParkRatingHigherDifficultyLevel, int_val[0]);
|
||||||
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
scenarioSetSetting.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -957,7 +957,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "difficult_guest_generation" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "difficult_guest_generation" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, int_val[0]);
|
ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, int_val[0]);
|
||||||
|
@ -969,7 +969,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "park_open" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "park_open" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
auto parkSetParameter = ParkSetParameterAction((int_val[0] == 1) ? ParkParameter::Open : ParkParameter::Close);
|
auto parkSetParameter = ParkSetParameterAction((int_val[0] == 1) ? ParkParameter::Open : ParkParameter::Close);
|
||||||
parkSetParameter.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
parkSetParameter.SetCallback([&console](const GameAction*, const GameActions::Result* res) {
|
||||||
|
@ -980,7 +980,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&parkSetParameter);
|
GameActions::Execute(&parkSetParameter);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "land_rights_cost" && invalidArguments(&invalidArgs, double_valid[0]))
|
else if (argv[0] == "land_rights_cost" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::CostToBuyLand, std::clamp(ToMoney64FromGBP(double_val[0]), 0.00_GBP, 200.00_GBP));
|
ScenarioSetSetting::CostToBuyLand, std::clamp(ToMoney64FromGBP(double_val[0]), 0.00_GBP, 200.00_GBP));
|
||||||
|
@ -992,7 +992,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
});
|
});
|
||||||
GameActions::Execute(&scenarioSetSetting);
|
GameActions::Execute(&scenarioSetSetting);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "construction_rights_cost" && invalidArguments(&invalidArgs, double_valid[0]))
|
else if (argv[0] == "construction_rights_cost" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
auto scenarioSetSetting = ScenarioSetSettingAction(
|
auto scenarioSetSetting = ScenarioSetSettingAction(
|
||||||
ScenarioSetSetting::CostToBuyConstructionRights,
|
ScenarioSetSetting::CostToBuyConstructionRights,
|
||||||
|
@ -1039,18 +1039,18 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get climate");
|
console.Execute("get climate");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "game_speed" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "game_speed" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
gGameSpeed = std::clamp(int_val[0], 1, 8);
|
gGameSpeed = std::clamp(int_val[0], 1, 8);
|
||||||
console.Execute("get game_speed");
|
console.Execute("get game_speed");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "console_small_font" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "console_small_font" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
gConfigInterface.ConsoleSmallFont = (int_val[0] != 0);
|
gConfigInterface.ConsoleSmallFont = (int_val[0] != 0);
|
||||||
ConfigSaveDefault();
|
ConfigSaveDefault();
|
||||||
console.Execute("get console_small_font");
|
console.Execute("get console_small_font");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "location" && invalidArguments(&invalidArgs, int_valid[0] && int_valid[1]))
|
else if (argv[0] == "location" && InvalidArguments(&invalidArgs, int_valid[0] && int_valid[1]))
|
||||||
{
|
{
|
||||||
rct_window* w = WindowGetMain();
|
rct_window* w = WindowGetMain();
|
||||||
if (w != nullptr)
|
if (w != nullptr)
|
||||||
|
@ -1058,11 +1058,11 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre();
|
auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre();
|
||||||
location.z = TileElementHeight(location);
|
location.z = TileElementHeight(location);
|
||||||
w->SetLocation(location);
|
w->SetLocation(location);
|
||||||
viewport_update_position(w);
|
ViewportUpdatePosition(w);
|
||||||
console.Execute("get location");
|
console.Execute("get location");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "window_scale" && invalidArguments(&invalidArgs, double_valid[0]))
|
else if (argv[0] == "window_scale" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
float newScale = static_cast<float>(0.001 * std::trunc(1000 * double_val[0]));
|
float newScale = static_cast<float>(0.001 * std::trunc(1000 * double_val[0]));
|
||||||
gConfigGeneral.WindowScale = std::clamp(newScale, 0.5f, 5.0f);
|
gConfigGeneral.WindowScale = std::clamp(newScale, 0.5f, 5.0f);
|
||||||
|
@ -1072,24 +1072,24 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
ContextUpdateCursorScale();
|
ContextUpdateCursorScale();
|
||||||
console.Execute("get window_scale");
|
console.Execute("get window_scale");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "window_limit" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "window_limit" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
WindowSetWindowLimit(int_val[0]);
|
WindowSetWindowLimit(int_val[0]);
|
||||||
console.Execute("get window_limit");
|
console.Execute("get window_limit");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "render_weather_effects" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "render_weather_effects" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
gConfigGeneral.RenderWeatherEffects = (int_val[0] != 0);
|
gConfigGeneral.RenderWeatherEffects = (int_val[0] != 0);
|
||||||
ConfigSaveDefault();
|
ConfigSaveDefault();
|
||||||
console.Execute("get render_weather_effects");
|
console.Execute("get render_weather_effects");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "render_weather_gloom" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "render_weather_gloom" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
gConfigGeneral.RenderWeatherGloom = (int_val[0] != 0);
|
gConfigGeneral.RenderWeatherGloom = (int_val[0] != 0);
|
||||||
ConfigSaveDefault();
|
ConfigSaveDefault();
|
||||||
console.Execute("get render_weather_gloom");
|
console.Execute("get render_weather_gloom");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "cheat_sandbox_mode" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "cheat_sandbox_mode" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
if (gCheatsSandboxMode != (int_val[0] != 0))
|
if (gCheatsSandboxMode != (int_val[0] != 0))
|
||||||
{
|
{
|
||||||
|
@ -1107,7 +1107,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get cheat_sandbox_mode");
|
console.Execute("get cheat_sandbox_mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "cheat_disable_clearance_checks" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "cheat_disable_clearance_checks" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
if (gCheatsDisableClearanceChecks != (int_val[0] != 0))
|
if (gCheatsDisableClearanceChecks != (int_val[0] != 0))
|
||||||
{
|
{
|
||||||
|
@ -1125,7 +1125,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get cheat_disable_clearance_checks");
|
console.Execute("get cheat_disable_clearance_checks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "cheat_disable_support_limits" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "cheat_disable_support_limits" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
if (gCheatsDisableSupportLimits != (int_val[0] != 0))
|
if (gCheatsDisableSupportLimits != (int_val[0] != 0))
|
||||||
{
|
{
|
||||||
|
@ -1143,9 +1143,9 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get cheat_disable_support_limits");
|
console.Execute("get cheat_disable_support_limits");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "current_rotation" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "current_rotation" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
uint8_t currentRotation = get_current_rotation();
|
uint8_t currentRotation = GetCurrentRotation();
|
||||||
rct_window* mainWindow = WindowGetMain();
|
rct_window* mainWindow = WindowGetMain();
|
||||||
int32_t newRotation = int_val[0];
|
int32_t newRotation = int_val[0];
|
||||||
if (newRotation < 0 || newRotation > 3)
|
if (newRotation < 0 || newRotation > 3)
|
||||||
|
@ -1158,7 +1158,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
console.Execute("get current_rotation");
|
console.Execute("get current_rotation");
|
||||||
}
|
}
|
||||||
else if (argv[0] == "host_timescale" && invalidArguments(&invalidArgs, double_valid[0]))
|
else if (argv[0] == "host_timescale" && InvalidArguments(&invalidArgs, double_valid[0]))
|
||||||
{
|
{
|
||||||
float newScale = static_cast<float>(double_val[0]);
|
float newScale = static_cast<float>(double_val[0]);
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
console.Execute("get host_timescale");
|
console.Execute("get host_timescale");
|
||||||
}
|
}
|
||||||
#ifndef NO_TTF
|
#ifndef NO_TTF
|
||||||
else if (argv[0] == "enable_hinting" && invalidArguments(&invalidArgs, int_valid[0]))
|
else if (argv[0] == "enable_hinting" && InvalidArguments(&invalidArgs, int_valid[0]))
|
||||||
{
|
{
|
||||||
gConfigFonts.EnableHinting = (int_val[0] != 0);
|
gConfigFonts.EnableHinting = (int_val[0] != 0);
|
||||||
ConfigSaveDefault();
|
ConfigSaveDefault();
|
||||||
|
@ -1193,7 +1193,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_load_object(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandLoadObject(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
|
@ -1293,7 +1293,7 @@ constexpr std::array _objectTypeNames = {
|
||||||
};
|
};
|
||||||
static_assert(_objectTypeNames.size() == EnumValue(ObjectType::Count));
|
static_assert(_objectTypeNames.size() == EnumValue(ObjectType::Count));
|
||||||
|
|
||||||
static int32_t cc_object_count(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandCountObjects(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
for (auto objectType : ObjectTypes)
|
for (auto objectType : ObjectTypes)
|
||||||
{
|
{
|
||||||
|
@ -1313,13 +1313,13 @@ static int32_t cc_object_count(InteractiveConsole& console, [[maybe_unused]] con
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandOpen(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
bool title = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0;
|
bool title = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0;
|
||||||
bool invalidTitle = false;
|
bool invalidTitle = false;
|
||||||
if (argv[0] == "object_selection" && invalidArguments(&invalidTitle, !title))
|
if (argv[0] == "object_selection" && InvalidArguments(&invalidTitle, !title))
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1332,7 +1332,7 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
|
||||||
ContextOpenWindow(WindowClass::EditorObjectSelection);
|
ContextOpenWindow(WindowClass::EditorObjectSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "inventions_list" && invalidArguments(&invalidTitle, !title))
|
else if (argv[0] == "inventions_list" && InvalidArguments(&invalidTitle, !title))
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1343,11 +1343,11 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
|
||||||
ContextOpenWindow(WindowClass::EditorInventionList);
|
ContextOpenWindow(WindowClass::EditorInventionList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argv[0] == "scenario_options" && invalidArguments(&invalidTitle, !title))
|
else if (argv[0] == "scenario_options" && InvalidArguments(&invalidTitle, !title))
|
||||||
{
|
{
|
||||||
ContextOpenWindow(WindowClass::EditorScenarioOptions);
|
ContextOpenWindow(WindowClass::EditorScenarioOptions);
|
||||||
}
|
}
|
||||||
else if (argv[0] == "objective_options" && invalidArguments(&invalidTitle, !title))
|
else if (argv[0] == "objective_options" && InvalidArguments(&invalidTitle, !title))
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1378,21 +1378,21 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_remove_unused_objects(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandRemoveUnusedObjects(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
int32_t result = editor_remove_unused_objects();
|
int32_t result = editor_remove_unused_objects();
|
||||||
console.WriteFormatLine("%d unused object entries have been removed.", result);
|
console.WriteFormatLine("%d unused object entries have been removed.", result);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_remove_floating_objects(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandRemoveFloatingObjects(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
uint16_t result = RemoveFloatingEntities();
|
uint16_t result = RemoveFloatingEntities();
|
||||||
console.WriteFormatLine("Removed %d flying objects", result);
|
console.WriteFormatLine("Removed %d flying objects", result);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_remove_park_fences(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandRemoveParkFences(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
tile_element_iterator it;
|
tile_element_iterator it;
|
||||||
TileElementIteratorBegin(&it);
|
TileElementIteratorBegin(&it);
|
||||||
|
@ -1411,7 +1411,7 @@ static int32_t cc_remove_park_fences(InteractiveConsole& console, [[maybe_unused
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandShowLimits(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
const auto& tileElements = GetTileElements();
|
const auto& tileElements = GetTileElements();
|
||||||
const auto tileElementCount = tileElements.size();
|
const auto tileElementCount = tileElements.size();
|
||||||
|
@ -1433,7 +1433,7 @@ static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] cons
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandForceDate([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
int32_t year = 0;
|
int32_t year = 0;
|
||||||
int32_t month = 0;
|
int32_t month = 0;
|
||||||
|
@ -1490,7 +1490,7 @@ static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_load_park([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandLoadPark([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (argv.size() < 1)
|
if (argv.size() < 1)
|
||||||
{
|
{
|
||||||
|
@ -1526,7 +1526,7 @@ static int32_t cc_load_park([[maybe_unused]] InteractiveConsole& console, [[mayb
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_save_park([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandSavePark([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (argv.size() < 1)
|
if (argv.size() < 1)
|
||||||
{
|
{
|
||||||
|
@ -1539,7 +1539,7 @@ static int32_t cc_save_park([[maybe_unused]] InteractiveConsole& console, [[mayb
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_say(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandSay(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() == NETWORK_MODE_NONE || network_get_status() != NETWORK_STATUS_CONNECTED
|
if (network_get_mode() == NETWORK_MODE_NONE || network_get_status() != NETWORK_STATUS_CONNECTED
|
||||||
|| network_get_authstatus() != NetworkAuth::Ok)
|
|| network_get_authstatus() != NetworkAuth::Ok)
|
||||||
|
@ -1558,7 +1558,7 @@ static int32_t cc_say(InteractiveConsole& console, const arguments_t& argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_replay_startrecord(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandReplayStartRecord(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1605,7 +1605,7 @@ static int32_t cc_replay_startrecord(InteractiveConsole& console, const argument
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_replay_stoprecord(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandReplayStopRecord(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1640,7 +1640,7 @@ static int32_t cc_replay_stoprecord(InteractiveConsole& console, const arguments
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_replay_start(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandReplayStart(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1682,7 +1682,7 @@ static int32_t cc_replay_start(InteractiveConsole& console, const arguments_t& a
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_replay_stop(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandReplayStop(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1700,7 +1700,7 @@ static int32_t cc_replay_stop(InteractiveConsole& console, const arguments_t& ar
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_replay_normalise(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandReplayNormalise(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (network_get_mode() != NETWORK_MODE_NONE)
|
if (network_get_mode() != NETWORK_MODE_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1735,7 +1735,7 @@ static int32_t cc_replay_normalise(InteractiveConsole& console, const arguments_
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandMpDesync(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
int32_t desyncType = 0;
|
int32_t desyncType = 0;
|
||||||
if (argv.size() >= 1)
|
if (argv.size() >= 1)
|
||||||
|
@ -1789,13 +1789,13 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4702) // unreachable code
|
#pragma warning(disable : 4702) // unreachable code
|
||||||
static int32_t cc_abort([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandAbort([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
std::abort();
|
std::abort();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_dereference([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandDereference([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||||
|
@ -1806,14 +1806,14 @@ static int32_t cc_dereference([[maybe_unused]] InteractiveConsole& console, [[ma
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_terminate([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandTerminate([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
std::terminate();
|
std::terminate();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
|
||||||
static int32_t cc_assert([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandAssert([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
Guard::Assert(false, "%s", argv[0].c_str());
|
Guard::Assert(false, "%s", argv[0].c_str());
|
||||||
|
@ -1822,7 +1822,7 @@ static int32_t cc_assert([[maybe_unused]] InteractiveConsole& console, [[maybe_u
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandAddNewsItem([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (argv.size() < 2)
|
if (argv.size() < 2)
|
||||||
{
|
{
|
||||||
|
@ -1871,12 +1871,14 @@ static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_profiler_reset([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandProfilerReset(
|
||||||
|
[[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
OpenRCT2::Profiling::ResetData();
|
OpenRCT2::Profiling::ResetData();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int32_t cc_profiler_start([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandProfilerStart(
|
||||||
|
[[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!OpenRCT2::Profiling::IsEnabled())
|
if (!OpenRCT2::Profiling::IsEnabled())
|
||||||
console.WriteLine("Started profiler");
|
console.WriteLine("Started profiler");
|
||||||
|
@ -1884,7 +1886,8 @@ static int32_t cc_profiler_start([[maybe_unused]] InteractiveConsole& console, [
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_profiler_exportcsv([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandProfilerExportCSV(
|
||||||
|
[[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (argv.size() < 1)
|
if (argv.size() < 1)
|
||||||
{
|
{
|
||||||
|
@ -1903,7 +1906,8 @@ static int32_t cc_profiler_exportcsv([[maybe_unused]] InteractiveConsole& consol
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_profiler_stop([[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandProfilerStop(
|
||||||
|
[[maybe_unused]] InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (OpenRCT2::Profiling::IsEnabled())
|
if (OpenRCT2::Profiling::IsEnabled())
|
||||||
console.WriteLine("Stopped profiler");
|
console.WriteLine("Stopped profiler");
|
||||||
|
@ -1912,7 +1916,7 @@ static int32_t cc_profiler_stop([[maybe_unused]] InteractiveConsole& console, [[
|
||||||
// Export to CSV if argument is provided.
|
// Export to CSV if argument is provided.
|
||||||
if (argv.size() >= 1)
|
if (argv.size() >= 1)
|
||||||
{
|
{
|
||||||
return cc_profiler_exportcsv(console, argv);
|
return ConsoleCommandProfilerExportCSV(console, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1979,56 +1983,59 @@ static constexpr const utf8* console_window_table[] = {
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
static constexpr const console_command console_command_table[] = {
|
static constexpr const console_command console_command_table[] = {
|
||||||
{ "abort", cc_abort, "Calls std::abort(), for testing purposes only.", "abort" },
|
{ "abort", ConsoleCommandAbort, "Calls std::abort(), for testing purposes only.", "abort" },
|
||||||
{ "add_news_item", cc_add_news_item, "Inserts a news item", "add_news_item [<type> <message> <assoc>]" },
|
{ "add_news_item", ConsoleCommandAddNewsItem, "Inserts a news item", "add_news_item [<type> <message> <assoc>]" },
|
||||||
{ "assert", cc_assert, "Triggers assertion failure, for testing purposes only", "assert" },
|
{ "assert", ConsoleCommandAssert, "Triggers assertion failure, for testing purposes only", "assert" },
|
||||||
{ "clear", cc_clear, "Clears the console.", "clear" },
|
{ "clear", ConsoleCommandClear, "Clears the console.", "clear" },
|
||||||
{ "close", cc_close, "Closes the console.", "close" },
|
{ "close", ConsoleCommandClose, "Closes the console.", "close" },
|
||||||
{ "date", cc_for_date, "Sets the date to a given date.", "Format <year>[ <month>[ <day>]]." },
|
{ "date", ConsoleCommandForceDate, "Sets the date to a given date.", "Format <year>[ <month>[ <day>]]." },
|
||||||
{ "dereference", cc_dereference, "Dereferences a nullptr, for testing purposes only", "dereference" },
|
{ "dereference", ConsoleCommandDereference, "Dereferences a nullptr, for testing purposes only", "dereference" },
|
||||||
{ "echo", cc_echo, "Echoes the text to the console.", "echo <text>" },
|
{ "echo", ConsoleCommandEcho, "Echoes the text to the console.", "echo <text>" },
|
||||||
{ "exit", cc_close, "Closes the console.", "exit" },
|
{ "exit", ConsoleCommandClose, "Closes the console.", "exit" },
|
||||||
{ "get", cc_get, "Gets the value of the specified variable.", "get <variable>" },
|
{ "get", ConsoleCommandGet, "Gets the value of the specified variable.", "get <variable>" },
|
||||||
{ "help", cc_help, "Lists commands or info about a command.", "help [command]" },
|
{ "help", ConsoleCommandHelp, "Lists commands or info about a command.", "help [command]" },
|
||||||
{ "hide", cc_hide, "Hides the console.", "hide" },
|
{ "hide", ConsoleCommandHide, "Hides the console.", "hide" },
|
||||||
{ "load_object", cc_load_object,
|
{ "load_object", ConsoleCommandLoadObject,
|
||||||
"Loads the object file into the scenario.\n"
|
"Loads the object file into the scenario.\n"
|
||||||
"Loading a scenery group will not load its associated objects.\n"
|
"Loading a scenery group will not load its associated objects.\n"
|
||||||
"This is a safer method opposed to \"open object_selection\".",
|
"This is a safer method opposed to \"open object_selection\".",
|
||||||
"load_object <objectfilenodat>" },
|
"load_object <objectfilenodat>" },
|
||||||
{ "load_park", cc_load_park, "Load park from save directory or by absolute path", "load_park <filename>" },
|
{ "load_park", ConsoleCommandLoadPark, "Load park from save directory or by absolute path", "load_park <filename>" },
|
||||||
{ "object_count", cc_object_count, "Shows the number of objects of each type in the scenario.", "object_count" },
|
{ "object_count", ConsoleCommandCountObjects, "Shows the number of objects of each type in the scenario.", "object_count" },
|
||||||
{ "open", cc_open, "Opens the window with the give name.", "open <window>." },
|
{ "open", ConsoleCommandOpen, "Opens the window with the give name.", "open <window>." },
|
||||||
{ "quit", cc_close, "Closes the console.", "quit" },
|
{ "quit", ConsoleCommandClose, "Closes the console.", "quit" },
|
||||||
{ "remove_park_fences", cc_remove_park_fences, "Removes all park fences from the surface", "remove_park_fences" },
|
{ "remove_park_fences", ConsoleCommandRemoveParkFences, "Removes all park fences from the surface", "remove_park_fences" },
|
||||||
{ "remove_unused_objects", cc_remove_unused_objects, "Removes all the unused objects from the object selection.",
|
{ "remove_unused_objects", ConsoleCommandRemoveUnusedObjects, "Removes all the unused objects from the object selection.",
|
||||||
"remove_unused_objects" },
|
"remove_unused_objects" },
|
||||||
{ "remove_floating_objects", cc_remove_floating_objects, "Removes floating objects", "remove_floating_objects" },
|
{ "remove_floating_objects", ConsoleCommandRemoveFloatingObjects, "Removes floating objects", "remove_floating_objects" },
|
||||||
{ "rides", cc_rides, "Ride management.", "rides <subcommand>" },
|
{ "rides", ConsoleCommandRides, "Ride management.", "rides <subcommand>" },
|
||||||
{ "save_park", cc_save_park, "Save current state of park. If no name specified default path will be used.",
|
{ "save_park", ConsoleCommandSavePark, "Save current state of park. If no name specified default path will be used.",
|
||||||
"save_park [name]" },
|
"save_park [name]" },
|
||||||
{ "say", cc_say, "Say to other players.", "say <message>" },
|
{ "say", ConsoleCommandSay, "Say to other players.", "say <message>" },
|
||||||
{ "set", cc_set, "Sets the variable to the specified value.", "set <variable> <value>" },
|
{ "set", ConsoleCommandSet, "Sets the variable to the specified value.", "set <variable> <value>" },
|
||||||
{ "show_limits", cc_show_limits, "Shows the map data counts and limits.", "show_limits" },
|
{ "show_limits", ConsoleCommandShowLimits, "Shows the map data counts and limits.", "show_limits" },
|
||||||
{ "staff", cc_staff, "Staff management.", "staff <subcommand>" },
|
{ "staff", ConsoleCommandStaff, "Staff management.", "staff <subcommand>" },
|
||||||
{ "terminate", cc_terminate, "Calls std::terminate(), for testing purposes only.", "terminate" },
|
{ "terminate", ConsoleCommandTerminate, "Calls std::terminate(), for testing purposes only.", "terminate" },
|
||||||
{ "variables", cc_variables, "Lists all the variables that can be used with get and sometimes set.", "variables" },
|
{ "variables", ConsoleCommandVariables, "Lists all the variables that can be used with get and sometimes set.",
|
||||||
{ "windows", cc_windows, "Lists all the windows that can be opened.", "windows" },
|
"variables" },
|
||||||
{ "replay_startrecord", cc_replay_startrecord, "Starts recording a new replay.", "replay_startrecord <name> [max_ticks]" },
|
{ "windows", ConsoleCommandWindows, "Lists all the windows that can be opened.", "windows" },
|
||||||
{ "replay_stoprecord", cc_replay_stoprecord, "Stops recording a new replay.", "replay_stoprecord" },
|
{ "replay_startrecord", ConsoleCommandReplayStartRecord, "Starts recording a new replay.",
|
||||||
{ "replay_start", cc_replay_start, "Starts a replay", "replay_start <name>" },
|
"replay_startrecord <name> [max_ticks]" },
|
||||||
{ "replay_stop", cc_replay_stop, "Stops the replay", "replay_stop" },
|
{ "replay_stoprecord", ConsoleCommandReplayStopRecord, "Stops recording a new replay.", "replay_stoprecord" },
|
||||||
{ "replay_normalise", cc_replay_normalise, "Normalises the replay to remove all gaps",
|
{ "replay_start", ConsoleCommandReplayStart, "Starts a replay", "replay_start <name>" },
|
||||||
|
{ "replay_stop", ConsoleCommandReplayStop, "Stops the replay", "replay_stop" },
|
||||||
|
{ "replay_normalise", ConsoleCommandReplayNormalise, "Normalises the replay to remove all gaps",
|
||||||
"replay_normalise <input file> <output file>" },
|
"replay_normalise <input file> <output file>" },
|
||||||
{ "mp_desync", cc_mp_desync, "Forces a multiplayer desync",
|
{ "mp_desync", ConsoleCommandMpDesync, "Forces a multiplayer desync",
|
||||||
"cc_mp_desync [desync_type, 0 = Random t-shirt color on random guest, 1 = Remove random guest ]" },
|
"ConsoleCommandMpDesync [desync_type, 0 = Random t-shirt color on random guest, 1 = Remove random guest ]" },
|
||||||
{ "profiler_reset", cc_profiler_reset, "Resets the profiler data.", "profiler_reset" },
|
{ "profiler_reset", ConsoleCommandProfilerReset, "Resets the profiler data.", "profiler_reset" },
|
||||||
{ "profiler_start", cc_profiler_start, "Starts the profiler.", "profiler_start" },
|
{ "profiler_start", ConsoleCommandProfilerStart, "Starts the profiler.", "profiler_start" },
|
||||||
{ "profiler_stop", cc_profiler_stop, "Stops the profiler.", "profiler_stop [<output file>]" },
|
{ "profiler_stop", ConsoleCommandProfilerStop, "Stops the profiler.", "profiler_stop [<output file>]" },
|
||||||
{ "profiler_exportcsv", cc_profiler_exportcsv, "Exports the current profiler data.", "profiler_exportcsv <output file>" },
|
{ "profiler_exportcsv", ConsoleCommandProfilerExportCSV, "Exports the current profiler data.",
|
||||||
|
"profiler_exportcsv <output file>" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t cc_windows(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandWindows(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
for (auto s : console_window_table)
|
for (auto s : console_window_table)
|
||||||
{
|
{
|
||||||
|
@ -2037,7 +2044,7 @@ static int32_t cc_windows(InteractiveConsole& console, [[maybe_unused]] const ar
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_variables(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
static int32_t ConsoleCommandVariables(InteractiveConsole& console, [[maybe_unused]] const arguments_t& argv)
|
||||||
{
|
{
|
||||||
for (auto s : console_variable_table)
|
for (auto s : console_variable_table)
|
||||||
{
|
{
|
||||||
|
@ -2046,7 +2053,7 @@ static int32_t cc_variables(InteractiveConsole& console, [[maybe_unused]] const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cc_help(InteractiveConsole& console, const arguments_t& argv)
|
static int32_t ConsoleCommandHelp(InteractiveConsole& console, const arguments_t& argv)
|
||||||
{
|
{
|
||||||
if (!argv.empty())
|
if (!argv.empty())
|
||||||
{
|
{
|
||||||
|
@ -2061,12 +2068,12 @@ static int32_t cc_help(InteractiveConsole& console, const arguments_t& argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console_write_all_commands(console);
|
ConsoleWriteAllCommands(console);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void console_write_all_commands(InteractiveConsole& console)
|
static void ConsoleWriteAllCommands(InteractiveConsole& console)
|
||||||
{
|
{
|
||||||
for (const auto& c : console_command_table)
|
for (const auto& c : console_command_table)
|
||||||
{
|
{
|
||||||
|
@ -2074,7 +2081,7 @@ static void console_write_all_commands(InteractiveConsole& console)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool invalidArguments(bool* invalid, bool arguments)
|
static bool InvalidArguments(bool* invalid, bool arguments)
|
||||||
{
|
{
|
||||||
if (!arguments)
|
if (!arguments)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ static bool WriteDpiToFile(std::string_view path, const rct_drawpixelinfo* dpi,
|
||||||
*
|
*
|
||||||
* rct2: 0x006E3AEC
|
* rct2: 0x006E3AEC
|
||||||
*/
|
*/
|
||||||
void screenshot_check()
|
void ScreenshotCheck()
|
||||||
{
|
{
|
||||||
if (gScreenshotCountdown != 0)
|
if (gScreenshotCountdown != 0)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ void screenshot_check()
|
||||||
if (gScreenshotCountdown == 0)
|
if (gScreenshotCountdown == 0)
|
||||||
{
|
{
|
||||||
// update_weather_animation();
|
// update_weather_animation();
|
||||||
std::string screenshotPath = screenshot_dump();
|
std::string screenshotPath = ScreenshotDump();
|
||||||
|
|
||||||
if (!screenshotPath.empty())
|
if (!screenshotPath.empty())
|
||||||
{
|
{
|
||||||
|
@ -102,18 +102,18 @@ void screenshot_check()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string screenshot_get_park_name()
|
static std::string ScreenshotGetParkName()
|
||||||
{
|
{
|
||||||
return GetContext()->GetGameState()->GetPark().Name;
|
return GetContext()->GetGameState()->GetPark().Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string screenshot_get_directory()
|
static std::string ScreenshotGetDirectory()
|
||||||
{
|
{
|
||||||
auto env = GetContext()->GetPlatformEnvironment();
|
auto env = GetContext()->GetPlatformEnvironment();
|
||||||
return env->GetDirectoryPath(DIRBASE::USER, DIRID::SCREENSHOT);
|
return env->GetDirectoryPath(DIRBASE::USER, DIRID::SCREENSHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::pair<rct2_date, rct2_time> screenshot_get_date_time()
|
static std::pair<rct2_date, rct2_time> ScreenshotGetDateTime()
|
||||||
{
|
{
|
||||||
auto date = Platform::GetDateLocal();
|
auto date = Platform::GetDateLocal();
|
||||||
auto time = Platform::GetTimeLocal();
|
auto time = Platform::GetTimeLocal();
|
||||||
|
@ -121,9 +121,9 @@ static std::pair<rct2_date, rct2_time> screenshot_get_date_time()
|
||||||
return { date, time };
|
return { date, time };
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string screenshot_get_formatted_date_time()
|
static std::string ScreenshotGetFormattedDateTime()
|
||||||
{
|
{
|
||||||
auto [date, time] = screenshot_get_date_time();
|
auto [date, time] = ScreenshotGetDateTime();
|
||||||
char formatted[64];
|
char formatted[64];
|
||||||
snprintf(
|
snprintf(
|
||||||
formatted, sizeof(formatted), "%4d-%02d-%02d %02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.minute,
|
formatted, sizeof(formatted), "%4d-%02d-%02d %02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.minute,
|
||||||
|
@ -131,17 +131,17 @@ static std::string screenshot_get_formatted_date_time()
|
||||||
return formatted;
|
return formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::optional<std::string> screenshot_get_next_path()
|
static std::optional<std::string> ScreenshotGetNextPath()
|
||||||
{
|
{
|
||||||
auto screenshotDirectory = screenshot_get_directory();
|
auto screenshotDirectory = ScreenshotGetDirectory();
|
||||||
if (!Platform::EnsureDirectoryExists(screenshotDirectory.c_str()))
|
if (!Platform::EnsureDirectoryExists(screenshotDirectory.c_str()))
|
||||||
{
|
{
|
||||||
log_error("Unable to save screenshots in OpenRCT2 screenshot directory.");
|
log_error("Unable to save screenshots in OpenRCT2 screenshot directory.");
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto parkName = screenshot_get_park_name();
|
auto parkName = ScreenshotGetParkName();
|
||||||
auto dateTime = screenshot_get_formatted_date_time();
|
auto dateTime = ScreenshotGetFormattedDateTime();
|
||||||
auto name = parkName + " " + dateTime;
|
auto name = parkName + " " + dateTime;
|
||||||
|
|
||||||
// Generate a path with a `tries` number
|
// Generate a path with a `tries` number
|
||||||
|
@ -164,10 +164,10 @@ static std::optional<std::string> screenshot_get_next_path()
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string screenshot_dump_png(rct_drawpixelinfo* dpi)
|
std::string ScreenshotDumpPNG(rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
// Get a free screenshot path
|
// Get a free screenshot path
|
||||||
auto path = screenshot_get_next_path();
|
auto path = ScreenshotGetNextPath();
|
||||||
|
|
||||||
if (!path.has_value())
|
if (!path.has_value())
|
||||||
{
|
{
|
||||||
|
@ -182,9 +182,9 @@ std::string screenshot_dump_png(rct_drawpixelinfo* dpi)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string screenshot_dump_png_32bpp(int32_t width, int32_t height, const void* pixels)
|
std::string ScreenshotDumpPNG32bpp(int32_t width, int32_t height, const void* pixels)
|
||||||
{
|
{
|
||||||
auto path = screenshot_get_next_path();
|
auto path = ScreenshotGetNextPath();
|
||||||
|
|
||||||
if (!path.has_value())
|
if (!path.has_value())
|
||||||
{
|
{
|
||||||
|
@ -336,21 +336,21 @@ static void RenderViewport(IDrawingEngine* drawingEngine, const rct_viewport& vi
|
||||||
drawingEngine = tempDrawingEngine.get();
|
drawingEngine = tempDrawingEngine.get();
|
||||||
}
|
}
|
||||||
dpi.DrawingEngine = drawingEngine;
|
dpi.DrawingEngine = drawingEngine;
|
||||||
viewport_render(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } });
|
ViewportRender(&dpi, &viewport, { { 0, 0 }, { viewport.width, viewport.height } });
|
||||||
}
|
}
|
||||||
|
|
||||||
void screenshot_giant()
|
void ScreenshotGiant()
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo dpi{};
|
rct_drawpixelinfo dpi{};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto path = screenshot_get_next_path();
|
auto path = ScreenshotGetNextPath();
|
||||||
if (!path.has_value())
|
if (!path.has_value())
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Giant screenshot failed, unable to find a suitable destination path.");
|
throw std::runtime_error("Giant screenshot failed, unable to find a suitable destination path.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto rotation = get_current_rotation();
|
const auto rotation = GetCurrentRotation();
|
||||||
auto zoom = ZoomLevel{ 0 };
|
auto zoom = ZoomLevel{ 0 };
|
||||||
auto* mainWindow = WindowGetMain();
|
auto* mainWindow = WindowGetMain();
|
||||||
const auto* vp = WindowGetViewport(mainWindow);
|
const auto* vp = WindowGetViewport(mainWindow);
|
||||||
|
@ -399,7 +399,7 @@ template<typename FN> static inline double MeasureFunctionTime(const FN& fn)
|
||||||
return std::chrono::duration<double>(endTime - startTime).count();
|
return std::chrono::duration<double>(endTime - startTime).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptr<IContext>& context, uint32_t iterationCount)
|
static void BenchgfxRenderScreenshots(const char* inputPath, std::unique_ptr<IContext>& context, uint32_t iterationCount)
|
||||||
{
|
{
|
||||||
if (!context->LoadParkFromFile(inputPath))
|
if (!context->LoadParkFromFile(inputPath))
|
||||||
{
|
{
|
||||||
|
@ -482,7 +482,7 @@ static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptr<I
|
||||||
ReleaseDPI(dpi);
|
ReleaseDPI(dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t cmdline_for_gfxbench(const char** argv, int32_t argc)
|
int32_t CmdlineForGfxbench(const char** argv, int32_t argc)
|
||||||
{
|
{
|
||||||
if (argc != 1 && argc != 2)
|
if (argc != 1 && argc != 2)
|
||||||
{
|
{
|
||||||
|
@ -506,7 +506,7 @@ int32_t cmdline_for_gfxbench(const char** argv, int32_t argc)
|
||||||
{
|
{
|
||||||
drawing_engine_init();
|
drawing_engine_init();
|
||||||
|
|
||||||
benchgfx_render_screenshots(inputPath, context, iterationCount);
|
BenchgfxRenderScreenshots(inputPath, context, iterationCount);
|
||||||
|
|
||||||
drawing_engine_dispose();
|
drawing_engine_dispose();
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ static void ApplyOptions(const ScreenshotOptions* options, rct_viewport& viewpor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOptions* options)
|
int32_t CmdlineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* options)
|
||||||
{
|
{
|
||||||
// Don't include options in the count (they have been handled by CommandLine::ParseOptions already)
|
// Don't include options in the count (they have been handled by CommandLine::ParseOptions already)
|
||||||
for (int32_t i = 0; i < argc; i++)
|
for (int32_t i = 0; i < argc; i++)
|
||||||
|
@ -724,7 +724,7 @@ static std::string ResolveFilenameForCapture(const fs::path& filename)
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
{
|
{
|
||||||
// Automatic filename
|
// Automatic filename
|
||||||
auto path = screenshot_get_next_path();
|
auto path = ScreenshotGetNextPath();
|
||||||
if (!path)
|
if (!path)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Unable to generate a filename for capture.");
|
throw std::runtime_error("Unable to generate a filename for capture.");
|
||||||
|
@ -732,7 +732,7 @@ static std::string ResolveFilenameForCapture(const fs::path& filename)
|
||||||
return *path;
|
return *path;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto screenshotDirectory = fs::u8path(screenshot_get_directory());
|
auto screenshotDirectory = fs::u8path(ScreenshotGetDirectory());
|
||||||
auto screenshotPath = fs::absolute(screenshotDirectory / filename);
|
auto screenshotPath = fs::absolute(screenshotDirectory / filename);
|
||||||
|
|
||||||
// Check the filename isn't attempting to leave the screenshot directory for security
|
// Check the filename isn't attempting to leave the screenshot directory for security
|
||||||
|
|
|
@ -52,13 +52,13 @@ struct CaptureOptions
|
||||||
bool Transparent{};
|
bool Transparent{};
|
||||||
};
|
};
|
||||||
|
|
||||||
void screenshot_check();
|
void ScreenshotCheck();
|
||||||
std::string screenshot_dump();
|
std::string ScreenshotDump();
|
||||||
std::string screenshot_dump_png(rct_drawpixelinfo* dpi);
|
std::string ScreenshotDumpPNG(rct_drawpixelinfo* dpi);
|
||||||
std::string screenshot_dump_png_32bpp(int32_t width, int32_t height, const void* pixels);
|
std::string ScreenshotDumpPNG32bpp(int32_t width, int32_t height, const void* pixels);
|
||||||
|
|
||||||
void screenshot_giant();
|
void ScreenshotGiant();
|
||||||
int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOptions* options);
|
int32_t CmdlineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* options);
|
||||||
int32_t cmdline_for_gfxbench(const char** argv, int32_t argc);
|
int32_t CmdlineForGfxbench(const char** argv, int32_t argc);
|
||||||
|
|
||||||
void CaptureImage(const CaptureOptions& options);
|
void CaptureImage(const CaptureOptions& options);
|
||||||
|
|
|
@ -77,18 +77,18 @@ InteractionInfo::InteractionInfo(const PaintStruct* ps)
|
||||||
, SpriteType(ps->sprite_type)
|
, SpriteType(ps->sprite_type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static void viewport_paint_weather_gloom(rct_drawpixelinfo* dpi);
|
static void ViewportPaintWeatherGloom(rct_drawpixelinfo* dpi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is not a viewport function. It is used to setup many variables for
|
* This is not a viewport function. It is used to setup many variables for
|
||||||
* multiple things.
|
* multiple things.
|
||||||
* rct2: 0x006E6EAC
|
* rct2: 0x006E6EAC
|
||||||
*/
|
*/
|
||||||
void viewport_init_all()
|
void ViewportInitAll()
|
||||||
{
|
{
|
||||||
if (!gOpenRCT2NoGraphics)
|
if (!gOpenRCT2NoGraphics)
|
||||||
{
|
{
|
||||||
colours_init_maps();
|
ColoursInitMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowInitAll();
|
WindowInitAll();
|
||||||
|
@ -124,7 +124,7 @@ std::optional<ScreenCoordsXY> centre_2d_coordinates(const CoordsXYZ& loc, rct_vi
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto screenCoord = Translate3DTo2DWithZ(get_current_rotation(), loc);
|
auto screenCoord = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
|
||||||
screenCoord.x -= viewport->view_width / 2;
|
screenCoord.x -= viewport->view_width / 2;
|
||||||
screenCoord.y -= viewport->view_height / 2;
|
screenCoord.y -= viewport->view_height / 2;
|
||||||
return { screenCoord };
|
return { screenCoord };
|
||||||
|
@ -171,7 +171,7 @@ CoordsXYZ Focus::GetPos() const
|
||||||
* flags: edx top most 2 bits 0b_X1 for zoom clear see below for 2nd bit.
|
* flags: edx top most 2 bits 0b_X1 for zoom clear see below for 2nd bit.
|
||||||
* w: esi
|
* w: esi
|
||||||
*/
|
*/
|
||||||
void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus)
|
void ViewportCreate(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus)
|
||||||
{
|
{
|
||||||
rct_viewport* viewport = nullptr;
|
rct_viewport* viewport = nullptr;
|
||||||
if (_viewports.size() >= MAX_VIEWPORT_COUNT)
|
if (_viewports.size() >= MAX_VIEWPORT_COUNT)
|
||||||
|
@ -218,7 +218,7 @@ void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t
|
||||||
viewport->viewPos = *centreLoc;
|
viewport->viewPos = *centreLoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_remove(rct_viewport* viewport)
|
void ViewportRemove(rct_viewport* viewport)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(_viewports.begin(), _viewports.end(), [viewport](const auto& vp) { return &vp == viewport; });
|
auto it = std::find_if(_viewports.begin(), _viewports.end(), [viewport](const auto& vp) { return &vp == viewport; });
|
||||||
if (it == _viewports.end())
|
if (it == _viewports.end())
|
||||||
|
@ -229,13 +229,13 @@ void viewport_remove(rct_viewport* viewport)
|
||||||
_viewports.erase(it);
|
_viewports.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
|
void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
|
||||||
{
|
{
|
||||||
for (auto& vp : _viewports)
|
for (auto& vp : _viewports)
|
||||||
{
|
{
|
||||||
if (maxZoom == ZoomLevel{ -1 } || vp.zoom <= ZoomLevel{ maxZoom })
|
if (maxZoom == ZoomLevel{ -1 } || vp.zoom <= ZoomLevel{ maxZoom })
|
||||||
{
|
{
|
||||||
viewport_invalidate(&vp, screenRect);
|
ViewportInvalidate(&vp, screenRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,15 +246,15 @@ void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
|
||||||
* edx is assumed to be (and always is) the current rotation, so it is not
|
* edx is assumed to be (and always is) the current rotation, so it is not
|
||||||
* needed as parameter.
|
* needed as parameter.
|
||||||
*/
|
*/
|
||||||
CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords)
|
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords)
|
||||||
{
|
{
|
||||||
int32_t height = 0;
|
int32_t height = 0;
|
||||||
|
|
||||||
uint32_t rotation = get_current_rotation();
|
uint32_t rotation = GetCurrentRotation();
|
||||||
CoordsXY pos{};
|
CoordsXY pos{};
|
||||||
for (int32_t i = 0; i < 6; i++)
|
for (int32_t i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
pos = viewport_coord_to_map_coord(startCoords, height);
|
pos = ViewportPosToMapPos(startCoords, height);
|
||||||
height = TileElementHeight(pos);
|
height = TileElementHeight(pos);
|
||||||
|
|
||||||
// HACK: This is to prevent the x and y values being set to values outside
|
// HACK: This is to prevent the x and y values being set to values outside
|
||||||
|
@ -279,7 +279,7 @@ CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords)
|
||||||
/*
|
/*
|
||||||
* rct2: 0x006E7FF3
|
* rct2: 0x006E7FF3
|
||||||
*/
|
*/
|
||||||
static void viewport_redraw_after_shift(
|
static void ViewportRedrawAfterShift(
|
||||||
rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, const ScreenCoordsXY& coords)
|
rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, const ScreenCoordsXY& coords)
|
||||||
{
|
{
|
||||||
// sub-divide by intersecting windows
|
// sub-divide by intersecting windows
|
||||||
|
@ -293,7 +293,7 @@ static void viewport_redraw_after_shift(
|
||||||
{
|
{
|
||||||
auto itWindowPos = WindowGetIterator(window);
|
auto itWindowPos = WindowGetIterator(window);
|
||||||
auto itNextWindow = itWindowPos != g_window_list.end() ? std::next(itWindowPos) : g_window_list.end();
|
auto itNextWindow = itWindowPos != g_window_list.end() ? std::next(itWindowPos) : g_window_list.end();
|
||||||
viewport_redraw_after_shift(
|
ViewportRedrawAfterShift(
|
||||||
dpi, itNextWindow == g_window_list.end() ? nullptr : itNextWindow->get(), viewport, coords);
|
dpi, itNextWindow == g_window_list.end() ? nullptr : itNextWindow->get(), viewport, coords);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -305,49 +305,49 @@ static void viewport_redraw_after_shift(
|
||||||
{
|
{
|
||||||
viewport->width = window->windowPos.x - viewport->pos.x;
|
viewport->width = window->windowPos.x - viewport->pos.x;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
|
|
||||||
viewport->pos.x += viewport->width;
|
viewport->pos.x += viewport->width;
|
||||||
viewport->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
|
viewport->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport->width = view_copy.width - viewport->width;
|
viewport->width = view_copy.width - viewport->width;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
}
|
}
|
||||||
else if (viewport->pos.x + viewport->width > window->windowPos.x + window->width)
|
else if (viewport->pos.x + viewport->width > window->windowPos.x + window->width)
|
||||||
{
|
{
|
||||||
viewport->width = window->windowPos.x + window->width - viewport->pos.x;
|
viewport->width = window->windowPos.x + window->width - viewport->pos.x;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
|
|
||||||
viewport->pos.x += viewport->width;
|
viewport->pos.x += viewport->width;
|
||||||
viewport->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
|
viewport->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport->width = view_copy.width - viewport->width;
|
viewport->width = view_copy.width - viewport->width;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
}
|
}
|
||||||
else if (viewport->pos.y < window->windowPos.y)
|
else if (viewport->pos.y < window->windowPos.y)
|
||||||
{
|
{
|
||||||
viewport->height = window->windowPos.y - viewport->pos.y;
|
viewport->height = window->windowPos.y - viewport->pos.y;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
|
|
||||||
viewport->pos.y += viewport->height;
|
viewport->pos.y += viewport->height;
|
||||||
viewport->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
|
viewport->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
|
||||||
viewport->height = view_copy.height - viewport->height;
|
viewport->height = view_copy.height - viewport->height;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
}
|
}
|
||||||
else if (viewport->pos.y + viewport->height > window->windowPos.y + window->height)
|
else if (viewport->pos.y + viewport->height > window->windowPos.y + window->height)
|
||||||
{
|
{
|
||||||
viewport->height = window->windowPos.y + window->height - viewport->pos.y;
|
viewport->height = window->windowPos.y + window->height - viewport->pos.y;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
|
|
||||||
viewport->pos.y += viewport->height;
|
viewport->pos.y += viewport->height;
|
||||||
viewport->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
|
viewport->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
|
||||||
viewport->height = view_copy.height - viewport->height;
|
viewport->height = view_copy.height - viewport->height;
|
||||||
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, coords);
|
ViewportRedrawAfterShift(dpi, window, viewport, coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore viewport
|
// restore viewport
|
||||||
|
@ -402,7 +402,7 @@ static void viewport_redraw_after_shift(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewport_shift_pixels(
|
static void ViewportShiftPixels(
|
||||||
rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, int32_t x_diff, int32_t y_diff)
|
rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, int32_t x_diff, int32_t y_diff)
|
||||||
{
|
{
|
||||||
auto it = WindowGetIterator(window);
|
auto it = WindowGetIterator(window);
|
||||||
|
@ -447,10 +447,10 @@ static void viewport_shift_pixels(
|
||||||
WindowDrawAll(dpi, left, top, right, bottom);
|
WindowDrawAll(dpi, left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_redraw_after_shift(dpi, window, viewport, { x_diff, y_diff });
|
ViewportRedrawAfterShift(dpi, window, viewport, { x_diff, y_diff });
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewport* viewport)
|
static void ViewportMove(const ScreenCoordsXY& coords, rct_window* w, rct_viewport* viewport)
|
||||||
{
|
{
|
||||||
auto zoom = viewport->zoom;
|
auto zoom = viewport->zoom;
|
||||||
|
|
||||||
|
@ -533,14 +533,14 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp
|
||||||
if (drawing_engine_has_dirty_optimisations())
|
if (drawing_engine_has_dirty_optimisations())
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo* dpi = drawing_engine_get_dpi();
|
rct_drawpixelinfo* dpi = drawing_engine_get_dpi();
|
||||||
viewport_shift_pixels(dpi, w, viewport, x_diff, y_diff);
|
ViewportShiftPixels(dpi, w, viewport, x_diff, y_diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
*viewport = view_copy;
|
*viewport = view_copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rct2: 0x006E7A15
|
// rct2: 0x006E7A15
|
||||||
static void viewport_set_underground_flag(int32_t underground, rct_window* window, rct_viewport* viewport)
|
static void ViewportSetUndergroundFlag(int32_t underground, rct_window* window, rct_viewport* viewport)
|
||||||
{
|
{
|
||||||
if (window->classification != WindowClass::MainWindow
|
if (window->classification != WindowClass::MainWindow
|
||||||
|| (window->classification == WindowClass::MainWindow && !window->viewport_smart_follow_sprite.IsNull()))
|
|| (window->classification == WindowClass::MainWindow && !window->viewport_smart_follow_sprite.IsNull()))
|
||||||
|
@ -567,7 +567,7 @@ static void viewport_set_underground_flag(int32_t underground, rct_window* windo
|
||||||
*
|
*
|
||||||
* rct2: 0x006E7A3A
|
* rct2: 0x006E7A3A
|
||||||
*/
|
*/
|
||||||
void viewport_update_position(rct_window* window)
|
void ViewportUpdatePosition(rct_window* window)
|
||||||
{
|
{
|
||||||
WindowEventResizeCall(window);
|
WindowEventResizeCall(window);
|
||||||
|
|
||||||
|
@ -577,21 +577,21 @@ void viewport_update_position(rct_window* window)
|
||||||
|
|
||||||
if (!window->viewport_smart_follow_sprite.IsNull())
|
if (!window->viewport_smart_follow_sprite.IsNull())
|
||||||
{
|
{
|
||||||
viewport_update_smart_sprite_follow(window);
|
ViewportUpdateSmartFollowEntity(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!window->viewport_target_sprite.IsNull())
|
if (!window->viewport_target_sprite.IsNull())
|
||||||
{
|
{
|
||||||
viewport_update_sprite_follow(window);
|
ViewportUpdateFollowSprite(window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_set_underground_flag(0, window, viewport);
|
ViewportSetUndergroundFlag(0, window, viewport);
|
||||||
|
|
||||||
auto viewportMidPoint = ScreenCoordsXY{ window->savedViewPos.x + viewport->view_width / 2,
|
auto viewportMidPoint = ScreenCoordsXY{ window->savedViewPos.x + viewport->view_width / 2,
|
||||||
window->savedViewPos.y + viewport->view_height / 2 };
|
window->savedViewPos.y + viewport->view_height / 2 };
|
||||||
|
|
||||||
auto mapCoord = viewport_coord_to_map_coord(viewportMidPoint, 0);
|
auto mapCoord = ViewportPosToMapPos(viewportMidPoint, 0);
|
||||||
|
|
||||||
// Clamp to the map minimum value
|
// Clamp to the map minimum value
|
||||||
int32_t at_map_edge = 0;
|
int32_t at_map_edge = 0;
|
||||||
|
@ -665,10 +665,10 @@ void viewport_update_position(rct_window* window)
|
||||||
windowCoords.y += viewport->viewPos.y;
|
windowCoords.y += viewport->viewPos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport_move(windowCoords, window, viewport);
|
ViewportMove(windowCoords, window, viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_update_sprite_follow(rct_window* window)
|
void ViewportUpdateFollowSprite(rct_window* window)
|
||||||
{
|
{
|
||||||
if (!window->viewport_target_sprite.IsNull() && window->viewport != nullptr)
|
if (!window->viewport_target_sprite.IsNull() && window->viewport != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -682,19 +682,19 @@ void viewport_update_sprite_follow(rct_window* window)
|
||||||
{
|
{
|
||||||
int32_t height = (TileElementHeight({ sprite->x, sprite->y })) - 16;
|
int32_t height = (TileElementHeight({ sprite->x, sprite->y })) - 16;
|
||||||
int32_t underground = sprite->z < height;
|
int32_t underground = sprite->z < height;
|
||||||
viewport_set_underground_flag(underground, window, window->viewport);
|
ViewportSetUndergroundFlag(underground, window, window->viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto centreLoc = centre_2d_coordinates(sprite->GetLocation(), window->viewport);
|
auto centreLoc = centre_2d_coordinates(sprite->GetLocation(), window->viewport);
|
||||||
if (centreLoc.has_value())
|
if (centreLoc.has_value())
|
||||||
{
|
{
|
||||||
window->savedViewPos = *centreLoc;
|
window->savedViewPos = *centreLoc;
|
||||||
viewport_move(*centreLoc, window, window->viewport);
|
ViewportMove(*centreLoc, window, window->viewport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_update_smart_sprite_follow(rct_window* window)
|
void ViewportUpdateSmartFollowEntity(rct_window* window)
|
||||||
{
|
{
|
||||||
auto entity = TryGetEntity(window->viewport_smart_follow_sprite);
|
auto entity = TryGetEntity(window->viewport_smart_follow_sprite);
|
||||||
if (entity == nullptr || entity->Type == EntityType::Null)
|
if (entity == nullptr || entity->Type == EntityType::Null)
|
||||||
|
@ -707,15 +707,15 @@ void viewport_update_smart_sprite_follow(rct_window* window)
|
||||||
switch (entity->Type)
|
switch (entity->Type)
|
||||||
{
|
{
|
||||||
case EntityType::Vehicle:
|
case EntityType::Vehicle:
|
||||||
viewport_update_smart_vehicle_follow(window);
|
ViewportUpdateSmartFollowVehicle(window);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType::Guest:
|
case EntityType::Guest:
|
||||||
viewport_update_smart_guest_follow(window, entity->As<Guest>());
|
ViewportUpdateSmartFollowGuest(window, entity->As<Guest>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EntityType::Staff:
|
case EntityType::Staff:
|
||||||
viewport_update_smart_staff_follow(window, entity->As<Staff>());
|
ViewportUpdateSmartFollowStaff(window, entity->As<Staff>());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // All other types don't need any "smart" following; steam particle, duck, money effect, etc.
|
default: // All other types don't need any "smart" following; steam particle, duck, money effect, etc.
|
||||||
|
@ -725,7 +725,7 @@ void viewport_update_smart_sprite_follow(rct_window* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_update_smart_guest_follow(rct_window* window, const Guest* peep)
|
void ViewportUpdateSmartFollowGuest(rct_window* window, const Guest* peep)
|
||||||
{
|
{
|
||||||
Focus focus = Focus(peep->sprite_index);
|
Focus focus = Focus(peep->sprite_index);
|
||||||
window->viewport_target_sprite = peep->sprite_index;
|
window->viewport_target_sprite = peep->sprite_index;
|
||||||
|
@ -777,7 +777,7 @@ void viewport_update_smart_guest_follow(rct_window* window, const Guest* peep)
|
||||||
window->focus = focus;
|
window->focus = focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_update_smart_staff_follow(rct_window* window, const Staff* peep)
|
void ViewportUpdateSmartFollowStaff(rct_window* window, const Staff* peep)
|
||||||
{
|
{
|
||||||
if (peep->State == PeepState::Picked)
|
if (peep->State == PeepState::Picked)
|
||||||
{
|
{
|
||||||
|
@ -791,7 +791,7 @@ void viewport_update_smart_staff_follow(rct_window* window, const Staff* peep)
|
||||||
window->viewport_target_sprite = window->viewport_smart_follow_sprite;
|
window->viewport_target_sprite = window->viewport_smart_follow_sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_update_smart_vehicle_follow(rct_window* window)
|
void ViewportUpdateSmartFollowVehicle(rct_window* window)
|
||||||
{
|
{
|
||||||
window->focus = Focus(window->viewport_smart_follow_sprite);
|
window->focus = Focus(window->viewport_smart_follow_sprite);
|
||||||
window->viewport_target_sprite = window->viewport_smart_follow_sprite;
|
window->viewport_target_sprite = window->viewport_smart_follow_sprite;
|
||||||
|
@ -807,7 +807,7 @@ void viewport_update_smart_vehicle_follow(rct_window* window)
|
||||||
* edi: dpi
|
* edi: dpi
|
||||||
* ebp: bottom
|
* ebp: bottom
|
||||||
*/
|
*/
|
||||||
void viewport_render(
|
void ViewportRender(
|
||||||
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
|
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
|
||||||
std::vector<RecordedPaintSession>* sessions)
|
std::vector<RecordedPaintSession>* sessions)
|
||||||
{
|
{
|
||||||
|
@ -839,7 +839,7 @@ void viewport_render(
|
||||||
viewport->zoom.ApplyTo(std::min(bottomRight.y, viewport->height)),
|
viewport->zoom.ApplyTo(std::min(bottomRight.y, viewport->height)),
|
||||||
} + viewport->viewPos;
|
} + viewport->viewPos;
|
||||||
|
|
||||||
viewport_paint(viewport, dpi, { topLeft, bottomRight }, sessions);
|
ViewportPaint(viewport, dpi, { topLeft, bottomRight }, sessions);
|
||||||
|
|
||||||
#ifdef DEBUG_SHOW_DIRTY_BOX
|
#ifdef DEBUG_SHOW_DIRTY_BOX
|
||||||
// FIXME g_viewport_list doesn't exist anymore
|
// FIXME g_viewport_list doesn't exist anymore
|
||||||
|
@ -848,7 +848,7 @@ void viewport_render(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void record_session(
|
static void RecordSession(
|
||||||
const PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
|
const PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
|
||||||
{
|
{
|
||||||
// Perform a deep copy of the paint session, use relative offsets.
|
// Perform a deep copy of the paint session, use relative offsets.
|
||||||
|
@ -908,20 +908,19 @@ static void record_session(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewport_fill_column(
|
static void ViewportFillColumn(PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
|
||||||
PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
|
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
PaintSessionGenerate(session);
|
PaintSessionGenerate(session);
|
||||||
if (recorded_sessions != nullptr)
|
if (recorded_sessions != nullptr)
|
||||||
{
|
{
|
||||||
record_session(session, recorded_sessions, record_index);
|
RecordSession(session, recorded_sessions, record_index);
|
||||||
}
|
}
|
||||||
PaintSessionArrange(session);
|
PaintSessionArrange(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewport_paint_column(PaintSession& session)
|
static void ViewportPaintColumn(PaintSession& session)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -943,7 +942,7 @@ static void viewport_paint_column(PaintSession& session)
|
||||||
if (gConfigGeneral.RenderWeatherGloom && !gTrackDesignSaveMode && !(session.ViewFlags & VIEWPORT_FLAG_HIDE_ENTITIES)
|
if (gConfigGeneral.RenderWeatherGloom && !gTrackDesignSaveMode && !(session.ViewFlags & VIEWPORT_FLAG_HIDE_ENTITIES)
|
||||||
&& !(session.ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
|
&& !(session.ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
|
||||||
{
|
{
|
||||||
viewport_paint_weather_gloom(&session.DPI);
|
ViewportPaintWeatherGloom(&session.DPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.PSStringHead != nullptr)
|
if (session.PSStringHead != nullptr)
|
||||||
|
@ -962,7 +961,7 @@ static void viewport_paint_column(PaintSession& session)
|
||||||
* edi: dpi
|
* edi: dpi
|
||||||
* ebp: bottom
|
* ebp: bottom
|
||||||
*/
|
*/
|
||||||
void viewport_paint(
|
void ViewportPaint(
|
||||||
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
|
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
|
||||||
std::vector<RecordedPaintSession>* recorded_sessions)
|
std::vector<RecordedPaintSession>* recorded_sessions)
|
||||||
{
|
{
|
||||||
|
@ -1059,11 +1058,11 @@ void viewport_paint(
|
||||||
if (useMultithreading)
|
if (useMultithreading)
|
||||||
{
|
{
|
||||||
_paintJobs->AddTask(
|
_paintJobs->AddTask(
|
||||||
[session, recorded_sessions, index]() -> void { viewport_fill_column(*session, recorded_sessions, index); });
|
[session, recorded_sessions, index]() -> void { ViewportFillColumn(*session, recorded_sessions, index); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewport_fill_column(*session, recorded_sessions, index);
|
ViewportFillColumn(*session, recorded_sessions, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,11 +1076,11 @@ void viewport_paint(
|
||||||
{
|
{
|
||||||
if (useParallelDrawing)
|
if (useParallelDrawing)
|
||||||
{
|
{
|
||||||
_paintJobs->AddTask([session]() -> void { viewport_paint_column(*session); });
|
_paintJobs->AddTask([session]() -> void { ViewportPaintColumn(*session); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewport_paint_column(*session);
|
ViewportPaintColumn(*session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (useParallelDrawing)
|
if (useParallelDrawing)
|
||||||
|
@ -1096,7 +1095,7 @@ void viewport_paint(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewport_paint_weather_gloom(rct_drawpixelinfo* dpi)
|
static void ViewportPaintWeatherGloom(rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
auto paletteId = ClimateGetWeatherGloomPaletteId(gClimateCurrent);
|
auto paletteId = ClimateGetWeatherGloomPaletteId(gClimateCurrent);
|
||||||
if (paletteId != FilterPaletteID::PaletteNull)
|
if (paletteId != FilterPaletteID::PaletteNull)
|
||||||
|
@ -1115,9 +1114,9 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo* dpi)
|
||||||
*
|
*
|
||||||
* rct2: 0x0068958D
|
* rct2: 0x0068958D
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords, int32_t* direction)
|
std::optional<CoordsXY> ScreenPosToMapPos(const ScreenCoordsXY& screenCoords, int32_t* direction)
|
||||||
{
|
{
|
||||||
auto mapCoords = screen_get_map_xy(screenCoords, nullptr);
|
auto mapCoords = ScreenGetMapXY(screenCoords, nullptr);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
@ -1171,14 +1170,14 @@ std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords
|
||||||
|
|
||||||
void rct_viewport::Invalidate() const
|
void rct_viewport::Invalidate() const
|
||||||
{
|
{
|
||||||
viewport_invalidate(this, { viewPos, viewPos + ScreenCoordsXY{ view_width, view_height } });
|
ViewportInvalidate(this, { viewPos, viewPos + ScreenCoordsXY{ view_width, view_height } });
|
||||||
}
|
}
|
||||||
|
|
||||||
CoordsXY viewport_coord_to_map_coord(const ScreenCoordsXY& coords, int32_t z)
|
CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z)
|
||||||
{
|
{
|
||||||
// Reverse of Translate3DTo2DWithZ
|
// Reverse of Translate3DTo2DWithZ
|
||||||
CoordsXY ret = { coords.y - coords.x / 2 + z, coords.y + coords.x / 2 + z };
|
CoordsXY ret = { coords.y - coords.x / 2 + z, coords.y + coords.x / 2 + z };
|
||||||
auto inverseRotation = DirectionFlipXAxis(get_current_rotation());
|
auto inverseRotation = DirectionFlipXAxis(GetCurrentRotation());
|
||||||
return ret.Rotate(inverseRotation);
|
return ret.Rotate(inverseRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1185,7 @@ CoordsXY viewport_coord_to_map_coord(const ScreenCoordsXY& coords, int32_t z)
|
||||||
*
|
*
|
||||||
* rct2: 0x00664689
|
* rct2: 0x00664689
|
||||||
*/
|
*/
|
||||||
void show_gridlines()
|
void ShowGridlines()
|
||||||
{
|
{
|
||||||
if (gShowGridLinesRefCount == 0)
|
if (gShowGridLinesRefCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -1207,7 +1206,7 @@ void show_gridlines()
|
||||||
*
|
*
|
||||||
* rct2: 0x006646B4
|
* rct2: 0x006646B4
|
||||||
*/
|
*/
|
||||||
void hide_gridlines()
|
void HideGridlines()
|
||||||
{
|
{
|
||||||
if (gShowGridLinesRefCount > 0)
|
if (gShowGridLinesRefCount > 0)
|
||||||
gShowGridLinesRefCount--;
|
gShowGridLinesRefCount--;
|
||||||
|
@ -1230,7 +1229,7 @@ void hide_gridlines()
|
||||||
*
|
*
|
||||||
* rct2: 0x00664E8E
|
* rct2: 0x00664E8E
|
||||||
*/
|
*/
|
||||||
void show_land_rights()
|
void ShowLandRights()
|
||||||
{
|
{
|
||||||
if (gShowLandRightsRefCount == 0)
|
if (gShowLandRightsRefCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -1251,7 +1250,7 @@ void show_land_rights()
|
||||||
*
|
*
|
||||||
* rct2: 0x00664EB9
|
* rct2: 0x00664EB9
|
||||||
*/
|
*/
|
||||||
void hide_land_rights()
|
void HideLandRights()
|
||||||
{
|
{
|
||||||
if (gShowLandRightsRefCount > 0)
|
if (gShowLandRightsRefCount > 0)
|
||||||
gShowLandRightsRefCount--;
|
gShowLandRightsRefCount--;
|
||||||
|
@ -1274,7 +1273,7 @@ void hide_land_rights()
|
||||||
*
|
*
|
||||||
* rct2: 0x00664EDD
|
* rct2: 0x00664EDD
|
||||||
*/
|
*/
|
||||||
void show_construction_rights()
|
void ShowConstructionRights()
|
||||||
{
|
{
|
||||||
if (gShowConstructionRightsRefCount == 0)
|
if (gShowConstructionRightsRefCount == 0)
|
||||||
{
|
{
|
||||||
|
@ -1295,7 +1294,7 @@ void show_construction_rights()
|
||||||
*
|
*
|
||||||
* rct2: 0x00664F08
|
* rct2: 0x00664F08
|
||||||
*/
|
*/
|
||||||
void hide_construction_rights()
|
void HideConstructionRights()
|
||||||
{
|
{
|
||||||
if (gShowConstructionRightsRefCount > 0)
|
if (gShowConstructionRightsRefCount > 0)
|
||||||
gShowConstructionRightsRefCount--;
|
gShowConstructionRightsRefCount--;
|
||||||
|
@ -1318,7 +1317,7 @@ void hide_construction_rights()
|
||||||
*
|
*
|
||||||
* rct2: 0x006CB70A
|
* rct2: 0x006CB70A
|
||||||
*/
|
*/
|
||||||
void viewport_set_visibility(uint8_t mode)
|
void ViewportSetVisibility(uint8_t mode)
|
||||||
{
|
{
|
||||||
rct_window* window = WindowGetMain();
|
rct_window* window = WindowGetMain();
|
||||||
|
|
||||||
|
@ -1533,8 +1532,7 @@ static bool PSSpriteTypeIsInFilter(PaintStruct* ps, uint16_t filter)
|
||||||
/**
|
/**
|
||||||
* rct2: 0x00679236, 0x00679662, 0x00679B0D, 0x00679FF1
|
* rct2: 0x00679236, 0x00679662, 0x00679B0D, 0x00679FF1
|
||||||
*/
|
*/
|
||||||
static bool is_pixel_present_bmp(
|
static bool IsPixelPresentBMP(uint32_t imageType, const rct_g1_element* g1, const uint8_t* index, const PaletteMap& paletteMap)
|
||||||
uint32_t imageType, const rct_g1_element* g1, const uint8_t* index, const PaletteMap& paletteMap)
|
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -1560,7 +1558,7 @@ static bool is_pixel_present_bmp(
|
||||||
/**
|
/**
|
||||||
* rct2: 0x0067933B, 0x00679788, 0x00679C4A, 0x0067A117
|
* rct2: 0x0067933B, 0x00679788, 0x00679C4A, 0x0067A117
|
||||||
*/
|
*/
|
||||||
static bool is_pixel_present_rle(const uint8_t* esi, int32_t x_start_point, int32_t y_start_point, int32_t round)
|
static bool IsPixelPresentRLE(const uint8_t* esi, int32_t x_start_point, int32_t y_start_point, int32_t round)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -1654,7 +1652,7 @@ static bool is_pixel_present_rle(const uint8_t* esi, int32_t x_start_point, int3
|
||||||
* @param y (dx)
|
* @param y (dx)
|
||||||
* @return value originally stored in 0x00141F569
|
* @return value originally stored in 0x00141F569
|
||||||
*/
|
*/
|
||||||
static bool is_sprite_interacted_with_palette_set(
|
static bool IsSpriteInteractedWithPaletteSet(
|
||||||
rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap)
|
rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& coords, const PaletteMap& paletteMap)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
@ -1686,7 +1684,7 @@ static bool is_sprite_interacted_with_palette_set(
|
||||||
};
|
};
|
||||||
|
|
||||||
auto zoomImageId = imageId.WithIndex(imageId.GetIndex() - g1->zoomed_offset);
|
auto zoomImageId = imageId.WithIndex(imageId.GetIndex() - g1->zoomed_offset);
|
||||||
return is_sprite_interacted_with_palette_set(&zoomed_dpi, zoomImageId, { coords.x / 2, coords.y / 2 }, paletteMap);
|
return IsSpriteInteractedWithPaletteSet(&zoomed_dpi, zoomImageId, { coords.x / 2, coords.y / 2 }, paletteMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1781,7 +1779,7 @@ static bool is_sprite_interacted_with_palette_set(
|
||||||
|
|
||||||
if (g1->flags & G1_FLAG_RLE_COMPRESSION)
|
if (g1->flags & G1_FLAG_RLE_COMPRESSION)
|
||||||
{
|
{
|
||||||
return is_pixel_present_rle(g1->offset, xStartPoint, yStartPoint, round);
|
return IsPixelPresentRLE(g1->offset, xStartPoint, yStartPoint, round);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* offset = g1->offset + (yStartPoint * g1->width) + xStartPoint;
|
uint8_t* offset = g1->offset + (yStartPoint * g1->width) + xStartPoint;
|
||||||
|
@ -1789,7 +1787,7 @@ static bool is_sprite_interacted_with_palette_set(
|
||||||
|
|
||||||
if (!(g1->flags & G1_FLAG_1))
|
if (!(g1->flags & G1_FLAG_1))
|
||||||
{
|
{
|
||||||
return is_pixel_present_bmp(imageType, g1, offset, paletteMap);
|
return IsPixelPresentBMP(imageType, g1, offset, paletteMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
Guard::Assert(false, "Invalid image type encountered.");
|
Guard::Assert(false, "Invalid image type encountered.");
|
||||||
|
@ -1801,7 +1799,7 @@ static bool is_sprite_interacted_with_palette_set(
|
||||||
* rct2: 0x00679023
|
* rct2: 0x00679023
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool is_sprite_interacted_with(rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& coords)
|
static bool IsSpriteInteractedWith(rct_drawpixelinfo* dpi, ImageId imageId, const ScreenCoordsXY& coords)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -1827,14 +1825,14 @@ static bool is_sprite_interacted_with(rct_drawpixelinfo* dpi, ImageId imageId, c
|
||||||
{
|
{
|
||||||
_currentImageType = IMAGE_TYPE_DEFAULT;
|
_currentImageType = IMAGE_TYPE_DEFAULT;
|
||||||
}
|
}
|
||||||
return is_sprite_interacted_with_palette_set(dpi, imageId, coords, paletteMap);
|
return IsSpriteInteractedWithPaletteSet(dpi, imageId, coords, paletteMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x0068862C
|
* rct2: 0x0068862C
|
||||||
*/
|
*/
|
||||||
InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, uint32_t viewFlags, uint16_t filter)
|
InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32_t viewFlags, uint16_t filter)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -1849,7 +1847,7 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
|
||||||
while (next_ps != nullptr)
|
while (next_ps != nullptr)
|
||||||
{
|
{
|
||||||
ps = next_ps;
|
ps = next_ps;
|
||||||
if (is_sprite_interacted_with(dpi, ps->image_id, { ps->x, ps->y }))
|
if (IsSpriteInteractedWith(dpi, ps->image_id, { ps->x, ps->y }))
|
||||||
{
|
{
|
||||||
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) != VisibilityKind::Hidden)
|
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) != VisibilityKind::Hidden)
|
||||||
{
|
{
|
||||||
|
@ -1863,7 +1861,7 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
|
||||||
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
#pragma GCC diagnostic ignored "-Wnull-dereference"
|
||||||
for (AttachedPaintStruct* attached_ps = ps->attached_ps; attached_ps != nullptr; attached_ps = attached_ps->next)
|
for (AttachedPaintStruct* attached_ps = ps->attached_ps; attached_ps != nullptr; attached_ps = attached_ps->next)
|
||||||
{
|
{
|
||||||
if (is_sprite_interacted_with(dpi, attached_ps->image_id, { (attached_ps->x + ps->x), (attached_ps->y + ps->y) }))
|
if (IsSpriteInteractedWith(dpi, attached_ps->image_id, { (attached_ps->x + ps->x), (attached_ps->y + ps->y) }))
|
||||||
{
|
{
|
||||||
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) != VisibilityKind::Hidden)
|
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) != VisibilityKind::Hidden)
|
||||||
{
|
{
|
||||||
|
@ -1890,13 +1888,13 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
|
||||||
* tileElement: edx
|
* tileElement: edx
|
||||||
* viewport: edi
|
* viewport: edi
|
||||||
*/
|
*/
|
||||||
InteractionInfo get_map_coordinates_from_pos(const ScreenCoordsXY& screenCoords, int32_t flags)
|
InteractionInfo GetMapCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t flags)
|
||||||
{
|
{
|
||||||
rct_window* window = WindowFindFromPoint(screenCoords);
|
rct_window* window = WindowFindFromPoint(screenCoords);
|
||||||
return get_map_coordinates_from_pos_window(window, screenCoords, flags);
|
return GetMapCoordinatesFromPosWindow(window, screenCoords, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags)
|
InteractionInfo GetMapCoordinatesFromPosWindow(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags)
|
||||||
{
|
{
|
||||||
InteractionInfo info{};
|
InteractionInfo info{};
|
||||||
if (window == nullptr || window->viewport == nullptr)
|
if (window == nullptr || window->viewport == nullptr)
|
||||||
|
@ -1928,7 +1926,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc
|
||||||
PaintSession* session = PaintSessionAlloc(&dpi, myviewport->flags);
|
PaintSession* session = PaintSessionAlloc(&dpi, myviewport->flags);
|
||||||
PaintSessionGenerate(*session);
|
PaintSessionGenerate(*session);
|
||||||
PaintSessionArrange(*session);
|
PaintSessionArrange(*session);
|
||||||
info = set_interaction_info_from_paint_session(session, myviewport->flags, flags & 0xFFFF);
|
info = SetInteractionInfoFromPaintSession(session, myviewport->flags, flags & 0xFFFF);
|
||||||
PaintSessionFree(session);
|
PaintSessionFree(session);
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
|
@ -1937,7 +1935,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc
|
||||||
/**
|
/**
|
||||||
* screenRect represents 2D map coordinates at zoom 0.
|
* screenRect represents 2D map coordinates at zoom 0.
|
||||||
*/
|
*/
|
||||||
void viewport_invalidate(const rct_viewport* viewport, const ScreenRect& screenRect)
|
void ViewportInvalidate(const rct_viewport* viewport, const ScreenRect& screenRect)
|
||||||
{
|
{
|
||||||
PROFILED_FUNCTION();
|
PROFILED_FUNCTION();
|
||||||
|
|
||||||
|
@ -1979,7 +1977,7 @@ void viewport_invalidate(const rct_viewport* viewport, const ScreenRect& screenR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static rct_viewport* viewport_find_from_point(const ScreenCoordsXY& screenCoords)
|
static rct_viewport* ViewportFindFromPoint(const ScreenCoordsXY& screenCoords)
|
||||||
{
|
{
|
||||||
rct_window* w = WindowFindFromPoint(screenCoords);
|
rct_window* w = WindowFindFromPoint(screenCoords);
|
||||||
if (w == nullptr)
|
if (w == nullptr)
|
||||||
|
@ -2007,7 +2005,7 @@ static rct_viewport* viewport_find_from_point(const ScreenCoordsXY& screenCoords
|
||||||
* tile_element: edx ?
|
* tile_element: edx ?
|
||||||
* viewport: edi
|
* viewport: edi
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rct_viewport** viewport)
|
std::optional<CoordsXY> ScreenGetMapXY(const ScreenCoordsXY& screenCoords, rct_viewport** viewport)
|
||||||
{
|
{
|
||||||
// This will get the tile location but we will need the more accuracy
|
// This will get the tile location but we will need the more accuracy
|
||||||
rct_window* window = WindowFindFromPoint(screenCoords);
|
rct_window* window = WindowFindFromPoint(screenCoords);
|
||||||
|
@ -2016,7 +2014,7 @@ std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
auto myViewport = window->viewport;
|
auto myViewport = window->viewport;
|
||||||
auto info = get_map_coordinates_from_pos_window(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain));
|
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain));
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
{
|
{
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -2029,7 +2027,7 @@ std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc
|
||||||
for (int32_t i = 0; i < 5; i++)
|
for (int32_t i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
int32_t z = TileElementHeight(cursorMapPos);
|
int32_t z = TileElementHeight(cursorMapPos);
|
||||||
cursorMapPos = viewport_coord_to_map_coord(start_vp_pos, z);
|
cursorMapPos = ViewportPosToMapPos(start_vp_pos, z);
|
||||||
cursorMapPos.x = std::clamp(cursorMapPos.x, info.Loc.x, info.Loc.x + 31);
|
cursorMapPos.x = std::clamp(cursorMapPos.x, info.Loc.x, info.Loc.x + 31);
|
||||||
cursorMapPos.y = std::clamp(cursorMapPos.y, info.Loc.y, info.Loc.y + 31);
|
cursorMapPos.y = std::clamp(cursorMapPos.y, info.Loc.y, info.Loc.y + 31);
|
||||||
}
|
}
|
||||||
|
@ -2044,16 +2042,16 @@ std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc
|
||||||
*
|
*
|
||||||
* rct2: 0x006894D4
|
* rct2: 0x006894D4
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int32_t z)
|
std::optional<CoordsXY> ScreenGetMapXYWithZ(const ScreenCoordsXY& screenCoords, int32_t z)
|
||||||
{
|
{
|
||||||
rct_viewport* viewport = viewport_find_from_point(screenCoords);
|
rct_viewport* viewport = ViewportFindFromPoint(screenCoords);
|
||||||
if (viewport == nullptr)
|
if (viewport == nullptr)
|
||||||
{
|
{
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vpCoords = viewport->ScreenToViewportCoord(screenCoords);
|
auto vpCoords = viewport->ScreenToViewportCoord(screenCoords);
|
||||||
auto mapPosition = viewport_coord_to_map_coord(vpCoords, z);
|
auto mapPosition = ViewportPosToMapPos(vpCoords, z);
|
||||||
if (!MapIsLocationValid(mapPosition))
|
if (!MapIsLocationValid(mapPosition))
|
||||||
{
|
{
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -2066,9 +2064,9 @@ std::optional<CoordsXY> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoo
|
||||||
*
|
*
|
||||||
* rct2: 0x00689604
|
* rct2: 0x00689604
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy_quadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant)
|
std::optional<CoordsXY> ScreenGetMapXYQuadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant)
|
||||||
{
|
{
|
||||||
auto mapCoords = screen_get_map_xy(screenCoords, nullptr);
|
auto mapCoords = ScreenGetMapXY(screenCoords, nullptr);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
@ -2080,9 +2078,9 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant(const ScreenCoordsXY& screenC
|
||||||
*
|
*
|
||||||
* rct2: 0x0068964B
|
* rct2: 0x0068964B
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant)
|
std::optional<CoordsXY> ScreenGetMapXYQuadrantWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant)
|
||||||
{
|
{
|
||||||
auto mapCoords = screen_get_map_xy_with_z(screenCoords, z);
|
auto mapCoords = ScreenGetMapXYWithZ(screenCoords, z);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
@ -2094,9 +2092,9 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY&
|
||||||
*
|
*
|
||||||
* rct2: 0x00689692
|
* rct2: 0x00689692
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy_side(const ScreenCoordsXY& screenCoords, uint8_t* side)
|
std::optional<CoordsXY> ScreenGetMapXYSide(const ScreenCoordsXY& screenCoords, uint8_t* side)
|
||||||
{
|
{
|
||||||
auto mapCoords = screen_get_map_xy(screenCoords, nullptr);
|
auto mapCoords = ScreenGetMapXY(screenCoords, nullptr);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
@ -2108,9 +2106,9 @@ std::optional<CoordsXY> screen_get_map_xy_side(const ScreenCoordsXY& screenCoord
|
||||||
*
|
*
|
||||||
* rct2: 0x006896DC
|
* rct2: 0x006896DC
|
||||||
*/
|
*/
|
||||||
std::optional<CoordsXY> screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side)
|
std::optional<CoordsXY> ScreenGetMapXYSideWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side)
|
||||||
{
|
{
|
||||||
auto mapCoords = screen_get_map_xy_with_z(screenCoords, z);
|
auto mapCoords = ScreenGetMapXYWithZ(screenCoords, z);
|
||||||
if (!mapCoords.has_value())
|
if (!mapCoords.has_value())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
|
@ -2126,7 +2124,7 @@ std::optional<CoordsXY> screen_get_map_xy_side_with_z(const ScreenCoordsXY& scre
|
||||||
*
|
*
|
||||||
* @returns rotation in range 0-3 (inclusive)
|
* @returns rotation in range 0-3 (inclusive)
|
||||||
*/
|
*/
|
||||||
uint8_t get_current_rotation()
|
uint8_t GetCurrentRotation()
|
||||||
{
|
{
|
||||||
uint8_t rotation = gCurrentRotation;
|
uint8_t rotation = gCurrentRotation;
|
||||||
uint8_t rotation_masked = rotation & 3;
|
uint8_t rotation_masked = rotation & 3;
|
||||||
|
@ -2141,7 +2139,7 @@ uint8_t get_current_rotation()
|
||||||
return rotation_masked;
|
return rotation_masked;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t get_height_marker_offset()
|
int32_t GetHeightMarkerOffset()
|
||||||
{
|
{
|
||||||
// Height labels in units
|
// Height labels in units
|
||||||
if (gConfigGeneral.ShowHeightAsUnits)
|
if (gConfigGeneral.ShowHeightAsUnits)
|
||||||
|
@ -2155,7 +2153,7 @@ int32_t get_height_marker_offset()
|
||||||
return 2 * 256;
|
return 2 * 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewport_set_saved_view()
|
void ViewportSetSavedView()
|
||||||
{
|
{
|
||||||
rct_window* w = WindowGetMain();
|
rct_window* w = WindowGetMain();
|
||||||
if (w != nullptr)
|
if (w != nullptr)
|
||||||
|
@ -2165,7 +2163,7 @@ void viewport_set_saved_view()
|
||||||
gSavedView = ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 } + viewport->viewPos;
|
gSavedView = ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 } + viewport->viewPos;
|
||||||
|
|
||||||
gSavedViewZoom = viewport->zoom;
|
gSavedViewZoom = viewport->zoom;
|
||||||
gSavedViewRotation = get_current_rotation();
|
gSavedViewRotation = GetCurrentRotation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,41 +120,41 @@ extern uint8_t gSavedViewRotation;
|
||||||
extern PaintEntry* gNextFreePaintStruct;
|
extern PaintEntry* gNextFreePaintStruct;
|
||||||
extern uint8_t gCurrentRotation;
|
extern uint8_t gCurrentRotation;
|
||||||
|
|
||||||
void viewport_init_all();
|
void ViewportInitAll();
|
||||||
std::optional<ScreenCoordsXY> centre_2d_coordinates(const CoordsXYZ& loc, rct_viewport* viewport);
|
std::optional<ScreenCoordsXY> centre_2d_coordinates(const CoordsXYZ& loc, rct_viewport* viewport);
|
||||||
void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus);
|
void ViewportCreate(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus);
|
||||||
void viewport_remove(rct_viewport* viewport);
|
void ViewportRemove(rct_viewport* viewport);
|
||||||
void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 });
|
void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 });
|
||||||
void viewport_update_position(rct_window* window);
|
void ViewportUpdatePosition(rct_window* window);
|
||||||
void viewport_update_sprite_follow(rct_window* window);
|
void ViewportUpdateFollowSprite(rct_window* window);
|
||||||
void viewport_update_smart_sprite_follow(rct_window* window);
|
void ViewportUpdateSmartFollowEntity(rct_window* window);
|
||||||
void viewport_update_smart_guest_follow(rct_window* window, const Guest* peep);
|
void ViewportUpdateSmartFollowGuest(rct_window* window, const Guest* peep);
|
||||||
void viewport_update_smart_staff_follow(rct_window* window, const Staff* peep);
|
void ViewportUpdateSmartFollowStaff(rct_window* window, const Staff* peep);
|
||||||
void viewport_update_smart_vehicle_follow(rct_window* window);
|
void ViewportUpdateSmartFollowVehicle(rct_window* window);
|
||||||
void viewport_render(
|
void ViewportRender(
|
||||||
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
|
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
|
||||||
std::vector<RecordedPaintSession>* sessions = nullptr);
|
std::vector<RecordedPaintSession>* sessions = nullptr);
|
||||||
void viewport_paint(
|
void ViewportPaint(
|
||||||
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
|
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
|
||||||
std::vector<RecordedPaintSession>* sessions = nullptr);
|
std::vector<RecordedPaintSession>* sessions = nullptr);
|
||||||
|
|
||||||
CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords);
|
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords);
|
||||||
|
|
||||||
CoordsXY viewport_coord_to_map_coord(const ScreenCoordsXY& coords, int32_t z);
|
CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z);
|
||||||
std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords, int32_t* direction);
|
std::optional<CoordsXY> ScreenPosToMapPos(const ScreenCoordsXY& screenCoords, int32_t* direction);
|
||||||
|
|
||||||
void show_gridlines();
|
void ShowGridlines();
|
||||||
void hide_gridlines();
|
void HideGridlines();
|
||||||
void show_land_rights();
|
void ShowLandRights();
|
||||||
void hide_land_rights();
|
void HideLandRights();
|
||||||
void show_construction_rights();
|
void ShowConstructionRights();
|
||||||
void hide_construction_rights();
|
void HideConstructionRights();
|
||||||
void viewport_set_visibility(uint8_t mode);
|
void ViewportSetVisibility(uint8_t mode);
|
||||||
|
|
||||||
InteractionInfo get_map_coordinates_from_pos(const ScreenCoordsXY& screenCoords, int32_t flags);
|
InteractionInfo GetMapCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t flags);
|
||||||
InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags);
|
InteractionInfo GetMapCoordinatesFromPosWindow(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags);
|
||||||
|
|
||||||
InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, uint32_t viewFlags, uint16_t filter);
|
InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32_t viewFlags, uint16_t filter);
|
||||||
InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords);
|
InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoords);
|
||||||
bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords);
|
bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords);
|
||||||
bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords);
|
bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords);
|
||||||
|
@ -164,18 +164,18 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords);
|
||||||
|
|
||||||
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords);
|
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords);
|
||||||
|
|
||||||
void viewport_invalidate(const rct_viewport* viewport, const ScreenRect& screenRect);
|
void ViewportInvalidate(const rct_viewport* viewport, const ScreenRect& screenRect);
|
||||||
|
|
||||||
std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rct_viewport** viewport);
|
std::optional<CoordsXY> ScreenGetMapXY(const ScreenCoordsXY& screenCoords, rct_viewport** viewport);
|
||||||
std::optional<CoordsXY> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int32_t z);
|
std::optional<CoordsXY> ScreenGetMapXYWithZ(const ScreenCoordsXY& screenCoords, int32_t z);
|
||||||
std::optional<CoordsXY> screen_get_map_xy_quadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant);
|
std::optional<CoordsXY> ScreenGetMapXYQuadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant);
|
||||||
std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant);
|
std::optional<CoordsXY> ScreenGetMapXYQuadrantWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant);
|
||||||
std::optional<CoordsXY> screen_get_map_xy_side(const ScreenCoordsXY& screenCoords, uint8_t* side);
|
std::optional<CoordsXY> ScreenGetMapXYSide(const ScreenCoordsXY& screenCoords, uint8_t* side);
|
||||||
std::optional<CoordsXY> screen_get_map_xy_side_with_z(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side);
|
std::optional<CoordsXY> ScreenGetMapXYSideWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side);
|
||||||
|
|
||||||
uint8_t get_current_rotation();
|
uint8_t GetCurrentRotation();
|
||||||
int32_t get_height_marker_offset();
|
int32_t GetHeightMarkerOffset();
|
||||||
|
|
||||||
void viewport_set_saved_view();
|
void ViewportSetSavedView();
|
||||||
|
|
||||||
VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlags);
|
VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlags);
|
||||||
|
|
|
@ -83,8 +83,8 @@ namespace WindowCloseFlags
|
||||||
static constexpr uint32_t CloseSingle = (1 << 1);
|
static constexpr uint32_t CloseSingle = (1 << 1);
|
||||||
} // namespace WindowCloseFlags
|
} // namespace WindowCloseFlags
|
||||||
|
|
||||||
static void window_draw_core(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
static void WindowDrawCore(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||||
static void window_draw_single(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
static void WindowDrawSingle(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom);
|
||||||
|
|
||||||
std::list<std::shared_ptr<rct_window>>::iterator WindowGetIterator(const rct_window* w)
|
std::list<std::shared_ptr<rct_window>>::iterator WindowGetIterator(const rct_window* w)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ void WindowUpdateAllViewports()
|
||||||
WindowVisitEach([&](rct_window* w) {
|
WindowVisitEach([&](rct_window* w) {
|
||||||
if (w->viewport != nullptr && WindowIsVisible(*w))
|
if (w->viewport != nullptr && WindowIsVisible(*w))
|
||||||
{
|
{
|
||||||
viewport_update_position(w);
|
ViewportUpdatePosition(w);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void WindowUpdateAllViewports()
|
||||||
*/
|
*/
|
||||||
void WindowUpdateAll()
|
void WindowUpdateAll()
|
||||||
{
|
{
|
||||||
// window_update_all_viewports();
|
// WindowUpdateAllViewports();
|
||||||
|
|
||||||
// 1000 tick update
|
// 1000 tick update
|
||||||
gWindowUpdateTicks += gCurrentDeltaTime;
|
gWindowUpdateTicks += gCurrentDeltaTime;
|
||||||
|
@ -155,7 +155,7 @@ void WindowUpdateAll()
|
||||||
windowManager->UpdateMouseWheel();
|
windowManager->UpdateMouseWheel();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_close_surplus(int32_t cap, WindowClass avoid_classification)
|
static void WindowCloseSurplus(int32_t cap, WindowClass avoid_classification)
|
||||||
{
|
{
|
||||||
// find the amount of windows that are currently open
|
// find the amount of windows that are currently open
|
||||||
auto count = static_cast<int32_t>(g_window_list.size());
|
auto count = static_cast<int32_t>(g_window_list.size());
|
||||||
|
@ -195,7 +195,7 @@ void WindowSetWindowLimit(int32_t value)
|
||||||
// windows if one sets a limit lower than the number of windows open
|
// windows if one sets a limit lower than the number of windows open
|
||||||
if (val < prev)
|
if (val < prev)
|
||||||
{
|
{
|
||||||
window_close_surplus(val, WindowClass::Options);
|
WindowCloseSurplus(val, WindowClass::Options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ void WindowClose(rct_window& w)
|
||||||
g_window_list.erase(itWindow);
|
g_window_list.erase(itWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename TPred> static void window_close_by_condition(TPred pred, uint32_t flags = WindowCloseFlags::None)
|
template<typename TPred> static void WindowCloseByCondition(TPred pred, uint32_t flags = WindowCloseFlags::None)
|
||||||
{
|
{
|
||||||
bool listUpdated;
|
bool listUpdated;
|
||||||
do
|
do
|
||||||
|
@ -286,7 +286,7 @@ template<typename TPred> static void window_close_by_condition(TPred pred, uint3
|
||||||
*/
|
*/
|
||||||
void WindowCloseByClass(WindowClass cls)
|
void WindowCloseByClass(WindowClass cls)
|
||||||
{
|
{
|
||||||
window_close_by_condition([&](rct_window* w) -> bool { return w->classification == cls; });
|
WindowCloseByCondition([&](rct_window* w) -> bool { return w->classification == cls; });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,7 +297,7 @@ void WindowCloseByClass(WindowClass cls)
|
||||||
*/
|
*/
|
||||||
void WindowCloseByNumber(WindowClass cls, rct_windownumber number)
|
void WindowCloseByNumber(WindowClass cls, rct_windownumber number)
|
||||||
{
|
{
|
||||||
window_close_by_condition([cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; });
|
WindowCloseByCondition([cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; });
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor this to use variant once the new window class is done.
|
// TODO: Refactor this to use variant once the new window class is done.
|
||||||
|
@ -365,7 +365,7 @@ void WindowCloseTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pred = [](rct_window* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); };
|
auto pred = [](rct_window* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); };
|
||||||
window_close_by_condition(pred, WindowCloseFlags::CloseSingle | WindowCloseFlags::IterateReverse);
|
WindowCloseByCondition(pred, WindowCloseFlags::CloseSingle | WindowCloseFlags::IterateReverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,14 +376,14 @@ void WindowCloseTop()
|
||||||
void WindowCloseAll()
|
void WindowCloseAll()
|
||||||
{
|
{
|
||||||
WindowCloseByClass(WindowClass::Dropdown);
|
WindowCloseByClass(WindowClass::Dropdown);
|
||||||
window_close_by_condition([](rct_window* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); });
|
WindowCloseByCondition([](rct_window* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowCloseAllExceptClass(WindowClass cls)
|
void WindowCloseAllExceptClass(WindowClass cls)
|
||||||
{
|
{
|
||||||
WindowCloseByClass(WindowClass::Dropdown);
|
WindowCloseByClass(WindowClass::Dropdown);
|
||||||
|
|
||||||
window_close_by_condition([cls](rct_window* w) -> bool {
|
WindowCloseByCondition([cls](rct_window* w) -> bool {
|
||||||
return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT));
|
return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ void WindowCloseAllExceptClass(WindowClass cls)
|
||||||
*/
|
*/
|
||||||
void WindowCloseAllExceptFlags(uint16_t flags)
|
void WindowCloseAllExceptFlags(uint16_t flags)
|
||||||
{
|
{
|
||||||
window_close_by_condition([flags](rct_window* w) -> bool { return !(w->flags & flags); });
|
WindowCloseByCondition([flags](rct_window* w) -> bool { return !(w->flags & flags); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -404,7 +404,7 @@ void WindowCloseAllExceptFlags(uint16_t flags)
|
||||||
void WindowCloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls)
|
void WindowCloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls)
|
||||||
{
|
{
|
||||||
WindowCloseByClass(WindowClass::Dropdown);
|
WindowCloseByClass(WindowClass::Dropdown);
|
||||||
window_close_by_condition([cls, number](rct_window* w) -> bool {
|
WindowCloseByCondition([cls, number](rct_window* w) -> bool {
|
||||||
return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)));
|
return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ WidgetIndex WindowFindWidgetFromPoint(rct_window& w, const ScreenCoordsXY& scree
|
||||||
*
|
*
|
||||||
* @param window The window to invalidate (esi).
|
* @param window The window to invalidate (esi).
|
||||||
*/
|
*/
|
||||||
template<typename TPred> static void window_invalidate_by_condition(TPred pred)
|
template<typename TPred> static void WindowInvalidateByCondition(TPred pred)
|
||||||
{
|
{
|
||||||
WindowVisitEach([pred](rct_window* w) {
|
WindowVisitEach([pred](rct_window* w) {
|
||||||
if (pred(w))
|
if (pred(w))
|
||||||
|
@ -503,7 +503,7 @@ template<typename TPred> static void window_invalidate_by_condition(TPred pred)
|
||||||
*/
|
*/
|
||||||
void WindowInvalidateByClass(WindowClass cls)
|
void WindowInvalidateByClass(WindowClass cls)
|
||||||
{
|
{
|
||||||
window_invalidate_by_condition([cls](rct_window* w) -> bool { return w->classification == cls; });
|
WindowInvalidateByCondition([cls](rct_window* w) -> bool { return w->classification == cls; });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -512,7 +512,7 @@ void WindowInvalidateByClass(WindowClass cls)
|
||||||
*/
|
*/
|
||||||
void WindowInvalidateByNumber(WindowClass cls, rct_windownumber number)
|
void WindowInvalidateByNumber(WindowClass cls, rct_windownumber number)
|
||||||
{
|
{
|
||||||
window_invalidate_by_condition(
|
WindowInvalidateByCondition(
|
||||||
[cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; });
|
[cls, number](rct_window* w) -> bool { return w->classification == cls && w->number == number; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +852,7 @@ void WindowScrollToLocation(rct_window& w, const CoordsXYZ& coords)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto screenCoords = Translate3DTo2DWithZ(get_current_rotation(), coords);
|
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), coords);
|
||||||
|
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||||
|
@ -931,7 +931,7 @@ void WindowRotateCamera(rct_window& w, int32_t direction)
|
||||||
|
|
||||||
// has something to do with checking if middle of the viewport is obstructed
|
// has something to do with checking if middle of the viewport is obstructed
|
||||||
rct_viewport* other;
|
rct_viewport* other;
|
||||||
auto mapXYCoords = screen_get_map_xy(windowPos, &other);
|
auto mapXYCoords = ScreenGetMapXY(windowPos, &other);
|
||||||
CoordsXYZ coords{};
|
CoordsXYZ coords{};
|
||||||
|
|
||||||
// other != viewport probably triggers on viewports in ride or guest window?
|
// other != viewport probably triggers on viewports in ride or guest window?
|
||||||
|
@ -940,7 +940,7 @@ void WindowRotateCamera(rct_window& w, int32_t direction)
|
||||||
{
|
{
|
||||||
auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos;
|
auto viewPos = ScreenCoordsXY{ (viewport->view_width >> 1), (viewport->view_height >> 1) } + viewport->viewPos;
|
||||||
|
|
||||||
coords = viewport_adjust_for_map_height(viewPos);
|
coords = ViewportAdjustForMapHeight(viewPos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -949,7 +949,7 @@ void WindowRotateCamera(rct_window& w, int32_t direction)
|
||||||
coords.z = TileElementHeight(coords);
|
coords.z = TileElementHeight(coords);
|
||||||
}
|
}
|
||||||
|
|
||||||
gCurrentRotation = (get_current_rotation() + direction) & 3;
|
gCurrentRotation = (GetCurrentRotation() + direction) & 3;
|
||||||
|
|
||||||
auto centreLoc = centre_2d_coordinates(coords, viewport);
|
auto centreLoc = centre_2d_coordinates(coords, viewport);
|
||||||
|
|
||||||
|
@ -973,8 +973,8 @@ void WindowViewportGetMapCoordsByCursor(
|
||||||
|
|
||||||
// Compute map coordinate by mouse position.
|
// Compute map coordinate by mouse position.
|
||||||
auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords);
|
auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords);
|
||||||
auto coordsXYZ = viewport_adjust_for_map_height(viewportPos);
|
auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos);
|
||||||
auto mapCoords = viewport_coord_to_map_coord(viewportPos, coordsXYZ.z);
|
auto mapCoords = ViewportPosToMapPos(viewportPos, coordsXYZ.z);
|
||||||
*map_x = mapCoords.x;
|
*map_x = mapCoords.x;
|
||||||
*map_y = mapCoords.y;
|
*map_y = mapCoords.y;
|
||||||
|
|
||||||
|
@ -1151,26 +1151,26 @@ void WindowDraw(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top
|
||||||
if (topwindow->windowPos.x > left)
|
if (topwindow->windowPos.x > left)
|
||||||
{
|
{
|
||||||
// Split draw at topwindow.left
|
// Split draw at topwindow.left
|
||||||
window_draw_core(dpi, w, left, top, topwindow->windowPos.x, bottom);
|
WindowDrawCore(dpi, w, left, top, topwindow->windowPos.x, bottom);
|
||||||
window_draw_core(dpi, w, topwindow->windowPos.x, top, right, bottom);
|
WindowDrawCore(dpi, w, topwindow->windowPos.x, top, right, bottom);
|
||||||
}
|
}
|
||||||
else if (topwindow->windowPos.x + topwindow->width < right)
|
else if (topwindow->windowPos.x + topwindow->width < right)
|
||||||
{
|
{
|
||||||
// Split draw at topwindow.right
|
// Split draw at topwindow.right
|
||||||
window_draw_core(dpi, w, left, top, topwindow->windowPos.x + topwindow->width, bottom);
|
WindowDrawCore(dpi, w, left, top, topwindow->windowPos.x + topwindow->width, bottom);
|
||||||
window_draw_core(dpi, w, topwindow->windowPos.x + topwindow->width, top, right, bottom);
|
WindowDrawCore(dpi, w, topwindow->windowPos.x + topwindow->width, top, right, bottom);
|
||||||
}
|
}
|
||||||
else if (topwindow->windowPos.y > top)
|
else if (topwindow->windowPos.y > top)
|
||||||
{
|
{
|
||||||
// Split draw at topwindow.top
|
// Split draw at topwindow.top
|
||||||
window_draw_core(dpi, w, left, top, right, topwindow->windowPos.y);
|
WindowDrawCore(dpi, w, left, top, right, topwindow->windowPos.y);
|
||||||
window_draw_core(dpi, w, left, topwindow->windowPos.y, right, bottom);
|
WindowDrawCore(dpi, w, left, topwindow->windowPos.y, right, bottom);
|
||||||
}
|
}
|
||||||
else if (topwindow->windowPos.y + topwindow->height < bottom)
|
else if (topwindow->windowPos.y + topwindow->height < bottom)
|
||||||
{
|
{
|
||||||
// Split draw at topwindow.bottom
|
// Split draw at topwindow.bottom
|
||||||
window_draw_core(dpi, w, left, top, right, topwindow->windowPos.y + topwindow->height);
|
WindowDrawCore(dpi, w, left, top, right, topwindow->windowPos.y + topwindow->height);
|
||||||
window_draw_core(dpi, w, left, topwindow->windowPos.y + topwindow->height, right, bottom);
|
WindowDrawCore(dpi, w, left, topwindow->windowPos.y + topwindow->height, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drawing for this region should be done now, exit
|
// Drawing for this region should be done now, exit
|
||||||
|
@ -1178,13 +1178,13 @@ void WindowDraw(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top
|
||||||
}
|
}
|
||||||
|
|
||||||
// No windows overlap
|
// No windows overlap
|
||||||
window_draw_core(dpi, w, left, top, right, bottom);
|
WindowDrawCore(dpi, w, left, top, right, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the given window and any other overlapping transparent windows.
|
* Draws the given window and any other overlapping transparent windows.
|
||||||
*/
|
*/
|
||||||
static void window_draw_core(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
static void WindowDrawCore(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||||
{
|
{
|
||||||
// Clamp region
|
// Clamp region
|
||||||
left = std::max<int32_t>(left, w.windowPos.x);
|
left = std::max<int32_t>(left, w.windowPos.x);
|
||||||
|
@ -1202,12 +1202,12 @@ static void window_draw_core(rct_drawpixelinfo* dpi, rct_window& w, int32_t left
|
||||||
auto* v = (*it).get();
|
auto* v = (*it).get();
|
||||||
if ((&w == v || (v->flags & WF_TRANSPARENT)) && WindowIsVisible(*v))
|
if ((&w == v || (v->flags & WF_TRANSPARENT)) && WindowIsVisible(*v))
|
||||||
{
|
{
|
||||||
window_draw_single(dpi, *v, left, top, right, bottom);
|
WindowDrawSingle(dpi, *v, left, top, right, bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void window_draw_single(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
static void WindowDrawSingle(rct_drawpixelinfo* dpi, rct_window& w, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||||
{
|
{
|
||||||
// Copy dpi so we can crop it
|
// Copy dpi so we can crop it
|
||||||
rct_drawpixelinfo copy = *dpi;
|
rct_drawpixelinfo copy = *dpi;
|
||||||
|
@ -1277,7 +1277,7 @@ static void window_draw_single(rct_drawpixelinfo* dpi, rct_window& w, int32_t le
|
||||||
*/
|
*/
|
||||||
void WindowDrawViewport(rct_drawpixelinfo* dpi, rct_window& w)
|
void WindowDrawViewport(rct_drawpixelinfo* dpi, rct_window& w)
|
||||||
{
|
{
|
||||||
viewport_render(dpi, w.viewport, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } });
|
ViewportRender(dpi, w.viewport, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } });
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowSetPosition(rct_window& w, const ScreenCoordsXY& screenCoords)
|
void WindowSetPosition(rct_window& w, const ScreenCoordsXY& screenCoords)
|
||||||
|
|
|
@ -33,7 +33,7 @@ void rct_window::RemoveViewport()
|
||||||
if (viewport == nullptr)
|
if (viewport == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
viewport_remove(viewport);
|
ViewportRemove(viewport);
|
||||||
viewport = nullptr;
|
viewport = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1974,7 +1974,7 @@ void NetworkBase::ServerClientDisconnected(std::unique_ptr<NetworkConnection>& c
|
||||||
format_string(text, 256, STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_NO_REASON, &(has_disconnected_args[0]));
|
format_string(text, 256, STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_NO_REASON, &(has_disconnected_args[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
chat_history_add(text);
|
ChatAddHistory(text);
|
||||||
Peep* pickup_peep = network_get_pickup_peep(connection_player->Id);
|
Peep* pickup_peep = network_get_pickup_peep(connection_player->Id);
|
||||||
if (pickup_peep != nullptr)
|
if (pickup_peep != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -2270,7 +2270,7 @@ void NetworkBase::Server_Client_Joined(std::string_view name, const std::string&
|
||||||
char text[256];
|
char text[256];
|
||||||
const char* player_name = static_cast<const char*>(player->Name.c_str());
|
const char* player_name = static_cast<const char*>(player->Name.c_str());
|
||||||
format_string(text, 256, STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, &player_name);
|
format_string(text, 256, STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, &player_name);
|
||||||
chat_history_add(text);
|
ChatAddHistory(text);
|
||||||
|
|
||||||
auto& context = GetContext();
|
auto& context = GetContext();
|
||||||
auto& objManager = context.GetObjectManager();
|
auto& objManager = context.GetObjectManager();
|
||||||
|
@ -2770,7 +2770,7 @@ void NetworkBase::Client_Handle_CHAT([[maybe_unused]] NetworkConnection& connect
|
||||||
auto text = packet.ReadString();
|
auto text = packet.ReadString();
|
||||||
if (!text.empty())
|
if (!text.empty())
|
||||||
{
|
{
|
||||||
chat_history_add(std::string(text));
|
ChatAddHistory(std::string(text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2836,7 +2836,7 @@ void NetworkBase::Server_Handle_CHAT(NetworkConnection& connection, NetworkPacke
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* formatted = FormatChat(connection.Player, text.c_str());
|
const char* formatted = FormatChat(connection.Player, text.c_str());
|
||||||
chat_history_add(formatted);
|
ChatAddHistory(formatted);
|
||||||
Server_Send_CHAT(formatted);
|
Server_Send_CHAT(formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3090,7 +3090,7 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec
|
||||||
{
|
{
|
||||||
auto playerName = packet.ReadString();
|
auto playerName = packet.ReadString();
|
||||||
auto message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, playerName);
|
auto message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, playerName);
|
||||||
chat_history_add(message);
|
ChatAddHistory(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SERVER_EVENT_PLAYER_DISCONNECTED:
|
case SERVER_EVENT_PLAYER_DISCONNECTED:
|
||||||
|
@ -3106,7 +3106,7 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec
|
||||||
{
|
{
|
||||||
message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_WITH_REASON, playerName, reason);
|
message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_WITH_REASON, playerName, reason);
|
||||||
}
|
}
|
||||||
chat_history_add(message);
|
ChatAddHistory(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3424,7 +3424,7 @@ void network_chat_show_connected_message()
|
||||||
NetworkPlayer server;
|
NetworkPlayer server;
|
||||||
server.Name = "Server";
|
server.Name = "Server";
|
||||||
const char* formatted = NetworkBase::FormatChat(&server, buffer);
|
const char* formatted = NetworkBase::FormatChat(&server, buffer);
|
||||||
chat_history_add(formatted);
|
ChatAddHistory(formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display server greeting if one exists
|
// Display server greeting if one exists
|
||||||
|
@ -3436,7 +3436,7 @@ void network_chat_show_server_greeting()
|
||||||
thread_local std::string greeting_formatted;
|
thread_local std::string greeting_formatted;
|
||||||
greeting_formatted.assign("{OUTLINE}{GREEN}");
|
greeting_formatted.assign("{OUTLINE}{GREEN}");
|
||||||
greeting_formatted += greeting;
|
greeting_formatted += greeting;
|
||||||
chat_history_add(greeting_formatted);
|
ChatAddHistory(greeting_formatted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3800,7 +3800,7 @@ void network_send_chat(const char* text, const std::vector<uint8_t>& playerIds)
|
||||||
|| std::find(playerIds.begin(), playerIds.end(), network.GetPlayerID()) != playerIds.end())
|
|| std::find(playerIds.begin(), playerIds.end(), network.GetPlayerID()) != playerIds.end())
|
||||||
{
|
{
|
||||||
// Server is one of the recipients
|
// Server is one of the recipients
|
||||||
chat_history_add(formatted);
|
ChatAddHistory(formatted);
|
||||||
}
|
}
|
||||||
network.Server_Send_CHAT(formatted, playerIds);
|
network.Server_Send_CHAT(formatted, playerIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ static PaintStruct* CreateNormalPaintStruct(
|
||||||
|
|
||||||
template<uint8_t direction> void PaintSessionGenerateRotate(PaintSession& session)
|
template<uint8_t direction> void PaintSessionGenerateRotate(PaintSession& session)
|
||||||
{
|
{
|
||||||
// Optimised modified version of viewport_coord_to_map_coord
|
// Optimised modified version of ViewportPosToMapPos
|
||||||
ScreenCoordsXY screenCoord = { floor2(session.DPI.x, 32), floor2((session.DPI.y - 16), 32) };
|
ScreenCoordsXY screenCoord = { floor2(session.DPI.x, 32), floor2((session.DPI.y - 16), 32) };
|
||||||
CoordsXY mapTile = { screenCoord.y - screenCoord.x / 2, screenCoord.y + screenCoord.x / 2 };
|
CoordsXY mapTile = { screenCoord.y - screenCoord.x / 2, screenCoord.y + screenCoord.x / 2 };
|
||||||
mapTile = mapTile.Rotate(direction);
|
mapTile = mapTile.Rotate(direction);
|
||||||
|
@ -245,7 +245,7 @@ template<uint8_t direction> void PaintSessionGenerateRotate(PaintSession& sessio
|
||||||
*/
|
*/
|
||||||
void PaintSessionGenerate(PaintSession& session)
|
void PaintSessionGenerate(PaintSession& session)
|
||||||
{
|
{
|
||||||
session.CurrentRotation = get_current_rotation();
|
session.CurrentRotation = GetCurrentRotation();
|
||||||
switch (DirectionFlipXAxis(session.CurrentRotation))
|
switch (DirectionFlipXAxis(session.CurrentRotation))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -567,7 +567,7 @@ static void PaintAttachedPS(rct_drawpixelinfo* dpi, PaintStruct* ps, uint32_t vi
|
||||||
static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y)
|
static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, PaintStruct* ps, ImageId imageId, int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->sprite_type)];
|
const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->sprite_type)];
|
||||||
const uint8_t rotation = get_current_rotation();
|
const uint8_t rotation = GetCurrentRotation();
|
||||||
|
|
||||||
const CoordsXYZ frontTop = {
|
const CoordsXYZ frontTop = {
|
||||||
ps->bounds.x_end,
|
ps->bounds.x_end,
|
||||||
|
|
|
@ -343,7 +343,7 @@ static void PaintHeightMarkers(PaintSession& session, const EntranceElement& ent
|
||||||
auto heightMarkerBaseZ = entranceEl.GetBaseZ() + 3;
|
auto heightMarkerBaseZ = entranceEl.GetBaseZ() + 3;
|
||||||
ImageIndex baseImageIndex = SPR_HEIGHT_MARKER_BASE;
|
ImageIndex baseImageIndex = SPR_HEIGHT_MARKER_BASE;
|
||||||
baseImageIndex += heightMarkerBaseZ / 16;
|
baseImageIndex += heightMarkerBaseZ / 16;
|
||||||
baseImageIndex += get_height_marker_offset();
|
baseImageIndex += GetHeightMarkerOffset();
|
||||||
baseImageIndex -= gMapBaseZ;
|
baseImageIndex -= gMapBaseZ;
|
||||||
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
|
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
|
||||||
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 31, 31, heightMarkerBaseZ + 64 }, { 1, 1, 0 } });
|
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 31, 31, heightMarkerBaseZ + 64 }, { 1, 1, 0 } });
|
||||||
|
|
|
@ -923,7 +923,7 @@ static void PaintHeightMarkers(PaintSession& session, const PathElement& pathEl)
|
||||||
|
|
||||||
uint32_t baseImageIndex = SPR_HEIGHT_MARKER_BASE;
|
uint32_t baseImageIndex = SPR_HEIGHT_MARKER_BASE;
|
||||||
baseImageIndex += heightMarkerBaseZ / 16;
|
baseImageIndex += heightMarkerBaseZ / 16;
|
||||||
baseImageIndex += get_height_marker_offset();
|
baseImageIndex += GetHeightMarkerOffset();
|
||||||
baseImageIndex -= gMapBaseZ;
|
baseImageIndex -= gMapBaseZ;
|
||||||
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
|
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
|
||||||
PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 });
|
PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 });
|
||||||
|
|
|
@ -1090,7 +1090,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
|
||||||
int32_t dx = surfaceHeight + 3;
|
int32_t dx = surfaceHeight + 3;
|
||||||
|
|
||||||
int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16);
|
int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16);
|
||||||
image_id += get_height_marker_offset();
|
image_id += GetHeightMarkerOffset();
|
||||||
image_id -= gMapBaseZ;
|
image_id -= gMapBaseZ;
|
||||||
|
|
||||||
PaintAddImageAsParent(session, ImageId(image_id, COLOUR_OLIVE_GREEN), { 16, 16, surfaceHeight }, { 1, 1, 0 });
|
PaintAddImageAsParent(session, ImageId(image_id, COLOUR_OLIVE_GREEN), { 16, 16, surfaceHeight }, { 1, 1, 0 });
|
||||||
|
|
|
@ -214,7 +214,7 @@ static bool OnCrash(
|
||||||
// Discovering which of the approaches got implemented is left as an excercise for the reader.
|
// Discovering which of the approaches got implemented is left as an excercise for the reader.
|
||||||
if (OpenRCT2::GetContext()->GetDrawingEngineType() != DrawingEngine::OpenGL)
|
if (OpenRCT2::GetContext()->GetDrawingEngineType() != DrawingEngine::OpenGL)
|
||||||
{
|
{
|
||||||
std::string screenshotPath = screenshot_dump();
|
std::string screenshotPath = ScreenshotDump();
|
||||||
if (!screenshotPath.empty())
|
if (!screenshotPath.empty())
|
||||||
{
|
{
|
||||||
auto screenshotPathW = String::ToWideChar(screenshotPath.c_str());
|
auto screenshotPathW = String::ToWideChar(screenshotPath.c_str());
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ void UpdateSpiralSlide(Ride& ride)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t current_rotation = get_current_rotation();
|
const uint8_t current_rotation = GetCurrentRotation();
|
||||||
// Invalidate something related to station start
|
// Invalidate something related to station start
|
||||||
for (int32_t i = 0; i < OpenRCT2::Limits::MaxStationsPerRide; i++)
|
for (int32_t i = 0; i < OpenRCT2::Limits::MaxStationsPerRide; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -382,7 +382,7 @@ namespace OpenRCT2::RideAudio
|
||||||
{
|
{
|
||||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != nullptr)
|
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != nullptr)
|
||||||
{
|
{
|
||||||
auto rotatedCoords = Translate3DTo2DWithZ(get_current_rotation(), rideCoords);
|
auto rotatedCoords = Translate3DTo2DWithZ(GetCurrentRotation(), rideCoords);
|
||||||
auto viewport = g_music_tracking_viewport;
|
auto viewport = g_music_tracking_viewport;
|
||||||
auto viewWidth = viewport->view_width;
|
auto viewWidth = viewport->view_width;
|
||||||
auto viewWidth2 = viewWidth * 2;
|
auto viewWidth2 = viewWidth * 2;
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
|
||||||
CoordsXYZD entranceExitCoords{};
|
CoordsXYZD entranceExitCoords{};
|
||||||
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
|
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
|
||||||
// determine if the mouse is hovering over a station - that's the station to add the entrance to
|
// determine if the mouse is hovering over a station - that's the station to add the entrance to
|
||||||
auto info = get_map_coordinates_from_pos(screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
|
auto info = GetMapCoordinatesFromPos(screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
|
||||||
if (info.SpriteType != ViewportInteractionItem::None)
|
if (info.SpriteType != ViewportInteractionItem::None)
|
||||||
{
|
{
|
||||||
if (info.Element->GetType() == TileElementType::Track)
|
if (info.Element->GetType() == TileElementType::Track)
|
||||||
|
@ -1247,7 +1247,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
|
||||||
|
|
||||||
auto stationBaseZ = ride->GetStation(gRideEntranceExitPlaceStationIndex).GetBaseZ();
|
auto stationBaseZ = ride->GetStation(gRideEntranceExitPlaceStationIndex).GetBaseZ();
|
||||||
|
|
||||||
auto coordsAtHeight = screen_get_map_xy_with_z(screenCoords, stationBaseZ);
|
auto coordsAtHeight = ScreenGetMapXYWithZ(screenCoords, stationBaseZ);
|
||||||
if (!coordsAtHeight.has_value())
|
if (!coordsAtHeight.has_value())
|
||||||
{
|
{
|
||||||
entranceExitCoords.SetNull();
|
entranceExitCoords.SetNull();
|
||||||
|
|
|
@ -2172,7 +2172,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels)
|
||||||
gCurrentRotation = i;
|
gCurrentRotation = i;
|
||||||
|
|
||||||
view.viewPos = Translate3DTo2DWithZ(i, centre) - offset;
|
view.viewPos = Translate3DTo2DWithZ(i, centre) - offset;
|
||||||
viewport_paint(&view, &dpi, { view.viewPos, view.viewPos + ScreenCoordsXY{ size_x, size_y } });
|
ViewportPaint(&view, &dpi, { view.viewPos, view.viewPos + ScreenCoordsXY{ size_x, size_y } });
|
||||||
|
|
||||||
dpi.bits += TRACK_PREVIEW_IMAGE_SIZE;
|
dpi.bits += TRACK_PREVIEW_IMAGE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2196,9 +2196,9 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons
|
||||||
{
|
{
|
||||||
uint16_t ax = ride->GetRideTypeDescriptor().Heights.VehicleZOffset;
|
uint16_t ax = ride->GetRideTypeDescriptor().Heights.VehicleZOffset;
|
||||||
// 0x1689 represents 0 height there are -127 to 128 heights above and below it
|
// 0x1689 represents 0 height there are -127 to 128 heights above and below it
|
||||||
// There are 3 arrays of 256 heights (units, m, ft) chosen with the get_height_marker_offset()
|
// There are 3 arrays of 256 heights (units, m, ft) chosen with the GetHeightMarkerOffset()
|
||||||
auto heightNum = (height + 8) / 16 - gMapBaseZ;
|
auto heightNum = (height + 8) / 16 - gMapBaseZ;
|
||||||
auto imageId = ImageId(SPR_HEIGHT_MARKER_BASE + get_height_marker_offset() + heightNum, COLOUR_LIGHT_BLUE);
|
auto imageId = ImageId(SPR_HEIGHT_MARKER_BASE + GetHeightMarkerOffset() + heightNum, COLOUR_LIGHT_BLUE);
|
||||||
|
|
||||||
PaintAddImageAsParent(session, imageId, { 16, 16, height + ax + 3 }, { 1, 1, 0 }, { 1000, 1000, 2047 });
|
PaintAddImageAsParent(session, imageId, { 16, 16, height + ax + 3 }, { 1, 1, 0 }, { 1000, 1000, 2047 });
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace OpenRCT2::Title
|
||||||
w->SetLocation({ loc, z });
|
w->SetLocation({ loc, z });
|
||||||
gScreenFlags = oldScreenFlags;
|
gScreenFlags = oldScreenFlags;
|
||||||
|
|
||||||
viewport_update_position(w);
|
ViewportUpdatePosition(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -130,7 +130,7 @@ void TitleScreen::Load()
|
||||||
#endif
|
#endif
|
||||||
OpenRCT2::Audio::StopAll();
|
OpenRCT2::Audio::StopAll();
|
||||||
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
|
||||||
viewport_init_all();
|
ViewportInitAll();
|
||||||
ContextOpenWindow(WindowClass::MainWindow);
|
ContextOpenWindow(WindowClass::MainWindow);
|
||||||
CreateWindows();
|
CreateWindows();
|
||||||
TitleInitialise();
|
TitleInitialise();
|
||||||
|
@ -159,7 +159,7 @@ void TitleScreen::Tick()
|
||||||
{
|
{
|
||||||
gInUpdateCode = true;
|
gInUpdateCode = true;
|
||||||
|
|
||||||
screenshot_check();
|
ScreenshotCheck();
|
||||||
title_handle_keyboard_input();
|
title_handle_keyboard_input();
|
||||||
|
|
||||||
if (game_is_not_paused())
|
if (game_is_not_paused())
|
||||||
|
|
|
@ -60,9 +60,9 @@ money32 PlaceProvisionalTrackPiece(
|
||||||
|
|
||||||
_unkF440C5 = { trackPos, static_cast<Direction>(trackDirection) };
|
_unkF440C5 = { trackPos, static_cast<Direction>(trackDirection) };
|
||||||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||||
viewport_set_visibility(3);
|
ViewportSetVisibility(3);
|
||||||
if (_currentTrackSlopeEnd != 0)
|
if (_currentTrackSlopeEnd != 0)
|
||||||
viewport_set_visibility(2);
|
ViewportSetVisibility(2);
|
||||||
|
|
||||||
// Invalidate previous track piece (we may not be changing height!)
|
// Invalidate previous track piece (we may not be changing height!)
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
|
@ -102,9 +102,9 @@ money32 PlaceProvisionalTrackPiece(
|
||||||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||||
|
|
||||||
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
||||||
viewport_set_visibility((resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) ? 1 : 3);
|
ViewportSetVisibility((resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) ? 1 : 3);
|
||||||
if (_currentTrackSlopeEnd != 0)
|
if (_currentTrackSlopeEnd != 0)
|
||||||
viewport_set_visibility(2);
|
ViewportSetVisibility(2);
|
||||||
|
|
||||||
// Invalidate previous track piece (we may not be changing height!)
|
// Invalidate previous track piece (we may not be changing height!)
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
|
|
|
@ -158,11 +158,11 @@ money32 FootpathProvisionalSet(
|
||||||
|
|
||||||
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||||
{
|
{
|
||||||
viewport_set_visibility(1);
|
ViewportSetVisibility(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
viewport_set_visibility(3);
|
ViewportSetVisibility(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,11 +249,11 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
auto viewport = window->viewport;
|
auto viewport = window->viewport;
|
||||||
auto info = get_map_coordinates_from_pos_window(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Footpath));
|
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Footpath));
|
||||||
if (info.SpriteType != ViewportInteractionItem::Footpath
|
if (info.SpriteType != ViewportInteractionItem::Footpath
|
||||||
|| !(viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)))
|
|| !(viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)))
|
||||||
{
|
{
|
||||||
info = get_map_coordinates_from_pos_window(
|
info = GetMapCoordinatesFromPosWindow(
|
||||||
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
|
||||||
if (info.SpriteType == ViewportInteractionItem::None)
|
if (info.SpriteType == ViewportInteractionItem::None)
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32
|
||||||
{
|
{
|
||||||
z = TileElementHeight(position);
|
z = TileElementHeight(position);
|
||||||
}
|
}
|
||||||
position = viewport_coord_to_map_coord(start_vp_pos, z);
|
position = ViewportPosToMapPos(start_vp_pos, z);
|
||||||
position.x = std::clamp(position.x, minPosition.x, maxPosition.x);
|
position.x = std::clamp(position.x, minPosition.x, maxPosition.x);
|
||||||
position.y = std::clamp(position.y, minPosition.y, maxPosition.y);
|
position.y = std::clamp(position.y, minPosition.y, maxPosition.y);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
auto viewport = window->viewport;
|
auto viewport = window->viewport;
|
||||||
auto info = get_map_coordinates_from_pos_window(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
|
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
|
||||||
*tileElement = info.Element;
|
*tileElement = info.Element;
|
||||||
if (info.SpriteType == ViewportInteractionItem::Ride
|
if (info.SpriteType == ViewportInteractionItem::Ride
|
||||||
&& viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)
|
&& viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)
|
||||||
|
@ -365,7 +365,7 @@ CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info = get_map_coordinates_from_pos_window(
|
info = GetMapCoordinatesFromPosWindow(
|
||||||
window, screenCoords,
|
window, screenCoords,
|
||||||
EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath, ViewportInteractionItem::Ride));
|
EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath, ViewportInteractionItem::Ride));
|
||||||
if (info.SpriteType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TileElementType::Entrance)
|
if (info.SpriteType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TileElementType::Entrance)
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ void MapInvalidateMapSelectionTiles()
|
||||||
|
|
||||||
static void MapGetBoundingBox(const MapRange& _range, int32_t* left, int32_t* top, int32_t* right, int32_t* bottom)
|
static void MapGetBoundingBox(const MapRange& _range, int32_t* left, int32_t* top, int32_t* right, int32_t* bottom)
|
||||||
{
|
{
|
||||||
uint32_t rotation = get_current_rotation();
|
uint32_t rotation = GetCurrentRotation();
|
||||||
const std::array corners{
|
const std::array corners{
|
||||||
CoordsXY{ _range.GetLeft(), _range.GetTop() },
|
CoordsXY{ _range.GetLeft(), _range.GetTop() },
|
||||||
CoordsXY{ _range.GetRight(), _range.GetTop() },
|
CoordsXY{ _range.GetRight(), _range.GetTop() },
|
||||||
|
@ -1193,7 +1193,7 @@ void MapInvalidateSelectionRect()
|
||||||
bottom += 32;
|
bottom += 32;
|
||||||
top -= 32 + 2080;
|
top -= 32 + 2080;
|
||||||
|
|
||||||
viewports_invalidate({ { left, top }, { right, bottom } });
|
ViewportsInvalidate({ { left, top }, { right, bottom } });
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t CountElementsOnTile(const CoordsXY& loc)
|
static size_t CountElementsOnTile(const CoordsXY& loc)
|
||||||
|
@ -1844,14 +1844,14 @@ static void MapInvalidateTileUnderZoom(int32_t x, int32_t y, int32_t z0, int32_t
|
||||||
|
|
||||||
x += 16;
|
x += 16;
|
||||||
y += 16;
|
y += 16;
|
||||||
auto screenCoord = Translate3DTo2D(get_current_rotation(), { x, y });
|
auto screenCoord = Translate3DTo2D(GetCurrentRotation(), { x, y });
|
||||||
|
|
||||||
x1 = screenCoord.x - 32;
|
x1 = screenCoord.x - 32;
|
||||||
y1 = screenCoord.y - 32 - z1;
|
y1 = screenCoord.y - 32 - z1;
|
||||||
x2 = screenCoord.x + 32;
|
x2 = screenCoord.x + 32;
|
||||||
y2 = screenCoord.y + 32 - z0;
|
y2 = screenCoord.y + 32 - z0;
|
||||||
|
|
||||||
viewports_invalidate({ { x1, y1 }, { x2, y2 } }, maxZoom);
|
ViewportsInvalidate({ { x1, y1 }, { x2, y2 } }, maxZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1912,7 +1912,7 @@ void MapInvalidateRegion(const CoordsXY& mins, const CoordsXY& maxs)
|
||||||
bottom += 32;
|
bottom += 32;
|
||||||
top -= 32 + 2080;
|
top -= 32 + 2080;
|
||||||
|
|
||||||
viewports_invalidate({ { left, top }, { right, bottom } });
|
ViewportsInvalidate({ { left, top }, { right, bottom } });
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MapGetTileSide(const CoordsXY& mapPos)
|
int32_t MapGetTileSide(const CoordsXY& mapPos)
|
||||||
|
|
|
@ -145,7 +145,7 @@ static bool MapAnimationInvalidateQueueBanner(const CoordsXYZ& loc)
|
||||||
if (!tileElement->AsPath()->HasQueueBanner())
|
if (!tileElement->AsPath()->HasQueueBanner())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32_t direction = (tileElement->AsPath()->GetQueueBannerDirection() + get_current_rotation()) & 3;
|
int32_t direction = (tileElement->AsPath()->GetQueueBannerDirection() + GetCurrentRotation()) & 3;
|
||||||
if (direction == TILE_ELEMENT_DIRECTION_NORTH || direction == TILE_ELEMENT_DIRECTION_EAST)
|
if (direction == TILE_ELEMENT_DIRECTION_NORTH || direction == TILE_ELEMENT_DIRECTION_EAST)
|
||||||
{
|
{
|
||||||
MapInvalidateTileZoom1({ loc, loc.z + 16, loc.z + 30 });
|
MapInvalidateTileZoom1({ loc, loc.z + 16, loc.z + 30 });
|
||||||
|
|
Loading…
Reference in New Issue