MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / freshenActiveState

Method freshenActiveState

source/base/StarAnimatedPartSet.cpp:246–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void AnimatedPartSet::freshenActiveState(StateType& stateType) {
247 if (stateType.activeStateDirty) {
248 auto const& state = *stateType.activeStatePointer;
249 auto& activeState = stateType.activeState;
250 activeState.frame = clamp<int>(activeState.timer / state.cycle * state.frames, 0, state.frames - 1);
251
252 activeState.properties = stateType.stateTypeProperties;
253 activeState.properties.merge(state.stateProperties, true);
254
255 for (auto const& pair : state.stateFrameProperties) {
256 if (activeState.frame < pair.second.size())
257 activeState.properties[pair.first] = pair.second.get(activeState.frame);
258 }
259
260 stateType.activeStateDirty = false;
261 }
262}
263
264void AnimatedPartSet::freshenActivePart(Part& part) {
265 if (part.activePartDirty) {

Callers 2

forEachActiveStateMethod · 0.80

Calls 3

mergeMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected