Fix previous fix for weapons.

This commit is contained in:
Ottermandias 2025-04-03 01:04:58 +02:00
parent b98cb31fd2
commit 096d82741d

View file

@ -157,19 +157,23 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable
/// <summary> Find the type of the given draw object by checking the actors pointers. </summary> /// <summary> Find the type of the given draw object by checking the actors pointers. </summary>
private static bool FindType(CharacterBase* characterBase, Actor actor, out MaterialValueIndex.DrawObjectType type) private static bool FindType(CharacterBase* characterBase, Actor actor, out MaterialValueIndex.DrawObjectType type)
{ {
type = MaterialValueIndex.DrawObjectType.Invalid;
if (!((Model)characterBase).IsHuman)
return false;
type = type = MaterialValueIndex.DrawObjectType.Human;
if (!actor.Valid) if (!actor.Valid)
{
type = MaterialValueIndex.DrawObjectType.Invalid;
return false; return false;
}
if (actor.Model.AsCharacterBase == characterBase) if (actor.Model.AsCharacterBase == characterBase && ((Model)characterBase).IsHuman)
{
type = MaterialValueIndex.DrawObjectType.Human;
return true; return true;
}
if (!actor.AsObject->IsCharacter()) if (!actor.AsObject->IsCharacter())
{
type = MaterialValueIndex.DrawObjectType.Invalid;
return false; return false;
}
if (actor.AsCharacter->DrawData.WeaponData[0].DrawObject == characterBase) if (actor.AsCharacter->DrawData.WeaponData[0].DrawObject == characterBase)
{ {
@ -183,6 +187,7 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable
return true; return true;
} }
type = MaterialValueIndex.DrawObjectType.Invalid;
return false; return false;
} }