private void Tag_NewScenarioStructureTag(int index, string name, Group newTagGroup) { //Prepare TagId newId = Map.IndexEntries.Last.Id; ScenarioStructureTag newTag = new ScenarioStructureTag(index) { Id = newId, Name = name, TagGroup = newTagGroup }; //Add Map.AddScenarioStructureTags(newTag); //Reload Host.Request(this, "ReloadMap"); }
private void TagDuplicator_Click(object sender, EventArgs e) { //Prepare Group newTagGroup = null; IndexEntry last = Map.IndexEntries.Last; //Check if (SelectedEntry != null) { //Get name string tagName = string.Empty; using (NameDialog nameDlg = new NameDialog()) { //Setup nameDlg.TagName = SelectedEntry.Filename; //Show DialogResult result = DialogResult.OK; while (Map.IndexEntries.Count(i => i.Filename == nameDlg.TagName && i.Root == SelectedEntry.Root) > 0 && result == DialogResult.OK) { result = nameDlg.ShowDialog(); } //Check if (result == DialogResult.OK) { tagName = nameDlg.TagName; } else { return; } } //Initialize BinaryReader instance for the selected tag using (BinaryReader reader = SelectedEntry.TagData.CreateReader()) { //Create tag group for selected entry newTagGroup = TagLookup.CreateTagGroup(SelectedEntry.Root); //Goto tag data and read SelectedEntry.TagData.Seek((uint)SelectedEntry.PostProcessedOffset, SeekOrigin.Begin); newTagGroup.Read(reader); } //Check the root for a scenario structure tag if (SelectedEntry.Root == HaloTags.sbsp || SelectedEntry.Root == HaloTags.ltmp) { //Scenario dialog using (StructureBspSelectDialog scenarioDlg = new StructureBspSelectDialog(Map.Scenario)) if (scenarioDlg.ShowDialog() == DialogResult.OK && scenarioDlg.SelectedBlockIndex >= 0) { //Prepare ScenarioStructureTag bspTag = new ScenarioStructureTag(scenarioDlg.SelectedBlockIndex) { SourceEntry = SelectedEntry, Name = tagName, Id = last.Id, TagGroup = newTagGroup }; //Add Map.AddScenarioStructureTags(bspTag); //Reload Host.Request(this, "ReloadMap"); } } else { //Prepare Tag tag = new Tag() { SourceEntry = SelectedEntry, Name = tagName, Id = last.Id, TagGroup = newTagGroup }; //Add Map.AddTags(tag); //Reload Host.Request(this, "ReloadMap"); } } }
private void NewTagButton_Click(object sender, EventArgs e) { //Get last IndexEntry last = Map.IndexEntries.Last; if (last.Root != HaloTags.ugh_) { return; } //Prepare using (GroupDialog groupDlg = new GroupDialog()) { //Show if (groupDlg.ShowDialog() == DialogResult.OK) { using (NameDialog nameDialog = new NameDialog()) if (nameDialog.ShowDialog() == DialogResult.OK) { //Prepare string tagName = nameDialog.TagName; Group tagGroup = TagLookup.CreateTagGroup(groupDlg.SelectedGroup); //Check if (tagGroup != null) { if (groupDlg.SelectedGroup == HaloTags.ltmp || groupDlg.SelectedGroup == HaloTags.sbsp) { //Ask for which BSP index to build into using (StructureBspSelectDialog bspSelectDlg = new StructureBspSelectDialog(Map.Scenario)) if (bspSelectDlg.ShowDialog() == DialogResult.OK && bspSelectDlg.SelectedBlockIndex >= 0) { //Create tag ScenarioStructureTag tag = new ScenarioStructureTag(bspSelectDlg.SelectedBlockIndex) { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddScenarioStructureTags(tag); } } else { //Create tag Tag tag = new Tag() { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddTags(tag); } } //Reload Host.Request(this, "ReloadMap"); } } } }