Remove snake_case in interface folder

This commit is contained in:
Gymnasiast 2023-01-16 21:14:50 +01:00
parent 28edbf9116
commit 5309c80e29
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
77 changed files with 680 additions and 677 deletions

View File

@ -145,7 +145,7 @@ public:
void Draw(rct_drawpixelinfo* dpi) override
{
auto bgColour = ThemeGetColour(WindowClass::Chat, 0);
chat_draw(dpi, bgColour);
ChatDraw(dpi, bgColour);
_inGameConsole.Draw(dpi);
}

View File

@ -609,7 +609,7 @@ public:
mainWindow->savedViewPos.y -= viewport->view_height >> 1;
// Make sure the viewport has correct coordinates set.
viewport_update_position(mainWindow);
ViewportUpdatePosition(mainWindow);
mainWindow->Invalidate();
}

View File

@ -341,7 +341,7 @@ public:
const OpenGLFramebuffer& framebuffer = _drawingContext->GetFinalFramebuffer();
framebuffer.Bind();
framebuffer.GetPixels(_bitsDPI);
std::string result = screenshot_dump_png(&_bitsDPI);
std::string result = ScreenshotDumpPNG(&_bitsDPI);
return result;
}

View File

@ -268,7 +268,7 @@ void InputManager::ProcessChat(const InputEvent& e)
}
if (input != ChatInput::None)
{
chat_input(input);
ChatInput(input);
}
}
}

View File

@ -1637,8 +1637,8 @@ void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords)
int32_t y = mainWindow->savedViewPos.y + viewport->view_height / 2;
int32_t y_dy = mainWindow->savedViewPos.y + viewport->view_height / 2 + dy;
auto mapCoord = viewport_coord_to_map_coord({ x, y }, 0);
auto mapCoord_dy = viewport_coord_to_map_coord({ x, y_dy }, 0);
auto mapCoord = ViewportPosToMapPos({ x, y }, 0);
auto mapCoord_dy = ViewportPosToMapPos({ x, y_dy }, 0);
// Check if we're crossing the boundary
// Clamp to the map minimum value

View File

@ -794,15 +794,15 @@ void ShortcutManager::RegisterDefaultShortcuts()
RegisterShortcut(ShortcutId::InterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", []() { ShortcutLoadGame(); });
RegisterShortcut(ShortcutId::InterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", []() { ShortcutQuickSaveGame(); });
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::InterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, []() { ShortcutToggleClearanceChecks(); });
RegisterShortcut(ShortcutId::MultiplayerChat, STR_SEND_MESSAGE, "C", []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
if (chat_available())
if (ChatAvailable())
{
chat_toggle();
ChatToggle();
}
}
});

View File

