Skip to content

Commit

Permalink
Starfield ConstructibleObject CIFK
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Jan 8, 2025
1 parent 18cc804 commit 3aa14c7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</Fields>
</List>
<UInt64 name="RECF" recordType="RECF" unknown="true" />
<FormLink name="InstantiationFilterKeyword" refName="Keyword" recordType="CIFK" />
</Fields>
<LinkInterface>IResourceTarget</LinkInterface>
<LinkInterface>IBaseObject</LinkInterface>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ public ExtendedList<IFormLinkGetter<IKeywordGetter>>? Categories
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
UInt64? IConstructibleObjectGetter.RECF => this.RECF;
#endregion
#region InstantiationFilterKeyword
private readonly IFormLinkNullable<IKeywordGetter> _InstantiationFilterKeyword = new FormLinkNullable<IKeywordGetter>();
public IFormLinkNullable<IKeywordGetter> InstantiationFilterKeyword
{
get => _InstantiationFilterKeyword;
set => _InstantiationFilterKeyword.SetTo(value);
}
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
IFormLinkNullableGetter<IKeywordGetter> IConstructibleObjectGetter.InstantiationFilterKeyword => this.InstantiationFilterKeyword;
#endregion

#region To String

Expand Down Expand Up @@ -271,6 +281,7 @@ public Mask(TItem initialValue)
this.BuildLimit = initialValue;
this.Categories = new MaskItem<TItem, IEnumerable<(int Index, TItem Value)>?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>());
this.RECF = initialValue;
this.InstantiationFilterKeyword = initialValue;
}

public Mask(
Expand Down Expand Up @@ -299,7 +310,8 @@ public Mask(
TItem MenuArtObject,
TItem BuildLimit,
TItem Categories,
TItem RECF)
TItem RECF,
TItem InstantiationFilterKeyword)
: base(
MajorRecordFlagsRaw: MajorRecordFlagsRaw,
FormKey: FormKey,
Expand Down Expand Up @@ -328,6 +340,7 @@ public Mask(
this.BuildLimit = BuildLimit;
this.Categories = new MaskItem<TItem, IEnumerable<(int Index, TItem Value)>?>(Categories, Enumerable.Empty<(int Index, TItem Value)>());
this.RECF = RECF;
this.InstantiationFilterKeyword = InstantiationFilterKeyword;
}

#pragma warning disable CS8618
Expand Down Expand Up @@ -358,6 +371,7 @@ protected Mask()
public TItem BuildLimit;
public MaskItem<TItem, IEnumerable<(int Index, TItem Value)>?>? Categories;
public TItem RECF;
public TItem InstantiationFilterKeyword;
#endregion

#region Equals
Expand Down Expand Up @@ -390,6 +404,7 @@ public bool Equals(Mask<TItem>? rhs)
if (!object.Equals(this.BuildLimit, rhs.BuildLimit)) return false;
if (!object.Equals(this.Categories, rhs.Categories)) return false;
if (!object.Equals(this.RECF, rhs.RECF)) return false;
if (!object.Equals(this.InstantiationFilterKeyword, rhs.InstantiationFilterKeyword)) return false;
return true;
}
public override int GetHashCode()
Expand All @@ -414,6 +429,7 @@ public override int GetHashCode()
hash.Add(this.BuildLimit);
hash.Add(this.Categories);
hash.Add(this.RECF);
hash.Add(this.InstantiationFilterKeyword);
hash.Add(base.GetHashCode());
return hash.ToHashCode();
}
Expand Down Expand Up @@ -509,6 +525,7 @@ public override bool All(Func<TItem, bool> eval)
}
}
if (!eval(this.RECF)) return false;
if (!eval(this.InstantiationFilterKeyword)) return false;
return true;
}
#endregion
Expand Down Expand Up @@ -602,6 +619,7 @@ public override bool Any(Func<TItem, bool> eval)
}
}
if (eval(this.RECF)) return true;
if (eval(this.InstantiationFilterKeyword)) return true;
return false;
}
#endregion
Expand Down Expand Up @@ -705,6 +723,7 @@ protected void Translate_InternalFill<R>(Mask<R> obj, Func<TItem, R> eval)
}
}
obj.RECF = eval(this.RECF);
obj.InstantiationFilterKeyword = eval(this.InstantiationFilterKeyword);
}
#endregion

