Close #13624: Refactor ViewportInteractionItem to use strong enum (#13657)

* Closes #13624: Refactor ViewportInteractionItem to use strong enum
This commit is contained in:
Dennis Devriendt 2020-12-29 19:09:15 +01:00 committed by GitHub
parent ce2319fca4
commit 3073cca6aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 238 additions and 230 deletions

View File

@ -64,27 +64,28 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
return info;
info = get_map_coordinates_from_pos(
screenCoords, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK);
auto tileElement = info.SpriteType != VIEWPORT_INTERACTION_ITEM_SPRITE ? info.Element : nullptr;
// Only valid when info.SpriteType == VIEWPORT_INTERACTION_ITEM_SPRITE, but can't assign nullptr without compiler
screenCoords,
VIEWPORT_INTERACTION_MASK_ENTITY & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK_ENTRANCE);
auto tileElement = info.SpriteType != ViewportInteractionItem::Entity ? info.Element : nullptr;
// Only valid when info.SpriteType == ViewportInteractionItem::Entity, but can't assign nullptr without compiler
// complaining
auto sprite = info.Entity;
// Allows only balloons to be popped and ducks to be quacked in title screen
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
{
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_SPRITE && (sprite->Is<Balloon>() || sprite->Is<Duck>()))
if (info.SpriteType == ViewportInteractionItem::Entity && (sprite->Is<Balloon>() || sprite->Is<Duck>()))
return info;
else
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
}
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SPRITE:
case ViewportInteractionItem::Entity:
switch (sprite->sprite_identifier)
{
case SpriteIdentifier::Vehicle:
@ -93,7 +94,7 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
if (vehicle != nullptr && vehicle->ride_subtype != RIDE_ENTRY_INDEX_NULL)
vehicle->SetMapToolbar();
else
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
}
break;
case SpriteIdentifier::Peep:
@ -105,7 +106,7 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
}
else
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
}
}
break;
@ -115,10 +116,10 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
break;
}
break;
case VIEWPORT_INTERACTION_ITEM_RIDE:
case ViewportInteractionItem::Ride:
ride_set_map_tooltip(tileElement);
break;
case VIEWPORT_INTERACTION_ITEM_PARK:
case ViewportInteractionItem::ParkEntrance:
{
auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark();
auto parkName = park.Name.c_str();
@ -130,18 +131,18 @@ InteractionInfo ViewportInteractionGetItemLeft(const ScreenCoordsXY& screenCoord
break;
}
default:
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
break;
}
// If nothing is under cursor, find a close by peep
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
auto peep = ViewportInteractionGetClosestPeep(screenCoords, 32);
if (peep != nullptr)
{
info.Entity = peep;
info.SpriteType = VIEWPORT_INTERACTION_ITEM_SPRITE;
info.SpriteType = ViewportInteractionItem::Entity;
info.Loc.x = peep->x;
info.Loc.y = peep->y;
peep_set_map_tooltip(peep);
@ -157,9 +158,9 @@ bool ViewportInteractionLeftOver(const ScreenCoordsXY& screenCoords)
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SPRITE:
case VIEWPORT_INTERACTION_ITEM_RIDE:
case VIEWPORT_INTERACTION_ITEM_PARK:
case ViewportInteractionItem::Entity:
case ViewportInteractionItem::Ride:
case ViewportInteractionItem::ParkEntrance:
return true;
default:
return false;
@ -172,7 +173,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords)
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SPRITE:
case ViewportInteractionItem::Entity:
{
auto entity = info.Entity;
switch (entity->sprite_identifier)
@ -220,14 +221,14 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords)
}
return true;
}
case VIEWPORT_INTERACTION_ITEM_RIDE:
case ViewportInteractionItem::Ride:
{
auto intent = Intent(WD_TRACK);
intent.putExtra(INTENT_EXTRA_TILE_ELEMENT, info.Element);
context_open_intent(&intent);
return true;
}
case VIEWPORT_INTERACTION_ITEM_PARK:
case ViewportInteractionItem::ParkEntrance:
context_open_window(WC_PARK_INFORMATION);
return true;
default:
@ -258,19 +259,19 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SPRITE:
case ViewportInteractionItem::Entity:
{
auto sprite = info.Entity;
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || sprite->sprite_identifier != SpriteIdentifier::Vehicle)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
auto vehicle = sprite->As<Vehicle>();
if (vehicle == nullptr)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
ride = get_ride(vehicle->ride);
@ -283,23 +284,23 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
}
return info;
}
case VIEWPORT_INTERACTION_ITEM_RIDE:
case ViewportInteractionItem::Ride:
{
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
ride = get_ride(tileElement->GetRideIndex());
if (ride == nullptr)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
@ -354,7 +355,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
// FIXME: Why does it *2 the value?
if (!gCheatsSandboxMode && !map_is_location_owned({ info.Loc, tileElement->GetBaseZ() * 2 }))
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
@ -380,7 +381,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
SetMapTooltip(ft);
return info;
}
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
sceneryEntry = tileElement->AsWall()->GetEntry();
if (sceneryEntry->wall.scrolling_mode != SCROLLING_MODE_NONE)
{
@ -398,7 +399,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
}
break;
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
if (sceneryEntry->large_scenery.scrolling_mode != SCROLLING_MODE_NONE)
{
@ -416,7 +417,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
}
break;
case VIEWPORT_INTERACTION_ITEM_BANNER:
case ViewportInteractionItem::Banner:
{
auto banner = tileElement->AsBanner()->GetBanner();
sceneryEntry = get_banner_entry(banner->type);
@ -437,7 +438,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
{
if (window_find_by_class(WC_RIDE_CONSTRUCTION) == nullptr && window_find_by_class(WC_FOOTPATH) == nullptr)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
}
@ -445,14 +446,14 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
auto ft = Formatter();
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
ft.Add<rct_string_id>(STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
ft.Add<rct_string_id>(sceneryEntry->name);
SetMapTooltip(ft);
return info;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
ft.Add<rct_string_id>(STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
if (tileElement->AsPath()->IsQueue())
ft.Add<rct_string_id>(STR_QUEUE_LINE_MAP_TIP);
@ -461,7 +462,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
SetMapTooltip(ft);
return info;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
case ViewportInteractionItem::FootpathItem:
sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
ft.Add<rct_string_id>(STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
if (tileElement->AsPath()->IsBroken())
@ -472,7 +473,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
SetMapTooltip(ft);
return info;
case VIEWPORT_INTERACTION_ITEM_PARK:
case ViewportInteractionItem::ParkEntrance:
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
break;
@ -484,14 +485,14 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
SetMapTooltip(ft);
return info;
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
sceneryEntry = tileElement->AsWall()->GetEntry();
ft.Add<rct_string_id>(STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
ft.Add<rct_string_id>(sceneryEntry->name);
SetMapTooltip(ft);
return info;
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
ft.Add<rct_string_id>(STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
ft.Add<rct_string_id>(sceneryEntry->name);
@ -501,7 +502,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
break;
}
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
info.SpriteType = ViewportInteractionItem::None;
return info;
}
@ -509,7 +510,7 @@ bool ViewportInteractionRightOver(const ScreenCoordsXY& screenCoords)
{
auto info = ViewportInteractionGetItemRight(screenCoords);
return info.SpriteType != VIEWPORT_INTERACTION_ITEM_NONE;
return info.SpriteType != ViewportInteractionItem::None;
}
/**
@ -523,13 +524,13 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords)
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_NONE:
case VIEWPORT_INTERACTION_ITEM_TERRAIN:
case VIEWPORT_INTERACTION_ITEM_WATER:
case VIEWPORT_INTERACTION_ITEM_LABEL:
case ViewportInteractionItem::None:
case ViewportInteractionItem::Terrain:
case ViewportInteractionItem::Water:
case ViewportInteractionItem::Label:
return false;
case VIEWPORT_INTERACTION_ITEM_SPRITE:
case ViewportInteractionItem::Entity:
{
auto entity = info.Entity;
if (entity->sprite_identifier == SpriteIdentifier::Vehicle)
@ -547,29 +548,29 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords)
}
}
break;
case VIEWPORT_INTERACTION_ITEM_RIDE:
case ViewportInteractionItem::Ride:
tileElement = { info.Loc, info.Element };
ride_modify(&tileElement);
break;
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
ViewportInteractionRemoveScenery(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
ViewportInteractionRemoveFootpath(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
case ViewportInteractionItem::FootpathItem:
ViewportInteractionRemoveFootpathItem(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_PARK:
case ViewportInteractionItem::ParkEntrance:
ViewportInteractionRemoveParkEntrance(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
ViewportInteractionRemoveParkWall(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
ViewportInteractionRemoveLargeScenery(info.Element, info.Loc);
break;
case VIEWPORT_INTERACTION_ITEM_BANNER:
case ViewportInteractionItem::Banner:
context_open_detail_window(WD_BANNER, info.Element->AsBanner()->GetIndex());
break;
}
@ -744,14 +745,14 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
window, screenCoords, VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER);
auto initialPos = info.Loc;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
initialPos.setNull();
return initialPos;
}
int16_t waterHeight = 0;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_WATER)
if (info.SpriteType == ViewportInteractionItem::Water)
{
waterHeight = info.Element->AsSurface()->GetWaterHeight();
}
@ -762,7 +763,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo
for (int32_t i = 0; i < 5; i++)
{
int16_t z = waterHeight;
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_WATER)
if (info.SpriteType != ViewportInteractionItem::Water)
{
z = tile_element_height(mapPos);
}

View File

@ -129,7 +129,7 @@ namespace OpenRCT2::Scripting
obj.Set("screenCoords", ToDuk(ctx, screenCoords));
obj.Set("mapCoords", ToDuk(ctx, info.Loc));
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_SPRITE && info.Entity != nullptr)
if (info.SpriteType == ViewportInteractionItem::Entity && info.Entity != nullptr)
{
obj.Set("entityId", info.Entity->sprite_index);
}

View File

@ -712,7 +712,7 @@ static void window_footpath_set_provisional_path_at_point(const ScreenCoordsXY&
auto info = get_map_coordinates_from_pos(
screenCoords, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE || info.Element == nullptr)
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
{
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
footpath_provisional_update();
@ -738,7 +738,7 @@ static void window_footpath_set_provisional_path_at_point(const ScreenCoordsXY&
int32_t slope = 0;
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_TERRAIN:
case ViewportInteractionItem::Terrain:
{
auto surfaceElement = info.Element->AsSurface();
if (surfaceElement != nullptr)
@ -747,7 +747,7 @@ static void window_footpath_set_provisional_path_at_point(const ScreenCoordsXY&
}
break;
}
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
{
auto pathElement = info.Element->AsPath();
if (pathElement != nullptr)
@ -836,7 +836,7 @@ static void window_footpath_place_path_at_point(const ScreenCoordsXY& screenCoor
const auto info = get_map_coordinates_from_pos(
screenCoords, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
return;
}
@ -845,10 +845,10 @@ static void window_footpath_place_path_at_point(const ScreenCoordsXY& screenCoor
auto slope = 0;
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_TERRAIN:
case ViewportInteractionItem::Terrain:
slope = DefaultPathSlope[info.Element->AsSurface()->GetSlope() & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK];
break;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
slope = info.Element->AsPath()->GetSlopeDirection();
if (info.Element->AsPath()->IsSloped())
{

View File

@ -1146,7 +1146,7 @@ void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
gPickupPeepImage = UINT32_MAX;
auto info = get_map_coordinates_from_pos(screenCoords, VIEWPORT_INTERACTION_MASK_NONE);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
return;
gPickupPeepX = screenCoords.x - 1;

View File

@ -4210,7 +4210,7 @@ static void window_ride_set_track_colour_scheme(rct_window* w, const ScreenCoord
auto newColourScheme = static_cast<uint8_t>(w->ride_colour);
auto info = get_map_coordinates_from_pos(screenPos, VIEWPORT_INTERACTION_MASK_RIDE);
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_RIDE)
if (info.SpriteType != ViewportInteractionItem::Ride)
return;
if (info.Element->GetType() != TILE_ELEMENT_TYPE_TRACK)
return;
@ -5395,10 +5395,10 @@ static void window_ride_measurements_tooldown(rct_window* w, rct_widgetindex wid
auto info = get_map_coordinates_from_pos(screenCoords, 0xFCCF);
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case VIEWPORT_INTERACTION_ITEM_WALL:
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Scenery:
case ViewportInteractionItem::LargeScenery:
case ViewportInteractionItem::Wall:
case ViewportInteractionItem::Footpath:
_collectTrackDesignScenery = !track_design_save_contains_tile_element(info.Element);
track_design_save_select_tile_element(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
break;
@ -5417,10 +5417,10 @@ static void window_ride_measurements_tooldrag(rct_window* w, rct_widgetindex wid
auto info = get_map_coordinates_from_pos(screenCoords, 0xFCCF);
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case VIEWPORT_INTERACTION_ITEM_WALL:
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Scenery:
case ViewportInteractionItem::LargeScenery:
case ViewportInteractionItem::Wall:
case ViewportInteractionItem::Footpath:
track_design_save_select_tile_element(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
break;
default:

View File

@ -2099,7 +2099,7 @@ static std::optional<CoordsXY> ride_get_place_position_from_screen_position(Scre
if (gInputPlaceObjectModifier & PLACE_OBJECT_MODIFIER_COPY_Z)
{
auto info = get_map_coordinates_from_pos(screenCoords, 0xFCCA);
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType != ViewportInteractionItem::None)
{
_trackPlaceCtrlZ = info.Element->GetBaseZ();
_trackPlaceCtrlState = true;

View File

@ -1171,7 +1171,7 @@ void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
gPickupPeepImage = UINT32_MAX;
auto info = get_map_coordinates_from_pos(screenCoords, VIEWPORT_INTERACTION_MASK_NONE);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
return;
gPickupPeepX = screenCoords.x - 1;

View File

@ -406,9 +406,9 @@ static struct {
};
// clang-format on
static constexpr int32_t ViewportInteractionFlags = VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_SPRITE
static constexpr int32_t ViewportInteractionFlags = VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_ENTITY
& VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_SCENERY & VIEWPORT_INTERACTION_MASK_FOOTPATH
& VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM & VIEWPORT_INTERACTION_MASK_PARK & VIEWPORT_INTERACTION_MASK_WALL
& VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM & VIEWPORT_INTERACTION_MASK_PARK_ENTRANCE & VIEWPORT_INTERACTION_MASK_WALL
& VIEWPORT_INTERACTION_MASK_LARGE_SCENERY & VIEWPORT_INTERACTION_MASK_BANNER;
static int16_t windowTileInspectorHighlightedIndex = -1;

View File

@ -627,7 +627,7 @@ static void window_title_command_editor_tool_down(
{
auto info = ViewportInteractionGetItemLeft(screenCoords);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_SPRITE)
if (info.SpriteType == ViewportInteractionItem::Entity)
{
auto entity = info.Entity;
bool validSprite = false;

View File

@ -989,7 +989,7 @@ static void repaint_scenery_tool_down(const ScreenCoordsXY& windowPos, rct_widge
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
{
rct_scenery_entry* scenery_entry = info.Element->AsSmallScenery()->GetEntry();
@ -1006,7 +1006,7 @@ static void repaint_scenery_tool_down(const ScreenCoordsXY& windowPos, rct_widge
GameActions::Execute(&repaintScenery);
break;
}
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
{
rct_scenery_entry* scenery_entry = info.Element->AsWall()->GetEntry();
@ -1021,7 +1021,7 @@ static void repaint_scenery_tool_down(const ScreenCoordsXY& windowPos, rct_widge
GameActions::Execute(&repaintScenery);
break;
}
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
{
rct_scenery_entry* scenery_entry = info.Element->AsLargeScenery()->GetEntry();
@ -1036,7 +1036,7 @@ static void repaint_scenery_tool_down(const ScreenCoordsXY& windowPos, rct_widge
GameActions::Execute(&repaintScenery);
break;
}
case VIEWPORT_INTERACTION_ITEM_BANNER:
case ViewportInteractionItem::Banner:
{
auto banner = info.Element->AsBanner()->GetBanner();
if (banner != nullptr)
@ -1067,7 +1067,7 @@ static void scenery_eyedropper_tool_down(const ScreenCoordsXY& windowPos, rct_wi
switch (info.SpriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
{
SmallSceneryElement* sceneryElement = info.Element->AsSmallScenery();
auto entryIndex = sceneryElement->GetEntryIndex();
@ -1084,7 +1084,7 @@ static void scenery_eyedropper_tool_down(const ScreenCoordsXY& windowPos, rct_wi
}
break;
}
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
{
auto entryIndex = info.Element->AsWall()->GetEntryIndex();
rct_scenery_entry* sceneryEntry = get_wall_entry(entryIndex);
@ -1100,7 +1100,7 @@ static void scenery_eyedropper_tool_down(const ScreenCoordsXY& windowPos, rct_wi
}
break;
}
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
{
auto entryIndex = info.Element->AsLargeScenery()->GetEntryIndex();
rct_scenery_entry* sceneryEntry = get_large_scenery_entry(entryIndex);
@ -1116,7 +1116,7 @@ static void scenery_eyedropper_tool_down(const ScreenCoordsXY& windowPos, rct_wi
}
break;
}
case VIEWPORT_INTERACTION_ITEM_BANNER:
case ViewportInteractionItem::Banner:
{
auto banner = info.Element->AsBanner()->GetBanner();
if (banner != nullptr)
@ -1132,7 +1132,7 @@ static void scenery_eyedropper_tool_down(const ScreenCoordsXY& windowPos, rct_wi
}
break;
}
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
case ViewportInteractionItem::FootpathItem:
{
auto entryIndex = info.Element->AsPath()->GetAdditionEntryIndex();
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(entryIndex);
@ -1169,7 +1169,7 @@ static void sub_6E1F34_update_screen_coords_and_buttons_pressed(bool canRaiseIte
& VIEWPORT_INTERACTION_MASK_LARGE_SCENERY;
auto info = get_map_coordinates_from_pos(screenPos, flags);
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType != ViewportInteractionItem::None)
{
gSceneryCtrlPressed = true;
gSceneryCtrlPressZ = info.Element->GetBaseZ();
@ -1339,7 +1339,7 @@ static void sub_6E1F34_small_scenery(
auto info = get_map_coordinates_from_pos(screenPos, flags);
gridPos = info.Loc;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
gridPos.setNull();
return;
@ -1433,7 +1433,7 @@ static void sub_6E1F34_path_item(
auto info = get_map_coordinates_from_pos(screenPos, flags);
gridPos = info.Loc;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
gridPos.setNull();
return;
@ -1656,7 +1656,7 @@ static void sub_6E1F34_banner(
auto info = get_map_coordinates_from_pos(screenPos, flags);
gridPos = info.Loc;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
gridPos.setNull();
return;
@ -2357,7 +2357,7 @@ static void top_toolbar_tool_update_water(const ScreenCoordsXY& screenPos)
auto info = get_map_coordinates_from_pos(screenPos, VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
if (gWaterToolRaiseCost != MONEY32_UNDEFINED || gWaterToolLowerCost != MONEY32_UNDEFINED)
{

View File

@ -299,7 +299,7 @@ void lightfx_prepare_light_list()
TileElement* tileElement = nullptr;
int32_t interactionType = 0;
ViewportInteractionItem interactionType = ViewportInteractionItem::None;
auto* w = window_get_main();
if (w != nullptr)
@ -330,7 +330,7 @@ void lightfx_prepare_light_list()
int32_t minDist = 0;
int32_t baseHeight = (-999) * COORDS_Z_STEP;
if (interactionType != VIEWPORT_INTERACTION_ITEM_SPRITE && tileElement)
if (interactionType != ViewportInteractionItem::Entity && tileElement)
{
baseHeight = tileElement->GetBaseZ();
}

View File

@ -1277,17 +1277,16 @@ void viewport_set_visibility(uint8_t mode)
*/
static bool PSSpriteTypeIsInFilter(paint_struct* ps, uint16_t filter)
{
if (ps->sprite_type == VIEWPORT_INTERACTION_ITEM_NONE
|| ps->sprite_type == 11 // 11 as a type seems to not exist, maybe part of the typo mentioned later on.
|| ps->sprite_type > VIEWPORT_INTERACTION_ITEM_BANNER)
if (ps->sprite_type == ViewportInteractionItem::None || ps->sprite_type == ViewportInteractionItem::Label
|| ps->sprite_type > ViewportInteractionItem::Banner)
return false;
uint16_t mask;
if (ps->sprite_type == VIEWPORT_INTERACTION_ITEM_BANNER)
if (ps->sprite_type == ViewportInteractionItem::Banner)
// I think CS made a typo here. Let's replicate the original behaviour.
mask = 1 << (ps->sprite_type - 3);
mask = 1 << (EnumValue(ps->sprite_type) - 3);
else
mask = 1 << (ps->sprite_type - 1);
mask = 1 << (EnumValue(ps->sprite_type) - 1);
if (filter & mask)
{
@ -1774,7 +1773,7 @@ std::optional<CoordsXY> screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc
}
auto myViewport = window->viewport;
auto info = get_map_coordinates_from_pos_window(window, screenCoords, VIEWPORT_INTERACTION_MASK_TERRAIN);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
return std::nullopt;
}

View File

@ -49,38 +49,37 @@ enum
VIEWPORT_FLAG_TRANSPARENT_BACKGROUND = (1 << 19),
};
enum ViewportInteractionItem : uint8_t
enum class ViewportInteractionItem : uint8_t
{
VIEWPORT_INTERACTION_ITEM_NONE,
VIEWPORT_INTERACTION_ITEM_TERRAIN,
VIEWPORT_INTERACTION_ITEM_SPRITE,
VIEWPORT_INTERACTION_ITEM_RIDE,
VIEWPORT_INTERACTION_ITEM_WATER,
VIEWPORT_INTERACTION_ITEM_SCENERY,
VIEWPORT_INTERACTION_ITEM_FOOTPATH,
VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM,
VIEWPORT_INTERACTION_ITEM_PARK,
VIEWPORT_INTERACTION_ITEM_WALL,
VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY,
VIEWPORT_INTERACTION_ITEM_LABEL,
VIEWPORT_INTERACTION_ITEM_BANNER,
None,
Terrain,
Entity,
Ride,
Water,
Scenery,
Footpath,
FootpathItem,
ParkEntrance,
Wall,
LargeScenery,
Label,
Banner
};
enum
{
VIEWPORT_INTERACTION_MASK_NONE = 0,
VIEWPORT_INTERACTION_MASK_TERRAIN = ~(1 << (VIEWPORT_INTERACTION_ITEM_TERRAIN - 1)),
VIEWPORT_INTERACTION_MASK_SPRITE = ~(1 << (VIEWPORT_INTERACTION_ITEM_SPRITE - 1)),
VIEWPORT_INTERACTION_MASK_RIDE = ~(1 << (VIEWPORT_INTERACTION_ITEM_RIDE - 1)),
VIEWPORT_INTERACTION_MASK_WATER = ~(1 << (VIEWPORT_INTERACTION_ITEM_WATER - 1)),
VIEWPORT_INTERACTION_MASK_SCENERY = ~(1 << (VIEWPORT_INTERACTION_ITEM_SCENERY - 1)),
VIEWPORT_INTERACTION_MASK_FOOTPATH = ~(1 << (VIEWPORT_INTERACTION_ITEM_FOOTPATH - 1)),
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM = ~(1 << (VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM - 1)),
VIEWPORT_INTERACTION_MASK_PARK = ~(1 << (VIEWPORT_INTERACTION_ITEM_PARK - 1)),
VIEWPORT_INTERACTION_MASK_WALL = ~(1 << (VIEWPORT_INTERACTION_ITEM_WALL - 1)),
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY = ~(1 << (VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY - 1)),
VIEWPORT_INTERACTION_MASK_BANNER = ~(1 << (VIEWPORT_INTERACTION_ITEM_BANNER - 2)), // Note the -2 for BANNER
VIEWPORT_INTERACTION_MASK_TERRAIN = ~(1 << (EnumValue(ViewportInteractionItem::Terrain) - 1)),
VIEWPORT_INTERACTION_MASK_ENTITY = ~(1 << (EnumValue(ViewportInteractionItem::Entity) - 1)),
VIEWPORT_INTERACTION_MASK_RIDE = ~(1 << (EnumValue(ViewportInteractionItem::Ride) - 1)),
VIEWPORT_INTERACTION_MASK_WATER = ~(1 << (EnumValue(ViewportInteractionItem::Water) - 1)),
VIEWPORT_INTERACTION_MASK_SCENERY = ~(1 << (EnumValue(ViewportInteractionItem::Scenery) - 1)),
VIEWPORT_INTERACTION_MASK_FOOTPATH = ~(1 << (EnumValue(ViewportInteractionItem::Footpath) - 1)),
VIEWPORT_INTERACTION_MASK_FOOTPATH_ITEM = ~(1 << (EnumValue(ViewportInteractionItem::FootpathItem) - 1)),
VIEWPORT_INTERACTION_MASK_PARK_ENTRANCE = ~(1 << (EnumValue(ViewportInteractionItem::ParkEntrance) - 1)),
VIEWPORT_INTERACTION_MASK_WALL = ~(1 << (EnumValue(ViewportInteractionItem::Wall) - 1)),
VIEWPORT_INTERACTION_MASK_LARGE_SCENERY = ~(1 << (EnumValue(ViewportInteractionItem::LargeScenery) - 1)),
VIEWPORT_INTERACTION_MASK_BANNER = ~(1 << (EnumValue(ViewportInteractionItem::Banner) - 2)), // Note the -2 for BANNER
};
struct InteractionInfo
@ -93,7 +92,7 @@ struct InteractionInfo
TileElement* Element = nullptr;
SpriteBase* Entity;
};
ViewportInteractionItem SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;
ViewportInteractionItem SpriteType = ViewportInteractionItem::None;
};
#define MAX_VIEWPORT_COUNT WINDOW_LIMIT_MAX

View File

@ -53,7 +53,7 @@ bool gPaintBlockedTiles;
static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t viewFlags);
static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y);
static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y);
static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags);
static uint32_t PaintPSColourifyImage(uint32_t imageId, ViewportInteractionItem spriteType, uint32_t viewFlags);
static constexpr int32_t CalculatePositionHash(const paint_struct& ps, uint8_t rotation)
{
@ -445,7 +445,7 @@ static void PaintDrawStruct(paint_session* session, paint_struct* ps)
int16_t x = ps->x;
int16_t y = ps->y;
if (ps->sprite_type == VIEWPORT_INTERACTION_ITEM_SPRITE)
if (ps->sprite_type == ViewportInteractionItem::Entity)
{
if (dpi->zoom_level >= 1)
{
@ -521,7 +521,7 @@ static void PaintAttachedPS(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t v
static void PaintPSImageWithBoundingBoxes(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imageId, int16_t x, int16_t y)
{
const uint8_t colour = BoundBoxDebugColours[ps->sprite_type];
const uint8_t colour = BoundBoxDebugColours[EnumValue(ps->sprite_type)];
const uint8_t rotation = get_current_rotation();
const CoordsXYZ frontTop = {
@ -615,7 +615,7 @@ static void PaintPSImage(rct_drawpixelinfo* dpi, paint_struct* ps, uint32_t imag
gfx_draw_sprite(dpi, imageId, { x, y }, ps->tertiary_colour);
}
static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint32_t viewFlags)
static uint32_t PaintPSColourifyImage(uint32_t imageId, ViewportInteractionItem spriteType, uint32_t viewFlags)
{
constexpr uint32_t primaryColour = COLOUR_BRIGHT_YELLOW;
constexpr uint32_t secondaryColour = COLOUR_GREY;
@ -623,7 +623,7 @@ static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint
if (viewFlags & VIEWPORT_FLAG_SEETHROUGH_RIDES)
{
if (spriteType == VIEWPORT_INTERACTION_ITEM_RIDE)
if (spriteType == ViewportInteractionItem::Ride)
{
imageId &= 0x7FFFF;
imageId |= seeThoughFlags;
@ -631,7 +631,7 @@ static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint
}
if (viewFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)
{
if (spriteType == VIEWPORT_INTERACTION_ITEM_WALL)
if (spriteType == ViewportInteractionItem::Wall)
{
imageId &= 0x7FFFF;
imageId |= seeThoughFlags;
@ -641,11 +641,12 @@ static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint
{
switch (spriteType)
{
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
case VIEWPORT_INTERACTION_ITEM_BANNER:
case ViewportInteractionItem::Footpath:
case ViewportInteractionItem::FootpathItem:
case ViewportInteractionItem::Banner:
imageId &= 0x7FFFF;
imageId |= seeThoughFlags;
default:
break;
}
}
@ -653,11 +654,12 @@ static uint32_t PaintPSColourifyImage(uint32_t imageId, uint8_t spriteType, uint
{
switch (spriteType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Scenery:
case ViewportInteractionItem::LargeScenery:
case ViewportInteractionItem::Wall:
imageId &= 0x7FFFF;
imageId |= seeThoughFlags;
default:
break;
}
}

View File

@ -15,7 +15,7 @@
#include "../world/Location.hpp"
struct TileElement;
enum ViewportInteractionItem : uint8_t;
enum class ViewportInteractionItem : uint8_t;
#pragma pack(push, 1)
/* size 0x12 */

View File

@ -303,7 +303,7 @@ void virtual_floor_paint(paint_session* session)
uint8_t direction = session->CurrentRotation;
// This is a virtual floor, so no interactions
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
int16_t virtualFloorClipHeight = _virtualFloorHeight;

View File

@ -97,7 +97,7 @@ void sprite_paint_setup(paint_session* session, const uint16_t x, const uint16_t
session->CurrentlyDrawnItem = spr;
session->SpritePosition.x = spr->x;
session->SpritePosition.y = spr->y;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
switch (spr->sprite_identifier)
{

View File

@ -36,7 +36,7 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
{
rct_drawpixelinfo* dpi = &session->DPI;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_BANNER;
session->InteractionType = ViewportInteractionItem::Banner;
if (dpi->zoom_level > 1 || gTrackDesignSaveMode || (session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES))
return;
@ -71,7 +71,7 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
if (tile_element->IsGhost()) // if being placed
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
image_id |= CONSTRUCTION_MARKER;
}
else

View File

@ -89,12 +89,12 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
colour_2 = ride->track_colour[0].additional;
image_id = (colour_1 << 19) | (colour_2 << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
uint32_t entranceImageId = 0;
if (tile_element->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
image_id = CONSTRUCTION_MARKER;
entranceImageId = image_id;
if (transparant_image_id)
@ -222,11 +222,11 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
}
#endif
session->InteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
session->InteractionType = ViewportInteractionItem::ParkEntrance;
uint32_t image_id, ghost_id = 0;
if (tile_element->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
ghost_id = CONSTRUCTION_MARKER;
}
@ -334,7 +334,7 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
*/
void entrance_paint(paint_session* session, uint8_t direction, int32_t height, const TileElement* tile_element)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_LABEL;
session->InteractionType = ViewportInteractionItem::Label;
if (PaintShouldShowHeightMarkers(session, VIEWPORT_FLAG_PATH_HEIGHTS))
{

View File

@ -225,7 +225,7 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
{
return;
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY;
session->InteractionType = ViewportInteractionItem::LargeScenery;
uint32_t sequenceNum = tileElement->AsLargeScenery()->GetSequenceIndex();
rct_scenery_entry* entry = tileElement->AsLargeScenery()->GetEntry();
if (entry == nullptr)
@ -250,7 +250,7 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
}
if (tileElement->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
sequenceNum = CONSTRUCTION_MARKER;
image_id &= 0x7FFFF;
dword_F4387C = sequenceNum;

View File

@ -417,7 +417,7 @@ static void sub_6A4101(
uint8_t direction = tile_element->AsPath()->GetQueueBannerDirection();
// Draw ride sign
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
if (tile_element->AsPath()->IsSloped())
{
if (tile_element->AsPath()->GetSlopeDirection() == direction)
@ -480,10 +480,10 @@ static void sub_6A4101(
1, 1, 21, height + 7, boundBoxOffsets.x, boundBoxOffsets.y, boundBoxOffsets.z);
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
session->InteractionType = ViewportInteractionItem::Footpath;
if (imageFlags != 0)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
}
return;
}
@ -694,10 +694,10 @@ static void sub_6A3F61(
{
if (tile_element->AsPath()->HasAddition())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
session->InteractionType = ViewportInteractionItem::FootpathItem;
if (sceneryImageFlags != 0)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
}
// Draw additional path bits (bins, benches, lamps, queue screens)
@ -738,11 +738,11 @@ static void sub_6A3F61(
break;
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
session->InteractionType = ViewportInteractionItem::Footpath;
if (sceneryImageFlags != 0)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
}
}
}
@ -807,7 +807,7 @@ static void sub_6A3F61(
*/
void path_paint(paint_session* session, uint16_t height, const TileElement* tile_element)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
session->InteractionType = ViewportInteractionItem::Footpath;
bool hasSupports = false;
@ -842,7 +842,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
if (tile_element->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
imageFlags = CONSTRUCTION_MARKER;
}

View File

@ -38,7 +38,7 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co
return;
}
const SmallSceneryElement* sceneryElement = tileElement->AsSmallScenery();
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SCENERY;
session->InteractionType = ViewportInteractionItem::Scenery;
LocationXYZ16 boxlength;
LocationXYZ16 boxoffset;
boxoffset.x = 0;
@ -55,7 +55,7 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co
}
if (tileElement->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
baseImageid = CONSTRUCTION_MARKER;
}
uint32_t dword_F64EB0 = baseImageid;

View File

@ -965,7 +965,7 @@ static std::pair<int32_t, int32_t> surface_get_height_above_water(
void surface_paint(paint_session* session, uint8_t direction, uint16_t height, const TileElement* tileElement)
{
rct_drawpixelinfo* dpi = &session->DPI;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
session->InteractionType = ViewportInteractionItem::Terrain;
session->DidPassSurface = true;
session->SurfaceElement = tileElement;
@ -1308,7 +1308,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
if (waterHeight > 0 && !gTrackDesignSaveMode && !waterGetsClipped)
{
// loc_6615A9: (water height)
session->InteractionType = VIEWPORT_INTERACTION_ITEM_WATER;
session->InteractionType = ViewportInteractionItem::Water;
const uint16_t localHeight = height + 16;
@ -1346,7 +1346,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
if ((tileElement->AsSurface()->GetParkFences()) && !gTrackDesignSaveMode)
{
// Owned land boundary fences
session->InteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
session->InteractionType = ViewportInteractionItem::ParkEntrance;
uint8_t rotatedFences = rol4(tileElement->AsSurface()->GetParkFences(), rotation);
@ -1404,7 +1404,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c
}
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_TERRAIN;
session->InteractionType = ViewportInteractionItem::Terrain;
session->Unk141E9DB |= G141E9DB_FLAG_1;
switch (surfaceShape)

View File

@ -124,7 +124,7 @@ static void blank_tiles_paint(paint_session* session, int32_t x, int32_t y)
session->SpritePosition.x = x;
session->SpritePosition.y = y;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
PaintAddImageAsParent(session, SPR_BLANK_TILE, 0, 0, 32, 32, -1, 16);
}
@ -199,7 +199,7 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y)
session->SpritePosition.x = x;
session->SpritePosition.y = y;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
PaintAddImageAsParent(session, imageId, 0, 0, 32, 32, -1, arrowZ, 0, 0, arrowZ + 18);
}

View File

@ -156,7 +156,7 @@ static void fence_paint_wall(
*/
void fence_paint(paint_session* session, uint8_t direction, int32_t height, const TileElement* tile_element)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_WALL;
session->InteractionType = ViewportInteractionItem::Wall;
rct_scenery_entry* sceneryEntry = tile_element->AsWall()->GetEntry();
if (sceneryEntry == nullptr)
@ -200,7 +200,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
if (tile_element->IsGhost())
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
dword_141F710 = CONSTRUCTION_MARKER;
}

View File

@ -6086,7 +6086,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
auto info = get_map_coordinates_from_pos(screenCoords, 0xFFFB);
if (info.SpriteType != 0)
if (info.SpriteType != ViewportInteractionItem::None)
{
if (info.Element->GetType() == TILE_ELEMENT_TYPE_TRACK)
{

View File

@ -221,7 +221,7 @@ void track_design_save_reset_scenery();
bool track_design_save_contains_tile_element(const TileElement* tileElement);
void track_design_save_select_nearby_scenery(ride_id_t rideIndex);
void track_design_save_select_tile_element(
int32_t interactionType, const CoordsXY& loc, TileElement* tileElement, bool collect);
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement, bool collect);
bool track_design_are_entrance_and_exit_placed();

View File

@ -43,8 +43,10 @@ std::vector<TrackDesignSceneryElement> _trackSavedTileElementsDesc;
static bool track_design_save_should_select_scenery_around(ride_id_t rideIndex, TileElement* tileElement);
static void track_design_save_select_nearby_scenery_for_tile(ride_id_t rideIndex, int32_t cx, int32_t cy);
static bool track_design_save_add_tile_element(int32_t interactionType, const CoordsXY& loc, TileElement* tileElement);
static void track_design_save_remove_tile_element(int32_t interactionType, const CoordsXY& loc, TileElement* tileElement);
static bool track_design_save_add_tile_element(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement);
static void track_design_save_remove_tile_element(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement);
void track_design_save_init()
{
@ -56,7 +58,8 @@ void track_design_save_init()
*
* rct2: 0x006D2B07
*/
void track_design_save_select_tile_element(int32_t interactionType, const CoordsXY& loc, TileElement* tileElement, bool collect)
void track_design_save_select_tile_element(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement, bool collect)
{
if (track_design_save_contains_tile_element(tileElement))
{
@ -311,7 +314,8 @@ static void track_design_save_add_footpath(const CoordsXY& loc, PathElement* pat
*
* rct2: 0x006D2B3C
*/
static bool track_design_save_add_tile_element(int32_t interactionType, const CoordsXY& loc, TileElement* tileElement)
static bool track_design_save_add_tile_element(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement)
{
if (!track_design_save_can_add_tile_element(tileElement))
{
@ -320,16 +324,16 @@ static bool track_design_save_add_tile_element(int32_t interactionType, const Co
switch (interactionType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
track_design_save_add_scenery(loc, tileElement->AsSmallScenery());
return true;
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
track_design_save_add_large_scenery(loc, tileElement->AsLargeScenery());
return true;
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
track_design_save_add_wall(loc, tileElement->AsWall());
return true;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
track_design_save_add_footpath(loc, tileElement->AsPath());
return true;
default:
@ -487,22 +491,25 @@ static void track_design_save_remove_footpath(const CoordsXY& loc, PathElement*
*
* rct2: 0x006D2B3C
*/
static void track_design_save_remove_tile_element(int32_t interactionType, const CoordsXY& loc, TileElement* tileElement)
static void track_design_save_remove_tile_element(
ViewportInteractionItem interactionType, const CoordsXY& loc, TileElement* tileElement)
{
switch (interactionType)
{
case VIEWPORT_INTERACTION_ITEM_SCENERY:
case ViewportInteractionItem::Scenery:
track_design_save_remove_scenery(loc, tileElement->AsSmallScenery());
break;
case VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY:
case ViewportInteractionItem::LargeScenery:
track_design_save_remove_large_scenery(loc, tileElement->AsLargeScenery());
break;
case VIEWPORT_INTERACTION_ITEM_WALL:
case ViewportInteractionItem::Wall:
track_design_save_remove_wall(loc, tileElement->AsWall());
break;
case VIEWPORT_INTERACTION_ITEM_FOOTPATH:
case ViewportInteractionItem::Footpath:
track_design_save_remove_footpath(loc, tileElement->AsPath());
break;
default:
break;
}
}
@ -544,27 +551,27 @@ static void track_design_save_select_nearby_scenery_for_tile(ride_id_t rideIndex
continue;
do
{
int32_t interactionType = VIEWPORT_INTERACTION_ITEM_NONE;
ViewportInteractionItem interactionType = ViewportInteractionItem::None;
switch (tileElement->GetType())
{
case TILE_ELEMENT_TYPE_PATH:
if (!tileElement->AsPath()->IsQueue())
interactionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
interactionType = ViewportInteractionItem::Footpath;
else if (tileElement->AsPath()->GetRideIndex() == rideIndex)
interactionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH;
interactionType = ViewportInteractionItem::Footpath;
break;
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
interactionType = VIEWPORT_INTERACTION_ITEM_SCENERY;
interactionType = ViewportInteractionItem::Scenery;
break;
case TILE_ELEMENT_TYPE_WALL:
interactionType = VIEWPORT_INTERACTION_ITEM_WALL;
interactionType = ViewportInteractionItem::Wall;
break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
interactionType = VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY;
interactionType = ViewportInteractionItem::LargeScenery;
break;
}
if (interactionType != VIEWPORT_INTERACTION_ITEM_NONE)
if (interactionType != ViewportInteractionItem::None)
{
if (!track_design_save_contains_tile_element(tileElement))
{

View File

@ -2154,7 +2154,7 @@ void track_paint(paint_session* session, Direction direction, int32_t height, co
if (PaintShouldShowHeightMarkers(session, VIEWPORT_FLAG_TRACK_HEIGHTS))
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
if (TrackHeightMarkerPositions[trackType] & (1 << trackSequence))
{
uint16_t ax = RideTypeDescriptors[ride->type].Heights.VehicleZOffset;
@ -2167,7 +2167,7 @@ void track_paint(paint_session* session, Direction direction, int32_t height, co
}
}
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
session->TrackColours[SCHEME_TRACK] = SPRITE_ID_PALETTE_COLOUR_2(
ride->track_colour[trackColourScheme].main, ride->track_colour[trackColourScheme].additional);
session->TrackColours[SCHEME_SUPPORTS] = SPRITE_ID_PALETTE_COLOUR_1(ride->track_colour[trackColourScheme].supports);
@ -2183,7 +2183,7 @@ void track_paint(paint_session* session, Direction direction, int32_t height, co
if (tileElement->IsGhost())
{
uint32_t ghost_id = CONSTRUCTION_MARKER;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
session->InteractionType = ViewportInteractionItem::None;
session->TrackColours[SCHEME_TRACK] = ghost_id;
session->TrackColours[SCHEME_SUPPORTS] = ghost_id;
session->TrackColours[SCHEME_MISC] = ghost_id;

View File

@ -33,7 +33,7 @@ static void paint_circus_tent(
auto vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -47,7 +47,7 @@ static void paint_circus_tent(
PaintAddImageAsParent(session, imageId | imageColourFlags, al, cl, 24, 24, 47, height + 3, al + 16, cl + 16, height + 3);
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**
* rct2: 0x0076FAD4

View File

@ -49,7 +49,7 @@ static void paint_crooked_house_structure(
auto vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
}

View File

@ -72,7 +72,7 @@ static void paint_ferris_wheel_structure(
auto vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -125,7 +125,7 @@ static void paint_ferris_wheel_structure(
boundBox.offset_y, height);
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**

View File

@ -51,7 +51,7 @@ static void paint_haunted_house_structure(
auto vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
frameNum = vehicle->vehicle_sprite_type;
}
@ -87,7 +87,7 @@ static void paint_haunted_house_structure(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**

View File

@ -41,7 +41,7 @@ static void paint_merry_go_round_structure(
auto vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
if (ride->lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)
@ -95,7 +95,7 @@ static void paint_merry_go_round_structure(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**

View File

@ -47,7 +47,7 @@ static void paint_space_rings_structure(paint_session* session, Ride* ride, uint
auto vehicle = GetEntity<Vehicle>(ride->vehicles[vehicleIndex]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
frameNum += static_cast<int8_t>(vehicle->vehicle_sprite_type) * 4;
}
@ -80,7 +80,7 @@ static void paint_space_rings_structure(paint_session* session, Ride* ride, uint
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x00767C40 */

View File

@ -32,7 +32,7 @@ static void paint_3d_cinema_structure(
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = GetEntity<Vehicle>(ride->vehicles[0]);
}
@ -46,7 +46,7 @@ static void paint_3d_cinema_structure(
PaintAddImageAsParent(session, imageId, xOffset, yOffset, 24, 24, 47, height + 3, xOffset + 16, yOffset + 16, height + 3);
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**

View File

@ -34,7 +34,7 @@ static void paint_enterprise_structure(
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && ride->vehicles[0] != SPRITE_INDEX_NULL)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
session->CurrentlyDrawnItem = vehicle;
}
@ -73,7 +73,7 @@ static void paint_enterprise_structure(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x008A1584 */

View File

@ -186,7 +186,7 @@ static void paint_magic_carpet_structure(
if (vehicle != nullptr)
{
swingImageId = vehicle->vehicle_sprite_type;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -208,7 +208,7 @@ static void paint_magic_carpet_structure(
paint_magic_carpet_pendulum(session, PLANE_FRONT, swingImageId, direction, offset, bbOffset, bbSize);
paint_magic_carpet_frame(session, PLANE_FRONT, direction, offset, bbOffset, bbSize);
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
session->CurrentlyDrawnItem = savedTileElement;
}

View File

@ -50,7 +50,7 @@ static void paint_motionsimulator_vehicle(
if (spriteIndex != SPRITE_INDEX_NULL)
{
vehicle = GetEntity<Vehicle>(spriteIndex);
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
}
@ -126,7 +126,7 @@ static void paint_motionsimulator_vehicle(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x008A85C4 */

View File

@ -61,7 +61,7 @@ static void paint_swinging_inverter_ship_structure(
{
vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -117,7 +117,7 @@ static void paint_swinging_inverter_ship_structure(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x00760260 */

View File

@ -74,7 +74,7 @@ static void paint_swinging_ship_structure(
{
vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -162,7 +162,7 @@ static void paint_swinging_ship_structure(
height);
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x008A85C4 */

View File

@ -63,7 +63,7 @@ static void top_spin_paint_vehicle(
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK && vehicle != nullptr)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
armRotation = vehicle->vehicle_sprite_type;
@ -240,7 +240,7 @@ static void top_spin_paint_vehicle(
session, image_id, al, cl, lengthX, lengthY, 90, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ);
session->CurrentlyDrawnItem = curTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/**

View File

@ -36,7 +36,7 @@ static void paint_twist_structure(
{
vehicle = GetEntity<Vehicle>(ride->vehicles[0]);
session->InteractionType = VIEWPORT_INTERACTION_ITEM_SPRITE;
session->InteractionType = ViewportInteractionItem::Entity;
session->CurrentlyDrawnItem = vehicle;
}
@ -73,7 +73,7 @@ static void paint_twist_structure(
}
session->CurrentlyDrawnItem = savedTileElement;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
session->InteractionType = ViewportInteractionItem::Ride;
}
/** rct2: 0x0076D858 */

View File

@ -257,12 +257,12 @@ CoordsXY footpath_get_coordinates_from_pos(const ScreenCoordsXY& screenCoords, i
}
auto viewport = window->viewport;
auto info = get_map_coordinates_from_pos_window(window, screenCoords, VIEWPORT_INTERACTION_MASK_FOOTPATH);
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_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(
window, screenCoords, VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_NONE)
if (info.SpriteType == ViewportInteractionItem::None)
{
auto position = info.Loc;
position.setNull();
@ -275,7 +275,7 @@ CoordsXY footpath_get_coordinates_from_pos(const ScreenCoordsXY& screenCoords, i
auto myTileElement = info.Element;
auto position = info.Loc.ToTileCentre();
auto z = 0;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_FOOTPATH)
if (info.SpriteType == ViewportInteractionItem::Footpath)
{
z = myTileElement->GetBaseZ();
if (myTileElement->AsPath()->IsSloped())
@ -288,7 +288,7 @@ CoordsXY footpath_get_coordinates_from_pos(const ScreenCoordsXY& screenCoords, i
for (int32_t i = 0; i < 5; i++)
{
if (info.SpriteType != VIEWPORT_INTERACTION_ITEM_FOOTPATH)
if (info.SpriteType != ViewportInteractionItem::Footpath)
{
z = tile_element_height(position);
}
@ -356,7 +356,7 @@ CoordsXY footpath_bridge_get_info_from_pos(const ScreenCoordsXY& screenCoords, i
auto viewport = window->viewport;
auto info = get_map_coordinates_from_pos_window(window, screenCoords, VIEWPORT_INTERACTION_MASK_RIDE);
*tileElement = info.Element;
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_RIDE
if (info.SpriteType == ViewportInteractionItem::Ride
&& viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)
&& (*tileElement)->GetType() == TILE_ELEMENT_TYPE_ENTRANCE)
{
@ -375,7 +375,7 @@ CoordsXY footpath_bridge_get_info_from_pos(const ScreenCoordsXY& screenCoords, i
info = get_map_coordinates_from_pos_window(
window, screenCoords,
VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_FOOTPATH & VIEWPORT_INTERACTION_MASK_TERRAIN);
if (info.SpriteType == VIEWPORT_INTERACTION_ITEM_RIDE && (*tileElement)->GetType() == TILE_ELEMENT_TYPE_ENTRANCE)
if (info.SpriteType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TILE_ELEMENT_TYPE_ENTRANCE)
{
int32_t directions = entrance_get_directions(*tileElement);
if (directions & 0x0F)

View File

@ -27,8 +27,8 @@ namespace TestPaint
{
void ResetEnvironment()
{
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
gPaintSession.InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
gPaintInteractionType = EnumValue(ViewportInteractionItem::Ride);
gPaintSession.InteractionType = ViewportInteractionItem::Ride;
gTrackColours[SCHEME_TRACK] = DEFAULT_SCHEME_TRACK;
gTrackColours[SCHEME_SUPPORTS] = DEFAULT_SCHEME_SUPPORTS;