Vehicle viewer progress

This commit is contained in:
dexy 2019-01-13 17:04:32 +11:00
parent 719631580c
commit 187f8379cd
8 changed files with 515 additions and 72 deletions

View File

@ -37,9 +37,9 @@ namespace CodeWalker.GameFiles
{ {
Fragment.Drawable.Owner = this; Fragment.Drawable.Owner = this;
} }
if (Fragment.Unknown_F8h_Data != null) if (Fragment.Drawable2 != null)
{ {
Fragment.Unknown_F8h_Data.Owner = this; Fragment.Drawable2.Owner = this;
} }
Loaded = true; Loaded = true;

View File

@ -1373,6 +1373,8 @@ namespace CodeWalker.GameFiles
public void InitStringDicts() public void InitStringDicts()
{ {
string langstr = "american_rel"; //todo: make this variable? string langstr = "american_rel"; //todo: make this variable?
string langstr2 = "americandlc.rpf";
string langstr3 = "american.rpf";
if (!DoFullStringIndex) if (!DoFullStringIndex)
{ {
@ -1395,7 +1397,8 @@ namespace CodeWalker.GameFiles
{ {
foreach (var entry in rpf.AllEntries) foreach (var entry in rpf.AllEntries)
{ {
if (entry.NameLower.EndsWith(".gxt2") && entry.Path.Contains(langstr)) var p = entry.Path;
if (entry.NameLower.EndsWith(".gxt2") && (p.Contains(langstr)|| p.Contains(langstr2)|| p.Contains(langstr3)))
{ {
var gxt2 = RpfMan.GetFile<Gxt2File>(entry); var gxt2 = RpfMan.GetFile<Gxt2File>(entry);
if (gxt2 != null) if (gxt2 != null)
@ -2634,6 +2637,12 @@ namespace CodeWalker.GameFiles
diffpsos.Add(fentry.Path); diffpsos.Add(fentry.Path);
} }
if (entry.NameLower == "wantedtuning.ymt")
{ }
if (entry.NameLower == "popgroups.ymt")
{ }
} }
} }
} }

View File

@ -654,6 +654,8 @@ namespace CodeWalker.GameFiles
var list = new List<uint>(); var list = new List<uint>();
var mloarch = Owner?.Archetype as MloArchetype; var mloarch = Owner?.Archetype as MloArchetype;
if (mloarch?.entitySets != null)
{
for (uint i = 0; i < mloarch.entitySets.Length; i++) for (uint i = 0; i < mloarch.entitySets.Length; i++)
{ {
var entset = mloarch.entitySets[i]; var entset = mloarch.entitySets[i];
@ -667,6 +669,7 @@ namespace CodeWalker.GameFiles
} }
} }
} }
}
defaultEntitySets = list.ToArray(); defaultEntitySets = list.ToArray();
} }

View File

