mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
@@ -1691,7 +1691,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc
|
||||
void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||
{
|
||||
// if unknown viewport visibility, use the containing window to discover the status
|
||||
if (viewport->visibility == VC_UNKNOWN)
|
||||
if (viewport->visibility == VisibilityCache::Unknown)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto owner = windowManager->GetOwner(viewport);
|
||||
@@ -1705,7 +1705,7 @@ void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int3
|
||||
}
|
||||
}
|
||||
|
||||
if (viewport->visibility == VC_COVERED)
|
||||
if (viewport->visibility == VisibilityCache::Covered)
|
||||
return;
|
||||
|
||||
int32_t viewportLeft = viewport->viewPos.x;
|
||||
|
||||
@@ -1969,16 +1969,16 @@ bool window_is_visible(rct_window* w)
|
||||
if (w == nullptr)
|
||||
return false;
|
||||
|
||||
if (w->visibility == VC_VISIBLE)
|
||||
if (w->visibility == VisibilityCache::Visible)
|
||||
return true;
|
||||
if (w->visibility == VC_COVERED)
|
||||
if (w->visibility == VisibilityCache::Covered)
|
||||
return false;
|
||||
|
||||
// only consider viewports, consider the main window always visible
|
||||
if (w->viewport == nullptr || w->classification == WC_MAIN_WINDOW)
|
||||
{
|
||||
// default to previous behaviour
|
||||
w->visibility = VC_VISIBLE;
|
||||
w->visibility = VisibilityCache::Visible;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1993,15 +1993,15 @@ bool window_is_visible(rct_window* w)
|
||||
&& w_other.windowPos.x + w_other.width >= w->windowPos.x + w->width
|
||||
&& w_other.windowPos.y + w_other.height >= w->windowPos.y + w->height)
|
||||
{
|
||||
w->visibility = VC_COVERED;
|
||||
w->viewport->visibility = VC_COVERED;
|
||||
w->visibility = VisibilityCache::Covered;
|
||||
w->viewport->visibility = VisibilityCache::Covered;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// default to previous behaviour
|
||||
w->visibility = VC_VISIBLE;
|
||||
w->viewport->visibility = VC_VISIBLE;
|
||||
w->visibility = VisibilityCache::Visible;
|
||||
w->viewport->visibility = VisibilityCache::Visible;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2052,10 +2052,10 @@ void window_reset_visibilities()
|
||||
{
|
||||
// reset window visibility status to unknown
|
||||
window_visit_each([](rct_window* w) {
|
||||
w->visibility = VC_UNKNOWN;
|
||||
w->visibility = VisibilityCache::Unknown;
|
||||
if (w->viewport != nullptr)
|
||||
{
|
||||
w->viewport->visibility = VC_UNKNOWN;
|
||||
w->viewport->visibility = VisibilityCache::Unknown;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ struct TitleSequence;
|
||||
struct TextInputSession;
|
||||
struct scenario_index_entry;
|
||||
|
||||
enum class VisibilityCache : uint8_t;
|
||||
|
||||
#define SCROLLABLE_ROW_HEIGHT 12
|
||||
#define LIST_ROW_HEIGHT 12
|
||||
#define TABLE_CELL_HEIGHT 12
|
||||
@@ -142,7 +144,7 @@ struct rct_viewport
|
||||
uint32_t flags;
|
||||
ZoomLevel zoom;
|
||||
uint8_t var_11;
|
||||
uint8_t visibility; // VISIBILITY_CACHE
|
||||
VisibilityCache visibility;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -632,11 +634,11 @@ enum
|
||||
MODAL_RESULT_OK
|
||||
};
|
||||
|
||||
enum VISIBILITY_CACHE
|
||||
enum class VisibilityCache : uint8_t
|
||||
{
|
||||
VC_UNKNOWN,
|
||||
VC_VISIBLE,
|
||||
VC_COVERED
|
||||
Unknown,
|
||||
Visible,
|
||||
Covered
|
||||
};
|
||||
|
||||
enum class GuestListFilterType : int32_t
|
||||
|
||||
@@ -88,7 +88,7 @@ struct rct_window
|
||||
ScreenCoordsXY savedViewPos;
|
||||
rct_windowclass classification;
|
||||
colour_t colours[6];
|
||||
uint8_t visibility;
|
||||
VisibilityCache visibility;
|
||||
uint16_t viewport_smart_follow_sprite; // Handles setting viewport target sprite etc
|
||||
|
||||
void SetLocation(const CoordsXYZ& coords);
|
||||
|
||||
Reference in New Issue
Block a user