Skip to content

Commit

Permalink
adds some templates
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Jun 26, 2022
1 parent 6c5ae8d commit e27fd45
Show file tree
Hide file tree
Showing 17 changed files with 143 additions and 19 deletions.
2 changes: 2 additions & 0 deletions IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs

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

2 changes: 1 addition & 1 deletion IndustrialPark/ArchiveEditor/ArchiveEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ private ListViewItem ListViewItemFromAsset(Asset asset, bool selected)
new ListViewItem.ListViewSubItem(item, asset.assetID.ToString("X8")),
new ListViewItem.ListViewSubItem(item, asset.TypeString),
new ListViewItem.ListViewSubItem(item, info),
new ListViewItem.ListViewSubItem(item, asset.AssetInfoLinks.ToString()),
new ListViewItem.ListViewSubItem(item, asset.AssetInfoLinks),
});
return item;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public static List<ToolStripMenuItem> PopulateTemplateMenusAt(ToolStripMenuItem
GetTemplateMenuItem(AssetTemplate.Text, eventHandler),
GetTemplateMenuItem(AssetTemplate.Timer, eventHandler),
new ToolStripSeparator(),
GetTemplateMenuItem(AssetTemplate.Cam_Tweak, eventHandler)
GetTemplateMenuItem(AssetTemplate.Cam_Tweak, eventHandler),
GetTemplateMenuItem(AssetTemplate.Disco_Floor, eventHandler),
});

// BFBB
Expand Down Expand Up @@ -309,6 +310,10 @@ public static List<ToolStripMenuItem> PopulateTemplateMenusAt(ToolStripMenuItem
ToolStripMenuItem stageitemsScooby = new ToolStripMenuItem("Stage Items");
stageitemsScooby.DropDownItems.AddRange(new ToolStripItem[]
{
GetTemplateMenuItem(AssetTemplate.Gust, eventHandler),
GetTemplateMenuItem(AssetTemplate.Volume_Box, eventHandler),
GetTemplateMenuItem(AssetTemplate.Volume_Sphere, eventHandler),
new ToolStripSeparator(),
GetTemplateMenuItem(AssetTemplate.Red_Button, eventHandler),
GetTemplateMenuItem(AssetTemplate.Red_Button_Smash, eventHandler),
GetTemplateMenuItem(AssetTemplate.Floor_Button, eventHandler),
Expand Down Expand Up @@ -381,12 +386,15 @@ public static List<ToolStripMenuItem> PopulateTemplateMenusAt(ToolStripMenuItem
GetTemplateMenuItem(AssetTemplate.Animation_List, eventHandler),
GetTemplateMenuItem(AssetTemplate.Collision_Table, eventHandler),
GetTemplateMenuItem(AssetTemplate.DefaultGlowSceneProp, eventHandler),
GetTemplateMenuItem(AssetTemplate.Destructible, eventHandler),
GetTemplateMenuItem(AssetTemplate.Environment, eventHandler),
GetTemplateMenuItem(AssetTemplate.Jaw_Data_Table, eventHandler),
GetTemplateMenuItem(AssetTemplate.Level_Of_Detail_Table, eventHandler),
GetTemplateMenuItem(AssetTemplate.Model_Info, eventHandler),
GetTemplateMenuItem(AssetTemplate.One_Liner, eventHandler),
GetTemplateMenuItem(AssetTemplate.Pipe_Info_Table, eventHandler),
GetTemplateMenuItem(AssetTemplate.Shadow_Table, eventHandler),
GetTemplateMenuItem(AssetTemplate.Shrapnel, eventHandler),
GetTemplateMenuItem(AssetTemplate.Sound_Info, eventHandler),
GetTemplateMenuItem(AssetTemplate.Surface_Mapper, eventHandler),
GetTemplateMenuItem(AssetTemplate.Throwable_Table, eventHandler),
Expand Down Expand Up @@ -575,6 +583,10 @@ public static string GetName(AssetTemplate template)
return "Floor Button (Step)";
case AssetTemplate.Floor_Button_Smash:
return "Floor Button (Super Smash)";
case AssetTemplate.Volume_Box:
return "Volume (Box)";
case AssetTemplate.Volume_Sphere:
return "Volume (Sphere)";
}

return template.ToString().Replace('_', ' ');
Expand Down Expand Up @@ -823,6 +835,9 @@ public Asset PlaceTemplate(Vector3 position, int layerIndex, ref List<uint> asse
case AssetTemplate.Duplicatotron_Settings:
asset = new DynaGObjectNPCSettings(assetName);
break;
case AssetTemplate.Disco_Floor:
asset = new AssetDSCO(assetName);
break;
case AssetTemplate.Camera:
case AssetTemplate.Start_Camera:
case AssetTemplate.Bus_Stop_Camera:
Expand Down Expand Up @@ -1107,12 +1122,18 @@ public Asset PlaceTemplate(Vector3 position, int layerIndex, ref List<uint> asse
case AssetTemplate.Model_Info:
asset = new AssetMINF(assetName);
break;
case AssetTemplate.One_Liner:
asset = new AssetONEL(assetName);
break;
case AssetTemplate.Pipe_Info_Table:
asset = new AssetPIPT(assetName);
break;
case AssetTemplate.Shadow_Table:
asset = new AssetSHDW(assetName);
break;
case AssetTemplate.Shrapnel:
asset = new AssetSHRP(assetName);
break;
case AssetTemplate.Sound_Info:
if (platform == Platform.Xbox)
asset = new AssetSNDI_XBOX(assetName);
Expand Down Expand Up @@ -1460,6 +1481,16 @@ public Asset PlaceTemplate(Vector3 position, int layerIndex, ref List<uint> asse
case AssetTemplate.Cauldron_Emitter:
asset = new AssetPARE(assetName, position, template);
break;
case AssetTemplate.Destructible:
asset = new AssetDEST(assetName);
break;
case AssetTemplate.Gust:
asset = new AssetGUST(assetName);
break;
case AssetTemplate.Volume_Box:
case AssetTemplate.Volume_Sphere:
asset = new AssetVOLU(assetName, position, template);
break;
default:
MessageBox.Show("Unsupported template");
return null;
Expand Down
8 changes: 8 additions & 0 deletions IndustrialPark/ArchiveEditor/Other/AssetTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum AssetTemplate
Text,
Timer,
Cam_Tweak,
Disco_Floor,
Duplicatotron_Settings,

// Placeable
Expand Down Expand Up @@ -51,15 +52,18 @@ public enum AssetTemplate
// Other
Animation_List,
DefaultGlowSceneProp,
Destructible,
Collision_Table,
Environment,
Flythrough,
Flythrough_Widget,
Jaw_Data_Table,
Level_Of_Detail_Table,
Model_Info,
One_Liner,
Pipe_Info_Table,
Shadow_Table,
Shrapnel,
Sound_Info,
Surface_Mapper,
Throwable_Table,
Expand Down Expand Up @@ -288,6 +292,10 @@ public enum AssetTemplate
//Shark,

// Scooby items
Gust,
Volume_Box,
Volume_Sphere,

Red_Button,
Floor_Button,
Red_Button_Smash,
Expand Down
5 changes: 5 additions & 0 deletions IndustrialPark/Assets/Binary/AssetDEST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public class AssetDEST : Asset
[Category(categoryName)]
public AssetID? Unknown2 { get; set; }

public AssetDEST(string assetName) : base(assetName, AssetType.Destructible)
{
States = new DestState[0];
}

public AssetDEST(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand Down
17 changes: 11 additions & 6 deletions IndustrialPark/Assets/Binary/AssetONEL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public enum ePlayerType
ePLAYER_TYPE_SIZE
}

public class xOneLiner : GenericAssetDataContainer
public class OneLiner : GenericAssetDataContainer
{
public AssetID SoundGroupNameHash { get; set; }
public AssetSingle SoundStartDelay { get; set; }
Expand All @@ -33,8 +33,8 @@ public class xOneLiner : GenericAssetDataContainer
public int TesterDataFirstParam { get; set; }
public AssetSingle TesterDataSecondParam { get; set; }

public xOneLiner() { }
public xOneLiner(EndianBinaryReader reader)
public OneLiner() { }
public OneLiner(EndianBinaryReader reader)
{
SoundGroupNameHash = reader.ReadUInt32();
SoundStartDelay = reader.ReadSingle();
Expand Down Expand Up @@ -89,18 +89,23 @@ public class AssetONEL : Asset
public override string AssetInfo => $"{OneLiners.Length} entries";

[Category("One Liner")]
public xOneLiner[] OneLiners { get; set; }
public OneLiner[] OneLiners { get; set; }

private const int unkByteCount = 0x43;

public AssetONEL(string assetName) : base(assetName, AssetType.OneLiner)
{
OneLiners = new OneLiner[0];
}

public AssetONEL(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
{
int num = reader.ReadInt32();
OneLiners = new xOneLiner[num];
OneLiners = new OneLiner[num];
for (int i = 0; i < OneLiners.Length; i++)
OneLiners[i] = new xOneLiner(reader);
OneLiners[i] = new OneLiner(reader);
reader.ReadBytes(unkByteCount);
}
}
Expand Down
6 changes: 6 additions & 0 deletions IndustrialPark/Assets/Binary/AssetSHRP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public class AssetSHRP : Asset
[Category(categoryName)]
public EntrySHRP[] Entries { get; set; }

public AssetSHRP(string assetName) : base(assetName, AssetType.Shrapnel)
{
AssetID_Internal = assetID;
Entries = new EntrySHRP[0];
}

public AssetSHRP(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand Down
17 changes: 17 additions & 0 deletions IndustrialPark/Assets/ObjectAssets/AssetDSCO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ public class AssetDSCO : BaseAsset
[Category(categoryName), Description(discoDesc)]
public DiscoPattern[] Patterns { get; set; }

public AssetDSCO(string assetName) : base(assetName, AssetType.DiscoFloor, BaseAssetType.DiscoFloor)
{
Flags.FlagValueInt = 3;
TimeYellow = 1f;
TimeRed = 1f;
TileName_FirstWhite = "";
TileName_FirstYellow = "";
TileName_FirstRed = "";
Patterns = new DiscoPattern[0];
}

public AssetDSCO(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand Down Expand Up @@ -209,5 +220,11 @@ private void WriteString(string writeString, EndianBinaryWriter writer, byte fil
while (writer.BaseStream.Length % 4 != 0)
writer.Write(fillerByte);
}

public override bool HasReference(uint assetID) =>
TileName_FirstWhite == HexUIntTypeConverter.StringFromAssetID(assetID) ||
TileName_FirstYellow == HexUIntTypeConverter.StringFromAssetID(assetID) ||
TileName_FirstRed == HexUIntTypeConverter.StringFromAssetID(assetID) ||
base.HasReference(assetID);
}
}
8 changes: 8 additions & 0 deletions IndustrialPark/Assets/ObjectAssets/AssetGUST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ public class AssetGUST : BaseAsset
[Category(catName)]
public AssetSingle PartMod { get; set; }

public AssetGUST(string assetName) : base(assetName, AssetType.Gust, BaseAssetType.Gust)
{
GustFlags.FlagValueInt = 1;
StrengthY = 1f;
Fade = 0.5f;
PartMod = 1f;
}

public AssetGUST(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand Down
1 change: 0 additions & 1 deletion IndustrialPark/Assets/ObjectAssets/AssetPGRS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;

namespace IndustrialPark
{
Expand Down
33 changes: 33 additions & 0 deletions IndustrialPark/Assets/ObjectAssets/ClickableAssets/AssetVOLU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,39 @@ public VolumeType Shape
[Category(categoryName)]
public AssetSingle PivotZ { get; set; }

public AssetVOLU(string assetName, Vector3 position, AssetTemplate template) : base(assetName, AssetType.Volume, BaseAssetType.Volume)
{
PivotX = position.X;
PivotZ = position.Z;

switch (template)
{
case AssetTemplate.Volume_Box:
{
Shape = VolumeType.Box;
var shape = (VolumeBox)VolumeShape;
shape.CenterX = position.X;
shape.CenterY = position.Y;
shape.CenterZ = position.Z;
shape.SetPositions(position.X + 5f, position.Y + 5f, position.Z + 5f, position.X - 5f, position.Y - 5f, position.Z - 5f);
}
break;
case AssetTemplate.Volume_Sphere:
{
Shape = VolumeType.Sphere;
var shape = (VolumeSphere)VolumeShape;
shape.CenterX = position.X;
shape.CenterY = position.Y;
shape.CenterZ = position.Z;
shape.Radius = 5f;
}
break;
}

CreateTransformMatrix();
ArchiveEditorFunctions.AddToRenderableAssets(this);
}

public AssetVOLU(Section_AHDR AHDR, Game game, Endianness endianness) : base(AHDR, game, endianness)
{
using (var reader = new EndianBinaryReader(AHDR.data, endianness))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public override AssetSingle ScaleZ
}
}

public void SetPositions(float x0, AssetSingle y0, AssetSingle z0, AssetSingle x1, AssetSingle y1, AssetSingle z1)
public void SetPositions(float x0, float y0, float z0, float x1, float y1, float z1)
{
_minimum.X = x0;
_minimum.Y = y0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public override string AssetInfo
{
get
{
if (this is AssetUI && Texture == 0)
if (!(this is AssetUIFT) && Texture == 0)
return base.AssetInfo;
return HexUIntTypeConverter.StringFromAssetID(Texture);
}
Expand Down Expand Up @@ -160,7 +160,7 @@ public override void Verify(ref List<string> result)

public override void CreateTransformMatrix()
{
if (this is AssetUI && Texture == 0)
if (!(this is AssetUIFT) && Texture == 0)
{
world = Matrix.Scaling(_scale) * Matrix.Scaling(Width, Height, 1f)
* Matrix.RotationYawPitchRoll(_yaw, _pitch, _roll)
Expand All @@ -177,7 +177,7 @@ public override void CreateTransformMatrix()

protected override void CreateBoundingBox()
{
if (this is AssetUI && Texture == 0)
if (!(this is AssetUIFT) && Texture == 0)
base.CreateBoundingBox();
else
{
Expand All @@ -188,7 +188,7 @@ protected override void CreateBoundingBox()

public override void Draw(SharpRenderer renderer)
{
if (this is AssetUI && Texture == 0)
if (!(this is AssetUIFT) && Texture == 0)
base.Draw(renderer);
else
renderer.DrawPlane(world, isSelected, Texture, UvAnimOffset);
Expand Down
2 changes: 1 addition & 1 deletion IndustrialPark/Assets/Shared/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class Asset : GenericAssetDataContainer
[Browsable(false)]
public virtual string AssetInfo => "";
[Browsable(false)]
public virtual int AssetInfoLinks => 0;
public virtual string AssetInfoLinks => "-";
[Browsable(false)]
public virtual string TypeString => assetType.ToString();

Expand Down
11 changes: 11 additions & 0 deletions IndustrialPark/Assets/Shared/AssetSpecifics/VolumeSpecific.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ public override void CreateTransformMatrix()
return null;
}

public void SetPositions(float x0, float y0, float z0, float x1, float y1, float z1)
{
_trigPos0.X = x0;
_trigPos0.Y = y0;
_trigPos0.Z = z0;
_trigPos1.X = x1;
_trigPos1.Y = y1;
_trigPos1.Z = z1;
FixPosition();
}

public override void FixPosition()
{
if (_trigPos0.X > _trigPos1.X)
Expand Down
Loading

0 comments on commit e27fd45

Please sign in to comment.