Finish renaming floats to axes

This commit is contained in:
YoshiRulz 2020-06-21 12:11:49 +10:00
parent 6fc1228ec2
commit e24ddc9ebe
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
17 changed files with 51 additions and 51 deletions

View File

@ -16,7 +16,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
// pass floats solely from the original source // pass axes solely from the original source
// this works in the code because SourceOr is the autofire controller // this works in the code because SourceOr is the autofire controller
public int AxisValue(string name) => Source.AxisValue(name); public int AxisValue(string name) => Source.AxisValue(name);
@ -38,7 +38,7 @@ namespace BizHawk.Client.Common
return false; return false;
} }
// pass floats solely from the original source // pass axes solely from the original source
// this works in the code because SourceOr is the autofire controller // this works in the code because SourceOr is the autofire controller
public int AxisValue(string name) => Source.AxisValue(name); public int AxisValue(string name) => Source.AxisValue(name);
@ -56,7 +56,7 @@ namespace BizHawk.Client.Common
| (SourceOr?.IsPressed(button) ?? false); | (SourceOr?.IsPressed(button) ?? false);
} }
// pass floats solely from the original source // pass axes solely from the original source
// this works in the code because SourceOr is the autofire controller // this works in the code because SourceOr is the autofire controller
public int AxisValue(string name) => Source.AxisValue(name); public int AxisValue(string name) => Source.AxisValue(name);

View File

@ -66,7 +66,7 @@ namespace BizHawk.Client.Common
_myBoolButtons[button] = controller.IsSticky(button); _myBoolButtons[button] = controller.IsSticky(button);
} }
// float controls don't have sticky logic, so latch default value // axes don't have sticky logic, so latch default value
for (int i = 0; i < Definition.AxisControls.Count; i++) for (int i = 0; i < Definition.AxisControls.Count; i++)
{ {
_myAxisControls[Definition.AxisControls[i]] = Definition.AxisRanges[i].Mid; _myAxisControls[Definition.AxisControls[i]] = Definition.AxisRanges[i].Mid;

View File

@ -31,7 +31,7 @@ namespace BizHawk.Client.Common
bool IsEmpty { get; } bool IsEmpty { get; }
/// <summary> /// <summary>
/// Gets an input log entry that is considered empty. (booleans will be false, floats will be 0) /// Gets an input log entry that is considered empty. (booleans will be false, axes will be 0)
/// </summary> /// </summary>
string EmptyEntry { get; } string EmptyEntry { get; }
} }

View File

@ -124,7 +124,7 @@ namespace BizHawk.Client.Common
private (int Frame, IMovieController Controller) _displayCache = (-1, new Bk2Controller("", NullController.Instance.Definition)); private (int Frame, IMovieController Controller) _displayCache = (-1, new Bk2Controller("", NullController.Instance.Definition));
/// <summary> /// <summary>
/// Returns the mnemonic value for boolean buttons, and actual value for floats, /// Returns the mnemonic value for boolean buttons, and actual value for axes,
/// for a given frame and button. /// for a given frame and button.
/// </summary> /// </summary>
public string DisplayValue(int frame, string buttonName) public string DisplayValue(int frame, string buttonName)

View File

@ -5,6 +5,6 @@
/// </summary> /// </summary>
public enum ColumnType public enum ColumnType
{ {
Boolean, Float, Text, Image Boolean, Axis, Text, Image
} }
} }

View File

@ -991,7 +991,7 @@ namespace BizHawk.Client.EmuHawk
} }
} // foreach event } // foreach event
//also handle floats //also handle axes
//we'll need to isolate the mouse coordinates so we can translate them //we'll need to isolate the mouse coordinates so we can translate them
KeyValuePair<string, int>? mouseX = null, mouseY = null; KeyValuePair<string, int>? mouseX = null, mouseY = null;
foreach (var f in Input.Instance.GetAxisValues()) foreach (var f in Input.Instance.GetAxisValues())

View File

