Update for GameData changes.

This commit is contained in:
Ottermandias 2023-12-20 16:39:26 +01:00
parent 6dc5916f2b
commit 5d28904bdf
24 changed files with 160 additions and 123 deletions

View file

@ -37,7 +37,7 @@ internal partial record ResolveContext
private unsafe GenderRace ResolveModelRaceCode()
=> ResolveEqdpRaceCode(Slot, Equipment.Set);
private unsafe GenderRace ResolveEqdpRaceCode(EquipSlot slot, SetId setId)
private unsafe GenderRace ResolveEqdpRaceCode(EquipSlot slot, PrimaryId primaryId)
{
var slotIndex = slot.ToIndex();
if (slotIndex >= 10 || ModelType != ModelType.Human)
@ -55,7 +55,7 @@ internal partial record ResolveContext
if (metaCache == null)
return GenderRace.MidlanderMale;
var entry = metaCache.GetEqdpEntry(characterRaceCode, accessory, setId);
var entry = metaCache.GetEqdpEntry(characterRaceCode, accessory, primaryId);
if (entry.ToBits(slot).Item2)
return characterRaceCode;
@ -63,7 +63,7 @@ internal partial record ResolveContext
if (fallbackRaceCode == GenderRace.MidlanderMale)
return GenderRace.MidlanderMale;
entry = metaCache.GetEqdpEntry(fallbackRaceCode, accessory, setId);
entry = metaCache.GetEqdpEntry(fallbackRaceCode, accessory, primaryId);
if (entry.ToBits(slot).Item2)
return fallbackRaceCode;
@ -229,7 +229,7 @@ internal partial record ResolveContext
return Utf8GamePath.FromString(path, out var gamePath) ? gamePath : Utf8GamePath.Empty;
}
private unsafe (GenderRace RaceCode, string Slot, SetId Set) ResolveHumanSkeletonData(uint partialSkeletonIndex)
private unsafe (GenderRace RaceCode, string Slot, PrimaryId Set) ResolveHumanSkeletonData(uint partialSkeletonIndex)
{
var human = (Human*)CharacterBase.Value;
var characterRaceCode = (GenderRace)human->RaceSexId;
@ -262,17 +262,17 @@ internal partial record ResolveContext
}
}
private unsafe (GenderRace RaceCode, string Slot, SetId Set) ResolveHumanEquipmentSkeletonData(EquipSlot slot, EstManipulation.EstType type)
private unsafe (GenderRace RaceCode, string Slot, PrimaryId Set) ResolveHumanEquipmentSkeletonData(EquipSlot slot, EstManipulation.EstType type)
{
var human = (Human*)CharacterBase.Value;
var equipment = ((CharacterArmor*)&human->Head)[slot.ToIndex()];
return ResolveHumanExtraSkeletonData(ResolveEqdpRaceCode(slot, equipment.Set), type, equipment.Set);
}
private unsafe (GenderRace RaceCode, string Slot, SetId Set) ResolveHumanExtraSkeletonData(GenderRace raceCode, EstManipulation.EstType type, SetId set)
private unsafe (GenderRace RaceCode, string Slot, PrimaryId Set) ResolveHumanExtraSkeletonData(GenderRace raceCode, EstManipulation.EstType type, PrimaryId primary)
{
var metaCache = Global.Collection.MetaCache;
var skeletonSet = metaCache == null ? default : metaCache.GetEstEntry(type, raceCode, set);
var skeletonSet = metaCache == null ? default : metaCache.GetEstEntry(type, raceCode, primary);
return (raceCode, EstManipulation.ToName(type), skeletonSet);
}

View file

@ -25,8 +25,8 @@ internal record GlobalResolveContext(ObjectIdentification Identifier, ModCollect
public readonly Dictionary<(Utf8GamePath, nint), ResourceNode> Nodes = new(128);
public unsafe ResolveContext CreateContext(CharacterBase* characterBase, uint slotIndex = 0xFFFFFFFFu,
EquipSlot slot = EquipSlot.Unknown, CharacterArmor equipment = default, WeaponType weaponType = default)
=> new(this, characterBase, slotIndex, slot, equipment, weaponType);
EquipSlot slot = EquipSlot.Unknown, CharacterArmor equipment = default, SecondaryId secondaryId = default)
=> new(this, characterBase, slotIndex, slot, equipment, secondaryId);
}
internal partial record ResolveContext(
@ -35,7 +35,7 @@ internal partial record ResolveContext(
uint SlotIndex,
EquipSlot Slot,
CharacterArmor Equipment,
WeaponType WeaponType)
SecondaryId SecondaryId)
{
private static readonly ByteString ShpkPrefix = ByteString.FromSpanUnsafe("shader/sm5/shpk"u8, true, true, true);