Make the function interval
contextual and linear.
This commit is contained in:
@@ -176,7 +176,6 @@ namespace Cryville.Crtr {
|
|||||||
|
|
||||||
_shortops.Add(new PdtOperatorSignature("frame_seq", 3), new func_frame_seq());
|
_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("in_area", 1), new func_in_area());
|
||||||
_shortops.Add(new PdtOperatorSignature("interval", 3), new func_interval());
|
|
||||||
_shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
|
_shortops.Add(new PdtOperatorSignature("is", 2), new func_is());
|
||||||
|
|
||||||
_ctxops.Add(IdentifierManager.Shared.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
|
_ctxops.Add(IdentifierManager.Shared.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
|
||||||
@@ -192,6 +191,8 @@ namespace Cryville.Crtr {
|
|||||||
_ctxops.Add(IdentifierManager.Shared.Request("ease_out"), new func_cubic_bezier_fixed(0f, 0f, 0.58f, 1f, () => ContextSelfValue));
|
_ctxops.Add(IdentifierManager.Shared.Request("ease_out"), new func_cubic_bezier_fixed(0f, 0f, 0.58f, 1f, () => ContextSelfValue));
|
||||||
_ctxops.Add(IdentifierManager.Shared.Request("ease_in_out"), new func_cubic_bezier_fixed(0.42f, 0f, 0.58f, 1f, () => ContextSelfValue));
|
_ctxops.Add(IdentifierManager.Shared.Request("ease_in_out"), new func_cubic_bezier_fixed(0.42f, 0f, 0.58f, 1f, () => ContextSelfValue));
|
||||||
|
|
||||||
|
_ctxops.Add(IdentifierManager.Shared.Request("interval"), new func_interval(() => ContextSelfValue));
|
||||||
|
|
||||||
Func<int, PropSrc> cccb = k => ContextCascadeLookup(k);
|
Func<int, PropSrc> cccb = k => ContextCascadeLookup(k);
|
||||||
_ctxops.Add(IdentifierManager.Shared.Request("attack_timing"), new func_attack_timing(cccb));
|
_ctxops.Add(IdentifierManager.Shared.Request("attack_timing"), new func_attack_timing(cccb));
|
||||||
_ctxops.Add(IdentifierManager.Shared.Request("enter_timing"), new func_enter_timing(cccb));
|
_ctxops.Add(IdentifierManager.Shared.Request("enter_timing"), new func_enter_timing(cccb));
|
||||||
@@ -377,16 +378,6 @@ namespace Cryville.Crtr {
|
|||||||
hit.CopyTo(ret);
|
hit.CopyTo(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class func_interval : PdtOperator {
|
|
||||||
public func_interval() : base(3) { }
|
|
||||||
protected override unsafe void Execute() {
|
|
||||||
var value = GetOperand(0).AsNumber();
|
|
||||||
var min = GetOperand(1).AsNumber();
|
|
||||||
var max = GetOperand(2).AsNumber();
|
|
||||||
var ret = GetReturnFrame(PdtInternalType.Number, sizeof(float));
|
|
||||||
ret.SetNumber((value - min) * (max - value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class func_is : PdtOperator {
|
class func_is : PdtOperator {
|
||||||
public func_is() : base(2) { }
|
public func_is() : base(2) { }
|
||||||
protected override unsafe void Execute() {
|
protected override unsafe void Execute() {
|
||||||
@@ -619,6 +610,32 @@ namespace Cryville.Crtr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region Area Functions
|
||||||
|
class func_interval : PdtOperator {
|
||||||
|
readonly Func<PropSrc> _ctxcb;
|
||||||
|
public func_interval(Func<PropSrc> ctxcb) : base(3) { _ctxcb = ctxcb; }
|
||||||
|
protected override unsafe void Execute() {
|
||||||
|
float min, value, max;
|
||||||
|
switch (LoadedOperandCount) {
|
||||||
|
case 2:
|
||||||
|
value = oputil.AsNumber(_ctxcb());
|
||||||
|
min = GetOperand(0).AsNumber();
|
||||||
|
max = GetOperand(1).AsNumber();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
value = GetOperand(0).AsNumber();
|
||||||
|
min = GetOperand(1).AsNumber();
|
||||||
|
max = GetOperand(2).AsNumber();
|
||||||
|
break;
|
||||||
|
default: throw new ArgumentException("Argument count not 2 or 3");
|
||||||
|
}
|
||||||
|
float center = (max + min) / 2;
|
||||||
|
float extent = (max - min) / 2;
|
||||||
|
var ret = GetReturnFrame(PdtInternalType.Number, sizeof(float));
|
||||||
|
ret.SetNumber(1 - Math.Abs(value - center) / extent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#region Judge Functions
|
#region Judge Functions
|
||||||
static readonly int _var_fn = IdentifierManager.Shared.Request("judge_clip_from");
|
static readonly int _var_fn = IdentifierManager.Shared.Request("judge_clip_from");
|
||||||
static readonly int _var_tn = IdentifierManager.Shared.Request("judge_clip_to");
|
static readonly int _var_tn = IdentifierManager.Shared.Request("judge_clip_to");
|
||||||
|
Reference in New Issue
Block a user