Feature: Apply auto-fire patterns to painted input
This commit is contained in:
parent
e4b613d9f7
commit
7da9efe3c2
|
@ -82,6 +82,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.AutoadjustInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.DrawInputByDraggingMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.applyPatternToPaintedInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CombineConsecutiveRecordingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UseInputKeysItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -560,6 +562,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.AutoadjustInputMenuItem,
|
||||
this.toolStripSeparator11,
|
||||
this.DrawInputByDraggingMenuItem,
|
||||
this.applyPatternToPaintedInputToolStripMenuItem,
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem,
|
||||
this.CombineConsecutiveRecordingsMenuItem,
|
||||
this.UseInputKeysItem,
|
||||
this.toolStripSeparator4,
|
||||
|
@ -608,6 +612,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.DrawInputByDraggingMenuItem.Text = "Draw Input by dragging";
|
||||
this.DrawInputByDraggingMenuItem.Click += new System.EventHandler(this.DrawInputByDraggingMenuItem_Click);
|
||||
//
|
||||
// applyPatternToPaintedInputToolStripMenuItem
|
||||
//
|
||||
this.applyPatternToPaintedInputToolStripMenuItem.CheckOnClick = true;
|
||||
this.applyPatternToPaintedInputToolStripMenuItem.Name = "applyPatternToPaintedInputToolStripMenuItem";
|
||||
this.applyPatternToPaintedInputToolStripMenuItem.Size = new System.Drawing.Size(288, 22);
|
||||
this.applyPatternToPaintedInputToolStripMenuItem.Text = "Apply Pattern to painted input";
|
||||
this.applyPatternToPaintedInputToolStripMenuItem.CheckedChanged += new System.EventHandler(this.applyPatternToPaintedInputToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// onlyOnAutoFireColumnsToolStripMenuItem
|
||||
//
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.Checked = true;
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.CheckOnClick = true;
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.Enabled = false;
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.Name = "onlyOnAutoFireColumnsToolStripMenuItem";
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.Size = new System.Drawing.Size(288, 22);
|
||||
this.onlyOnAutoFireColumnsToolStripMenuItem.Text = "Only on Auto-Fire columns";
|
||||
//
|
||||
// CombineConsecutiveRecordingsMenuItem
|
||||
//
|
||||
this.CombineConsecutiveRecordingsMenuItem.Enabled = false;
|
||||
|
@ -1498,5 +1520,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem scrollToBottomToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem scrollToCenterToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ScrollToMarkerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem applyPatternToPaintedInputToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem onlyOnAutoFireColumnsToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private string _startFloatDrawColumn = string.Empty;
|
||||
private bool _boolPaintState;
|
||||
private float _floatPaintState;
|
||||
private bool _patternPaint = false;
|
||||
private bool _startMarkerDrag;
|
||||
private bool _startFrameDrag;
|
||||
private bool _frameDragState;
|
||||
|
@ -278,8 +279,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (TasView.CurrentCell == null || !TasView.CurrentCell.RowIndex.HasValue || TasView.CurrentCell.Column == null)
|
||||
return;
|
||||
|
||||
var frame = TasView.CurrentCell.RowIndex.Value;
|
||||
var buttonName = TasView.CurrentCell.Column.Name;
|
||||
int frame = TasView.CurrentCell.RowIndex.Value;
|
||||
string buttonName = TasView.CurrentCell.Column.Name;
|
||||
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
|
@ -327,6 +328,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
_startBoolDrawColumn = buttonName;
|
||||
|
||||
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
|
||||
if (applyPatternToPaintedInputToolStripMenuItem.Checked &&
|
||||
(!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis))
|
||||
{
|
||||
BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].Reset();
|
||||
BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].GetNextValue();
|
||||
_patternPaint = true;
|
||||
}
|
||||
else
|
||||
_patternPaint = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -339,6 +349,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
|
||||
_floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
|
||||
if (applyPatternToPaintedInputToolStripMenuItem.Checked &&
|
||||
(!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis))
|
||||
{
|
||||
FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].Reset();
|
||||
CurrentTasMovie.SetFloatState(frame, buttonName,
|
||||
FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].GetNextValue());
|
||||
_patternPaint = true;
|
||||
}
|
||||
else
|
||||
_patternPaint = false;
|
||||
|
||||
|
||||
if (e.Clicks != 2)
|
||||
{
|
||||
|
@ -604,9 +625,17 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
|
||||
{
|
||||
for (var i = startVal; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
|
||||
for (var i = startVal + 1; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
|
||||
{
|
||||
CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, _boolPaintState); // Notice it uses new row, old column, you can only paint across a single column
|
||||
bool setVal = _boolPaintState;
|
||||
if (_patternPaint && _boolPaintState)
|
||||
{
|
||||
if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
|
||||
setVal = CurrentTasMovie.BoolIsPressed(i - 1, _startBoolDrawColumn);
|
||||
else
|
||||
setVal = BoolPatterns[controllerType.BoolButtons.IndexOf(_startBoolDrawColumn)].GetNextValue();
|
||||
}
|
||||
CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
}
|
||||
|
@ -619,14 +648,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
|
||||
{
|
||||
for (var i = startVal; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
|
||||
for (var i = startVal + 1; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
|
||||
{
|
||||
if (i < CurrentTasMovie.InputLogLength)
|
||||
float setVal = _floatPaintState;
|
||||
if (_patternPaint)
|
||||
{
|
||||
CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, _floatPaintState); // Notice it uses new row, old column, you can only paint across a single column
|
||||
if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
|
||||
setVal = CurrentTasMovie.GetFloatState(i - 1, _startFloatDrawColumn);
|
||||
else
|
||||
setVal = FloatPatterns[controllerType.FloatControls.IndexOf(_startFloatDrawColumn)].GetNextValue();
|
||||
}
|
||||
CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
if (TasView.CurrentCell.RowIndex.Value < _triggerAutoRestoreFromFrame)
|
||||
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
|
||||
}
|
||||
|
||||
RefreshTasView();
|
||||
|
|
|
@ -662,6 +662,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
TasView.InputPaintingMode = Settings.DrawInput ^= true;
|
||||
}
|
||||
|
||||
private void applyPatternToPaintedInputToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
onlyOnAutoFireColumnsToolStripMenuItem.Enabled = applyPatternToPaintedInputToolStripMenuItem.Checked;
|
||||
}
|
||||
|
||||
private void BindMarkersToInputMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentTasMovie.BindMarkersToInput = BindMarkersToInputMenuItem.Checked;
|
||||
|
|
|
@ -792,6 +792,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (e.KeyCode == Keys.F)
|
||||
TasPlaybackBox.FollowCursor ^= true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue