Skip to content

Commit

Permalink
EQCache works
Browse files Browse the repository at this point in the history
  • Loading branch information
bigianb committed Aug 20, 2021
1 parent df38720 commit fe7bf98
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions WorldExplorer/WorldExplorer/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ public object SelectedNode
{
OnYakChildElementSelected((YakChildTreeViewItem)_selectedNode);
}
else if (_selectedNode is HdrDatChildTreeViewItem)
{
OnHdrDatChildElementSelected((HdrDatChildTreeViewItem)_selectedNode);
}
OnPropertyChanged("SelectedNode");
}
}
Expand Down Expand Up @@ -365,6 +369,31 @@ private void OnYakChildElementSelected(YakChildTreeViewItem childEntry)
_window.SetViewportText(1, childEntry.Text + " of " + ((YakTreeViewItem)childEntry.Parent).Text, "");
}

private void OnHdrDatChildElementSelected(HdrDatChildTreeViewItem childEntry)
{
SelectedNodeImage = TexDecoder.Decode(childEntry.CacheFile.FileData, childEntry.Value.TexOffset);
var log = new StringLogger();
_modelViewModel.Texture = SelectedNodeImage;
_modelViewModel.AnimData = null;
var model = new Model
{
meshList = VifDecoder.Decode(
log,
childEntry.CacheFile.FileData,
childEntry.Value.VifOffset,
childEntry.Value.VifLength,
SelectedNodeImage.PixelWidth,
SelectedNodeImage.PixelHeight)
};
_modelViewModel.VifModel = model;

LogText += log.ToString();

_window.tabControl.SelectedIndex = 1; // Model View
_window.ResetCamera();
_window.SetViewportText(1, childEntry.Text + " of " + ((HdrDatTreeViewItem)childEntry.Parent).Text, "");
}

private List<AnimData> LoadFirstAnim(LmpFile lmpFile)
{
var animList = new List<AnimData>();
Expand Down
2 changes: 1 addition & 1 deletion WorldExplorer/WorldExplorer/TreeView/HdrDatTreeViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected override void LoadChildren()
var i = 0;
foreach (var child in _entry.children)
{
Children.Add(new HdrDatChildTreeViewItem(this, _cacheFile, child, _entry, "Child " + i));
Children.Add(new HdrDatChildTreeViewItem(this, _cacheFile, child, _entry, "Id " + child.id));
++i;
}
}
Expand Down

0 comments on commit fe7bf98

Please sign in to comment.