Modify logic for "and" and "or" operator and in_area function. Add null marshaling for input proxy.
This commit is contained in:
@@ -117,10 +117,15 @@ namespace Cryville.Crtr {
|
|||||||
readonly byte[] _vecbuf = new byte[3 * sizeof(float) + sizeof(int)];
|
readonly byte[] _vecbuf = new byte[3 * sizeof(float) + sizeof(int)];
|
||||||
unsafe void OnInput(InputIdentifier id, InputVector vec, string target) {
|
unsafe void OnInput(InputIdentifier id, InputVector vec, string target) {
|
||||||
_etor.ContextCascadeInsert();
|
_etor.ContextCascadeInsert();
|
||||||
|
if (vec.IsNull) {
|
||||||
|
_etor.ContextCascadeUpdate(_var_value, new PropSrc.Arbitrary(PdtInternalType.Null, new byte[0]));
|
||||||
|
}
|
||||||
|
else {
|
||||||
fixed (byte* ptr = _vecbuf) {
|
fixed (byte* ptr = _vecbuf) {
|
||||||
*(Vector3*)ptr = vec.Vector;
|
*(Vector3*)ptr = vec.Vector;
|
||||||
}
|
}
|
||||||
_etor.ContextCascadeUpdate(_var_value, new PropSrc.Arbitrary(PdtInternalType.Vector, _vecbuf));
|
_etor.ContextCascadeUpdate(_var_value, new PropSrc.Arbitrary(PdtInternalType.Vector, _vecbuf));
|
||||||
|
}
|
||||||
OnInput(id, target);
|
OnInput(id, target);
|
||||||
_etor.ContextCascadeDiscard();
|
_etor.ContextCascadeDiscard();
|
||||||
}
|
}
|
||||||
|
@@ -87,8 +87,8 @@ namespace Cryville.Crtr {
|
|||||||
static readonly int _colop_and = IdentifierManager.SharedInstance.Request("&");
|
static readonly int _colop_and = IdentifierManager.SharedInstance.Request("&");
|
||||||
static readonly int _colop_or = IdentifierManager.SharedInstance.Request("|");
|
static readonly int _colop_or = IdentifierManager.SharedInstance.Request("|");
|
||||||
protected override bool Collapse(int name, PdtVariableMemory param) {
|
protected override bool Collapse(int name, PdtVariableMemory param) {
|
||||||
if (name == _colop_and) return param.AsNumber() == 0;
|
if (name == _colop_and) return param.AsNumber() <= 0;
|
||||||
else if(name == _colop_or) return param.AsNumber() != 0;
|
else if (name == _colop_or) return param.AsNumber() > 0;
|
||||||
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", name));
|
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ namespace Cryville.Crtr {
|
|||||||
if (arg.Type == PdtInternalType.Error) {
|
if (arg.Type == PdtInternalType.Error) {
|
||||||
throw new InvalidOperationException("Error");
|
throw new InvalidOperationException("Error");
|
||||||
}
|
}
|
||||||
else if (arg.Type == PdtInternalType.Number && arg.AsNumber() >= 0) {
|
else if (arg.Type == PdtInternalType.Number && arg.AsNumber() <= 0) {
|
||||||
GetReturnFrame(PdtInternalType.Null, 0);
|
GetReturnFrame(PdtInternalType.Null, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user