1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Code style: Remove struct snakes from Paint (#18341)

This commit is contained in:
Rik Smeets
2022-10-14 20:26:36 +02:00
committed by GitHub
parent d415a5bd10
commit c80bd455e9
124 changed files with 3776 additions and 3779 deletions

View File

@@ -53,17 +53,17 @@ static std::list<rct_viewport> _viewports;
rct_viewport* g_music_tracking_viewport;
static std::unique_ptr<JobPool> _paintJobs;
static std::vector<paint_session*> _paintColumns;
static std::vector<PaintSession*> _paintColumns;
ScreenCoordsXY gSavedView;
ZoomLevel gSavedViewZoom;
uint8_t gSavedViewRotation;
paint_entry* gNextFreePaintStruct;
PaintEntry* gNextFreePaintStruct;
uint8_t gCurrentRotation;
static uint32_t _currentImageType;
InteractionInfo::InteractionInfo(const paint_struct* ps)
InteractionInfo::InteractionInfo(const PaintStruct* ps)
: Loc(ps->map_x, ps->map_y)
, Element(ps->tileElement)
, Entity(ps->entity)
@@ -842,7 +842,7 @@ void viewport_render(
}
static void record_session(
const paint_session& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
const PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
{
// Perform a deep copy of the paint session, use relative offsets.
// This is done to extract the session for benchmark.
@@ -853,7 +853,7 @@ static void record_session(
recordedSession.Entries.resize(session.PaintEntryChain.GetCount());
// Mind the offset needs to be calculated against the original `session`, not `session_copy`
std::unordered_map<paint_struct*, paint_struct*> entryRemap;
std::unordered_map<PaintStruct*, PaintStruct*> entryRemap;
// Copy all entries
auto paintIndex = 0;
@@ -865,11 +865,11 @@ static void record_session(
auto& src = chain->PaintStructs[i];
auto& dst = recordedSession.Entries[paintIndex++];
dst = src;
entryRemap[src.AsBasic()] = reinterpret_cast<paint_struct*>(i * sizeof(paint_entry));
entryRemap[src.AsBasic()] = reinterpret_cast<PaintStruct*>(i * sizeof(PaintEntry));
}
chain = chain->Next;
}
entryRemap[nullptr] = reinterpret_cast<paint_struct*>(-1);
entryRemap[nullptr] = reinterpret_cast<PaintStruct*>(-1);
// Remap all entries
for (auto& ps : recordedSession.Entries)
@@ -902,7 +902,7 @@ static void record_session(
}
static void viewport_fill_column(
paint_session& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
PaintSession& session, std::vector<RecordedPaintSession>* recorded_sessions, size_t record_index)
{
PROFILED_FUNCTION();
@@ -914,7 +914,7 @@ static void viewport_fill_column(
PaintSessionArrange(session);
}
static void viewport_paint_column(paint_session& session)
static void viewport_paint_column(PaintSession& session)
{
PROFILED_FUNCTION();
@@ -1027,7 +1027,7 @@ void viewport_paint(
// Generate and sort columns.
for (x = alignedX; x < rightBorder; x += 32, index++)
{
paint_session* session = PaintSessionAlloc(&dpi1, viewFlags);
PaintSession* session = PaintSessionAlloc(&dpi1, viewFlags);
_paintColumns.push_back(session);
rct_drawpixelinfo& dpi2 = session->DPI;
@@ -1404,7 +1404,7 @@ static bool IsTileElementVegetation(const TileElement* tileElement)
return false;
}
VisibilityKind GetPaintStructVisibility(const paint_struct* ps, uint32_t viewFlags)
VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlags)
{
switch (ps->sprite_type)
{
@@ -1484,9 +1484,9 @@ VisibilityKind GetPaintStructVisibility(const paint_struct* ps, uint32_t viewFla
}
/**
* Checks if a paint_struct sprite type is in the filter mask.
* Checks if a PaintStruct sprite type is in the filter mask.
*/
static bool PSSpriteTypeIsInFilter(paint_struct* ps, uint16_t filter)
static bool PSSpriteTypeIsInFilter(PaintStruct* ps, uint16_t filter)
{
if (ps->sprite_type != ViewportInteractionItem::None && ps->sprite_type != ViewportInteractionItem::Label
&& ps->sprite_type <= ViewportInteractionItem::Banner)
@@ -1804,18 +1804,18 @@ static bool is_sprite_interacted_with(rct_drawpixelinfo* dpi, ImageId imageId, c
*
* rct2: 0x0068862C
*/
InteractionInfo set_interaction_info_from_paint_session(paint_session* session, uint32_t viewFlags, uint16_t filter)
InteractionInfo set_interaction_info_from_paint_session(PaintSession* session, uint32_t viewFlags, uint16_t filter)
{
PROFILED_FUNCTION();
paint_struct* ps = &session->PaintHead;
PaintStruct* ps = &session->PaintHead;
rct_drawpixelinfo* dpi = &session->DPI;
InteractionInfo info{};
while ((ps = ps->next_quadrant_ps) != nullptr)
{
paint_struct* old_ps = ps;
paint_struct* next_ps = ps;
PaintStruct* old_ps = ps;
PaintStruct* next_ps = ps;
while (next_ps != nullptr)
{
ps = next_ps;
@@ -1831,7 +1831,7 @@ InteractionInfo set_interaction_info_from_paint_session(paint_session* session,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnull-dereference"
for (attached_paint_struct* attached_ps = ps->attached_ps; attached_ps != nullptr; attached_ps = attached_ps->next)
for (AttachedPaintStruct* attached_ps = ps->attached_ps; attached_ps != nullptr; attached_ps = attached_ps->next)
{
if (is_sprite_interacted_with(dpi, attached_ps->image_id, { (attached_ps->x + ps->x), (attached_ps->y + ps->y) }))
{
@@ -1895,7 +1895,7 @@ InteractionInfo get_map_coordinates_from_pos_window(rct_window* window, const Sc
dpi.zoom_level = myviewport->zoom;
dpi.width = 1;
paint_session* session = PaintSessionAlloc(&dpi, myviewport->flags);
PaintSession* session = PaintSessionAlloc(&dpi, myviewport->flags);
PaintSessionGenerate(*session);
PaintSessionArrange(*session);
info = set_interaction_info_from_paint_session(session, myviewport->flags, flags & 0xFFFF);