mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Rename SpecialActor -> ScreenActor, add new ScreenActors.
This commit is contained in:
parent
27fed7860d
commit
79eee0e2c7
5 changed files with 32 additions and 29 deletions
|
|
@ -19,7 +19,7 @@ public readonly struct ActorIdentifier : IEquatable<ActorIdentifier>
|
||||||
[FieldOffset( 1 )] public readonly ObjectKind Kind; // Npc, Owned
|
[FieldOffset( 1 )] public readonly ObjectKind Kind; // Npc, Owned
|
||||||
[FieldOffset( 2 )] public readonly ushort HomeWorld; // Player, Owned
|
[FieldOffset( 2 )] public readonly ushort HomeWorld; // Player, Owned
|
||||||
[FieldOffset( 2 )] public readonly ushort Index; // NPC
|
[FieldOffset( 2 )] public readonly ushort Index; // NPC
|
||||||
[FieldOffset( 2 )] public readonly SpecialActor Special; // Special
|
[FieldOffset( 2 )] public readonly ScreenActor Special; // Special
|
||||||
[FieldOffset( 4 )] public readonly uint DataId; // Owned, NPC
|
[FieldOffset( 4 )] public readonly uint DataId; // Owned, NPC
|
||||||
[FieldOffset( 8 )] public readonly ByteString PlayerName; // Player, Owned
|
[FieldOffset( 8 )] public readonly ByteString PlayerName; // Player, Owned
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
@ -91,7 +91,7 @@ public readonly struct ActorIdentifier : IEquatable<ActorIdentifier>
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
Kind = kind;
|
Kind = kind;
|
||||||
Special = (SpecialActor)index;
|
Special = (ScreenActor)index;
|
||||||
HomeWorld = Index = index;
|
HomeWorld = Index = index;
|
||||||
DataId = data;
|
DataId = data;
|
||||||
PlayerName = playerName;
|
PlayerName = playerName;
|
||||||
|
|
@ -189,14 +189,14 @@ public static class ActorManagerExtensions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fixed names for special actors.
|
/// Fixed names for special actors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ToName(this SpecialActor actor)
|
public static string ToName(this ScreenActor actor)
|
||||||
=> actor switch
|
=> actor switch
|
||||||
{
|
{
|
||||||
SpecialActor.CharacterScreen => "Character Screen Actor",
|
ScreenActor.CharacterScreen => "Character Screen Actor",
|
||||||
SpecialActor.ExamineScreen => "Examine Screen Actor",
|
ScreenActor.ExamineScreen => "Examine Screen Actor",
|
||||||
SpecialActor.FittingRoom => "Fitting Room Actor",
|
ScreenActor.FittingRoom => "Fitting Room Actor",
|
||||||
SpecialActor.DyePreview => "Dye Preview Actor",
|
ScreenActor.DyePreview => "Dye Preview Actor",
|
||||||
SpecialActor.Portrait => "Portrait Actor",
|
ScreenActor.Portrait => "Portrait Actor",
|
||||||
_ => "Invalid",
|
_ => "Invalid",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public partial class ActorManager
|
||||||
}
|
}
|
||||||
case IdentifierType.Special:
|
case IdentifierType.Special:
|
||||||
{
|
{
|
||||||
var special = data[nameof(ActorIdentifier.Special)]?.ToObject<SpecialActor>() ?? 0;
|
var special = data[nameof(ActorIdentifier.Special)]?.ToObject<ScreenActor>() ?? 0;
|
||||||
return CreateSpecial(special);
|
return CreateSpecial(special);
|
||||||
}
|
}
|
||||||
case IdentifierType.Npc:
|
case IdentifierType.Npc:
|
||||||
|
|
@ -97,7 +97,7 @@ public partial class ActorManager
|
||||||
if (main == null)
|
if (main == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (main->ObjectIndex is >= (ushort)SpecialActor.CutsceneStart and < (ushort)SpecialActor.CutsceneEnd)
|
if (main->ObjectIndex is >= (ushort)ScreenActor.CutsceneStart and < (ushort)ScreenActor.CutsceneEnd)
|
||||||
{
|
{
|
||||||
var parentIdx = _toParentIdx(main->ObjectIndex);
|
var parentIdx = _toParentIdx(main->ObjectIndex);
|
||||||
if (parentIdx >= 0)
|
if (parentIdx >= 0)
|
||||||
|
|
@ -197,8 +197,7 @@ public partial class ActorManager
|
||||||
return FindDataId(split[1], Data.BNpcs, out id)
|
return FindDataId(split[1], Data.BNpcs, out id)
|
||||||
? (ObjectKind.BattleNpc, id)
|
? (ObjectKind.BattleNpc, id)
|
||||||
: throw new IdentifierParseError($"Could not identify a Battle NPC named {split[1]}.");
|
: throw new IdentifierParseError($"Could not identify a Battle NPC named {split[1]}.");
|
||||||
default:
|
default: throw new IdentifierParseError($"The argument {split[0]} is not a valid NPC Type.");
|
||||||
throw new IdentifierParseError($"The argument {split[0]} is not a valid NPC Type.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,6 +227,7 @@ public partial class ActorManager
|
||||||
if (split.Length < 3)
|
if (split.Length < 3)
|
||||||
throw new IdentifierParseError(
|
throw new IdentifierParseError(
|
||||||
"Owned NPCs need a NPC and a player, separated by '|', but only one was provided.");
|
"Owned NPCs need a NPC and a player, separated by '|', but only one was provided.");
|
||||||
|
|
||||||
type = IdentifierType.Owned;
|
type = IdentifierType.Owned;
|
||||||
(kind, objectId) = ParseNpc(split[1]);
|
(kind, objectId) = ParseNpc(split[1]);
|
||||||
(playerName, worldId) = ParsePlayer(split[2]);
|
(playerName, worldId) = ParsePlayer(split[2]);
|
||||||
|
|
@ -252,7 +252,7 @@ public partial class ActorManager
|
||||||
|
|
||||||
actor = HandleCutscene(actor);
|
actor = HandleCutscene(actor);
|
||||||
var idx = actor->ObjectIndex;
|
var idx = actor->ObjectIndex;
|
||||||
if (idx is >= (ushort)SpecialActor.CharacterScreen and <= (ushort)SpecialActor.Portrait)
|
if (idx is >= (ushort)ScreenActor.CharacterScreen and <= (ushort)ScreenActor.Card8)
|
||||||
return CreateIndividualUnchecked(IdentifierType.Special, ByteString.Empty, idx, ObjectKind.None, uint.MaxValue);
|
return CreateIndividualUnchecked(IdentifierType.Special, ByteString.Empty, idx, ObjectKind.None, uint.MaxValue);
|
||||||
|
|
||||||
var kind = (ObjectKind)actor->ObjectKind;
|
var kind = (ObjectKind)actor->ObjectKind;
|
||||||
|
|
@ -390,7 +390,7 @@ public partial class ActorManager
|
||||||
IdentifierType.Player => CreatePlayer(name, homeWorld),
|
IdentifierType.Player => CreatePlayer(name, homeWorld),
|
||||||
IdentifierType.Retainer => CreateRetainer(name),
|
IdentifierType.Retainer => CreateRetainer(name),
|
||||||
IdentifierType.Owned => CreateOwned(name, homeWorld, kind, dataId),
|
IdentifierType.Owned => CreateOwned(name, homeWorld, kind, dataId),
|
||||||
IdentifierType.Special => CreateSpecial((SpecialActor)homeWorld),
|
IdentifierType.Special => CreateSpecial((ScreenActor)homeWorld),
|
||||||
IdentifierType.Npc => CreateNpc(kind, dataId, homeWorld),
|
IdentifierType.Npc => CreateNpc(kind, dataId, homeWorld),
|
||||||
IdentifierType.UnkObject => CreateIndividualUnchecked(IdentifierType.UnkObject, name, homeWorld, ObjectKind.None, 0),
|
IdentifierType.UnkObject => CreateIndividualUnchecked(IdentifierType.UnkObject, name, homeWorld, ObjectKind.None, 0),
|
||||||
_ => ActorIdentifier.Invalid,
|
_ => ActorIdentifier.Invalid,
|
||||||
|
|
@ -418,7 +418,7 @@ public partial class ActorManager
|
||||||
return new ActorIdentifier(IdentifierType.Retainer, ObjectKind.Retainer, 0, 0, name);
|
return new ActorIdentifier(IdentifierType.Retainer, ObjectKind.Retainer, 0, 0, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActorIdentifier CreateSpecial(SpecialActor actor)
|
public ActorIdentifier CreateSpecial(ScreenActor actor)
|
||||||
{
|
{
|
||||||
if (!VerifySpecial(actor))
|
if (!VerifySpecial(actor))
|
||||||
return ActorIdentifier.Invalid;
|
return ActorIdentifier.Invalid;
|
||||||
|
|
@ -545,18 +545,18 @@ public partial class ActorManager
|
||||||
=> worldId == ushort.MaxValue || Data.Worlds.ContainsKey(worldId);
|
=> worldId == ushort.MaxValue || Data.Worlds.ContainsKey(worldId);
|
||||||
|
|
||||||
/// <summary> Verify that the enum value is a specific actor and return the name if it is. </summary>
|
/// <summary> Verify that the enum value is a specific actor and return the name if it is. </summary>
|
||||||
public static bool VerifySpecial(SpecialActor actor)
|
public static bool VerifySpecial(ScreenActor actor)
|
||||||
=> actor is >= SpecialActor.CharacterScreen and <= SpecialActor.Portrait;
|
=> actor is >= ScreenActor.CharacterScreen and <= ScreenActor.Card8;
|
||||||
|
|
||||||
/// <summary> Verify that the object index is a valid index for an NPC. </summary>
|
/// <summary> Verify that the object index is a valid index for an NPC. </summary>
|
||||||
public static bool VerifyIndex(ushort index)
|
public static bool VerifyIndex(ushort index)
|
||||||
{
|
{
|
||||||
return index switch
|
return index switch
|
||||||
{
|
{
|
||||||
ushort.MaxValue => true,
|
ushort.MaxValue => true,
|
||||||
< 200 => index % 2 == 0,
|
< 200 => index % 2 == 0,
|
||||||
> (ushort)SpecialActor.Portrait => index < 426,
|
> (ushort)ScreenActor.Card8 => index < 426,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Penumbra.GameData.Actors;
|
namespace Penumbra.GameData.Actors;
|
||||||
|
|
||||||
public enum SpecialActor : ushort
|
public enum ScreenActor : ushort
|
||||||
{
|
{
|
||||||
CutsceneStart = 200,
|
CutsceneStart = 200,
|
||||||
CutsceneEnd = 240,
|
CutsceneEnd = 240,
|
||||||
|
|
@ -9,4 +9,7 @@ public enum SpecialActor : ushort
|
||||||
FittingRoom = 242,
|
FittingRoom = 242,
|
||||||
DyePreview = 243,
|
DyePreview = 243,
|
||||||
Portrait = 244,
|
Portrait = 244,
|
||||||
}
|
Card6 = 245,
|
||||||
|
Card7 = 246,
|
||||||
|
Card8 = 247,
|
||||||
|
}
|
||||||
|
|
@ -88,12 +88,12 @@ public sealed partial class IndividualCollections : IReadOnlyList< (string Displ
|
||||||
|
|
||||||
switch( identifier.Special )
|
switch( identifier.Special )
|
||||||
{
|
{
|
||||||
case SpecialActor.CharacterScreen when Penumbra.Config.UseCharacterCollectionInMainWindow:
|
case ScreenActor.CharacterScreen when Penumbra.Config.UseCharacterCollectionInMainWindow:
|
||||||
case SpecialActor.FittingRoom when Penumbra.Config.UseCharacterCollectionInTryOn:
|
case ScreenActor.FittingRoom when Penumbra.Config.UseCharacterCollectionInTryOn:
|
||||||
case SpecialActor.DyePreview when Penumbra.Config.UseCharacterCollectionInTryOn:
|
case ScreenActor.DyePreview when Penumbra.Config.UseCharacterCollectionInTryOn:
|
||||||
case SpecialActor.Portrait when Penumbra.Config.UseCharacterCollectionsInCards:
|
case ScreenActor.Portrait when Penumbra.Config.UseCharacterCollectionsInCards:
|
||||||
return _actorManager.GetCurrentPlayer();
|
return _actorManager.GetCurrentPlayer();
|
||||||
case SpecialActor.ExamineScreen:
|
case ScreenActor.ExamineScreen:
|
||||||
{
|
{
|
||||||
identifier = _actorManager.GetInspectPlayer();
|
identifier = _actorManager.GetInspectPlayer();
|
||||||
if( identifier.IsValid )
|
if( identifier.IsValid )
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ public unsafe partial class PathResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, true, false );
|
var identifier = Penumbra.Actors.FromObject( gameObject, out var owner, true, false );
|
||||||
if( Penumbra.Config.UseNoModsInInspect && identifier.Type == IdentifierType.Special && identifier.Special == SpecialActor.ExamineScreen )
|
if( Penumbra.Config.UseNoModsInInspect && identifier.Type == IdentifierType.Special && identifier.Special == ScreenActor.ExamineScreen )
|
||||||
{
|
{
|
||||||
return IdentifiedCache.Set( ModCollection.Empty, identifier, gameObject );
|
return IdentifiedCache.Set( ModCollection.Empty, identifier, gameObject );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue