Skip to content

Commit

Permalink
Outsource some things from singleplayer resource builder
Browse files Browse the repository at this point in the history
  • Loading branch information
DurtyFree committed Feb 7, 2021
1 parent 1d9620c commit 8cc654b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 34 deletions.
21 changes: 5 additions & 16 deletions altClothTool.App/Builders/Base/MultiplayerResourceBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,10 @@ public override void BuildResource(string outputFolder, string collectionName)

for(int sexNr = 0; sexNr < 2; ++sexNr)
{
// Male YMT generating
YmtPedDefinitionFile ymt = new YmtPedDefinitionFile
{
metaYmtName = Prefixes[sexNr] + collectionName,
Unk_376833625 = {DlcName = RageLib.Hash.Jenkins.Hash(Prefixes[sexNr] + collectionName)}
};

MUnk_3538495220[] componentTextureBindings = { null, null, null, null, null, null, null, null, null, null, null, null };
int[] componentIndexes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int[] propIndexes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

//ymt.Unk_376833625.Unk_1235281004 = 0;
//ymt.Unk_376833625.Unk_4086467184 = 0;
//ymt.Unk_376833625.Unk_911147899 = 0;
//ymt.Unk_376833625.Unk_315291935 = 0;
//ymt.Unk_376833625.Unk_2996560424 = ;
YmtPedDefinitionFile ymt = CreateYmtPedDefinitionFile(Prefixes[sexNr] + collectionName,
out var componentTextureBindings,
out var componentIndexes,
out var propIndexes);

bool isAnyClothAdded = false;
bool isAnyPropAdded = false;
Expand Down Expand Up @@ -93,6 +81,7 @@ public override void BuildResource(string outputFolder, string collectionName)

string componentNumerics = currentPropIndex.ToString().PadLeft(3, '0');
string prefix = clothData.GetPrefix();

clothData.SetComponentNumerics(componentNumerics, currentPropIndex);

CopyPropModelToResource(clothData, sexNr, outputFolder, collectionName, componentNumerics, prefix);
Expand Down
22 changes: 22 additions & 0 deletions altClothTool.App/Builders/Base/ResourceBuilderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,28 @@ protected MCComponentInfo GenerateYmtPedComponentItem(ClothData clothData, ref M
};
}

protected YmtPedDefinitionFile CreateYmtPedDefinitionFile(string ymtName, out MUnk_3538495220[] componentTextureBindings, out int[] componentIndexes, out int[] propIndexes)
{
//Male YMT generating
YmtPedDefinitionFile ymt = new YmtPedDefinitionFile
{
metaYmtName = ymtName,
Unk_376833625 = {DlcName = RageLib.Hash.Jenkins.Hash(ymtName)}
};

componentTextureBindings = new MUnk_3538495220[]{ null, null, null, null, null, null, null, null, null, null, null, null };
componentIndexes = new []{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
propIndexes = new []{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

//ymt.Unk_376833625.Unk_1235281004 = 0;
//ymt.Unk_376833625.Unk_4086467184 = 0;
//ymt.Unk_376833625.Unk_911147899 = 0;
//ymt.Unk_376833625.Unk_315291935 = 0;
//ymt.Unk_376833625.Unk_2996560424 = ;

return ymt;
}

public abstract void BuildResource(string outputFolder, string collectionName);
}
}
23 changes: 5 additions & 18 deletions altClothTool.App/Builders/SingleplayerResourceBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,10 @@ public override void BuildResource(string outputFolder, string collectionName)

for (int sexNr = 0; sexNr < 2; ++sexNr)
{
//Male YMT generating
YmtPedDefinitionFile ymt = new YmtPedDefinitionFile
{
metaYmtName = Prefixes[sexNr] + collectionName,
Unk_376833625 = {DlcName = RageLib.Hash.Jenkins.Hash(Prefixes[sexNr] + collectionName)}
};

MUnk_3538495220[] componentTextureBindings = { null, null, null, null, null, null, null, null, null, null, null, null };
int[] componentIndexes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int[] propIndexes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

//ymt.Unk_376833625.Unk_1235281004 = 0;
//ymt.Unk_376833625.Unk_4086467184 = 0;
//ymt.Unk_376833625.Unk_911147899 = 0;
//ymt.Unk_376833625.Unk_315291935 = 0;
//ymt.Unk_376833625.Unk_2996560424 = ;
YmtPedDefinitionFile ymt = CreateYmtPedDefinitionFile(Prefixes[sexNr] + collectionName,
out var componentTextureBindings,
out var componentIndexes,
out var propIndexes);

bool isAnyClothAdded = false;
bool isAnyPropAdded = false;
Expand Down Expand Up @@ -249,15 +237,14 @@ public override void BuildResource(string outputFolder, string collectionName)
resource.Import(clothData.MainPath);

char offsetLetter = 'a';

for (int i = 0; i < clothData.Textures.Count; ++i)
{
resource = currComponentDir.CreateResourceFile();
resource.Name = prefix + "_diff_" + componentNumerics + "_" + (char)(offsetLetter + i) + "_" + ytdPostfix + ".ytd";
resource.Import(clothData.Textures[i]);
}

if (clothData.FirstPersonModelPath != "")
if (!string.IsNullOrEmpty(clothData.FirstPersonModelPath))
{
resource = currComponentDir.CreateResourceFile();
resource.Name = prefix + "_" + componentNumerics + "_" + yddPostfix + "_1.ydd";
Expand Down

0 comments on commit 8cc654b

Please sign in to comment.