MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / onUpdateByInput

Method onUpdateByInput

src/logic/PlayerController.cpp:520–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

518}
519
520void PlayerController::onUpdateByInput(float deltaTime)
521{
522 ModelVisual* model = getModelVisual();
523
524 if (!model)
525 return;
526
527 if (m_World.getDialogManager().isDialogActive())
528 return;
529
530 if (m_World.getEngine()->getHud().isMenuActive())
531 resetKeyStates();
532
533 // Stand up if wounded
534 if (getModelVisual()->isAnimPlaying("S_WOUNDEDB") && getBodyState() == EBodyState::BS_UNCONSCIOUS)
535 {
536 // Only stand up if the unconscious-state has ended (aka. is not valid anymore)
537 // Otherwise, the player would fall down immediately
538 if (m_AIStateMachine.isStateActive())
539 {
540 // FIXME: End UNCONSCIOUS-state here
541
542 getEM().onMessage(EventMessages::ConversationMessage::playAnimation("T_WOUNDEDB_2_STAND"));
543 setBodyState(EBodyState::BS_STAND);
544 }
545 }
546
547 if (!getEM().isEmpty() || getUsedMob().isValid())
548 return;
549
550 // TODO: HACK, take this out!
551 float moveMod = 1.0f;
552 if (m_MoveSpeed1)
553 moveMod *= 4.0f;
554
555 if (m_MoveSpeed2)
556 moveMod *= 16.0f;
557
558 m_MoveSpeed2 = false;
559 m_MoveSpeed1 = false;
560
561 getModelVisual()->getAnimationHandler().setSpeedMultiplier(moveMod);
562
563 m_AIHandler.playerUpdate(deltaTime);
564}
565
566void PlayerController::onMessage(SharedEMessage message, Handle::EntityHandle sourceVob)
567{

Callers 1

onFrameUpdateMethod · 0.80

Calls 10

isDialogActiveMethod · 0.80
isMenuActiveMethod · 0.80
getEngineMethod · 0.80
isAnimPlayingMethod · 0.80
isStateActiveMethod · 0.80
isEmptyMethod · 0.80
setSpeedMultiplierMethod · 0.80
playerUpdateMethod · 0.80
onMessageMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected