1- using Dalamud . Game ;
21using Dalamud . Game . ClientState . Conditions ;
32using Dalamud . Game . ClientState . Objects ;
43using Dalamud . Game . ClientState . Objects . Enums ;
@@ -20,8 +19,10 @@ public unsafe partial class RedrawService
2019 public const int GPoseEndIdx = GPosePlayerIdx + GPoseSlots ;
2120
2221 private readonly string ? [ ] _gPoseNames = new string ? [ GPoseSlots ] ;
23- private int _gPoseNameCounter = 0 ;
24- private bool _inGPose = false ;
22+ private int _gPoseNameCounter ;
23+
24+ private bool InGPose
25+ => _clientState . IsGPosing ;
2526
2627 // VFuncs that disable and enable draw, used only for GPose actors.
2728 private static void DisableDraw ( GameObject actor )
@@ -33,10 +34,7 @@ private static void EnableDraw(GameObject actor)
3334 // Check whether we currently are in GPose.
3435 // Also clear the name list.
3536 private void SetGPose ( )
36- {
37- _inGPose = _objects [ GPosePlayerIdx ] != null ;
38- _gPoseNameCounter = 0 ;
39- }
37+ => _gPoseNameCounter = 0 ;
4038
4139 private static bool IsGPoseActor ( int idx )
4240 => idx is >= GPosePlayerIdx and < GPoseEndIdx ;
@@ -50,7 +48,7 @@ private static bool IsGPoseActor(int idx)
5048 private bool FindCorrectActor ( int idx , out GameObject ? obj )
5149 {
5250 obj = _objects [ idx ] ;
53- if ( ! _inGPose || obj == null || IsGPoseActor ( idx ) )
51+ if ( ! InGPose || obj == null || IsGPoseActor ( idx ) )
5452 return false ;
5553
5654 var name = obj . Name . ToString ( ) ;
@@ -100,23 +98,25 @@ private static bool BadRedrawIndices(GameObject? actor, out int tableIndex)
10098
10199public sealed unsafe partial class RedrawService : IDisposable
102100{
103- private readonly IFramework _framework ;
101+ private readonly IFramework _framework ;
104102 private readonly IObjectTable _objects ;
105103 private readonly ITargetManager _targets ;
106- private readonly ICondition _conditions ;
104+ private readonly ICondition _conditions ;
105+ private readonly IClientState _clientState ;
107106
108107 private readonly List < int > _queue = new ( 100 ) ;
109108 private readonly List < int > _afterGPoseQueue = new ( GPoseSlots ) ;
110109 private int _target = - 1 ;
111110
112111 public event GameObjectRedrawnDelegate ? GameObjectRedrawn ;
113112
114- public RedrawService ( IFramework framework , IObjectTable objects , ITargetManager targets , ICondition conditions )
113+ public RedrawService ( IFramework framework , IObjectTable objects , ITargetManager targets , ICondition conditions , IClientState clientState )
115114 {
116115 _framework = framework ;
117116 _objects = objects ;
118117 _targets = targets ;
119118 _conditions = conditions ;
119+ _clientState = clientState ;
120120 _framework . Update += OnUpdateEvent ;
121121 }
122122
@@ -241,7 +241,7 @@ private void HandleRedraw()
241241
242242 private void HandleAfterGPose ( )
243243 {
244- if ( _afterGPoseQueue . Count == 0 || _inGPose )
244+ if ( _afterGPoseQueue . Count == 0 || InGPose )
245245 return ;
246246
247247 var numKept = 0 ;
0 commit comments