@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
private enum InputChangeTypes private enum InputChangeTypes
{ {
Bool, Bool,
Float Axis
} }
public class TastudioBranchInfo public class TastudioBranchInfo
@ -215,7 +215,7 @@ namespace BizHawk.Client.EmuHawk
if (Tastudio.CurrentTasMovie.GetAxisState(frame, button) != (int) value) // Check if the button state is not already in the state the user set in the lua script if (Tastudio.CurrentTasMovie.GetAxisState(frame, button) != (int) value) // Check if the button state is not already in the state the user set in the lua script
{ {
newChange.Type = LuaChangeTypes.InputChange; newChange.Type = LuaChangeTypes.InputChange;
newChange.InputType = InputChangeTypes.Float; newChange.InputType = InputChangeTypes.Axis;
newChange.Frame = frame; newChange.Frame = frame;
newChange.Button = button; newChange.Button = button;
newChange.ValueAxis = (int) value; newChange.ValueAxis = (int) value;
@ -226,7 +226,7 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
newChange.Type = LuaChangeTypes.InputChange; newChange.Type = LuaChangeTypes.InputChange;
newChange.InputType = InputChangeTypes.Float; newChange.InputType = InputChangeTypes.Axis;
newChange.Frame = frame; newChange.Frame = frame;
newChange.Button = button; newChange.Button = button;
newChange.ValueAxis = (int) value; newChange.ValueAxis = (int) value;
@ -287,7 +287,7 @@ namespace BizHawk.Client.EmuHawk
case InputChangeTypes.Bool: case InputChangeTypes.Bool:
Tastudio.CurrentTasMovie.SetBoolState(_changeList[i].Frame, _changeList[i].Button, _changeList[i].ValueBool); Tastudio.CurrentTasMovie.SetBoolState(_changeList[i].Frame, _changeList[i].Button, _changeList[i].ValueBool);
break; break;
case InputChangeTypes.Float: case InputChangeTypes.Axis:
Tastudio.CurrentTasMovie.SetAxisState(_changeList[i].Frame, _changeList[i].Button, _changeList[i].ValueAxis); Tastudio.CurrentTasMovie.SetAxisState(_changeList[i].Frame, _changeList[i].Button, _changeList[i].ValueAxis);
break; break;
} }

View File

@ -297,11 +297,11 @@ namespace BizHawk.Client.EmuHawk
foreach (string name in latching.Definition.AxisControls) foreach (string name in latching.Definition.AxisControls)
{ {
var sFloat = source.AxisValue(name); var axisValue = source.AxisValue(name);
int indexRange = source.Definition.AxisControls.IndexOf(name); int indexRange = source.Definition.AxisControls.IndexOf(name);
if (sFloat == source.Definition.AxisRanges[indexRange].Mid) if (axisValue == source.Definition.AxisRanges[indexRange].Mid)
{ {
latching.SetAxis(name, sFloat); latching.SetAxis(name, axisValue);
} }
} }
} }

View File

