public void AddWarpSourceData(WarpSourceData data)
{
if (warpSourceDataList.Contains(data))
return;
// Assumes the last element of warpSourceDataList is always the
// m_WarpSourcesEnd command
fileParser.InsertComponentBefore(EndData, data);
warpSourceDataList.Insert(warpSourceDataList.Count-1, data);
if (data.WarpSourceType == WarpSourceType.PointerWarp && data.PointerString == ".") {
// Create a unique pointer after m_WarpSourcesEnd
int nameIndex = 0;
string name;
do {
name = "customWarpSource" + nameIndex.ToString("d2");
nameIndex++;
}
while (Project.HasLabel(name));
data.PointerString = name;
Label newLabel = new Label(FileParser, name);
// Insert label after m_WarpSourcesEnd
FileParser.InsertComponentAfter(EndData, newLabel);
// Create a blank PointedData to go after this label
WarpSourceData pointedData = new WarpSourceData(Project,
WarpSourceData.WarpCommands[(int)WarpSourceType.PointedWarp],
WarpSourceData.DefaultValues[(int)WarpSourceType.PointedWarp],
FileParser,
new List<int>{-1});
pointedData.Opcode = 0x80;
pointedData.Transition = 4;
FileParser.InsertComponentAfter(newLabel, pointedData);
}
}