Skip to content

Commit 7389a13

Browse files
committed
Corrected an error regarding writing UVs to a Vector2 that was still null
(Though model conversion still only seems to work for sims rather than objects)
1 parent 36c8745 commit 7389a13

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

MorcuTool/src/FileTypes/Package.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ public void LoadPackage()
645645

646646
default:
647647
Console.WriteLine("Unknown type ID " + subfiles[i].typeID);
648-
Console.WriteLine("and this type ID appears " + GetNumOccurrencesOfTypeID(subfiles[i].typeID) + " times in total.");
649648
Console.WriteLine("index of file was " + filesprocessed);
650649
fileextension = "."+subfiles[i].typeID.ToString();
651650
break;

MorcuTool/src/FileTypes/Subfiles/DS/MSG.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public string MSK_DS_string_to_normal_string(byte[] input) {
1616
StringBuilder sb = new StringBuilder(input.Length);
1717

1818
foreach (byte b in input) {
19-
// sb.Append(Utility.CharFromMSKDSChar(b));
20-
Console.WriteLine("Temporarily dummied out");
19+
// sb.Append(Utility.CharFromMSKDSChar(b));
20+
// temporarily dummmied out
2121
}
2222

2323
return sb.ToString();

MorcuTool/src/FileTypes/Subfiles/MsaAnimation.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ public class Table1Entry { //setting table 1's count to 1 turns the animati
1414
public uint unk1; //start frame, possibly?
1515
public uint unk2; //flags? padding? usually 0
1616
public uint unk3; //u32 start of this frame's data, relative to the data section
17-
public FrameData frmData;
17+
public FrameData frmData1;
18+
public FrameData frmData2;
1819

1920
public Table1Entry(byte[] filebytes, int offset, MsaAnimation parent) {
2021
unk1 = Utility.ReadUInt32BigEndian(filebytes, offset);
2122
unk2 = Utility.ReadUInt32BigEndian(filebytes, offset + 4);
2223
unk3 = Utility.ReadUInt32BigEndian(filebytes, offset + 8);
23-
frmData = new FrameData(filebytes, parent.dataSectionOffset + unk3);
24+
frmData1 = new FrameData(filebytes, parent.dataSectionOffset + unk1);
25+
frmData2 = new FrameData(filebytes, parent.dataSectionOffset + unk3);
2426
}
2527
}
2628

2729

2830
public class FrameData {
2931

3032
public FrameData(byte[] filebytes, uint offset) {
31-
33+
Console.WriteLine("FrameData type: "+Utility.ReadUInt32BigEndian(filebytes,(int)offset));
3234
}
3335
}
3436

MorcuTool/src/Forms/Form1.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ public List<byte> ConvertSkyHeroesModel(string filename, byte[] file)
264264

265265
reader.BaseStream.Position += 0x10;
266266

267+
if (newVertex.UVchannels[0] == null) {
268+
newVertex.UVchannels[0] = new MorcuMath.Vector2();
269+
}
270+
267271
newVertex.UVchannels[0].x = Utility.ReverseEndianSingle(reader.ReadSingle());
268272
newVertex.UVchannels[0].y = Utility.ReverseEndianSingle(reader.ReadSingle()) * -1;
269273

@@ -500,6 +504,8 @@ private void convertModelToolStripMenuItem_Click(object sender, EventArgs e)
500504
openFileDialog2.CheckPathExists = true;
501505
openFileDialog2.Multiselect = true;
502506

507+
bool createdAtLeastOneOBJ = false;
508+
503509
if (openFileDialog2.ShowDialog() == DialogResult.OK)
504510
{
505511
foreach (string filename in openFileDialog2.FileNames)
@@ -523,11 +529,12 @@ private void convertModelToolStripMenuItem_Click(object sender, EventArgs e)
523529
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
524530
{
525531
s.rmdl.GenerateObj(saveFileDialog1.FileName);
532+
createdAtLeastOneOBJ = true;
526533
}
527534
}
528-
529535
}
530-
}
536+
MessageBox.Show("Created .OBJ model(s) in same directory as original file.");
537+
}
531538

532539
}
533540

0 commit comments

Comments
 (0)