Adapt judge functions to Vector4.
This commit is contained in:
@@ -639,50 +639,50 @@ namespace Cryville.Crtr {
|
|||||||
var tt = oputil.AsNumber(_ctxcb(_var_tt));
|
var tt = oputil.AsNumber(_ctxcb(_var_tt));
|
||||||
var fv = oputil.AsVector(_ctxcb(_var_fv));
|
var fv = oputil.AsVector(_ctxcb(_var_fv));
|
||||||
var tv = oputil.AsVector(_ctxcb(_var_tv));
|
var tv = oputil.AsVector(_ctxcb(_var_tv));
|
||||||
ret.SetNumber(ExecuteImpl(fn, tn, ft, tt, fv, tv) ? 1 : 0);
|
ret.SetNumber(ExecuteImpl(fn, tn, ft, tt, fv, tv));
|
||||||
}
|
}
|
||||||
protected abstract bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv);
|
protected abstract float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv);
|
||||||
}
|
}
|
||||||
class func_attack_timing : JudgeFunction {
|
class func_attack_timing : JudgeFunction {
|
||||||
public func_attack_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
public func_attack_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
||||||
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
protected override float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv) {
|
||||||
if (fv != null) return false;
|
if (fv != null) return 0;
|
||||||
var t0 = GetOperand(0).AsNumber() + fn;
|
var t0 = GetOperand(0).AsNumber() + fn;
|
||||||
var t1 = GetOperand(1).AsNumber() + tn;
|
var t1 = GetOperand(1).AsNumber() + tn;
|
||||||
return tt > t0 && tt <= t1;
|
return (tt > t0 && tt <= t1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_enter_timing : JudgeFunction {
|
class func_enter_timing : JudgeFunction {
|
||||||
public func_enter_timing(Func<int, PropSrc> ctxcb) : base(1, ctxcb) { }
|
public func_enter_timing(Func<int, PropSrc> ctxcb) : base(1, ctxcb) { }
|
||||||
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
protected override float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv) {
|
||||||
if (fv == null || tv == null) return false;
|
if (fv == null || tv == null) return 0;
|
||||||
var t0 = GetOperand(0).AsNumber() + fn;
|
var t0 = GetOperand(0).AsNumber() + fn;
|
||||||
return ft < t0 && tt >= t0;
|
return (ft < t0 && tt >= t0) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_release_timing : JudgeFunction {
|
class func_release_timing : JudgeFunction {
|
||||||
public func_release_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
public func_release_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
||||||
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
protected override float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv) {
|
||||||
if (tv != null) return false;
|
if (tv != null) return 0;
|
||||||
var t0 = GetOperand(0).AsNumber() + fn;
|
var t0 = GetOperand(0).AsNumber() + fn;
|
||||||
var t1 = GetOperand(1).AsNumber() + tn;
|
var t1 = GetOperand(1).AsNumber() + tn;
|
||||||
return ft > t0 && ft <= t1;
|
return (ft > t0 && ft <= t1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_leave_timing : JudgeFunction {
|
class func_leave_timing : JudgeFunction {
|
||||||
public func_leave_timing(Func<int, PropSrc> ctxcb) : base(1, ctxcb) { }
|
public func_leave_timing(Func<int, PropSrc> ctxcb) : base(1, ctxcb) { }
|
||||||
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
protected override float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv) {
|
||||||
if (fv == null || tv == null) return false;
|
if (fv == null || tv == null) return 0;
|
||||||
var t1 = GetOperand(0).AsNumber() + tn;
|
var t1 = GetOperand(0).AsNumber() + tn;
|
||||||
return ft < t1 && tt >= t1;
|
return (ft < t1 && tt >= t1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_contact_timing : JudgeFunction {
|
class func_contact_timing : JudgeFunction {
|
||||||
public func_contact_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
public func_contact_timing(Func<int, PropSrc> ctxcb) : base(2, ctxcb) { }
|
||||||
protected override bool ExecuteImpl(float fn, float tn, float ft, float tt, Vector3? fv, Vector3? tv) {
|
protected override float ExecuteImpl(float fn, float tn, float ft, float tt, Vector4? fv, Vector4? tv) {
|
||||||
var t0 = GetOperand(0).AsNumber() + fn;
|
var t0 = GetOperand(0).AsNumber() + fn;
|
||||||
var t1 = GetOperand(1).AsNumber() + tn;
|
var t1 = GetOperand(1).AsNumber() + tn;
|
||||||
return (fv == null || ft < t1) && (tv == null || tt >= t0);
|
return ((fv == null || ft < t1) && (tv == null || tt >= t0)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -697,18 +697,18 @@ namespace Cryville.Crtr {
|
|||||||
return *(float*)ptr;
|
return *(float*)ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Vector3? AsVector(PropSrc src) {
|
public static Vector4? AsVector(PropSrc src) {
|
||||||
if (src == null) throw new ArgumentNullException("src");
|
if (src == null) throw new ArgumentNullException("src");
|
||||||
int type; byte[] value;
|
int type; byte[] value;
|
||||||
src.Get(out type, out value);
|
src.Get(out type, out value);
|
||||||
if (type == PdtInternalType.Vector) {
|
if (type == PdtInternalType.Vector) {
|
||||||
fixed (byte* ptr = value) {
|
fixed (byte* ptr = value) {
|
||||||
return *(Vector3*)ptr;
|
return *(Vector4*)ptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == PdtInternalType.Number) {
|
else if (type == PdtInternalType.Number) {
|
||||||
fixed (byte* ptr = value) {
|
fixed (byte* ptr = value) {
|
||||||
return new Vector3(*(float*)ptr, 0, 0);
|
return new Vector4(*(float*)ptr, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == PdtInternalType.Null) {
|
else if (type == PdtInternalType.Null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user