@ -96,7 +96,7 @@ namespace CodeWalker.GameFiles
public uint Unknown_E8h { get; set; } // 0x00000000 public uint Unknown_E8h { get; set; } // 0x00000000
public uint Unknown_ECh { get; set; } // 0x00000000 public uint Unknown_ECh { get; set; } // 0x00000000
public ulong PhysicsLODGroupPointer { get; set; } public ulong PhysicsLODGroupPointer { get; set; }
public ulong Unknown_F8h_Pointer { get; set; } public ulong Drawable2Pointer { get; set; }
public uint Unknown_100h { get; set; } // 0x00000000 public uint Unknown_100h { get; set; } // 0x00000000
public uint Unknown_104h { get; set; } // 0x00000000 public uint Unknown_104h { get; set; } // 0x00000000
public uint Unknown_108h { get; set; } // 0x00000000 public uint Unknown_108h { get; set; } // 0x00000000
@ -116,7 +116,7 @@ namespace CodeWalker.GameFiles
public FragUnknown_F_004 Unknown_A8h_Data { get; set; } public FragUnknown_F_004 Unknown_A8h_Data { get; set; }
public ResourcePointerArray64<FragUnknown_F_006> Unknown_E0h_Data { get; set; } public ResourcePointerArray64<FragUnknown_F_006> Unknown_E0h_Data { get; set; }
public FragPhysicsLODGroup PhysicsLODGroup { get; set; } public FragPhysicsLODGroup PhysicsLODGroup { get; set; }
public FragDrawable Unknown_F8h_Data { get; set; } public FragDrawable Drawable2 { get; set; }
public FragUnknown_F_003 Unknown_120h_Data { get; set; } public FragUnknown_F_003 Unknown_120h_Data { get; set; }
/// <summary> /// <summary>
@ -177,7 +177,7 @@ namespace CodeWalker.GameFiles
this.Unknown_E8h = reader.ReadUInt32(); this.Unknown_E8h = reader.ReadUInt32();
this.Unknown_ECh = reader.ReadUInt32(); this.Unknown_ECh = reader.ReadUInt32();
this.PhysicsLODGroupPointer = reader.ReadUInt64(); this.PhysicsLODGroupPointer = reader.ReadUInt64();
this.Unknown_F8h_Pointer = reader.ReadUInt64(); this.Drawable2Pointer = reader.ReadUInt64();
this.Unknown_100h = reader.ReadUInt32(); this.Unknown_100h = reader.ReadUInt32();
this.Unknown_104h = reader.ReadUInt32(); this.Unknown_104h = reader.ReadUInt32();
this.Unknown_108h = reader.ReadUInt32(); this.Unknown_108h = reader.ReadUInt32();
@ -230,12 +230,12 @@ namespace CodeWalker.GameFiles
this.PhysicsLODGroup = reader.ReadBlockAt<FragPhysicsLODGroup>( this.PhysicsLODGroup = reader.ReadBlockAt<FragPhysicsLODGroup>(
this.PhysicsLODGroupPointer // offset this.PhysicsLODGroupPointer // offset
); );
this.Unknown_F8h_Data = reader.ReadBlockAt<FragDrawable>( this.Drawable2 = reader.ReadBlockAt<FragDrawable>(
this.Unknown_F8h_Pointer // offset this.Drawable2Pointer // offset
); );
if (this.Unknown_F8h_Data != null) if (this.Drawable2 != null)
{ {
this.Unknown_F8h_Data.OwnerFragment = this; this.Drawable2.OwnerFragment = this;
} }
this.Unknown_120h_Data = reader.ReadBlockAt<FragUnknown_F_003>( this.Unknown_120h_Data = reader.ReadBlockAt<FragUnknown_F_003>(
@ -283,7 +283,7 @@ namespace CodeWalker.GameFiles
//this.anotherCount = (byte)(this.pxxxxx_3data != null ? this.pxxxxx_3data.Count : 0); //this.anotherCount = (byte)(this.pxxxxx_3data != null ? this.pxxxxx_3data.Count : 0);
this.Unknown_E0h_Pointer = (ulong)(this.Unknown_E0h_Data != null ? this.Unknown_E0h_Data.FilePosition : 0); this.Unknown_E0h_Pointer = (ulong)(this.Unknown_E0h_Data != null ? this.Unknown_E0h_Data.FilePosition : 0);
this.PhysicsLODGroupPointer = (ulong)(this.PhysicsLODGroup != null ? this.PhysicsLODGroup.FilePosition : 0); this.PhysicsLODGroupPointer = (ulong)(this.PhysicsLODGroup != null ? this.PhysicsLODGroup.FilePosition : 0);
this.Unknown_F8h_Pointer = (ulong)(this.Unknown_F8h_Data != null ? this.Unknown_F8h_Data.FilePosition : 0); this.Drawable2Pointer = (ulong)(this.Drawable2 != null ? this.Drawable2.FilePosition : 0);
//this.cntxx51a = (ushort)(this.pxxxxx_5data != null ? this.pxxxxx_5data.Count : 0); //this.cntxx51a = (ushort)(this.pxxxxx_5data != null ? this.pxxxxx_5data.Count : 0);
this.Unknown_120h_Pointer = (ulong)(this.Unknown_120h_Data != null ? this.Unknown_120h_Data.FilePosition : 0); this.Unknown_120h_Pointer = (ulong)(this.Unknown_120h_Data != null ? this.Unknown_120h_Data.FilePosition : 0);
@ -338,7 +338,7 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_E8h); writer.Write(this.Unknown_E8h);
writer.Write(this.Unknown_ECh); writer.Write(this.Unknown_ECh);
writer.Write(this.PhysicsLODGroupPointer); writer.Write(this.PhysicsLODGroupPointer);
writer.Write(this.Unknown_F8h_Pointer); writer.Write(this.Drawable2Pointer);
writer.Write(this.Unknown_100h); writer.Write(this.Unknown_100h);
writer.Write(this.Unknown_104h); writer.Write(this.Unknown_104h);
writer.Write(this.Unknown_108h); writer.Write(this.Unknown_108h);
@ -362,7 +362,7 @@ namespace CodeWalker.GameFiles
if (Unknown_A8h_Data != null) list.Add(Unknown_A8h_Data); if (Unknown_A8h_Data != null) list.Add(Unknown_A8h_Data);
if (Unknown_E0h_Data != null) list.Add(Unknown_E0h_Data); if (Unknown_E0h_Data != null) list.Add(Unknown_E0h_Data);
if (PhysicsLODGroup != null) list.Add(PhysicsLODGroup); if (PhysicsLODGroup != null) list.Add(PhysicsLODGroup);
if (Unknown_F8h_Data != null) list.Add(Unknown_F8h_Data); if (Drawable2 != null) list.Add(Drawable2);
if (Unknown_120h_Data != null) list.Add(Unknown_120h_Data); if (Unknown_120h_Data != null) list.Add(Unknown_120h_Data);
return list.ToArray(); return list.ToArray();
} }
@ -2451,6 +2451,14 @@ namespace CodeWalker.GameFiles
var child = Children.data_items[i]; var child = Children.data_items[i];
child.OwnerFragPhysLod = this; child.OwnerFragPhysLod = this;
child.OwnerFragPhysIndex = i; child.OwnerFragPhysIndex = i;
if ((Groups?.data_items != null) && (i < Groups.data_items.Length))
{
var group = Groups.data_items[i];
var str = group.Name.ToString().ToLowerInvariant();
JenkIndex.Ensure(str);
child.GroupNameHash = JenkHash.GenHash(str);
}
} }
} }
} }
@ -3350,7 +3358,8 @@ namespace CodeWalker.GameFiles
public uint Unknown_04h { get; set; } // 0x00000001 public uint Unknown_04h { get; set; } // 0x00000001
public float Unknown_08h { get; set; } public float Unknown_08h { get; set; }
public float Unknown_0Ch { get; set; } public float Unknown_0Ch { get; set; }
public float Unknown_10h { get; set; } public ushort BoneIndex { get; set; }
public ushort BoneTag { get; set; }
public uint Unknown_14h { get; set; } // 0x00000000 public uint Unknown_14h { get; set; } // 0x00000000
public uint Unknown_18h { get; set; } // 0x00000000 public uint Unknown_18h { get; set; } // 0x00000000
public uint Unknown_1Ch { get; set; } // 0x00000000 public uint Unknown_1Ch { get; set; } // 0x00000000
@ -3417,6 +3426,7 @@ namespace CodeWalker.GameFiles
public FragPhysicsLOD OwnerFragPhysLod { get; set; } public FragPhysicsLOD OwnerFragPhysLod { get; set; }
public int OwnerFragPhysIndex { get; set; } public int OwnerFragPhysIndex { get; set; }
public MetaHash GroupNameHash { get; set; }
/// <summary> /// <summary>
/// Reads the data-block from a stream. /// Reads the data-block from a stream.
@ -3428,7 +3438,8 @@ namespace CodeWalker.GameFiles
this.Unknown_04h = reader.ReadUInt32(); this.Unknown_04h = reader.ReadUInt32();
this.Unknown_08h = reader.ReadSingle(); this.Unknown_08h = reader.ReadSingle();
this.Unknown_0Ch = reader.ReadSingle(); this.Unknown_0Ch = reader.ReadSingle();
this.Unknown_10h = reader.ReadSingle(); this.BoneIndex = reader.ReadUInt16();
this.BoneTag = reader.ReadUInt16();
this.Unknown_14h = reader.ReadUInt32(); this.Unknown_14h = reader.ReadUInt32();
this.Unknown_18h = reader.ReadUInt32(); this.Unknown_18h = reader.ReadUInt32();
this.Unknown_1Ch = reader.ReadUInt32(); this.Unknown_1Ch = reader.ReadUInt32();
@ -3523,7 +3534,8 @@ namespace CodeWalker.GameFiles
writer.Write(this.Unknown_04h); writer.Write(this.Unknown_04h);
writer.Write(this.Unknown_08h); writer.Write(this.Unknown_08h);
writer.Write(this.Unknown_0Ch); writer.Write(this.Unknown_0Ch);
writer.Write(this.Unknown_10h); writer.Write(this.BoneIndex);
writer.Write(this.BoneTag);
writer.Write(this.Unknown_14h); writer.Write(this.Unknown_14h);
writer.Write(this.Unknown_18h); writer.Write(this.Unknown_18h);
writer.Write(this.Unknown_1Ch); writer.Write(this.Unknown_1Ch);
@ -3593,6 +3605,12 @@ namespace CodeWalker.GameFiles
if (EvtSet != null) list.Add(EvtSet); if (EvtSet != null) list.Add(EvtSet);
return list.ToArray(); return list.ToArray();
} }
public override string ToString()
{
return GroupNameHash.ToString();
}
} }
[TypeConverter(typeof(ExpandableObjectConverter))] public class FragPhysEvtSet : ResourceSystemBlock [TypeConverter(typeof(ExpandableObjectConverter))] public class FragPhysEvtSet : ResourceSystemBlock
{ {

View File

@ -824,6 +824,30 @@ namespace CodeWalker.Forms
AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false);
AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false);
//AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false); //AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false);
var fdrawable = drawable as FragDrawable;
if (fdrawable != null)
{
var plod1 = fdrawable.OwnerFragment?.PhysicsLODGroup?.PhysicsLOD1;
if ((plod1 != null) && (plod1.Children?.data_items != null))
{
foreach (var child in plod1.Children.data_items)
{
var cdrwbl = child.Drawable1;
if ((cdrwbl != null) && (cdrwbl.AllModels?.Length > 0))
{
if (cdrwbl.Owner is FragDrawable) continue; //it's a copied drawable... eg a wheel
var dname = child.GroupNameHash.ToString();
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsHigh, dname + " - High Detail", true);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsMedium, dname + " - Medium Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsLow, dname + " - Low Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsVeryLow, dname + " - Very Low Detail", false);
}
}
}
}
} }
} }
private void UpdateModelsUI(FragType frag) private void UpdateModelsUI(FragType frag)
@ -845,6 +869,29 @@ namespace CodeWalker.Forms
AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false);
AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false);
//AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false); //AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false);
var fdrawable = drawable as FragDrawable;
if (fdrawable != null)
{
var plod1 = fdrawable.OwnerFragment?.PhysicsLODGroup?.PhysicsLOD1;
if ((plod1 != null) && (plod1.Children?.data_items != null))
{
foreach (var child in plod1.Children.data_items)
{
var cdrwbl = child.Drawable1;
if ((cdrwbl != null) && (cdrwbl.AllModels?.Length > 0))
{
if (cdrwbl.Owner is FragDrawable) continue; //it's a copied drawable... eg a wheel
var dname = child.GroupNameHash.ToString();
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsHigh, dname + " - High Detail", true);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsMedium, dname + " - Medium Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsLow, dname + " - Low Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsVeryLow, dname + " - Very Low Detail", false);
}
}
}
}
} }
} }
private void UpdateModelsUI(Dictionary<uint, Drawable> dict) private void UpdateModelsUI(Dictionary<uint, Drawable> dict)

