This commit is contained in:
Ottermandias 2022-03-26 18:34:32 +01:00
parent bc47e08e08
commit 9a0b0bfa0f
35 changed files with 1365 additions and 1997 deletions

View file

@ -8,6 +8,7 @@ using FFXIVClientStructs.FFXIV.Client.Game.Character;
using FFXIVClientStructs.FFXIV.Client.Game.Object;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Penumbra.Collections;
using Penumbra.GameData.ByteString;
using Penumbra.Mods;
using ObjectKind = Dalamud.Game.ClientState.Objects.Enums.ObjectKind;
@ -90,10 +91,10 @@ public unsafe partial class PathResolver
// This map links DrawObjects directly to Actors (by ObjectTable index) and their collections.
// It contains any DrawObjects that correspond to a human actor, even those without specific collections.
internal readonly Dictionary< IntPtr, (ModCollection, int) > DrawObjectToObject = new();
internal readonly Dictionary< IntPtr, (ModCollection2, int) > DrawObjectToObject = new();
// This map links files to their corresponding collection, if it is non-default.
internal readonly ConcurrentDictionary< Utf8String, ModCollection > PathCollections = new();
internal readonly ConcurrentDictionary< Utf8String, ModCollection2 > PathCollections = new();
internal GameObject* LastGameObject = null;
@ -158,11 +159,11 @@ public unsafe partial class PathResolver
}
// Identify the correct collection for a GameObject by index and name.
private static ModCollection IdentifyCollection( GameObject* gameObject )
private static ModCollection2 IdentifyCollection( GameObject* gameObject )
{
if( gameObject == null )
{
return Penumbra.CollectionManager.DefaultCollection;
return Penumbra.CollectionManager.Default;
}
var name = gameObject->ObjectIndex switch
@ -175,13 +176,11 @@ public unsafe partial class PathResolver
}
?? new Utf8String( gameObject->Name ).ToString();
return Penumbra.CollectionManager.CharacterCollection.TryGetValue( name, out var col )
? col
: Penumbra.CollectionManager.DefaultCollection;
return Penumbra.CollectionManager.Character( name );
}
// Update collections linked to Game/DrawObjects due to a change in collection configuration.
private void CheckCollections( ModCollection? _1, ModCollection? _2, CollectionType type, string? name )
private void CheckCollections( ModCollection2? _1, ModCollection2? _2, CollectionType type, string? name )
{
if( type is not (CollectionType.Character or CollectionType.Default) )
{
@ -201,7 +200,7 @@ public unsafe partial class PathResolver
}
// Use the stored information to find the GameObject and Collection linked to a DrawObject.
private GameObject* FindParent( IntPtr drawObject, out ModCollection collection )
private GameObject* FindParent( IntPtr drawObject, out ModCollection2 collection )
{
if( DrawObjectToObject.TryGetValue( drawObject, out var data ) )
{
@ -226,7 +225,7 @@ public unsafe partial class PathResolver
// Special handling for paths so that we do not store non-owned temporary strings in the dictionary.
private void SetCollection( Utf8String path, ModCollection collection )
private void SetCollection( Utf8String path, ModCollection2 collection )
{
if( PathCollections.ContainsKey( path ) || path.IsOwned )
{