MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / updateBuildingAnimation1

Function updateBuildingAnimation1

src/OpenLoco/src/Map/BuildingElement.cpp:195–240  ·  view source on GitHub ↗

0x0042E4D4

Source from the content-addressed store, hash-verified

193
194 // 0x0042E4D4
195 bool updateBuildingAnimation1(const Animation& anim)
196 {
197 auto tile = TileManager::get(anim.pos);
198 BuildingElement* elBuilding = nullptr;
199 for (auto& el : tile)
200 {
201 elBuilding = el.as<BuildingElement>();
202 if (elBuilding == nullptr)
203 {
204 continue;
205 }
206 if (elBuilding->baseZ() != anim.baseZ)
207 {
208 continue;
209 }
210 break;
211 }
212
213 if (elBuilding == nullptr)
214 {
215 return true;
216 }
217 // Animations are controlled from index 0
218 if (elBuilding->sequenceIndex() != 0)
219 {
220 return true;
221 }
222
223 auto* buildingObj = elBuilding->getObject();
224 if (buildingObj->numElevatorSequences == 0)
225 {
226 return true;
227 }
228
229 if (ScenarioManager::getScenarioTicks() & 0b1)
230 {
231 return false;
232 }
233
234 bool isMultiTile = buildingObj->hasFlags(BuildingObjectFlags::largeTile);
235
236 applyToMultiTile(*elBuilding, anim.pos, isMultiTile, [](World::BuildingElement& elBuilding, const World::Pos2& pos) {
237 Ui::ViewportManager::invalidate(pos, elBuilding.baseHeight(), elBuilding.clearHeight(), ZoomLevel::half);
238 });
239 return false;
240 }
241
242 // 0x0042E646
243 bool updateBuildingAnimation2(const Animation& anim)

Callers 1

callUpdateFunctionFunction · 0.85

Calls 10

getScenarioTicksFunction · 0.85
baseZMethod · 0.80
baseHeightMethod · 0.80
clearHeightMethod · 0.80
getFunction · 0.70
applyToMultiTileFunction · 0.70
invalidateFunction · 0.50
sequenceIndexMethod · 0.45
getObjectMethod · 0.45
hasFlagsMethod · 0.45

Tested by

no test coverage detected