View File

@ -2211,23 +2211,59 @@ namespace CodeWalker.Rendering
RenderDrawable(f.Drawable, arch, ent, txdhash); RenderDrawable(f.Drawable, arch, ent, txdhash);
if (f.Unknown_F8h_Data != null) //cloth if (f.Drawable2 != null) //cloth
{ {
RenderDrawable(f.Unknown_F8h_Data, arch, ent, txdhash); RenderDrawable(f.Drawable2, arch, ent, txdhash);
} }
//vehicle wheels... //vehicle wheels...
if ((f.PhysicsLODGroup != null) && (f.PhysicsLODGroup.PhysicsLOD1 != null)) if ((f.PhysicsLODGroup != null) && (f.PhysicsLODGroup.PhysicsLOD1 != null))
{ {
var pl1 = f.PhysicsLODGroup.PhysicsLOD1; var pl1 = f.PhysicsLODGroup.PhysicsLOD1;
if ((pl1.Children != null) && (pl1.Children.data_items != null)) //var groupnames = pl1?.GroupNames?.data_items;
var groups = pl1?.Groups?.data_items;
FragDrawable wheel_f = null;
FragDrawable wheel_r = null;
if (pl1.Children?.data_items != null)
{ {
for (int i = 0; i < pl1.Children.data_items.Length; i++) for (int i = 0; i < pl1.Children.data_items.Length; i++)
{ {
var pch = pl1.Children.data_items[i]; var pch = pl1.Children.data_items[i];
//var groupname = pch.GroupNameHash;
//if ((pl1.Groups?.data_items != null) && (i < pl1.Groups.data_items.Length))
//{
// //var group = pl1.Groups.data_items[i];
//}
if ((pch.Drawable1 != null) && (pch.Drawable1.AllModels.Length != 0)) if ((pch.Drawable1 != null) && (pch.Drawable1.AllModels.Length != 0))
{ {
switch (pch.BoneTag)
{
case 27922: //wheel_lf
case 26418: //wheel_rf
wheel_f = pch.Drawable1;
break;
case 29921: //wheel_lm1
case 29922: //wheel_lm2
case 29923: //wheel_lm3
case 27902: //wheel_lr
case 5857: //wheel_rm1
case 5858: //wheel_rm2
case 5859: //wheel_rm3
case 26398: //wheel_rr
wheel_r = pch.Drawable1;
break;
default:
RenderDrawable(pch.Drawable1, arch, ent, txdhash); RenderDrawable(pch.Drawable1, arch, ent, txdhash);
break;
}
} }
else else
{ } { }
@ -2238,6 +2274,79 @@ namespace CodeWalker.Rendering
else else
{ } { }
} }
if ((wheel_f != null) || (wheel_r != null))
{
for (int i = 0; i < pl1.Children.data_items.Length; i++)
{
var pch = pl1.Children.data_items[i];
FragDrawable dwbl = pch.Drawable1;
FragDrawable dwblcopy = null;
switch (pch.BoneTag)
{
case 27922: //wheel_lf
case 26418: //wheel_rf
dwblcopy = wheel_f != null ? wheel_f : wheel_r;
break;
case 29921: //wheel_lm1
case 29922: //wheel_lm2
case 29923: //wheel_lm3
case 27902: //wheel_lr
case 5857: //wheel_rm1
case 5858: //wheel_rm2
case 5859: //wheel_rm3
case 26398: //wheel_rr
dwblcopy = wheel_r != null ? wheel_r : wheel_f;
break;
default:
break;
}
//switch (pch.GroupNameHash)
//{
// case 3311608449: //wheel_lf
// case 1705452237: //wheel_lm1
// case 1415282742: //wheel_lm2
// case 3392433122: //wheel_lm3
// case 133671269: //wheel_rf
// case 2908525601: //wheel_rm1
// case 2835549038: //wheel_rm2
// case 4148013026: //wheel_rm3
// dwblcopy = wheel_f != null ? wheel_f : wheel_r;
// break;
// case 1695736278: //wheel_lr
// case 1670111368: //wheel_rr
// dwblcopy = wheel_r != null ? wheel_r : wheel_f;
// break;
// default:
// break;
//}
if (dwblcopy != null)
{
if (dwbl != null)
{
if ((dwbl != dwblcopy) && (dwbl.AllModels.Length == 0))
{
dwbl.Owner = dwblcopy;
dwbl.AllModels = dwblcopy.AllModels;
dwbl.DrawableModelsHigh = dwblcopy.DrawableModelsHigh;
dwbl.DrawableModelsMedium = dwblcopy.DrawableModelsMedium;
dwbl.DrawableModelsLow = dwblcopy.DrawableModelsLow;
dwbl.DrawableModelsVeryLow = dwblcopy.DrawableModelsVeryLow;
dwbl.VertexDecls = dwblcopy.VertexDecls;
}
RenderDrawable(dwbl, arch, ent, txdhash);
}
else
{ }
}
else
{ }
}
}
} }
} }
@ -2321,9 +2430,9 @@ namespace CodeWalker.Rendering
if (fd != null) if (fd != null)
{ {
var frag = fd.OwnerFragment; var frag = fd.OwnerFragment;
if ((frag != null) && (frag.Unknown_F8h_Data != null)) //cloth... if ((frag != null) && (frag.Drawable2 != null)) //cloth...
{ {
rndbl = TryGetRenderable(arche, frag.Unknown_F8h_Data); rndbl = TryGetRenderable(arche, frag.Drawable2);
if (rndbl != null) if (rndbl != null)
{ {
bool res2 = RenderRenderable(rndbl, arche, entity); bool res2 = RenderRenderable(rndbl, arche, entity);

View File

@ -37,7 +37,11 @@
this.StatsUpdateTimer = new System.Windows.Forms.Timer(this.components); this.StatsUpdateTimer = new System.Windows.Forms.Timer(this.components);
this.ToolsPanel = new System.Windows.Forms.Panel(); this.ToolsPanel = new System.Windows.Forms.Panel();
this.ToolsTabControl = new System.Windows.Forms.TabControl(); this.ToolsTabControl = new System.Windows.Forms.TabControl();
this.ToolsVehicleTabPage = new System.Windows.Forms.TabPage();
this.label3 = new System.Windows.Forms.Label();
this.VehicleModelComboBox = new System.Windows.Forms.ComboBox();
this.ToolsModelsTabPage = new System.Windows.Forms.TabPage(); this.ToolsModelsTabPage = new System.Windows.Forms.TabPage();
this.ModelsTreeView = new CodeWalker.WinForms.TreeViewFix();
this.ToolsTexturesTabPage = new System.Windows.Forms.TabPage(); this.ToolsTexturesTabPage = new System.Windows.Forms.TabPage();
this.TextureViewerButton = new System.Windows.Forms.Button(); this.TextureViewerButton = new System.Windows.Forms.Button();
this.TexturesTreeView = new CodeWalker.WinForms.TreeViewFix(); this.TexturesTreeView = new CodeWalker.WinForms.TreeViewFix();
@ -71,13 +75,18 @@
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.ToolsPanelHideButton = new System.Windows.Forms.Button(); this.ToolsPanelHideButton = new System.Windows.Forms.Button();
this.ToolsDragPanel = new System.Windows.Forms.Panel(); this.ToolsDragPanel = new System.Windows.Forms.Panel();
this.ModelsTreeView = new CodeWalker.WinForms.TreeViewFix();
this.ToolsPanelShowButton = new System.Windows.Forms.Button(); this.ToolsPanelShowButton = new System.Windows.Forms.Button();
this.ConsolePanel = new System.Windows.Forms.Panel(); this.ConsolePanel = new System.Windows.Forms.Panel();
this.ConsoleTextBox = new CodeWalker.WinForms.TextBoxFix(); this.ConsoleTextBox = new CodeWalker.WinForms.TextBoxFix();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.VehicleMakeLabel = new System.Windows.Forms.Label();
this.VehicleNameLabel = new System.Windows.Forms.Label();
this.VehicleHighDetailCheckBox = new System.Windows.Forms.CheckBox();
this.StatusStrip.SuspendLayout(); this.StatusStrip.SuspendLayout();
this.ToolsPanel.SuspendLayout(); this.ToolsPanel.SuspendLayout();
this.ToolsTabControl.SuspendLayout(); this.ToolsTabControl.SuspendLayout();
this.ToolsVehicleTabPage.SuspendLayout();
this.ToolsModelsTabPage.SuspendLayout(); this.ToolsModelsTabPage.SuspendLayout();
this.ToolsTexturesTabPage.SuspendLayout(); this.ToolsTexturesTabPage.SuspendLayout();
this.ToolsDetailsTabPage.SuspendLayout(); this.ToolsDetailsTabPage.SuspendLayout();
@ -138,7 +147,7 @@
this.ToolsPanel.Controls.Add(this.ToolsDragPanel); this.ToolsPanel.Controls.Add(this.ToolsDragPanel);
this.ToolsPanel.Location = new System.Drawing.Point(12, 12); this.ToolsPanel.Location = new System.Drawing.Point(12, 12);
this.ToolsPanel.Name = "ToolsPanel"; this.ToolsPanel.Name = "ToolsPanel";
this.ToolsPanel.Size = new System.Drawing.Size(233, 666); this.ToolsPanel.Size = new System.Drawing.Size(252, 666);
this.ToolsPanel.TabIndex = 3; this.ToolsPanel.TabIndex = 3;
this.ToolsPanel.Visible = false; this.ToolsPanel.Visible = false;
// //
@ -147,6 +156,7 @@
this.ToolsTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.ToolsTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.ToolsTabControl.Controls.Add(this.ToolsVehicleTabPage);
this.ToolsTabControl.Controls.Add(this.ToolsModelsTabPage); this.ToolsTabControl.Controls.Add(this.ToolsModelsTabPage);
this.ToolsTabControl.Controls.Add(this.ToolsTexturesTabPage); this.ToolsTabControl.Controls.Add(this.ToolsTexturesTabPage);
this.ToolsTabControl.Controls.Add(this.ToolsDetailsTabPage); this.ToolsTabControl.Controls.Add(this.ToolsDetailsTabPage);
@ -154,20 +164,73 @@
this.ToolsTabControl.Location = new System.Drawing.Point(2, 30); this.ToolsTabControl.Location = new System.Drawing.Point(2, 30);
this.ToolsTabControl.Name = "ToolsTabControl"; this.ToolsTabControl.Name = "ToolsTabControl";
this.ToolsTabControl.SelectedIndex = 0; this.ToolsTabControl.SelectedIndex = 0;
this.ToolsTabControl.Size = new System.Drawing.Size(228, 633); this.ToolsTabControl.Size = new System.Drawing.Size(247, 633);
this.ToolsTabControl.TabIndex = 1; this.ToolsTabControl.TabIndex = 1;
// //
// ToolsVehicleTabPage
//
this.ToolsVehicleTabPage.Controls.Add(this.VehicleHighDetailCheckBox);
this.ToolsVehicleTabPage.Controls.Add(this.VehicleNameLabel);
this.ToolsVehicleTabPage.Controls.Add(this.VehicleMakeLabel);
this.ToolsVehicleTabPage.Controls.Add(this.label5);
this.ToolsVehicleTabPage.Controls.Add(this.label4);
this.ToolsVehicleTabPage.Controls.Add(this.label3);
this.ToolsVehicleTabPage.Controls.Add(this.VehicleModelComboBox);
this.ToolsVehicleTabPage.Location = new System.Drawing.Point(4, 22);
this.ToolsVehicleTabPage.Name = "ToolsVehicleTabPage";
this.ToolsVehicleTabPage.Size = new System.Drawing.Size(239, 607);
this.ToolsVehicleTabPage.TabIndex = 4;
this.ToolsVehicleTabPage.Text = "Vehicle";
this.ToolsVehicleTabPage.UseVisualStyleBackColor = true;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 11);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(39, 13);
this.label3.TabIndex = 1;
this.label3.Text = "Model:";
//
// VehicleModelComboBox
//
this.VehicleModelComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.VehicleModelComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.VehicleModelComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.VehicleModelComboBox.FormattingEnabled = true;
this.VehicleModelComboBox.Location = new System.Drawing.Point(54, 8);
this.VehicleModelComboBox.Name = "VehicleModelComboBox";
this.VehicleModelComboBox.Size = new System.Drawing.Size(182, 21);
this.VehicleModelComboBox.TabIndex = 0;
this.VehicleModelComboBox.TextChanged += new System.EventHandler(this.VehicleModelComboBox_TextChanged);
//
// ToolsModelsTabPage // ToolsModelsTabPage
// //
this.ToolsModelsTabPage.Controls.Add(this.ModelsTreeView); this.ToolsModelsTabPage.Controls.Add(this.ModelsTreeView);
this.ToolsModelsTabPage.Location = new System.Drawing.Point(4, 22); this.ToolsModelsTabPage.Location = new System.Drawing.Point(4, 22);
this.ToolsModelsTabPage.Name = "ToolsModelsTabPage"; this.ToolsModelsTabPage.Name = "ToolsModelsTabPage";
this.ToolsModelsTabPage.Padding = new System.Windows.Forms.Padding(3); this.ToolsModelsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.ToolsModelsTabPage.Size = new System.Drawing.Size(220, 607); this.ToolsModelsTabPage.Size = new System.Drawing.Size(239, 607);
this.ToolsModelsTabPage.TabIndex = 0; this.ToolsModelsTabPage.TabIndex = 0;
this.ToolsModelsTabPage.Text = "Models"; this.ToolsModelsTabPage.Text = "Models";
this.ToolsModelsTabPage.UseVisualStyleBackColor = true; this.ToolsModelsTabPage.UseVisualStyleBackColor = true;
// //
// ModelsTreeView
//
this.ModelsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ModelsTreeView.CheckBoxes = true;
this.ModelsTreeView.Location = new System.Drawing.Point(0, 3);
this.ModelsTreeView.Name = "ModelsTreeView";
this.ModelsTreeView.ShowRootLines = false;
this.ModelsTreeView.Size = new System.Drawing.Size(239, 604);
this.ModelsTreeView.TabIndex = 2;
this.ModelsTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.ModelsTreeView_AfterCheck);
this.ModelsTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.ModelsTreeView_NodeMouseDoubleClick);
this.ModelsTreeView.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ModelsTreeView_KeyPress);
//
// ToolsTexturesTabPage // ToolsTexturesTabPage
// //
this.ToolsTexturesTabPage.Controls.Add(this.TextureViewerButton); this.ToolsTexturesTabPage.Controls.Add(this.TextureViewerButton);
@ -175,7 +238,7 @@
this.ToolsTexturesTabPage.Location = new System.Drawing.Point(4, 22); this.ToolsTexturesTabPage.Location = new System.Drawing.Point(4, 22);
this.ToolsTexturesTabPage.Name = "ToolsTexturesTabPage"; this.ToolsTexturesTabPage.Name = "ToolsTexturesTabPage";
this.ToolsTexturesTabPage.Padding = new System.Windows.Forms.Padding(3); this.ToolsTexturesTabPage.Padding = new System.Windows.Forms.Padding(3);
this.ToolsTexturesTabPage.Size = new System.Drawing.Size(220, 607); this.ToolsTexturesTabPage.Size = new System.Drawing.Size(239, 607);
this.ToolsTexturesTabPage.TabIndex = 1; this.ToolsTexturesTabPage.TabIndex = 1;
this.ToolsTexturesTabPage.Text = "Textures"; this.ToolsTexturesTabPage.Text = "Textures";
this.ToolsTexturesTabPage.UseVisualStyleBackColor = true; this.ToolsTexturesTabPage.UseVisualStyleBackColor = true;
@ -198,7 +261,7 @@
this.TexturesTreeView.Location = new System.Drawing.Point(0, 34); this.TexturesTreeView.Location = new System.Drawing.Point(0, 34);
this.TexturesTreeView.Name = "TexturesTreeView"; this.TexturesTreeView.Name = "TexturesTreeView";
this.TexturesTreeView.ShowRootLines = false; this.TexturesTreeView.ShowRootLines = false;
this.TexturesTreeView.Size = new System.Drawing.Size(220, 573); this.TexturesTreeView.Size = new System.Drawing.Size(239, 573);
this.TexturesTreeView.TabIndex = 1; this.TexturesTreeView.TabIndex = 1;
// //
// ToolsDetailsTabPage // ToolsDetailsTabPage
@ -206,7 +269,7 @@
this.ToolsDetailsTabPage.Controls.Add(this.DetailsPropertyGrid); this.ToolsDetailsTabPage.Controls.Add(this.DetailsPropertyGrid);
this.ToolsDetailsTabPage.Location = new System.Drawing.Point(4, 22); this.ToolsDetailsTabPage.Location = new System.Drawing.Point(4, 22);
this.ToolsDetailsTabPage.Name = "ToolsDetailsTabPage"; this.ToolsDetailsTabPage.Name = "ToolsDetailsTabPage";
this.ToolsDetailsTabPage.Size = new System.Drawing.Size(220, 607); this.ToolsDetailsTabPage.Size = new System.Drawing.Size(239, 607);
this.ToolsDetailsTabPage.TabIndex = 2; this.ToolsDetailsTabPage.TabIndex = 2;
this.ToolsDetailsTabPage.Text = "Details"; this.ToolsDetailsTabPage.Text = "Details";
this.ToolsDetailsTabPage.UseVisualStyleBackColor = true; this.ToolsDetailsTabPage.UseVisualStyleBackColor = true;
@ -221,7 +284,7 @@
this.DetailsPropertyGrid.Name = "DetailsPropertyGrid"; this.DetailsPropertyGrid.Name = "DetailsPropertyGrid";
this.DetailsPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort; this.DetailsPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.DetailsPropertyGrid.ReadOnly = true; this.DetailsPropertyGrid.ReadOnly = true;
this.DetailsPropertyGrid.Size = new System.Drawing.Size(220, 604); this.DetailsPropertyGrid.Size = new System.Drawing.Size(239, 604);
this.DetailsPropertyGrid.TabIndex = 1; this.DetailsPropertyGrid.TabIndex = 1;
this.DetailsPropertyGrid.ToolbarVisible = false; this.DetailsPropertyGrid.ToolbarVisible = false;
// //
@ -254,7 +317,7 @@
this.ToolsOptionsTabPage.Controls.Add(this.label14); this.ToolsOptionsTabPage.Controls.Add(this.label14);
this.ToolsOptionsTabPage.Location = new System.Drawing.Point(4, 22); this.ToolsOptionsTabPage.Location = new System.Drawing.Point(4, 22);
this.ToolsOptionsTabPage.Name = "ToolsOptionsTabPage"; this.ToolsOptionsTabPage.Name = "ToolsOptionsTabPage";
this.ToolsOptionsTabPage.Size = new System.Drawing.Size(220, 607); this.ToolsOptionsTabPage.Size = new System.Drawing.Size(239, 607);
this.ToolsOptionsTabPage.TabIndex = 3; this.ToolsOptionsTabPage.TabIndex = 3;
this.ToolsOptionsTabPage.Text = "Options"; this.ToolsOptionsTabPage.Text = "Options";
this.ToolsOptionsTabPage.UseVisualStyleBackColor = true; this.ToolsOptionsTabPage.UseVisualStyleBackColor = true;
@ -310,7 +373,7 @@
this.TimeOfDayTrackBar.Location = new System.Drawing.Point(9, 125); this.TimeOfDayTrackBar.Location = new System.Drawing.Point(9, 125);
this.TimeOfDayTrackBar.Maximum = 1440; this.TimeOfDayTrackBar.Maximum = 1440;
this.TimeOfDayTrackBar.Name = "TimeOfDayTrackBar"; this.TimeOfDayTrackBar.Name = "TimeOfDayTrackBar";
this.TimeOfDayTrackBar.Size = new System.Drawing.Size(203, 45); this.TimeOfDayTrackBar.Size = new System.Drawing.Size(222, 45);
this.TimeOfDayTrackBar.TabIndex = 6; this.TimeOfDayTrackBar.TabIndex = 6;
this.TimeOfDayTrackBar.TickFrequency = 60; this.TimeOfDayTrackBar.TickFrequency = 60;
this.TimeOfDayTrackBar.Value = 720; this.TimeOfDayTrackBar.Value = 720;
@ -570,7 +633,7 @@
this.ToolsDragPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.ToolsDragPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.ToolsDragPanel.Cursor = System.Windows.Forms.Cursors.VSplit; this.ToolsDragPanel.Cursor = System.Windows.Forms.Cursors.VSplit;
this.ToolsDragPanel.Location = new System.Drawing.Point(230, 0); this.ToolsDragPanel.Location = new System.Drawing.Point(249, 0);
this.ToolsDragPanel.Name = "ToolsDragPanel"; this.ToolsDragPanel.Name = "ToolsDragPanel";
this.ToolsDragPanel.Size = new System.Drawing.Size(4, 666); this.ToolsDragPanel.Size = new System.Drawing.Size(4, 666);
this.ToolsDragPanel.TabIndex = 17; this.ToolsDragPanel.TabIndex = 17;
@ -578,21 +641,6 @@
this.ToolsDragPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ToolsDragPanel_MouseMove); this.ToolsDragPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ToolsDragPanel_MouseMove);
this.ToolsDragPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ToolsDragPanel_MouseUp); this.ToolsDragPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ToolsDragPanel_MouseUp);
// //
// ModelsTreeView
//
this.ModelsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ModelsTreeView.CheckBoxes = true;
this.ModelsTreeView.Location = new System.Drawing.Point(0, 3);
this.ModelsTreeView.Name = "ModelsTreeView";
this.ModelsTreeView.ShowRootLines = false;
this.ModelsTreeView.Size = new System.Drawing.Size(220, 604);
this.ModelsTreeView.TabIndex = 2;
this.ModelsTreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.ModelsTreeView_AfterCheck);
this.ModelsTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.ModelsTreeView_NodeMouseDoubleClick);
this.ModelsTreeView.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ModelsTreeView_KeyPress);
//
// ToolsPanelShowButton // ToolsPanelShowButton
// //
this.ToolsPanelShowButton.Location = new System.Drawing.Point(15, 15); this.ToolsPanelShowButton.Location = new System.Drawing.Point(15, 15);
@ -609,9 +657,9 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.ConsolePanel.BackColor = System.Drawing.SystemColors.Control; this.ConsolePanel.BackColor = System.Drawing.SystemColors.Control;
this.ConsolePanel.Controls.Add(this.ConsoleTextBox); this.ConsolePanel.Controls.Add(this.ConsoleTextBox);
this.ConsolePanel.Location = new System.Drawing.Point(252, 577); this.ConsolePanel.Location = new System.Drawing.Point(271, 577);
this.ConsolePanel.Name = "ConsolePanel"; this.ConsolePanel.Name = "ConsolePanel";
this.ConsolePanel.Size = new System.Drawing.Size(720, 101); this.ConsolePanel.Size = new System.Drawing.Size(701, 101);
this.ConsolePanel.TabIndex = 5; this.ConsolePanel.TabIndex = 5;
this.ConsolePanel.Visible = false; this.ConsolePanel.Visible = false;
// //
@ -624,9 +672,58 @@
this.ConsoleTextBox.Multiline = true; this.ConsoleTextBox.Multiline = true;
this.ConsoleTextBox.Name = "ConsoleTextBox"; this.ConsoleTextBox.Name = "ConsoleTextBox";
this.ConsoleTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.ConsoleTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.ConsoleTextBox.Size = new System.Drawing.Size(714, 95); this.ConsoleTextBox.Size = new System.Drawing.Size(695, 95);
this.ConsoleTextBox.TabIndex = 0; this.ConsoleTextBox.TabIndex = 0;
// //
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 41);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(37, 13);
this.label4.TabIndex = 2;
this.label4.Text = "Make:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(3, 63);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(38, 13);
this.label5.TabIndex = 3;
this.label5.Text = "Name:";
//
// VehicleMakeLabel
//
this.VehicleMakeLabel.AutoSize = true;
this.VehicleMakeLabel.Location = new System.Drawing.Point(51, 41);
this.VehicleMakeLabel.Name = "VehicleMakeLabel";
this.VehicleMakeLabel.Size = new System.Drawing.Size(10, 13);
this.VehicleMakeLabel.TabIndex = 4;
this.VehicleMakeLabel.Text = "-";
//
// VehicleNameLabel
//
this.VehicleNameLabel.AutoSize = true;
this.VehicleNameLabel.Location = new System.Drawing.Point(51, 63);
this.VehicleNameLabel.Name = "VehicleNameLabel";
this.VehicleNameLabel.Size = new System.Drawing.Size(10, 13);
this.VehicleNameLabel.TabIndex = 5;
this.VehicleNameLabel.Text = "-";
//
// VehicleHighDetailCheckBox
//
this.VehicleHighDetailCheckBox.AutoSize = true;
this.VehicleHighDetailCheckBox.Checked = true;
this.VehicleHighDetailCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.VehicleHighDetailCheckBox.Location = new System.Drawing.Point(54, 90);
this.VehicleHighDetailCheckBox.Name = "VehicleHighDetailCheckBox";
this.VehicleHighDetailCheckBox.Size = new System.Drawing.Size(120, 17);
this.VehicleHighDetailCheckBox.TabIndex = 6;
this.VehicleHighDetailCheckBox.Text = "High detail fragment";
this.VehicleHighDetailCheckBox.UseVisualStyleBackColor = true;
this.VehicleHighDetailCheckBox.CheckedChanged += new System.EventHandler(this.VehicleHighDetailCheckBox_CheckedChanged);
//
// VehicleForm // VehicleForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -652,6 +749,8 @@
this.StatusStrip.PerformLayout(); this.StatusStrip.PerformLayout();
this.ToolsPanel.ResumeLayout(false); this.ToolsPanel.ResumeLayout(false);
this.ToolsTabControl.ResumeLayout(false); this.ToolsTabControl.ResumeLayout(false);
this.ToolsVehicleTabPage.ResumeLayout(false);
this.ToolsVehicleTabPage.PerformLayout();
this.ToolsModelsTabPage.ResumeLayout(false); this.ToolsModelsTabPage.ResumeLayout(false);
this.ToolsTexturesTabPage.ResumeLayout(false); this.ToolsTexturesTabPage.ResumeLayout(false);
this.ToolsDetailsTabPage.ResumeLayout(false); this.ToolsDetailsTabPage.ResumeLayout(false);
@ -712,5 +811,13 @@
private System.Windows.Forms.Button ToolsPanelShowButton; private System.Windows.Forms.Button ToolsPanelShowButton;
private System.Windows.Forms.Panel ConsolePanel; private System.Windows.Forms.Panel ConsolePanel;
private WinForms.TextBoxFix ConsoleTextBox; private WinForms.TextBoxFix ConsoleTextBox;
private System.Windows.Forms.TabPage ToolsVehicleTabPage;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox VehicleModelComboBox;
private System.Windows.Forms.Label VehicleNameLabel;
private System.Windows.Forms.Label VehicleMakeLabel;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox VehicleHighDetailCheckBox;
} }
} }

