From 5805f2b211811792194e818a54ef9ad3c56926c7 Mon Sep 17 00:00:00 2001 From: igorseabra4 Date: Wed, 8 May 2019 22:43:10 -0300 Subject: [PATCH] plat editor --- .../ArchiveEditor/ArchiveEditorFunctions.cs | 11 +- .../ArchiveEditorFunctions_AssetEditing.cs | 3 + .../ArchiveEditorFunctions_AssetTemplates.cs | 73 +- .../Dialogs/ScrollableMessageBox.Designer.cs | 4 +- .../InternalAssetEditor.Designer.cs | 30 +- .../InternalButtonEditor.Designer.cs | 146 ++++ .../InternalEditors/InternalButtonEditor.cs | 59 ++ .../InternalButtonEditor.resx} | 0 .../InternalCamEditor.Designer.cs | 51 +- .../InternalEditors/InternalCamEditor.cs | 8 + .../InternalDynaEditor.Designer.cs | 26 +- .../InternalEditors/InternalGrupEditor.cs | 1 + .../InternalPlatEditor.Designer.cs | 69 +- .../InternalEditors/InternalPlatEditor.cs | 255 +------ .../InternalShrapnelEditor.Designer.cs | 38 +- .../InternalTextEditor.Designer.cs | 34 +- IndustrialPark/Assets/Binary/AssetPICK.cs | 68 +- .../ObjectAssets/ClickableAssets/AssetCAM.cs | 122 +-- .../PlaceableAssets/AssetBOUL.cs | 4 +- .../PlaceableAssets/AssetBUTN.cs | 187 +---- .../PlaceableAssets/AssetNPC.cs | 4 +- .../PlaceableAssets/AssetPKUP.cs | 2 +- .../PlaceableAssets/AssetPLAT.cs | 637 ++++------------ .../PlaceableAssets/AssetPLYR.cs | 4 +- .../ClickableAssets/PlatSpecific.cs | 171 +++++ IndustrialPark/Assets/Shared/Asset.cs | 2 +- .../Assets/Shared/AssetWithMotion.cs | 106 +++ .../Assets/Shared/Enums/PlatType.cs | 10 +- .../Assets/Shared/Enums/PlatTypeSpecific.cs | 4 +- IndustrialPark/Assets/Shared/Motion.cs | 703 ++++++++++++++++++ .../Assets/Shared/PlaceableAsset.cs | 32 +- IndustrialPark/Assets/Shared/PlatSpecific.cs | 359 +++++++++ IndustrialPark/IndustrialPark.csproj | 22 +- IndustrialPark/MainForm/MainForm.Designer.cs | 62 +- IndustrialPark/MainForm/MainForm.cs | 12 +- IndustrialPark/Program.cs | 2 - .../Research/PlatSearch.Designer.cs | 116 --- IndustrialPark/Research/PlatSearch.cs | 191 ----- IndustrialPark/SharpDX/SharpRenderer.cs | 4 +- 39 files changed, 2092 insertions(+), 1540 deletions(-) create mode 100644 IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.Designer.cs create mode 100644 IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.cs rename IndustrialPark/{Research/PlatSearch.resx => ArchiveEditor/InternalEditors/InternalButtonEditor.resx} (100%) create mode 100644 IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlatSpecific.cs create mode 100644 IndustrialPark/Assets/Shared/AssetWithMotion.cs create mode 100644 IndustrialPark/Assets/Shared/Motion.cs create mode 100644 IndustrialPark/Assets/Shared/PlatSpecific.cs delete mode 100644 IndustrialPark/Research/PlatSearch.Designer.cs delete mode 100644 IndustrialPark/Research/PlatSearch.cs diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs index de108270..ee453a4a 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs @@ -283,12 +283,13 @@ public void DisposeOfAsset(uint assetID, bool fast = false) if (assetDictionary[assetID] is AssetJSP jsp) jsp.GetRenderWareModelFile().Dispose(); - if (assetDictionary[assetID] is AssetMODL modl) - if (modl.HasRenderWareModelFile()) - modl.GetRenderWareModelFile().Dispose(); - if (assetDictionary[assetID] is IAssetWithModel iawm) + else if (assetDictionary[assetID] is AssetMODL modl && modl.HasRenderWareModelFile()) + modl.GetRenderWareModelFile().Dispose(); + else if (assetDictionary[assetID] is IAssetWithModel iawm) iawm.MovieRemoveFromDictionary(); - if (assetDictionary[assetID] is AssetLODT lodt) + else if (assetDictionary[assetID] is AssetPICK pick) + pick.ClearDictionary(); + else if (assetDictionary[assetID] is AssetLODT lodt) lodt.ClearDictionary(); } diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs index 6113b65c..2b40e276 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetEditing.cs @@ -105,6 +105,9 @@ private void OpenInternalEditor(Asset asset) switch (asset.AHDR.assetType) { + case AssetType.BUTN: + internalEditors.Add(new InternalButtonEditor((AssetBUTN)asset, this)); + break; case AssetType.CAM: internalEditors.Add(new InternalCamEditor((AssetCAM)asset, this)); break; diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetTemplates.cs b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetTemplates.cs index 1dcce55c..dee5cb0a 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetTemplates.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions_AssetTemplates.cs @@ -770,7 +770,7 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetCAM)asset).Flags2 = 1; ((AssetCAM)asset).Flags3 = 1; ((AssetCAM)asset).Flags4 = 0xC0; - ((AssetCAM)asset).CamType = 2; + ((AssetCAM)asset).CamType = CamType.Static; break; case AssetTemplate.Counter: ((AssetCNTR)asset).AssetType = ObjectAssetType.CNTR; @@ -807,7 +807,8 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetPLAT)asset).PlatformType = PlatType.Mechanism; ((AssetPLAT)asset).PlatformSubtype = PlatTypeSpecific.Mechanism; ((AssetPLAT)asset).CollisionType = 4; - ((AssetPLAT)asset).UnknownByte_90 = 4; + ((AssetPLAT)asset).PlatSpecific = new PlatSpecific_Generic(); + ((AssetPLAT)asset).Motion = new Motion_Mechanism(); break; case AssetTemplate.Player_Generic: ((AssetPLYR)asset).AssetType = ObjectAssetType.PLYR; @@ -1224,14 +1225,16 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetBUTN)asset).AssetType = ObjectAssetType.BUTN; ((AssetBUTN)asset).Model_AssetID = "button"; ((AssetBUTN)asset).PressedModel_AssetID = "button_grn"; - ((AssetBUTN)asset).UnknownByte6C = 4; - ((AssetBUTN)asset).UnknownByte6F = 4; - ((AssetBUTN)asset).UnknownByte70 = 2; - ((AssetBUTN)asset).UnknownByte71 = 1; - ((AssetBUTN)asset).UnknownByte72 = 1; - ((AssetBUTN)asset).PressedOffset = -0.2f; - ((AssetBUTN)asset).TransitionTime = 0.5f; - ((AssetBUTN)asset).TransitionEaseOut = 0.2f; + ((AssetBUTN)asset).Motion = new Motion_Mechanism() + { + Flags = 4, + MovementMode = 2, + MovementLoopMode = 1, + SlideAxis = 1, + SlideDistance = -0.2f, + SlideTime = 0.5f, + SlideDecelTime = 0.2f + }; ((AssetBUTN)asset).BubbleSpin = true; ((AssetBUTN)asset).BubbleBowlOrBoulder = true; ((AssetBUTN)asset).CruiseBubble = true; @@ -1245,13 +1248,15 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetBUTN)asset).ActMethod = AssetBUTN.ButnActMethod.PressurePlate; ((AssetBUTN)asset).Model_AssetID = "plate_pressure"; ((AssetBUTN)asset).PressedModel_AssetID = 0xCE7F8131; - ((AssetBUTN)asset).UnknownByte6C = 4; - ((AssetBUTN)asset).UnknownByte6F = 4; - ((AssetBUTN)asset).UnknownByte70 = 2; - ((AssetBUTN)asset).UnknownByte71 = 1; - ((AssetBUTN)asset).UnknownByte72 = 1; - ((AssetBUTN)asset).PressedOffset = -0.15f; - ((AssetBUTN)asset).TransitionTime = 0.15f; + ((AssetBUTN)asset).Motion = new Motion_Mechanism() + { + Flags = 4, + MovementMode = 2, + MovementLoopMode = 1, + SlideAxis = 1, + SlideDistance = -0.15f, + SlideTime = 0.15f, + }; ((AssetBUTN)asset).PlayerOnPressurePlate = true; ((AssetBUTN)asset).AnyThrowableOnPressurePlate = true; ((AssetBUTN)asset).ThrowFruitOnPressurePlate = true; @@ -1276,7 +1281,8 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re case AssetTemplate.Swinger_PLAT: ((AssetPLAT)asset).AssetType = ObjectAssetType.PLAT; ((AssetPLAT)asset).Model_AssetID = "trailer_hitch"; - ((AssetPLAT)asset).UnknownByte_90 = 4; + ((AssetPLAT)asset).PlatSpecific = new PlatSpecific_Generic(); + ((AssetPLAT)asset).Motion = new Motion_Mechanism(); break; case AssetTemplate.EnemyAreaMVPT: ((AssetMVPT_Scooby)asset).AssetType = ObjectAssetType.MVPT; @@ -1390,14 +1396,11 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetCAM)asset).OffsetEndFrames = 45; ((AssetCAM)asset).FieldOfView = 60f; ((AssetCAM)asset).TransitionTime = 0.5f; - ((AssetCAM)asset).UnknownFloat64 = -2f; - ((AssetCAM)asset).UnknownFloat68 = 1f; - ((AssetCAM)asset).UnknownFloat6C = 1f; ((AssetCAM)asset).Flags1 = 00; ((AssetCAM)asset).Flags2 = 01; ((AssetCAM)asset).Flags3 = 01; ((AssetCAM)asset).Flags4 = 0x8F; - ((AssetCAM)asset).CamType = 2; + ((AssetCAM)asset).CamType = CamType.Static; break; case AssetTemplate.BusStop_BusSimp: ((AssetSIMP)asset).AssetType = ObjectAssetType.SIMP; @@ -1529,11 +1532,17 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetPLAT)asset).PlatformType = PlatType.Springboard; ((AssetPLAT)asset).PlatformSubtype = PlatTypeSpecific.Springboard; ((AssetPLAT)asset).CollisionType = 4; - ((AssetPLAT)asset).Float58 = 10; - ((AssetPLAT)asset).ANIM_AssetID_1 = 0x6DAE0759; - ((AssetPLAT)asset).ANIM_AssetID_2 = 0xBC4A9A5F; - ((AssetPLAT)asset).LaunchDirectionY = 1; - ((AssetPLAT)asset).UnknownByte_90 = 6; + ((AssetPLAT)asset).PlatSpecific = new PlatSpecific_Springboard() + { + Height1 = 10, + Height2 = 10, + Height3 = 10, + HeightBubbleBounce = 10, + Anim1_AssetID = 0x6DAE0759, + Anim2_AssetID = 0xBC4A9A5F, + DirectionY = 1f, + }; + ((AssetPLAT)asset).Motion = new Motion() { Type = MotionType.Other }; break; case AssetTemplate.HoveringPlatform: ((AssetPLAT)asset).AssetType = ObjectAssetType.PLAT; @@ -1542,10 +1551,12 @@ public uint PlaceTemplate(Vector3 position, int layerIndex, out bool success, re ((AssetPLAT)asset).PlatformType = PlatType.Mechanism; ((AssetPLAT)asset).PlatformSubtype = PlatTypeSpecific.Mechanism; ((AssetPLAT)asset).CollisionType = 4; - ((AssetPLAT)asset).UnknownByte_90 = 6; - ((AssetPLAT)asset).MovementLoopType = 1; - ((AssetPLAT)asset).MovementTranslation_EaseEnd = 0.4f; - ((AssetPLAT)asset).MovementTranslation_EaseStart = 0.4f; + ((AssetPLAT)asset).Motion = new Motion_Mechanism() { + Type = MotionType.Other, + MovementLoopMode = 1, + SlideAccelTime = 0.4f, + SlideDecelTime = 0.4f + }; break; case AssetTemplate.BungeeHook: ((AssetDYNA)asset).Version = 13; diff --git a/IndustrialPark/ArchiveEditor/Dialogs/ScrollableMessageBox.Designer.cs b/IndustrialPark/ArchiveEditor/Dialogs/ScrollableMessageBox.Designer.cs index c53152a2..631ec8c3 100644 --- a/IndustrialPark/ArchiveEditor/Dialogs/ScrollableMessageBox.Designer.cs +++ b/IndustrialPark/ArchiveEditor/Dialogs/ScrollableMessageBox.Designer.cs @@ -38,7 +38,7 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.richTextBox1.Location = new System.Drawing.Point(12, 12); this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(624, 519); + this.richTextBox1.Size = new System.Drawing.Size(825, 519); this.richTextBox1.TabIndex = 6; this.richTextBox1.Text = ""; // @@ -46,7 +46,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(648, 543); + this.ClientSize = new System.Drawing.Size(849, 543); this.Controls.Add(this.richTextBox1); this.Name = "ScrollableMessageBox"; this.ShowIcon = false; diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalAssetEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalAssetEditor.Designer.cs index d695d981..f998f4f0 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalAssetEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalAssetEditor.Designer.cs @@ -31,17 +31,15 @@ private void InitializeComponent() this.propertyGridAsset = new System.Windows.Forms.PropertyGrid(); this.labelAssetName = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.buttonFindCallers = new System.Windows.Forms.Button(); this.buttonHelp = new System.Windows.Forms.Button(); + this.buttonFindCallers = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // propertyGridAsset // - this.propertyGridAsset.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.propertyGridAsset, 2); + this.propertyGridAsset.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGridAsset.HelpVisible = false; this.propertyGridAsset.Location = new System.Drawing.Point(3, 23); this.propertyGridAsset.Name = "propertyGridAsset"; @@ -80,18 +78,6 @@ private void InitializeComponent() this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 401); this.tableLayoutPanel1.TabIndex = 7; // - // buttonFindCallers - // - this.buttonFindCallers.AutoSize = true; - this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindCallers.Location = new System.Drawing.Point(168, 376); - this.buttonFindCallers.Name = "buttonFindCallers"; - this.buttonFindCallers.Size = new System.Drawing.Size(159, 22); - this.buttonFindCallers.TabIndex = 7; - this.buttonFindCallers.Text = "Find Who Targets Me"; - this.buttonFindCallers.UseVisualStyleBackColor = true; - this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); - // // buttonHelp // this.buttonHelp.AutoSize = true; @@ -104,6 +90,18 @@ private void InitializeComponent() this.buttonHelp.UseVisualStyleBackColor = true; this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); // + // buttonFindCallers + // + this.buttonFindCallers.AutoSize = true; + this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonFindCallers.Location = new System.Drawing.Point(168, 376); + this.buttonFindCallers.Name = "buttonFindCallers"; + this.buttonFindCallers.Size = new System.Drawing.Size(159, 22); + this.buttonFindCallers.TabIndex = 7; + this.buttonFindCallers.Text = "Find Who Targets Me"; + this.buttonFindCallers.UseVisualStyleBackColor = true; + this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); + // // InternalAssetEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.Designer.cs new file mode 100644 index 00000000..29f0250f --- /dev/null +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.Designer.cs @@ -0,0 +1,146 @@ +namespace IndustrialPark +{ + partial class InternalButtonEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.propertyGridAsset = new System.Windows.Forms.PropertyGrid(); + this.labelAssetName = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.buttonHelp = new System.Windows.Forms.Button(); + this.buttonFindCallers = new System.Windows.Forms.Button(); + this.propertyGrid_Motion = new System.Windows.Forms.PropertyGrid(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // propertyGridAsset + // + this.tableLayoutPanel1.SetColumnSpan(this.propertyGridAsset, 2); + this.propertyGridAsset.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGridAsset.HelpVisible = false; + this.propertyGridAsset.Location = new System.Drawing.Point(3, 23); + this.propertyGridAsset.Name = "propertyGridAsset"; + this.propertyGridAsset.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGridAsset.Size = new System.Drawing.Size(324, 337); + this.propertyGridAsset.TabIndex = 5; + this.propertyGridAsset.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGridAsset_PropertyValueChanged); + // + // labelAssetName + // + this.labelAssetName.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.labelAssetName, 2); + this.labelAssetName.Dock = System.Windows.Forms.DockStyle.Left; + this.labelAssetName.Location = new System.Drawing.Point(3, 0); + this.labelAssetName.Name = "labelAssetName"; + this.labelAssetName.Size = new System.Drawing.Size(0, 20); + this.labelAssetName.TabIndex = 6; + this.labelAssetName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.buttonHelp, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.propertyGridAsset, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.labelAssetName, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.buttonFindCallers, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.propertyGrid_Motion, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 539); + this.tableLayoutPanel1.TabIndex = 7; + // + // buttonHelp + // + this.buttonHelp.AutoSize = true; + this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonHelp.Location = new System.Drawing.Point(3, 513); + this.buttonHelp.Name = "buttonHelp"; + this.buttonHelp.Size = new System.Drawing.Size(159, 23); + this.buttonHelp.TabIndex = 16; + this.buttonHelp.Text = "Help"; + this.buttonHelp.UseVisualStyleBackColor = true; + this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); + // + // buttonFindCallers + // + this.buttonFindCallers.AutoSize = true; + this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonFindCallers.Location = new System.Drawing.Point(168, 513); + this.buttonFindCallers.Name = "buttonFindCallers"; + this.buttonFindCallers.Size = new System.Drawing.Size(159, 23); + this.buttonFindCallers.TabIndex = 7; + this.buttonFindCallers.Text = "Find Who Targets Me"; + this.buttonFindCallers.UseVisualStyleBackColor = true; + this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); + // + // propertyGrid_Motion + // + this.tableLayoutPanel1.SetColumnSpan(this.propertyGrid_Motion, 2); + this.propertyGrid_Motion.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid_Motion.HelpVisible = false; + this.propertyGrid_Motion.Location = new System.Drawing.Point(3, 366); + this.propertyGrid_Motion.Name = "propertyGrid_Motion"; + this.propertyGrid_Motion.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGrid_Motion.Size = new System.Drawing.Size(324, 141); + this.propertyGrid_Motion.TabIndex = 17; + this.propertyGrid_Motion.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid_Motion_PropertyValueChanged); + // + // InternalButtonEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(330, 539); + this.Controls.Add(this.tableLayoutPanel1); + this.MaximizeBox = false; + this.Name = "InternalButtonEditor"; + this.ShowIcon = false; + this.Text = "Asset Data Editor"; + this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InternalAssetEditor_FormClosing); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.PropertyGrid propertyGridAsset; + private System.Windows.Forms.Label labelAssetName; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Button buttonFindCallers; + private System.Windows.Forms.Button buttonHelp; + private System.Windows.Forms.PropertyGrid propertyGrid_Motion; + } +} \ No newline at end of file diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.cs new file mode 100644 index 00000000..808dea48 --- /dev/null +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.cs @@ -0,0 +1,59 @@ +using SharpDX; +using System; +using System.ComponentModel; +using System.Windows.Forms; + +namespace IndustrialPark +{ + public partial class InternalButtonEditor : Form, IInternalEditor + { + public InternalButtonEditor(AssetBUTN asset, ArchiveEditorFunctions archive) + { + InitializeComponent(); + TopMost = true; + + this.asset = asset; + this.archive = archive; + + propertyGridAsset.SelectedObject = asset; + labelAssetName.Text = $"[{asset.AHDR.assetType.ToString()}] {asset.ToString()}"; + + propertyGrid_Motion.SelectedObject = asset.Motion; + } + + private void InternalAssetEditor_FormClosing(object sender, FormClosingEventArgs e) + { + archive.CloseInternalEditor(this); + } + + private AssetBUTN asset; + private ArchiveEditorFunctions archive; + + public uint GetAssetID() + { + return asset.AHDR.assetID; + } + + private void buttonFindCallers_Click(object sender, System.EventArgs e) + { + Program.MainForm.FindWhoTargets(GetAssetID()); + } + + private void propertyGridAsset_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + archive.UnsavedChanges = true; + ArchiveEditorFunctions.UpdateGizmoPosition(); + } + + private void propertyGrid_Motion_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + archive.UnsavedChanges = true; + asset.Motion = (Motion)propertyGrid_Motion.SelectedObject; + } + + private void buttonHelp_Click(object sender, EventArgs e) + { + System.Diagnostics.Process.Start(AboutBox.WikiLink + asset.AHDR.assetType.ToString()); + } + } +} diff --git a/IndustrialPark/Research/PlatSearch.resx b/IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.resx similarity index 100% rename from IndustrialPark/Research/PlatSearch.resx rename to IndustrialPark/ArchiveEditor/InternalEditors/InternalButtonEditor.resx diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.Designer.cs index e42a5a8a..6b535630 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.Designer.cs @@ -35,20 +35,19 @@ private void InitializeComponent() this.buttonGetDir = new System.Windows.Forms.Button(); this.buttonGetPos = new System.Windows.Forms.Button(); this.buttonFindCallers = new System.Windows.Forms.Button(); + this.propertyGridCamSpecific = new System.Windows.Forms.PropertyGrid(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // propertyGridAsset // - this.propertyGridAsset.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.propertyGridAsset, 2); + this.propertyGridAsset.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGridAsset.HelpVisible = false; this.propertyGridAsset.Location = new System.Drawing.Point(3, 23); this.propertyGridAsset.Name = "propertyGridAsset"; this.propertyGridAsset.PropertySort = System.Windows.Forms.PropertySort.Categorized; - this.propertyGridAsset.Size = new System.Drawing.Size(324, 319); + this.propertyGridAsset.Size = new System.Drawing.Size(324, 339); this.propertyGridAsset.TabIndex = 5; this.propertyGridAsset.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGridAsset_PropertyValueChanged); // @@ -68,31 +67,32 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Controls.Add(this.buttonHelp, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.buttonGetDir, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.buttonGetPos, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.buttonHelp, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.buttonGetDir, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.buttonGetPos, 0, 3); this.tableLayoutPanel1.Controls.Add(this.propertyGridAsset, 0, 1); this.tableLayoutPanel1.Controls.Add(this.labelAssetName, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.buttonFindCallers, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.buttonFindCallers, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.propertyGridCamSpecific, 0, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowCount = 5; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 77F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 23F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 401); + this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 525); this.tableLayoutPanel1.TabIndex = 7; // // buttonHelp // this.buttonHelp.AutoSize = true; this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonHelp.Location = new System.Drawing.Point(3, 376); + this.buttonHelp.Location = new System.Drawing.Point(3, 499); this.buttonHelp.Name = "buttonHelp"; - this.buttonHelp.Size = new System.Drawing.Size(159, 22); + this.buttonHelp.Size = new System.Drawing.Size(159, 23); this.buttonHelp.TabIndex = 13; this.buttonHelp.Text = "Help"; this.buttonHelp.UseVisualStyleBackColor = true; @@ -102,7 +102,7 @@ private void InitializeComponent() // this.buttonGetDir.AutoSize = true; this.buttonGetDir.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonGetDir.Location = new System.Drawing.Point(168, 348); + this.buttonGetDir.Location = new System.Drawing.Point(3, 471); this.buttonGetDir.Name = "buttonGetDir"; this.buttonGetDir.Size = new System.Drawing.Size(159, 22); this.buttonGetDir.TabIndex = 10; @@ -114,7 +114,7 @@ private void InitializeComponent() // this.buttonGetPos.AutoSize = true; this.buttonGetPos.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonGetPos.Location = new System.Drawing.Point(3, 348); + this.buttonGetPos.Location = new System.Drawing.Point(168, 471); this.buttonGetPos.Name = "buttonGetPos"; this.buttonGetPos.Size = new System.Drawing.Size(159, 22); this.buttonGetPos.TabIndex = 11; @@ -126,19 +126,31 @@ private void InitializeComponent() // this.buttonFindCallers.AutoSize = true; this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindCallers.Location = new System.Drawing.Point(168, 376); + this.buttonFindCallers.Location = new System.Drawing.Point(168, 499); this.buttonFindCallers.Name = "buttonFindCallers"; - this.buttonFindCallers.Size = new System.Drawing.Size(159, 22); + this.buttonFindCallers.Size = new System.Drawing.Size(159, 23); this.buttonFindCallers.TabIndex = 12; this.buttonFindCallers.Text = "Find Who Targets Me"; this.buttonFindCallers.UseVisualStyleBackColor = true; this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); // + // propertyGridCamSpecific + // + this.tableLayoutPanel1.SetColumnSpan(this.propertyGridCamSpecific, 2); + this.propertyGridCamSpecific.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGridCamSpecific.HelpVisible = false; + this.propertyGridCamSpecific.Location = new System.Drawing.Point(3, 368); + this.propertyGridCamSpecific.Name = "propertyGridCamSpecific"; + this.propertyGridCamSpecific.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGridCamSpecific.Size = new System.Drawing.Size(324, 97); + this.propertyGridCamSpecific.TabIndex = 14; + this.propertyGridCamSpecific.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGridCamSpecific_PropertyValueChanged); + // // InternalCamEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(330, 401); + this.ClientSize = new System.Drawing.Size(330, 525); this.Controls.Add(this.tableLayoutPanel1); this.MaximizeBox = false; this.Name = "InternalCamEditor"; @@ -160,5 +172,6 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonGetPos; private System.Windows.Forms.Button buttonFindCallers; private System.Windows.Forms.Button buttonHelp; + private System.Windows.Forms.PropertyGrid propertyGridCamSpecific; } } \ No newline at end of file diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.cs index 8bbec0db..2f3b3eec 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalCamEditor.cs @@ -14,6 +14,7 @@ public InternalCamEditor(AssetCAM asset, ArchiveEditorFunctions archive) propertyGridAsset.SelectedObject = asset; labelAssetName.Text = $"[{asset.AHDR.assetType.ToString()}] {asset.ToString()}"; + propertyGridCamSpecific.SelectedObject = asset.CamSpecific; } private void InternalCamEditor_FormClosing(object sender, FormClosingEventArgs e) @@ -48,6 +49,13 @@ private void buttonFindCallers_Click(object sender, System.EventArgs e) private void propertyGridAsset_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { + propertyGridCamSpecific.SelectedObject = asset.CamSpecific; + archive.UnsavedChanges = true; + } + + private void propertyGridCamSpecific_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + asset.CamSpecific = (CamSpecific_Generic)propertyGridCamSpecific.SelectedObject; archive.UnsavedChanges = true; } diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalDynaEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalDynaEditor.Designer.cs index cb07c740..ace2a4df 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalDynaEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalDynaEditor.Designer.cs @@ -32,8 +32,8 @@ private void InitializeComponent() this.labelAssetName = new System.Windows.Forms.Label(); this.propertyGridDynaType = new System.Windows.Forms.PropertyGrid(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.buttonFindCallers = new System.Windows.Forms.Button(); this.buttonHelp = new System.Windows.Forms.Button(); + this.buttonFindCallers = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -93,18 +93,6 @@ private void InitializeComponent() this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 580); this.tableLayoutPanel1.TabIndex = 8; // - // buttonFindCallers - // - this.buttonFindCallers.AutoSize = true; - this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindCallers.Location = new System.Drawing.Point(168, 555); - this.buttonFindCallers.Name = "buttonFindCallers"; - this.buttonFindCallers.Size = new System.Drawing.Size(159, 22); - this.buttonFindCallers.TabIndex = 8; - this.buttonFindCallers.Text = "Find Who Targets Me"; - this.buttonFindCallers.UseVisualStyleBackColor = true; - this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); - // // buttonHelp // this.buttonHelp.AutoSize = true; @@ -117,6 +105,18 @@ private void InitializeComponent() this.buttonHelp.UseVisualStyleBackColor = true; this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); // + // buttonFindCallers + // + this.buttonFindCallers.AutoSize = true; + this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonFindCallers.Location = new System.Drawing.Point(168, 555); + this.buttonFindCallers.Name = "buttonFindCallers"; + this.buttonFindCallers.Size = new System.Drawing.Size(159, 22); + this.buttonFindCallers.TabIndex = 8; + this.buttonFindCallers.Text = "Find Who Targets Me"; + this.buttonFindCallers.UseVisualStyleBackColor = true; + this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); + // // InternalDynaEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalGrupEditor.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalGrupEditor.cs index 3ded3c08..0c8a35a6 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalGrupEditor.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalGrupEditor.cs @@ -50,6 +50,7 @@ private void buttonAddSelected_Click(object sender, System.EventArgs e) if (!items.Contains(i)) items.Add(i); asset.GroupItems = items.ToArray(); + archive.UnsavedChanges = true; } private void buttonHelp_Click(object sender, System.EventArgs e) diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.Designer.cs index 64113087..df1dc7d9 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.Designer.cs @@ -31,23 +31,22 @@ private void InitializeComponent() this.propertyGridAsset = new System.Windows.Forms.PropertyGrid(); this.labelAssetName = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.buttonHelp = new System.Windows.Forms.Button(); this.propertyGrid_PlatSpecific = new System.Windows.Forms.PropertyGrid(); this.buttonFindCallers = new System.Windows.Forms.Button(); - this.buttonHelp = new System.Windows.Forms.Button(); + this.propertyGrid_Motion = new System.Windows.Forms.PropertyGrid(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // propertyGridAsset // - this.propertyGridAsset.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.propertyGridAsset, 2); + this.propertyGridAsset.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGridAsset.HelpVisible = false; this.propertyGridAsset.Location = new System.Drawing.Point(3, 23); this.propertyGridAsset.Name = "propertyGridAsset"; this.propertyGridAsset.PropertySort = System.Windows.Forms.PropertySort.Categorized; - this.propertyGridAsset.Size = new System.Drawing.Size(324, 223); + this.propertyGridAsset.Size = new System.Drawing.Size(324, 190); this.propertyGridAsset.TabIndex = 5; this.propertyGridAsset.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGridAsset_PropertyValueChanged); // @@ -67,40 +66,53 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Controls.Add(this.buttonHelp, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.buttonHelp, 0, 4); this.tableLayoutPanel1.Controls.Add(this.propertyGrid_PlatSpecific, 0, 2); this.tableLayoutPanel1.Controls.Add(this.propertyGridAsset, 0, 1); this.tableLayoutPanel1.Controls.Add(this.labelAssetName, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.buttonFindCallers, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.buttonFindCallers, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.propertyGrid_Motion, 0, 3); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowCount = 5; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 401); + this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 539); this.tableLayoutPanel1.TabIndex = 7; // + // buttonHelp + // + this.buttonHelp.AutoSize = true; + this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonHelp.Location = new System.Drawing.Point(3, 513); + this.buttonHelp.Name = "buttonHelp"; + this.buttonHelp.Size = new System.Drawing.Size(159, 23); + this.buttonHelp.TabIndex = 16; + this.buttonHelp.Text = "Help"; + this.buttonHelp.UseVisualStyleBackColor = true; + this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); + // // propertyGrid_PlatSpecific // - this.propertyGrid_PlatSpecific.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.tableLayoutPanel1.SetColumnSpan(this.propertyGrid_PlatSpecific, 2); + this.propertyGrid_PlatSpecific.Dock = System.Windows.Forms.DockStyle.Fill; this.propertyGrid_PlatSpecific.HelpVisible = false; - this.propertyGrid_PlatSpecific.Location = new System.Drawing.Point(3, 252); + this.propertyGrid_PlatSpecific.Location = new System.Drawing.Point(3, 219); this.propertyGrid_PlatSpecific.Name = "propertyGrid_PlatSpecific"; this.propertyGrid_PlatSpecific.PropertySort = System.Windows.Forms.PropertySort.Categorized; - this.propertyGrid_PlatSpecific.Size = new System.Drawing.Size(324, 117); + this.propertyGrid_PlatSpecific.Size = new System.Drawing.Size(324, 141); this.propertyGrid_PlatSpecific.TabIndex = 8; + this.propertyGrid_PlatSpecific.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid_PlatSpecific_PropertyValueChanged); // // buttonFindCallers // this.buttonFindCallers.AutoSize = true; this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindCallers.Location = new System.Drawing.Point(168, 375); + this.buttonFindCallers.Location = new System.Drawing.Point(168, 513); this.buttonFindCallers.Name = "buttonFindCallers"; this.buttonFindCallers.Size = new System.Drawing.Size(159, 23); this.buttonFindCallers.TabIndex = 7; @@ -108,23 +120,23 @@ private void InitializeComponent() this.buttonFindCallers.UseVisualStyleBackColor = true; this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); // - // buttonHelp + // propertyGrid_Motion // - this.buttonHelp.AutoSize = true; - this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonHelp.Location = new System.Drawing.Point(3, 375); - this.buttonHelp.Name = "buttonHelp"; - this.buttonHelp.Size = new System.Drawing.Size(159, 23); - this.buttonHelp.TabIndex = 16; - this.buttonHelp.Text = "Help"; - this.buttonHelp.UseVisualStyleBackColor = true; - this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); + this.tableLayoutPanel1.SetColumnSpan(this.propertyGrid_Motion, 2); + this.propertyGrid_Motion.Dock = System.Windows.Forms.DockStyle.Fill; + this.propertyGrid_Motion.HelpVisible = false; + this.propertyGrid_Motion.Location = new System.Drawing.Point(3, 366); + this.propertyGrid_Motion.Name = "propertyGrid_Motion"; + this.propertyGrid_Motion.PropertySort = System.Windows.Forms.PropertySort.Categorized; + this.propertyGrid_Motion.Size = new System.Drawing.Size(324, 141); + this.propertyGrid_Motion.TabIndex = 17; + this.propertyGrid_Motion.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid_Motion_PropertyValueChanged); // // InternalPlatEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(330, 401); + this.ClientSize = new System.Drawing.Size(330, 539); this.Controls.Add(this.tableLayoutPanel1); this.MaximizeBox = false; this.Name = "InternalPlatEditor"; @@ -145,5 +157,6 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonFindCallers; private System.Windows.Forms.PropertyGrid propertyGrid_PlatSpecific; private System.Windows.Forms.Button buttonHelp; + private System.Windows.Forms.PropertyGrid propertyGrid_Motion; } } \ No newline at end of file diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.cs index c1c65bad..75b26a86 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalPlatEditor.cs @@ -7,216 +7,6 @@ namespace IndustrialPark { public partial class InternalPlatEditor : Form, IInternalEditor { - class Plat_Default - { - private AssetPLAT asset; - public Plat_Default(AssetPLAT asset) { this.asset = asset; } - - [Category("Platform")] - public int UnknownInt58 - { - get => asset.Int58; - set => asset.Int58 = value; - } - [Category("Platform")] - public int UnknownInt5C - { - get => asset.Int5C; - set => asset.Int5C = value; - } - [Category("Platform")] - public int UnknownInt60 - { - get => asset.Int60; - set => asset.Int60 = value; - } - [Category("Platform")] - public int UnknownInt64 - { - get => asset.Int64; - set => asset.Int64 = value; - } - [Category("Platform")] - public float UnknownFloat58 - { - get => asset.Float58; - set => asset.Float58 = value; - } - [Category("Platform")] - public float UnknownFloat5C - { - get => asset.Float5C; - set => asset.Float5C = value; - } - [Category("Platform")] - public float UnknownFloat60 - { - get => asset.Float60; - set => asset.Float60 = value; - } - [Category("Platform")] - public float UnknownFloat64 - { - get => asset.Float64; - set => asset.Float64 = value; - } - } - - class Plat_Conveyor - { - private AssetPLAT asset; - public Plat_Conveyor(AssetPLAT asset) { this.asset = asset; } - - [Category("Conveyor")] - public float Speed - { - get => asset.Float58; - set => asset.Float58 = value; - } - [Category("Conveyor")] - public int UnknownInt5C - { - get => asset.Int5C; - set => asset.Int5C = value; - } - [Category("Conveyor")] - public int UnknownInt60 - { - get => asset.Int60; - set => asset.Int60 = value; - } - [Category("Conveyor")] - public int UnknownInt64 - { - get => asset.Int64; - set => asset.Int64 = value; - } - } - - class Plat_Breakaway - { - private AssetPLAT asset; - public Plat_Breakaway(AssetPLAT asset) { this.asset = asset; } - - [Category("Breakaway Platform")] - public float BreakDelay - { - get => asset.Float58; - set => asset.Float58 = value; - } - [Category("Breakaway Platform")] - public AssetID UnknownInt5C - { - get => (uint)asset.Int5C; - set => asset.Int5C = (int)(uint)value; - } - [Category("Breakaway Platform")] - public float UnknownFloat60 - { - get => asset.Float60; - set => asset.Float60 = value; - } - [Category("Breakaway Platform")] - public int UnknownInt64 - { - get => asset.Int64; - set => asset.Int64 = value; - } - } - - class Plat_Springboard - { - private AssetPLAT asset; - public Plat_Springboard(AssetPLAT asset) { this.asset = asset; } - - [Category("Springboard")] - public float BounceHeight1 - { - get => asset.Float58; - set => asset.Float58 = value; - } - [Category("Springboard")] - public float BounceHeight2 - { - get => asset.Float5C; - set => asset.Float5C = value; - } - [Category("Springboard")] - public float BounceHeight3 - { - get => asset.Float60; - set => asset.Float60 = value; - } - [Category("Springboard")] - public float SlamHeight - { - get => asset.Float64; - set => asset.Float64 = value; - } - } - - class Plat_Teeter - { - private AssetPLAT asset; - public Plat_Teeter(AssetPLAT asset) { this.asset = asset; } - - [Category("Teeter-Totter")] - public float UnknownFloat58 - { - get => MathUtil.RadiansToDegrees(asset.Float58); - set => asset.Float58 = MathUtil.DegreesToRadians(value); - } - [Category("Teeter-Totter")] - public float MaxTiltAngle - { - get => MathUtil.RadiansToDegrees(asset.Float5C); - set => asset.Float5C = MathUtil.DegreesToRadians(value); - } - [Category("Teeter-Totter")] - public float TiltSpeed - { - get => asset.Float60; - set => asset.Float60 = value; - } - [Category("Teeter-Totter")] - public int UnknownInt64 - { - get => asset.Int64; - set => asset.Int64 = value; - } - } - - class Plat_Paddle - { - private AssetPLAT asset; - public Plat_Paddle(AssetPLAT asset) { this.asset = asset; } - - [Category("Paddle")] - public int CurrentSpinIndex - { - get => asset.Int58; - set => asset.Int58 = value; - } - [Category("Paddle")] - public float NumberOfSpins - { - get => asset.Float5C; - set => asset.Float5C = value; - } - [Category("Paddle")] - public float UnknownFloat60 - { - get => asset.Float60; - set => asset.Float60 = value; - } - [Category("Paddle")] - public int UnknownInt64 - { - get => asset.Int64; - set => asset.Int64 = value; - } - } - public InternalPlatEditor(AssetPLAT asset, ArchiveEditorFunctions archive) { InitializeComponent(); @@ -227,11 +17,15 @@ public InternalPlatEditor(AssetPLAT asset, ArchiveEditorFunctions archive) propertyGridAsset.SelectedObject = asset; labelAssetName.Text = $"[{asset.AHDR.assetType.ToString()}] {asset.ToString()}"; - ChoosePlatSpecific(); + + asset.PlatSpecificChosen += UpdatePlatSpecifics; + + UpdatePlatSpecifics(); } private void InternalAssetEditor_FormClosing(object sender, FormClosingEventArgs e) { + asset.PlatSpecificChosen -= UpdatePlatSpecifics; archive.CloseInternalEditor(this); } @@ -252,32 +46,25 @@ private void propertyGridAsset_PropertyValueChanged(object s, PropertyValueChang { archive.UnsavedChanges = true; ArchiveEditorFunctions.UpdateGizmoPosition(); - ChoosePlatSpecific(); + UpdatePlatSpecifics(); } - private void ChoosePlatSpecific() + private void UpdatePlatSpecifics() { - switch (asset.PlatformType) - { - case PlatType.ConveyorBelt: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Conveyor(asset); - break; - case PlatType.BreakawayPlatform: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Breakaway(asset); - break; - case PlatType.Springboard: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Springboard(asset); - break; - case PlatType.TeeterTotter: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Teeter(asset); - break; - case PlatType.Paddle: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Paddle(asset); - break; - default: - propertyGrid_PlatSpecific.SelectedObject = new Plat_Default(asset); - break; - } + propertyGrid_PlatSpecific.SelectedObject = asset.PlatSpecific; + propertyGrid_Motion.SelectedObject = asset.Motion; + } + + private void propertyGrid_PlatSpecific_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + archive.UnsavedChanges = true; + asset.PlatSpecific = (PlatSpecific_Generic)propertyGrid_PlatSpecific.SelectedObject; + } + + private void propertyGrid_Motion_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + archive.UnsavedChanges = true; + asset.Motion = (Motion)propertyGrid_Motion.SelectedObject; } private void buttonHelp_Click(object sender, EventArgs e) diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalShrapnelEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalShrapnelEditor.Designer.cs index 5cb88c95..246c73e9 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalShrapnelEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalShrapnelEditor.Designer.cs @@ -52,7 +52,7 @@ private void InitializeComponent() this.propertyGridAsset.Location = new System.Drawing.Point(3, 23); this.propertyGridAsset.Name = "propertyGridAsset"; this.propertyGridAsset.PropertySort = System.Windows.Forms.PropertySort.Categorized; - this.propertyGridAsset.Size = new System.Drawing.Size(311, 362); + this.propertyGridAsset.Size = new System.Drawing.Size(324, 342); this.propertyGridAsset.TabIndex = 5; this.propertyGridAsset.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGridAsset_PropertyValueChanged); // @@ -93,16 +93,16 @@ private void InitializeComponent() this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(317, 472); + this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 452); this.tableLayoutPanel1.TabIndex = 7; // // buttonHelp // this.buttonHelp.AutoSize = true; this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonHelp.Location = new System.Drawing.Point(3, 447); + this.buttonHelp.Location = new System.Drawing.Point(3, 427); this.buttonHelp.Name = "buttonHelp"; - this.buttonHelp.Size = new System.Drawing.Size(99, 22); + this.buttonHelp.Size = new System.Drawing.Size(103, 22); this.buttonHelp.TabIndex = 21; this.buttonHelp.Text = "Help"; this.buttonHelp.UseVisualStyleBackColor = true; @@ -111,9 +111,9 @@ private void InitializeComponent() // buttonAdd9 // this.buttonAdd9.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd9.Location = new System.Drawing.Point(213, 419); + this.buttonAdd9.Location = new System.Drawing.Point(222, 399); this.buttonAdd9.Name = "buttonAdd9"; - this.buttonAdd9.Size = new System.Drawing.Size(101, 22); + this.buttonAdd9.Size = new System.Drawing.Size(105, 22); this.buttonAdd9.TabIndex = 20; this.buttonAdd9.Text = "Add Type 9"; this.buttonAdd9.UseVisualStyleBackColor = true; @@ -122,9 +122,9 @@ private void InitializeComponent() // buttonAdd8 // this.buttonAdd8.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd8.Location = new System.Drawing.Point(108, 419); + this.buttonAdd8.Location = new System.Drawing.Point(112, 399); this.buttonAdd8.Name = "buttonAdd8"; - this.buttonAdd8.Size = new System.Drawing.Size(99, 22); + this.buttonAdd8.Size = new System.Drawing.Size(104, 22); this.buttonAdd8.TabIndex = 19; this.buttonAdd8.Text = "Add Type 8"; this.buttonAdd8.UseVisualStyleBackColor = true; @@ -133,9 +133,9 @@ private void InitializeComponent() // buttonAdd6 // this.buttonAdd6.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd6.Location = new System.Drawing.Point(3, 419); + this.buttonAdd6.Location = new System.Drawing.Point(3, 399); this.buttonAdd6.Name = "buttonAdd6"; - this.buttonAdd6.Size = new System.Drawing.Size(99, 22); + this.buttonAdd6.Size = new System.Drawing.Size(103, 22); this.buttonAdd6.TabIndex = 18; this.buttonAdd6.Text = "Add Type 6"; this.buttonAdd6.UseVisualStyleBackColor = true; @@ -146,9 +146,9 @@ private void InitializeComponent() this.buttonFindWhoTargetsMe.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.buttonFindWhoTargetsMe, 2); this.buttonFindWhoTargetsMe.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindWhoTargetsMe.Location = new System.Drawing.Point(108, 447); + this.buttonFindWhoTargetsMe.Location = new System.Drawing.Point(112, 427); this.buttonFindWhoTargetsMe.Name = "buttonFindWhoTargetsMe"; - this.buttonFindWhoTargetsMe.Size = new System.Drawing.Size(206, 22); + this.buttonFindWhoTargetsMe.Size = new System.Drawing.Size(215, 22); this.buttonFindWhoTargetsMe.TabIndex = 17; this.buttonFindWhoTargetsMe.Text = "Find Who Targets Me"; this.buttonFindWhoTargetsMe.UseVisualStyleBackColor = true; @@ -157,9 +157,9 @@ private void InitializeComponent() // buttonAdd4 // this.buttonAdd4.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd4.Location = new System.Drawing.Point(108, 391); + this.buttonAdd4.Location = new System.Drawing.Point(112, 371); this.buttonAdd4.Name = "buttonAdd4"; - this.buttonAdd4.Size = new System.Drawing.Size(99, 22); + this.buttonAdd4.Size = new System.Drawing.Size(104, 22); this.buttonAdd4.TabIndex = 9; this.buttonAdd4.Text = "Add Type 4"; this.buttonAdd4.UseVisualStyleBackColor = true; @@ -168,9 +168,9 @@ private void InitializeComponent() // buttonAdd3 // this.buttonAdd3.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd3.Location = new System.Drawing.Point(3, 391); + this.buttonAdd3.Location = new System.Drawing.Point(3, 371); this.buttonAdd3.Name = "buttonAdd3"; - this.buttonAdd3.Size = new System.Drawing.Size(99, 22); + this.buttonAdd3.Size = new System.Drawing.Size(103, 22); this.buttonAdd3.TabIndex = 8; this.buttonAdd3.Text = "Add Type 3"; this.buttonAdd3.UseVisualStyleBackColor = true; @@ -179,9 +179,9 @@ private void InitializeComponent() // buttonAdd5 // this.buttonAdd5.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonAdd5.Location = new System.Drawing.Point(213, 391); + this.buttonAdd5.Location = new System.Drawing.Point(222, 371); this.buttonAdd5.Name = "buttonAdd5"; - this.buttonAdd5.Size = new System.Drawing.Size(101, 22); + this.buttonAdd5.Size = new System.Drawing.Size(105, 22); this.buttonAdd5.TabIndex = 10; this.buttonAdd5.Text = "Add Type 5"; this.buttonAdd5.UseVisualStyleBackColor = true; @@ -191,7 +191,7 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(317, 472); + this.ClientSize = new System.Drawing.Size(330, 452); this.Controls.Add(this.tableLayoutPanel1); this.MaximizeBox = false; this.Name = "InternalShrapnelEditor"; diff --git a/IndustrialPark/ArchiveEditor/InternalEditors/InternalTextEditor.Designer.cs b/IndustrialPark/ArchiveEditor/InternalEditors/InternalTextEditor.Designer.cs index 1240e15b..112a99c0 100644 --- a/IndustrialPark/ArchiveEditor/InternalEditors/InternalTextEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/InternalEditors/InternalTextEditor.Designer.cs @@ -31,8 +31,8 @@ private void InitializeComponent() this.labelAssetName = new System.Windows.Forms.Label(); this.richTextBoxAssetText = new System.Windows.Forms.RichTextBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.buttonFindCallers = new System.Windows.Forms.Button(); this.buttonHelp = new System.Windows.Forms.Button(); + this.buttonFindCallers = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -52,7 +52,7 @@ private void InitializeComponent() this.richTextBoxAssetText.Font = new System.Drawing.Font("Courier New", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.richTextBoxAssetText.Location = new System.Drawing.Point(3, 23); this.richTextBoxAssetText.Name = "richTextBoxAssetText"; - this.richTextBoxAssetText.Size = new System.Drawing.Size(557, 196); + this.richTextBoxAssetText.Size = new System.Drawing.Size(557, 207); this.richTextBoxAssetText.TabIndex = 7; this.richTextBoxAssetText.Text = ""; this.richTextBoxAssetText.TextChanged += new System.EventHandler(this.richTextBoxAssetText_TextChanged); @@ -73,26 +73,14 @@ private void InitializeComponent() this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 28F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(563, 250); + this.tableLayoutPanel1.Size = new System.Drawing.Size(563, 261); this.tableLayoutPanel1.TabIndex = 8; // - // buttonFindCallers - // - this.buttonFindCallers.AutoSize = true; - this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonFindCallers.Location = new System.Drawing.Point(284, 225); - this.buttonFindCallers.Name = "buttonFindCallers"; - this.buttonFindCallers.Size = new System.Drawing.Size(276, 22); - this.buttonFindCallers.TabIndex = 8; - this.buttonFindCallers.Text = "Find Who Targets Me"; - this.buttonFindCallers.UseVisualStyleBackColor = true; - this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); - // // buttonHelp // this.buttonHelp.AutoSize = true; this.buttonHelp.Dock = System.Windows.Forms.DockStyle.Fill; - this.buttonHelp.Location = new System.Drawing.Point(3, 225); + this.buttonHelp.Location = new System.Drawing.Point(3, 236); this.buttonHelp.Name = "buttonHelp"; this.buttonHelp.Size = new System.Drawing.Size(275, 22); this.buttonHelp.TabIndex = 18; @@ -100,11 +88,23 @@ private void InitializeComponent() this.buttonHelp.UseVisualStyleBackColor = true; this.buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click); // + // buttonFindCallers + // + this.buttonFindCallers.AutoSize = true; + this.buttonFindCallers.Dock = System.Windows.Forms.DockStyle.Fill; + this.buttonFindCallers.Location = new System.Drawing.Point(284, 236); + this.buttonFindCallers.Name = "buttonFindCallers"; + this.buttonFindCallers.Size = new System.Drawing.Size(276, 22); + this.buttonFindCallers.TabIndex = 8; + this.buttonFindCallers.Text = "Find Who Targets Me"; + this.buttonFindCallers.UseVisualStyleBackColor = true; + this.buttonFindCallers.Click += new System.EventHandler(this.buttonFindCallers_Click); + // // InternalTextEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(563, 250); + this.ClientSize = new System.Drawing.Size(563, 261); this.Controls.Add(this.tableLayoutPanel1); this.MaximizeBox = false; this.Name = "InternalTextEditor"; diff --git a/IndustrialPark/Assets/Binary/AssetPICK.cs b/IndustrialPark/Assets/Binary/AssetPICK.cs index 80a79cd3..e2f75b5e 100644 --- a/IndustrialPark/Assets/Binary/AssetPICK.cs +++ b/IndustrialPark/Assets/Binary/AssetPICK.cs @@ -9,28 +9,25 @@ namespace IndustrialPark { public class EntryPICK { - public AssetID ReferenceID { get; set; } + public uint PickupHash { get; set; } [TypeConverter(typeof(HexByteTypeConverter))] - public byte Unknown21 { get; set; } + public byte PickupType { get; set; } [TypeConverter(typeof(HexByteTypeConverter))] - public byte Unknown22 { get; set; } - [TypeConverter(typeof(HexByteTypeConverter))] - public byte Unknown23 { get; set; } - [TypeConverter(typeof(HexByteTypeConverter))] - public byte Unknown24 { get; set; } - public uint Unknown3 { get; set; } + public byte PickupIndex { get; set; } + [TypeConverter(typeof(HexShortTypeConverter))] + public ushort PickupFlags { get; set; } + public uint Quantity { get; set; } public AssetID ModelAssetID { get; set; } - public uint Unknown5 { get; set; } + public AssetID AnimAssetID { get; set; } public EntryPICK() { - ReferenceID = 0; ModelAssetID = 0; } public override string ToString() { - return $"[{Program.MainForm.GetAssetNameFromID(ReferenceID)}] - [{Program.MainForm.GetAssetNameFromID(ModelAssetID)}]"; + return $"[{Program.MainForm.GetAssetNameFromID(PickupHash)}] - [{Program.MainForm.GetAssetNameFromID(ModelAssetID)}]"; } } @@ -40,9 +37,24 @@ public class AssetPICK : Asset public AssetPICK(Section_AHDR AHDR) : base(AHDR) { - pickEntries = new Dictionary(); - foreach (EntryPICK entryPICK in PICK_Entries) - pickEntries.Add(entryPICK.ReferenceID, entryPICK.ModelAssetID); + SetupDictionary(); + } + + private void SetupDictionary() + { + pickEntries.Clear(); + + foreach (EntryPICK entry in PICK_Entries) + if (pickEntries.ContainsKey(entry.PickupHash)) + pickEntries[entry.PickupHash] = entry.ModelAssetID; + else + pickEntries.Add(entry.PickupHash, entry.ModelAssetID); + } + + public void ClearDictionary() + { + foreach (EntryPICK entry in PICK_Entries) + pickEntries.Remove(entry.PickupHash); } public override bool HasReference(uint assetID) @@ -51,8 +63,6 @@ public override bool HasReference(uint assetID) { if (a.ModelAssetID == assetID) return true; - if (a.ReferenceID == assetID) - return true; } return base.HasReference(assetID); @@ -80,14 +90,13 @@ public EntryPICK[] PICK_Entries { entries.Add(new EntryPICK() { - ReferenceID = ReadUInt(8 + i * 0x14), - Unknown21 = ReadByte(12 + i * 0x14), - Unknown22 = ReadByte(13 + i * 0x14), - Unknown23 = ReadByte(14 + i * 0x14), - Unknown24 = ReadByte(15 + i * 0x14), - Unknown3 = ReadUInt(16 + i * 0x14), + PickupHash = ReadUInt(8 + i * 0x14), + PickupType = ReadByte(12 + i * 0x14), + PickupIndex = ReadByte(13 + i * 0x14), + PickupFlags = ReadUShort(14 + i * 0x14), + Quantity = ReadUInt(16 + i * 0x14), ModelAssetID = ReadUInt(20 + i * 0x14), - Unknown5 = ReadUInt(24 + i * 0x14) + AnimAssetID = ReadUInt(24 + i * 0x14) }); } @@ -102,14 +111,13 @@ public EntryPICK[] PICK_Entries foreach (EntryPICK i in newValues) { - newData.AddRange(BitConverter.GetBytes(Switch(i.ReferenceID))); - newData.Add(i.Unknown21); - newData.Add(i.Unknown22); - newData.Add(i.Unknown23); - newData.Add(i.Unknown24); - newData.AddRange(BitConverter.GetBytes(Switch(i.Unknown3))); + newData.AddRange(BitConverter.GetBytes(Switch(i.PickupHash))); + newData.Add(i.PickupType); + newData.Add(i.PickupIndex); + newData.AddRange(BitConverter.GetBytes(Switch(i.PickupFlags))); + newData.AddRange(BitConverter.GetBytes(Switch(i.Quantity))); newData.AddRange(BitConverter.GetBytes(Switch(i.ModelAssetID))); - newData.AddRange(BitConverter.GetBytes(Switch(i.Unknown5))); + newData.AddRange(BitConverter.GetBytes(Switch(i.AnimAssetID))); } Data = newData.ToArray(); diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/AssetCAM.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/AssetCAM.cs index a2488f9f..c3e82f0d 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/AssetCAM.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/AssetCAM.cs @@ -1,12 +1,34 @@ using HipHopFile; using SharpDX; using System.Collections.Generic; -using System; using System.ComponentModel; -using IndustrialPark.Models; +using System.Linq; namespace IndustrialPark { + public enum CamType : byte + { + Follow = 0, + Shoulder = 1, + Static = 2, + Path = 3, + StaticFollow = 4, + } + + public enum CamTransitionType + { + None = 0, + Interp1 = 1, + Interp2 = 2, + Interp3 = 3, + Interp4 = 4, + Linear = 5, + Interp1Rev = 6, + Interp2Rev = 7, + Interp3Rev = 8, + Interp4Rev = 9, + } + public class AssetCAM : ObjectAsset, IRenderableAsset, IClickableAsset { private Matrix world; @@ -30,9 +52,15 @@ public AssetCAM(Section_AHDR AHDR) : base(AHDR) public override bool HasReference(uint assetID) { - if (MarkerAssetID == assetID) + if (Marker1AssetID == assetID) + return true; + if (Marker2AssetID == assetID) return true; + if (CamSpecific is CamSpecific_Path camSpecific_Path) + if (camSpecific_Path.Unknown_AssetID == assetID) + return true; + return base.HasReference(assetID); } @@ -40,7 +68,11 @@ public override void Verify(ref List result) { base.Verify(ref result); - Verify(MarkerAssetID, ref result); + Verify(Marker1AssetID, ref result); + Verify(Marker2AssetID, ref result); + + if (CamSpecific is CamSpecific_Path camSpecific_Path) + Verify(camSpecific_Path.Unknown_AssetID, ref result); Vector3 nForward = new Vector3(NormalizedForwardX, NormalizedForwardY, NormalizedForwardZ); if (nForward != Vector3.Normalize(nForward)) @@ -266,10 +298,10 @@ public float TransitionTime set => Write(0x4C, value); } [Category("Camera")] - public int TransitionType + public CamTransitionType TransitionType { - get => ReadInt(0x50); - set => Write(0x50, value); + get => (CamTransitionType)ReadInt(0x50); + set => Write(0x50, (int)value); } [Category("Camera")] public uint CamFlags @@ -289,42 +321,36 @@ public float FadeDown get => ReadFloat(0x5C); set => Write(0x5C, value); } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat60 - { - get => ReadFloat(0x60); - set => Write(0x60, value); - } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat64 - { - get => ReadFloat(0x64); - set => Write(0x64, value); - } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat68 - { - get => ReadFloat(0x68); - set => Write(0x68, value); - } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat6C - { - get => ReadFloat(0x6C); - set => Write(0x6C, value); - } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat70 - { - get => ReadFloat(0x70); - set => Write(0x70, value); - } - [Category("Camera"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat74 + + public CamSpecific_Generic CamSpecific { - get => ReadFloat(0x74); - set => Write(0x74, value); + get + { + switch (CamType) + { + case CamType.Follow: + return new CamSpecific_Follow(Data.Skip(0x60).ToArray()); + case CamType.Shoulder: + return new CamSpecific_Shoulder(Data.Skip(0x60).ToArray()); + case CamType.Static: + return new CamSpecific_Static(Data.Skip(0x60).ToArray()); + case CamType.Path: + return new CamSpecific_Path(Data.Skip(0x60).ToArray()); + case CamType.StaticFollow: + return new CamSpecific_StaticFollow(Data.Skip(0x60).ToArray()); + default: + return new CamSpecific_Generic(Data.Skip(0x60).ToArray()); + } + } + set + { + List before = Data.Take(0x60).ToList(); + before.AddRange(value.ToByteArray()); + before.AddRange(Data.Skip(0x60 + CamSpecific_Generic.Size)); + Data = before.ToArray(); + } } + [Category("Camera"), TypeConverter(typeof(HexByteTypeConverter))] public byte Flags1 { @@ -350,22 +376,22 @@ public byte Flags4 set => Write(0x7B, value); } [Category("Camera")] - public AssetID MarkerAssetID + public AssetID Marker1AssetID { get => ReadUInt(0x7C); set => Write(0x7C, value); } - [Category("Camera"), TypeConverter(typeof(HexIntTypeConverter))] - public int UnknownInt80 + [Category("Camera")] + public AssetID Marker2AssetID { - get => ReadInt(0x80); + get => ReadUInt(0x80); set => Write(0x80, value); } [Category("Camera")] - public byte CamType + public CamType CamType { - get => ReadByte(0x84); - set => Write(0x84, value); + get => (CamType)ReadByte(0x84); + set => Write(0x84, (byte)value); } [Category("Camera")] public byte Padding85 diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBOUL.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBOUL.cs index 91a5922f..f946127d 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBOUL.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBOUL.cs @@ -38,9 +38,9 @@ public override void Draw(SharpRenderer renderer) Color.W = Color.W == 0f ? 1f : Color.W; if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID)) - ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, world, isSelected ? renderer.selectedObjectColor * Color : Color); + ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, LocalWorld(), isSelected ? renderer.selectedObjectColor * Color : Color); else - renderer.DrawCube(world, isSelected); + renderer.DrawCube(LocalWorld(), isSelected); } [Category("Boulder"), TypeConverter(typeof(FloatTypeConverter))] diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBUTN.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBUTN.cs index 2f8caf12..a46b5e43 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBUTN.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetBUTN.cs @@ -1,19 +1,22 @@ using HipHopFile; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; namespace IndustrialPark { - public class AssetBUTN : PlaceableAsset + public class AssetBUTN : AssetWithMotion { public static bool dontRender = false; protected override bool DontRender => dontRender; - protected override int EventStartOffset => 0x9C + Offset + (Functions.currentGame == Game.Incredibles ? 12 : 0); + protected override int EventStartOffset => 0x6C + Offset + Motion.Size; + + public AssetBUTN(Section_AHDR AHDR) : base(AHDR) + { + } - public AssetBUTN(Section_AHDR AHDR) : base(AHDR) { } - public override bool HasReference(uint assetID) { if (PressedModel_AssetID == assetID) @@ -300,179 +303,7 @@ public bool HitMask31 get => (HitMask & Mask(31)) != 0; set => HitMask = value ? (HitMask | Mask(31)) : (HitMask & InvMask(31)); } - - [Category("Button")] - public byte UnknownByte6C - { - get => ReadByte(0x6C + Offset); - set => Write(0x6C + Offset, value); - } - - [Category("Button")] - public byte UnknownByte6D - { - get => ReadByte(0x6D + Offset); - set => Write(0x6D + Offset, value); - } - - [Category("Button")] - public byte UnknownByte6E - { - get => ReadByte(0x6E + Offset); - set => Write(0x6E + Offset, value); - } - - [Category("Button")] - public byte UnknownByte6F - { - get => ReadByte(0x6F + Offset); - set => Write(0x6F + Offset, value); - } - - [Category("Button")] - public byte UnknownByte70 - { - get => ReadByte(0x70 + Offset); - set => Write(0x70 + Offset, value); - } - - [Category("Button")] - public byte UnknownByte71 - { - get => ReadByte(0x71 + Offset); - set => Write(0x71 + Offset, value); - } - - [Category("Button")] - public byte UnknownByte72 - { - get => ReadByte(0x72 + Offset); - set => Write(0x72 + Offset, value); - } - - [Category("Button")] - public byte UnknownByte73 - { - get => ReadByte(0x73 + Offset); - set => Write(0x73 + Offset, value); - } - - [Category("Button"), TypeConverter(typeof(FloatTypeConverter))] - public float PressedOffset - { - get => ReadFloat(0x74); - set => Write(0x74, value); - } - - [Category("Button"), TypeConverter(typeof(FloatTypeConverter))] - public float TransitionTime - { - get => ReadFloat(0x78 + Offset); - set => Write(0x78 + Offset, value); - } - - [Category("Button"), TypeConverter(typeof(FloatTypeConverter))] - public float TransitionEaseIn - { - get => ReadFloat(0x7C + Offset); - set => Write(0x7C + Offset, value); - } - - [Category("Button"), TypeConverter(typeof(FloatTypeConverter))] - public float TransitionEaseOut - { - get => ReadFloat(0x80 + Offset); - set => Write(0x80 + Offset, value); - } - - [Category("Button")] - public int UnknownInt84 - { - get => ReadInt(0x84 + Offset); - set => Write(0x84 + Offset, value); - } - - [Category("Button")] - public int UnknownInt88 - { - get => ReadInt(0x88 + Offset); - set => Write(0x88 + Offset, value); - } - - [Category("Button")] - public int UnknownInt8C - { - get => ReadInt(0x8C + Offset); - set => Write(0x8C + Offset, value); - } - - [Category("Button")] - public int UnknownInt90 - { - get => ReadInt(0x90 + Offset); - set => Write(0x90 + Offset, value); - } - - [Category("Button")] - public int UnknownInt94 - { - get => ReadInt(0x94 + Offset); - set => Write(0x94 + Offset, value); - } - - [Category("Button")] - public int UnknownInt98 - { - get => ReadInt(0x98 + Offset); - set => Write(0x98 + Offset, value); - } - - [Category("Button (TSSM)")] - public int UnknownInt9C - { - get - { - if (Functions.currentGame == Game.Incredibles) - return ReadInt(0x9C + Offset); - return 0; - } - set - { - if (Functions.currentGame == Game.Incredibles) - Write(0x9C + Offset, value); - } - } - - [Category("Button (TSSM)")] - public int UnknownIntA0 - { - get - { - if (Functions.currentGame == Game.Incredibles) - return ReadInt(0xA0 + Offset); - return 0; - } - set - { - if (Functions.currentGame == Game.Incredibles) - Write(0xA0 + Offset, value); - } - } - - [Category("Button (TSSM)")] - public int UnknownIntA4 - { - get - { - if (Functions.currentGame == Game.Incredibles) - return ReadInt(0xA4 + Offset); - return 0; - } - set - { - if (Functions.currentGame == Game.Incredibles) - Write(0xA4 + Offset, value); - } - } + + protected override int MotionStart => 0x6C + Offset; } } \ No newline at end of file diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetNPC.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetNPC.cs index dfd0e8d5..9e69784b 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetNPC.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetNPC.cs @@ -39,9 +39,9 @@ public override void Draw(SharpRenderer renderer) Color.W = Color.W == 0f ? 1f : Color.W; if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID)) - ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, world, isSelected ? renderer.selectedObjectColor * Color : Color); + ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, LocalWorld(), isSelected ? renderer.selectedObjectColor * Color : Color); else - renderer.DrawCube(world, isSelected); + renderer.DrawCube(LocalWorld(), isSelected); } [Category("NPC"), TypeConverter(typeof(FloatTypeConverter))] diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPKUP.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPKUP.cs index 317651df..c0ab4e9d 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPKUP.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPKUP.cs @@ -80,7 +80,7 @@ public override void Draw(SharpRenderer renderer) if (AssetPICK.pickEntries.ContainsKey(_pickEntryID)) if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(AssetPICK.pickEntries[_pickEntryID])) { - ArchiveEditorFunctions.renderingDictionary[AssetPICK.pickEntries[_pickEntryID]].Draw(renderer, world, isSelected ? renderer.selectedObjectColor * _color : _color); + ArchiveEditorFunctions.renderingDictionary[AssetPICK.pickEntries[_pickEntryID]].Draw(renderer, LocalWorld(), isSelected ? renderer.selectedObjectColor * _color : _color); return; } diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLAT.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLAT.cs index 3235ef1e..831c3942 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLAT.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLAT.cs @@ -3,10 +3,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; namespace IndustrialPark { - public class AssetPLAT : PlaceableAsset + public class AssetPLAT : AssetWithMotion { public static bool dontRender = false; @@ -14,15 +15,14 @@ public class AssetPLAT : PlaceableAsset protected override int EventStartOffset => Functions.currentGame == Game.Incredibles ? 0xC8 : 0xC0; - public AssetPLAT(Section_AHDR AHDR) : base(AHDR) { } + public AssetPLAT(Section_AHDR AHDR) : base(AHDR) + { + ChoosePlatSpecific(); + } public override bool HasReference(uint assetID) { - if (ANIM_AssetID_1 == assetID) - return true; - if (ANIM_AssetID_2 == assetID) - return true; - if (MVPT_AssetID == assetID) + if (_platSpecific.HasReference(assetID)) return true; return base.HasReference(assetID); @@ -30,257 +30,87 @@ public override bool HasReference(uint assetID) public override void Verify(ref List result) { + _platSpecific.Verify(ref result); base.Verify(ref result); - - Verify(ANIM_AssetID_1, ref result); - Verify(ANIM_AssetID_2, ref result); - if (PlatformType == PlatType.MovePoint) - Verify(MVPT_AssetID, ref result); - } - - private enum CurrentMovementAction - { - StartWait, - Going, - EndWait, - GoingBack - } - - private float localFrameCounter = -1; - private int amountOfMovementsPerformed = 0; - - private CurrentMovementAction currentMovementAction = CurrentMovementAction.StartWait; - - private float StartWaitRange => 60 * (Movement_StartPointWait); - private float GoingRange => StartWaitRange + 60 * Math.Max(MovementMode == 0 ? 0 : MovementRotation_Time, MovementMode != 1 ? MovementTranslation_Time : 0); - private float EndWaitRange => GoingRange + 60 * Movement_EndPointWait; - private float GoingBackRange => EndWaitRange + 60 * Math.Max(MovementMode == 0 ? 0 : MovementRotation_Time, MovementMode != 1 ? MovementTranslation_Time : 0); - - public void Reset() - { - currentMovementAction = CurrentMovementAction.StartWait; - localFrameCounter = -1; - amountOfMovementsPerformed = 0; } - - public Matrix PlatLocalTranslation() + + [Category("Placement")] + [TypeConverter(typeof(FloatTypeConverter))] + public override float PositionX { - Matrix localWorld = Matrix.Identity; - - if (MovementMode != 1) + get => _position.X; + set { - float translationMultiplier = 0; - - switch (MovementLoopType) - { - case 0: - switch (currentMovementAction) - { - case CurrentMovementAction.StartWait: - translationMultiplier = amountOfMovementsPerformed; - if (localFrameCounter >= StartWaitRange) - currentMovementAction = CurrentMovementAction.Going; - break; - - case CurrentMovementAction.Going: - translationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (localFrameCounter - StartWaitRange) / (60 * MovementTranslation_Time)); - - if (localFrameCounter >= GoingRange) - { - amountOfMovementsPerformed++; - currentMovementAction = CurrentMovementAction.StartWait; - localFrameCounter = 0; - } - break; - } - break; - case 1: - case 2: - switch (currentMovementAction) - { - case CurrentMovementAction.StartWait: - if (localFrameCounter >= StartWaitRange) - currentMovementAction = CurrentMovementAction.Going; - break; - - case CurrentMovementAction.Going: - translationMultiplier = Math.Min(1, (localFrameCounter - StartWaitRange) / (60 * MovementTranslation_Time)); - if (localFrameCounter >= GoingRange) - currentMovementAction = CurrentMovementAction.EndWait; - break; - - case CurrentMovementAction.EndWait: - translationMultiplier = 1; - if (localFrameCounter >= EndWaitRange) - currentMovementAction = CurrentMovementAction.GoingBack; - break; - - case CurrentMovementAction.GoingBack: - translationMultiplier = 1 - Math.Min(1, (localFrameCounter - EndWaitRange) / (60 * MovementTranslation_Time)); - if (localFrameCounter >= GoingBackRange) - { - currentMovementAction = CurrentMovementAction.StartWait; - localFrameCounter = 0; - } - break; - } - break; - } - - switch (MovementTranslation_Direction) - { - case 0: - localWorld *= Matrix.Translation(translationMultiplier * MovementTranslation_Distance, 0, 0); - break; - case 1: - localWorld *= Matrix.Translation(0, translationMultiplier * MovementTranslation_Distance, 0); - break; - case 2: - localWorld *= Matrix.Translation(0, 0, translationMultiplier * MovementTranslation_Distance); - break; - } + _position.X = value; + Write(0x20 + Offset, _position.X); + CreateTransformMatrix(); + ChoosePlatSpecific(); } - - return localWorld; } - public override Matrix PlatLocalRotation() + [Category("Placement")] + [TypeConverter(typeof(FloatTypeConverter))] + public override float PositionY { - Matrix localWorld = Matrix.Identity; - - if (MovementMode >= 1) + get => _position.Y; + set { - float rotationMultiplier = 0; - - switch (MovementLoopType) - { - case 0: - switch (currentMovementAction) - { - case CurrentMovementAction.StartWait: - rotationMultiplier = amountOfMovementsPerformed; - if (localFrameCounter >= StartWaitRange) - currentMovementAction = CurrentMovementAction.Going; - break; - - case CurrentMovementAction.Going: - rotationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (localFrameCounter - StartWaitRange) / (60 * MovementRotation_Time)); - - if (localFrameCounter >= GoingRange) - { - amountOfMovementsPerformed++; - currentMovementAction = CurrentMovementAction.StartWait; - localFrameCounter = 0; - } - break; - } - break; - case 1: - case 2: - case 3: - switch (currentMovementAction) - { - case CurrentMovementAction.StartWait: - if (localFrameCounter >= StartWaitRange) - currentMovementAction = CurrentMovementAction.Going; - break; - - case CurrentMovementAction.Going: - rotationMultiplier = Math.Min(1, (localFrameCounter - StartWaitRange) / (60 * MovementRotation_Time)); - if (localFrameCounter >= GoingRange) - currentMovementAction = CurrentMovementAction.EndWait; - break; - - case CurrentMovementAction.EndWait: - rotationMultiplier = 1; - if (localFrameCounter >= EndWaitRange) - currentMovementAction = CurrentMovementAction.GoingBack; - break; - - case CurrentMovementAction.GoingBack: - rotationMultiplier = 1 - Math.Min(1, (localFrameCounter - EndWaitRange) / (60 * MovementRotation_Time)); - if (localFrameCounter >= GoingBackRange) - { - currentMovementAction = CurrentMovementAction.StartWait; - localFrameCounter = 0; - } - break; - } - break; - } - - switch (MovementRotation_Axis) - { - case 0: - localWorld = Matrix.RotationX(rotationMultiplier * MathUtil.DegreesToRadians(MovementRotation_Degrees)); - break; - case 1: - localWorld = Matrix.RotationY(rotationMultiplier * MathUtil.DegreesToRadians(MovementRotation_Degrees)); - break; - case 2: - localWorld = Matrix.RotationZ(rotationMultiplier * MathUtil.DegreesToRadians(MovementRotation_Degrees)); - break; - } + _position.Y = value; + Write(0x24 + Offset, _position.Y); + CreateTransformMatrix(); + ChoosePlatSpecific(); } - - return localWorld; } - public override Matrix LocalWorld() + [Category("Placement")] + [TypeConverter(typeof(FloatTypeConverter))] + public override float PositionZ { - if (movementPreview) + get => _position.Z; + set { - PlaceableAsset driver = FindDrivenByAsset(out bool found, out bool useRotation); - - if (found) - { - return PlatLocalRotation() * PlatLocalTranslation() - * Matrix.Scaling(_scale) - * Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll) - * Matrix.Translation(_position - driver._position) - * (useRotation ? driver.PlatLocalRotation() : Matrix.Identity) - * Matrix.Translation((Vector3)Vector3.Transform(Vector3.Zero, driver.LocalWorld())); - } - - return PlatLocalRotation() * PlatLocalTranslation() - * Matrix.Scaling(_scale) - * Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll) - * Matrix.Translation(_position); + _position.Z = value; + Write(0x28 + Offset, _position.Z); + CreateTransformMatrix(); + ChoosePlatSpecific(); } - - return world; } - public override void Draw(SharpRenderer renderer) + private byte _platformType { - if (movementPreview) - localFrameCounter++; - - if (DontRender || isInvisible) - return; - - if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID)) - ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, LocalWorld(), isSelected ? renderer.selectedObjectColor * _color : _color); - else - renderer.DrawCube(LocalWorld(), isSelected); + get => ReadByte(0x09); + set => Write(0x09, value); + } + private byte _platformSubtype + { + get => ReadByte(0x54 + Offset); + set => Write(0x54 + Offset, value); } [Category("Platform")] public PlatType PlatformType { - get => (PlatType)ReadByte(0x09 + Offset); - set => Write(0x09 + Offset, (byte)value); + get => (PlatType)_platformType; + set + { + _platformType = (byte)value; + ChoosePlatSpecific(); + } } [Category("Platform")] public PlatTypeSpecific PlatformSubtype { - get => (PlatTypeSpecific)ReadByte(0x54 + Offset); - set => Write(0x54 + Offset, (byte)value); + get => (PlatTypeSpecific)_platformSubtype; + set + { + _platformSubtype = (byte)value; + ChoosePlatSpecific(); + } } [Category("Platform")] - public byte UnknownByte_55 + public byte Padding55 { get => ReadByte(0x55 + Offset); set => Write(0x55 + Offset, value); @@ -293,301 +123,94 @@ public short CollisionType set => Write(0x56 + Offset, value); } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float Float58 - { - get => ReadFloat(0x58 + Offset); - set => Write(0x58 + Offset, value); - } - - [Browsable(false)] - public int Int58 - { - get => ReadInt(0x58 + Offset); - set => Write(0x58 + Offset, value); - } - - [Browsable(false)] - public float Float5C - { - get => ReadFloat(0x5C + Offset); - set => Write(0x5C + Offset, value); - } - - [Browsable(false)] - public int Int5C - { - get => ReadInt(0x5C + Offset); - set => Write(0x5C + Offset, value); - } - - [Browsable(false)] - public float Float60 - { - get => ReadFloat(0x60 + Offset); - set => Write(0x60 + Offset, value); - } - - [Browsable(false)] - public int Int60 - { - get => ReadInt(0x60 + Offset); - set => Write(0x60 + Offset, value); - } - - [Browsable(false)] - public float Float64 - { - get => ReadFloat(0x64 + Offset); - set => Write(0x64 + Offset, value); - } - - [Browsable(false)] - public int Int64 - { - get => ReadInt(0x64 + Offset); - set => Write(0x64 + Offset, value); - } - - [Category("Platform")] - public AssetID ANIM_AssetID_1 - { - get => ReadUInt(0x68 + Offset); - set => Write(0x68 + Offset, value); - } - - [Category("Platform")] - public AssetID ANIM_AssetID_2 - { - get => ReadUInt(0x6C + Offset); - set => Write(0x6C + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat_70 - { - get => ReadFloat(0x70 + Offset); - set => Write(0x70 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float LaunchDirectionX - { - get => ReadFloat(0x74 + Offset); - set => Write(0x74 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float LaunchDirectionY - { - get => ReadFloat(0x78 + Offset); - set => Write(0x78 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float LaunchDirectionZ - { - get => ReadFloat(0x7C + Offset); - set => Write(0x7C + Offset, value); - } - - [Category("Platform")] - public int MovementLockMode - { - get => ReadInt(0x80 + Offset); - set => Write(0x80 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat_84 - { - get => ReadFloat(0x84 + Offset); - set => Write(0x84 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat_88 - { - get => ReadFloat(0x88 + Offset); - set => Write(0x88 + Offset, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float UnknownFloat_8C - { - get => ReadFloat(0x8C + Offset); - set => Write(0x8C + Offset, value); - } - - [Category("Platform")] - public byte UnknownByte_90 - { - get => ReadByte(0x90 + Offset); - set => Write(0x90 + Offset, value); - } - - [Category("Platform")] - public byte UnknownByte_91 - { - get => ReadByte(0x91 + Offset); - set => Write(0x91 + Offset, value); - } - - [Category("Platform")] - public byte UnknownByte_92 - { - get => ReadByte(0x92 + Offset); - set => Write(0x92 + Offset, value); - } - - [Category("Platform")] - public byte UnknownByte_93 - { - get => ReadByte(0x93 + Offset); - set => Write(0x93 + Offset, value); - } - - [Category("Platform")] - public byte MovementMode - { - get => ReadByte(0x94 + Offset); - set => Write(0x94 + Offset, value); - } - - [Category("Platform")] - public byte MovementLoopType - { - get => ReadByte(0x95 + Offset); - set { Write(0x95 + Offset, value); Reset(); } - } - - [Category("Platform")] - public byte MovementTranslation_Direction - { - get => ReadByte(0x96 + Offset); - set { Write(0x96 + Offset, value); Reset(); } - } - - [Category("Platform")] - public byte MovementRotation_Axis - { - get => ReadByte(0x97 + Offset); - set { Write(0x97 + Offset, value); Reset(); } - } - - private int OffsetForTSSM => Functions.currentGame == Game.Incredibles ? 4 : 0; - - [Category("Platform")] - public AssetID MVPT_AssetID - { - get { return ReadUInt(0x98 + Offset); } - set { Write(0x98 + Offset, value); Reset(); } - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementTranslation_Distance - { - get => ReadFloat(0x98 + Offset + OffsetForTSSM); - set { Write(0x98 + Offset + OffsetForTSSM, value); Reset(); } - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementTranslation_Time - { - get => ReadFloat(0x9C + Offset + OffsetForTSSM); - set { Write(0x9C + Offset + OffsetForTSSM, value); Reset(); } - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementTranslation_EaseStart - { - get => ReadFloat(0xA0 + Offset + OffsetForTSSM); - set => Write(0xA0 + Offset + OffsetForTSSM, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementTranslation_EaseEnd - { - get => ReadFloat(0xA4 + Offset + OffsetForTSSM); - set => Write(0xA4 + Offset + OffsetForTSSM, value); - } - - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementRotation_Degrees + private void ChoosePlatSpecific() { - get => ReadFloat(0xA8 + Offset + OffsetForTSSM); - set { Write(0xA8 + Offset + OffsetForTSSM, value); Reset(); } - } + switch (PlatformType) + { + case PlatType.ConveyorBelt: + _platSpecific = new PlatSpecific_ConveryorBelt(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.FallingPlatform: + _platSpecific = new PlatSpecific_FallingPlatform(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.FR: + _platSpecific = new PlatSpecific_FR(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.BreakawayPlatform: + _platSpecific = new PlatSpecific_BreakawayPlatform(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.Springboard: + _platSpecific = new PlatSpecific_Springboard(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.TeeterTotter: + _platSpecific = new PlatSpecific_TeeterTotter(Data.Skip(0x58 + Offset).ToArray()); + break; + case PlatType.Paddle: + _platSpecific = new PlatSpecific_Paddle(Data.Skip(0x58 + Offset).ToArray()); + break; + default: + _platSpecific = new PlatSpecific_Generic(Data.Skip(0x58 + Offset).ToArray()); + break; + } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementRotation_Time - { - get => ReadFloat(0xAC + Offset + OffsetForTSSM); - set { Write(0xAC + Offset + OffsetForTSSM, value); Reset(); } - } + switch (PlatformSubtype) + { + case PlatTypeSpecific.ExtendRetract: + _motion = new Motion_ExtendRetract(Data.Skip(MotionStart).ToArray()); + break; + case PlatTypeSpecific.Orbit: + _motion = new Motion_Orbit(Data.Skip(MotionStart).ToArray()); + break; + case PlatTypeSpecific.Spline: + _motion = new Motion_Spline(Data.Skip(MotionStart).ToArray()); + break; + case PlatTypeSpecific.Pendulum: + _motion = new Motion_Pendulum(Data.Skip(MotionStart).ToArray()); + break; + case PlatTypeSpecific.MovePoint: + _motion = new Motion_MovePoint(Data.Skip(MotionStart).ToArray(), _position); + break; + default: + _motion = new Motion_Mechanism(Data.Skip(MotionStart).ToArray()); + break; + } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementRotation_EaseStart - { - get => ReadFloat(0xB0 + Offset + OffsetForTSSM); - set => Write(0xB0 + Offset + OffsetForTSSM, value); + PlatSpecificChosen?.Invoke(); } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float MovementRotation_EaseEnd + public Action PlatSpecificChosen; + + public override Matrix LocalWorld() { - get => ReadFloat(0xB4 + Offset + OffsetForTSSM); - set => Write(0xB4 + Offset + OffsetForTSSM, value); - } + if (movementPreview) + { + if (PlatformSubtype == PlatTypeSpecific.MovePoint) + return Matrix.Scaling(_scale) + * Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll) + * PlatLocalTranslation(); + return base.LocalWorld(); + } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float Movement_StartPointWait - { - get => ReadFloat(0xB8 + Offset + OffsetForTSSM); - set { Write(0xB8 + Offset + OffsetForTSSM, value); Reset(); } + return world; } - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float Movement_EndPointWait - { - get => ReadFloat(0xBC + Offset + OffsetForTSSM); - set { Write(0xBC + Offset + OffsetForTSSM, value); Reset(); } - } + private PlatSpecific_Generic _platSpecific; - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float TSSM_Unknown_C0 + [Category("Platform"), ReadOnly(true)] + public PlatSpecific_Generic PlatSpecific { - get - { - if (Functions.currentGame == Game.Incredibles) - return ReadFloat(0xC0 + Offset + OffsetForTSSM); - return 0; - } + get => _platSpecific; set { - if (Functions.currentGame == Game.Incredibles) - { - Write(0xC0 + Offset + OffsetForTSSM, value); - } - } - } + _platSpecific = value; - [Category("Platform"), TypeConverter(typeof(FloatTypeConverter))] - public float TSSM_Unknown_C4 - { - get - { - if (Functions.currentGame == Game.Incredibles) - return ReadFloat(0xC4 + Offset + OffsetForTSSM); - return 0; - } - set - { - if (Functions.currentGame == Game.Incredibles) - { - Write(0xC4 + Offset + OffsetForTSSM, value); - } + List before = Data.Take(0x58 + Offset).ToList(); + before.AddRange(value.ToByteArray()); + before.AddRange(Data.Skip(0x58 + Offset + PlatSpecific_Generic.Size)); + Data = before.ToArray(); } } + + protected override int MotionStart => 0x90 + Offset; } } \ No newline at end of file diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLYR.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLYR.cs index 5ce87139..5eefc99b 100644 --- a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLYR.cs +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlaceableAssets/AssetPLYR.cs @@ -59,9 +59,9 @@ public override void Draw(SharpRenderer renderer) Color.W = Color.W == 0f ? 1f : Color.W; if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID)) - ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, world, isSelected ? renderer.selectedObjectColor * Color : Color); + ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, LocalWorld(), isSelected ? renderer.selectedObjectColor * Color : Color); else - renderer.DrawPyramid(world, isSelected, 1f); + renderer.DrawPyramid(LocalWorld(), isSelected, 1f); } [Category("Player References")] diff --git a/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlatSpecific.cs b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlatSpecific.cs new file mode 100644 index 00000000..69afc3df --- /dev/null +++ b/IndustrialPark/Assets/ObjectAssets/ClickableAssets/PlatSpecific.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using static IndustrialPark.ConverterFunctions; + +namespace IndustrialPark +{ + public class CamSpecific_Generic + { + public static int Size => 0x18; + + public CamSpecific_Generic() { } + + public CamSpecific_Generic(byte[] data) { } + + public virtual byte[] ToByteArray() + { + return new byte[0x18]; + } + } + + public class CamSpecific_Follow : CamSpecific_Generic + { + public CamSpecific_Follow(byte[] data) + { + Rotation = Switch(BitConverter.ToSingle(data, 0)); + Distance = Switch(BitConverter.ToSingle(data, 4)); + Height = Switch(BitConverter.ToSingle(data, 8)); + RubberBand = Switch(BitConverter.ToSingle(data, 12)); + StartSpeed = Switch(BitConverter.ToSingle(data, 16)); + EndSpeed = Switch(BitConverter.ToSingle(data, 20)); + } + + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float Rotation { get; set; } + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float Distance { get; set; } + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float Height { get; set; } + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float RubberBand { get; set; } + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float StartSpeed { get; set; } + [Category("Follow"), TypeConverter(typeof(FloatTypeConverter))] + public float EndSpeed { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Rotation))); + data.AddRange(BitConverter.GetBytes(Switch(Distance))); + data.AddRange(BitConverter.GetBytes(Switch(Height))); + data.AddRange(BitConverter.GetBytes(Switch(RubberBand))); + data.AddRange(BitConverter.GetBytes(Switch(StartSpeed))); + data.AddRange(BitConverter.GetBytes(Switch(EndSpeed))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class CamSpecific_Shoulder : CamSpecific_Generic + { + public CamSpecific_Shoulder(byte[] data) + { + Distance = Switch(BitConverter.ToSingle(data, 0)); + Height = Switch(BitConverter.ToSingle(data, 4)); + RealignSpeed = Switch(BitConverter.ToSingle(data, 8)); + RealignDelay = Switch(BitConverter.ToSingle(data, 12)); + } + + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float Distance { get; set; } + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float Height { get; set; } + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float RealignSpeed { get; set; } + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float RealignDelay { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Distance))); + data.AddRange(BitConverter.GetBytes(Switch(Height))); + data.AddRange(BitConverter.GetBytes(Switch(RealignSpeed))); + data.AddRange(BitConverter.GetBytes(Switch(RealignDelay))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class CamSpecific_Static : CamSpecific_Generic + { + public CamSpecific_Static(byte[] data) + { + Unused = Switch(BitConverter.ToInt32(data, 0)); + } + + [Category("Static")] + public int Unused { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Unused))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class CamSpecific_Path : CamSpecific_Generic + { + public CamSpecific_Path(byte[] data) + { + Unknown_AssetID = Switch(BitConverter.ToUInt32(data, 0)); + TimeEnd = Switch(BitConverter.ToSingle(data, 4)); + TimeDelay = Switch(BitConverter.ToSingle(data, 8)); + } + + [Category("Shoulder")] + public AssetID Unknown_AssetID { get; set; } + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float TimeEnd { get; set; } + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float TimeDelay { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Unknown_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(TimeEnd))); + data.AddRange(BitConverter.GetBytes(Switch(TimeDelay))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class CamSpecific_StaticFollow : CamSpecific_Generic + { + public CamSpecific_StaticFollow(byte[] data) + { + RubberBand = Switch(BitConverter.ToSingle(data, 0)); + } + + [Category("Shoulder"), TypeConverter(typeof(FloatTypeConverter))] + public float RubberBand { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(RubberBand))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } +} diff --git a/IndustrialPark/Assets/Shared/Asset.cs b/IndustrialPark/Assets/Shared/Asset.cs index 0446d15e..93d405ff 100644 --- a/IndustrialPark/Assets/Shared/Asset.cs +++ b/IndustrialPark/Assets/Shared/Asset.cs @@ -61,7 +61,7 @@ protected short ReadShort(int j) return BitConverter.ToInt16(AHDR.data, j); } - protected ushort ReadUshort(int j) + protected ushort ReadUShort(int j) { if (currentPlatform == Platform.GameCube) return BitConverter.ToUInt16(new byte[] { diff --git a/IndustrialPark/Assets/Shared/AssetWithMotion.cs b/IndustrialPark/Assets/Shared/AssetWithMotion.cs new file mode 100644 index 00000000..6f538d42 --- /dev/null +++ b/IndustrialPark/Assets/Shared/AssetWithMotion.cs @@ -0,0 +1,106 @@ +using HipHopFile; +using SharpDX; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace IndustrialPark +{ + public abstract class AssetWithMotion : PlaceableAsset + { + public AssetWithMotion(Section_AHDR AHDR) : base(AHDR) + { + _motion = new Motion_Mechanism(Data.Skip(MotionStart).ToArray()); + } + + public override bool HasReference(uint assetID) + { + if (_motion.HasReference(assetID)) + return true; + + return base.HasReference(assetID); + } + + public override void Verify(ref List result) + { + _motion.Verify(ref result); + base.Verify(ref result); + } + + public override void Draw(SharpRenderer renderer) + { + if (movementPreview) + _motion.Increment(); + + Matrix localW = LocalWorld(); + + if (DontRender || isInvisible) + return; + + if (ArchiveEditorFunctions.renderingDictionary.ContainsKey(_modelAssetID)) + ArchiveEditorFunctions.renderingDictionary[_modelAssetID].Draw(renderer, localW, isSelected ? renderer.selectedObjectColor * _color : _color); + else + renderer.DrawCube(localW, isSelected); + } + + public void Reset() + { + _motion.Reset(); + } + + public Matrix PlatLocalTranslation() + { + return _motion.PlatLocalTranslation(); + } + + public override Matrix PlatLocalRotation() + { + return _motion.PlatLocalRotation(); + } + + public override Matrix LocalWorld() + { + if (movementPreview) + { + PlaceableAsset driver = FindDrivenByAsset(out bool found, out bool useRotation); + + if (found) + { + return PlatLocalRotation() * PlatLocalTranslation() + * Matrix.Scaling(_scale) + * Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll) + * Matrix.Translation(_position - driver._position) + * (useRotation ? driver.PlatLocalRotation() : Matrix.Identity) + * Matrix.Translation((Vector3)Vector3.Transform(Vector3.Zero, driver.LocalWorld())); + } + + return PlatLocalRotation() * PlatLocalTranslation() + * Matrix.Scaling(_scale) + * Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll) + * Matrix.Translation(_position); + } + + return world; + } + + protected Motion _motion; + + protected abstract int MotionStart { get; } + + [Browsable(false)] + public Motion Motion + { + get => _motion; + set + { + _motion = value; + + List before = Data.Take(MotionStart).ToList(); + before.AddRange(value.ToByteArray()); + before.AddRange(Data.Skip(MotionStart + Motion.Size)); + Data = before.ToArray(); + } + } + } +} \ No newline at end of file diff --git a/IndustrialPark/Assets/Shared/Enums/PlatType.cs b/IndustrialPark/Assets/Shared/Enums/PlatType.cs index 0f9d6048..3834efb7 100644 --- a/IndustrialPark/Assets/Shared/Enums/PlatType.cs +++ b/IndustrialPark/Assets/Shared/Enums/PlatType.cs @@ -3,14 +3,14 @@ public enum PlatType : byte { Platform = 0, - Orbit = 1, + Type1 = 1, Type2 = 2, - MovePoint = 3, + Type3 = 3, Mechanism = 4, - Type5 = 5, + Pendulum = 5, ConveyorBelt = 6, - Type7 = 7, - Type8 = 8, + FallingPlatform = 7, + FR = 8, BreakawayPlatform = 9, Springboard = 10, TeeterTotter = 11, diff --git a/IndustrialPark/Assets/Shared/Enums/PlatTypeSpecific.cs b/IndustrialPark/Assets/Shared/Enums/PlatTypeSpecific.cs index 6f268576..f509ecb0 100644 --- a/IndustrialPark/Assets/Shared/Enums/PlatTypeSpecific.cs +++ b/IndustrialPark/Assets/Shared/Enums/PlatTypeSpecific.cs @@ -4,10 +4,10 @@ public enum PlatTypeSpecific : byte { ExtendRetract = 0, Orbit = 1, - Type2 = 2, + Spline = 2, MovePoint = 3, Mechanism = 4, - Type5 = 5, + Pendulum = 5, ConveyorBelt = 6, Type7 = 7, Type8 = 8, diff --git a/IndustrialPark/Assets/Shared/Motion.cs b/IndustrialPark/Assets/Shared/Motion.cs new file mode 100644 index 00000000..ebcc0cca --- /dev/null +++ b/IndustrialPark/Assets/Shared/Motion.cs @@ -0,0 +1,703 @@ +using SharpDX; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using static IndustrialPark.ConverterFunctions; + +namespace IndustrialPark +{ + public enum MotionType : byte + { + ExtendRetract = 0, + Orbit = 1, + Spline = 2, + MovePoint = 3, + Mechanism = 4, + Pendulum = 5, + Other = 6, + } + + public class Motion + { + public static int Size => HipHopFile.Functions.currentGame == HipHopFile.Game.Incredibles ? 0x3C : 0x30; + + [Category("Motion"), ReadOnly(true)] + public MotionType Type { get; set; } + [Category("Motion")] + public byte UseBanking { get; set; } + [Category("Motion")] + public short Flags { get; set; } + + public Motion() { } + + public Motion(byte[] data) + { + Type = (MotionType)(data[0]); + UseBanking = data[1]; + Flags = Switch(BitConverter.ToInt16(data, 2)); + } + + public virtual byte[] ToByteArray() + { + List data = new List + { + (byte)Type, + UseBanking + }; + data.AddRange(BitConverter.GetBytes(Switch(Flags))); + + return data.ToArray(); + } + + public virtual bool HasReference(uint assetID) + { + return false; + } + + public virtual void Verify(ref List result) + { + + } + + protected int LocalFrameCounter = -1; + + public virtual void Reset() + { + LocalFrameCounter = -1; + } + + public void Increment() + { + LocalFrameCounter++; + } + + public virtual Matrix PlatLocalTranslation() + { + return Matrix.Identity; + } + + public virtual Matrix PlatLocalRotation() + { + return Matrix.Identity; + } + } + + public class Motion_ExtendRetract : Motion + { + public Motion_ExtendRetract() + { + Type = MotionType.ExtendRetract; + } + + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractPositionX { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractPositionY { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractPositionZ { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float ExtendDeltaPositionX { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float ExtendDeltaPositionY { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float ExtendDeltaPositionZ { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float ExtendTime { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float ExtendWaitTime { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractTime { get; set; } + [Category("Motion: ExtendRetract"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractWaitTime { get; set; } + + public Motion_ExtendRetract(byte[] data) : base(data) + { + RetractPositionX = Switch(BitConverter.ToSingle(data, 4)); + RetractPositionY = Switch(BitConverter.ToSingle(data, 8)); + RetractPositionZ = Switch(BitConverter.ToSingle(data, 12)); + ExtendDeltaPositionX = Switch(BitConverter.ToSingle(data, 16)); + ExtendDeltaPositionY = Switch(BitConverter.ToSingle(data, 20)); + ExtendDeltaPositionZ = Switch(BitConverter.ToSingle(data, 24)); + ExtendTime = Switch(BitConverter.ToSingle(data, 28)); + ExtendWaitTime = Switch(BitConverter.ToSingle(data, 32)); + RetractTime = Switch(BitConverter.ToSingle(data, 36)); + RetractWaitTime = Switch(BitConverter.ToSingle(data, 40)); + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.AddRange(BitConverter.GetBytes(Switch(RetractPositionX))); + data.AddRange(BitConverter.GetBytes(Switch(RetractPositionY))); + data.AddRange(BitConverter.GetBytes(Switch(RetractPositionZ))); + data.AddRange(BitConverter.GetBytes(Switch(ExtendDeltaPositionX))); + data.AddRange(BitConverter.GetBytes(Switch(ExtendDeltaPositionY))); + data.AddRange(BitConverter.GetBytes(Switch(ExtendDeltaPositionZ))); + data.AddRange(BitConverter.GetBytes(Switch(ExtendTime))); + data.AddRange(BitConverter.GetBytes(Switch(ExtendWaitTime))); + data.AddRange(BitConverter.GetBytes(Switch(RetractTime))); + data.AddRange(BitConverter.GetBytes(Switch(RetractWaitTime))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class Motion_Orbit : Motion + { + public Motion_Orbit() + { + Type = MotionType.Orbit; + } + + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float CenterX { get; set; } + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float CenterY { get; set; } + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float CenterZ { get; set; } + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float Width { get; set; } + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float Height { get; set; } + [Category("Motion: Orbit"), TypeConverter(typeof(FloatTypeConverter))] + public float Period { get; set; } + + public Motion_Orbit(byte[] data) : base(data) + { + CenterX = Switch(BitConverter.ToSingle(data, 4)); + CenterY = Switch(BitConverter.ToSingle(data, 8)); + CenterZ = Switch(BitConverter.ToSingle(data, 12)); + Width = Switch(BitConverter.ToSingle(data, 16)); + Height = Switch(BitConverter.ToSingle(data, 20)); + Period = Switch(BitConverter.ToSingle(data, 24)); + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.AddRange(BitConverter.GetBytes(Switch(CenterX))); + data.AddRange(BitConverter.GetBytes(Switch(CenterY))); + data.AddRange(BitConverter.GetBytes(Switch(CenterZ))); + data.AddRange(BitConverter.GetBytes(Switch(Width))); + data.AddRange(BitConverter.GetBytes(Switch(Height))); + data.AddRange(BitConverter.GetBytes(Switch(Period))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class Motion_Spline : Motion + { + public Motion_Spline() + { + Type = MotionType.Spline; + } + + [Category("Motion: Spline")] + public int Unknown { get; set; } + + public Motion_Spline(byte[] data) : base(data) + { + Unknown = Switch(BitConverter.ToInt32(data, 4)); + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.AddRange(BitConverter.GetBytes(Switch(Unknown))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class Motion_MovePoint : Motion + { + public Motion_MovePoint() + { + Type = MotionType.MovePoint; + } + + [Category("Motion: MovePoint")] + public uint MovePoint_Flags { get; set; } + [Category("Motion: MovePoint")] + public AssetID MVPT_AssetID { get; set; } + [Category("Motion: MovePoint"), TypeConverter(typeof(FloatTypeConverter))] + public float Speed { get; set; } + + public Motion_MovePoint(byte[] data, Vector3 initialPosition) : base(data) + { + MovePoint_Flags = Switch(BitConverter.ToUInt32(data, 4)); + MVPT_AssetID = Switch(BitConverter.ToUInt32(data, 8)); + Speed = Switch(BitConverter.ToSingle(data, 12)); + + this.initialPosition = initialPosition; + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.AddRange(BitConverter.GetBytes(Switch(MovePoint_Flags))); + data.AddRange(BitConverter.GetBytes(Switch(MVPT_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(Speed))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + + public override bool HasReference(uint assetID) + { + return MVPT_AssetID == assetID; + } + + public override void Verify(ref List result) + { + if (MVPT_AssetID == 0) + result.Add("MovePoint PLAT with MVPT_AssetID set to 0"); + Asset.Verify(MVPT_AssetID, ref result); + } + + private AssetMVPT currentMVPT; + private Vector3 initialPosition; + private Vector3 oldPosition; + private Vector3 targetPosition; + + public override void Reset() + { + currentMVPT = FindMVPT(MVPT_AssetID); + if (currentMVPT != null) + { + targetPosition = new Vector3(currentMVPT.PositionX, currentMVPT.PositionY, currentMVPT.PositionZ); + oldPosition = targetPosition; + } + else + oldPosition = initialPosition; + + base.Reset(); + } + + private AssetMVPT FindMVPT(uint assetID) + { + foreach (ArchiveEditor ae in Program.MainForm.archiveEditors) + if (ae.archive.ContainsAsset(assetID)) + { + Asset asset = ae.archive.GetFromAssetID(assetID); + if (asset is AssetMVPT MVPT) + return MVPT; + } + return null; + } + + public override Matrix PlatLocalTranslation() + { + if (currentMVPT != null) + { + Vector3 newPosition = Vector3.Lerp(oldPosition, targetPosition, Math.Min(1f, LocalFrameCounter / (Vector3.Distance(oldPosition, targetPosition) / (Math.Abs(Speed) / 60f)))); + + if (newPosition == targetPosition) + { + LocalFrameCounter = 0; + oldPosition = targetPosition; + + if (currentMVPT.NextMVPTs.Length > 0) + { + currentMVPT = FindMVPT(currentMVPT.NextMVPTs[0]); + targetPosition = new Vector3(currentMVPT.PositionX, currentMVPT.PositionY, currentMVPT.PositionZ); + } + else + Reset(); + } + + return Matrix.Translation(newPosition); + } + + return Matrix.Translation(oldPosition); + } + } + + public class Motion_Mechanism : Motion + { + public Motion_Mechanism() + { + Type = MotionType.Mechanism; + } + + [Category("Motion: Mechanism")] + public byte MovementMode { get; set; } + [Category("Motion: Mechanism")] + public byte MovementLoopMode { get; set; } + [Category("Motion: Mechanism")] + public byte SlideAxis { get; set; } + [Category("Motion: Mechanism")] + public byte RotateAxis { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float SlideDistance { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float SlideTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float SlideAccelTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float SlideDecelTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float RotateDistance { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float RotateTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float RotateAccelTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float RotateDecelTime { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float RetractDelay { get; set; } + [Category("Motion: Mechanism"), TypeConverter(typeof(FloatTypeConverter))] + public float PostRetractDelay { get; set; } + + [Category("TSSM Only")] + public byte Unknown1 { get; set; } + [Category("TSSM Only")] + public byte Unknown2 { get; set; } + [Category("TSSM Only")] + public byte Unknown3 { get; set; } + [Category("TSSM Only")] + public byte Unknown4 { get; set; } + [Category("TSSM Only")] + public float UnknownFloat1 { get; set; } + [Category("TSSM Only")] + public float UnknownFloat2 { get; set; } + + public Motion_Mechanism(byte[] data) : base(data) + { + MovementMode = data[4]; + MovementLoopMode = data[5]; + SlideAxis = data[6]; + RotateAxis = data[7]; + + int offset = 0; + if (HipHopFile.Functions.currentGame == HipHopFile.Game.Incredibles) + { + Unknown1 = data[8]; + Unknown2 = data[9]; + Unknown3 = data[10]; + Unknown4 = data[11]; + + offset = 4; + } + + SlideDistance = Switch(BitConverter.ToSingle(data, 8 + offset)); + SlideTime = Switch(BitConverter.ToSingle(data, 12 + offset)); + SlideAccelTime = Switch(BitConverter.ToSingle(data, 16 + offset)); + SlideDecelTime = Switch(BitConverter.ToSingle(data, 20 + offset)); + RotateDistance = Switch(BitConverter.ToSingle(data, 24 + offset)); + RotateTime = Switch(BitConverter.ToSingle(data, 28 + offset)); + RotateAccelTime = Switch(BitConverter.ToSingle(data, 32 + offset)); + RotateDecelTime = Switch(BitConverter.ToSingle(data, 36 + offset)); + RetractDelay = Switch(BitConverter.ToSingle(data, 40 + offset)); + PostRetractDelay = Switch(BitConverter.ToSingle(data, 44 + offset)); + + if (HipHopFile.Functions.currentGame == HipHopFile.Game.Incredibles) + { + UnknownFloat1 = Switch(BitConverter.ToSingle(data, 52)); + UnknownFloat2 = Switch(BitConverter.ToSingle(data, 56)); + } + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.Add(MovementMode); + data.Add(MovementLoopMode); + data.Add(SlideAxis); + data.Add(RotateAxis); + + if (HipHopFile.Functions.currentGame == HipHopFile.Game.Incredibles) + { + data.Add(Unknown1); + data.Add(Unknown2); + data.Add(Unknown3); + data.Add(Unknown4); + } + + data.AddRange(BitConverter.GetBytes(Switch(SlideDistance))); + data.AddRange(BitConverter.GetBytes(Switch(SlideTime))); + data.AddRange(BitConverter.GetBytes(Switch(SlideAccelTime))); + data.AddRange(BitConverter.GetBytes(Switch(SlideDecelTime))); + data.AddRange(BitConverter.GetBytes(Switch(RotateDistance))); + data.AddRange(BitConverter.GetBytes(Switch(RotateTime))); + data.AddRange(BitConverter.GetBytes(Switch(RotateAccelTime))); + data.AddRange(BitConverter.GetBytes(Switch(RotateDecelTime))); + data.AddRange(BitConverter.GetBytes(Switch(RetractDelay))); + data.AddRange(BitConverter.GetBytes(Switch(PostRetractDelay))); + + if (HipHopFile.Functions.currentGame == HipHopFile.Game.Incredibles) + { + data.AddRange(BitConverter.GetBytes(Switch(UnknownFloat1))); + data.AddRange(BitConverter.GetBytes(Switch(UnknownFloat2))); + } + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + + public enum CurrentMovementAction + { + StartWait, + Going, + EndWait, + GoingBack + } + + private CurrentMovementAction currentMovementAction; + private int amountOfMovementsPerformed = 0; + + public override void Reset() + { + currentMovementAction = CurrentMovementAction.StartWait; + amountOfMovementsPerformed = 0; + + base.Reset(); + } + + private float StartWaitRange => 60 * PostRetractDelay; + private float GoingRange => StartWaitRange + 60 * Math.Max(MovementMode != 0 ? RotateTime :0, MovementMode != 1 ? SlideTime : 0); + private float EndWaitRange => GoingRange + 60 * RetractDelay; + private float GoingBackRange => EndWaitRange + 60 * Math.Max(MovementMode != 0 ? RotateTime : 0, MovementMode != 1 ? SlideTime : 0); + + public override Matrix PlatLocalTranslation() + { + Matrix localWorld = Matrix.Identity; + + if (MovementMode != 1) + { + float translationMultiplier = 0; + + if ((MovementLoopMode & 1) == 0) + switch (currentMovementAction) + { + case CurrentMovementAction.StartWait: + translationMultiplier = amountOfMovementsPerformed; + if (LocalFrameCounter >= StartWaitRange) + currentMovementAction = CurrentMovementAction.Going; + break; + + case CurrentMovementAction.Going: + translationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (LocalFrameCounter - StartWaitRange) / (60 * SlideTime)); + + if (LocalFrameCounter >= GoingRange) + { + if ((MovementLoopMode & 2) == 0) + amountOfMovementsPerformed++; + else + amountOfMovementsPerformed = 0; + currentMovementAction = CurrentMovementAction.StartWait; + LocalFrameCounter = 0; + } + break; + default: + Reset(); + break; + } + else + switch (currentMovementAction) + { + case CurrentMovementAction.StartWait: + if (LocalFrameCounter >= StartWaitRange) + currentMovementAction = CurrentMovementAction.Going; + break; + + case CurrentMovementAction.Going: + translationMultiplier = Math.Min(1, (LocalFrameCounter - StartWaitRange) / (60 * SlideTime)); + if (LocalFrameCounter >= GoingRange) + currentMovementAction = CurrentMovementAction.EndWait; + break; + + case CurrentMovementAction.EndWait: + translationMultiplier = 1; + if (LocalFrameCounter >= EndWaitRange) + currentMovementAction = CurrentMovementAction.GoingBack; + break; + + case CurrentMovementAction.GoingBack: + translationMultiplier = 1 - Math.Min(1, (LocalFrameCounter - EndWaitRange) / (60 * SlideTime)); + if (LocalFrameCounter >= GoingBackRange) + { + currentMovementAction = CurrentMovementAction.StartWait; + LocalFrameCounter = 0; + } + break; + + default: + Reset(); + break; + } + + switch (SlideAxis) + { + case 0: + localWorld *= Matrix.Translation(translationMultiplier * SlideDistance, 0, 0); + break; + case 1: + localWorld *= Matrix.Translation(0, translationMultiplier * SlideDistance, 0); + break; + case 2: + localWorld *= Matrix.Translation(0, 0, translationMultiplier * SlideDistance); + break; + } + } + + return localWorld; + } + + public override Matrix PlatLocalRotation() + { + Matrix localWorld = Matrix.Identity; + + if (MovementMode > 0) + { + float rotationMultiplier = 0; + + if ((MovementLoopMode & 1) == 0) + switch (currentMovementAction) + { + case CurrentMovementAction.StartWait: + rotationMultiplier = amountOfMovementsPerformed; + if (LocalFrameCounter >= StartWaitRange) + currentMovementAction = CurrentMovementAction.Going; + break; + + case CurrentMovementAction.Going: + rotationMultiplier = amountOfMovementsPerformed + Math.Min(1f, (LocalFrameCounter - StartWaitRange) / (60 * RotateTime)); + + if (LocalFrameCounter >= GoingRange) + { + if ((MovementLoopMode & 2) == 0) + amountOfMovementsPerformed++; + else + amountOfMovementsPerformed = 0; + currentMovementAction = CurrentMovementAction.StartWait; + LocalFrameCounter = 0; + } + break; + default: + Reset(); + break; + } + else + switch (currentMovementAction) + { + case CurrentMovementAction.StartWait: + if (LocalFrameCounter >= StartWaitRange) + currentMovementAction = CurrentMovementAction.Going; + break; + + case CurrentMovementAction.Going: + rotationMultiplier = Math.Min(1, (LocalFrameCounter - StartWaitRange) / (60 * RotateTime)); + if (LocalFrameCounter >= GoingRange) + currentMovementAction = CurrentMovementAction.EndWait; + break; + + case CurrentMovementAction.EndWait: + rotationMultiplier = 1; + if (LocalFrameCounter >= EndWaitRange) + currentMovementAction = CurrentMovementAction.GoingBack; + break; + + case CurrentMovementAction.GoingBack: + rotationMultiplier = 1 - Math.Min(1, (LocalFrameCounter - EndWaitRange) / (60 * RotateTime)); + if (LocalFrameCounter >= GoingBackRange) + { + currentMovementAction = CurrentMovementAction.StartWait; + LocalFrameCounter = 0; + } + break; + + default: + Reset(); + break; + } + + switch (RotateAxis) + { + case 0: + localWorld = Matrix.RotationX(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); + break; + case 1: + localWorld = Matrix.RotationY(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); + break; + case 2: + localWorld = Matrix.RotationZ(rotationMultiplier * MathUtil.DegreesToRadians(RotateDistance)); + break; + } + } + + return localWorld; + } + } + + public class Motion_Pendulum : Motion + { + public Motion_Pendulum() + { + Type = MotionType.Pendulum; + } + + [Category("Motion: Pendulum")] + public byte PendulumFlags { get; set; } + [Category("Motion: Pendulum")] + public byte Plane { get; set; } + [Category("Motion: Pendulum")] + public float Length { get; set; } + [Category("Motion: Pendulum")] + public float Range { get; set; } + [Category("Motion: Pendulum")] + public float Period { get; set; } + [Category("Motion: Pendulum")] + public float Phase { get; set; } + + public Motion_Pendulum(byte[] data) : base(data) + { + PendulumFlags = data[4]; + Plane = data[5]; + Length = Switch(BitConverter.ToSingle(data, 8)); + Range = Switch(BitConverter.ToSingle(data, 12)); + Period = Switch(BitConverter.ToSingle(data, 16)); + Phase = Switch(BitConverter.ToSingle(data, 20)); + } + + public override byte[] ToByteArray() + { + List data = base.ToByteArray().ToList(); + + data.Add(PendulumFlags); + data.Add(Plane); + data.Add(0); + data.Add(0); + + data.AddRange(BitConverter.GetBytes(Switch(Length))); + data.AddRange(BitConverter.GetBytes(Switch(Range))); + data.AddRange(BitConverter.GetBytes(Switch(Period))); + data.AddRange(BitConverter.GetBytes(Switch(Phase))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } +} diff --git a/IndustrialPark/Assets/Shared/PlaceableAsset.cs b/IndustrialPark/Assets/Shared/PlaceableAsset.cs index c25496bd..5f907488 100644 --- a/IndustrialPark/Assets/Shared/PlaceableAsset.cs +++ b/IndustrialPark/Assets/Shared/PlaceableAsset.cs @@ -456,22 +456,28 @@ public virtual AssetID Animation_AssetID protected PlaceableAsset FindDrivenByAsset(out bool found, out bool useRotation) { foreach (LinkBFBB assetEvent in LinksBFBB) - if (assetEvent.EventSendID == EventBFBB.Drivenby) - { - uint PlatID = assetEvent.TargetAssetID; + { + uint PlatID = 0; - foreach (ArchiveEditor ae in Program.MainForm.archiveEditors) - if (ae.archive.ContainsAsset(PlatID)) + if (assetEvent.EventSendID == EventBFBB.Drivenby) + PlatID = assetEvent.TargetAssetID; + else if (assetEvent.EventSendID == EventBFBB.Mount) + PlatID = assetEvent.ArgumentAssetID; + else continue; + + foreach (ArchiveEditor ae in Program.MainForm.archiveEditors) + if (ae.archive.ContainsAsset(PlatID)) + { + Asset asset = ae.archive.GetFromAssetID(PlatID); + if (asset is PlaceableAsset Placeable) { - Asset asset = ae.archive.GetFromAssetID(PlatID); - if (asset is PlaceableAsset Placeable) - { - found = true; - useRotation = assetEvent.Arguments_Float[0] != 0; - return Placeable; - } + found = true; + useRotation = assetEvent.Arguments_Float[0] != 0 || assetEvent.EventSendID == EventBFBB.Mount; + return Placeable; } - } + } + } + found = false; useRotation = false; return null; diff --git a/IndustrialPark/Assets/Shared/PlatSpecific.cs b/IndustrialPark/Assets/Shared/PlatSpecific.cs new file mode 100644 index 00000000..d2da9ca5 --- /dev/null +++ b/IndustrialPark/Assets/Shared/PlatSpecific.cs @@ -0,0 +1,359 @@ +using SharpDX; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using static IndustrialPark.ConverterFunctions; + +namespace IndustrialPark +{ + public class PlatSpecific_Generic + { + public static int Size => 0x38; + + public PlatSpecific_Generic() { } + + public PlatSpecific_Generic(byte[] data) { } + + public virtual byte[] ToByteArray() + { + return new byte[Size]; + } + + public virtual bool HasReference(uint assetID) + { + return false; + } + + public virtual void Verify(ref List result) + { + + } + } + + public class PlatSpecific_ConveryorBelt : PlatSpecific_Generic + { + public PlatSpecific_ConveryorBelt(byte[] data) + { + Speed = Switch(BitConverter.ToSingle(data, 0)); + } + + [Category("Conveyor Belt")] + public float Speed { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Speed))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class PlatSpecific_FallingPlatform : PlatSpecific_Generic + { + public PlatSpecific_FallingPlatform(byte[] data) + { + Speed = Switch(BitConverter.ToSingle(data, 0)); + BustModel_AssetID = Switch(BitConverter.ToUInt32(data, 4)); + } + + [Category("Falling Platform")] + public float Speed { get; set; } + [Category("Falling Platform")] + public AssetID BustModel_AssetID { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Speed))); + data.AddRange(BitConverter.GetBytes(Switch(BustModel_AssetID))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + + public override bool HasReference(uint assetID) + { + return BustModel_AssetID == assetID; + } + + public override void Verify(ref List result) + { + Asset.Verify(BustModel_AssetID, ref result); + } + } + + + public class PlatSpecific_FR : PlatSpecific_Generic + { + public PlatSpecific_FR(byte[] data) + { + fspeed = Switch(BitConverter.ToSingle(data, 0)); + rspeed = Switch(BitConverter.ToSingle(data, 4)); + ret_delay = Switch(BitConverter.ToSingle(data, 8)); + post_ret_delay = Switch(BitConverter.ToSingle(data, 12)); + } + + [Category("FR")] + public float fspeed { get; set; } + [Category("FR")] + public float rspeed { get; set; } + [Category("FR")] + public float ret_delay { get; set; } + [Category("FR")] + public float post_ret_delay { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(fspeed))); + data.AddRange(BitConverter.GetBytes(Switch(rspeed))); + data.AddRange(BitConverter.GetBytes(Switch(ret_delay))); + data.AddRange(BitConverter.GetBytes(Switch(post_ret_delay))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class PlatSpecific_BreakawayPlatform : PlatSpecific_Generic + { + public PlatSpecific_BreakawayPlatform(byte[] data) + { + BreakawayDelay = Switch(BitConverter.ToSingle(data, 0)); + BustModel_AssetID = Switch(BitConverter.ToUInt32(data, 4)); + ResetDelay = Switch(BitConverter.ToSingle(data, 8)); + Flags = Switch(BitConverter.ToInt32(data, 12)); + } + + [Category("Breakaway Platform")] + public float BreakawayDelay { get; set; } + [Category("Breakaway Platform")] + public AssetID BustModel_AssetID { get; set; } + [Category("Breakaway Platform")] + public float ResetDelay { get; set; } + [Category("Breakaway Platform")] + public int Flags { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(BreakawayDelay))); + data.AddRange(BitConverter.GetBytes(Switch(BustModel_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(ResetDelay))); + data.AddRange(BitConverter.GetBytes(Switch(Flags))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class PlatSpecific_Springboard : PlatSpecific_Generic + { + public PlatSpecific_Springboard() + { + Anim1_AssetID = 0; + Anim2_AssetID = 0; + Anim3_AssetID = 0; + } + + public PlatSpecific_Springboard(byte[] data) + { + Height1 = Switch(BitConverter.ToSingle(data, 0)); + Height2 = Switch(BitConverter.ToSingle(data, 4)); + Height3 = Switch(BitConverter.ToSingle(data, 8)); + HeightBubbleBounce = Switch(BitConverter.ToSingle(data, 12)); + Anim1_AssetID = Switch(BitConverter.ToUInt32(data, 16)); + Anim2_AssetID = Switch(BitConverter.ToUInt32(data, 20)); + Anim3_AssetID = Switch(BitConverter.ToUInt32(data, 24)); + DirectionX = Switch(BitConverter.ToSingle(data, 28)); + DirectionY = Switch(BitConverter.ToSingle(data, 32)); + DirectionZ = Switch(BitConverter.ToSingle(data, 36)); + Flags = Switch(BitConverter.ToInt32(data, 40)); + } + + [Category("Springboard")] + public float Height1 { get; set; } + [Category("Springboard")] + public float Height2 { get; set; } + [Category("Springboard")] + public float Height3 { get; set; } + [Category("Springboard")] + public float HeightBubbleBounce { get; set; } + [Category("Springboard")] + public AssetID Anim1_AssetID { get; set; } + [Category("Springboard")] + public AssetID Anim2_AssetID { get; set; } + [Category("Springboard")] + public AssetID Anim3_AssetID { get; set; } + [Category("Springboard")] + public float DirectionX { get; set; } + [Category("Springboard")] + public float DirectionY { get; set; } + [Category("Springboard")] + public float DirectionZ { get; set; } + [Category("Springboard")] + public int Flags { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(Height1))); + data.AddRange(BitConverter.GetBytes(Switch(Height2))); + data.AddRange(BitConverter.GetBytes(Switch(Height3))); + data.AddRange(BitConverter.GetBytes(Switch(HeightBubbleBounce))); + data.AddRange(BitConverter.GetBytes(Switch(Anim1_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(Anim2_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(Anim3_AssetID))); + data.AddRange(BitConverter.GetBytes(Switch(DirectionX))); + data.AddRange(BitConverter.GetBytes(Switch(DirectionY))); + data.AddRange(BitConverter.GetBytes(Switch(DirectionZ))); + data.AddRange(BitConverter.GetBytes(Switch(Flags))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + + public override bool HasReference(uint assetID) + { + return Anim1_AssetID == assetID || Anim2_AssetID == assetID || Anim3_AssetID == assetID; + } + + public override void Verify(ref List result) + { + Asset.Verify(Anim1_AssetID, ref result); + Asset.Verify(Anim2_AssetID, ref result); + Asset.Verify(Anim3_AssetID, ref result); + } + } + + public class PlatSpecific_TeeterTotter : PlatSpecific_Generic + { + public PlatSpecific_TeeterTotter(byte[] data) + { + InitialTilt_Rad = Switch(BitConverter.ToSingle(data, 0)); + MaxTilt_Rad = Switch(BitConverter.ToSingle(data, 4)); + InverseMass = Switch(BitConverter.ToSingle(data, 8)); + } + + [Category("Teeter-Totter")] + private float InitialTilt_Rad { get; set; } + [Category("Teeter-Totter")] + private float MaxTilt_Rad { get; set; } + + [Category("Teeter-Totter")] + public float InitialTilt_Deg + { + get => MathUtil.RadiansToDegrees(InitialTilt_Rad); + set => InitialTilt_Rad = MathUtil.DegreesToRadians(value); + } + [Category("Teeter-Totter")] + public float MaxTilt_Deg + { + get => MathUtil.RadiansToDegrees(MaxTilt_Rad); + set => MaxTilt_Rad = MathUtil.DegreesToRadians(value); + } + + [Category("Teeter-Totter")] + public float InverseMass { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + data.AddRange(BitConverter.GetBytes(Switch(InitialTilt_Rad))); + data.AddRange(BitConverter.GetBytes(Switch(MaxTilt_Rad))); + data.AddRange(BitConverter.GetBytes(Switch(InverseMass))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } + + public class PlatSpecific_Paddle : PlatSpecific_Generic + { + public PlatSpecific_Paddle(byte[] data) + { + StartOrient = Switch(BitConverter.ToInt32(data, 0)); + OrientCount = Switch(BitConverter.ToInt32(data, 4)); + OrientLoop = Switch(BitConverter.ToSingle(data, 8)); + Orient1 = Switch(BitConverter.ToSingle(data, 12)); + Orient2 = Switch(BitConverter.ToSingle(data, 16)); + Orient3 = Switch(BitConverter.ToSingle(data, 20)); + Orient4 = Switch(BitConverter.ToSingle(data, 24)); + Orient5 = Switch(BitConverter.ToSingle(data, 28)); + Orient6 = Switch(BitConverter.ToSingle(data, 32)); + Flags = Switch(BitConverter.ToInt32(data, 36)); + RotateSpeed = Switch(BitConverter.ToSingle(data, 36)); + AccelTime = Switch(BitConverter.ToSingle(data, 36)); + DecelTime = Switch(BitConverter.ToSingle(data, 36)); + HubRadius = Switch(BitConverter.ToSingle(data, 36)); + } + + [Category("Paddle")] + public int StartOrient { get; set; } + [Category("Paddle")] + public int OrientCount { get; set; } + [Category("Paddle")] + public float OrientLoop { get; set; } + [Category("Paddle")] + public float Orient1 { get; set; } + [Category("Paddle")] + public float Orient2{ get; set; } + [Category("Paddle")] + public float Orient3 { get; set; } + [Category("Paddle")] + public float Orient4 { get; set; } + [Category("Paddle")] + public float Orient5 { get; set; } + [Category("Paddle")] + public float Orient6 { get; set; } + [Category("Paddle")] + public int Flags { get; set; } + [Category("Paddle")] + public float RotateSpeed { get; set; } + [Category("Paddle")] + public float AccelTime { get; set; } + [Category("Paddle")] + public float DecelTime { get; set; } + [Category("Paddle")] + public float HubRadius { get; set; } + + public override byte[] ToByteArray() + { + List data = new List(Size); + + data.AddRange(BitConverter.GetBytes(Switch(StartOrient))); + data.AddRange(BitConverter.GetBytes(Switch(OrientCount))); + data.AddRange(BitConverter.GetBytes(Switch(OrientLoop))); + data.AddRange(BitConverter.GetBytes(Switch(Orient1))); + data.AddRange(BitConverter.GetBytes(Switch(Orient2))); + data.AddRange(BitConverter.GetBytes(Switch(Orient3))); + data.AddRange(BitConverter.GetBytes(Switch(Orient4))); + data.AddRange(BitConverter.GetBytes(Switch(Orient5))); + data.AddRange(BitConverter.GetBytes(Switch(Orient5))); + data.AddRange(BitConverter.GetBytes(Switch(Flags))); + data.AddRange(BitConverter.GetBytes(Switch(RotateSpeed))); + data.AddRange(BitConverter.GetBytes(Switch(AccelTime))); + data.AddRange(BitConverter.GetBytes(Switch(DecelTime))); + data.AddRange(BitConverter.GetBytes(Switch(HubRadius))); + + while (data.Count < Size) + data.Add(0); + + return data.ToArray(); + } + } +} diff --git a/IndustrialPark/IndustrialPark.csproj b/IndustrialPark/IndustrialPark.csproj index 2cd9777f..9728fc64 100644 --- a/IndustrialPark/IndustrialPark.csproj +++ b/IndustrialPark/IndustrialPark.csproj @@ -99,6 +99,12 @@ InternalModelEditor.cs + + Form + + + InternalButtonEditor.cs + Form @@ -181,6 +187,10 @@ + + + + @@ -389,6 +399,9 @@ InternalModelEditor.cs + + InternalButtonEditor.cs + InternalPlatEditor.cs @@ -404,9 +417,6 @@ AssetIDGenerator.cs - - PlatSearch.cs - EventSearch.cs @@ -416,12 +426,6 @@ AssetIDGenerator.cs - - Form - - - PlatSearch.cs - Form diff --git a/IndustrialPark/MainForm/MainForm.Designer.cs b/IndustrialPark/MainForm/MainForm.Designer.cs index 42e7f024..19bc5360 100644 --- a/IndustrialPark/MainForm/MainForm.Designer.cs +++ b/IndustrialPark/MainForm/MainForm.Designer.cs @@ -100,7 +100,6 @@ private void InitializeComponent() this.uIModeAutoSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.researchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.eventSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.platSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.assetIDGeneratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); @@ -150,14 +149,14 @@ private void InitializeComponent() // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(130, 22); this.newToolStripMenuItem.Text = "Open New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(127, 6); // // projectToolStripMenuItem // @@ -487,7 +486,7 @@ private void InitializeComponent() this.levelModelToolStripMenuItem.Checked = true; this.levelModelToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.levelModelToolStripMenuItem.Name = "levelModelToolStripMenuItem"; - this.levelModelToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.levelModelToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.levelModelToolStripMenuItem.Text = "BSP/JSP"; this.levelModelToolStripMenuItem.Click += new System.EventHandler(this.levelModelToolStripMenuItem_Click); // @@ -496,7 +495,7 @@ private void InitializeComponent() this.bOULToolStripMenuItem.Checked = true; this.bOULToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.bOULToolStripMenuItem.Name = "bOULToolStripMenuItem"; - this.bOULToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.bOULToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.bOULToolStripMenuItem.Text = "BOUL"; this.bOULToolStripMenuItem.Click += new System.EventHandler(this.bOULToolStripMenuItem_Click); // @@ -505,7 +504,7 @@ private void InitializeComponent() this.bUTNToolStripMenuItem.Checked = true; this.bUTNToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.bUTNToolStripMenuItem.Name = "bUTNToolStripMenuItem"; - this.bUTNToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.bUTNToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.bUTNToolStripMenuItem.Text = "BUTN"; this.bUTNToolStripMenuItem.Click += new System.EventHandler(this.bUTNToolStripMenuItem_Click); // @@ -514,7 +513,7 @@ private void InitializeComponent() this.cAMToolStripMenuItem.Checked = true; this.cAMToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.cAMToolStripMenuItem.Name = "cAMToolStripMenuItem"; - this.cAMToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.cAMToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.cAMToolStripMenuItem.Text = "CAM"; this.cAMToolStripMenuItem.Click += new System.EventHandler(this.cAMToolStripMenuItem_Click); // @@ -523,7 +522,7 @@ private void InitializeComponent() this.dSTRToolStripMenuItem.Checked = true; this.dSTRToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.dSTRToolStripMenuItem.Name = "dSTRToolStripMenuItem"; - this.dSTRToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.dSTRToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.dSTRToolStripMenuItem.Text = "DSTR"; this.dSTRToolStripMenuItem.Click += new System.EventHandler(this.dSTRToolStripMenuItem_Click); // @@ -532,7 +531,7 @@ private void InitializeComponent() this.dYNAToolStripMenuItem.Checked = true; this.dYNAToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.dYNAToolStripMenuItem.Name = "dYNAToolStripMenuItem"; - this.dYNAToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.dYNAToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.dYNAToolStripMenuItem.Text = "DYNA"; this.dYNAToolStripMenuItem.Click += new System.EventHandler(this.dYNAToolStripMenuItem_Click); // @@ -541,7 +540,7 @@ private void InitializeComponent() this.eGENToolStripMenuItem.Checked = true; this.eGENToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.eGENToolStripMenuItem.Name = "eGENToolStripMenuItem"; - this.eGENToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.eGENToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.eGENToolStripMenuItem.Text = "EGEN"; this.eGENToolStripMenuItem.Click += new System.EventHandler(this.eGENToolStripMenuItem_Click); // @@ -550,7 +549,7 @@ private void InitializeComponent() this.hANGToolStripMenuItem.Checked = true; this.hANGToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.hANGToolStripMenuItem.Name = "hANGToolStripMenuItem"; - this.hANGToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.hANGToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.hANGToolStripMenuItem.Text = "HANG"; this.hANGToolStripMenuItem.Click += new System.EventHandler(this.hANGToolStripMenuItem_Click); // @@ -559,7 +558,7 @@ private void InitializeComponent() this.lITEToolStripMenuItem.Checked = true; this.lITEToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.lITEToolStripMenuItem.Name = "lITEToolStripMenuItem"; - this.lITEToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.lITEToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.lITEToolStripMenuItem.Text = "LITE"; this.lITEToolStripMenuItem.Click += new System.EventHandler(this.lITEToolStripMenuItem_Click); // @@ -568,7 +567,7 @@ private void InitializeComponent() this.mRKRToolStripMenuItem.Checked = true; this.mRKRToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.mRKRToolStripMenuItem.Name = "mRKRToolStripMenuItem"; - this.mRKRToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.mRKRToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.mRKRToolStripMenuItem.Text = "MRKR"; this.mRKRToolStripMenuItem.Click += new System.EventHandler(this.mRKRToolStripMenuItem_Click); // @@ -577,7 +576,7 @@ private void InitializeComponent() this.mVPTToolStripMenuItem.Checked = true; this.mVPTToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.mVPTToolStripMenuItem.Name = "mVPTToolStripMenuItem"; - this.mVPTToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.mVPTToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.mVPTToolStripMenuItem.Text = "MVPT"; this.mVPTToolStripMenuItem.Click += new System.EventHandler(this.mVPTToolStripMenuItem_Click); // @@ -586,7 +585,7 @@ private void InitializeComponent() this.pENDToolStripMenuItem.Checked = true; this.pENDToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.pENDToolStripMenuItem.Name = "pENDToolStripMenuItem"; - this.pENDToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pENDToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.pENDToolStripMenuItem.Text = "PEND"; this.pENDToolStripMenuItem.Click += new System.EventHandler(this.pENDToolStripMenuItem_Click); // @@ -595,7 +594,7 @@ private void InitializeComponent() this.pKUPToolStripMenuItem.Checked = true; this.pKUPToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.pKUPToolStripMenuItem.Name = "pKUPToolStripMenuItem"; - this.pKUPToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pKUPToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.pKUPToolStripMenuItem.Text = "PKUP"; this.pKUPToolStripMenuItem.Click += new System.EventHandler(this.pKUPToolStripMenuItem_Click); // @@ -604,7 +603,7 @@ private void InitializeComponent() this.pLATToolStripMenuItem.Checked = true; this.pLATToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.pLATToolStripMenuItem.Name = "pLATToolStripMenuItem"; - this.pLATToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pLATToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.pLATToolStripMenuItem.Text = "PLAT"; this.pLATToolStripMenuItem.Click += new System.EventHandler(this.pLATToolStripMenuItem_Click); // @@ -613,7 +612,7 @@ private void InitializeComponent() this.pLYRToolStripMenuItem.Checked = true; this.pLYRToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.pLYRToolStripMenuItem.Name = "pLYRToolStripMenuItem"; - this.pLYRToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pLYRToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.pLYRToolStripMenuItem.Text = "PLYR"; this.pLYRToolStripMenuItem.Click += new System.EventHandler(this.pLYRToolStripMenuItem_Click); // @@ -622,7 +621,7 @@ private void InitializeComponent() this.sFXToolStripMenuItem.Checked = true; this.sFXToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.sFXToolStripMenuItem.Name = "sFXToolStripMenuItem"; - this.sFXToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.sFXToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.sFXToolStripMenuItem.Text = "SFX"; this.sFXToolStripMenuItem.Click += new System.EventHandler(this.sFXToolStripMenuItem_Click); // @@ -631,7 +630,7 @@ private void InitializeComponent() this.sIMPToolStripMenuItem.Checked = true; this.sIMPToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.sIMPToolStripMenuItem.Name = "sIMPToolStripMenuItem"; - this.sIMPToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.sIMPToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.sIMPToolStripMenuItem.Text = "SIMP"; this.sIMPToolStripMenuItem.Click += new System.EventHandler(this.sIMPToolStripMenuItem_Click); // @@ -640,7 +639,7 @@ private void InitializeComponent() this.tRIGToolStripMenuItem.Checked = true; this.tRIGToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.tRIGToolStripMenuItem.Name = "tRIGToolStripMenuItem"; - this.tRIGToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.tRIGToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.tRIGToolStripMenuItem.Text = "TRIG"; this.tRIGToolStripMenuItem.Click += new System.EventHandler(this.tRIGToolStripMenuItem_Click); // @@ -649,7 +648,7 @@ private void InitializeComponent() this.uIToolStripMenuItem.Checked = true; this.uIToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.uIToolStripMenuItem.Name = "uIToolStripMenuItem"; - this.uIToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.uIToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.uIToolStripMenuItem.Text = "UI"; this.uIToolStripMenuItem.Click += new System.EventHandler(this.uIToolStripMenuItem_Click); // @@ -658,7 +657,7 @@ private void InitializeComponent() this.uIFTToolStripMenuItem.Checked = true; this.uIFTToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.uIFTToolStripMenuItem.Name = "uIFTToolStripMenuItem"; - this.uIFTToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.uIFTToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.uIFTToolStripMenuItem.Text = "UIFT"; this.uIFTToolStripMenuItem.Click += new System.EventHandler(this.uIFTToolStripMenuItem_Click); // @@ -667,26 +666,26 @@ private void InitializeComponent() this.vILToolStripMenuItem.Checked = true; this.vILToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.vILToolStripMenuItem.Name = "vILToolStripMenuItem"; - this.vILToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.vILToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.vILToolStripMenuItem.Text = "VIL"; this.vILToolStripMenuItem.Click += new System.EventHandler(this.vILToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(165, 6); // // uIModeToolStripMenuItem // this.uIModeToolStripMenuItem.Name = "uIModeToolStripMenuItem"; - this.uIModeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.uIModeToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.uIModeToolStripMenuItem.Text = "UI Mode (U)"; this.uIModeToolStripMenuItem.Click += new System.EventHandler(this.uIModeToolStripMenuItem_Click); // // uIModeAutoSizeToolStripMenuItem // this.uIModeAutoSizeToolStripMenuItem.Name = "uIModeAutoSizeToolStripMenuItem"; - this.uIModeAutoSizeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.uIModeAutoSizeToolStripMenuItem.Size = new System.Drawing.Size(168, 22); this.uIModeAutoSizeToolStripMenuItem.Text = "UI Mode AutoSize"; this.uIModeAutoSizeToolStripMenuItem.Click += new System.EventHandler(this.uIModeAutoSizeToolStripMenuItem_Click); // @@ -694,7 +693,6 @@ private void InitializeComponent() // this.researchToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.eventSearchToolStripMenuItem, - this.platSearchToolStripMenuItem, this.assetIDGeneratorToolStripMenuItem}); this.researchToolStripMenuItem.Name = "researchToolStripMenuItem"; this.researchToolStripMenuItem.Size = new System.Drawing.Size(124, 20); @@ -707,13 +705,6 @@ private void InitializeComponent() this.eventSearchToolStripMenuItem.Text = "Event Search"; this.eventSearchToolStripMenuItem.Click += new System.EventHandler(this.eventSearchToolStripMenuItem_Click); // - // platSearchToolStripMenuItem - // - this.platSearchToolStripMenuItem.Name = "platSearchToolStripMenuItem"; - this.platSearchToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.platSearchToolStripMenuItem.Text = "Plat Search"; - this.platSearchToolStripMenuItem.Click += new System.EventHandler(this.platSearchToolStripMenuItem_Click); - // // assetIDGeneratorToolStripMenuItem // this.assetIDGeneratorToolStripMenuItem.Name = "assetIDGeneratorToolStripMenuItem"; @@ -961,7 +952,6 @@ private void InitializeComponent() private ToolStripMenuItem researchToolStripMenuItem; private ToolStripMenuItem eventSearchToolStripMenuItem; private ToolStripMenuItem addTXDArchiveToolStripMenuItem; - private ToolStripMenuItem platSearchToolStripMenuItem; private ToolStripMenuItem templatesPersistentShiniesToolStripMenuItem; private ToolStripMenuItem lITEToolStripMenuItem; private ToolStripMenuItem assetIDGeneratorToolStripMenuItem; diff --git a/IndustrialPark/MainForm/MainForm.cs b/IndustrialPark/MainForm/MainForm.cs index d921421a..14380546 100644 --- a/IndustrialPark/MainForm/MainForm.cs +++ b/IndustrialPark/MainForm/MainForm.cs @@ -795,8 +795,8 @@ private void pLATPreviewToolStripMenuItem_Click(object sender, EventArgs e) { foreach (ArchiveEditor ae in archiveEditors) foreach (Asset a in ae.archive.GetAllAssets()) - if (a is AssetPLAT PLAT) - PLAT.Reset(); + if (a is AssetWithMotion m) + m.Reset(); } } @@ -1149,12 +1149,7 @@ private void eventSearchToolStripMenuItem_Click(object sender, EventArgs e) { Program.EventSearch.Show(); } - - private void platSearchToolStripMenuItem_Click(object sender, EventArgs e) - { - Program.PlatSearch.Show(); - } - + private void assetIDGeneratorToolStripMenuItem_Click(object sender, EventArgs e) { Program.AssetIDGenerator.Show(); @@ -1189,7 +1184,6 @@ private void SetAllTopMost(bool value) Program.UserTemplateManager.TopMost = value; Program.EventSearch.TopMost = value; - Program.PlatSearch.TopMost = value; Program.AssetIDGenerator.TopMost = value; foreach (ArchiveEditor ae in archiveEditors) diff --git a/IndustrialPark/Program.cs b/IndustrialPark/Program.cs index 67a0c853..d1243bc0 100644 --- a/IndustrialPark/Program.cs +++ b/IndustrialPark/Program.cs @@ -12,7 +12,6 @@ static class Program public static UserTemplateManager UserTemplateManager; public static EventSearch EventSearch; - public static PlatSearch PlatSearch; public static AssetIDGenerator AssetIDGenerator; /// @@ -36,7 +35,6 @@ static void Main() UserTemplateManager = new UserTemplateManager(); EventSearch = new EventSearch(); - PlatSearch = new PlatSearch(); AssetIDGenerator = new AssetIDGenerator(); Application.Run(MainForm); diff --git a/IndustrialPark/Research/PlatSearch.Designer.cs b/IndustrialPark/Research/PlatSearch.Designer.cs deleted file mode 100644 index bf950b37..00000000 --- a/IndustrialPark/Research/PlatSearch.Designer.cs +++ /dev/null @@ -1,116 +0,0 @@ -namespace IndustrialPark -{ - partial class PlatSearch - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.buttonChooseRoot = new System.Windows.Forms.Button(); - this.labelRootDir = new System.Windows.Forms.Label(); - this.buttonPerform = new System.Windows.Forms.Button(); - this.richTextBox2 = new System.Windows.Forms.RichTextBox(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.SuspendLayout(); - // - // buttonChooseRoot - // - this.buttonChooseRoot.Location = new System.Drawing.Point(12, 25); - this.buttonChooseRoot.Name = "buttonChooseRoot"; - this.buttonChooseRoot.Size = new System.Drawing.Size(194, 23); - this.buttonChooseRoot.TabIndex = 0; - this.buttonChooseRoot.Text = "Choose Root Directory"; - this.buttonChooseRoot.UseVisualStyleBackColor = true; - this.buttonChooseRoot.Click += new System.EventHandler(this.buttonChooseRoot_Click); - // - // labelRootDir - // - this.labelRootDir.AutoSize = true; - this.labelRootDir.Location = new System.Drawing.Point(12, 9); - this.labelRootDir.Name = "labelRootDir"; - this.labelRootDir.Size = new System.Drawing.Size(107, 13); - this.labelRootDir.TabIndex = 1; - this.labelRootDir.Text = "Root Directory: None"; - // - // buttonPerform - // - this.buttonPerform.Location = new System.Drawing.Point(224, 25); - this.buttonPerform.Name = "buttonPerform"; - this.buttonPerform.Size = new System.Drawing.Size(190, 23); - this.buttonPerform.TabIndex = 8; - this.buttonPerform.Text = "Perform Search"; - this.buttonPerform.UseVisualStyleBackColor = true; - this.buttonPerform.Click += new System.EventHandler(this.buttonPerform_Click); - // - // richTextBox2 - // - this.richTextBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.richTextBox2.Location = new System.Drawing.Point(12, 83); - this.richTextBox2.Name = "richTextBox2"; - this.richTextBox2.Size = new System.Drawing.Size(402, 338); - this.richTextBox2.TabIndex = 9; - this.richTextBox2.Text = ""; - // - // progressBar1 - // - this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(12, 54); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(402, 23); - this.progressBar1.TabIndex = 10; - // - // PlatSearch - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(426, 433); - this.Controls.Add(this.progressBar1); - this.Controls.Add(this.richTextBox2); - this.Controls.Add(this.buttonPerform); - this.Controls.Add(this.labelRootDir); - this.Controls.Add(this.buttonChooseRoot); - this.MaximizeBox = false; - this.Name = "PlatSearch"; - this.ShowIcon = false; - this.Text = "Plat Search"; - this.TopMost = true; - this.Load += new System.EventHandler(this.EventSearch_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button buttonChooseRoot; - private System.Windows.Forms.Label labelRootDir; - private System.Windows.Forms.Button buttonPerform; - private System.Windows.Forms.RichTextBox richTextBox2; - private System.Windows.Forms.ProgressBar progressBar1; - } -} \ No newline at end of file diff --git a/IndustrialPark/Research/PlatSearch.cs b/IndustrialPark/Research/PlatSearch.cs deleted file mode 100644 index 6db98e36..00000000 --- a/IndustrialPark/Research/PlatSearch.cs +++ /dev/null @@ -1,191 +0,0 @@ -using HipHopFile; -using Microsoft.WindowsAPICodePack.Dialogs; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace IndustrialPark -{ - public partial class PlatSearch : Form - { - public PlatSearch() - { - InitializeComponent(); - } - - private void EventSearch_Load(object sender, EventArgs e) - { - - } - - protected override void OnFormClosing(FormClosingEventArgs e) - { - if (e.CloseReason == CloseReason.WindowsShutDown) return; - if (e.CloseReason == CloseReason.FormOwnerClosing) return; - - e.Cancel = true; - Hide(); - } - - private string rootDir; - - private void buttonChooseRoot_Click(object sender, EventArgs e) - { - CommonOpenFileDialog openFile = new CommonOpenFileDialog() { IsFolderPicker = true }; - if (openFile.ShowDialog() == CommonFileDialogResult.Ok) - { - rootDir = openFile.FileName; - labelRootDir.Text = "Root Directory: " + rootDir; - } - } - - int total = 0; - - HashSet PlatformType_Header = new HashSet(); - HashSet PlatformType_Specific = new HashSet(); - HashSet UnknownByte_55 = new HashSet(); - HashSet CollisionType = new HashSet(); - HashSet MovementLockMode = new HashSet(); - HashSet UnknownByte_90 = new HashSet(); - HashSet UnknownByte_91 = new HashSet(); - HashSet UnknownByte_92 = new HashSet(); - HashSet UnknownByte_93 = new HashSet(); - HashSet MovementMode = new HashSet(); - HashSet MovementLoopType = new HashSet(); - HashSet MovementTranslation_Direction = new HashSet(); - HashSet MovementRotation_Axis = new HashSet(); - - private void buttonPerform_Click(object sender, EventArgs e) - { - total = 0; - - PlatformType_Header = new HashSet(); - PlatformType_Specific = new HashSet(); - UnknownByte_55 = new HashSet(); - CollisionType = new HashSet(); - MovementLockMode = new HashSet(); - UnknownByte_90 = new HashSet(); - UnknownByte_91 = new HashSet(); - UnknownByte_92 = new HashSet(); - UnknownByte_93 = new HashSet(); - MovementMode = new HashSet(); - MovementLoopType = new HashSet(); - MovementTranslation_Direction = new HashSet(); - MovementRotation_Axis = new HashSet(); - - AddFolder(rootDir); - - richTextBox2.Text = $"Found a total of {total} PLATs with \n {PlatformType_Header.Count} PlatformType_Header types: "; - foreach (PlatType type in PlatformType_Header) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {PlatformType_Specific.Count} PlatformType_Specific types: "; - foreach (PlatTypeSpecific type in PlatformType_Specific) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_55.Count} UnknownByte_55 types: "; - foreach (byte type in UnknownByte_55) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {CollisionType.Count} CollisionType types: "; - foreach (short type in CollisionType) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {MovementLockMode.Count} MovementLockMode types: "; - foreach (int type in MovementLockMode) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_90.Count} UnknownByte_90 types: "; - foreach (byte type in UnknownByte_90) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_91.Count} UnknownByte_91 types: "; - foreach (byte type in UnknownByte_91) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_92.Count} UnknownByte_92 types: "; - foreach (byte type in UnknownByte_92) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_93.Count} UnknownByte_93 types: "; - foreach (byte type in UnknownByte_93) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {UnknownByte_93.Count} UnknownByte_93 types: "; - foreach (byte type in UnknownByte_93) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {MovementMode.Count} MovementMode types: "; - foreach (byte type in MovementMode) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {MovementLoopType.Count} MovementLoopType types: "; - foreach (byte type in MovementLoopType) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {MovementTranslation_Direction.Count} MovementTranslation_Direction types: "; - foreach (byte type in MovementTranslation_Direction) - richTextBox2.Text += type.ToString() + ", "; - - richTextBox2.Text += $"\n with {MovementRotation_Axis.Count} MovementRotation_Axis types: "; - foreach (byte type in MovementRotation_Axis) - richTextBox2.Text += type.ToString() + ", "; - } - - private void AddFolder(string folderPath) - { - foreach (string s in Directory.GetFiles(folderPath)) - { - if (Path.GetExtension(s).ToLower() == ".hip" || Path.GetExtension(s).ToLower() == ".hop") - { - ArchiveEditorFunctions archive = new ArchiveEditorFunctions(); - archive.OpenFile(s); - WriteWhatIFound(archive); - archive.Dispose(); - } - } - foreach (string s in Directory.GetDirectories(folderPath)) - AddFolder(s); - } - - private void WriteWhatIFound(ArchiveEditorFunctions archive) - { - progressBar1.Minimum = 0; - progressBar1.Maximum = archive.AssetCount; - progressBar1.Step = 1; - - foreach (Asset asset in archive.GetAllAssets()) - { - progressBar1.PerformStep(); - - if (asset.AHDR.assetType != AssetType.PLAT) - continue; - - AssetPLAT PLAT = (AssetPLAT)asset; - - PlatformType_Header.Add(PLAT.PlatformType); - PlatformType_Specific.Add(PLAT.PlatformSubtype); - UnknownByte_55.Add(PLAT.UnknownByte_55); - CollisionType.Add(PLAT.CollisionType); - MovementLockMode.Add(PLAT.MovementLockMode); - UnknownByte_90.Add(PLAT.UnknownByte_90); - UnknownByte_91.Add(PLAT.UnknownByte_91); - UnknownByte_92.Add(PLAT.UnknownByte_92); - UnknownByte_93.Add(PLAT.UnknownByte_93); - MovementMode.Add(PLAT.MovementMode); - MovementLoopType.Add(PLAT.MovementLoopType); - MovementTranslation_Direction.Add(PLAT.MovementTranslation_Direction); - MovementRotation_Axis.Add(PLAT.MovementRotation_Axis); - - total++; - } - } - } -} diff --git a/IndustrialPark/SharpDX/SharpRenderer.cs b/IndustrialPark/SharpDX/SharpRenderer.cs index 7c24dd36..f305c388 100644 --- a/IndustrialPark/SharpDX/SharpRenderer.cs +++ b/IndustrialPark/SharpDX/SharpRenderer.cs @@ -452,7 +452,7 @@ public void RunMainLoop(Panel Panel) renderLarge.Add(a); else if (a is AssetPKUP assetPKUP && AssetPICK.pickEntries.Count == 0) renderTrans.Add(a); - else if (frustum.Intersects(ref bb)) + else if (PlaceableAsset.movementPreview || frustum.Intersects(ref bb)) a.Draw(this); } @@ -466,7 +466,7 @@ public void RunMainLoop(Panel Panel) foreach (IRenderableAsset a in renderTrans) { BoundingBox bb = a.GetBoundingBox(); - if (frustum.Intersects(ref bb)) + if (PlaceableAsset.movementPreview || frustum.Intersects(ref bb)) a.Draw(this); }