mirror of
https://github.com/LazyDuchess/OpenTS2.git
synced 2025-01-23 08:41:47 -05:00
Start implementing primitives and entities
This commit is contained in:
parent
2bb732b4d6
commit
6009d9f121
7 changed files with 80 additions and 14 deletions
|
@ -14,6 +14,9 @@ namespace OpenTS2.SimAntics
|
||||||
|
|
||||||
public class Node
|
public class Node
|
||||||
{
|
{
|
||||||
|
public const ushort ErrorReturnValue = 0xFFFC;
|
||||||
|
public const ushort TrueReturnValue = 0xFFFD;
|
||||||
|
public const ushort FalseReturnValue = 0xFFFE;
|
||||||
public ushort OpCode;
|
public ushort OpCode;
|
||||||
public ushort TrueTarget;
|
public ushort TrueTarget;
|
||||||
public ushort FalseTarget;
|
public ushort FalseTarget;
|
||||||
|
|
|
@ -104,13 +104,14 @@ namespace OpenTS2.SimAntics
|
||||||
{
|
{
|
||||||
// None / Error
|
// None / Error
|
||||||
case 0xFD:
|
case 0xFD:
|
||||||
return 0xFFFC;
|
return BHAVAsset.Node.ErrorReturnValue;
|
||||||
// True
|
// True
|
||||||
case 0xFE:
|
case 0xFE:
|
||||||
return 0xFFFD;
|
return BHAVAsset.Node.TrueReturnValue;
|
||||||
// False
|
// False
|
||||||
case 0xFF:
|
case 0xFF:
|
||||||
return 0xFFFE;
|
return BHAVAsset.Node.FalseReturnValue;
|
||||||
|
// probably already an okay value
|
||||||
default:
|
default:
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,6 @@ namespace OpenTS2.SimAntics
|
||||||
{
|
{
|
||||||
public class VM
|
public class VM
|
||||||
{
|
{
|
||||||
// Start is called before the first frame update
|
public List<VMEntity> Entities = new List<VMEntity>();
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs
Normal file
14
Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs
Normal file
|
@ -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];
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs.meta
generated
Normal file
11
Assets/Scripts/OpenTS2/SimAntics/VMEntity.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 17d0bfd1bb2c4ab48a5e03c6c55d4c3d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
36
Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs
Normal file
36
Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs
Normal file
|
@ -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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs.meta
generated
Normal file
11
Assets/Scripts/OpenTS2/SimAntics/VMPrimitive.cs.meta
generated
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 636b30d1f9f76fa4b8ff19785fe663f8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in a new issue