Change state timestamp to double precision.

This commit is contained in:
2022-12-19 14:55:15 +08:00
parent e55642cdeb
commit d7b0ca77e9
9 changed files with 40 additions and 40 deletions

View File

@@ -56,7 +56,7 @@ namespace Cryville.Crtr.Event {
private set;
}
public float Time {
public double Time {
get {
return Bus.Time;
}
@@ -225,7 +225,7 @@ namespace Cryville.Crtr.Event {
if (tr.Valid) return r;
#endif
float reltime = 0;
if (rootPrototype != null) reltime = Time - rootPrototype.Time;
if (rootPrototype != null) reltime = (float)(Time - rootPrototype.Time);
GetMotionValue(key).GetValue(reltime, ref r);
if (Parent != null) r.ApplyFrom(Parent.GetRawValue(key));
#if !DISABLE_CACHE
@@ -394,7 +394,7 @@ namespace Cryville.Crtr.Event {
}
}
else {
var scaledTime = (Time - m.Key.Time - ChartPlayer.actualRenderStep * tev.sumfix) / m.Key.Duration;
var scaledTime = (float)((Time - m.Key.Time - ChartPlayer.actualRenderStep * tev.sumfix) / m.Key.Duration);
var lerpedTime = MotionLerper.GetEaseTime(scaledTime, tev.transition, tev.rate);
if (tev.RelativeNode != null) {
var target = value.QueryRelativeNode(tev.RelativeNode.Id);

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace Cryville.Crtr.Event {
public class EventBatch : IComparable<EventBatch>, IEnumerable<StampedEvent> {
public float Time {
public double Time {
get;
private set;
}
@@ -14,7 +14,7 @@ namespace Cryville.Crtr.Event {
get { return queue.Count; }
}
public EventBatch(float time) {
public EventBatch(double time) {
Time = time;
}
@@ -32,7 +32,7 @@ namespace Cryville.Crtr.Event {
}
public int CompareTo(EventBatch other) {
return this.Time.CompareTo(other.Time);
return Time.CompareTo(other.Time);
}
public IEnumerator<StampedEvent> GetEnumerator() {

View File

@@ -17,8 +17,8 @@ namespace Cryville.Crtr.Event {
= new Dictionary<ChartEvent, ContainerState>();
public List<StampedEvent> stampedEvents = new List<StampedEvent>();
readonly List<EventBatch> batches = new List<EventBatch>();
float beat;
double beat;
float tempo;
public EventBatcher(Chart c) : base(c, new List<ChartEvent>()) {
@@ -56,12 +56,12 @@ namespace Cryville.Crtr.Event {
}
}
public override void ForwardOnceToTime(float toTime, Action<ChartEvent> callback) {
float toBeat = (float)Math.Round(beat + (toTime - Time) * tempo / 60f, 6);
public override void ForwardOnceToTime(double toTime, Action<ChartEvent> callback) {
double toBeat = Math.Round(beat + (toTime - Time) * tempo / 60f, 6);
if (EventId >= events.Count)
goto return_ahead;
float ebeat = events[EventId].BeatPosition;
float etime = (float)Math.Round((ebeat - beat) / tempo * 60f + Time, 6);
double ebeat = events[EventId].BeatPosition;
double etime = Math.Round((ebeat - beat) / tempo * 60f + Time, 6);
if (etime > toTime)
goto return_ahead;
var batch = GetEventBatch();

View File

@@ -114,7 +114,7 @@ namespace Cryville.Crtr.Event {
patch.Clear();
}
public override void ForwardOnceToTime(float toTime, Action<EventBatch> callback = null) {
public override void ForwardOnceToTime(double toTime, Action<EventBatch> callback = null) {
if (EventId < events.Count && events[EventId].Time <= toTime) {
Time = events[EventId].Time;
var batch = events[EventId];