TAStudio - float painting
This commit is contained in:
parent
1ef53257e9
commit
f8ee569bbb
|
@ -157,6 +157,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#endregion
|
||||
|
||||
public void SetFloat(string buttonName, float value)
|
||||
{
|
||||
MyFloatControls[buttonName] = value;
|
||||
}
|
||||
|
||||
public class Bk2ControllerDefinition : ControllerDefinition
|
||||
{
|
||||
public Bk2ControllerDefinition()
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (adapter.Type.FloatControls.Contains(buttonName))
|
||||
{
|
||||
adapter.GetFloat(buttonName);
|
||||
return adapter.GetFloat(buttonName).ToString();
|
||||
}
|
||||
|
||||
return "!";
|
||||
|
@ -118,12 +118,37 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void SetFloatState(int frame, string buttonName, float val)
|
||||
{
|
||||
if (frame < _log.Count)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
var old = adapter.GetFloat(buttonName);
|
||||
adapter.SetFloat(buttonName, val);
|
||||
|
||||
var lg = LogGeneratorInstance();
|
||||
lg.SetSource(adapter);
|
||||
_log[frame] = lg.GenerateLogEntry();
|
||||
|
||||
if (old != val)
|
||||
{
|
||||
Changes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BoolIsPressed(int frame, string buttonName)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
return adapter.IsPressed(buttonName);
|
||||
}
|
||||
|
||||
public float GetFloatValue(int frame, string buttonName)
|
||||
{
|
||||
var adapter = GetInputState(frame) as Bk2ControllerAdapter;
|
||||
return adapter.GetFloat(buttonName);
|
||||
}
|
||||
|
||||
public override string GetInput(int frame)
|
||||
{
|
||||
if (Global.Emulator.Frame == frame && !StateManager.HasState(frame))
|
||||
|
|
|
@ -9,8 +9,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class TAStudio
|
||||
{
|
||||
// Input Painting
|
||||
private string _startDrawColumn = string.Empty;
|
||||
private string _startBoolDrawColumn = string.Empty;
|
||||
private string _startFloatDrawColumn = string.Empty;
|
||||
private bool _boolPaintState;
|
||||
private float _floatPaintState;
|
||||
private bool _startMarkerDrag;
|
||||
private bool _startFrameDrag;
|
||||
|
||||
|
@ -97,9 +99,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
_tas.ToggleBoolState(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
|
||||
TasView.Refresh();
|
||||
|
||||
_startDrawColumn = TasView.PointedCell.Column;
|
||||
_startBoolDrawColumn = TasView.PointedCell.Column;
|
||||
_boolPaintState = _tas.BoolIsPressed(frame, buttonName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_startFloatDrawColumn = TasView.PointedCell.Column;
|
||||
_floatPaintState = _tas.GetFloatValue(frame, buttonName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +115,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_startMarkerDrag = false;
|
||||
_startFrameDrag = false;
|
||||
_startDrawColumn = string.Empty;
|
||||
_startBoolDrawColumn = string.Empty;
|
||||
_startFloatDrawColumn = string.Empty;
|
||||
_floatPaintState = 0;
|
||||
}
|
||||
|
||||
private void TasView_PointedCellChanged(object sender, TasListView.CellEventArgs e)
|
||||
|
@ -142,14 +151,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startDrawColumn))
|
||||
else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn))
|
||||
{
|
||||
if (e.OldCell.Row.HasValue && e.NewCell.Row.HasValue)
|
||||
{
|
||||
for (var i = startVal; i < endVal; i++)
|
||||
{
|
||||
_tas.SetBoolState(i, _startDrawColumn, _boolPaintState); // Notice it uses new row, old column, you can only paint across a single column
|
||||
_tas.SetBoolState(i, _startBoolDrawColumn, _boolPaintState); // Notice it uses new row, old column, you can only paint across a single column
|
||||
}
|
||||
|
||||
TasView.Refresh();
|
||||
}
|
||||
}
|
||||
else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn))
|
||||
{
|
||||
if (e.OldCell.Row.HasValue && e.NewCell.Row.HasValue)
|
||||
{
|
||||
for (var i = startVal; i < endVal; i++)
|
||||
{
|
||||
_tas.SetFloatState(i, _startFloatDrawColumn, _floatPaintState); // Notice it uses new row, old column, you can only paint across a single column
|
||||
}
|
||||
|
||||
TasView.Refresh();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue