| 61 | } |
| 62 | |
| 63 | sp<Image> Doodad::getSprite() |
| 64 | { |
| 65 | if (this->sprite) |
| 66 | return sprite; |
| 67 | int animTime = 0; |
| 68 | sp<Image> frame; |
| 69 | for (auto &f : type->frames) |
| 70 | { |
| 71 | frame = f.image; |
| 72 | animTime += f.time * TICKS_MULTIPLIER; |
| 73 | if (animTime > age) |
| 74 | return frame; |
| 75 | } |
| 76 | LogWarning("Doodad reached age %d with no frame", age); |
| 77 | return frame; |
| 78 | } |
| 79 | |
| 80 | } // namespace OpenApoc |