mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
.
This commit is contained in:
parent
145b64bb7a
commit
4cf082aa19
37 changed files with 1362 additions and 1255 deletions
|
|
@ -59,7 +59,7 @@ public partial class CustomizationOptions
|
|||
|
||||
public partial class CustomizationOptions
|
||||
{
|
||||
internal readonly bool Valid;
|
||||
private readonly bool _valid;
|
||||
|
||||
public string GetName(CustomName name)
|
||||
=> _names[(int)name];
|
||||
|
|
@ -68,7 +68,7 @@ public partial class CustomizationOptions
|
|||
{
|
||||
var tmp = new TemporaryData(gameData, this);
|
||||
_icons = new IconStorage(pi, gameData, _customizationSets.Length * 50);
|
||||
Valid = tmp.Valid;
|
||||
_valid = tmp.Valid;
|
||||
SetNames(gameData, tmp);
|
||||
foreach (var race in Clans)
|
||||
{
|
||||
|
|
@ -77,7 +77,6 @@ public partial class CustomizationOptions
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Obtain localized names of customization options and race names from the game data.
|
||||
private readonly string[] _names = new string[Enum.GetValues<CustomName>().Length];
|
||||
|
||||
|
|
@ -430,10 +429,14 @@ public partial class CustomizationOptions
|
|||
|
||||
// Hair Row from CustomizeSheet might not be set in case of unlockable hair.
|
||||
var hairRow = _customizeSheet.GetRow(customizeIdx);
|
||||
hairList.Add(hairRow != null
|
||||
? new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)hairRow.FeatureID, hairRow.Icon,
|
||||
(ushort)hairRow.RowId)
|
||||
: new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)i, customizeIdx));
|
||||
if (hairRow == null)
|
||||
{
|
||||
hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)i, customizeIdx));
|
||||
}
|
||||
else if (_options._icons.IconExists(hairRow.Icon))
|
||||
{
|
||||
hairList.Add(new CustomizeData(CustomizeIndex.Hairstyle, (CustomizeValue)hairRow.FeatureID, hairRow.Icon, (ushort)hairRow.RowId));
|
||||
}
|
||||
}
|
||||
|
||||
return hairList.ToArray();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,14 @@ public unsafe struct Customize
|
|||
public Customize(Penumbra.GameData.Structs.CustomizeData* data)
|
||||
=> Data = data;
|
||||
|
||||
public Customize(ref Penumbra.GameData.Structs.CustomizeData data)
|
||||
{
|
||||
fixed (Penumbra.GameData.Structs.CustomizeData* ptr = &data)
|
||||
{
|
||||
Data = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
public Race Race
|
||||
{
|
||||
get => (Race)Data->Get(CustomizeIndex.Race).Value;
|
||||
|
|
@ -96,4 +104,18 @@ public unsafe struct Customize
|
|||
|
||||
public string WriteBase64()
|
||||
=> Data->WriteBase64();
|
||||
|
||||
public static CustomizeFlag Compare(Customize lhs, Customize rhs)
|
||||
{
|
||||
CustomizeFlag ret = 0;
|
||||
foreach (var idx in Enum.GetValues<CustomizeIndex>())
|
||||
{
|
||||
var l = lhs[idx];
|
||||
var r = rhs[idx];
|
||||
if (l.Value != r.Value)
|
||||
ret |= idx.ToFlag();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ public enum CustomizeFlag : ulong
|
|||
|
||||
public static class CustomizeFlagExtensions
|
||||
{
|
||||
public const CustomizeFlag All = (CustomizeFlag)(((ulong)CustomizeFlag.FacePaintColor << 1) - 1ul);
|
||||
public const CustomizeFlag All = (CustomizeFlag)(((ulong)CustomizeFlag.FacePaintColor << 1) - 1ul);
|
||||
public const CustomizeFlag RedrawRequired = CustomizeFlag.Race | CustomizeFlag.Clan | CustomizeFlag.Gender | CustomizeFlag.Face;
|
||||
|
||||
public static bool RequiresRedraw(this CustomizeFlag flags)
|
||||
=> (flags & RedrawRequired) != 0;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
public static CustomizeIndex ToIndex(this CustomizeFlag flag)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue