Skip to content

Commit

Permalink
event editor, incredibles events
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Dec 5, 2018
1 parent cc1be10 commit 1ecdda5
Show file tree
Hide file tree
Showing 22 changed files with 2,748 additions and 45 deletions.
37 changes: 19 additions & 18 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs

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

8 changes: 7 additions & 1 deletion IndustrialPark/ArchiveEditor/ArchiveEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public ArchiveEditor(string filePath)
if (!string.IsNullOrWhiteSpace(filePath))
OpenFile(filePath);

textBoxFindAsset.AutoCompleteSource = AutoCompleteSource.CustomSource;
textBoxFindAsset.AutoCompleteCustomSource = archive.autoCompleteSource;

MainForm.PopulateTemplateMenusAt(addTemplateToolStripMenuItem, TemplateToolStripMenuItem_Click);
listViewAssets_SizeChanged(null, null);
}
Expand Down Expand Up @@ -867,8 +870,11 @@ private void textBoxFindAsset_TextChanged(object sender, EventArgs e)
SetSelectedIndices(new List<uint>() { assetID }, false);
else
foreach (ListViewItem v in listViewAssets.Items)
if (v.Text.ToLower().Contains(textBoxFindAsset.Text.ToLower()))
if (v.Text.ToLower().Contains(textBoxFindAsset.Text.ToLower()) && (v.Selected == false))
{
SetSelectedIndices(new List<uint>() { GetAssetIDFromName(v.Text) }, false);
return;
}
}

private void collapseLayersToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down
7 changes: 6 additions & 1 deletion IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using System.Windows.Forms;
using HipHopFile;
using SharpDX;
using static HipHopFile.Functions;

namespace IndustrialPark
Expand All @@ -31,6 +30,7 @@ public static void AddToRenderingDictionary(uint key, IAssetWithModel value)
public Section_PACK PACK;
public Section_DICT DICT;
public Section_STRM STRM;
public AutoCompleteStringCollection autoCompleteSource = new AutoCompleteStringCollection();

public bool New()
{
Expand Down Expand Up @@ -594,6 +594,9 @@ private void AddAssetToDictionary(Section_AHDR AHDR)
if (hiddenAssets.Contains(AHDR.assetID))
assetDictionary[AHDR.assetID].isInvisible = true;

if (assetDictionary[AHDR.assetID] is ObjectAsset oa)
autoCompleteSource.Add(AHDR.ADBG.assetName);

allowRender = true;
}

Expand Down Expand Up @@ -702,6 +705,8 @@ public void RemoveAsset(uint assetID)

DICT.ATOC.AHDRList.Remove(assetDictionary[assetID].AHDR);

autoCompleteSource.Remove(assetDictionary[assetID].AHDR.ADBG.assetName);

assetDictionary.Remove(assetID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
case AssetTemplate.BusStop_DYNA:
case AssetTemplate.DuplicatotronSettings:
case AssetTemplate.TeleportBox:
case AssetTemplate.Checkpoint_Talkbox:
newAssetType = AssetType.DYNA;
break;
case AssetTemplate.ElectricArc_Generic:
Expand Down Expand Up @@ -184,6 +185,7 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
case AssetTemplate.ThrowFruit:
case AssetTemplate.ThrowFruitBase:
case AssetTemplate.FreezyFruit:
case AssetTemplate.Checkpoint_SIMP:
newAssetType = AssetType.SIMP;
break;
case AssetTemplate.SoundInfo:
Expand All @@ -192,12 +194,15 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
break;
case AssetTemplate.SphereTrigger:
case AssetTemplate.BusStop_Trigger:
case AssetTemplate.Checkpoint:
case AssetTemplate.Checkpoint_Invisible:
newAssetType = AssetType.TRIG;
break;
case AssetTemplate.Text:
newAssetType = AssetType.TEXT;
break;
case AssetTemplate.Timer:
case AssetTemplate.Checkpoint_Timer:
newAssetType = AssetType.TIMR;
break;
case AssetTemplate.WoodenTiki:
Expand Down Expand Up @@ -819,6 +824,94 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re
((AssetSIMP)asset).ModelAssetID = BKDRHash("fruit_throw_base");
((AssetSIMP)asset).Unknown_5C = 0;
break;
case AssetTemplate.Checkpoint:
case AssetTemplate.Checkpoint_Invisible:
{
((AssetTRIG)asset).Position1X_Radius = 6f;
uint checkpointDisp = BKDRHash("CHECKPOINT_DISP_00"); ;
if (!ContainsAsset(checkpointDisp))
checkpointDisp = PlaceTemplate(position, layerIndex, out success, ref assetIDs, "CHECKPOINT_DISP", AssetTemplate.Dispatcher);

List<AssetEventBFBB> events = new List<AssetEventBFBB>
{
new AssetEventBFBB
{
Arguments_Hex = new AssetID[] { 0, 0, 0, 0, PlaceTemplate(position, layerIndex, out success, ref assetIDs, "CHECKPOINT_MRKR", AssetTemplate.Marker), 0 },
TargetAssetID = checkpointDisp,
EventReceiveID = EventTypeBFBB.EnterPlayer,
EventSendID = EventTypeBFBB.SetCheckPoint
}
};

if (template == AssetTemplate.Checkpoint)
events.Add(new AssetEventBFBB
{
Arguments_Float = new float[6],
TargetAssetID = PlaceTemplate(position, layerIndex, out success, ref assetIDs, "CHECKPOINT_TIMER", AssetTemplate.Checkpoint_Timer),
EventReceiveID = EventTypeBFBB.EnterPlayer,
EventSendID = EventTypeBFBB.Run
});

((AssetTRIG)asset).EventsBFBB = events.ToArray();
break;
}
case AssetTemplate.Checkpoint_Timer:
{
((AssetTIMR)asset).Time = 0.5f;
uint checkpointSimp = PlaceTemplate(new Vector3(position.X + 2f, position.Y, position.Z), layerIndex, out success, ref assetIDs, "CHECKPOINT_SIMP", AssetTemplate.Checkpoint_SIMP);
uint checkpointTalkbox = BKDRHash("CHECKPOINT_TALKBOX_00"); ;
if (!ContainsAsset(checkpointTalkbox))
checkpointTalkbox = PlaceTemplate(position, layerIndex, out success, ref assetIDs, "CHECKPOINT_TALKBOX", AssetTemplate.Checkpoint_Talkbox);
((AssetTIMR)asset).EventsBFBB = new AssetEventBFBB[] {
new AssetEventBFBB
{
Arguments_Float = new float[] { 2, 0, 0, 0, 0, 0},
TargetAssetID = checkpointSimp,
EventReceiveID = EventTypeBFBB.Run,
EventSendID = EventTypeBFBB.AnimPlayLoop
},
new AssetEventBFBB
{
Arguments_Hex = new AssetID[] { BKDRHash("checkpoint_text"), 0, 0, 0, 0, 0},
TargetAssetID = checkpointTalkbox,
EventReceiveID = EventTypeBFBB.Run,
EventSendID = EventTypeBFBB.StartConversation
},
new AssetEventBFBB
{
Arguments_Float = new float[] { 3, 0, 0, 0, 0, 0},
TargetAssetID = checkpointSimp,
EventReceiveID = EventTypeBFBB.Expired,
EventSendID = EventTypeBFBB.AnimPlayLoop
},
new AssetEventBFBB
{
Arguments_Float = new float[6],
TargetAssetID = asset.AHDR.assetID,
EventReceiveID = EventTypeBFBB.Expired,
EventSendID = EventTypeBFBB.Disable
},
};
break;
}
case AssetTemplate.Checkpoint_SIMP:
((AssetSIMP)asset).ScaleX = 0.75f;
((AssetSIMP)asset).ScaleY = 0.75f;
((AssetSIMP)asset).ScaleZ = 0.75f;
((AssetSIMP)asset).ModelAssetID = BKDRHash("checkpoint_bind");
((AssetSIMP)asset).AnimationAssetID = BKDRHash("CHECKPOINT_ANIMLIST_01");
break;
case AssetTemplate.Checkpoint_Talkbox:
((AssetDYNA)asset).Flags = 0x1D;
((AssetDYNA)asset).Version = 11;
((AssetDYNA)asset).Type = DynaType.game_object__talk_box;
((AssetDYNA)asset).DynaBase = new DynaTalkBox()
{
TextBoxID1 = 0x9BC49154,
Flags5 = 1,
UnknownFloat = 2f
};
break;
}

assetIDs.Add(asset.AHDR.assetID);
Expand Down
Loading

0 comments on commit 1ecdda5

Please sign in to comment.