Peds form progress, new MetaNames, ped ymt metas parsing

This commit is contained in:
dexy
2019-11-07 03:51:35 +11:00
Unverified
parent 90142cb6da
commit 8bfca3a338
14 changed files with 1358 additions and 120 deletions
+351 -2
View File
@@ -78,6 +78,31 @@
this.ToolsPedTabPage = new System.Windows.Forms.TabPage();
this.ToolsTabControl = new System.Windows.Forms.TabControl();
this.ToolsPanel = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.CompHeadComboBox = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.CompBerdComboBox = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.CompHairComboBox = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.CompUpprComboBox = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.CompLowrComboBox = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.CompHandComboBox = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
this.CompFeetComboBox = new System.Windows.Forms.ComboBox();
this.label15 = new System.Windows.Forms.Label();
this.CompTeefComboBox = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.CompAccsComboBox = new System.Windows.Forms.ComboBox();
this.label17 = new System.Windows.Forms.Label();
this.CompTaskComboBox = new System.Windows.Forms.ComboBox();
this.label18 = new System.Windows.Forms.Label();
this.CompDeclComboBox = new System.Windows.Forms.ComboBox();
this.label20 = new System.Windows.Forms.Label();
this.CompJbibComboBox = new System.Windows.Forms.ComboBox();
this.ConsolePanel.SuspendLayout();
this.ToolsOptionsTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.TimeOfDayTrackBar)).BeginInit();
@@ -601,9 +626,9 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 11);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(38, 13);
this.label3.Size = new System.Drawing.Size(29, 13);
this.label3.TabIndex = 1;
this.label3.Text = "Name:";
this.label3.Text = "Ped:";
//
// PedNameComboBox
//
@@ -616,6 +641,7 @@
this.PedNameComboBox.Name = "PedNameComboBox";
this.PedNameComboBox.Size = new System.Drawing.Size(182, 21);
this.PedNameComboBox.TabIndex = 0;
this.PedNameComboBox.SelectedIndexChanged += new System.EventHandler(this.PedNameComboBox_SelectedIndexChanged);
//
// StatsUpdateTimer
//
@@ -625,6 +651,31 @@
//
// ToolsPedTabPage
//
this.ToolsPedTabPage.Controls.Add(this.label20);
this.ToolsPedTabPage.Controls.Add(this.CompJbibComboBox);
this.ToolsPedTabPage.Controls.Add(this.label18);
this.ToolsPedTabPage.Controls.Add(this.CompDeclComboBox);
this.ToolsPedTabPage.Controls.Add(this.label17);
this.ToolsPedTabPage.Controls.Add(this.CompTaskComboBox);
this.ToolsPedTabPage.Controls.Add(this.label16);
this.ToolsPedTabPage.Controls.Add(this.CompAccsComboBox);
this.ToolsPedTabPage.Controls.Add(this.label15);
this.ToolsPedTabPage.Controls.Add(this.CompTeefComboBox);
this.ToolsPedTabPage.Controls.Add(this.label13);
this.ToolsPedTabPage.Controls.Add(this.CompFeetComboBox);
this.ToolsPedTabPage.Controls.Add(this.label12);
this.ToolsPedTabPage.Controls.Add(this.CompHandComboBox);
this.ToolsPedTabPage.Controls.Add(this.label9);
this.ToolsPedTabPage.Controls.Add(this.CompLowrComboBox);
this.ToolsPedTabPage.Controls.Add(this.label8);
this.ToolsPedTabPage.Controls.Add(this.CompUpprComboBox);
this.ToolsPedTabPage.Controls.Add(this.label7);
this.ToolsPedTabPage.Controls.Add(this.CompHairComboBox);
this.ToolsPedTabPage.Controls.Add(this.label6);
this.ToolsPedTabPage.Controls.Add(this.CompBerdComboBox);
this.ToolsPedTabPage.Controls.Add(this.label5);
this.ToolsPedTabPage.Controls.Add(this.CompHeadComboBox);
this.ToolsPedTabPage.Controls.Add(this.label4);
this.ToolsPedTabPage.Controls.Add(this.label3);
this.ToolsPedTabPage.Controls.Add(this.PedNameComboBox);
this.ToolsPedTabPage.Location = new System.Drawing.Point(4, 22);
@@ -664,6 +715,279 @@
this.ToolsPanel.TabIndex = 7;
this.ToolsPanel.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 53);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(69, 13);
this.label4.TabIndex = 2;
this.label4.Text = "Components:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 76);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(36, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Head:";
//
// CompHeadComboBox
//
this.CompHeadComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHeadComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHeadComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHeadComboBox.FormattingEnabled = true;
this.CompHeadComboBox.Location = new System.Drawing.Point(54, 73);
this.CompHeadComboBox.Name = "CompHeadComboBox";
this.CompHeadComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHeadComboBox.TabIndex = 3;
this.CompHeadComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHeadComboBox_SelectedIndexChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(16, 103);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(32, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Berd:";
//
// CompBerdComboBox
//
this.CompBerdComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompBerdComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompBerdComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompBerdComboBox.FormattingEnabled = true;
this.CompBerdComboBox.Location = new System.Drawing.Point(54, 100);
this.CompBerdComboBox.Name = "CompBerdComboBox";
this.CompBerdComboBox.Size = new System.Drawing.Size(182, 21);
this.CompBerdComboBox.TabIndex = 5;
this.CompBerdComboBox.SelectedIndexChanged += new System.EventHandler(this.CompBerdComboBox_SelectedIndexChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(19, 130);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(29, 13);
this.label7.TabIndex = 8;
this.label7.Text = "Hair:";
//
// CompHairComboBox
//
this.CompHairComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHairComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHairComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHairComboBox.FormattingEnabled = true;
this.CompHairComboBox.Location = new System.Drawing.Point(54, 127);
this.CompHairComboBox.Name = "CompHairComboBox";
this.CompHairComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHairComboBox.TabIndex = 7;
this.CompHairComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHairComboBox_SelectedIndexChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(15, 157);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(33, 13);
this.label8.TabIndex = 10;
this.label8.Text = "Uppr:";
//
// CompUpprComboBox
//
this.CompUpprComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompUpprComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompUpprComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompUpprComboBox.FormattingEnabled = true;
this.CompUpprComboBox.Location = new System.Drawing.Point(54, 154);
this.CompUpprComboBox.Name = "CompUpprComboBox";
this.CompUpprComboBox.Size = new System.Drawing.Size(182, 21);
this.CompUpprComboBox.TabIndex = 9;
this.CompUpprComboBox.SelectedIndexChanged += new System.EventHandler(this.CompUpprComboBox_SelectedIndexChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(15, 184);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(33, 13);
this.label9.TabIndex = 12;
this.label9.Text = "Lowr:";
//
// CompLowrComboBox
//
this.CompLowrComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompLowrComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompLowrComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompLowrComboBox.FormattingEnabled = true;
this.CompLowrComboBox.Location = new System.Drawing.Point(54, 181);
this.CompLowrComboBox.Name = "CompLowrComboBox";
this.CompLowrComboBox.Size = new System.Drawing.Size(182, 21);
this.CompLowrComboBox.TabIndex = 11;
this.CompLowrComboBox.SelectedIndexChanged += new System.EventHandler(this.CompLowrComboBox_SelectedIndexChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(12, 211);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(36, 13);
this.label12.TabIndex = 14;
this.label12.Text = "Hand:";
//
// CompHandComboBox
//
this.CompHandComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompHandComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompHandComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompHandComboBox.FormattingEnabled = true;
this.CompHandComboBox.Location = new System.Drawing.Point(54, 208);
this.CompHandComboBox.Name = "CompHandComboBox";
this.CompHandComboBox.Size = new System.Drawing.Size(182, 21);
this.CompHandComboBox.TabIndex = 13;
this.CompHandComboBox.SelectedIndexChanged += new System.EventHandler(this.CompHandComboBox_SelectedIndexChanged);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(17, 238);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(31, 13);
this.label13.TabIndex = 16;
this.label13.Text = "Feet:";
//
// CompFeetComboBox
//
this.CompFeetComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompFeetComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompFeetComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompFeetComboBox.FormattingEnabled = true;
this.CompFeetComboBox.Location = new System.Drawing.Point(54, 235);
this.CompFeetComboBox.Name = "CompFeetComboBox";
this.CompFeetComboBox.Size = new System.Drawing.Size(182, 21);
this.CompFeetComboBox.TabIndex = 15;
this.CompFeetComboBox.SelectedIndexChanged += new System.EventHandler(this.CompFeetComboBox_SelectedIndexChanged);
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(16, 265);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(32, 13);
this.label15.TabIndex = 18;
this.label15.Text = "Teef:";
//
// CompTeefComboBox
//
this.CompTeefComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompTeefComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompTeefComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompTeefComboBox.FormattingEnabled = true;
this.CompTeefComboBox.Location = new System.Drawing.Point(54, 262);
this.CompTeefComboBox.Name = "CompTeefComboBox";
this.CompTeefComboBox.Size = new System.Drawing.Size(182, 21);
this.CompTeefComboBox.TabIndex = 17;
this.CompTeefComboBox.SelectedIndexChanged += new System.EventHandler(this.CompTeefComboBox_SelectedIndexChanged);
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(14, 292);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(34, 13);
this.label16.TabIndex = 20;
this.label16.Text = "Accs:";
//
// CompAccsComboBox
//
this.CompAccsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompAccsComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompAccsComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompAccsComboBox.FormattingEnabled = true;
this.CompAccsComboBox.Location = new System.Drawing.Point(54, 289);
this.CompAccsComboBox.Name = "CompAccsComboBox";
this.CompAccsComboBox.Size = new System.Drawing.Size(182, 21);
this.CompAccsComboBox.TabIndex = 19;
this.CompAccsComboBox.SelectedIndexChanged += new System.EventHandler(this.CompAccsComboBox_SelectedIndexChanged);
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(14, 319);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(34, 13);
this.label17.TabIndex = 22;
this.label17.Text = "Task:";
//
// CompTaskComboBox
//
this.CompTaskComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompTaskComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompTaskComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompTaskComboBox.FormattingEnabled = true;
this.CompTaskComboBox.Location = new System.Drawing.Point(54, 316);
this.CompTaskComboBox.Name = "CompTaskComboBox";
this.CompTaskComboBox.Size = new System.Drawing.Size(182, 21);
this.CompTaskComboBox.TabIndex = 21;
this.CompTaskComboBox.SelectedIndexChanged += new System.EventHandler(this.CompTaskComboBox_SelectedIndexChanged);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(16, 346);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(32, 13);
this.label18.TabIndex = 24;
this.label18.Text = "Decl:";
//
// CompDeclComboBox
//
this.CompDeclComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompDeclComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompDeclComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompDeclComboBox.FormattingEnabled = true;
this.CompDeclComboBox.Location = new System.Drawing.Point(54, 343);
this.CompDeclComboBox.Name = "CompDeclComboBox";
this.CompDeclComboBox.Size = new System.Drawing.Size(182, 21);
this.CompDeclComboBox.TabIndex = 23;
this.CompDeclComboBox.SelectedIndexChanged += new System.EventHandler(this.CompDeclComboBox_SelectedIndexChanged);
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(19, 373);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(29, 13);
this.label20.TabIndex = 26;
this.label20.Text = "Jbib:";
//
// CompJbibComboBox
//
this.CompJbibComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.CompJbibComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CompJbibComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CompJbibComboBox.FormattingEnabled = true;
this.CompJbibComboBox.Location = new System.Drawing.Point(54, 370);
this.CompJbibComboBox.Name = "CompJbibComboBox";
this.CompJbibComboBox.Size = new System.Drawing.Size(182, 21);
this.CompJbibComboBox.TabIndex = 25;
this.CompJbibComboBox.SelectedIndexChanged += new System.EventHandler(this.CompJbibComboBox_SelectedIndexChanged);
//
// PedsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -754,5 +1078,30 @@
private System.Windows.Forms.TabPage ToolsPedTabPage;
private System.Windows.Forms.TabControl ToolsTabControl;
private System.Windows.Forms.Panel ToolsPanel;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox CompHeadComboBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox CompHairComboBox;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox CompBerdComboBox;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox CompUpprComboBox;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.ComboBox CompHandComboBox;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.ComboBox CompLowrComboBox;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.ComboBox CompFeetComboBox;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.ComboBox CompTeefComboBox;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.ComboBox CompTaskComboBox;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ComboBox CompAccsComboBox;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.ComboBox CompJbibComboBox;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.ComboBox CompDeclComboBox;
}
}
+239 -52
View File
@@ -74,6 +74,32 @@ namespace CodeWalker.Peds
string SelectedPedName = string.Empty;
MetaHash SelectedPedHash = 0;//ped name hash
CPedModelInfo__InitData SelectedPedInit = null; //ped init data
YddFile SelectedPedYdd = null; //ped drawables
YftFile SelectedPedYft = null; //ped skeleton YFT
PedFile SelectedPedYmt = null; //ped variation info
Drawable SelectedHead = null;
Drawable SelectedBerd = null;
Drawable SelectedHair = null;
Drawable SelectedUppr = null;
Drawable SelectedLowr = null;
Drawable SelectedHand = null;
Drawable SelectedFeet = null;
Drawable SelectedTeef = null;
Drawable SelectedAccs = null;
Drawable SelectedTask = null;
Drawable SelectedDecl = null;
Drawable SelectedJbib = null;
public PedsForm()
{
InitializeComponent();
@@ -92,7 +118,7 @@ namespace CodeWalker.Peds
//Renderer.renderclouds = true;
//Renderer.individualcloudfrag = "Contrails";
Renderer.rendermoon = false;
Renderer.renderskeletons = false;
Renderer.renderskeletons = true;
Renderer.SelectionFlagsTestAll = true;
}
@@ -425,7 +451,7 @@ namespace CodeWalker.Peds
{
//move the camera to a default place where the given sphere is fully visible.
rad = Math.Max(0.01f, rad);
rad = Math.Max(0.01f, rad*0.1f);
camera.FollowEntity.Position = pos;
camera.TargetDistance = rad * 1.6f;
@@ -662,36 +688,70 @@ namespace CodeWalker.Peds
var pednamel = pedname.ToLowerInvariant();
MetaHash pedhash = JenkHash.GenHash(pednamel);
SelectedPedName = string.Empty;
SelectedPedHash = 0;
SelectedPedInit = null;
SelectedPedYdd = null;
SelectedPedYft = null;
SelectedPedYmt = null;
ClearCombo(CompHeadComboBox); SelectedHead = null;
ClearCombo(CompBerdComboBox); SelectedBerd = null;
ClearCombo(CompHairComboBox); SelectedHair = null;
ClearCombo(CompUpprComboBox); SelectedUppr = null;
ClearCombo(CompLowrComboBox); SelectedLowr = null;
ClearCombo(CompHandComboBox); SelectedHand = null;
ClearCombo(CompFeetComboBox); SelectedFeet = null;
ClearCombo(CompTeefComboBox); SelectedTeef = null;
ClearCombo(CompAccsComboBox); SelectedAccs = null;
ClearCombo(CompTaskComboBox); SelectedTask = null;
ClearCombo(CompDeclComboBox); SelectedDecl = null;
ClearCombo(CompJbibComboBox); SelectedJbib = null;
CPedModelInfo__InitData initdata = null;
if (!GameFileCache.PedsInitDict.TryGetValue(pedhash, out initdata)) return;
bool pedchange = SelectedPedHash != pedhash;
SelectedPedName = pedname;
SelectedPedHash = pedhash;
SelectedPedInit = initdata;
SelectedPedYdd = GameFileCache.GetYdd(pedhash);
SelectedPedYft = GameFileCache.GetYft(pedhash);
GameFileCache.PedVariationsDict?.TryGetValue(pedhash, out SelectedPedYmt);
while ((SelectedPedYdd != null) && (!SelectedPedYdd.Loaded))
{
Thread.Sleep(20);//kinda hacky
SelectedPedYdd = GameFileCache.GetYdd(SelectedPedHash);
}
while ((SelectedPedYft != null) && (!SelectedPedYft.Loaded))
{
Thread.Sleep(20);//kinda hacky
SelectedPedYft = GameFileCache.GetYft(SelectedPedHash);
}
LoadModel(SelectedPedYft, pedchange);
var vi = SelectedPedYmt?.VariationInfo;
if (vi != null)
{
PopulateCompCombo(CompHeadComboBox, vi.GetVariations(0));
PopulateCompCombo(CompBerdComboBox, vi.GetVariations(1));
PopulateCompCombo(CompHairComboBox, vi.GetVariations(2));
PopulateCompCombo(CompUpprComboBox, vi.GetVariations(3));
PopulateCompCombo(CompLowrComboBox, vi.GetVariations(4));
PopulateCompCombo(CompHandComboBox, vi.GetVariations(5));
PopulateCompCombo(CompFeetComboBox, vi.GetVariations(6));
PopulateCompCombo(CompTeefComboBox, vi.GetVariations(7));
PopulateCompCombo(CompAccsComboBox, vi.GetVariations(8));
PopulateCompCombo(CompTaskComboBox, vi.GetVariations(9));
PopulateCompCombo(CompDeclComboBox, vi.GetVariations(10));
PopulateCompCombo(CompJbibComboBox, vi.GetVariations(11));
}
//MetaHash modelhashhi = JenkHash.GenHash(pednamel + "_hi");
//bool hidet = VehicleHighDetailCheckBox.Checked;
//var yfthash = hidet ? modelhashhi : pedhash;
//VehicleInitData vid = null;
//if (GameFileCache.VehiclesInitDict.TryGetValue(pedhash, out vid))
//{
// bool vehiclechange = SelectedVehicleHash != pedhash;
// SelectedModelHash = yfthash;
// SelectedVehicleHash = pedhash;
// SelectedVehicleInit = vid;
// SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);
// while (!SelectedVehicleYft.Loaded)
// {
// Thread.Sleep(20);//kinda hacky
// SelectedVehicleYft = GameFileCache.GetYft(SelectedModelHash);
// }
// LoadModel(SelectedVehicleYft, vehiclechange);
// VehicleMakeLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.vehicleMakeName.ToLower()));
// VehicleNameLabel.Text = GlobalText.TryGetString(JenkHash.GenHash(vid.gameName.ToLower()));
//}
//else
//{
// SelectedModelHash = 0;
// SelectedVehicleHash = 0;
// SelectedVehicleInit = null;
// SelectedVehicleYft = null;
// VehicleMakeLabel.Text = "-";
// VehicleNameLabel.Text = "-";
//}
}
public void LoadModel(YftFile yft, bool movecamera = true)
@@ -712,6 +772,68 @@ namespace CodeWalker.Peds
private void ClearCombo(ComboBox c)
{
c.Items.Clear();
c.Text = string.Empty;
}
private void PopulateCompCombo(ComboBox c, MUnk_3538495220 vars)
{
if (vars?.Variations == null) return;
foreach (var item in vars.Variations)
{
c.Items.Add(item.GetDrawableName());
}
if (vars.Variations.Length > 0)
{
c.SelectedIndex = 0;
}
}
private Drawable GetComponentDrawable(string name)
{
var namel = name.ToLowerInvariant();
MetaHash hash = JenkHash.GenHash(namel);
Drawable d;
if (SelectedPedYdd?.Dict != null)
{
if (SelectedPedYdd.Dict.TryGetValue(hash, out d)) return d;
}
Dictionary<MetaHash, RpfFileEntry> peddict = null;
if (GameFileCache.PedDrawableDicts.TryGetValue(SelectedPedHash, out peddict))
{
RpfFileEntry file = null;
if (peddict.TryGetValue(hash, out file))
{
var ydd = GameFileCache.GetFileUncached<YddFile>(file);
while ((ydd != null) && (!ydd.Loaded))
{
Thread.Sleep(20);//kinda hacky
GameFileCache.TryLoadEnqueue(ydd);
}
if (ydd?.Drawables?.Length > 0)
{
return ydd.Drawables[0];//should only be one in this dict
}
}
}
return null;
}
private void UpdateTimeOfDayLabel()
{
int v = TimeOfDayTrackBar.Value;
@@ -889,31 +1011,26 @@ namespace CodeWalker.Peds
private void RenderPed()
{
//YftFile yft = GameFileCache.GetYft(SelectedModelHash);
//if (yft != null)
//{
// if (yft.Loaded)
// {
// if (yft.Fragment != null)
// {
// var f = yft.Fragment;
YftFile yft = SelectedPedYft;// GameFileCache.GetYft(SelectedModelHash);
if (yft != null)
{
if (yft.Loaded)
{
if (yft.Fragment != null)
{
var f = yft.Fragment;
// var txdhash = SelectedVehicleHash;// yft.RpfFileEntry?.ShortNameHash ?? 0;
var txdhash = 0u;// SelectedVehicleHash;// yft.RpfFileEntry?.ShortNameHash ?? 0;
//var namelower = yft.RpfFileEntry?.GetShortNameLower();
// var namelower = yft.RpfFileEntry?.GetShortNameLower();
// if (namelower?.EndsWith("_hi") ?? false)
// {
// txdhash = JenkHash.GenHash(namelower.Substring(0, namelower.Length - 3));
// }
Archetype arch = null;// TryGetArchetype(hash);
// Archetype arch = null;// TryGetArchetype(hash);
Renderer.RenderFragment(arch, null, f, txdhash);
// Renderer.RenderFragment(arch, null, f, txdhash);
// //seldrwbl = f.Drawable;
// }
// }
//}
//seldrwbl = f.Drawable;
}
}
}
}
@@ -1413,5 +1530,75 @@ namespace CodeWalker.Peds
private void PedNameComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (!GameFileCache.IsInited) return;
LoadPed();
}
private void CompHeadComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHead = GetComponentDrawable(CompHeadComboBox.Text);
}
private void CompBerdComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedBerd = GetComponentDrawable(CompBerdComboBox.Text);
}
private void CompHairComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHair = GetComponentDrawable(CompHairComboBox.Text);
}
private void CompUpprComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedUppr = GetComponentDrawable(CompUpprComboBox.Text);
}
private void CompLowrComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedLowr = GetComponentDrawable(CompLowrComboBox.Text);
}
private void CompHandComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedHand = GetComponentDrawable(CompHandComboBox.Text);
}
private void CompFeetComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedFeet = GetComponentDrawable(CompFeetComboBox.Text);
}
private void CompTeefComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedTeef = GetComponentDrawable(CompTeefComboBox.Text);
}
private void CompAccsComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedAccs = GetComponentDrawable(CompAccsComboBox.Text);
}
private void CompTaskComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedTask = GetComponentDrawable(CompTaskComboBox.Text);
}
private void CompDeclComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedDecl = GetComponentDrawable(CompDeclComboBox.Text);
}
private void CompJbibComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
SelectedJbib = GetComponentDrawable(CompJbibComboBox.Text);
}
}
}