MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / updateState

Method updateState

Engine/source/T3D/player.cpp:2273–2326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2271}
2272
2273void Player::updateState()
2274{
2275 switch (mState)
2276 {
2277 case RecoverState:
2278 if (mDataBlock->landSequenceTime > 0.0f)
2279 {
2280 // Count down the land time
2281 mRecoverDelay -= TickSec;
2282 if (mRecoverDelay <= 0.0f)
2283 {
2284 setState(MoveState);
2285 }
2286 }
2287 else
2288 {
2289 // Legacy recover system
2290 if (mRecoverTicks-- <= 0)
2291 {
2292 if (mReversePending && mActionAnimation.action != PlayerData::NullAnimation)
2293 {
2294 // this serves and counter, and direction state
2295 mRecoverTicks = mReversePending;
2296 mActionAnimation.forward = false;
2297
2298 S32 seq = mDataBlock->actionList[mActionAnimation.action].sequence;
2299 S32 imageBasedSeq = convertActionToImagePrefix(mActionAnimation.action);
2300 if (imageBasedSeq != -1)
2301 seq = imageBasedSeq;
2302
2303 F32 pos = mShapeInstance->getPos(mActionAnimation.thread);
2304
2305 mShapeInstance->setTimeScale(mActionAnimation.thread, -sLandReverseScale);
2306 mShapeInstance->transitionToSequence(mActionAnimation.thread,
2307 seq, pos, sAnimationTransitionTime, true);
2308 mReversePending = 0;
2309 }
2310 else
2311 {
2312 setState(MoveState);
2313 }
2314 } // Stand back up slowly only if not moving much-
2315 else if (!mReversePending && mVelocity.lenSquared() > sSlowStandThreshSquared)
2316 {
2317 mActionAnimation.waitForEnd = false;
2318 setState(MoveState);
2319 }
2320 }
2321 break;
2322
2323 default:
2324 break;
2325 }
2326}
2327
2328const char* Player::getStateName()
2329{

Callers

nothing calls this directly

Calls 4

transitionToSequenceMethod · 0.80
getPosMethod · 0.45
setTimeScaleMethod · 0.45
lenSquaredMethod · 0.45

Tested by

no test coverage detected