Added a redraw timer to the debug editor

* redraws the background game screen when moving the editor window.
* works for sfall DX9 mode.
This commit is contained in:
NovaRain
2022-01-17 09:51:24 +08:00
parent 937cff235e
commit 0a5ec8c70f
6 changed files with 29 additions and 4 deletions
+8
View File
@@ -23,6 +23,7 @@
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -34,6 +35,7 @@
this.bSGlobals = new System.Windows.Forms.Button(); this.bSGlobals = new System.Windows.Forms.Button();
this.bArrays = new System.Windows.Forms.Button(); this.bArrays = new System.Windows.Forms.Button();
this.bEdit = new System.Windows.Forms.Button(); this.bEdit = new System.Windows.Forms.Button();
this.redrawTimer = new System.Windows.Forms.Timer(this.components);
this.bCrittersLvar = new System.Windows.Forms.Button(); this.bCrittersLvar = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@@ -154,6 +156,11 @@
this.bEdit.UseVisualStyleBackColor = true; this.bEdit.UseVisualStyleBackColor = true;
this.bEdit.Click += new System.EventHandler(this.bEdit_Click); this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
// //
// redrawTimer
//
this.redrawTimer.Interval = 200;
this.redrawTimer.Tick += new System.EventHandler(this.timer1_Tick);
//
// bCrittersLvar // bCrittersLvar
// //
this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -202,6 +209,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column1; private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2; private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3; private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
internal System.Windows.Forms.Timer redrawTimer;
private System.Windows.Forms.Button bCrittersLvar; private System.Windows.Forms.Button bCrittersLvar;
} }
+9
View File
@@ -137,6 +137,7 @@ namespace FalloutClient {
sr.Close(); sr.Close();
} }
Redraw(); Redraw();
redrawTimer.Start();
} }
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) { private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
@@ -188,6 +189,7 @@ namespace FalloutClient {
default: default:
return; return;
} }
redrawTimer.Stop();
if (e.ColumnIndex == 2) { if (e.ColumnIndex == 2) {
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
int val; int val;
@@ -211,11 +213,13 @@ namespace FalloutClient {
connection.WriteInt(converter.GetAsInt(val)); connection.WriteInt(converter.GetAsInt(val));
} }
} }
redrawTimer.Start();
} }
private void bEdit_Click(object sender, EventArgs e) { private void bEdit_Click(object sender, EventArgs e) {
if (dataGridView1.SelectedRows.Count == 0) return; if (dataGridView1.SelectedRows.Count == 0) return;
int i = (int)dataGridView1.SelectedRows[0].Tag; int i = (int)dataGridView1.SelectedRows[0].Tag;
redrawTimer.Stop();
switch (mode) { switch (mode) {
case Mode.Arrays: { case Mode.Arrays: {
DataType[] types = new DataType[connection.ArrayLengths[i]]; DataType[] types = new DataType[connection.ArrayLengths[i]];
@@ -333,6 +337,7 @@ namespace FalloutClient {
} }
break; break;
} }
redrawTimer.Start();
} }
private void bCrittersLvar_Click(object sender, EventArgs e) { private void bCrittersLvar_Click(object sender, EventArgs e) {
@@ -381,5 +386,9 @@ namespace FalloutClient {
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) {
dataGridView1.Rows[e.RowIndex].Tag = e.RowIndex; dataGridView1.Rows[e.RowIndex].Tag = e.RowIndex;
} }
private void timer1_Tick(object sender, EventArgs e) {
connection.WriteDataType(DataTypeSend.RedrawGame);
}
} }
} }
+3
View File
@@ -129,4 +129,7 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="redrawTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
+4
View File
@@ -48,8 +48,10 @@ namespace FalloutClient {
} }
public static string[] ShowEditor(DebugEditor form, string[] names, DataType[] types, string[] values, bool isMap = false) { public static string[] ShowEditor(DebugEditor form, string[] names, DataType[] types, string[] values, bool isMap = false) {
form.redrawTimer.Start();
EditorWindow editor = new EditorWindow(names, types, values, isMap); EditorWindow editor = new EditorWindow(names, types, values, isMap);
editor.ShowDialog(); editor.ShowDialog();
form.redrawTimer.Stop();
if (editor.save) { if (editor.save) {
if (valueInHex) editor.ConvertValues(false); if (valueInHex) editor.ConvertValues(false);
return editor.values; return editor.values;
@@ -70,8 +72,10 @@ namespace FalloutClient {
} }
public static string[] ShowEditor(DebugEditor form, string[] lvalues) { public static string[] ShowEditor(DebugEditor form, string[] lvalues) {
form.redrawTimer.Start();
EditorWindow editor = new EditorWindow(lvalues); EditorWindow editor = new EditorWindow(lvalues);
editor.ShowDialog(); editor.ShowDialog();
form.redrawTimer.Stop();
if (editor.save) { if (editor.save) {
if (valueInHex) editor.ConvertValues(false); if (valueInHex) editor.ConvertValues(false);
return editor.values; return editor.values;
+2 -1
View File
@@ -32,6 +32,7 @@ namespace FalloutClient {
SetArray = 10, SetArray = 10,
GetLocal = 11, GetLocal = 11,
SetLocal = 12, SetLocal = 12,
Exit = 254 Exit = 254,
RedrawGame = 255
} }
} }
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("sfall")] [assembly: AssemblyProduct("sfall")]
[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyCopyright("Copyright (C) 2022")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("4.1.9.0")] [assembly: AssemblyVersion("4.1.9.1")]
[assembly: AssemblyFileVersion("4.1.9.0")] [assembly: AssemblyFileVersion("4.1.9.1")]