diff --git a/Source/Scripts/sslActorAlias.psc b/Source/Scripts/sslActorAlias.psc index 091a2c85..ef1b1374 100644 --- a/Source/Scripts/sslActorAlias.psc +++ b/Source/Scripts/sslActorAlias.psc @@ -196,25 +196,6 @@ Function SetPathing(int aiPathingFlag) _PathingFlag = PapyrusUtil.ClampInt(_PathingFlag, PATHING_DISABLE, PATHING_FORCE) EndFunction -; ------------------------------------------------------- ; -; --- AnimSpeed --- ; -; ------------------------------------------------------- ; - -Function UpdateBaseSpeed(float afBaseSpeed) - _AnimationSpeedBase = afBaseSpeed -EndFunction - -Function UpdateAnimationSpeed() - If (!sslSystemConfig.HasAnimSpeedSE()) - return - EndIf - float animSpeed = _AnimationSpeedBase - If (_Config.SetAnimSpeedByEnjoyment) - animSpeed *= PapyrusUtil.ClampFloat((GetFullEnjoyment() as float) / 90, 0.8, 1.2) - EndIf - sslAnimSpeedHelper.SetAnimationSpeed(_ActorRef, animSpeed, UPDATE_INTERVAL / 2, 0) -EndFunction - ; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ; ; ----------------------------------------------------------------------------- ; ; ██╗███╗ ██╗████████╗███████╗██████╗ ███╗ ██╗ █████╗ ██╗ ; @@ -269,8 +250,6 @@ Actor _killer int _AnimVarIsNPC bool _AnimVarbHumanoidFootIKDisable -float _AnimationSpeedBase - ; Center ObjectReference _myMarker @@ -739,7 +718,6 @@ State Animating _LoopEnjoymentDelay = 0 UpdateEffectiveEnjoymentCalculations() EndIf - UpdateAnimationSpeed() int strength = CalcReaction() If (_LoopDelay >= _VoiceDelay && !IsSilent) _LoopDelay = 0.0 @@ -1165,7 +1143,6 @@ Function Initialize() ; Floats _LastOrgasm = 0.0 _StartedAt = 0.0 - _AnimationSpeedBase = 1.0 ResetEnjoymentVariables() EndFunction diff --git a/Source/Scripts/sslThreadController.psc b/Source/Scripts/sslThreadController.psc index 74a3966a..60882a83 100644 --- a/Source/Scripts/sslThreadController.psc +++ b/Source/Scripts/sslThreadController.psc @@ -86,11 +86,7 @@ Event MenuEvent(string asEventName, string asStringArg, float afNumArg, form akS Log("SetSpeed: AnimSpeedSE not found") return EndIf - int i = 0 - While (i < ActorAlias.Length) - ActorAlias[i].UpdateBaseSpeed(afNumArg) - i += 1 - EndWhile + UpdateBaseSpeed(afNumArg) If (afNumArg == 0.0) _AutoAdvanceCache = AutoAdvance as int AutoAdvance = false diff --git a/Source/Scripts/sslThreadModel.psc b/Source/Scripts/sslThreadModel.psc index 4654a59f..94597574 100644 --- a/Source/Scripts/sslThreadModel.psc +++ b/Source/Scripts/sslThreadModel.psc @@ -1111,6 +1111,7 @@ State Animating _SFXTimer = 0.8 EndIf EndIf + UpdateAnimationSpeed() RegisterForSingleUpdate(ANIMATING_UPDATE_INTERVAL) EndEvent @@ -1642,6 +1643,7 @@ Function Initialize() _ThreadTags = Utility.CreateStringArray(0) _ContextTags = Utility.CreateStringArray(0) _Hooks = Utility.CreateStringArray(0) + _AnimationSpeedBase = 1.0 ; Enter thread selection pool DestroyInstance() GoToState(STATE_IDLE) @@ -2485,6 +2487,45 @@ Function ProcessEnjGameArg(String arg = "", Actor akActor, Actor akPartner, floa EndIf EndFunction +; -------------------------------------------------- ; +; --- AnimSpeed --- ; +; -------------------------------------------------- ; + +float _AnimationSpeedBase + +Function UpdateBaseSpeed(float afBaseSpeed) + _AnimationSpeedBase = afBaseSpeed +EndFunction + +float Function CalcInstThreadAnimSpeed() + float animSpeed = 0.0 + If (Config.SetAnimSpeedByEnjoyment) + int i = 0 + While (i < _Positions.Length) + float actorSpeed = _AnimationSpeedBase * PapyrusUtil.ClampFloat(GetEnjoyment(_Positions[i]) as float / 90, 0.8, 1.2) + If (actorSpeed > animSpeed) + animSpeed = actorSpeed + EndIf + i += 1 + EndWhile + Else + animSpeed = _AnimationSpeedBase + EndIf + return animSpeed +EndFunction + +Function UpdateAnimationSpeed() + If (!sslSystemConfig.HasAnimSpeedSE()) + return + EndIf + float animSpeed = CalcInstThreadAnimSpeed() + int i = 0 + While (i < _Positions.Length) + sslAnimSpeedHelper.SetAnimationSpeed(_Positions[i], animSpeed, ANIMATING_UPDATE_INTERVAL / 3, 0) + i += 1 + EndWhile +EndFunction + ; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ; ; ----------------------------------------------------------------------------- ; ; ██╗ ███████╗ ██████╗ █████╗ ██████╗██╗ ██╗ ;