Skip to content

Commit

Permalink
add SHRP, SURF, duplotron template
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Nov 28, 2018
1 parent 38ffc12 commit d25784a
Show file tree
Hide file tree
Showing 44 changed files with 1,412 additions and 88 deletions.
29 changes: 28 additions & 1 deletion IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ private void PopulateAssetList(AssetType type = AssetType.Null)

assetList.Sort();
listBoxAssets.Items.AddRange(assetList.ToArray());

toolStripStatusLabelSelectionCount.Text = $"{listBoxAssets.SelectedItems.Count}/{listBoxAssets.Items.Count} assets selected";
}

private void comboBoxAssetTypes_SelectedIndexChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -639,6 +641,12 @@ public void OpenInternalEditors()
archive.OpenInternalEditor(archive.GetCurrentlySelectedAssetIDs());
}

public void DeleteSelectedAssets()
{
buttonRemoveAsset_Click(null, null);
listBoxAssets.SelectedIndex = -1;
}

private void buttonExportRaw_Click(object sender, EventArgs e)
{
if (listBoxAssets.SelectedItem == null)
Expand Down Expand Up @@ -694,6 +702,8 @@ private uint GetAssetIDFromName(string name)

private void listBoxAssets_SelectedIndexChanged(object sender, EventArgs e)
{
toolStripStatusLabelSelectionCount.Text = $"{listBoxAssets.SelectedItems.Count}/{listBoxAssets.Items.Count} assets selected";

archive.ClearSelectedAssets();
foreach (string s in listBoxAssets.SelectedItems)
archive.SelectAsset(GetAssetIDFromName(s), true);
Expand Down Expand Up @@ -1011,5 +1021,29 @@ private void labelTemplateFocus_Click(object sender, EventArgs e)
TemplateFocusOn();
}
}

private void hideButtonsToolStripMenuItem_Click(object sender, EventArgs e)
{
hideButtonsToolStripMenuItem.Checked = !hideButtonsToolStripMenuItem.Checked;

buttonAddAsset.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonDuplicate.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonCopy.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonPaste.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonRemoveAsset.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonView.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonEditAsset.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonExportRaw.Visible = !hideButtonsToolStripMenuItem.Checked;
buttonInternalEdit.Visible = !hideButtonsToolStripMenuItem.Checked;

if (hideButtonsToolStripMenuItem.Checked)
{
listBoxAssets.Size = new System.Drawing.Size(listBoxAssets.Size.Width + 81, listBoxAssets.Size.Height);
}
else
{
listBoxAssets.Size = new System.Drawing.Size(listBoxAssets.Size.Width - 81, listBoxAssets.Size.Height);
}
}
}
}
14 changes: 12 additions & 2 deletions IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
assetDictionary.Add(AHDR.assetID, newAsset);
}
break;
case AssetType.SHRP:
{
AssetSHRP newAsset = new AssetSHRP(AHDR);
assetDictionary.Add(AHDR.assetID, newAsset);
}
break;
case AssetType.SNDI:
{
if (currentPlatform == Platform.GameCube && (currentGame == Game.BFBB || currentGame == Game.Scooby))
Expand All @@ -483,6 +489,12 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
}
}
break;
case AssetType.SURF:
{
AssetSURF newAsset = new AssetSURF(AHDR);
assetDictionary.Add(AHDR.assetID, newAsset);
}
break;
case AssetType.TEXT:
{
AssetTEXT newAsset = new AssetTEXT(AHDR);
Expand Down Expand Up @@ -542,7 +554,6 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
case AssetType.SPLN:
case AssetType.SSET:
case AssetType.SUBT:
case AssetType.SURF:
case AssetType.TPIK:
case AssetType.TRWT:
case AssetType.UIM:
Expand All @@ -563,7 +574,6 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
case AssetType.NPCS:
case AssetType.ONEL:
case AssetType.RAW:
case AssetType.SHRP:
case AssetType.SND:
case AssetType.SNDS:
case AssetType.SPLP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ private void OpenInternalEditor(Asset asset)
case AssetType.TEXT:
internalEditors.Add(new InternalTextEditor((AssetTEXT)asset, this));
break;
case AssetType.SHRP:
internalEditors.Add(new InternalShrapnelEditor((AssetSHRP)asset, this));
break;
case AssetType.SND:
case AssetType.SNDS:
internalEditors.Add(new InternalSoundEditor(asset, this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
case AssetTemplate.SphereTrigger:
newAssetType = AssetType.TRIG;
break;
case AssetTemplate.DuplicatotronSettings:
newAssetType = AssetType.DYNA;
break;
case AssetTemplate.EmptyGroup:
newAssetType = AssetType.GRUP;
break;
default:
if (template != AssetTemplate.None)
MessageBox.Show("Unsupported asset template");
Expand All @@ -150,6 +156,9 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
data = GetTemplate(newAssetType)
};

if (template == AssetTemplate.DuplicatotronSettings)
newAsset.data = new byte[0x10];

if (string.IsNullOrWhiteSpace(customName))
newAsset.ADBG = new Section_ADBG(0, template.ToString().ToUpper() + "_01", "", 0);
else
Expand Down Expand Up @@ -442,6 +451,32 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
case AssetTemplate.Duplicatotron:
((AssetVIL)asset).ModelAssetID = BKDRHash("duplicatotron1000_bind.MINF");
((AssetVIL)asset).VilType = VilType.duplicatotron1000_bind;
((AssetVIL)asset).AssetID_DYNA_NPCSettings = PlaceTemplate(position, layerIndex, out success, ref assetIDs, template.ToString().ToUpper() + "_SETTINGS", AssetTemplate.DuplicatotronSettings);
((AssetVIL)asset).EventsBFBB = new AssetEventBFBB[] {
new AssetEventBFBB
{
Arguments_Float = new float[6],
TargetAssetID = PlaceTemplate(position, layerIndex, out success, ref assetIDs, template.ToString().ToUpper() + "_GROUP", AssetTemplate.EmptyGroup),
EventReceiveID = EventTypeBFBB.ScenePrepare,
EventSendID = EventTypeBFBB.Connect_IOwnYou
}
};
break;
case AssetTemplate.DuplicatotronSettings:
((AssetDYNA)asset).Flags = 0x1D;
((AssetDYNA)asset).Version = 2;
((AssetDYNA)asset).Type = DynaType.game_object__NPCSettings;
((AssetDYNA)asset).DynaBase = new DynaNPCSettings()
{
Flags1 = 1,
Flags2 = 1,
Flags3 = 1,
Flags5 = 1,
Flags9 = 1,
Flags10 = 1,
DuploSpawnRate = 1f,
DuploEnemyLimit = -1
};
break;
case AssetTemplate.Button:
((AssetBUTN)asset).RotationX = -90f;
Expand Down
Loading

0 comments on commit d25784a

Please sign in to comment.