@ -92,7 +92,7 @@
this.AutoadjustInputMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AutoadjustInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.applyPatternToPaintedInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.applyPatternToPaintedInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.onlyOnAutoFireColumnsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.onlyOnAutoFireColumnsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SingleClickFloatEditMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SingleClickAxisEditMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UseInputKeysItem = new System.Windows.Forms.ToolStripMenuItem(); this.UseInputKeysItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.BindMarkersToInputMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.BindMarkersToInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -619,7 +619,7 @@
this.AutoadjustInputMenuItem, this.AutoadjustInputMenuItem,
this.applyPatternToPaintedInputToolStripMenuItem, this.applyPatternToPaintedInputToolStripMenuItem,
this.onlyOnAutoFireColumnsToolStripMenuItem, this.onlyOnAutoFireColumnsToolStripMenuItem,
this.SingleClickFloatEditMenuItem, this.SingleClickAxisEditMenuItem,
this.UseInputKeysItem, this.UseInputKeysItem,
this.toolStripSeparator4, this.toolStripSeparator4,
this.BindMarkersToInputMenuItem, this.BindMarkersToInputMenuItem,
@ -732,14 +732,14 @@
this.onlyOnAutoFireColumnsToolStripMenuItem.Size = new System.Drawing.Size(244, 22); this.onlyOnAutoFireColumnsToolStripMenuItem.Size = new System.Drawing.Size(244, 22);
this.onlyOnAutoFireColumnsToolStripMenuItem.Text = "Only on Auto-Fire columns"; this.onlyOnAutoFireColumnsToolStripMenuItem.Text = "Only on Auto-Fire columns";
// //
// SingleClickFloatEditMenuItem // SingleClickAxisEditMenuItem
// //
this.SingleClickFloatEditMenuItem.Enabled = false; this.SingleClickAxisEditMenuItem.Enabled = false;
this.SingleClickFloatEditMenuItem.Name = "SingleClickFloatEditMenuItem"; this.SingleClickAxisEditMenuItem.Name = "SingleClickAxisEditMenuItem";
this.SingleClickFloatEditMenuItem.Size = new System.Drawing.Size(244, 22); this.SingleClickAxisEditMenuItem.Size = new System.Drawing.Size(244, 22);
this.SingleClickFloatEditMenuItem.Text = "Enter Float Edit mode by single click"; this.SingleClickAxisEditMenuItem.Text = "Enter Axis Edit mode by single click";
this.SingleClickFloatEditMenuItem.Visible = false; this.SingleClickAxisEditMenuItem.Visible = false;
this.SingleClickFloatEditMenuItem.Click += new System.EventHandler(this.SingleClickFloatEditMenuItem_Click); this.SingleClickAxisEditMenuItem.Click += new System.EventHandler(this.SingleClickAxisEditMenuItem_Click);
// //
// UseInputKeysItem // UseInputKeysItem
// //
@ -1758,7 +1758,7 @@
private System.Windows.Forms.ToolStripMenuItem BackupPerFileSaveMenuItem; private System.Windows.Forms.ToolStripMenuItem BackupPerFileSaveMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveBackupMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveBackupMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveBk2BackupMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveBk2BackupMenuItem;
private System.Windows.Forms.ToolStripMenuItem SingleClickFloatEditMenuItem; private System.Windows.Forms.ToolStripMenuItem SingleClickAxisEditMenuItem;
private System.Windows.Forms.ToolStripMenuItem LoadBranchOnDoubleclickMenuItem; private System.Windows.Forms.ToolStripMenuItem LoadBranchOnDoubleclickMenuItem;
private System.Windows.Forms.ToolStripMenuItem SetFontMenuItem; private System.Windows.Forms.ToolStripMenuItem SetFontMenuItem;
} }

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
{ {
// Input Painting // Input Painting
private string _startBoolDrawColumn = ""; private string _startBoolDrawColumn = "";
private string _startFloatDrawColumn = ""; private string _startAxisDrawColumn = "";
private bool _boolPaintState; private bool _boolPaintState;
private int _axisPaintState; private int _axisPaintState;
private int _axisBackupState; private int _axisBackupState;
@ -334,7 +334,7 @@ namespace BizHawk.Client.EmuHawk
else if (index < CurrentTasMovie.InputLogLength) else if (index < CurrentTasMovie.InputLogLength)
{ {
text = CurrentTasMovie.DisplayValue(index, columnName); text = CurrentTasMovie.DisplayValue(index, columnName);
if (column.Type == ColumnType.Float) if (column.Type == ColumnType.Axis)
{ {
// feos: this could be cached, but I don't notice any slowdown this way either // feos: this could be cached, but I don't notice any slowdown this way either
ControllerDefinition.AxisRange range = ControllerType.AxisRanges ControllerDefinition.AxisRange range = ControllerType.AxisRanges
@ -679,10 +679,10 @@ namespace BizHawk.Client.EmuHawk
} }
if (e.Clicks != 2 && !Settings.SingleClickFloatEdit) if (e.Clicks != 2 && !Settings.SingleClickAxisEdit)
{ {
CurrentTasMovie.ChangeLog.BeginNewBatch($"Paint Float {buttonName} from frame {frame}"); CurrentTasMovie.ChangeLog.BeginNewBatch($"Paint Axis {buttonName} from frame {frame}");
_startFloatDrawColumn = buttonName; _startAxisDrawColumn = buttonName;
} }
else // Double-click enters axis editing mode else // Double-click enters axis editing mode
{ {
@ -692,7 +692,7 @@ namespace BizHawk.Client.EmuHawk
} }
else else
{ {
CurrentTasMovie.ChangeLog.BeginNewBatch($"Float Edit: {frame}"); CurrentTasMovie.ChangeLog.BeginNewBatch($"Axis Edit: {frame}");
_axisEditColumn = buttonName; _axisEditColumn = buttonName;
AxisEditRow = frame; AxisEditRow = frame;
_axisTypedValue = ""; _axisTypedValue = "";
@ -778,7 +778,7 @@ namespace BizHawk.Client.EmuHawk
_startCursorDrag = false; _startCursorDrag = false;
_startSelectionDrag = false; _startSelectionDrag = false;
_startBoolDrawColumn = ""; _startBoolDrawColumn = "";
_startFloatDrawColumn = ""; _startAxisDrawColumn = "";
_paintingMinFrame = -1; _paintingMinFrame = -1;
TasView.ReleaseCurrentCell(); TasView.ReleaseCurrentCell();
@ -1137,7 +1137,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
else if (TasView.IsPaintDown && !string.IsNullOrEmpty(_startFloatDrawColumn)) else if (TasView.IsPaintDown && !string.IsNullOrEmpty(_startAxisDrawColumn))
{ {
CurrentTasMovie.IsCountingRerecords = false; CurrentTasMovie.IsCountingRerecords = false;
@ -1148,15 +1148,15 @@ namespace BizHawk.Client.EmuHawk
{ {
if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value) if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
{ {
setVal = CurrentTasMovie.GetAxisState(i - 1, _startFloatDrawColumn); setVal = CurrentTasMovie.GetAxisState(i - 1, _startAxisDrawColumn);
} }
else else
{ {
setVal = AxisPatterns[ControllerType.AxisControls.IndexOf(_startFloatDrawColumn)].GetNextValue(); setVal = AxisPatterns[ControllerType.AxisControls.IndexOf(_startAxisDrawColumn)].GetNextValue();
} }
} }
CurrentTasMovie.SetAxisState(i, _startFloatDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column CurrentTasMovie.SetAxisState(i, _startAxisDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
JumpToGreenzone(); JumpToGreenzone();
} }
} }

View File

@ -774,7 +774,7 @@ namespace BizHawk.Client.EmuHawk
AutosaveAsBk2MenuItem.Checked = Settings.AutosaveAsBk2; AutosaveAsBk2MenuItem.Checked = Settings.AutosaveAsBk2;
AutosaveAsBackupFileMenuItem.Checked = Settings.AutosaveAsBackupFile; AutosaveAsBackupFileMenuItem.Checked = Settings.AutosaveAsBackupFile;
BackupPerFileSaveMenuItem.Checked = Settings.BackupPerFileSave; BackupPerFileSaveMenuItem.Checked = Settings.BackupPerFileSave;
SingleClickFloatEditMenuItem.Checked = Settings.SingleClickFloatEdit; SingleClickAxisEditMenuItem.Checked = Settings.SingleClickAxisEdit;
OldControlSchemeForBranchesMenuItem.Checked = Settings.OldControlSchemeForBranches; OldControlSchemeForBranchesMenuItem.Checked = Settings.OldControlSchemeForBranches;
LoadBranchOnDoubleclickMenuItem.Checked = Settings.LoadBranchOnDoubleClick; LoadBranchOnDoubleclickMenuItem.Checked = Settings.LoadBranchOnDoubleClick;
BindMarkersToInputMenuItem.Checked = CurrentTasMovie.BindMarkersToInput; BindMarkersToInputMenuItem.Checked = CurrentTasMovie.BindMarkersToInput;
@ -889,9 +889,9 @@ namespace BizHawk.Client.EmuHawk
onlyOnAutoFireColumnsToolStripMenuItem.Enabled = applyPatternToPaintedInputToolStripMenuItem.Checked; onlyOnAutoFireColumnsToolStripMenuItem.Enabled = applyPatternToPaintedInputToolStripMenuItem.Checked;
} }
private void SingleClickFloatEditMenuItem_Click(object sender, EventArgs e) private void SingleClickAxisEditMenuItem_Click(object sender, EventArgs e)
{ {
Settings.SingleClickFloatEdit ^= true; Settings.SingleClickAxisEdit ^= true;
} }
private void BindMarkersToInputMenuItem_Click(object sender, EventArgs e) private void BindMarkersToInputMenuItem_Click(object sender, EventArgs e)

View File

@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
AutosaveAsBk2 = false; AutosaveAsBk2 = false;
AutosaveAsBackupFile = false; AutosaveAsBackupFile = false;
BackupPerFileSave = false; BackupPerFileSave = false;
SingleClickFloatEdit = false; SingleClickAxisEdit = false;
OldControlSchemeForBranches = false; OldControlSchemeForBranches = false;
LoadBranchOnDoubleClick = true; LoadBranchOnDoubleClick = true;
@ -89,7 +89,7 @@ namespace BizHawk.Client.EmuHawk
public bool AutosaveAsBk2 { get; set; } public bool AutosaveAsBk2 { get; set; }
public bool AutosaveAsBackupFile { get; set; } public bool AutosaveAsBackupFile { get; set; }
public bool BackupPerFileSave { get; set; } public bool BackupPerFileSave { get; set; }
public bool SingleClickFloatEdit { get; set; } public bool SingleClickAxisEdit { get; set; }
public bool OldControlSchemeForBranches { get; set; } // branch loading will behave differently depending on the recording mode public bool OldControlSchemeForBranches { get; set; } // branch loading will behave differently depending on the recording mode
public bool LoadBranchOnDoubleClick { get; set; } public bool LoadBranchOnDoubleClick { get; set; }
public bool DenoteStatesWithIcons { get; set; } public bool DenoteStatesWithIcons { get; set; }
@ -423,7 +423,7 @@ namespace BizHawk.Client.EmuHawk
{ {
var range = ControllerType.AxisRanges var range = ControllerType.AxisRanges
[ControllerType.AxisControls.IndexOf(kvp.Key)]; [ControllerType.AxisControls.IndexOf(kvp.Key)];
type = ColumnType.Float; type = ColumnType.Axis;
digits = Math.Max(kvp.Value.Length, range.MaxDigits); digits = Math.Max(kvp.Value.Length, range.MaxDigits);
} }
else else

View File

@ -35,9 +35,9 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); GlobalWin.InputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button));
} }
foreach (var floatButton in controller.Definition.AxisControls) foreach (var axisName in controller.Definition.AxisControls)
{ {
GlobalWin.InputManager.ButtonOverrideAdapter.SetAxis(floatButton, controller.AxisValue(floatButton)); GlobalWin.InputManager.ButtonOverrideAdapter.SetAxis(axisName, controller.AxisValue(axisName));
} }
return controller; return controller;

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
private bool _isProgrammicallyChangingNumerics; private bool _isProgrammicallyChangingNumerics;
private bool _isDragging; private bool _isDragging;
private bool _readonly; private bool _readonly;
private bool _isSet; // The tool has to keep track of this because there is currently no way to know if a float button is being autoheld or just held private bool _isSet; // The tool has to keep track of this because there is currently no way to know if an axis is being autoheld or just held
private int? _overrideX; private int? _overrideX;
private int? _overrideY; private int? _overrideY;