View File

@ -75,6 +75,13 @@ namespace CodeWalker.Vehicles
MetaHash SelectedVehicleHash = 0;//base vehicle name hash
MetaHash SelectedModelHash = 0;//yft name hash, can be _hi
VehicleInitData SelectedVehicleInit = null;
YftFile SelectedVehicleYft = null;
public VehicleForm() public VehicleForm()
@ -181,18 +188,8 @@ namespace CodeWalker.Vehicles
Renderer.SelectedDrawable = null;// SelectedItem.Drawable; Renderer.SelectedDrawable = null;// SelectedItem.Drawable;
//if (renderworld) RenderVehicle();
//{
// RenderWorld();
//}
//else if (rendermaps)
//{
// RenderYmaps();
//}
//else
//{
// RenderSingleItem();
//}
//UpdateMouseHitsFromRenderer(); //UpdateMouseHitsFromRenderer();
//RenderSelection(); //RenderSelection();
@ -292,12 +289,16 @@ namespace CodeWalker.Vehicles
GameFileCache.LoadVehicles = true; GameFileCache.LoadVehicles = true;
GameFileCache.LoadArchetypes = false;//to speed things up a little GameFileCache.LoadArchetypes = false;//to speed things up a little
GameFileCache.BuildExtendedJenkIndex = false;//to speed things up a little GameFileCache.BuildExtendedJenkIndex = false;//to speed things up a little
GameFileCache.DoFullStringIndex = true;//to get all global text from DLC...
GameFileCache.Init(UpdateStatus, LogError); GameFileCache.Init(UpdateStatus, LogError);
//UpdateDlcListComboBox(gameFileCache.DlcNameList); //UpdateDlcListComboBox(gameFileCache.DlcNameList);
//EnableCacheDependentUI(); //EnableCacheDependentUI();
UpdateGlobalVehiclesUI();
LoadWorld(); LoadWorld();
@ -580,6 +581,37 @@ namespace CodeWalker.Vehicles
} }
} }
private void UpdateGlobalVehiclesUI()
{
if (InvokeRequired)
{
BeginInvoke(new Action(() => { UpdateGlobalVehiclesUI(); }));
}
else
{
VehicleModelComboBox.Items.Clear();
var vehicles = GameFileCache.VehiclesInitDict.Values.ToList();
vehicles.Sort((a, b) => { return a.modelName.CompareTo(b.modelName); });
foreach (var vehicle in vehicles)
{
VehicleModelComboBox.Items.Add(vehicle.modelName);
}
if (vehicles.Count > 0)
{
VehicleModelComboBox.SelectedIndex = 0;
}
}
}
private void UpdateModelsUI(DrawableBase drawable) private void UpdateModelsUI(DrawableBase drawable)
{ {
DetailsPropertyGrid.SelectedObject = drawable; DetailsPropertyGrid.SelectedObject = drawable;
@ -597,10 +629,74 @@ namespace CodeWalker.Vehicles
AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsLow, "Low Detail", false);
AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false); AddDrawableModelsTreeNodes(drawable.DrawableModelsVeryLow, "Very Low Detail", false);
//AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false); //AddSelectionDrawableModelsTreeNodes(item.Drawable.DrawableModelsX, "X Detail", false);
var fdrawable = drawable as FragDrawable;
if (fdrawable != null)
{
var plod1 = fdrawable.OwnerFragment?.PhysicsLODGroup?.PhysicsLOD1;
if ((plod1 != null) && (plod1.Children?.data_items != null))
{
foreach (var child in plod1.Children.data_items)
{
var cdrwbl = child.Drawable1;
if ((cdrwbl != null) && (cdrwbl.AllModels?.Length > 0))
{
if (cdrwbl.Owner is FragDrawable) continue; //it's a copied drawable... eg a wheel
var dname = child.GroupNameHash.ToString();
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsHigh, dname + " - High Detail", true);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsMedium, dname + " - Medium Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsLow, dname + " - Low Detail", false);
AddDrawableModelsTreeNodes(cdrwbl.DrawableModelsVeryLow, dname + " - Very Low Detail", false);
}
}
} }
} }
public void LoadModel(YftFile yft) }
}
public void LoadVehicle()
{
var modelname = VehicleModelComboBox.Text;
var modelnamel = modelname.ToLowerInvariant();
MetaHash modelhash = JenkHash.GenHash(modelnamel);
MetaHash modelhashhi = JenkHash.GenHash(modelnamel + "_hi");
bool hidet = VehicleHighDetailCheckBox.Checked;
var yfthash = hidet ? modelhashhi : modelhash;
VehicleInitData vid = null;
if (GameFileCache.VehiclesInitDict.TryGetValue(modelhash, out vid))
{
bool vehiclechange = SelectedVehicleHash != modelhash;
SelectedModelHash = yfthash;
SelectedVehicleHash = modelhash;
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)
{ {
if (yft == null) return; if (yft == null) return;
@ -608,7 +704,7 @@ namespace CodeWalker.Vehicles
//Yft = yft; //Yft = yft;
var dr = yft.Fragment?.Drawable; var dr = yft.Fragment?.Drawable;
if (dr != null) if (movecamera && (dr != null))
{ {
MoveCameraToView(dr.BoundingCenter, dr.BoundingSphereRadius); MoveCameraToView(dr.BoundingCenter, dr.BoundingSphereRadius);
} }
@ -792,6 +888,44 @@ namespace CodeWalker.Vehicles
private void RenderVehicle()
{
YftFile yft = 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 namelower = yft.RpfFileEntry?.GetShortNameLower();
if (namelower?.EndsWith("_hi") ?? false)
{
txdhash = JenkHash.GenHash(namelower.Substring(0, namelower.Length - 3));
}
Archetype arch = null;// TryGetArchetype(hash);
Renderer.RenderFragment(arch, null, f, txdhash);
//seldrwbl = f.Drawable;
}
}
}
}
private void VehicleForm_Load(object sender, EventArgs e) private void VehicleForm_Load(object sender, EventArgs e)
{ {
Init(); Init();
@ -1275,5 +1409,21 @@ namespace CodeWalker.Vehicles
// MessageBox.Show("Couldn't find embedded texture dict."); // MessageBox.Show("Couldn't find embedded texture dict.");
//} //}
} }
private void VehicleModelComboBox_TextChanged(object sender, EventArgs e)
{
if (!GameFileCache.IsInited) return;
LoadVehicle();
}
private void VehicleHighDetailCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (!GameFileCache.IsInited) return;
LoadVehicle();
}
} }
} }