Markers on frames to be truncated are now deleted like in TAS Editor.

This commit is contained in:
kylelyk 2014-08-21 21:24:25 +00:00
parent 86b1e2ed6d
commit 1b85a89b66
2 changed files with 22 additions and 1 deletions

View File

@ -44,7 +44,9 @@ namespace BizHawk.Client.Common
{
Changes = true;
}
// TODO: Markers? What does taseditor do?
//Taseditor deletes markers that are in truncated portion of movie.
Markers.TruncateAt(frame);
}
public override void PokeFrame(int frame, IController source)

View File

@ -72,6 +72,7 @@ namespace BizHawk.Client.Common
}
}
//Add functions as needed
public class TasMovieMarkerList : List<TasMovieMarker>
{
private readonly TasMovie _movie;
@ -128,6 +129,24 @@ namespace BizHawk.Client.Common
this.Sort((m1, m2) => m1.Frame.CompareTo(m2.Frame));
}
/// <summary>
/// Deletes all markers at or below the given start frame.
/// </summary>
/// <param name="startFrame">The first frame for markers to be deleted.</param>
/// <returns>Number of markers deleted.</returns>
public int TruncateAt(int startFrame)
{
int deletedCount = 0;
for (int i = Count - 1; i > -1; i--)
{
if(this[i].Frame >= startFrame){
RemoveAt(i);
deletedCount++;
}
}
return deletedCount;
}
public TasMovieMarker Previous(int currentFrame)
{
return this