Skip to content

Commit

Permalink
finish floating block templates
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Jun 17, 2023
1 parent 5f2f9e8 commit ae74b01
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,11 @@ public static List<ToolStripMenuItem> PopulateTemplateMenusAt(ToolStripMenuItem
GetTemplateMenuItem(AssetTemplate.Floating_Block, eventHandler),
GetTemplateMenuItem(AssetTemplate.Floating_Block_Spiked, eventHandler),
GetTemplateMenuItem(AssetTemplate.Scale_Block, eventHandler),
GetTemplateMenuItem(AssetTemplate.Scale_Block_Spiked, eventHandler),
GetTemplateMenuItem(AssetTemplate.Scale_Block_Driven, eventHandler),
GetTemplateMenuItem(AssetTemplate.Scale_Block_Spiked_Driven, eventHandler),
GetTemplateMenuItem(AssetTemplate.Ice_Block, eventHandler),
GetTemplateMenuItem(AssetTemplate.Ice_Block_Spiked, eventHandler),
GetTemplateMenuItem(AssetTemplate.Trampoline_Block, eventHandler),
GetTemplateMenuItem(AssetTemplate.Trampoline_Block_Spiked, eventHandler),
GetTemplateMenuItem(AssetTemplate.Trampoline_Block_Driven, eventHandler),
GetTemplateMenuItem(AssetTemplate.Trampoline_Block_Spiked_Driven, eventHandler),
new ToolStripSeparator(),
Expand Down Expand Up @@ -623,16 +621,12 @@ public static string GetName(AssetTemplate template)
return "Volume (Sphere)";
case AssetTemplate.Floating_Block_Spiked:
return "Floating Block (spiked)";
case AssetTemplate.Scale_Block_Spiked:
return "Scale Block (spiked)";
case AssetTemplate.Scale_Block_Driven:
return "Scale Block (with driver)";
case AssetTemplate.Scale_Block_Spiked_Driven:
return "Scale Block (spiked with driver)";
case AssetTemplate.Ice_Block_Spiked:
return "Ice Block (spiked)";
case AssetTemplate.Trampoline_Block_Spiked:
return "Trampoline Block (spiked)";
case AssetTemplate.Trampoline_Block_Driven:
return "Trampoline Block (with driver)";
case AssetTemplate.Trampoline_Block_Spiked_Driven:
Expand Down Expand Up @@ -841,6 +835,7 @@ private Asset CreateFromTemplate(AssetTemplate template, string assetName, Vecto
case AssetTemplate.Progress_Script:
return new AssetPGRS(assetName);
case AssetTemplate.Script:
case AssetTemplate.Scale_Block_Script:
return new AssetSCRP(assetName);
case AssetTemplate.Sound_Group:
return new AssetSGRP(assetName);
Expand Down Expand Up @@ -1132,6 +1127,7 @@ private Asset CreateFromTemplate(AssetTemplate template, string assetName, Vecto
case AssetTemplate.Cauldron_Sfx:
return new AssetSFX(assetName, position, game, template);
case AssetTemplate.SDFX:
case AssetTemplate.Scale_Block_Sdfx:
return new AssetSDFX(assetName, position, GetSGRP);
case AssetTemplate.Light:
case AssetTemplate.Cauldron_Light:
Expand Down Expand Up @@ -1506,24 +1502,21 @@ private Asset CreateFromTemplate(AssetTemplate template, string assetName, Vecto
case AssetTemplate.Floating_Block:
case AssetTemplate.Floating_Block_Spiked:
case AssetTemplate.Scale_Block:
case AssetTemplate.Scale_Block_Spiked:
case AssetTemplate.Scale_Block_Driven:
case AssetTemplate.Scale_Block_Spiked_Driven:
case AssetTemplate.Ice_Block:
case AssetTemplate.Ice_Block_Spiked:
case AssetTemplate.Trampoline_Block:
case AssetTemplate.Trampoline_Block_Spiked:
case AssetTemplate.Trampoline_Block_Driven:
case AssetTemplate.Trampoline_Block_Spiked_Driven:
case AssetTemplate.Wooden_Platform:
case AssetTemplate.Block_Driver:
var block = new AssetPLAT(assetName, position, template);

if (new AssetTemplate[] {
AssetTemplate.Floating_Block_Spiked,
AssetTemplate.Ice_Block_Spiked,
AssetTemplate.Scale_Block_Spiked,
AssetTemplate.Scale_Block_Spiked_Driven,
AssetTemplate.Trampoline_Block_Spiked,
AssetTemplate.Trampoline_Block_Spiked_Driven
}.Contains(template))
{
Expand All @@ -1539,6 +1532,7 @@ private Asset CreateFromTemplate(AssetTemplate template, string assetName, Vecto
}
};
}

if (new AssetTemplate[] {
AssetTemplate.Scale_Block_Driven,
AssetTemplate.Scale_Block_Spiked_Driven,
Expand All @@ -1554,9 +1548,54 @@ private Asset CreateFromTemplate(AssetTemplate template, string assetName, Vecto
EventReceiveID = (ushort)EventTSSM.ScenePrepare,
EventSendID = (ushort)EventTSSM.Drivenby,
TargetAsset = driver.assetID,
FloatParameter1 = 1f
}
};
}

if (new AssetTemplate[] {
AssetTemplate.Scale_Block,
AssetTemplate.Scale_Block_Driven,
AssetTemplate.Scale_Block_Spiked_Driven
}.Contains(template))
{
var sdfx = (AssetSDFX)PlaceTemplate(position, ref assetIDs, block.assetName + "_SDFX", AssetTemplate.Scale_Block_Sdfx);
sdfx.SoundGroup = "SHRINK_SGRP";
sdfx.Emitter = block.assetID;
sdfx.SDFXFlags.FlagValueInt = 4;

var script = (AssetSCRP)PlaceTemplate(position, ref assetIDs, block.assetName + "_SCRIPT", AssetTemplate.Scale_Block_Script);
script.TimedLinks = new Link[]
{
new Link(game)
{
Time = 0,
EventSendID = (ushort)EventTSSM.Run,
TargetAsset = block.assetID
},
new Link(game)
{
Time = 1,
EventSendID = (ushort)EventTSSM.CollisionVisibleOff,
TargetAsset = block.assetID
},
new Link(game)
{
Time = 1,
EventSendID = (ushort)EventTSSM.Play,
TargetAsset = sdfx.assetID
},
};

var links = block.Links.ToList();
links.Add(new Link(game)
{
EventReceiveID = (ushort)EventTSSM.Mount,
EventSendID = (ushort)EventTSSM.Run,
TargetAsset = script.assetID,
});
block.Links = links.ToArray();
}
return block;
}
MessageBox.Show("Unsupported template");
Expand Down
5 changes: 3 additions & 2 deletions IndustrialPark/ArchiveEditor/Other/AssetTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,19 @@ public enum AssetTemplate
Floating_Block,
Floating_Block_Spiked,
Scale_Block,
Scale_Block_Spiked,
Scale_Block_Driven,
Scale_Block_Spiked_Driven,
Ice_Block,
Ice_Block_Spiked,
Trampoline_Block,
Trampoline_Block_Spiked,
Trampoline_Block_Driven,
Trampoline_Block_Spiked_Driven,
Wooden_Platform,
Block_Spikes,

Block_Driver,
Scale_Block_Script,
Scale_Block_Sdfx,

// ...but not for user
Pressure_Plate_Base,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ public AssetPLAT(string assetName, Vector3 position, AssetTemplate template) : b
SolidityFlags.FlagValueByte = 0x82;
break;
case AssetTemplate.Scale_Block:
case AssetTemplate.Scale_Block_Spiked:
case AssetTemplate.Scale_Block_Driven:
case AssetTemplate.Scale_Block_Spiked_Driven:
_scale = new Vector3(1.9f, 1.9f, 1.9f);
Expand All @@ -185,6 +184,7 @@ public AssetPLAT(string assetName, Vector3 position, AssetTemplate template) : b
ScaleAmount = 0.01f,
ScaleDuration = 1f
};
Motion.MotionFlags.FlagValueShort = 0x04;
Model = "block_scale";
Surface = "WALLHANG_SURF";
SolidityFlags.FlagValueByte = 0x82;
Expand All @@ -204,7 +204,6 @@ public AssetPLAT(string assetName, Vector3 position, AssetTemplate template) : b
SolidityFlags.FlagValueByte = 0x82;
break;
case AssetTemplate.Trampoline_Block:
case AssetTemplate.Trampoline_Block_Spiked:
case AssetTemplate.Trampoline_Block_Driven:
case AssetTemplate.Trampoline_Block_Spiked_Driven:
_scale = new Vector3(1.9f, 1.9f, 1.9f);
Expand Down

0 comments on commit ae74b01

Please sign in to comment.