Expand Down Expand Up @@ -876,6 +895,10 @@ public void Print(StructuredStringBuilder sb, ConstructibleObject.Mask<bool>? pr
{
sb.AppendItem(RECF, "RECF");
}
if (printMask?.InstantiationFilterKeyword ?? true)
{
sb.AppendItem(InstantiationFilterKeyword, "InstantiationFilterKeyword");
}
}
}
#endregion
Expand Down Expand Up @@ -906,6 +929,7 @@ public void Print(StructuredStringBuilder sb, ConstructibleObject.Mask<bool>? pr
public Exception? BuildLimit;
public MaskItem<Exception?, IEnumerable<(int Index, Exception Value)>?>? Categories;
public Exception? RECF;
public Exception? InstantiationFilterKeyword;
#endregion

#region IErrorMask
Expand Down Expand Up @@ -952,6 +976,8 @@ public void Print(StructuredStringBuilder sb, ConstructibleObject.Mask<bool>? pr
return Categories;
case ConstructibleObject_FieldIndex.RECF:
return RECF;
case ConstructibleObject_FieldIndex.InstantiationFilterKeyword:
return InstantiationFilterKeyword;
default:
return base.GetNthMask(index);
}
Expand Down Expand Up @@ -1019,6 +1045,9 @@ public override void SetNthException(int index, Exception ex)
case ConstructibleObject_FieldIndex.RECF:
this.RECF = ex;
break;
case ConstructibleObject_FieldIndex.InstantiationFilterKeyword:
this.InstantiationFilterKeyword = ex;
break;
default:
base.SetNthException(index, ex);
break;
Expand Down Expand Up @@ -1087,6 +1116,9 @@ public override void SetNthMask(int index, object obj)
case ConstructibleObject_FieldIndex.RECF:
this.RECF = (Exception?)obj;
break;
case ConstructibleObject_FieldIndex.InstantiationFilterKeyword:
this.InstantiationFilterKeyword = (Exception?)obj;
break;
default:
base.SetNthMask(index, obj);
break;
Expand Down Expand Up @@ -1115,6 +1147,7 @@ public override bool IsInError()
if (BuildLimit != null) return true;
if (Categories != null) return true;
if (RECF != null) return true;
if (InstantiationFilterKeyword != null) return true;
return false;
}
#endregion
Expand Down Expand Up @@ -1269,6 +1302,9 @@ protected override void PrintFillInternal(StructuredStringBuilder sb)
{
sb.AppendItem(RECF, "RECF");
}
{
sb.AppendItem(InstantiationFilterKeyword, "InstantiationFilterKeyword");
}
}
#endregion

Expand Down Expand Up @@ -1296,6 +1332,7 @@ public ErrorMask Combine(ErrorMask? rhs)
ret.BuildLimit = this.BuildLimit.Combine(rhs.BuildLimit);
ret.Categories = new MaskItem<Exception?, IEnumerable<(int Index, Exception Value)>?>(Noggog.ExceptionExt.Combine(this.Categories?.Overall, rhs.Categories?.Overall), Noggog.ExceptionExt.Combine(this.Categories?.Specific, rhs.Categories?.Specific));
ret.RECF = this.RECF.Combine(rhs.RECF);
ret.InstantiationFilterKeyword = this.InstantiationFilterKeyword.Combine(rhs.InstantiationFilterKeyword);
return ret;
}
public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs)
Expand Down Expand Up @@ -1337,6 +1374,7 @@ public ErrorMask Combine(ErrorMask? rhs)
public bool BuildLimit;
public bool Categories;
public bool RECF;
public bool InstantiationFilterKeyword;
#endregion

#region Ctors
Expand All @@ -1357,6 +1395,7 @@ public TranslationMask(
this.BuildLimit = defaultOn;
this.Categories = defaultOn;
this.RECF = defaultOn;
this.InstantiationFilterKeyword = defaultOn;
}

#endregion
Expand All @@ -1383,6 +1422,7 @@ protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal
ret.Add((BuildLimit, null));
ret.Add((Categories, null));
ret.Add((RECF, null));
ret.Add((InstantiationFilterKeyword, null));
}

public static implicit operator TranslationMask(bool defaultOn)
Expand Down Expand Up @@ -1556,6 +1596,7 @@ public partial interface IConstructibleObject :
new IFormLinkNullable<IGlobalGetter> BuildLimit { get; set; }
new ExtendedList<IFormLinkGetter<IKeywordGetter>>? Categories { get; set; }
new UInt64? RECF { get; set; }
new IFormLinkNullable<IKeywordGetter> InstantiationFilterKeyword { get; set; }
}

public partial interface IConstructibleObjectInternal :
Expand Down Expand Up @@ -1596,6 +1637,7 @@ public partial interface IConstructibleObjectGetter :
IFormLinkNullableGetter<IGlobalGetter> BuildLimit { get; }
IReadOnlyList<IFormLinkGetter<IKeywordGetter>>? Categories { get; }
UInt64? RECF { get; }
IFormLinkNullableGetter<IKeywordGetter> InstantiationFilterKeyword { get; }

}

Expand Down Expand Up @@ -1791,6 +1833,7 @@ internal enum ConstructibleObject_FieldIndex
BuildLimit = 23,
Categories = 24,
RECF = 25,
InstantiationFilterKeyword = 26,
}
#endregion

Expand All @@ -1801,9 +1844,9 @@ internal partial class ConstructibleObject_Registration : ILoquiRegistration

public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey;

public const ushort AdditionalFieldCount = 19;
public const ushort AdditionalFieldCount = 20;

public const ushort FieldCount = 26;
public const ushort FieldCount = 27;

public static readonly Type MaskType = typeof(ConstructibleObject.Mask<>);

Expand Down Expand Up @@ -1858,7 +1901,8 @@ internal partial class ConstructibleObject_Registration : ILoquiRegistration
RecordTypes.ANAM,
RecordTypes.JNAM,
RecordTypes.FNAM,
RecordTypes.RECF);
RecordTypes.RECF,
RecordTypes.CIFK);
return new RecordTriggerSpecs(
allRecordTypes: all,
triggeringRecordTypes: triggers);
Expand Down Expand Up @@ -1922,6 +1966,7 @@ public void Clear(IConstructibleObjectInternal item)
item.BuildLimit.Clear();
item.Categories = null;
item.RECF = default;
item.InstantiationFilterKeyword.Clear();
base.Clear(item);
}

Expand Down Expand Up @@ -1951,6 +1996,7 @@ public void RemapLinks(IConstructibleObject obj, IReadOnlyDictionary<FormKey, Fo
obj.MenuArtObject.Relink(mapping);
obj.BuildLimit.Relink(mapping);
obj.Categories?.RemapLinks(mapping);
obj.InstantiationFilterKeyword.Relink(mapping);
}

public IEnumerable<IAssetLink> EnumerateListedAssetLinks(IConstructibleObject obj)
Expand Down Expand Up @@ -2088,6 +2134,7 @@ public void FillEqualsMask(
(l, r) => object.Equals(l, r),
include);
ret.RECF = item.RECF == rhs.RECF;
ret.InstantiationFilterKeyword = item.InstantiationFilterKeyword.Equals(rhs.InstantiationFilterKeyword);
base.FillEqualsMask(item, rhs, ret, include);
}

Expand Down Expand Up @@ -2272,6 +2319,10 @@ protected static void ToStringFields(
{
sb.AppendItem(RECFItem, "RECF");
}
if (printMask?.InstantiationFilterKeyword ?? true)
{
sb.AppendItem(item.InstantiationFilterKeyword.FormKeyNullable, "InstantiationFilterKeyword");
}
}

public static ConstructibleObject_FieldIndex ConvertFieldIndex(StarfieldMajorRecord_FieldIndex index)
Expand Down Expand Up @@ -2410,6 +2461,10 @@ public virtual bool Equals(
{
if (lhs.RECF != rhs.RECF) return false;
}
if ((equalsMask?.GetShouldTranslate((int)ConstructibleObject_FieldIndex.InstantiationFilterKeyword) ?? true))
{
if (!lhs.InstantiationFilterKeyword.Equals(rhs.InstantiationFilterKeyword)) return false;
}
return true;
}

