0x0042E646
| 241 | |
| 242 | // 0x0042E646 |
| 243 | bool updateBuildingAnimation2(const Animation& anim) |
| 244 | { |
| 245 | auto tile = TileManager::get(anim.pos); |
| 246 | BuildingElement* elBuilding = nullptr; |
| 247 | for (auto& el : tile) |
| 248 | { |
| 249 | elBuilding = el.as<BuildingElement>(); |
| 250 | if (elBuilding == nullptr) |
| 251 | { |
| 252 | continue; |
| 253 | } |
| 254 | if (elBuilding->baseZ() != anim.baseZ) |
| 255 | { |
| 256 | continue; |
| 257 | } |
| 258 | break; |
| 259 | } |
| 260 | |
| 261 | if (elBuilding == nullptr) |
| 262 | { |
| 263 | return true; |
| 264 | } |
| 265 | |
| 266 | auto* buildingObj = elBuilding->getObject(); |
| 267 | const auto parts = buildingObj->getBuildingParts(elBuilding->variation()); |
| 268 | const auto partAnimations = buildingObj->getBuildingPartAnimations(); |
| 269 | uint8_t slowestSpeed = 0xFF; |
| 270 | uint8_t numFrames = 0; |
| 271 | for (auto part : parts) |
| 272 | { |
| 273 | auto& partAnim = partAnimations[part]; |
| 274 | const uint8_t animSpeed = partAnim.animationSpeed & ~(1U << 7); |
| 275 | if (partAnim.numFrames == 0) |
| 276 | { |
| 277 | continue; |
| 278 | } |
| 279 | numFrames |= partAnim.numFrames; |
| 280 | if (partAnim.numFrames == 1) |
| 281 | { |
| 282 | continue; |
| 283 | } |
| 284 | slowestSpeed = std::min(slowestSpeed, animSpeed); |
| 285 | } |
| 286 | if (numFrames <= 1) |
| 287 | { |
| 288 | return true; |
| 289 | } |
| 290 | const auto speedMask = ((1 << slowestSpeed) - 1); |
| 291 | if (!(ScenarioManager::getScenarioTicks() & speedMask)) |
| 292 | { |
| 293 | Ui::ViewportManager::invalidate(anim.pos, elBuilding->baseHeight(), elBuilding->clearHeight(), ZoomLevel::quarter); |
| 294 | } |
| 295 | return false; |
| 296 | } |
| 297 | } |
no test coverage detected