Fix for scenario YMT entity overrides (stutters), Create new scenario chains in clusters

This commit is contained in:
dexyfex 2017-09-27 00:54:05 +10:00
parent 24370c1b5d
commit b4c481d83f
3 changed files with 60 additions and 6 deletions

View File

@ -11,7 +11,7 @@ namespace CodeWalker.GameFiles
List<MetaBuilderBlock> Blocks = new List<MetaBuilderBlock>();
int MaxBlockLength = 0x2000; //TODO: figure what this should be!
int MaxBlockLength = 0x4000; //TODO: figure what this should be!
public MetaBuilderBlock EnsureBlock(MetaName type)

View File

@ -3753,9 +3753,27 @@ namespace CodeWalker.GameFiles
if ((EntityOverrides != null) && (EntityOverrides.Length > 0))
{
//mb.AddStructureInfo(MetaName.CScenarioEntityOverride); //will get added by MCScenarioEntityOverride
//mb.AddStructureInfo(MetaName.CExtensionDefSpawnPoint);
_Data.EntityOverrides = mb.AddWrapperArray(EntityOverrides);
//_Data.EntityOverrides = mb.AddWrapperArray(EntityOverrides);
mb.AddStructureInfo(MetaName.CScenarioEntityOverride);
var cents = new CScenarioEntityOverride[EntityOverrides.Length];
for (int i = 0; i < EntityOverrides.Length; i++)
{
var mcent = EntityOverrides[i];
var cent = mcent.Data;
var scps = mcent.GetCScenarioPoints();
if (scps != null)
{
mb.AddStructureInfo(MetaName.CExtensionDefSpawnPoint);
mb.AddEnumInfo((MetaName)3573596290);
mb.AddEnumInfo((MetaName)700327466);
cent.ScenarioPoints = mb.AddItemArrayPtr(MetaName.CExtensionDefSpawnPoint, scps);
}
cents[i] = cent;
}
_Data.EntityOverrides = mb.AddItemArrayPtr(MetaName.CScenarioEntityOverride, cents);
}
else
{
@ -4429,6 +4447,18 @@ namespace CodeWalker.GameFiles
}
public CExtensionDefSpawnPoint[] GetCScenarioPoints()
{
if ((ScenarioPoints == null) || (ScenarioPoints.Length == 0)) return null;
CExtensionDefSpawnPoint[] r = new CExtensionDefSpawnPoint[ScenarioPoints.Length];
for (int i = 0; i < ScenarioPoints.Length; i++)
{
r[i] = ScenarioPoints[i].Data;
}
return r;
}
public override string Name
{

View File

@ -4733,6 +4733,7 @@ namespace CodeWalker
var copyn = CurrentScenarioNode?.ChainingNode;
var copyp = CurrentScenarioNode?.MyPoint;
var copye = CurrentScenarioChainEdge;
var copycl = CurrentScenarioNode?.Cluster;
MCScenarioChain chain = new MCScenarioChain();
if (copy != null)
@ -4748,8 +4749,26 @@ namespace CodeWalker
var pos1 = GetSpawnPos(10.0f);
var pos2 = pos1 + Vector3.UnitX;
var n1 = CurrentScenario.ScenarioRegion.AddNode();
var n2 = CurrentScenario.ScenarioRegion.AddNode();
ScenarioNode n1 = null;// CurrentScenario.ScenarioRegion.AddNode();
if (copycl != null)
{
ScenarioNode copyclnode = new ScenarioNode(CurrentScenario);
copyclnode.Cluster = copycl;
copyclnode.ClusterMyPoint = new MCScenarioPoint(CurrentScenario.CScenarioPointRegion);
copyclnode.ClusterMyPoint.InteriorName = 493038497; //JenkHash.GenHash("none");
copyclnode.ClusterMyPoint.GroupName = 493038497;
copyclnode.ClusterMyPoint.IMapName = 493038497;
copyclnode.ClusterMyPoint.TimeStart = 0;
copyclnode.ClusterMyPoint.TimeEnd = 24;
n1 = CurrentScenario.ScenarioRegion.AddNode(copyclnode);
}
else
{
n1 = CurrentScenario.ScenarioRegion.AddNode();
}
ScenarioNode n2 = CurrentScenario.ScenarioRegion.AddNode();
if (copyp != null)
{
@ -8910,6 +8929,11 @@ namespace CodeWalker
}
}
UpdateScenarioNodeTreeNode(CurrentScenarioNode);
if (CurrentScenarioNode.ChainingNode != null)
{
ScenarioChainNodeTypeComboBox.SelectedItem = stype;
}
}
private void ScenarioPointModelSetComboBox_SelectedIndexChanged(object sender, EventArgs e)