TAStudio - implement green-zone invaliding on edit

This commit is contained in:
adelikat 2013-12-14 21:05:54 +00:00
parent 5c9a604ae5
commit ff4e122310
1 changed files with 15 additions and 3 deletions

View File

@ -34,14 +34,14 @@ namespace BizHawk.Client.Common
public void ToggleButton(int frame, string buttonName)
{
//_records[frame].Buttons[buttonName] ^= true; //TODO: be this clean but still fire the event
InvalidateGreenzone(frame);
_records[frame].SetButton(buttonName, !_records[frame].Buttons[buttonName]);
}
public void SetButton(int frame, string buttonName, bool value)
{
//_records[frame].Buttons[buttonName] = value; //TODO: be this clean but still fire the event
InvalidateGreenzone(frame);
_records[frame].SetButton(buttonName, value);
}
@ -52,7 +52,6 @@ namespace BizHawk.Client.Common
private void InputChanged(object sender, MovieRecord.InputEventArgs e)
{
//TODO: manage green zone
Changes = true;
if (OnChanged != null)
@ -61,6 +60,18 @@ namespace BizHawk.Client.Common
}
}
/// <summary>
/// Removes the greenzone content after the given frame
/// </summary>
/// <param name="frame"></param>
private void InvalidateGreenzone(int frame)
{
for (int i = frame + 1; i < _records.Count; i++)
{
_records[i].ClearState();
}
}
#region Events
public delegate void MovieEventHandler(object sender, MovieRecord.InputEventArgs e);
@ -259,6 +270,7 @@ namespace BizHawk.Client.Common
public void PokeFrame(int frame, IController source)
{
InvalidateGreenzone(frame);
if (frame < _records.Count)
{
Changes = true;