Skip to content

Commit 4641086

Browse files
committed
Update acnl_convert_csharp_pseudo.cs
1 parent f8c5526 commit 4641086

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

acnl_convert_csharp_pseudo.cs

+10-4
Original file line numberDiff line numberDiff line change
@@ -150,44 +150,50 @@ public static byte[] DataSortACNL(byte[] data)
150150
// Check data type
151151
if (data[0x69] != 0x06 && data[0x69] != 0x07)
152152
{
153+
// Iterate pixels
153154
for (var y = 0; y < 64; y++)
154155
{
155156
for (var x = 0; x < 64 / 2; x++)
156157
{
157-
if (data[0x69] != 0x06 && data[0x69] != 0x07) // Ain't a hat? Off we hack!
158+
// Ain't a hat? Off we hack!
159+
if (data[0x69] != 0x06 && data[0x69] != 0x07)
158160
{
161+
// Grab offsets for chunks
159162
var offset = (x >= 64 / 4 ? 0x200 : 0x0) + (y >= 64 / 2 ? 0x400 : 0x0);
160163
int index = offset + x % (64 / 4) + (y % (64 / 2)) * (64 / 4);
161-
if (data[0x69] == 0x08)
164+
if (data[0x69] == 0x08) // If it's a standee
162165
{
163166
var newIndex = index;
164167
foreach (var kvp in OffsetsProStandeeTexChunk)
165168
{
169+
// Match up chunks
166170
if (index >= kvp.Value && index < kvp.Value + (kvp.Key.Item2 - kvp.Key.Item1))
167171
{
168172
newIndex = (index - kvp.Value) + kvp.Key.Item1;
169173
}
170174
}
171-
dataSorted[0x6C + newIndex] = data[0x6C + index];
175+
dataSorted[0x6C + newIndex] = data[0x6C + index]; // Place chunks
172176
}
173177
else
174178
{
175179
var newIndex = index;
176180
foreach (var kvp in OffsetsProTexChunk)
177181
{
182+
// Match up chunks
178183
if (index >= kvp.Value && index < kvp.Value + (kvp.Key.Item2 - kvp.Key.Item1))
179184
{
180185
newIndex = (index - kvp.Value) + kvp.Key.Item1;
181186
}
182187
}
183-
dataSorted[0x6C + newIndex] = data[0x6C + index];
188+
dataSorted[0x6C + newIndex] = data[0x6C + index]; // Place chunks
184189
}
185190
}
186191
}
187192
}
188193
}
189194
else
190195
{
196+
// It's a hat? Cut it back!
191197
Array.Copy(data, 0x6C, dataSorted, 0x6C, 0x200);
192198
}
193199

0 commit comments

Comments
 (0)