| 554 | } |
| 555 | |
| 556 | PaintStruct* PaintSession::createNormalPaintStruct(ImageId imageId, const World::Pos3& offset, const World::Pos3& boundBoxOffset, const World::Pos3& boundBoxSize) |
| 557 | { |
| 558 | auto* const g1 = Gfx::getG1Element(imageId.getIndex()); |
| 559 | if (g1 == nullptr) |
| 560 | { |
| 561 | return nullptr; |
| 562 | } |
| 563 | |
| 564 | const auto swappedRotation = directionFlipXAxis(currentRotation); |
| 565 | auto swappedRotCoord = World::Pos3{ Math::Vector::rotate(offset, swappedRotation), offset.z }; |
| 566 | swappedRotCoord += World::Pos3{ getSpritePosition(), 0 }; |
| 567 | |
| 568 | const auto vpPos = World::gameToScreen(swappedRotCoord, currentRotation); |
| 569 | |
| 570 | if (!imageWithinRT(vpPos, *g1, *_renderTarget)) |
| 571 | { |
| 572 | return nullptr; |
| 573 | } |
| 574 | |
| 575 | const auto rotBoundBoxOffset = World::Pos3{ Math::Vector::rotate(boundBoxOffset, swappedRotation), boundBoxOffset.z }; |
| 576 | const auto rotBoundBoxSize = rotateBoundBoxSize(boundBoxSize, currentRotation); |
| 577 | |
| 578 | auto* ps = allocatePaintStruct<PaintStruct>(); |
| 579 | if (ps == nullptr) |
| 580 | { |
| 581 | return nullptr; |
| 582 | } |
| 583 | |
| 584 | const auto spritePos = getSpritePosition(); |
| 585 | ps->imageId = imageId; |
| 586 | ps->vpPos = { vpPos.x, vpPos.y }; |
| 587 | ps->bounds.mins = rotBoundBoxOffset + World::Pos3{ spritePos.x, spritePos.y, 0 }; |
| 588 | ps->bounds.maxs = rotBoundBoxOffset + rotBoundBoxSize + World::Pos3{ spritePos.x, spritePos.y, 0 }; |
| 589 | ps->flags = PaintStructFlags::none; |
| 590 | ps->attachedPS = nullptr; |
| 591 | ps->children = nullptr; |
| 592 | ps->type = _itemType; |
| 593 | ps->modId = _trackModId; |
| 594 | ps->mapPos = _mapPosition; |
| 595 | ps->tileElement = reinterpret_cast<World::TileElement*>(_currentItem); |
| 596 | return ps; |
| 597 | } |
| 598 | |
| 599 | // 0x004622A2 |
| 600 | void PaintSession::generate() |
nothing calls this directly
no test coverage detected