diff --git a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs
index 8f3db02..eaeed98 100644
--- a/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs
+++ b/Assets/Cryville/Common/Pdt/PdtVariableMemory.cs
@@ -4,7 +4,7 @@ namespace Cryville.Common.Pdt {
///
/// Span on the memory of a .
///
- public unsafe struct PdtVariableMemory {
+ public unsafe struct PdtVariableMemory : IEquatable {
readonly byte* _ptr;
///
/// The length of the span.
@@ -46,6 +46,14 @@ namespace Cryville.Common.Pdt {
for (int i = 0; i < length; i++)
dest[destOffset + i] = _ptr[i];
}
+ ///
+ public bool Equals(PdtVariableMemory obj) {
+ if (Type != obj.Type || Length != obj.Length) return false;
+ for (int i = 0; i < Length; i++) {
+ if (*(_ptr + i) != *(obj._ptr + i)) return false;
+ }
+ return true;
+ }
///
/// Gets the memory of the span as a number.
///
diff --git a/Assets/Cryville/Crtr/PdtEvaluator.cs b/Assets/Cryville/Crtr/PdtEvaluator.cs
index 4498a30..606f39f 100644
--- a/Assets/Cryville/Crtr/PdtEvaluator.cs
+++ b/Assets/Cryville/Crtr/PdtEvaluator.cs
@@ -164,6 +164,7 @@ namespace Cryville.Crtr {
_shortops.Add(new PdtOperatorSignature("frame_seq", 3), new func_frame_seq());
_shortops.Add(new PdtOperatorSignature("in_area", 1), new func_in_area());
+ _shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
}
#region Operators
#pragma warning disable IDE1006
@@ -346,6 +347,17 @@ namespace Cryville.Crtr {
hit.CopyTo(ret);
}
}
+ class func_is : PdtOperator {
+ public func_is() : base(2) { }
+ protected override unsafe void Execute() {
+ var op0 = GetOperand(0);
+ if (op0.Type == PdtInternalType.Error) throw new ArgumentException("Error");
+ var op1 = GetOperand(1);
+ if (op1.Type == PdtInternalType.Error) throw new ArgumentException("Error");
+ var ret = GetReturnFrame(PdtInternalType.Number, sizeof(float));
+ ret.SetNumber(op0.Equals(op1) ? 1 : 0);
+ }
+ }
#endregion
#region Contextual Functions
class func_screen_edge : PdtOperator {