MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / Tween

Method Tween

src/openrct2/entity/EntityTweener.cpp:141–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139 }
140
141 void EntityTweener::Tween(float alpha)
142 {
143 const float inv = (1.0f - alpha);
144 for (size_t i = 0; i < Entities.size(); ++i)
145 {
146 auto* ent = Entities[i];
147 if (ent == nullptr)
148 continue;
149
150 auto& posA = PrePos[i];
151 auto& posB = PostPos[i];
152
153 if (posA == posB)
154 continue;
155
156 ent->moveTo(
157 { static_cast<int32_t>(std::round(posB.x * alpha + posA.x * inv)),
158 static_cast<int32_t>(std::round(posB.y * alpha + posA.y * inv)),
159 static_cast<int32_t>(std::round(posB.z * alpha + posA.z * inv)) });
160 }
161 }
162
163 void EntityTweener::Restore()
164 {

Callers 1

RunVariableFrameMethod · 0.80

Calls 2

moveToMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected