-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass on ActionTypePlay parsing
- Loading branch information
Showing
7 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace ME3Tweaks.Wwiser.Model.Action; | ||
|
||
public class ActionParams | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Model.Hierarchy; | ||
|
||
namespace ME3Tweaks.Wwiser.Model.Action; | ||
|
||
public class ActionParamsFactory : ISubtypeFactory | ||
{ | ||
private static readonly Dictionary<Type, ActionTypeValue> TypeToEnum = new() | ||
{ | ||
{ typeof(Play), ActionTypeValue.Play}, | ||
}; | ||
|
||
public bool TryGetKey(Type valueType, [UnscopedRef] out object key) | ||
{ | ||
if (TypeToEnum.TryGetValue(valueType, out var value)) | ||
{ | ||
key = value; | ||
return true; | ||
} | ||
|
||
// fallback | ||
key = ActionTypeValue.Play; | ||
return false; | ||
} | ||
|
||
public bool TryGetType(object key, [UnscopedRef] out Type type) | ||
{ | ||
type = (ActionTypeValue)key switch | ||
{ | ||
ActionTypeValue.Play => typeof(Play), | ||
_ => typeof(Play) | ||
}; | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Attributes; | ||
using ME3Tweaks.Wwiser.Formats; | ||
|
||
namespace ME3Tweaks.Wwiser.Model.Action; | ||
|
||
public class ExceptParams | ||
{ | ||
[FieldOrder(0)] | ||
public VarCount ExceptionCount { get; set; } | ||
|
||
[FieldOrder(1)] | ||
[FieldCount($"{nameof(ExceptionCount)}.{nameof(ExceptionCount.Value)}")] | ||
public List<ElementException> Exceptions { get; set; } = new(); | ||
} | ||
|
||
public class ElementException : AkIdentifiable | ||
{ | ||
[FieldOrder(0)] | ||
[SerializeAs(SerializedType.UInt1)] | ||
[SerializeWhenVersion(65, ComparisonOperator.GreaterThan)] | ||
public bool IsBus { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Attributes; | ||
using ME3Tweaks.Wwiser.Model.RTPC; | ||
|
||
namespace ME3Tweaks.Wwiser.Model.Action; | ||
|
||
public class Play : ActionParams | ||
{ | ||
[FieldOrder(0)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int Time { get; set; } | ||
|
||
[FieldOrder(1)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int TimeMin { get; set; } | ||
|
||
[FieldOrder(2)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int TimeMax { get; set; } | ||
|
||
[FieldOrder(3)] | ||
[SerializeAs(SerializedType.UInt1)] | ||
public CurveInterpolation CurveInterpolation { get; set; } | ||
|
||
[FieldOrder(4)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public SpecificParams SpecificParams { get; set; } | ||
|
||
[FieldOrder(5)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public ExceptParams ExceptParams { get; set; } | ||
|
||
[FieldOrder(6)] | ||
[SerializeWhenVersion(26, ComparisonOperator.GreaterThan)] | ||
public uint BankId { get; set; } | ||
|
||
[FieldOrder(7)] | ||
[SerializeWhenVersion(144, ComparisonOperator.GreaterThanOrEqual)] | ||
public uint BankType { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Attributes; | ||
|
||
namespace ME3Tweaks.Wwiser.Model.Action; | ||
|
||
public class SpecificParams | ||
{ | ||
[FieldOrder(0)] | ||
[FieldLength(0x10)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public byte[] Data { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using BinarySerialization; | ||
using ME3Tweaks.Wwiser.Attributes; | ||
using ME3Tweaks.Wwiser.Model.Action; | ||
using ME3Tweaks.Wwiser.Model.ParameterNode; | ||
|
||
namespace ME3Tweaks.Wwiser.Model.Hierarchy; | ||
|
||
public class Action : HircItem | ||
{ | ||
[FieldOrder(0)] | ||
public ActionType Type { get; set; } = new(); | ||
|
||
[FieldOrder(1)] | ||
public uint TargetId { get; set; } | ||
|
||
[FieldOrder(2)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int Delay { get; set; } | ||
|
||
[FieldOrder(3)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int DelayMin { get; set; } | ||
|
||
[FieldOrder(4)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public int DelayMax { get; set; } | ||
|
||
[FieldOrder(5)] | ||
[SerializeWhenVersion(56, ComparisonOperator.LessThanOrEqual)] | ||
public uint SubSectionSize { get; set; } // TODO: this needs to go away | ||
|
||
[FieldOrder(6)] | ||
[SerializeWhenVersion(65, ComparisonOperator.GreaterThan)] | ||
[SerializeAs(SerializedType.UInt1)] | ||
public bool IsBus { get; set; } | ||
|
||
[FieldOrder(7)] | ||
[SerializeWhenVersion(56, ComparisonOperator.GreaterThan)] | ||
public InitialParamsV62 PropBundle { get; set; } = new(); | ||
|
||
[FieldOrder(8)] | ||
[FieldLength(nameof(SubSectionSize))] | ||
[SubtypeFactory($"{nameof(Type)}.{nameof(Type.Value)}", typeof(ActionParamsFactory))] | ||
public ActionParams ActionParams { get; set; } = new(); | ||
} |