-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormAttributes.cs
More file actions
162 lines (122 loc) · 4.04 KB
/
Copy pathFormAttributes.cs
File metadata and controls
162 lines (122 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
using RetroDevStudio;
using RetroDevStudio.Displayer;
using RetroDevStudio.Formats;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static ElementEditor.Project;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
namespace ElementEditor
{
public partial class FormAttributes : Form
{
private byte m_CurrentValue = 0;
private bool m_DoNotRaiseEvent = false;
public event EventHandler BitsChanged;
public byte ByteValue
{
get
{
return m_CurrentValue;
}
}
public FormAttributes()
{
InitializeComponent();
}
internal void UpdateBits( byte ByteValue )
{
m_CurrentValue = ByteValue;
m_DoNotRaiseEvent = true;
checkFixPermanent.Checked = ( ( m_CurrentValue & 1 ) != 0 );
checkFixOnce.Checked = ( ( m_CurrentValue & 2 ) != 0 );
checkIndestructiblePerm.Checked = ( ( m_CurrentValue & 4 ) != 0 );
checkIndestructibleOnce.Checked = ( ( m_CurrentValue & 8 ) != 0 );
checkSpecialObject.Checked = ( ( m_CurrentValue & 16 ) != 0 );
checkTargetObject.Checked = ( ( m_CurrentValue & 32 ) != 0 );
checkTargetField.Checked = ( ( m_CurrentValue & 64 ) != 0 );
checkStartTile.Checked = ( ( m_CurrentValue & 128 ) != 0 );
m_DoNotRaiseEvent = false;
}
private void checkFixPermanent_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xfe ) | ( checkFixPermanent.Checked ? 1 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkFixOnce_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xfd ) | ( checkFixOnce.Checked ? 2 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkIndestructiblePerm_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xfb ) | ( checkIndestructiblePerm.Checked ? 4 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkIndestructibleOnce_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xf7 ) | ( checkIndestructibleOnce.Checked ? 8 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkSpecialObject_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xef ) | ( checkSpecialObject.Checked ? 16 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkTargetObject_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xdf ) | ( checkTargetObject.Checked ? 32 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkTargetField_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0xbf ) | ( checkTargetField.Checked ? 64 : 0 ) );
BitsChanged?.Invoke( this, e );
}
private void checkStartTile_CheckedChanged( object sender, EventArgs e )
{
if ( m_DoNotRaiseEvent )
{
return;
}
m_CurrentValue = (byte)( ( m_CurrentValue & 0x7f ) | ( checkStartTile.Checked ? 128 : 0 ) );
BitsChanged?.Invoke( this, e );
}
}
}