mirror of https://github.com/OpenRCT2/OpenRCT2.git
Re-order members of paint_struct for better code generation
This commit is contained in:
parent
3fecb36a19
commit
64cbccdda6
|
@ -140,20 +140,23 @@ struct paint_session
|
||||||
rct_drawpixelinfo DPI;
|
rct_drawpixelinfo DPI;
|
||||||
FixedVector<paint_entry, 4000> PaintStructs;
|
FixedVector<paint_entry, 4000> PaintStructs;
|
||||||
paint_struct* Quadrants[MAX_PAINT_QUADRANTS];
|
paint_struct* Quadrants[MAX_PAINT_QUADRANTS];
|
||||||
|
paint_struct* LastPS;
|
||||||
|
paint_string_struct* PSStringHead;
|
||||||
|
paint_string_struct* LastPSString;
|
||||||
|
attached_paint_struct* LastAttachedPS;
|
||||||
|
const TileElement* SurfaceElement;
|
||||||
|
const void* CurrentlyDrawnItem;
|
||||||
|
TileElement* PathElementOnSameHeight;
|
||||||
|
TileElement* TrackElementOnSameHeight;
|
||||||
paint_struct PaintHead;
|
paint_struct PaintHead;
|
||||||
uint32_t ViewFlags;
|
uint32_t ViewFlags;
|
||||||
uint32_t QuadrantBackIndex;
|
uint32_t QuadrantBackIndex;
|
||||||
uint32_t QuadrantFrontIndex;
|
uint32_t QuadrantFrontIndex;
|
||||||
const void* CurrentlyDrawnItem;
|
|
||||||
CoordsXY SpritePosition;
|
CoordsXY SpritePosition;
|
||||||
paint_struct* LastPS;
|
|
||||||
attached_paint_struct* LastAttachedPS;
|
|
||||||
ViewportInteractionItem InteractionType;
|
ViewportInteractionItem InteractionType;
|
||||||
uint8_t CurrentRotation;
|
uint8_t CurrentRotation;
|
||||||
support_height SupportSegments[9];
|
support_height SupportSegments[9];
|
||||||
support_height Support;
|
support_height Support;
|
||||||
paint_string_struct* PSStringHead;
|
|
||||||
paint_string_struct* LastPSString;
|
|
||||||
paint_struct* WoodenSupportsPrependTo;
|
paint_struct* WoodenSupportsPrependTo;
|
||||||
CoordsXY MapPosition;
|
CoordsXY MapPosition;
|
||||||
tunnel_entry LeftTunnels[TUNNEL_MAX_COUNT];
|
tunnel_entry LeftTunnels[TUNNEL_MAX_COUNT];
|
||||||
|
@ -161,9 +164,6 @@ struct paint_session
|
||||||
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
|
tunnel_entry RightTunnels[TUNNEL_MAX_COUNT];
|
||||||
uint8_t RightTunnelCount;
|
uint8_t RightTunnelCount;
|
||||||
uint8_t VerticalTunnelHeight;
|
uint8_t VerticalTunnelHeight;
|
||||||
const TileElement* SurfaceElement;
|
|
||||||
TileElement* PathElementOnSameHeight;
|
|
||||||
TileElement* TrackElementOnSameHeight;
|
|
||||||
bool DidPassSurface;
|
bool DidPassSurface;
|
||||||
uint8_t Unk141E9DB;
|
uint8_t Unk141E9DB;
|
||||||
uint16_t WaterHeight;
|
uint16_t WaterHeight;
|
||||||
|
|
|
@ -135,8 +135,7 @@ paint_session* Painter::CreateSession(rct_drawpixelinfo* dpi, uint32_t viewFlags
|
||||||
if (_freePaintSessions.empty() == false)
|
if (_freePaintSessions.empty() == false)
|
||||||
{
|
{
|
||||||
// Re-use.
|
// Re-use.
|
||||||
const size_t idx = _freePaintSessions.size() - 1;
|
session = _freePaintSessions.back();
|
||||||
session = _freePaintSessions[idx];
|
|
||||||
|
|
||||||
// Shrink by one.
|
// Shrink by one.
|
||||||
_freePaintSessions.pop_back();
|
_freePaintSessions.pop_back();
|
||||||
|
@ -149,17 +148,14 @@ paint_session* Painter::CreateSession(rct_drawpixelinfo* dpi, uint32_t viewFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
session->DPI = *dpi;
|
session->DPI = *dpi;
|
||||||
session->EndOfPaintStructArray = &session->PaintStructs[4000 - 1];
|
|
||||||
session->NextFreePaintStruct = session->PaintStructs;
|
|
||||||
session->LastPS = nullptr;
|
|
||||||
session->LastAttachedPS = nullptr;
|
|
||||||
session->ViewFlags = viewFlags;
|
session->ViewFlags = viewFlags;
|
||||||
for (auto& quadrant : session->Quadrants)
|
|
||||||
{
|
|
||||||
quadrant = nullptr;
|
|
||||||
}
|
|
||||||
session->QuadrantBackIndex = std::numeric_limits<uint32_t>::max();
|
session->QuadrantBackIndex = std::numeric_limits<uint32_t>::max();
|
||||||
session->QuadrantFrontIndex = 0;
|
session->QuadrantFrontIndex = 0;
|
||||||
|
session->PaintStructs.clear();
|
||||||
|
|
||||||
|
std::fill(std::begin(session->Quadrants), std::end(session->Quadrants), nullptr);
|
||||||
|
session->LastPS = nullptr;
|
||||||
|
session->LastAttachedPS = nullptr;
|
||||||
session->PSStringHead = nullptr;
|
session->PSStringHead = nullptr;
|
||||||
session->LastPSString = nullptr;
|
session->LastPSString = nullptr;
|
||||||
session->WoodenSupportsPrependTo = nullptr;
|
session->WoodenSupportsPrependTo = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue