Compare commits
2 Commits
d2ff168e25
...
975b48e61e
Author | SHA1 | Date | |
---|---|---|---|
975b48e61e | |||
9e0bf024d7 |
@@ -85,6 +85,19 @@ namespace Cryville.Crtr {
|
||||
}
|
||||
return ~num;
|
||||
}
|
||||
int BinarySearchFirst(List<JudgeEvent> list, float time, int stack) {
|
||||
if (list[0].Definition.stack == stack && list[0].StartClip == time) return 0;
|
||||
int num = 0;
|
||||
int num2 = list.Count - 1;
|
||||
while (num <= num2) {
|
||||
int num3 = num + (num2 - num >> 1);
|
||||
int num4 = -list[num3].Definition.stack.CompareTo(stack);
|
||||
if (num4 == 0) num4 = list[num3].StartClip.CompareTo(time);
|
||||
if (num4 >= 0) num2 = num3 - 1;
|
||||
else num = num3 + 1;
|
||||
}
|
||||
return num + 1;
|
||||
}
|
||||
public void Feed(Identifier target, float ft, float tt) {
|
||||
Forward(target, tt);
|
||||
var actlist = activeEvs[target];
|
||||
@@ -103,11 +116,14 @@ namespace Cryville.Crtr {
|
||||
if (def.scores != null) UpdateScore(def.scores);
|
||||
if (def.pass != null) Pass(def.pass);
|
||||
actlist.RemoveAt(index);
|
||||
index = BinarySearch(actlist, ev.StartClip, def.prop);
|
||||
if (def.stack != def.prop && actlist.Count > 0) {
|
||||
index = BinarySearchFirst(actlist, ev.StartClip, def.prop);
|
||||
if (index < 0) index = ~index;
|
||||
}
|
||||
else index++;
|
||||
}
|
||||
else index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool Pass(Identifier[] ids) {
|
||||
|
@@ -146,6 +146,8 @@ namespace Cryville.Crtr {
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("attack_timing"), new func_attack_timing(cccb));
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("enter_timing"), new func_enter_timing(cccb));
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("release_timing"), new func_release_timing(cccb));
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("leave_timing"), new func_leave_timing(cccb));
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("contact_timing"), new func_contact_timing(cccb));
|
||||
}
|
||||
static PdtEvaluator() {
|
||||
_shortops.Add(new PdtOperatorSignature("@", 2), new op_at_2());
|
||||
@@ -507,6 +509,22 @@ namespace Cryville.Crtr {
|
||||
return ft > t0 && ft <= t1;
|
||||
}
|
||||
}
|
||||
class func_leave_timing : JudgeFunction {
|
||||
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) {
|
||||
if (fv == null || tv == null) return false;
|
||||
var t1 = GetOperand(0).AsNumber() + tn;
|
||||
return ft < t1 && tt >= t1;
|
||||
}
|
||||
}
|
||||
class func_contact_timing : JudgeFunction {
|
||||
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) {
|
||||
var t0 = GetOperand(0).AsNumber() + fn;
|
||||
var t1 = GetOperand(1).AsNumber() + tn;
|
||||
return (fv == null || ft < t1) && (tv == null || tt >= t0);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
unsafe static class oputil {
|
||||
public static float AsNumber(PropSrc src) {
|
||||
|
Reference in New Issue
Block a user