@ -70,7 +70,7 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) && gEditorStep != EditorStep::RollercoasterDesigner)
return info;
info = get_map_coordinates_from_pos(
info = GetMapCoordinatesFromPos(
screenCoords,
EnumsToFlags(ViewportInteractionItem::Entity, ViewportInteractionItem::Ride, ViewportInteractionItem::ParkEntrance));
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>(
~EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
info = get_map_coordinates_from_pos(screenCoords, flags);
info = GetMapCoordinatesFromPos(screenCoords, flags);
auto tileElement = info.Element;
switch (info.SpriteType)
@ -768,7 +768,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
return ret;
}
auto viewport = window->viewport;
auto info = get_map_coordinates_from_pos_window(
auto info = GetMapCoordinatesFromPosWindow(
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
auto initialPos = info.Loc;
@ -794,7 +794,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
{
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.y = std::clamp(mapPos.y, initialPos.y, initialPos.y + 31);
}

View File

@ -185,7 +185,7 @@ namespace OpenRCT2::Scripting
if (dukHandler.is_function())
{
auto ctx = dukHandler.context();
auto info = get_map_coordinates_from_pos(screenCoords, Filter);
auto info = GetMapCoordinatesFromPos(screenCoords, Filter);
DukObject obj(dukHandler.context());
obj.Set("isDown", MouseDown);

View File

@ -803,7 +803,7 @@ namespace OpenRCT2::Ui::Windows
auto wheight = viewportWidget->height() - 1;
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;
Invalidate();
}

View File

@ -111,7 +111,7 @@ namespace OpenRCT2::Scripting
int32_t rotation_get() const
{
return get_current_rotation();
return GetCurrentRotation();
}
void rotation_set(int32_t value)
{
@ -120,7 +120,7 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
while (get_current_rotation() != value)
while (GetCurrentRotation() != value)
{
WindowRotateCamera(*w, 1);
}
@ -179,7 +179,7 @@ namespace OpenRCT2::Scripting
if (viewport != nullptr)
{
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 obj = duk_push_object(ctx);
@ -203,7 +203,7 @@ namespace OpenRCT2::Scripting
auto coords = GetCoordsFromObject(position);
if (coords)
{
auto screenCoords = Translate3DTo2DWithZ(get_current_rotation(), *coords);
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), *coords);
auto left = screenCoords.x - (viewport->view_width / 2);
auto top = screenCoords.y - (viewport->view_height / 2);
SetViewLeftTop(left, top);

View File

@ -78,7 +78,7 @@ private:
void CreateViewport()
{
Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
viewport_create(
ViewportCreate(
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
(viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos));

View File

@ -601,7 +601,7 @@ public:
// Close any other open windows such as options/colour schemes to prevent a crash.
WindowCloseAll();
// window_close(*w);
// WindowClose(*w);
// This function calls window_track_list_open
ManageTracks();

View File

@ -168,7 +168,7 @@ public:
WindowInitScrollWidgets(*this);
WindowPushOthersRight(*this);
show_gridlines();
ShowGridlines();
ToolCancel();
_footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND;
@ -181,11 +181,11 @@ public:
void OnClose() override
{
FootpathProvisionalUpdate();
viewport_set_visibility(0);
ViewportSetVisibility(0);
MapInvalidateMapSelectionTiles();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
WindowInvalidateByClass(WindowClass::TopToolbar);
hide_gridlines();
HideGridlines();
}
void OnUpdate() override
@ -194,7 +194,7 @@ public:
WindowFootpathUpdateProvisionalPathForBridgeMode();
// #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)
{
_lastUpdatedCameraRotation = currentRotation;
@ -438,7 +438,7 @@ public:
if (!IsWidgetDisabled(WIDX_CONSTRUCT))
{
// Get construction image
uint8_t direction = (_footpathConstructDirection + get_current_rotation()) % 4;
uint8_t direction = (_footpathConstructDirection + GetCurrentRotation()) % 4;
uint8_t slope = 0;
if (gFootpathConstructSlope == 2)
{
@ -750,7 +750,7 @@ private:
void WindowFootpathMousedownDirection(int32_t direction)
{
FootpathProvisionalUpdate();
_footpathConstructDirection = (direction - get_current_rotation()) & 3;
_footpathConstructDirection = (direction - GetCurrentRotation()) & 3;
_windowFootpathCost = MONEY32_UNDEFINED;
WindowFootpathSetEnabledAndPressedWidgets();
}
@ -776,7 +776,7 @@ private:
MapInvalidateSelectionRect();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
auto info = get_map_coordinates_from_pos(
auto info = GetMapCoordinatesFromPos(
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
@ -902,7 +902,7 @@ private:
FootpathProvisionalUpdate();
const auto info = get_map_coordinates_from_pos(
const auto info = GetMapCoordinatesFromPos(
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
if (info.SpriteType == ViewportInteractionItem::None)
@ -1048,7 +1048,7 @@ private:
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
{
viewport_set_visibility(1);
ViewportSetVisibility(1);
}
gFootpathConstructFromPosition = footpathLoc;
@ -1211,7 +1211,7 @@ private:
& ~((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));
uint64_t disabledWidgets = 0;
int32_t currentRotation = get_current_rotation();
int32_t currentRotation = GetCurrentRotation();
if (_footpathConstructionMode >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL)
{
// Set pressed directional widget
@ -1306,7 +1306,7 @@ public:
{
return;
}
int32_t currentRotation = get_current_rotation();
int32_t currentRotation = GetCurrentRotation();
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? 1 : -1);
WindowFootpathMousedownDirection(turnedRotation);
}
@ -1318,7 +1318,7 @@ public:
{
return;
}
int32_t currentRotation = get_current_rotation();
int32_t currentRotation = GetCurrentRotation();
int32_t turnedRotation = _footpathConstructDirection - currentRotation + (currentRotation % 2 == 1 ? -1 : 1);
WindowFootpathMousedownDirection(turnedRotation);
}

View File

@ -703,7 +703,7 @@ private:
return;
}
viewport_update_smart_guest_follow(this, peep);
ViewportUpdateSmartFollowGuest(this, peep);
bool reCreateViewport = false;
uint16_t origViewportFlags{};
if (viewport != nullptr)
@ -726,7 +726,7 @@ private:
int32_t widgWidth = viewWidget.width() - 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)
{
viewport->flags = origViewportFlags;
@ -923,7 +923,7 @@ private:
gPickupPeepImage = ImageId();
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionItemAll);
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
if (info.SpriteType == ViewportInteractionItem::None)
return;

View File

@ -66,24 +66,24 @@ public:
gLandToolSize = 1;
show_gridlines();
ShowGridlines();
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
input_set_flag(INPUT_FLAG_6, true);
show_land_rights();
ShowLandRights();
if (gLandRemainingConstructionSales == 0)
{
show_construction_rights();
ShowConstructionRights();
}
}
void OnClose() override
{
hide_gridlines();
HideGridlines();
if (gLandRemainingConstructionSales == 0)
{
hide_construction_rights();
HideConstructionRights();
}
// If the tool wasn't changed, turn tool off
@ -106,7 +106,7 @@ public:
{
ToolSet(*this, WIDX_BUY_LAND_RIGHTS, Tool::UpArrow);
_landRightsMode = LAND_RIGHTS_MODE_BUY_LAND;
show_land_rights();
ShowLandRights();
Invalidate();
}
break;
@ -115,7 +115,7 @@ public:
{
ToolSet(*this, WIDX_BUY_CONSTRUCTION_RIGHTS, Tool::UpArrow);
_landRightsMode = LAND_RIGHTS_MODE_BUY_CONSTRUCTION_RIGHTS;
show_construction_rights();
ShowConstructionRights();
Invalidate();
}
break;
@ -240,7 +240,7 @@ public:
MapInvalidateSelectionRect();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
auto mapTile = screen_get_map_xy(screenCoords, nullptr);
auto mapTile = ScreenGetMapXY(screenCoords, nullptr);
if (!mapTile.has_value())
{
@ -321,11 +321,11 @@ public:
{
if (_landRightsMode == LAND_RIGHTS_MODE_BUY_LAND)
{
hide_land_rights();
HideLandRights();
}
else
{
hide_construction_rights();
HideConstructionRights();
}
}

View File

@ -1159,7 +1159,7 @@ static void WindowOverwritePromptMouseup(rct_window* w, WidgetIndex widgetIndex)
Select(_window_overwrite_prompt_path);
// 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);
break;
}

View File

@ -31,7 +31,7 @@ public:
_mainWidgets[0].bottom = height;
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)
{
SetViewportFlags();
@ -45,7 +45,7 @@ public:
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:

View File

@ -154,7 +154,7 @@ public:
InitScrollWidgets();
_rotation = get_current_rotation();
_rotation = GetCurrentRotation();
InitMap();
gWindowSceneryRotation = 0;
@ -201,9 +201,9 @@ public:
_activeTool = 2;
// Prevent mountain tool size.
_landRightsToolSize = std::max<uint16_t>(MINIMUM_TOOL_SIZE, _landRightsToolSize);
show_gridlines();
show_land_rights();
show_construction_rights();
ShowGridlines();
ShowLandRights();
ShowConstructionRights();
break;
case WIDX_LAND_OWNED_CHECKBOX:
_activeTool ^= 2;
@ -245,9 +245,9 @@ public:
gParkEntranceGhostExists = false;
input_set_flag(INPUT_FLAG_6, true);
show_gridlines();
show_land_rights();
show_construction_rights();
ShowGridlines();
ShowLandRights();
ShowConstructionRights();
break;
case WIDX_ROTATE_90:
gWindowSceneryRotation = (gWindowSceneryRotation + 1) & 3;
@ -256,9 +256,9 @@ public:
if (ToolSet(*this, widgetIndex, Tool::UpArrow))
break;
show_gridlines();
show_land_rights();
show_construction_rights();
ShowGridlines();
ShowLandRights();
ShowConstructionRights();
break;
case WIDX_LAND_TOOL:
InputLandSize();
@ -323,9 +323,9 @@ public:
void OnUpdate() override
{
if (get_current_rotation() != _rotation)
if (GetCurrentRotation() != _rotation)
{
_rotation = get_current_rotation();
_rotation = GetCurrentRotation();
InitMap();
CentreMapOnViewPoint();
}
@ -405,22 +405,22 @@ public:
{
case WIDX_SET_LAND_RIGHTS:
Invalidate();
hide_gridlines();
hide_land_rights();
hide_construction_rights();
HideGridlines();
HideLandRights();
HideConstructionRights();
break;
case WIDX_BUILD_PARK_ENTRANCE:
ParkEntranceRemoveGhost();
Invalidate();
hide_gridlines();
hide_land_rights();
hide_construction_rights();
HideGridlines();
HideLandRights();
HideConstructionRights();
break;
case WIDX_PEOPLE_STARTING_POSITION:
Invalidate();
hide_gridlines();
hide_land_rights();
hide_construction_rights();
HideGridlines();
HideLandRights();
HideConstructionRights();
break;
}
}
@ -429,7 +429,7 @@ public:
{
MapInvalidateSelectionRect();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
auto mapCoords = screen_get_map_xy(screenCoords, nullptr);
auto mapCoords = ScreenGetMapXY(screenCoords, nullptr);
if (!mapCoords.has_value())
return;
@ -478,7 +478,7 @@ public:
}
}
}
parkEntranceMapPosition.direction = (gWindowSceneryRotation - get_current_rotation()) & 3;
parkEntranceMapPosition.direction = (gWindowSceneryRotation - GetCurrentRotation()) & 3;
return parkEntranceMapPosition;
}
@ -935,7 +935,7 @@ private:
if (mainWindow == nullptr || mainWindow->viewport == nullptr)
return;
auto offset = MiniMapOffsets[get_current_rotation()];
auto offset = MiniMapOffsets[GetCurrentRotation()];
// 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;
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;
switch (get_current_rotation())
switch (GetCurrentRotation())
{
case 0:
x = _currentLine * COORDS_XY_STEP;
@ -1251,7 +1251,7 @@ private:
if (mainViewport == nullptr)
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 rightBottom = ScreenCoordsXY{ ((mainViewport->viewPos.x + mainViewport->view_width) >> 5) + offset.x,
((mainViewport->viewPos.y + mainViewport->view_height) >> 4) + offset.y };
@ -1345,7 +1345,7 @@ private:
screenCoords.y = ((screenCoords.y + 8)) / 2;
auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY();
switch (get_current_rotation())
switch (GetCurrentRotation())
{
case 0:
return location;
@ -1364,7 +1364,7 @@ private:
{
int32_t x = c.x, y = c.y;
switch (get_current_rotation())
switch (GetCurrentRotation())
{
case 3:
std::swap(x, y);

View File

@ -101,13 +101,13 @@ public:
widgets = window_maze_construction_widgets;
WindowInitScrollWidgets(*this);
rideId = _currentRideIndex;
show_gridlines();
ShowGridlines();
}
void OnClose() override
{
ride_construction_invalidate_current_track();
viewport_set_visibility(0);
ViewportSetVisibility(0);
MapInvalidateMapSelectionTiles();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
@ -117,7 +117,7 @@ public:
// selection tool should be cancelled.
ToolCancel();
hide_gridlines();
HideGridlines();
auto currentRide = get_ride(_currentRideIndex);
if (currentRide != nullptr)
@ -155,7 +155,7 @@ public:
case WIDX_MAZE_DIRECTION_NE:
case WIDX_MAZE_DIRECTION_SE:
case WIDX_MAZE_DIRECTION_SW:
WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - get_current_rotation()) & 3);
WindowMazeConstructionConstruct(((widgetIndex - WIDX_MAZE_DIRECTION_NW) - GetCurrentRotation()) & 3);
break;
}
}

View File

@ -642,7 +642,7 @@ private:
if (viewport == nullptr)
{
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
viewport_create(
ViewportCreate(
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
viewportWidget->width() - 1, viewportWidget->height() - 1, focus.value());
flags |= WF_NO_SCROLLING;

View File

@ -189,7 +189,7 @@ public:
void OnToolAbort(WidgetIndex widgetIndex) override
{
hide_gridlines();
HideGridlines();
ClearPatrolAreaToRender();
GfxInvalidateScreen();
}
@ -246,7 +246,7 @@ private:
{
if (!ToolSet(*this, 0, Tool::WalkDown))
{
show_gridlines();
ShowGridlines();
input_set_flag(INPUT_FLAG_6, true);
SetPatrolAreaToRender(_staffId);
GfxInvalidateScreen();

View File

@ -292,9 +292,9 @@ void WindowPlayerOverviewUpdate(rct_window* w)
bool scroll = true;
// 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;
}
WindowPlayerUpdateViewport(w, scroll);
@ -521,7 +521,7 @@ static void WindowPlayerSetPage(rct_window* w, int32_t page)
if (w->viewport == nullptr)
{
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;
WindowEventInvalidateCall(w);
WindowPlayerUpdateViewport(w, false);

View File

@ -1584,7 +1584,7 @@ static void WindowRideInitViewport(rct_window* w)
int32_t width = view_widget.width() - 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->Invalidate();
@ -4248,7 +4248,7 @@ static int32_t WindowRideHasTrackColour(const Ride& ride, int32_t trackColour)
static void WindowRideSetTrackColourScheme(rct_window* w, const ScreenCoordsXY& screenPos)
{
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)
return;
@ -5514,7 +5514,7 @@ static void WindowRideMeasurementsTooldown(rct_window* w, WidgetIndex widgetInde
constexpr auto flags = EnumsToFlags(
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
ViewportInteractionItem::LargeScenery);
auto info = get_map_coordinates_from_pos(screenCoords, flags);
auto info = GetMapCoordinatesFromPos(screenCoords, flags);
switch (info.SpriteType)
{
case ViewportInteractionItem::Scenery:
@ -5539,7 +5539,7 @@ static void WindowRideMeasurementsTooldrag(rct_window* w, WidgetIndex widgetInde
auto flags = EnumsToFlags(
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
ViewportInteractionItem::LargeScenery);
auto info = get_map_coordinates_from_pos(screenCoords, flags);
auto info = GetMapCoordinatesFromPos(screenCoords, flags);
switch (info.SpriteType)
{
case ViewportInteractionItem::Scenery:

View File

@ -213,7 +213,7 @@ public:
InitScrollWidgets();
WindowPushOthersRight(*this);
show_gridlines();
ShowGridlines();
_currentTrackPrice = MONEY32_UNDEFINED;
_currentBrakeSpeed2 = 8;
@ -243,7 +243,7 @@ public:
void OnClose() override
{
ride_construction_invalidate_current_track();
viewport_set_visibility(0);
ViewportSetVisibility(0);
MapInvalidateMapSelectionTiles();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
@ -255,7 +255,7 @@ public:
if (classification == gCurrentToolWidget.window_classification && number == gCurrentToolWidget.window_number)
ToolCancel();
hide_gridlines();
HideGridlines();
// If we demolish a currentRide all windows will be closed including the construction window,
// the currentRide at this point is already gone.
@ -2275,14 +2275,14 @@ private:
const auto resultData = res.GetData<TrackPlaceActionResult>();
if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
viewport_set_visibility(1);
ViewportSetVisibility(1);
}
const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected)
&& TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected);
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;
mapCoords.z -= previewZOffset;
const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(get_current_rotation(), mapCoords);
const ScreenCoordsXY rotatedScreenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), mapCoords);
dpi->x += rotatedScreenCoords.x - widgetWidth / 2;
dpi->y += rotatedScreenCoords.y - widgetHeight / 2 - 16;
@ -2930,7 +2930,7 @@ static std::optional<CoordsXY> RideGetPlacePositionFromScreenPosition(ScreenCoor
{
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)
{
_trackPlaceCtrlZ = info.Element->GetBaseZ();
@ -3002,7 +3002,7 @@ static std::optional<CoordsXY> RideGetPlacePositionFromScreenPosition(ScreenCoor
else
{
auto mapZ = _trackPlaceCtrlZ;
auto mapXYCoords = screen_get_map_xy_with_z(screenCoords, mapZ);
auto mapXYCoords = ScreenGetMapXYWithZ(screenCoords, mapZ);
if (mapXYCoords.has_value())
{
mapCoords = mapXYCoords.value();

View File

@ -137,7 +137,7 @@ public:
InitScrollWidgets();
ContentUpdateScroll();
show_gridlines();
ShowGridlines();
gWindowSceneryRotation = 3;
gSceneryCtrlPressed = false;
gSceneryShiftPressed = false;
@ -167,8 +167,8 @@ public:
void OnClose() override
{
SceneryRemoveGhostToolPlacement();
hide_gridlines();
viewport_set_visibility(0);
HideGridlines();
ViewportSetVisibility(0);
if (gWindowSceneryScatterEnabled)
WindowCloseByClass(WindowClass::SceneryScatter);

View File

@ -131,7 +131,7 @@ public:
// Create viewport
Widget& viewportWidget = window_sign_widgets[WIDX_VIEWPORT];
viewport_create(
ViewportCreate(
this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1,
viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ }));
@ -303,7 +303,7 @@ public:
// Create viewport
Widget* viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
viewport_create(
ViewportCreate(
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1,
viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos }));
if (viewport != nullptr)

View File

@ -658,7 +658,7 @@ private:
gPickupPeepImage = ImageId();
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionItemAll);
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
if (info.SpriteType == ViewportInteractionItem::None)
return;
@ -1167,7 +1167,7 @@ private:
int32_t viewportWidth = viewWidget.width() - 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;
Invalidate();
}

View File

@ -141,7 +141,7 @@ public:
case WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON:
if (!ToolSet(*this, WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON, Tool::Crosshair))
{
show_gridlines();
ShowGridlines();
SetPatrolAreaToRender(GetSelectedStaffType());
GfxInvalidateScreen();
}
@ -470,7 +470,7 @@ public:
{
if (widgetIndex == WIDX_STAFF_LIST_SHOW_PATROL_AREA_BUTTON)
{
hide_gridlines();
HideGridlines();
ToolCancel();
ClearPatrolAreaToRender();
GfxInvalidateScreen();

View File

@ -579,7 +579,7 @@ public:
case WIDX_SURFACE_CHECK_CORNER_E:
case WIDX_SURFACE_CHECK_CORNER_S:
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;
case WIDX_SURFACE_CHECK_DIAGONAL:
@ -606,7 +606,7 @@ public:
// 0 = east/right, 1 = south/bottom, 2 = west/left, 3 = north/top
const int32_t eswn = (widgetIndex - WIDX_PATH_CHECK_EDGE_E) / 2;
// Transform to world orientation
const int32_t index = (eswn - get_current_rotation()) & 3;
const int32_t index = (eswn - GetCurrentRotation()) & 3;
PathToggleEdge(
windowTileInspectorSelectedIndex,
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
const int32_t neseswnw = (widgetIndex - WIDX_PATH_CHECK_EDGE_NE) / 2;
// Transform to world orientation
const int32_t index = (neseswnw - get_current_rotation()) & 3;
const int32_t index = (neseswnw - GetCurrentRotation()) & 3;
PathToggleEdge(windowTileInspectorSelectedIndex, index);
break;
}
@ -931,14 +931,14 @@ public:
bool mouseOnViewport = false;
if (InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z))
{
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionFlags);
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags);
clickedElement = info.Element;
mapCoords = info.Loc;
}
// Even if Ctrl was pressed, fall back to normal selection when there was nothing under the cursor
if (clickedElement == nullptr)
{
auto mouseCoords = screen_pos_to_map_pos(screenCoords, nullptr);
auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr);
if (mouseCoords.has_value())
{
mouseOnViewport = true;
@ -1729,7 +1729,7 @@ private:
TileElement* clickedElement = nullptr;
if (ctrlIsHeldDown)
{
auto info = get_map_coordinates_from_pos(screenCoords, ViewportInteractionFlags);
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionFlags);
clickedElement = info.Element;
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
if (clickedElement == nullptr)
{
auto mouseCoords = screen_pos_to_map_pos(screenCoords, nullptr);
auto mouseCoords = ScreenPosToMapPos(screenCoords, nullptr);
if (!mouseCoords.has_value())
return;
@ -1933,7 +1933,7 @@ private:
// 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");
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - get_current_rotation()) & 3);
_toolMap, TileModifyType::ScenerySetQuarterLocation, elementIndex, (quarterIndex - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
}
@ -1941,8 +1941,7 @@ private:
void ToggleQuadrantCollosion(int32_t elementIndex, const int32_t quadrantIndex)
{
auto modifyTile = TileModifyAction(
_toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex,
(quadrantIndex + 2 - get_current_rotation()) & 3);
_toolMap, TileModifyType::ScenerySetQuarterCollision, elementIndex, (quadrantIndex + 2 - GetCurrentRotation()) & 3);
GameActions::Execute(&modifyTile);
}
@ -1950,7 +1949,7 @@ private:
{
openrct2_assert(edgeIndex >= 0 && edgeIndex < 4, "edgeIndex out of range");
// Make edgeIndex abstract
edgeIndex = (edgeIndex - get_current_rotation()) & 3;
edgeIndex = (edgeIndex - GetCurrentRotation()) & 3;
auto modifyTile = TileModifyAction(_toolMap, TileModifyType::BannerToggleBlockingEdge, elementIndex, edgeIndex);
GameActions::Execute(&modifyTile);
}
@ -2104,16 +2103,16 @@ private:
widgets[WIDX_SURFACE_CHECK_DIAGONAL].bottom = widgets[WIDX_SURFACE_CHECK_DIAGONAL].top + 13;
SetCheckboxValue(
WIDX_SURFACE_CHECK_CORNER_N,
tileElement->AsSurface()->GetSlope() & (1 << ((2 - get_current_rotation()) & 3)));
tileElement->AsSurface()->GetSlope() & (1 << ((2 - GetCurrentRotation()) & 3)));
SetCheckboxValue(
WIDX_SURFACE_CHECK_CORNER_E,
tileElement->AsSurface()->GetSlope() & (1 << ((3 - get_current_rotation()) & 3)));
tileElement->AsSurface()->GetSlope() & (1 << ((3 - GetCurrentRotation()) & 3)));
SetCheckboxValue(
WIDX_SURFACE_CHECK_CORNER_S,
tileElement->AsSurface()->GetSlope() & (1 << ((0 - get_current_rotation()) & 3)));
tileElement->AsSurface()->GetSlope() & (1 << ((0 - GetCurrentRotation()) & 3)));
SetCheckboxValue(
WIDX_SURFACE_CHECK_CORNER_W,
tileElement->AsSurface()->GetSlope() & (1 << ((1 - get_current_rotation()) & 3)));
tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3)));
SetCheckboxValue(
WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT);
break;
@ -2148,21 +2147,21 @@ private:
SetCheckboxValue(WIDX_PATH_CHECK_SLOPED, tileElement->AsPath()->IsSloped());
SetCheckboxValue(WIDX_PATH_CHECK_BROKEN, tileElement->AsPath()->IsBroken());
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(
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(
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(
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(
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(
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(
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(
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;
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].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
bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - get_current_rotation()) & 3);
bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - get_current_rotation()) & 3);
bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - get_current_rotation()) & 3);
bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - get_current_rotation()) & 3);
bool N = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((0 - GetCurrentRotation()) & 3);
bool E = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((1 - GetCurrentRotation()) & 3);
bool S = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((2 - GetCurrentRotation()) & 3);
bool W = tileElement->AsSmallScenery()->GetSceneryQuadrant() == ((3 - GetCurrentRotation()) & 3);
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_N, N);
SetCheckboxValue(WIDX_SCENERY_CHECK_QUARTER_E, E);
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].bottom = widgets[WIDX_SCENERY_CHECK_COLLISION_W].top + 13;
auto occupiedQuadrants = tileElement->GetOccupiedQuadrants();
N = (occupiedQuadrants & (1 << ((2 - get_current_rotation()) & 3))) != 0;
E = (occupiedQuadrants & (1 << ((3 - get_current_rotation()) & 3))) != 0;
S = (occupiedQuadrants & (1 << ((0 - get_current_rotation()) & 3))) != 0;
W = (occupiedQuadrants & (1 << ((1 - get_current_rotation()) & 3))) != 0;
N = (occupiedQuadrants & (1 << ((2 - GetCurrentRotation()) & 3))) != 0;
E = (occupiedQuadrants & (1 << ((3 - GetCurrentRotation()) & 3))) != 0;
S = (occupiedQuadrants & (1 << ((0 - GetCurrentRotation()) & 3))) != 0;
W = (occupiedQuadrants & (1 << ((1 - GetCurrentRotation()) & 3))) != 0;
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_N, N);
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_E, E);
SetCheckboxValue(WIDX_SCENERY_CHECK_COLLISION_S, S);
@ -2320,16 +2319,16 @@ private:
widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1);
SetCheckboxValue(
WIDX_BANNER_CHECK_BLOCK_NE,
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - get_current_rotation()) & 3))));
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - GetCurrentRotation()) & 3))));
SetCheckboxValue(
WIDX_BANNER_CHECK_BLOCK_SE,
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - get_current_rotation()) & 3))));
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - GetCurrentRotation()) & 3))));
SetCheckboxValue(
WIDX_BANNER_CHECK_BLOCK_SW,
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - get_current_rotation()) & 3))));
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - GetCurrentRotation()) & 3))));
SetCheckboxValue(
WIDX_BANNER_CHECK_BLOCK_NW,
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - get_current_rotation()) & 3))));
(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - GetCurrentRotation()) & 3))));
break;
default:

