Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions Source/Scripts/sslActorAlias.psc
Original file line number Diff line number Diff line change
Expand Up @@ -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

; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ;
; ----------------------------------------------------------------------------- ;
; ██╗███╗ ██╗████████╗███████╗██████╗ ███╗ ██╗ █████╗ ██╗ ;
Expand Down Expand Up @@ -269,8 +250,6 @@ Actor _killer
int _AnimVarIsNPC
bool _AnimVarbHumanoidFootIKDisable

float _AnimationSpeedBase

; Center
ObjectReference _myMarker

Expand Down Expand Up @@ -739,7 +718,6 @@ State Animating
_LoopEnjoymentDelay = 0
UpdateEffectiveEnjoymentCalculations()
EndIf
UpdateAnimationSpeed()
int strength = CalcReaction()
If (_LoopDelay >= _VoiceDelay && !IsSilent)
_LoopDelay = 0.0
Expand Down Expand Up @@ -1165,7 +1143,6 @@ Function Initialize()
; Floats
_LastOrgasm = 0.0
_StartedAt = 0.0
_AnimationSpeedBase = 1.0
ResetEnjoymentVariables()
EndFunction

Expand Down
6 changes: 1 addition & 5 deletions Source/Scripts/sslThreadController.psc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions Source/Scripts/sslThreadModel.psc
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ State Animating
_SFXTimer = 0.8
EndIf
EndIf
UpdateAnimationSpeed()
RegisterForSingleUpdate(ANIMATING_UPDATE_INTERVAL)
EndEvent

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

; *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ;
; ----------------------------------------------------------------------------- ;
; ██╗ ███████╗ ██████╗ █████╗ ██████╗██╗ ██╗ ;
Expand Down