| 8 | { |
| 9 | |
| 10 | void TileObjectProjectile::draw(Renderer &r, TileTransform &transform, Vec2<float> screenPosition, |
| 11 | TileViewMode mode, bool visible, int, bool, bool) |
| 12 | { |
| 13 | // Mode isn't used as TileView::tileToScreenCoords already transforms according to the mode |
| 14 | std::ignore = mode; |
| 15 | auto projectile = this->projectile.lock(); |
| 16 | if (!projectile) |
| 17 | { |
| 18 | LogError("Called with no owning projectile object"); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | if (projectile->delay_ticks_remaining > 0) |
| 23 | { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | auto sprite_it = projectile->projectile_sprites.begin(); |
| 28 | for (auto &point : projectile->spritePositions) |
| 29 | { |
| 30 | auto pos = screenPosition + transform.tileToScreenCoords(point - projectile->position); |
| 31 | |
| 32 | if (sprite_it == projectile->projectile_sprites.end()) |
| 33 | { |
| 34 | // Some beams have tails longer than sprite list, |
| 35 | // Some missiles too, but they will look buggy if we repeat them |
| 36 | if (projectile->type == Projectile::Type::Missile) |
| 37 | break; |
| 38 | else |
| 39 | sprite_it = projectile->projectile_sprites.begin(); |
| 40 | } |
| 41 | if (*sprite_it != nullptr) |
| 42 | { |
| 43 | drawTinted(r, *sprite_it, pos, visible); |
| 44 | } |
| 45 | sprite_it++; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | TileObjectProjectile::~TileObjectProjectile() = default; |
| 50 |
nothing calls this directly
no test coverage detected