#pragma once #include "F4TRemotePlayerState.h" #include #include #include #include namespace RE { class Actor; } namespace F4T::ProxyAnimationSync { // Confirmed via local read-by-name graph debug (Fallout4Together.log): // - float "Speed" reads/writes while in-game (walk ~47-105) // - bool "IsSprinting" reads while in-game // - bIsMoving, bIsSneaking, bSprint, bInJumpState, bWeaponDrawn, Direction: unavailable by name namespace GraphVar { inline constexpr const char* kSpeed = "Speed"; inline constexpr const char* kSpeedLower = "speed"; inline constexpr const char* kSpeedSampled = "speedSampled"; inline constexpr const char* kSpeedDamped = "speedDamped"; inline constexpr const char* kIsSprinting = "IsSprinting"; } // Maps network movementSpeed (units/sec) to graph Speed (~0-105). Used when the sender // does not provide animationGraphSpeed. float MapMovementSpeedToGraphSpeed(float a_movementSpeed, bool a_isSprinting); struct ProxyAppliedAnimationState { bool hasAppliedGraphState{ false }; bool lastIsMoving{ false }; bool lastIsSprinting{ false }; bool lastIsSneaking{ false }; bool lastIsJumping{ false }; bool lastWeaponDrawn{ false }; float lastGraphSpeed{ 0.0F }; float lastDirection{ 0.0F }; std::chrono::steady_clock::time_point movingHoldUntil{}; }; void ResetAppliedAnimationState(ProxyAppliedAnimationState& a_state); void ApplyProxyAnimationFromRemoteState( ProxyAppliedAnimationState& a_state, RE::Actor& a_proxy, const RemotePlayerState::RemotePlayerState& a_remotePlayer); void ClearProxyAnimationState( ProxyAppliedAnimationState& a_state, RE::Actor& a_proxy, std::uint32_t a_remotePlayerId, std::string_view a_reason); }