View File

@ -331,9 +331,9 @@ namespace BizHawk.Emulation.Common
} }
/// <summary> /// <summary>
/// See ToBoolButtonNameList(). Works the same except with float controls /// See ToBoolButtonNameList(). Works the same except with axes
/// </summary> /// </summary>
public static List<string> ToFloatControlNameList(this IController controller, int? controllerNum = null) public static List<string> ToAxisControlNameList(this IController controller, int? controllerNum = null)
{ {
return ToControlNameList(controller.Definition.AxisControls, controllerNum); return ToControlNameList(controller.Definition.AxisControls, controllerNum);
} }

View File

@ -159,7 +159,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
} }
} }
// Add in the reset timing float control for subneshawk // Add in the reset timing axis for subneshawk
if (using_reset_timing && ControllerDefinition.AxisControls.Count == 0) if (using_reset_timing && ControllerDefinition.AxisControls.Count == 0)
{ {
ControllerDefinition.AxisControls.Add("Reset Cycle"); ControllerDefinition.AxisControls.Add("Reset Cycle");

View File

@ -11,7 +11,7 @@ namespace BizHawk.Common.Tests.Client.Common.Movie
public class LogGeneratorTests public class LogGeneratorTests
{ {
private SimpleController _boolController = null!; private SimpleController _boolController = null!;
private SimpleController _floatController = null!; private SimpleController _axisController = null!;
[TestInitialize] [TestInitialize]
public void Initializer() public void Initializer()
@ -21,7 +21,7 @@ namespace BizHawk.Common.Tests.Client.Common.Movie
Definition = new ControllerDefinition { BoolButtons = { "A" } } Definition = new ControllerDefinition { BoolButtons = { "A" } }
}; };
_floatController = new SimpleController _axisController = new SimpleController
{ {
Definition = new ControllerDefinition().AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0, 100, 200) Definition = new ControllerDefinition().AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0, 100, 200)
}; };
@ -65,7 +65,7 @@ namespace BizHawk.Common.Tests.Client.Common.Movie
[TestMethod] [TestMethod]
public void GenerateLogEntry_Floats() public void GenerateLogEntry_Floats()
{ {
var lg = new Bk2LogEntryGenerator("NES", _floatController); var lg = new Bk2LogEntryGenerator("NES", _axisController);
var actual = lg.GenerateLogEntry(); var actual = lg.GenerateLogEntry();
Assert.AreEqual("| 0, 0,|", actual); Assert.AreEqual("| 0, 0,|", actual);
} }