diff --git a/Assets/Scripts/OpenTS2/SimAntics/BHAVAsset.cs b/Assets/Scripts/OpenTS2/SimAntics/BHAVAsset.cs index a3f9900..679597b 100644 --- a/Assets/Scripts/OpenTS2/SimAntics/BHAVAsset.cs +++ b/Assets/Scripts/OpenTS2/SimAntics/BHAVAsset.cs @@ -14,6 +14,9 @@ namespace OpenTS2.SimAntics public class Node { + public const ushort ErrorReturnValue = 0xFFFC; + public const ushort TrueReturnValue = 0xFFFD; + public const ushort FalseReturnValue = 0xFFFE; public ushort OpCode; public ushort TrueTarget; public ushort FalseTarget; diff --git a/Assets/Scripts/OpenTS2/SimAntics/BHAVCodec.cs b/Assets/Scripts/OpenTS2/SimAntics/BHAVCodec.cs index 38a5125..602cadb 100644 --- a/Assets/Scripts/OpenTS2/SimAntics/BHAVCodec.cs +++ b/Assets/Scripts/OpenTS2/SimAntics/BHAVCodec.cs @@ -104,13 +104,14 @@ namespace OpenTS2.SimAntics { // None / Error case 0xFD: - return 0xFFFC; + return BHAVAsset.Node.ErrorReturnValue; // True case 0xFE: - return 0xFFFD; + return BHAVAsset.Node.TrueReturnValue; // False case 0xFF: - return 0xFFFE; + return BHAVAsset.Node.FalseReturnValue; + // probably already an okay value default: return target; } diff --git a/Assets/Scripts/OpenTS2/SimAntics/VM.cs b/Assets/Scripts/OpenTS2/SimAntics/VM.cs index 2a50eba..c5044c2 100644 --- a/Assets/Scripts/OpenTS2/SimAntics/VM.cs +++ b/Assets/Scripts/OpenTS2/SimAntics/VM.cs @@ -6,16 +6,6 @@ namespace OpenTS2.SimAntics { public class VM { - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } + public List Entities = new List(); } } diff --git a/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs b/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs new file mode 100644 index 0000000..92ebade --- /dev/null +++ b/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenTS2.SimAntics +{ + public class VMEntity + { + public ushort ID = 1; + public short[] Temps = new short[20]; + } +} diff --git a/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs.meta b/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs.meta new file mode 100644 index 0000000..bb48c54 --- /dev/null +++ b/Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 17d0bfd1bb2c4ab48a5e03c6c55d4c3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs b/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs new file mode 100644 index 0000000..1f651ca --- /dev/null +++ b/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenTS2.SimAntics +{ + public abstract class VMPrimitive + { + public abstract ReturnValue Execute(); + + public enum ExitCode : byte + { + GoToTrue, + GoToFalse + } + + public struct ReturnValue + { + private ExitCode Code; + public int Ticks; + + public static ReturnValue GoToTrue = new ReturnValue { Code = ExitCode.GoToTrue, Ticks = 0 }; + public static ReturnValue GoToFalse = new ReturnValue { Code = ExitCode.GoToFalse, Ticks = 0 }; + public static ReturnValue ContinueOnFutureTick( ExitCode exitCode, int ticksToSleep ) + { + return new ReturnValue + { + Code = exitCode, + Ticks = ticksToSleep + }; + } + } + } +} diff --git a/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs.meta b/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs.meta new file mode 100644 index 0000000..6fde0f6 --- /dev/null +++ b/Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 636b30d1f9f76fa4b8ff19785fe663f8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: