Stop window actors from redrawing/unloading.

This commit is contained in:
Ottermandias 2022-05-31 22:06:09 +02:00
parent 81435b4ff2
commit 630469fc0e

View file

@ -36,48 +36,61 @@ public sealed unsafe class ObjectReloader : IDisposable
private static int ObjectTableIndex( GameObject actor ) private static int ObjectTableIndex( GameObject actor )
=> ( ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )actor.Address )->ObjectIndex; => ( ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )actor.Address )->ObjectIndex;
private static void WriteInvisible( GameObject? actor ) private static bool BadRedrawIndices( GameObject? actor, out int tableIndex )
{ {
if( actor == null ) if( actor == null )
{
tableIndex = -1;
return true;
}
tableIndex = ObjectTableIndex( actor );
return tableIndex is >= 240 and < 245;
}
private static void WriteInvisible( GameObject? actor )
{
if( BadRedrawIndices( actor, out var tableIndex ) )
{ {
return; return;
} }
*ActorDrawState( actor ) |= DrawState.Invisibility; *ActorDrawState( actor! ) |= DrawState.Invisibility;
if( ObjectTableIndex( actor ) is >= GPosePlayerIdx and < GPoseEndIdx ) if( tableIndex is >= GPosePlayerIdx and < GPoseEndIdx )
{ {
DisableDraw( actor ); DisableDraw( actor! );
} }
} }
private static void WriteVisible( GameObject? actor ) private static void WriteVisible( GameObject? actor )
{ {
if( actor == null ) if( BadRedrawIndices( actor, out var tableIndex ) )
{ {
return; return;
} }
*ActorDrawState( actor ) &= ~DrawState.Invisibility; *ActorDrawState( actor! ) &= ~DrawState.Invisibility;
if( ObjectTableIndex( actor ) is >= GPosePlayerIdx and < GPoseEndIdx ) if( tableIndex is >= GPosePlayerIdx and < GPoseEndIdx )
{ {
EnableDraw( actor ); EnableDraw( actor! );
} }
} }
private void ReloadActor( GameObject? actor ) private void ReloadActor( GameObject? actor )
{ {
if( actor != null ) if( BadRedrawIndices( actor, out var tableIndex ) )
{ {
var idx = ObjectTableIndex( actor ); return;
if( actor.Address == Dalamud.Targets.Target?.Address )
{
_target = idx;
}
_queue.Add( ~idx );
} }
if( actor!.Address == Dalamud.Targets.Target?.Address )
{
_target = tableIndex;
}
_queue.Add( ~tableIndex );
} }
private void ReloadActorAfterGPose( GameObject? actor ) private void ReloadActorAfterGPose( GameObject? actor )