Expand Down Expand Up @@ -2475,6 +2530,7 @@ public virtual int GetHashCode(IConstructibleObjectGetter item)
{
hash.Add(RECFitem);
}
hash.Add(item.InstantiationFilterKeyword);
hash.Add(base.GetHashCode());
return hash.ToHashCode();
}
Expand Down Expand Up @@ -2571,6 +2627,10 @@ public IEnumerable<IFormLinkGetter> EnumerateFormLinks(IConstructibleObjectGette
yield return FormLinkInformation.Factory(item);
}
}
if (FormLinkInformation.TryFactory(obj.InstantiationFilterKeyword, out var InstantiationFilterKeywordInfo))
{
yield return InstantiationFilterKeywordInfo;
}
yield break;
}

Expand Down Expand Up @@ -2920,6 +2980,10 @@ public void DeepCopyIn(
{
item.RECF = rhs.RECF;
}
if ((copyMask?.GetShouldTranslate((int)ConstructibleObject_FieldIndex.InstantiationFilterKeyword) ?? true))
{
item.InstantiationFilterKeyword.SetTo(rhs.InstantiationFilterKeyword.FormKeyNullable);
}
DeepCopyInCustom(
item: item,
rhs: rhs,
Expand Down Expand Up @@ -3222,6 +3286,10 @@ public static void WriteRecordTypes(
writer: writer,
item: item.RECF,
header: translationParams.ConvertToCustom(RecordTypes.RECF));
FormLinkBinaryTranslation.Instance.WriteNullable(
writer: writer,
item: item.InstantiationFilterKeyword,
header: translationParams.ConvertToCustom(RecordTypes.CIFK));
}

public void Write(
Expand Down Expand Up @@ -3429,6 +3497,12 @@ public static ParseResult FillBinaryRecordTypes(
item.RECF = frame.ReadUInt64();
return (int)ConstructibleObject_FieldIndex.RECF;
}
case RecordTypeInts.CIFK:
{
frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength;
item.InstantiationFilterKeyword.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame));
return (int)ConstructibleObject_FieldIndex.InstantiationFilterKeyword;
}
default:
return StarfieldMajorRecordBinaryCreateTranslation.FillBinaryRecordTypes(
item: item,
Expand Down Expand Up @@ -3541,6 +3615,10 @@ void IBinaryItem.WriteToBinary(
private int? _RECFLocation;
public UInt64? RECF => _RECFLocation.HasValue ? BinaryPrimitives.ReadUInt64LittleEndian(HeaderTranslation.ExtractSubrecordMemory(_recordData, _RECFLocation.Value, _package.MetaData.Constants)) : default(UInt64?);
#endregion
#region InstantiationFilterKeyword
private int? _InstantiationFilterKeywordLocation;
public IFormLinkNullableGetter<IKeywordGetter> InstantiationFilterKeyword => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory<IKeywordGetter>(_package, _recordData, _InstantiationFilterKeywordLocation);
#endregion
partial void CustomFactoryEnd(
OverlayStream stream,
int finalPos,
Expand Down Expand Up @@ -3746,6 +3824,11 @@ public override ParseResult FillRecordType(
_RECFLocation = (stream.Position - offset);
return (int)ConstructibleObject_FieldIndex.RECF;
}
case RecordTypeInts.CIFK:
{
_InstantiationFilterKeywordLocation = (stream.Position - offset);
return (int)ConstructibleObject_FieldIndex.InstantiationFilterKeyword;
}
default:
return base.FillRecordType(
stream: stream,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public partial class RecordTypeInts
public const int CHAL = 0x4C414843;
public const int CHGL = 0x4C474843;
public const int CHRR = 0x52524843;
public const int CIFK = 0x4B464943;
public const int CIS1 = 0x31534943;
public const int CIS2 = 0x32534943;
public const int CITC = 0x43544943;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public partial class RecordTypes
public static readonly RecordType CHAL = new(0x4C414843);
public static readonly RecordType CHGL = new(0x4C474843);
public static readonly RecordType CHRR = new(0x52524843);
public static readonly RecordType CIFK = new(0x4B464943);
public static readonly RecordType CIS1 = new(0x31534943);
public static readonly RecordType CIS2 = new(0x32534943);
public static readonly RecordType CITC = new(0x43544943);
Expand Down

0 comments on commit 3aa14c7

Please sign in to comment.