View File

@ -419,9 +419,9 @@ static void WindowTopToolbarMouseup(rct_window* w, WidgetIndex widgetIndex)
OpenRCT2::Audio::ToggleAllSounds();
break;
case WIDX_CHAT:
if (chat_available())
if (ChatAvailable())
{
chat_toggle();
ChatToggle();
}
else
{
@ -602,7 +602,7 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int
gScreenshotCountdown = 10;
break;
case DDIDX_GIANT_SCREENSHOT:
screenshot_giant();
ScreenshotGiant();
break;
case DDIDX_FILE_BUG_ON_GITHUB:
{
@ -840,7 +840,7 @@ static void WindowTopToolbarInvalidate(rct_window* w)
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);
}
@ -1009,7 +1009,7 @@ static void RepaintSceneryToolDown(const ScreenCoordsXY& windowPos, WidgetIndex
auto flags = EnumsToFlags(
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
ViewportInteractionItem::Banner);
auto info = get_map_coordinates_from_pos(windowPos, flags);
auto info = GetMapCoordinatesFromPos(windowPos, flags);
switch (info.SpriteType)
{
case ViewportInteractionItem::Scenery:
@ -1086,7 +1086,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
auto flags = EnumsToFlags(
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
ViewportInteractionItem::Banner, ViewportInteractionItem::FootpathItem);
auto info = get_map_coordinates_from_pos(windowPos, flags);
auto info = GetMapCoordinatesFromPos(windowPos, flags);
switch (info.SpriteType)
{
case ViewportInteractionItem::Scenery:
@ -1099,7 +1099,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
WindowScenerySetSelectedItem(
{ SCENERY_TYPE_SMALL, entryIndex }, sceneryElement->GetPrimaryColour(),
sceneryElement->GetSecondaryColour(), std::nullopt,
sceneryElement->GetDirectionWithOffset(get_current_rotation()));
sceneryElement->GetDirectionWithOffset(GetCurrentRotation()));
}
break;
}
@ -1124,7 +1124,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
WindowScenerySetSelectedItem(
{ SCENERY_TYPE_LARGE, entryIndex }, info.Element->AsLargeScenery()->GetPrimaryColour(),
info.Element->AsLargeScenery()->GetSecondaryColour(), std::nullopt,
(get_current_rotation() + info.Element->GetDirection()) & 3);
(GetCurrentRotation() + info.Element->GetDirection()) & 3);
}
break;
}
@ -1175,7 +1175,7 @@ static void Sub6E1F34UpdateScreenCoordsAndButtonsPressed(bool canRaiseItem, Scre
constexpr auto flags = EnumsToFlags(
ViewportInteractionItem::Terrain, ViewportInteractionItem::Ride, ViewportInteractionItem::Scenery,
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)
{
@ -1269,7 +1269,7 @@ static void Sub6E1F34SmallScenery(
// If CTRL not pressed
if (!gSceneryCtrlPressed)
{
auto gridCoords = screen_get_map_xy_quadrant(screenPos, &quadrant);
auto gridCoords = ScreenGetMapXYQuadrant(screenPos, &quadrant);
if (!gridCoords.has_value())
{
gridPos.SetNull();
@ -1302,7 +1302,7 @@ static void Sub6E1F34SmallScenery(
{
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())
{
gridPos.SetNull();
@ -1331,7 +1331,7 @@ static void Sub6E1F34SmallScenery(
rotation = util_rand() & 0xFF;
}
rotation -= get_current_rotation();
rotation -= GetCurrentRotation();
rotation &= 0x3;
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
@ -1350,7 +1350,7 @@ static void Sub6E1F34SmallScenery(
{
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;
if (info.SpriteType == ViewportInteractionItem::None)
@ -1384,7 +1384,7 @@ static void Sub6E1F34SmallScenery(
else
{
int16_t z = gSceneryCtrlPressZ;
auto coords = screen_get_map_xy_with_z(screenPos, z);
auto coords = ScreenGetMapXYWithZ(screenPos, z);
if (coords.has_value())
{
gridPos = *coords;
@ -1415,7 +1415,7 @@ static void Sub6E1F34SmallScenery(
rotation = util_rand() & 0xFF;
}
rotation -= get_current_rotation();
rotation -= GetCurrentRotation();
rotation &= 0x3;
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
@ -1443,7 +1443,7 @@ static void Sub6E1F34PathItem(
// Path bits
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;
if (info.SpriteType == ViewportInteractionItem::None)
@ -1487,7 +1487,7 @@ static void Sub6E1F34Wall(
// If CTRL not pressed
if (!gSceneryCtrlPressed)
{
auto gridCoords = screen_get_map_xy_side(screenPos, &edge);
auto gridCoords = ScreenGetMapXYSide(screenPos, &edge);
if (!gridCoords.has_value())
{
gridPos.SetNull();
@ -1519,7 +1519,7 @@ static void Sub6E1F34Wall(
else
{
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())
{
gridPos.SetNull();
@ -1610,7 +1610,7 @@ static void Sub6E1F34LargeScenery(
else
{
int16_t z = gSceneryCtrlPressZ;
auto coords = screen_get_map_xy_with_z(screenPos, z);
auto coords = ScreenGetMapXYWithZ(screenPos, z);
if (coords.has_value())
{
gridPos = *coords;
@ -1637,7 +1637,7 @@ static void Sub6E1F34LargeScenery(
gridPos = gridPos.ToTileStart();
Direction rotation = gWindowSceneryRotation;
rotation -= get_current_rotation();
rotation -= GetCurrentRotation();
rotation &= 0x3;
if (gConfigGeneral.VirtualFloorStyle != VirtualFloorStyles::Off)
@ -1665,7 +1665,7 @@ static void Sub6E1F34Banner(
// Banner
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;
if (info.SpriteType == ViewportInteractionItem::None)
@ -1675,7 +1675,7 @@ static void Sub6E1F34Banner(
}
uint8_t rotation = gWindowSceneryRotation;
rotation -= get_current_rotation();
rotation -= GetCurrentRotation();
rotation &= 0x3;
auto z = info.Element->GetBaseZ();
@ -2005,7 +2005,7 @@ static uint8_t TopToolbarToolUpdateLandPaint(const ScreenCoordsXY& screenPos)
MapInvalidateSelectionRect();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
auto mapTile = screen_get_map_xy(screenPos, nullptr);
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
if (!mapTile.has_value())
{
@ -2123,8 +2123,8 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos)
{
int32_t selectionType;
// Get selection type and map coordinates from mouse x,y position
screen_pos_to_map_pos(screenPos, &selectionType);
mapTile = screen_get_map_xy_side(screenPos, &side);
ScreenPosToMapPos(screenPos, &selectionType);
mapTile = ScreenGetMapXYSide(screenPos, &side);
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
mapTile = screen_get_map_xy_side(screenPos, &side);
mapTile = ScreenGetMapXYSide(screenPos, &side);
if (!mapTile.has_value())
{
@ -2360,7 +2360,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos)
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
auto info = get_map_coordinates_from_pos(
auto info = GetMapCoordinatesFromPos(
screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
if (info.SpriteType == ViewportInteractionItem::None)
@ -2480,12 +2480,12 @@ static money64 TryPlaceGhostSmallScenery(
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
// Set underground on
viewport_set_visibility(4);
ViewportSetVisibility(4);
}
else
{
// Set underground off
viewport_set_visibility(5);
ViewportSetVisibility(5);
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
@ -2561,12 +2561,12 @@ static money64 TryPlaceGhostLargeScenery(
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
{
// Set underground on
viewport_set_visibility(4);
ViewportSetVisibility(4);
}
else
{
// Set underground off
viewport_set_visibility(5);
ViewportSetVisibility(5);
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
@ -3262,7 +3262,7 @@ static void WindowTopToolbarToolAbort(rct_window* w, WidgetIndex widgetIndex)
case WIDX_LAND:
case WIDX_WATER:
case WIDX_CLEAR_SCENERY:
hide_gridlines();
HideGridlines();
break;
#ifdef ENABLE_SCRIPTING
default:
@ -3809,7 +3809,7 @@ static void ToggleLandWindow(rct_window* topToolbar, WidgetIndex widgetIndex)
else
{
_landToolBlocked = false;
show_gridlines();
ShowGridlines();
ToolSet(*topToolbar, widgetIndex, Tool::DigDown);
input_set_flag(INPUT_FLAG_6, true);
ContextOpenWindow(WindowClass::Land);
@ -3829,7 +3829,7 @@ static void ToggleClearSceneryWindow(rct_window* topToolbar, WidgetIndex widgetI
}
else
{
show_gridlines();
ShowGridlines();
ToolSet(*topToolbar, widgetIndex, Tool::Crosshair);
input_set_flag(INPUT_FLAG_6, true);
ContextOpenWindow(WindowClass::ClearScenery);
@ -3850,7 +3850,7 @@ static void ToggleWaterWindow(rct_window* topToolbar, WidgetIndex widgetIndex)
else
{
_landToolBlocked = false;
show_gridlines();
ShowGridlines();
ToolSet(*topToolbar, widgetIndex, Tool::WaterDown);
input_set_flag(INPUT_FLAG_6, true);
ContextOpenWindow(WindowClass::Water);

View File

@ -82,21 +82,21 @@ public:
ToolSet(*this, WIDX_PRICE, Tool::Crosshair);
input_set_flag(INPUT_FLAG_6, true);
WindowPushOthersRight(*this);
show_gridlines();
ShowGridlines();
_miniPreview.resize(TRACK_MINI_PREVIEW_SIZE);
_placementCost = MONEY32_UNDEFINED;
_placementLoc.SetNull();
_currentTrackPieceDirection = (2 - get_current_rotation()) & 3;
_currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3;
}
void OnClose() override
{
ClearProvisional();
viewport_set_visibility(0);
ViewportSetVisibility(0);
MapInvalidateMapSelectionTiles();
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
hide_gridlines();
HideGridlines();
_miniPreview.clear();
_miniPreview.shrink_to_fit();
_trackDesign = nullptr;
@ -430,7 +430,7 @@ private:
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;
uint8_t curTrackRotation = rotation;
@ -537,7 +537,7 @@ private:
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)
{
auto rotatedMazeCoords = origin + TileCoordsXY{ mazeElement.x, mazeElement.y }.ToCoordsXY().Rotate(rotation);

View File

@ -199,7 +199,7 @@ public:
}
int32_t direction;
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
if (mapCoords.has_value())
{
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE;
@ -213,7 +213,7 @@ public:
void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
{
int32_t direction;
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
if (mapCoords.has_value())
{
_dragging = true;
@ -229,7 +229,7 @@ public:
}
int32_t direction;
auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction);
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
if (mapCoords)
{
MapInvalidateSelectionRect();

View File

@ -76,7 +76,7 @@ public:
widgets = window_viewport_widgets;
// 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)
{
Close();
@ -142,7 +142,7 @@ public:
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
{
auto info = get_map_coordinates_from_pos(
auto info = GetMapCoordinatesFromPos(
{ windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll);
WindowScrollToLocation(*mainWindow, { info.Loc, TileElementHeight(info.Loc) });
}

View File

@ -461,7 +461,7 @@ namespace OpenRCT2
gGameSoundsOff = !gConfigSound.MasterSoundEnabled;
}
chat_init();
ChatInit();
CopyOriginalUserFilesOver();
if (!gOpenRCT2NoGraphics)
@ -474,7 +474,7 @@ namespace OpenRCT2
}
input_reset_place_obj_modifier();
viewport_init_all();
ViewportInitAll();
_gameState = std::make_unique<GameState>();
_gameState->InitAll(DEFAULT_MAP_SIZE);
@ -1205,7 +1205,7 @@ namespace OpenRCT2
}
#endif
chat_update();
ChatUpdate();
#ifdef ENABLE_SCRIPTING
_scriptEngine.Tick();
#endif

View File

@ -110,7 +110,7 @@ namespace Editor
gEditorStep = EditorStep::ObjectSelection;
gParkFlags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
ViewportInitAll();
rct_window* mainWindow = OpenEditorWindows();
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@ -148,7 +148,7 @@ namespace Editor
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
gEditorStep = EditorStep::ObjectiveSelection;
gScenarioCategory = SCENARIO_CATEGORY_OTHER;
viewport_init_all();
ViewportInitAll();
OpenEditorWindows();
FinaliseMainView();
gScreenAge = 0;
@ -169,7 +169,7 @@ namespace Editor
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
SetAllLandOwned();
gEditorStep = EditorStep::ObjectSelection;
viewport_init_all();
ViewportInitAll();
rct_window* mainWindow = OpenEditorWindows();
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@ -190,7 +190,7 @@ namespace Editor
OpenRCT2::GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
SetAllLandOwned();
gEditorStep = EditorStep::ObjectSelection;
viewport_init_all();
ViewportInitAll();
rct_window* mainWindow = OpenEditorWindows();
mainWindow->SetLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
LoadPalette();
@ -245,7 +245,7 @@ namespace Editor
gEditorStep = EditorStep::LandscapeEditor;
gScreenAge = 0;
gScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR;
viewport_init_all();
ViewportInitAll();
OpenEditorWindows();
FinaliseMainView();
}

View File

@ -466,7 +466,7 @@ void game_load_init()
OpenRCT2::Audio::StopAll();
if (!gLoadKeepWindowsOpen)
{
viewport_init_all();
ViewportInitAll();
game_create_windows();
}
else
@ -848,7 +848,7 @@ bool stop_silent_record()
void PrepareMapForSave()
{
viewport_set_saved_view();
ViewportSetSavedView();
#ifdef ENABLE_SCRIPTING
auto& scriptEngine = GetContext()->GetScriptEngine();

View File

@ -111,7 +111,7 @@ void GameState::Tick()
uint32_t numUpdates = 1;
// 0x006E3AEC // screen_game_process_mouse_input();
screenshot_check();
ScreenshotCheck();
game_handle_keyboard_input();
if (game_is_not_paused() && gPreviewingTitleSequenceInGame)
@ -363,7 +363,7 @@ void GameState::UpdateLogic(LogicTimings* timings)
editor_open_windows_for_current_step();
// Update windows
// window_dispatch_update_all();
// WindowDispatchUpdateAll();
// Start autosave timer after update
if (gLastAutoSaveUpdate == AUTOSAVE_PAUSE)

View File

@ -173,7 +173,7 @@ namespace OpenRCT2::Audio
volumeDown = 10;
}
uint8_t rotation = get_current_rotation();
uint8_t rotation = GetCurrentRotation();
auto pos2 = Translate3DTo2DWithZ(rotation, location);
rct_viewport* viewport = nullptr;

View File

@ -21,7 +21,7 @@ static exitcode_t HandleBenchGfx(CommandLineArgEnumerator* argEnumerator)
{
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + 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)
{
return EXITCODE_FAIL;

View File

@ -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));
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);
drawing_engine_dispose();
@ -131,7 +131,7 @@ static std::vector<RecordedPaintSession> extract_paint_session(std::string_view
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)
{
auto sessions = inputSessions;

View File

@ -43,7 +43,7 @@ static exitcode_t HandleScreenshot(CommandLineArgEnumerator* argEnumerator)
{
const char** argv = const_cast<const char**>(argEnumerator->GetArguments()) + 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)
{
return EXITCODE_FAIL;

View File

@ -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
// of the foreground colour for font hinting.
*dst = blendColours(colour, PALETTE_INDEX_0);
*dst = BlendColours(colour, PALETTE_INDEX_0);
}
else
{
*dst = blendColours(colour, *dst);
*dst = BlendColours(colour, *dst);
}
}
}

View File

@ -297,7 +297,7 @@ void lightfx_prepare_light_list()
auto* w = WindowGetMain();
if (w != nullptr)
{
// based on get_map_coordinates_from_pos_window
// based on GetMapCoordinatesFromPosWindow
rct_drawpixelinfo dpi;
dpi.x = entry->ViewCoords.x + offsetPattern[0 + 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);
PaintSessionGenerate(*session);
PaintSessionArrange(*session);
auto info = set_interaction_info_from_paint_session(
session, w->viewport->flags, ViewportInteractionItemAll);
auto info = SetInteractionInfoFromPaintSession(session, w->viewport->flags, ViewportInteractionItemAll);
PaintSessionFree(session);
// log_warning("[%i, %i]", dpi->x, dpi->y);
@ -438,7 +437,7 @@ void lightfx_update_viewport_settings()
rct_viewport* viewport = WindowGetViewport(mainWindow);
_current_view_x_back = viewport->viewPos.x;
_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;
}
}
@ -647,7 +646,7 @@ static void LightfxAdd3DLight(
continue;
entry->Position = loc;
entry->ViewCoords = Translate3DTo2DWithZ(get_current_rotation(), loc);
entry->ViewCoords = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
entry->Type = lightType;
entry->LightIntensity = 0xFF;
entry->LightHash = lightHash;
@ -661,7 +660,7 @@ static void LightfxAdd3DLight(
LightListEntry* entry = &_LightListBack[LightListCurrentCountBack++];
entry->Position = loc;
entry->ViewCoords = Translate3DTo2DWithZ(get_current_rotation(), loc);
entry->ViewCoords = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
entry->Type = lightType;
entry->LightIntensity = 0xFF;
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)
{
uint8_t relativeRotation = (4 - get_current_rotation()) % 4;
uint8_t relativeRotation = (4 - GetCurrentRotation()) % 4;
CoordsXY lanternOffset1 = CoordsXY(0, 16).Rotate(relativeRotation);
CoordsXY lanternOffset2 = CoordsXY(16, 0).Rotate(relativeRotation);
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)
{
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 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, 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 spotOffset2 = CoordsXY(-32, -4).Rotate(direction);

View File

@ -275,7 +275,7 @@ void FASTCALL GfxDrawSpriteSolid(rct_drawpixelinfo* dpi, const ImageId image, co
}
}
std::string screenshot_dump()
std::string ScreenshotDump()
{
auto drawingEngine = GetDrawingEngine();
if (drawingEngine != nullptr)

View File

@ -1619,7 +1619,7 @@ static void scrolling_text_set_bitmap_for_ttf(
else if (use_hinting && src_pixel > fontDesc->hinting_threshold)
{
// Simulate font hinting by shading the background colour instead.
*dst = blendColours(colour, *dst);
*dst = BlendColours(colour, *dst);
}
// Jump to next row

View File

@ -259,7 +259,7 @@ void X8DrawingEngine::CopyRect(int32_t x, int32_t y, int32_t width, int32_t heig
std::string X8DrawingEngine::Screenshot()
{
return screenshot_dump_png(&_bitsDPI);
return ScreenshotDumpPNG(&_bitsDPI);
}
IDrawingContext* X8DrawingEngine::GetDrawingContext()

View File

@ -64,7 +64,7 @@ void EntityBase::Invalidate()
break;
}
viewports_invalidate(SpriteRect, maxZoom);
ViewportsInvalidate(SpriteRect, maxZoom);
}
void EntityBase::Serialise(DataSerialiser& stream)

View File

@ -476,7 +476,7 @@ void EntityBase::MoveTo(const CoordsXYZ& newLocation)
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
{
auto screenCoords = Translate3DTo2DWithZ(get_current_rotation(), entityPos);
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
entity->SpriteRect = ScreenRect(
screenCoords - ScreenCoordsXY{ entity->sprite_width, entity->sprite_height_negative },

View File

@ -88,7 +88,7 @@ void MoneyEffect::Create(money64 value, const CoordsXYZ& loc)
return;
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);
if (!mapPositionXY.has_value())
return;
@ -126,8 +126,8 @@ void MoneyEffect::Update()
{
newZ += 1;
}
newY += _moneyEffectMoveOffset[get_current_rotation()].y;
newX += _moneyEffectMoveOffset[get_current_rotation()].x;
newY += _moneyEffectMoveOffset[GetCurrentRotation()].y;
newX += _moneyEffectMoveOffset[GetCurrentRotation()].x;
MoveTo({ newX, newY, newZ });

View File

@ -40,59 +40,59 @@ static int32_t _chatWidth;
static int32_t _chatHeight;
static TextInputSession* _chatTextInputSession;
static const char* chat_history_get(uint32_t index);
static uint32_t chat_history_get_time(uint32_t index);
static void chat_clear_input();
static int32_t chat_history_draw_string(
static const char* ChatGetHistory(uint32_t index);
static uint32_t ChatHistoryGetTime(uint32_t index);
static void ChatClearInput();
static int32_t ChatHistoryDrawString(
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
&& network_get_authstatus() == NetworkAuth::Ok;
}
void chat_open()
void ChatOpen()
{
gChatOpen = true;
_chatTextInputSession = ContextStartTextInput(_chatCurrentLine, sizeof(_chatCurrentLine));
}
void chat_close()
void ChatClose()
{
gChatOpen = false;
ContextStopTextInput();
}
void chat_toggle()
void ChatToggle()
{
if (gChatOpen)
{
chat_close();
ChatClose();
}
else
{
chat_open();
ChatOpen();
}
}
void chat_init()
void ChatInit()
{
std::memset(_chatHistory, 0x00, sizeof(_chatHistory));
std::memset(_chatHistoryTime, 0x00, sizeof(_chatHistoryTime));
}
void chat_update()
void ChatUpdate()
{
// Flash the caret
_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;
if (!chat_available())
if (!ChatAvailable())
{
gChatOpen = false;
return;
@ -110,19 +110,19 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
// Draw chat window
if (gChatOpen)
{
inputLineHeight = chat_string_wrapped_get_height(static_cast<void*>(&inputLine), _chatWidth - 10);
inputLineHeight = ChatStringWrappedGetHeight(static_cast<void*>(&inputLine), _chatWidth - 10);
_chatTop -= inputLineHeight;
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++)
{
if (chat_history_get(i)[0] == '\0')
if (ChatGetHistory(i)[0] == '\0')
{
continue;
}
lineBuffer.assign(chat_history_get(i));
lineBuffer.assign(ChatGetHistory(i));
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);
}
@ -164,15 +164,15 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
// Draw chat history
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)
{
break;
}
lineBuffer.assign(chat_history_get(i));
lineBuffer.assign(ChatGetHistory(i));
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(
{ { 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
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);
}
void chat_input(ChatInput input)
void ChatInput(enum ChatInput input)
{
switch (input)
{
@ -243,35 +243,35 @@ void chat_input(ChatInput input)
{
network_send_chat(_chatCurrentLine);
}
chat_clear_input();
chat_close();
ChatClearInput();
ChatClose();
break;
case ChatInput::Close:
chat_close();
ChatClose();
break;
default:
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];
}
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];
}
static void chat_clear_input()
static void ChatClearInput()
{
_chatCurrentLine[0] = 0;
}
// This method is the same as gfx_draw_string_left_wrapped.
// 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)
{
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.
// 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];
auto bufferPtr = buffer;

View File

@ -30,16 +30,16 @@ enum class ChatInput : uint8_t
extern bool gChatOpen;
bool chat_available();
void chat_open();
void chat_close();
void chat_toggle();
bool ChatAvailable();
void ChatOpen();
void ChatClose();
void ChatToggle();
void chat_init();
void chat_update();
void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColour);
void ChatInit();
void ChatUpdate();
void ChatDraw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColour);
void chat_history_add(std::string_view s);
void chat_input(ChatInput input);
void ChatAddHistory(std::string_view s);
void ChatInput(ChatInput input);
int32_t chat_string_wrapped_get_height(void* args, int32_t width);
int32_t ChatStringWrappedGetHeight(void* args, int32_t width);

View File

@ -34,7 +34,7 @@ enum
INDEX_COLOUR_11 = 254,
};
void colours_init_maps()
void ColoursInitMaps()
{
// Get colour maps from g1
for (int32_t i = 0; i < COLOUR_COUNT; i++)
@ -106,7 +106,7 @@ namespace Colour
#ifndef NO_TTF
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;
int32_t closestDistance = INT32_MAX;
@ -126,7 +126,7 @@ static uint8_t findClosestPaletteIndex(uint8_t red, uint8_t green, uint8_t blue)
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 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 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];
}
#endif

View File

@ -211,7 +211,7 @@ struct rct_colour_map
extern rct_colour_map ColourMapA[COLOUR_COUNT];
void colours_init_maps();
void ColoursInitMaps();
namespace Colour
{
@ -219,5 +219,5 @@ namespace Colour
}
#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

View File

@ -83,15 +83,15 @@ static constexpr const char* ClimateNames[] = {
"cold",
};
static int32_t console_parse_int(const std::string& src, bool* valid);
static double console_parse_double(const std::string& src, bool* valid);
static int32_t ConsoleParseInt(const std::string& src, bool* valid);
static double ConsoleParseDouble(const std::string& src, bool* valid);
static void console_write_all_commands(InteractiveConsole& console);
static int32_t cc_variables(InteractiveConsole& console, const arguments_t& argv);
static int32_t cc_windows(InteractiveConsole& console, const arguments_t& argv);
static int32_t cc_help(InteractiveConsole& console, const arguments_t& argv);
static void ConsoleWriteAllCommands(InteractiveConsole& console);
static int32_t ConsoleCommandVariables(InteractiveConsole& console, const arguments_t& argv);
static int32_t ConsoleCommandWindows(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) \
{ \
@ -101,7 +101,7 @@ static bool invalidArguments(bool* invalid, bool arguments);
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;
int32_t value;
@ -110,7 +110,7 @@ static int32_t console_parse_int(const std::string& src, bool* valid)
return value;
}
static double console_parse_double(const std::string& src, bool* valid)
static double ConsoleParseDouble(const std::string& src, bool* valid)
{
utf8* end;
double value;
@ -119,32 +119,32 @@ static double console_parse_double(const std::string& src, bool* valid)
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();
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();
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();
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())
console.WriteLine(argv[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())
{
@ -188,8 +188,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
if (argv[1] == "type")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
int32_t type = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
int32_t type = ConsoleParseInt(argv[3], &int_valid[1]);
if (!int_valid[0] || !int_valid[1])
{
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")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
int32_t mode = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
int32_t mode = ConsoleParseInt(argv[3], &int_valid[1]);
if (!int_valid[0] || !int_valid[1])
{
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")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
int32_t mass = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
int32_t mass = ConsoleParseInt(argv[3], &int_valid[1]);
if (ride_index < 0)
{
@ -287,8 +287,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
else if (argv[1] == "excitement")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
ride_rating excitement = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
ride_rating excitement = ConsoleParseInt(argv[3], &int_valid[1]);
if (ride_index < 0)
{
@ -320,8 +320,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
else if (argv[1] == "intensity")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
ride_rating intensity = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
ride_rating intensity = ConsoleParseInt(argv[3], &int_valid[1]);
if (ride_index < 0)
{
@ -353,8 +353,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
else if (argv[1] == "nausea")
{
bool int_valid[2] = { false };
int32_t ride_index = console_parse_int(argv[2], &int_valid[0]);
ride_rating nausea = console_parse_int(argv[3], &int_valid[1]);
int32_t ride_index = ConsoleParseInt(argv[2], &int_valid[0]);
ride_rating nausea = ConsoleParseInt(argv[3], &int_valid[1]);
if (ride_index < 0)
{
@ -388,7 +388,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
bool int_valid[2] = { false };
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)
{
auto price = arg1;
@ -408,7 +408,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
else
{
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])
{
@ -429,8 +429,8 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
}
else
{
int32_t rideId = console_parse_int(argv[2], &int_valid[0]);
money16 price = console_parse_int(argv[3], &int_valid[1]);
int32_t rideId = ConsoleParseInt(argv[2], &int_valid[0]);
money16 price = ConsoleParseInt(argv[3], &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;
}
static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
static int32_t ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& argv)
{
if (!argv.empty())
{
@ -487,8 +487,8 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
{
int32_t int_val[3];
bool int_valid[3] = { false };
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
int_val[1] = ConsoleParseInt(argv[3], &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];
bool int_valid[2] = { false };
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
int_val[0] = ConsoleParseInt(argv[2], &int_valid[0]);
int_val[1] = ConsoleParseInt(argv[3], &int_valid[1]);
if (!int_valid[0])
{
console.WriteLineError("Invalid staff ID");
@ -541,7 +541,7 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
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())
{
@ -677,7 +677,7 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
if (w != nullptr)
{
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));
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")
{
console.WriteFormatLine("current_rotation %d", get_current_rotation());
console.WriteFormatLine("current_rotation %d", GetCurrentRotation());
}
else if (argv[0] == "host_timescale")
{
@ -733,7 +733,7 @@ static int32_t cc_get(InteractiveConsole& console, const arguments_t& argv)
}
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)
{
@ -747,8 +747,8 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
{
if (i + 1 < argv.size())
{
int_val[i] = console_parse_int(argv[i + 1], &int_valid[i]);
double_val[i] = console_parse_double(argv[i + 1], &double_valid[i]);
int_val[i] = ConsoleParseInt(argv[i + 1], &int_valid[i]);
double_val[i] = ConsoleParseDouble(argv[i + 1], &double_valid[i]);
}
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]);
if (gCash != money)
@ -778,7 +778,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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(
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);
}
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(
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);
}
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(
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);
}
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(
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);
}
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(
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);
}
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(
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);
}
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(
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);
}
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]);
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);
}
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]);
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);
}
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]);
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);
}
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]);
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);
}
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]);
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);
}
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]);
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);
}
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]);
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);
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);
}
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]);
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);
}
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(
ScenarioSetSetting::GuestGenerationHigherDifficultyLevel, int_val[0]);
@ -969,7 +969,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
});
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);
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);
}
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(
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);
}
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(
ScenarioSetSetting::CostToBuyConstructionRights,
@ -1039,18 +1039,18 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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);
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);
ConfigSaveDefault();
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();
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();
location.z = TileElementHeight(location);
w->SetLocation(location);
viewport_update_position(w);
ViewportUpdatePosition(w);
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]));
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();
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]);
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);
ConfigSaveDefault();
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);
ConfigSaveDefault();
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))
{
@ -1107,7 +1107,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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))
{
@ -1125,7 +1125,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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))
{
@ -1143,9 +1143,9 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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();
int32_t newRotation = int_val[0];
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");
}
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]);
@ -1167,7 +1167,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
console.Execute("get host_timescale");
}
#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);
ConfigSaveDefault();
@ -1193,7 +1193,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv)
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())
{
@ -1293,7 +1293,7 @@ constexpr std::array _objectTypeNames = {
};
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)
{
@ -1313,13 +1313,13 @@ static int32_t cc_object_count(InteractiveConsole& console, [[maybe_unused]] con
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())
{
bool title = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0;
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)
{
@ -1332,7 +1332,7 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
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)
{
@ -1343,11 +1343,11 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
ContextOpenWindow(WindowClass::EditorInventionList);
}
}
else if (argv[0] == "scenario_options" && invalidArguments(&invalidTitle, !title))
else if (argv[0] == "scenario_options" && InvalidArguments(&invalidTitle, !title))
{
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)
{
@ -1378,21 +1378,21 @@ static int32_t cc_open(InteractiveConsole& console, const arguments_t& argv)
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();
console.WriteFormatLine("%d unused object entries have been removed.", result);
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();
console.WriteFormatLine("Removed %d flying objects", result);
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;
TileElementIteratorBegin(&it);
@ -1411,7 +1411,7 @@ static int32_t cc_remove_park_fences(InteractiveConsole& console, [[maybe_unused
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 tileElementCount = tileElements.size();
@ -1433,7 +1433,7 @@ static int32_t cc_show_limits(InteractiveConsole& console, [[maybe_unused]] cons
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 month = 0;
@ -1490,7 +1490,7 @@ static int32_t cc_for_date([[maybe_unused]] InteractiveConsole& console, [[maybe
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)
{
@ -1526,7 +1526,7 @@ static int32_t cc_load_park([[maybe_unused]] InteractiveConsole& console, [[mayb
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)
{
@ -1539,7 +1539,7 @@ static int32_t cc_save_park([[maybe_unused]] InteractiveConsole& console, [[mayb
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
|| network_get_authstatus() != NetworkAuth::Ok)
@ -1558,7 +1558,7 @@ static int32_t cc_say(InteractiveConsole& console, const arguments_t& argv)
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)
{
@ -1605,7 +1605,7 @@ static int32_t cc_replay_startrecord(InteractiveConsole& console, const argument
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)
{
@ -1640,7 +1640,7 @@ static int32_t cc_replay_stoprecord(InteractiveConsole& console, const arguments
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)
{
@ -1682,7 +1682,7 @@ static int32_t cc_replay_start(InteractiveConsole& console, const arguments_t& a
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)
{
@ -1700,7 +1700,7 @@ static int32_t cc_replay_stop(InteractiveConsole& console, const arguments_t& ar
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)
{
@ -1735,7 +1735,7 @@ static int32_t cc_replay_normalise(InteractiveConsole& console, const arguments_
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;
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(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();
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 ignored "-Wnull-dereference"
@ -1806,14 +1806,14 @@ static int32_t cc_dereference([[maybe_unused]] InteractiveConsole& console, [[ma
#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();
return 0;
}
#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())
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;
}
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)
{
@ -1871,12 +1871,14 @@ static int32_t cc_add_news_item([[maybe_unused]] InteractiveConsole& console, [[
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();
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())
console.WriteLine("Started profiler");
@ -1884,7 +1886,8 @@ static int32_t cc_profiler_start([[maybe_unused]] InteractiveConsole& console, [
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)
{
@ -1903,7 +1906,8 @@ static int32_t cc_profiler_exportcsv([[maybe_unused]] InteractiveConsole& consol
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())
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.
if (argv.size() >= 1)
{
return cc_profiler_exportcsv(console, argv);
return ConsoleCommandProfilerExportCSV(console, argv);
}
return 0;
@ -1979,56 +1983,59 @@ static constexpr const utf8* console_window_table[] = {
// clang-format on
static constexpr const console_command console_command_table[] = {
{ "abort", cc_abort, "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>]" },
{ "assert", cc_assert, "Triggers assertion failure, for testing purposes only", "assert" },
{ "clear", cc_clear, "Clears the console.", "clear" },
{ "close", cc_close, "Closes the console.", "close" },
{ "date", cc_for_date, "Sets the date to a given date.", "Format <year>[ <month>[ <day>]]." },
{ "dereference", cc_dereference, "Dereferences a nullptr, for testing purposes only", "dereference" },
{ "echo", cc_echo, "Echoes the text to the console.", "echo <text>" },
{ "exit", cc_close, "Closes the console.", "exit" },
{ "get", cc_get, "Gets the value of the specified variable.", "get <variable>" },
{ "help", cc_help, "Lists commands or info about a command.", "help [command]" },
{ "hide", cc_hide, "Hides the console.", "hide" },
{ "load_object", cc_load_object,
{ "abort", ConsoleCommandAbort, "Calls std::abort(), for testing purposes only.", "abort" },
{ "add_news_item", ConsoleCommandAddNewsItem, "Inserts a news item", "add_news_item [<type> <message> <assoc>]" },
{ "assert", ConsoleCommandAssert, "Triggers assertion failure, for testing purposes only", "assert" },
{ "clear", ConsoleCommandClear, "Clears the console.", "clear" },
{ "close", ConsoleCommandClose, "Closes the console.", "close" },
{ "date", ConsoleCommandForceDate, "Sets the date to a given date.", "Format <year>[ <month>[ <day>]]." },
{ "dereference", ConsoleCommandDereference, "Dereferences a nullptr, for testing purposes only", "dereference" },
{ "echo", ConsoleCommandEcho, "Echoes the text to the console.", "echo <text>" },
{ "exit", ConsoleCommandClose, "Closes the console.", "exit" },
{ "get", ConsoleCommandGet, "Gets the value of the specified variable.", "get <variable>" },
{ "help", ConsoleCommandHelp, "Lists commands or info about a command.", "help [command]" },
{ "hide", ConsoleCommandHide, "Hides the console.", "hide" },
{ "load_object", ConsoleCommandLoadObject,
"Loads the object file into the scenario.\n"
"Loading a scenery group will not load its associated objects.\n"
"This is a safer method opposed to \"open object_selection\".",
"load_object <objectfilenodat>" },
{ "load_park", cc_load_park, "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" },
{ "open", cc_open, "Opens the window with the give name.", "open <window>." },
{ "quit", cc_close, "Closes the console.", "quit" },
{ "remove_park_fences", cc_remove_park_fences, "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.",
{ "load_park", ConsoleCommandLoadPark, "Load park from save directory or by absolute path", "load_park <filename>" },
{ "object_count", ConsoleCommandCountObjects, "Shows the number of objects of each type in the scenario.", "object_count" },
{ "open", ConsoleCommandOpen, "Opens the window with the give name.", "open <window>." },
{ "quit", ConsoleCommandClose, "Closes the console.", "quit" },
{ "remove_park_fences", ConsoleCommandRemoveParkFences, "Removes all park fences from the surface", "remove_park_fences" },
{ "remove_unused_objects", ConsoleCommandRemoveUnusedObjects, "Removes all the unused objects from the object selection.",
"remove_unused_objects" },
{ "remove_floating_objects", cc_remove_floating_objects, "Removes floating objects", "remove_floating_objects" },
{ "rides", cc_rides, "Ride management.", "rides <subcommand>" },
{ "save_park", cc_save_park, "Save current state of park. If no name specified default path will be used.",
{ "remove_floating_objects", ConsoleCommandRemoveFloatingObjects, "Removes floating objects", "remove_floating_objects" },
{ "rides", ConsoleCommandRides, "Ride management.", "rides <subcommand>" },
{ "save_park", ConsoleCommandSavePark, "Save current state of park. If no name specified default path will be used.",
"save_park [name]" },
{ "say", cc_say, "Say to other players.", "say <message>" },
{ "set", cc_set, "Sets the variable to the specified value.", "set <variable> <value>" },
{ "show_limits", cc_show_limits, "Shows the map data counts and limits.", "show_limits" },
{ "staff", cc_staff, "Staff management.", "staff <subcommand>" },
{ "terminate", cc_terminate, "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" },
{ "windows", cc_windows, "Lists all the windows that can be opened.", "windows" },
{ "replay_startrecord", cc_replay_startrecord, "Starts recording a new replay.", "replay_startrecord <name> [max_ticks]" },
{ "replay_stoprecord", cc_replay_stoprecord, "Stops recording a new replay.", "replay_stoprecord" },
{ "replay_start", cc_replay_start, "Starts a replay", "replay_start <name>" },
{ "replay_stop", cc_replay_stop, "Stops the replay", "replay_stop" },
{ "replay_normalise", cc_replay_normalise, "Normalises the replay to remove all gaps",
{ "say", ConsoleCommandSay, "Say to other players.", "say <message>" },
{ "set", ConsoleCommandSet, "Sets the variable to the specified value.", "set <variable> <value>" },
{ "show_limits", ConsoleCommandShowLimits, "Shows the map data counts and limits.", "show_limits" },
{ "staff", ConsoleCommandStaff, "Staff management.", "staff <subcommand>" },
{ "terminate", ConsoleCommandTerminate, "Calls std::terminate(), for testing purposes only.", "terminate" },
{ "variables", ConsoleCommandVariables, "Lists all the variables that can be used with get and sometimes set.",
"variables" },
{ "windows", ConsoleCommandWindows, "Lists all the windows that can be opened.", "windows" },
{ "replay_startrecord", ConsoleCommandReplayStartRecord, "Starts recording a new replay.",
"replay_startrecord <name> [max_ticks]" },
{ "replay_stoprecord", ConsoleCommandReplayStopRecord, "Stops recording a new replay.", "replay_stoprecord" },
{ "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>" },
{ "mp_desync", cc_mp_desync, "Forces a multiplayer desync",
"cc_mp_desync [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_start", cc_profiler_start, "Starts the profiler.", "profiler_start" },
{ "profiler_stop", cc_profiler_stop, "Stops the profiler.", "profiler_stop [<output file>]" },
{ "profiler_exportcsv", cc_profiler_exportcsv, "Exports the current profiler data.", "profiler_exportcsv <output file>" },
{ "mp_desync", ConsoleCommandMpDesync, "Forces a multiplayer desync",
"ConsoleCommandMpDesync [desync_type, 0 = Random t-shirt color on random guest, 1 = Remove random guest ]" },
{ "profiler_reset", ConsoleCommandProfilerReset, "Resets the profiler data.", "profiler_reset" },
{ "profiler_start", ConsoleCommandProfilerStart, "Starts the profiler.", "profiler_start" },
{ "profiler_stop", ConsoleCommandProfilerStop, "Stops the profiler.", "profiler_stop [<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)
{
@ -2037,7 +2044,7 @@ static int32_t cc_windows(InteractiveConsole& console, [[maybe_unused]] const ar
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)
{
@ -2046,7 +2053,7 @@ static int32_t cc_variables(InteractiveConsole& console, [[maybe_unused]] const
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())
{
@ -2061,12 +2068,12 @@ static int32_t cc_help(InteractiveConsole& console, const arguments_t& argv)
}
else
{
console_write_all_commands(console);
ConsoleWriteAllCommands(console);
}
return 0;
}
static void console_write_all_commands(InteractiveConsole& console)
static void ConsoleWriteAllCommands(InteractiveConsole& console)
{
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)
{

View File

@ -78,7 +78,7 @@ static bool WriteDpiToFile(std::string_view path, const rct_drawpixelinfo* dpi,
*
* rct2: 0x006E3AEC
*/
void screenshot_check()
void ScreenshotCheck()
{
if (gScreenshotCountdown != 0)
{
@ -86,7 +86,7 @@ void screenshot_check()
if (gScreenshotCountdown == 0)
{
// update_weather_animation();
std::string screenshotPath = screenshot_dump();
std::string screenshotPath = ScreenshotDump();
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;
}
static std::string screenshot_get_directory()
static std::string ScreenshotGetDirectory()
{
auto env = GetContext()->GetPlatformEnvironment();
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 time = Platform::GetTimeLocal();
@ -121,9 +121,9 @@ static std::pair<rct2_date, rct2_time> screenshot_get_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];
snprintf(
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;
}
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()))
{
log_error("Unable to save screenshots in OpenRCT2 screenshot directory.");
return std::nullopt;
}
auto parkName = screenshot_get_park_name();
auto dateTime = screenshot_get_formatted_date_time();
auto parkName = ScreenshotGetParkName();
auto dateTime = ScreenshotGetFormattedDateTime();
auto name = parkName + " " + dateTime;
// Generate a path with a `tries` number
@ -164,10 +164,10 @@ static std::optional<std::string> screenshot_get_next_path()
return std::nullopt;
};
std::string screenshot_dump_png(rct_drawpixelinfo* dpi)
std::string ScreenshotDumpPNG(rct_drawpixelinfo* dpi)
{
// Get a free screenshot path
auto path = screenshot_get_next_path();
auto path = ScreenshotGetNextPath();
if (!path.has_value())
{
@ -182,9 +182,9 @@ std::string screenshot_dump_png(rct_drawpixelinfo* dpi)
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())
{
@ -336,21 +336,21 @@ static void RenderViewport(IDrawingEngine* drawingEngine, const rct_viewport& vi
drawingEngine = tempDrawingEngine.get();
}
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{};
try
{
auto path = screenshot_get_next_path();
auto path = ScreenshotGetNextPath();
if (!path.has_value())
{
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* mainWindow = WindowGetMain();
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();
}
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))
{
@ -482,7 +482,7 @@ static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptr<I
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)
{
@ -506,7 +506,7 @@ int32_t cmdline_for_gfxbench(const char** argv, int32_t argc)
{
drawing_engine_init();
benchgfx_render_screenshots(inputPath, context, iterationCount);
BenchgfxRenderScreenshots(inputPath, context, iterationCount);
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)
for (int32_t i = 0; i < argc; i++)
@ -724,7 +724,7 @@ static std::string ResolveFilenameForCapture(const fs::path& filename)
if (filename.empty())
{
// Automatic filename
auto path = screenshot_get_next_path();
auto path = ScreenshotGetNextPath();
if (!path)
{
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;
}
auto screenshotDirectory = fs::u8path(screenshot_get_directory());
auto screenshotDirectory = fs::u8path(ScreenshotGetDirectory());
auto screenshotPath = fs::absolute(screenshotDirectory / filename);
// Check the filename isn't attempting to leave the screenshot directory for security

View File

@ -52,13 +52,13 @@ struct CaptureOptions
bool Transparent{};
};
void screenshot_check();
std::string screenshot_dump();
std::string screenshot_dump_png(rct_drawpixelinfo* dpi);
std::string screenshot_dump_png_32bpp(int32_t width, int32_t height, const void* pixels);
void ScreenshotCheck();
std::string ScreenshotDump();
std::string ScreenshotDumpPNG(rct_drawpixelinfo* dpi);
std::string ScreenshotDumpPNG32bpp(int32_t width, int32_t height, const void* pixels);
void screenshot_giant();
int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOptions* options);
int32_t cmdline_for_gfxbench(const char** argv, int32_t argc);
void ScreenshotGiant();
int32_t CmdlineForScreenshot(const char** argv, int32_t argc, ScreenshotOptions* options);
int32_t CmdlineForGfxbench(const char** argv, int32_t argc);
void CaptureImage(const CaptureOptions& options);

View File

@ -77,18 +77,18 @@ InteractionInfo::InteractionInfo(const PaintStruct* ps)
, 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
* multiple things.
* rct2: 0x006E6EAC
*/
void viewport_init_all()
void ViewportInitAll()
{
if (!gOpenRCT2NoGraphics)
{
colours_init_maps();
ColoursInitMaps();
}
WindowInitAll();
@ -124,7 +124,7 @@ std::optional<ScreenCoordsXY> centre_2d_coordinates(const CoordsXYZ& loc, rct_vi
return std::nullopt;
}
auto screenCoord = Translate3DTo2DWithZ(get_current_rotation(), loc);
auto screenCoord = Translate3DTo2DWithZ(GetCurrentRotation(), loc);
screenCoord.x -= viewport->view_width / 2;
screenCoord.y -= viewport->view_height / 2;
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.
* 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;
if (_viewports.size() >= MAX_VIEWPORT_COUNT)
@ -218,7 +218,7 @@ void viewport_create(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t
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; });
if (it == _viewports.end())
@ -229,13 +229,13 @@ void viewport_remove(rct_viewport* viewport)
_viewports.erase(it);
}
void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom)
{
for (auto& vp : _viewports)
{
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
* needed as parameter.
*/
CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords)
CoordsXYZ ViewportAdjustForMapHeight(const ScreenCoordsXY& startCoords)
{
int32_t height = 0;
uint32_t rotation = get_current_rotation();
uint32_t rotation = GetCurrentRotation();
CoordsXY pos{};
for (int32_t i = 0; i < 6; i++)
{
pos = viewport_coord_to_map_coord(startCoords, height);
pos = ViewportPosToMapPos(startCoords, height);
height = TileElementHeight(pos);
// 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
*/
static void viewport_redraw_after_shift(
static void ViewportRedrawAfterShift(
rct_drawpixelinfo* dpi, rct_window* window, rct_viewport* viewport, const ScreenCoordsXY& coords)
{
// sub-divide by intersecting windows
@ -293,7 +293,7 @@ static void viewport_redraw_after_shift(
{
auto itWindowPos = WindowGetIterator(window);
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);
return;
}
@ -305,49 +305,49 @@ static void viewport_redraw_after_shift(
{
viewport->width = window->windowPos.x - viewport->pos.x;
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->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
viewport->width = view_copy.width - 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)
{
viewport->width = window->windowPos.x + window->width - viewport->pos.x;
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->viewPos.x += viewport->zoom.ApplyTo(viewport->width);
viewport->width = view_copy.width - 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)
{
viewport->height = window->windowPos.y - viewport->pos.y;
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->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
viewport->height = view_copy.height - viewport->height;
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)
{
viewport->height = window->windowPos.y + window->height - viewport->pos.y;
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->viewPos.y += viewport->zoom.ApplyTo(viewport->height);
viewport->height = view_copy.height - viewport->height;
viewport->view_width = viewport->zoom.ApplyTo(viewport->width);
viewport_redraw_after_shift(dpi, window, viewport, coords);
ViewportRedrawAfterShift(dpi, window, viewport, coords);
}
// 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)
{
auto it = WindowGetIterator(window);
@ -447,10 +447,10 @@ static void viewport_shift_pixels(
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;
@ -533,14 +533,14 @@ static void viewport_move(const ScreenCoordsXY& coords, rct_window* w, rct_viewp
if (drawing_engine_has_dirty_optimisations())
{
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;
}
// 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
|| (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
*/
void viewport_update_position(rct_window* window)
void ViewportUpdatePosition(rct_window* window)
{
WindowEventResizeCall(window);
@ -577,21 +577,21 @@ void viewport_update_position(rct_window* window)
if (!window->viewport_smart_follow_sprite.IsNull())
{
viewport_update_smart_sprite_follow(window);
ViewportUpdateSmartFollowEntity(window);
}
if (!window->viewport_target_sprite.IsNull())
{
viewport_update_sprite_follow(window);
ViewportUpdateFollowSprite(window);
return;
}
viewport_set_underground_flag(0, window, viewport);
ViewportSetUndergroundFlag(0, window, viewport);
auto viewportMidPoint = ScreenCoordsXY{ window->savedViewPos.x + viewport->view_width / 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
int32_t at_map_edge = 0;
@ -665,10 +665,10 @@ void viewport_update_position(rct_window* window)
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)
{
@ -682,19 +682,19 @@ void viewport_update_sprite_follow(rct_window* window)
{
int32_t height = (TileElementHeight({ sprite->x, sprite->y })) - 16;
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);
if (centreLoc.has_value())
{
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);
if (entity == nullptr || entity->Type == EntityType::Null)
@ -707,15 +707,15 @@ void viewport_update_smart_sprite_follow(rct_window* window)
switch (entity->Type)
{
case EntityType::Vehicle:
viewport_update_smart_vehicle_follow(window);
ViewportUpdateSmartFollowVehicle(window);
break;
case EntityType::Guest:
viewport_update_smart_guest_follow(window, entity->As<Guest>());
ViewportUpdateSmartFollowGuest(window, entity->As<Guest>());
break;
case EntityType::Staff:
viewport_update_smart_staff_follow(window, entity->As<Staff>());
ViewportUpdateSmartFollowStaff(window, entity->As<Staff>());
break;
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);
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;
}
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)
{
@ -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;
}
void viewport_update_smart_vehicle_follow(rct_window* window)
void ViewportUpdateSmartFollowVehicle(rct_window* window)
{
window->focus = Focus(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
* ebp: bottom
*/
void viewport_render(
void ViewportRender(
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
std::vector<RecordedPaintSession>* sessions)
{
@ -839,7 +839,7 @@ void viewport_render(
viewport->zoom.ApplyTo(std::min(bottomRight.y, viewport->height)),
} + viewport->viewPos;
viewport_paint(viewport, dpi, { topLeft, bottomRight }, sessions);
ViewportPaint(viewport, dpi, { topLeft, bottomRight }, sessions);
#ifdef DEBUG_SHOW_DIRTY_BOX
// FIXME g_viewport_list doesn't exist anymore
@ -848,7 +848,7 @@ void viewport_render(
#endif
}
static void record_session(
static void RecordSession(
const PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
{
// Perform a deep copy of the paint session, use relative offsets.
@ -908,20 +908,19 @@ static void record_session(
}
}
static void viewport_fill_column(
PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
static void ViewportFillColumn(PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
{
PROFILED_FUNCTION();
PaintSessionGenerate(session);
if (recorded_sessions != nullptr)
{
record_session(session, recorded_sessions, record_index);
RecordSession(session, recorded_sessions, record_index);
}
PaintSessionArrange(session);
}
static void viewport_paint_column(PaintSession& session)
static void ViewportPaintColumn(PaintSession& session)
{
PROFILED_FUNCTION();
@ -943,7 +942,7 @@ static void viewport_paint_column(PaintSession& session)
if (gConfigGeneral.RenderWeatherGloom && !gTrackDesignSaveMode && !(session.ViewFlags & VIEWPORT_FLAG_HIDE_ENTITIES)
&& !(session.ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
{
viewport_paint_weather_gloom(&session.DPI);
ViewportPaintWeatherGloom(&session.DPI);
}
if (session.PSStringHead != nullptr)
@ -962,7 +961,7 @@ static void viewport_paint_column(PaintSession& session)
* edi: dpi
* ebp: bottom
*/
void viewport_paint(
void ViewportPaint(
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
std::vector<RecordedPaintSession>* recorded_sessions)
{
@ -1059,11 +1058,11 @@ void viewport_paint(
if (useMultithreading)
{
_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
{
viewport_fill_column(*session, recorded_sessions, index);
ViewportFillColumn(*session, recorded_sessions, index);
}
}
@ -1077,11 +1076,11 @@ void viewport_paint(
{
if (useParallelDrawing)
{
_paintJobs->AddTask([session]() -> void { viewport_paint_column(*session); });
_paintJobs->AddTask([session]() -> void { ViewportPaintColumn(*session); });
}
else
{
viewport_paint_column(*session);
ViewportPaintColumn(*session);
}
}
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);
if (paletteId != FilterPaletteID::PaletteNull)
@ -1115,9 +1114,9 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo* dpi)
*
* 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())
return std::nullopt;
@ -1171,14 +1170,14 @@ std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords
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
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);
}
@ -1186,7 +1185,7 @@ CoordsXY viewport_coord_to_map_coord(const ScreenCoordsXY& coords, int32_t z)
*
* rct2: 0x00664689
*/
void show_gridlines()
void ShowGridlines()
{
if (gShowGridLinesRefCount == 0)
{
@ -1207,7 +1206,7 @@ void show_gridlines()
*
* rct2: 0x006646B4
*/
void hide_gridlines()
void HideGridlines()
{
if (gShowGridLinesRefCount > 0)
gShowGridLinesRefCount--;
@ -1230,7 +1229,7 @@ void hide_gridlines()
*
* rct2: 0x00664E8E
*/
void show_land_rights()
void ShowLandRights()
{
if (gShowLandRightsRefCount == 0)
{
@ -1251,7 +1250,7 @@ void show_land_rights()
*
* rct2: 0x00664EB9
*/
void hide_land_rights()
void HideLandRights()
{
if (gShowLandRightsRefCount > 0)
gShowLandRightsRefCount--;
@ -1274,7 +1273,7 @@ void hide_land_rights()
*
* rct2: 0x00664EDD
*/
void show_construction_rights()
void ShowConstructionRights()
{
if (gShowConstructionRightsRefCount == 0)
{
@ -1295,7 +1294,7 @@ void show_construction_rights()
*
* rct2: 0x00664F08
*/
void hide_construction_rights()
void HideConstructionRights()
{
if (gShowConstructionRightsRefCount > 0)
gShowConstructionRightsRefCount--;
@ -1318,7 +1317,7 @@ void hide_construction_rights()
*
* rct2: 0x006CB70A
*/
void viewport_set_visibility(uint8_t mode)
void ViewportSetVisibility(uint8_t mode)
{
rct_window* window = WindowGetMain();
@ -1533,8 +1532,7 @@ static bool PSSpriteTypeIsInFilter(PaintStruct* ps, uint16_t filter)
/**
* rct2: 0x00679236, 0x00679662, 0x00679B0D, 0x00679FF1
*/
static bool is_pixel_present_bmp(
uint32_t imageType, const rct_g1_element* g1, const uint8_t* index, const PaletteMap& paletteMap)
static bool IsPixelPresentBMP(uint32_t imageType, const rct_g1_element* g1, const uint8_t* index, const PaletteMap& paletteMap)
{
PROFILED_FUNCTION();
@ -1560,7 +1558,7 @@ static bool is_pixel_present_bmp(
/**
* 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();
@ -1654,7 +1652,7 @@ static bool is_pixel_present_rle(const uint8_t* esi, int32_t x_start_point, int3
* @param y (dx)
* @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)
{
PROFILED_FUNCTION();
@ -1686,7 +1684,7 @@ static bool is_sprite_interacted_with_palette_set(
};
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)
{
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;
@ -1789,7 +1787,7 @@ static bool is_sprite_interacted_with_palette_set(
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.");
@ -1801,7 +1799,7 @@ static bool is_sprite_interacted_with_palette_set(
* 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();
@ -1827,14 +1825,14 @@ static bool is_sprite_interacted_with(rct_drawpixelinfo* dpi, ImageId imageId, c
{
_currentImageType = IMAGE_TYPE_DEFAULT;
}
return is_sprite_interacted_with_palette_set(dpi, imageId, coords, paletteMap);
return IsSpriteInteractedWithPaletteSet(dpi, imageId, coords, paletteMap);
}
/**
*
* 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();
@ -1849,7 +1847,7 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
while (next_ps != nullptr)
{
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)
{
@ -1863,7 +1861,7 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
#pragma GCC diagnostic ignored "-Wnull-dereference"
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)
{
@ -1890,13 +1888,13 @@ InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, u
* tileElement: edx
* 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);
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{};
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);
PaintSessionGenerate(*session);
PaintSessionArrange(*session);
info = set_interaction_info_from_paint_session(session, myviewport->flags, flags & 0xFFFF);
info = SetInteractionInfoFromPaintSession(session, myviewport->flags, flags & 0xFFFF);
PaintSessionFree(session);
}
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.
*/
void viewport_invalidate(const rct_viewport* viewport, const ScreenRect& screenRect)
void ViewportInvalidate(const rct_viewport* viewport, const ScreenRect& screenRect)
{
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);
if (w == nullptr)
@ -2007,7 +2005,7 @@ static rct_viewport* viewport_find_from_point(const ScreenCoordsXY& screenCoords
* tile_element: edx ?
* 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
rct_window* window = WindowFindFromPoint(screenCoords);
@ -2016,7 +2014,7 @@ std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc
return std::nullopt;
}
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)
{
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++)
{
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.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
*/
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)
{
return std::nullopt;
}
auto vpCoords = viewport->ScreenToViewportCoord(screenCoords);
auto mapPosition = viewport_coord_to_map_coord(vpCoords, z);
auto mapPosition = ViewportPosToMapPos(vpCoords, z);
if (!MapIsLocationValid(mapPosition))
{
return std::nullopt;
@ -2066,9 +2064,9 @@ std::optional<CoordsXY> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoo
*
* 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())
return std::nullopt;
@ -2080,9 +2078,9 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant(const ScreenCoordsXY& screenC
*
* 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())
return std::nullopt;
@ -2094,9 +2092,9 @@ std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(const ScreenCoordsXY&
*
* 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())
return std::nullopt;
@ -2108,9 +2106,9 @@ std::optional<CoordsXY> screen_get_map_xy_side(const ScreenCoordsXY& screenCoord
*
* 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())
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)
*/
uint8_t get_current_rotation()
uint8_t GetCurrentRotation()
{
uint8_t rotation = gCurrentRotation;
uint8_t rotation_masked = rotation & 3;
@ -2141,7 +2139,7 @@ uint8_t get_current_rotation()
return rotation_masked;
}
int32_t get_height_marker_offset()
int32_t GetHeightMarkerOffset()
{
// Height labels in units
if (gConfigGeneral.ShowHeightAsUnits)
@ -2155,7 +2153,7 @@ int32_t get_height_marker_offset()
return 2 * 256;
}
void viewport_set_saved_view()
void ViewportSetSavedView()
{
rct_window* w = WindowGetMain();
if (w != nullptr)
@ -2165,7 +2163,7 @@ void viewport_set_saved_view()
gSavedView = ScreenCoordsXY{ viewport->view_width / 2, viewport->view_height / 2 } + viewport->viewPos;
gSavedViewZoom = viewport->zoom;
gSavedViewRotation = get_current_rotation();
gSavedViewRotation = GetCurrentRotation();
}
}

View File

@ -120,41 +120,41 @@ extern uint8_t gSavedViewRotation;
extern PaintEntry* gNextFreePaintStruct;
extern uint8_t gCurrentRotation;
void viewport_init_all();
void ViewportInitAll();
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 viewport_remove(rct_viewport* viewport);
void viewports_invalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 });
void viewport_update_position(rct_window* window);
void viewport_update_sprite_follow(rct_window* window);
void viewport_update_smart_sprite_follow(rct_window* window);
void viewport_update_smart_guest_follow(rct_window* window, const Guest* peep);
void viewport_update_smart_staff_follow(rct_window* window, const Staff* peep);
void viewport_update_smart_vehicle_follow(rct_window* window);
void viewport_render(
void ViewportCreate(rct_window* w, const ScreenCoordsXY& screenCoords, int32_t width, int32_t height, const Focus& focus);
void ViewportRemove(rct_viewport* viewport);
void ViewportsInvalidate(const ScreenRect& screenRect, ZoomLevel maxZoom = ZoomLevel{ -1 });
void ViewportUpdatePosition(rct_window* window);
void ViewportUpdateFollowSprite(rct_window* window);
void ViewportUpdateSmartFollowEntity(rct_window* window);
void ViewportUpdateSmartFollowGuest(rct_window* window, const Guest* peep);
void ViewportUpdateSmartFollowStaff(rct_window* window, const Staff* peep);
void ViewportUpdateSmartFollowVehicle(rct_window* window);
void ViewportRender(
rct_drawpixelinfo* dpi, const rct_viewport* viewport, const ScreenRect& screenRect,
std::vector<RecordedPaintSession>* sessions = nullptr);
void viewport_paint(
void ViewportPaint(
const rct_viewport* viewport, rct_drawpixelinfo* dpi, const ScreenRect& screenRect,
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);
std::optional<CoordsXY> screen_pos_to_map_pos(const ScreenCoordsXY& screenCoords, int32_t* direction);
CoordsXY ViewportPosToMapPos(const ScreenCoordsXY& coords, int32_t z);
std::optional<CoordsXY> ScreenPosToMapPos(const ScreenCoordsXY& screenCoords, int32_t* direction);
void show_gridlines();
void hide_gridlines();
void show_land_rights();
void hide_land_rights();
void show_construction_rights();
void hide_construction_rights();
void viewport_set_visibility(uint8_t mode);
void ShowGridlines();
void HideGridlines();
void ShowLandRights();
void HideLandRights();
void ShowConstructionRights();
void HideConstructionRights();
void ViewportSetVisibility(uint8_t mode);
InteractionInfo get_map_coordinates_from_pos(const ScreenCoordsXY& screenCoords, int32_t flags);
InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const ScreenCoordsXY& screenCoords, int32_t flags);
InteractionInfo GetMapCoordinatesFromPos(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);
bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords);
bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords);
@ -164,18 +164,18 @@ bool ViewportInteractionRightClick(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> screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoords, int32_t z);
std::optional<CoordsXY> screen_get_map_xy_quadrant(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> screen_get_map_xy_side(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> ScreenGetMapXY(const ScreenCoordsXY& screenCoords, rct_viewport** viewport);
std::optional<CoordsXY> ScreenGetMapXYWithZ(const ScreenCoordsXY& screenCoords, int32_t z);
std::optional<CoordsXY> ScreenGetMapXYQuadrant(const ScreenCoordsXY& screenCoords, uint8_t* quadrant);
std::optional<CoordsXY> ScreenGetMapXYQuadrantWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* quadrant);
std::optional<CoordsXY> ScreenGetMapXYSide(const ScreenCoordsXY& screenCoords, uint8_t* side);
std::optional<CoordsXY> ScreenGetMapXYSideWithZ(const ScreenCoordsXY& screenCoords, int32_t z, uint8_t* side);
uint8_t get_current_rotation();
int32_t get_height_marker_offset();
uint8_t GetCurrentRotation();
int32_t GetHeightMarkerOffset();
void viewport_set_saved_view();
void ViewportSetSavedView();
VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlags);

View File

@ -83,8 +83,8 @@ namespace WindowCloseFlags
static constexpr uint32_t CloseSingle = (1 << 1);
} // 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 window_draw_single(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 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)
{
@ -117,7 +117,7 @@ void WindowUpdateAllViewports()
WindowVisitEach([&](rct_window* w) {
if (w->viewport != nullptr && WindowIsVisible(*w))
{
viewport_update_position(w);
ViewportUpdatePosition(w);
}
});
}
@ -128,7 +128,7 @@ void WindowUpdateAllViewports()
*/
void WindowUpdateAll()
{
// window_update_all_viewports();
// WindowUpdateAllViewports();
// 1000 tick update
gWindowUpdateTicks += gCurrentDeltaTime;
@ -155,7 +155,7 @@ void WindowUpdateAll()
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
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
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);
}
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;
do
@ -286,7 +286,7 @@ template<typename TPred> static void window_close_by_condition(TPred pred, uint3
*/
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)
{
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.
@ -365,7 +365,7 @@ void WindowCloseTop()
}
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()
{
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)
{
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));
});
}
@ -393,7 +393,7 @@ void WindowCloseAllExceptClass(WindowClass cls)
*/
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)
{
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)));
});
}
@ -486,7 +486,7 @@ WidgetIndex WindowFindWidgetFromPoint(rct_window& w, const ScreenCoordsXY& scree
*
* @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) {
if (pred(w))
@ -503,7 +503,7 @@ template<typename TPred> static void window_invalidate_by_condition(TPred pred)
*/
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)
{
window_invalidate_by_condition(
WindowInvalidateByCondition(
[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;
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
rct_viewport* other;
auto mapXYCoords = screen_get_map_xy(windowPos, &other);
auto mapXYCoords = ScreenGetMapXY(windowPos, &other);
CoordsXYZ coords{};
// 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;
coords = viewport_adjust_for_map_height(viewPos);
coords = ViewportAdjustForMapHeight(viewPos);
}
else
{
@ -949,7 +949,7 @@ void WindowRotateCamera(rct_window& w, int32_t direction)
coords.z = TileElementHeight(coords);
}
gCurrentRotation = (get_current_rotation() + direction) & 3;
gCurrentRotation = (GetCurrentRotation() + direction) & 3;
auto centreLoc = centre_2d_coordinates(coords, viewport);
@ -973,8 +973,8 @@ void WindowViewportGetMapCoordsByCursor(
// Compute map coordinate by mouse position.
auto viewportPos = w.viewport->ScreenToViewportCoord(mouseCoords);
auto coordsXYZ = viewport_adjust_for_map_height(viewportPos);
auto mapCoords = viewport_coord_to_map_coord(viewportPos, coordsXYZ.z);
auto coordsXYZ = ViewportAdjustForMapHeight(viewportPos);
auto mapCoords = ViewportPosToMapPos(viewportPos, coordsXYZ.z);
*map_x = mapCoords.x;
*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)
{
// Split draw at topwindow.left
window_draw_core(dpi, w, left, top, topwindow->windowPos.x, bottom);
window_draw_core(dpi, w, topwindow->windowPos.x, top, right, bottom);
WindowDrawCore(dpi, w, left, top, topwindow->windowPos.x, bottom);
WindowDrawCore(dpi, w, topwindow->windowPos.x, top, right, bottom);
}
else if (topwindow->windowPos.x + topwindow->width < right)
{
// Split draw at topwindow.right
window_draw_core(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, left, top, topwindow->windowPos.x + topwindow->width, bottom);
WindowDrawCore(dpi, w, topwindow->windowPos.x + topwindow->width, top, right, bottom);
}
else if (topwindow->windowPos.y > top)
{
// Split draw at topwindow.top
window_draw_core(dpi, w, left, top, right, topwindow->windowPos.y);
window_draw_core(dpi, w, left, topwindow->windowPos.y, right, bottom);
WindowDrawCore(dpi, w, left, top, right, topwindow->windowPos.y);
WindowDrawCore(dpi, w, left, topwindow->windowPos.y, right, bottom);
}
else if (topwindow->windowPos.y + topwindow->height < bottom)
{
// Split draw at topwindow.bottom
window_draw_core(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, top, right, topwindow->windowPos.y + topwindow->height);
WindowDrawCore(dpi, w, left, topwindow->windowPos.y + topwindow->height, right, bottom);
}
// 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
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.
*/
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
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();
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
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)
{
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)

View File

@ -33,7 +33,7 @@ void rct_window::RemoveViewport()
if (viewport == nullptr)
return;
viewport_remove(viewport);
ViewportRemove(viewport);
viewport = nullptr;
}

View File

@ -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]));
}
chat_history_add(text);
ChatAddHistory(text);
Peep* pickup_peep = network_get_pickup_peep(connection_player->Id);
if (pickup_peep != nullptr)
{
@ -2270,7 +2270,7 @@ void NetworkBase::Server_Client_Joined(std::string_view name, const std::string&
char text[256];
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);
chat_history_add(text);
ChatAddHistory(text);
auto& context = GetContext();
auto& objManager = context.GetObjectManager();
@ -2770,7 +2770,7 @@ void NetworkBase::Client_Handle_CHAT([[maybe_unused]] NetworkConnection& connect
auto text = packet.ReadString();
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());
chat_history_add(formatted);
ChatAddHistory(formatted);
Server_Send_CHAT(formatted);
}
@ -3090,7 +3090,7 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec
{
auto playerName = packet.ReadString();
auto message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, playerName);
chat_history_add(message);
ChatAddHistory(message);
break;
}
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);
}
chat_history_add(message);
ChatAddHistory(message);
break;
}
}
@ -3424,7 +3424,7 @@ void network_chat_show_connected_message()
NetworkPlayer server;
server.Name = "Server";
const char* formatted = NetworkBase::FormatChat(&server, buffer);
chat_history_add(formatted);
ChatAddHistory(formatted);
}
// Display server greeting if one exists
@ -3436,7 +3436,7 @@ void network_chat_show_server_greeting()
thread_local std::string greeting_formatted;
greeting_formatted.assign("{OUTLINE}{GREEN}");
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())
{
// Server is one of the recipients
chat_history_add(formatted);
ChatAddHistory(formatted);
}
network.Server_Send_CHAT(formatted, playerIds);
}

View File

@ -199,7 +199,7 @@ static PaintStruct* CreateNormalPaintStruct(
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) };
CoordsXY mapTile = { screenCoord.y - screenCoord.x / 2, screenCoord.y + screenCoord.x / 2 };
mapTile = mapTile.Rotate(direction);
@ -245,7 +245,7 @@ template<uint8_t direction> void PaintSessionGenerateRotate(PaintSession& sessio
*/
void PaintSessionGenerate(PaintSession& session)
{
session.CurrentRotation = get_current_rotation();
session.CurrentRotation = GetCurrentRotation();
switch (DirectionFlipXAxis(session.CurrentRotation))
{
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)
{
const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->sprite_type)];
const uint8_t rotation = get_current_rotation();
const uint8_t rotation = GetCurrentRotation();
const CoordsXYZ frontTop = {
ps->bounds.x_end,

View File

@ -343,7 +343,7 @@ static void PaintHeightMarkers(PaintSession& session, const EntranceElement& ent
auto heightMarkerBaseZ = entranceEl.GetBaseZ() + 3;
ImageIndex baseImageIndex = SPR_HEIGHT_MARKER_BASE;
baseImageIndex += heightMarkerBaseZ / 16;
baseImageIndex += get_height_marker_offset();
baseImageIndex += GetHeightMarkerOffset();
baseImageIndex -= gMapBaseZ;
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
PaintAddImageAsParent(session, imageId, { 16, 16, height }, { { 31, 31, heightMarkerBaseZ + 64 }, { 1, 1, 0 } });

View File

@ -923,7 +923,7 @@ static void PaintHeightMarkers(PaintSession& session, const PathElement& pathEl)
uint32_t baseImageIndex = SPR_HEIGHT_MARKER_BASE;
baseImageIndex += heightMarkerBaseZ / 16;
baseImageIndex += get_height_marker_offset();
baseImageIndex += GetHeightMarkerOffset();
baseImageIndex -= gMapBaseZ;
auto imageId = ImageId(baseImageIndex, COLOUR_GREY);
PaintAddImageAsParent(session, imageId, { 16, 16, heightMarkerBaseZ }, { 1, 1, 0 });

View File

@ -1090,7 +1090,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
int32_t dx = surfaceHeight + 3;
int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16);
image_id += get_height_marker_offset();
image_id += GetHeightMarkerOffset();
image_id -= gMapBaseZ;
PaintAddImageAsParent(session, ImageId(image_id, COLOUR_OLIVE_GREEN), { 16, 16, surfaceHeight }, { 1, 1, 0 });

View File

@ -214,7 +214,7 @@ static bool OnCrash(
// Discovering which of the approaches got implemented is left as an excercise for the reader.
if (OpenRCT2::GetContext()->GetDrawingEngineType() != DrawingEngine::OpenGL)
{
std::string screenshotPath = screenshot_dump();
std::string screenshotPath = ScreenshotDump();
if (!screenshotPath.empty())
{
auto screenshotPathW = String::ToWideChar(screenshotPath.c_str());

View File

@ -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
for (int32_t i = 0; i < OpenRCT2::Limits::MaxStationsPerRide; i++)
{

View File

@ -382,7 +382,7 @@ namespace OpenRCT2::RideAudio
{
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 viewWidth = viewport->view_width;
auto viewWidth2 = viewWidth * 2;

View File

@ -1214,7 +1214,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
CoordsXYZD entranceExitCoords{};
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
// 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.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 coordsAtHeight = screen_get_map_xy_with_z(screenCoords, stationBaseZ);
auto coordsAtHeight = ScreenGetMapXYWithZ(screenCoords, stationBaseZ);
if (!coordsAtHeight.has_value())
{
entranceExitCoords.SetNull();

View File

@ -2172,7 +2172,7 @@ void TrackDesignDrawPreview(TrackDesign* td6, uint8_t* pixels)
gCurrentRotation = i;
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;
}

View File

@ -2196,9 +2196,9 @@ void PaintTrack(PaintSession& session, Direction direction, int32_t height, cons
{
uint16_t ax = ride->GetRideTypeDescriptor().Heights.VehicleZOffset;
// 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 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 });
}

View File

@ -30,7 +30,7 @@ namespace OpenRCT2::Title
w->SetLocation({ loc, z });
gScreenFlags = oldScreenFlags;
viewport_update_position(w);
ViewportUpdatePosition(w);
}
return 0;

View File

@ -130,7 +130,7 @@ void TitleScreen::Load()
#endif
OpenRCT2::Audio::StopAll();
GetContext()->GetGameState()->InitAll(DEFAULT_MAP_SIZE);
viewport_init_all();
ViewportInitAll();
ContextOpenWindow(WindowClass::MainWindow);
CreateWindows();
TitleInitialise();
@ -159,7 +159,7 @@ void TitleScreen::Tick()
{
gInUpdateCode = true;
screenshot_check();
ScreenshotCheck();
title_handle_keyboard_input();
if (game_is_not_paused())

View File

@ -60,9 +60,9 @@ money32 PlaceProvisionalTrackPiece(
_unkF440C5 = { trackPos, static_cast<Direction>(trackDirection) };
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
viewport_set_visibility(3);
ViewportSetVisibility(3);
if (_currentTrackSlopeEnd != 0)
viewport_set_visibility(2);
ViewportSetVisibility(2);
// Invalidate previous track piece (we may not be changing height!)
VirtualFloorInvalidate();
@ -102,9 +102,9 @@ money32 PlaceProvisionalTrackPiece(
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
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)
viewport_set_visibility(2);
ViewportSetVisibility(2);
// Invalidate previous track piece (we may not be changing height!)
VirtualFloorInvalidate();

View File

@ -158,11 +158,11 @@ money32 FootpathProvisionalSet(
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
{
viewport_set_visibility(1);
ViewportSetVisibility(1);
}
else
{
viewport_set_visibility(3);
ViewportSetVisibility(3);
}
}
@ -249,11 +249,11 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32
return position;
}
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
|| !(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));
if (info.SpriteType == ViewportInteractionItem::None)
{
@ -285,7 +285,7 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32
{
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.y = std::clamp(position.y, minPosition.y, maxPosition.y);
}
@ -347,7 +347,7 @@ CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_
return ret;
}
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;
if (info.SpriteType == ViewportInteractionItem::Ride
&& 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,
EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath, ViewportInteractionItem::Ride));
if (info.SpriteType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TileElementType::Entrance)

View File

@ -1145,7 +1145,7 @@ void MapInvalidateMapSelectionTiles()
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{
CoordsXY{ _range.GetLeft(), _range.GetTop() },
CoordsXY{ _range.GetRight(), _range.GetTop() },
@ -1193,7 +1193,7 @@ void MapInvalidateSelectionRect()
bottom += 32;
top -= 32 + 2080;
viewports_invalidate({ { left, top }, { right, bottom } });
ViewportsInvalidate({ { left, top }, { right, bottom } });
}
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;
y += 16;
auto screenCoord = Translate3DTo2D(get_current_rotation(), { x, y });
auto screenCoord = Translate3DTo2D(GetCurrentRotation(), { x, y });
x1 = screenCoord.x - 32;
y1 = screenCoord.y - 32 - z1;
x2 = screenCoord.x + 32;
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;
top -= 32 + 2080;
viewports_invalidate({ { left, top }, { right, bottom } });
ViewportsInvalidate({ { left, top }, { right, bottom } });
}
int32_t MapGetTileSide(const CoordsXY& mapPos)

View File

@ -145,7 +145,7 @@ static bool MapAnimationInvalidateQueueBanner(const CoordsXYZ& loc)
if (!tileElement->AsPath()->HasQueueBanner())
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)
{
MapInvalidateTileZoom1({ loc, loc.z + 16, loc.z + 30 });