0x00456E32
| 244 | |
| 245 | // 0x00456E32 |
| 246 | bool updateIndustryAnimation1(const Animation& anim) |
| 247 | { |
| 248 | auto tile = TileManager::get(anim.pos); |
| 249 | for (auto& el : tile) |
| 250 | { |
| 251 | auto* elIndustry = el.as<IndustryElement>(); |
| 252 | if (elIndustry == nullptr) |
| 253 | { |
| 254 | continue; |
| 255 | } |
| 256 | if (elIndustry->baseZ() != anim.baseZ) |
| 257 | { |
| 258 | continue; |
| 259 | } |
| 260 | |
| 261 | auto* industry = elIndustry->industry(); |
| 262 | const auto* indObj = industry->getObject(); |
| 263 | const auto buildingParts = indObj->getBuildingParts(elIndustry->buildingType()); |
| 264 | const auto buildingPartAnims = indObj->getBuildingPartAnimations(); |
| 265 | bool hasAnimation = false; |
| 266 | uint8_t animSpeed = std::numeric_limits<uint8_t>::max(); |
| 267 | for (auto& part : buildingParts) |
| 268 | { |
| 269 | auto& partAnim = buildingPartAnims[part]; |
| 270 | if (partAnim.numFrames > 1) |
| 271 | { |
| 272 | hasAnimation = true; |
| 273 | animSpeed = std::min<uint8_t>(animSpeed, partAnim.animationSpeed & ~(1 << 7)); |
| 274 | } |
| 275 | } |
| 276 | if (!hasAnimation) |
| 277 | { |
| 278 | return true; |
| 279 | } |
| 280 | const auto speedMask = ((1 << animSpeed) - 1); |
| 281 | if (!(ScenarioManager::getScenarioTicks() & speedMask)) |
| 282 | { |
| 283 | Ui::ViewportManager::invalidate(anim.pos, el.baseHeight(), el.clearHeight(), ZoomLevel::quarter); |
| 284 | } |
| 285 | return false; |
| 286 | } |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | // 0x00456EEB |
| 291 | bool updateIndustryAnimation2(const Animation& anim) |
no test coverage detected