Add SetCutsceneParentIndex.

This commit is contained in:
Ottermandias 2024-01-27 18:51:16 +01:00
parent b543d9fc1d
commit 5a80e65d3b
5 changed files with 46 additions and 3 deletions

View file

@ -56,6 +56,24 @@ public sealed class CutsceneService : IService, IDisposable
public int GetParentIndex(int idx)
=> GetParentIndex((ushort)idx);
public bool SetParentIndex(int copyIdx, int parentIdx)
{
if (copyIdx is < CutsceneStartIdx or >= CutsceneEndIdx)
return false;
if (parentIdx is < -1 or >= CutsceneEndIdx)
return false;
if (_objects.GetObjectAddress(copyIdx) == nint.Zero)
return false;
if (parentIdx != -1 && _objects.GetObjectAddress(parentIdx) == nint.Zero)
return false;
_copiedCharacters[copyIdx - CutsceneStartIdx] = (short)parentIdx;
return true;
}
public short GetParentIndex(ushort idx)
{
if (idx is >= CutsceneStartIdx and < CutsceneEndIdx)