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

Method updateRoll

src/OpenLoco/src/Vehicles/VehicleBogie.cpp:71–91  ·  view source on GitHub ↗

0x004AAC02

Source from the content-addressed store, hash-verified

69
70 // 0x004AAC02
71 void VehicleBogie::updateRoll(const int32_t unkDistance)
72 {
73 auto unk = unkDistance / 8;
74 if (has38Flags(Flags38::isReversed))
75 {
76 unk = -unk;
77 }
78 var_44 += unk;
79
80 if (objectSpriteType != 0xFF)
81 {
82 auto* vehObj = ObjectManager::get<VehicleObject>(objectId);
83 auto& bogieSprites = vehObj->bogieSprites[objectSpriteType];
84 const auto newAnimationIndex = (bogieSprites.numAnimationFrames - 1) & (var_44 / 4096);
85 if (newAnimationIndex != animationIndex)
86 {
87 animationIndex = newAnimationIndex;
88 invalidateSprite();
89 }
90 }
91 }
92
93 // To replace several instances of the same exact code in
94 // VehicleBogie::updateSegmentCrashed(). Returns true if the

Callers 1

updateSegmentCrashedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected