* Extracted from 0x0098196c, 0x0098197c, 0x0098198c, 0x0098199c */
| 175 | * Extracted from 0x0098196c, 0x0098197c, 0x0098198c, 0x0098199c |
| 176 | */ |
| 177 | static PaintStruct* CreateNormalPaintStruct( |
| 178 | PaintSession& session, ImageId image_id, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) |
| 179 | { |
| 180 | auto* const g1 = GfxGetG1Element(image_id); |
| 181 | if (g1 == nullptr) |
| 182 | { |
| 183 | return nullptr; |
| 184 | } |
| 185 | |
| 186 | const auto swappedRotation = DirectionFlipXAxis(session.CurrentRotation); |
| 187 | auto swappedRotCoord = CoordsXYZ{ offset.Rotate(swappedRotation), offset.z }; |
| 188 | swappedRotCoord += session.SpritePosition; |
| 189 | |
| 190 | const auto imagePos = Translate3DTo2DWithZ(session.CurrentRotation, swappedRotCoord); |
| 191 | |
| 192 | if (!imageWithinRT(imagePos, *g1, session.rt)) |
| 193 | { |
| 194 | return nullptr; |
| 195 | } |
| 196 | |
| 197 | const auto rotBoundBoxOffset = CoordsXYZ{ boundBox.offset.Rotate(swappedRotation), boundBox.offset.z }; |
| 198 | const auto rotBoundBoxSize = RotateBoundBoxSize(boundBox.length, session.CurrentRotation); |
| 199 | |
| 200 | auto* ps = session.AllocateNormalPaintEntry(); |
| 201 | if (ps == nullptr) |
| 202 | { |
| 203 | return nullptr; |
| 204 | } |
| 205 | |
| 206 | ps->image_id = image_id; |
| 207 | ps->ScreenPos = imagePos; |
| 208 | ps->Bounds.x_end = rotBoundBoxSize.x + rotBoundBoxOffset.x + session.SpritePosition.x; |
| 209 | ps->Bounds.y_end = rotBoundBoxSize.y + rotBoundBoxOffset.y + session.SpritePosition.y; |
| 210 | ps->Bounds.z_end = rotBoundBoxSize.z + rotBoundBoxOffset.z; |
| 211 | ps->Bounds.x = rotBoundBoxOffset.x + session.SpritePosition.x; |
| 212 | ps->Bounds.y = rotBoundBoxOffset.y + session.SpritePosition.y; |
| 213 | ps->Bounds.z = rotBoundBoxOffset.z; |
| 214 | ps->Attached = nullptr; |
| 215 | ps->Children = nullptr; |
| 216 | ps->NextQuadrantEntry = nullptr; |
| 217 | ps->InteractionItem = session.InteractionType; |
| 218 | ps->MapPos = session.MapPosition; |
| 219 | ps->Element = session.CurrentlyDrawnTileElement; |
| 220 | ps->Entity = session.CurrentlyDrawnEntity; |
| 221 | |
| 222 | return ps; |
| 223 | } |
| 224 | |
| 225 | static PaintStruct* CreateNormalPaintStructHeight( |
| 226 | PaintSession& session, const ImageId imageId, const int32_t height, const CoordsXYZ& offset, const BoundBoxXYZ& boundBox) |
no test coverage detected