Custom resources for loading menu titles and information, as well as loading menu visuals and images#31
Custom resources for loading menu titles and information, as well as loading menu visuals and images#31alfvy wants to merge 7 commits intoinfernoplus:mainfrom
Conversation
…s and information, and loading menu visuals
|
I don't really want to review this PR until your other one is merged @alfvy as it has significant overlap and is a bit confusing which pieces are new to this PR. |
| } | ||
|
|
||
| menu = LoadMsgBnd(Utility.ResourcePath(@"text\menu_dlc02.msgbnd.dcx")); | ||
| menu = LoadMsgBnd($"{Const.ELDEN_PATH}Game\\msg\\engus\\menu.msgbnd.dcx"); |
JortPob/TextManager.cs
Outdated
| public int AddChoice(string text) | ||
| { | ||
| foreach(FMG.Entry entry in menu[TextType.EventTextForTalk].Entries) | ||
| foreach(FMG.Entry entry in menuDlc[TextType.EventTextForTalk].Entries) |
There was a problem hiding this comment.
Can be simplified with .First
There was a problem hiding this comment.
And the other functions in the file doing the same pattern should also use First instead of foreach.
| { | ||
| int id = nextMenuId++; | ||
| FMG fmg = menu[TextType.GR_MenuText]; | ||
| FMG fmg = menuDlc[TextType.GR_MenuText]; |
There was a problem hiding this comment.
Just do menuDlc[TextType.GR_MenuText].entries.Add(...) instead of having the fmg variable.
JortPob/MenuTextureManager.cs
Outdated
| (var hiBxf, var lowBxf) = icon.Write(); | ||
| images.Write(hiBxf, lowBxf); | ||
|
|
||
| hiBxf.Write($"{Const.OUTPUT_PATH}menu\\hi\\00_solo.tpfbhd", $"{Const.OUTPUT_PATH}menu\\hi\\00_solo.tpfbdt"); |
There was a problem hiding this comment.
Path.Combine and @. With the amount that Path joins are done with OUTPUT_PATH, it might be worth creating a helper method to reduce duplication in case we need to change any formatting in the future.
JortPob/LoadingImagesManager.cs
Outdated
| var tpf = new TPF(); | ||
| var texture = new TPF.Texture(); | ||
|
|
||
| var fileName = file.Name.Split('.')[0].Split('\\')[1]; |
There was a problem hiding this comment.
Would Path.GetFileName work here or are there multiple periods before the extension? If there are multiple path separators I think this would include everything after the first one.
There was a problem hiding this comment.
this is the path pulled directly from the bxf, its not a standard path, and has some internal engine shenanigans associated
JortPob/LoadingImagesManager.cs
Outdated
| .Where(f => f.Name.ToLower().Contains("menu_load") && !f.Name.ToLower().Contains("ps5")) | ||
| .ToList(); | ||
|
|
||
| foreach (var file in lowFiles) |
There was a problem hiding this comment.
Since this logic is exactly the same as above just with lowFiles instead of hiFiles, I suggest moving the logic to a private helper function to reduce duplication.
| return (hiBxf, lowBxf); | ||
| } | ||
|
|
||
| public void Dispose() |
There was a problem hiding this comment.
if IconInfo or BuffInfo aren't actually disposable types then there isn't benefit to implementing IDisposable here. Counterintuitively, setting collections to null can sometimes delay their GC cleanup due to funky .NET things.
There was a problem hiding this comment.
I have 0 idea how either works tbh, if they're made to be disposable, then disposable they are
| { | ||
| public readonly List<IconInfo> icons; | ||
| public readonly List<BuffInfo> buffs; | ||
| public List<IconInfo> icons { get; private set; } |
There was a problem hiding this comment.
Should use init instead of private set if these are still just being initialized in the constructor.
| } | ||
| } | ||
|
|
||
| // source: trust me bro |
There was a problem hiding this comment.
Can you provide a source for this? Not that I don't trust you, but we aren't actually running a game so using the slower, but more accurate, power methods is likely preferable.
There was a problem hiding this comment.
The accuracy difference is about 1 in 4 thousand decimal places, so very very tiny, and it's an almost 20x speed up, this is my source: https://martin.ankerl.com/2007/10/04/optimized-pow-approximation-for-java-and-c-c/
There was a problem hiding this comment.
All good, just wondering what dark magic you were incanting.
horfius
left a comment
There was a problem hiding this comment.
This looks much cleaner than before. Only one actual error I can see although some of the other cleanup would be nice, but optional.
| loadingTitleFmg.Entries.Clear(); | ||
| loadingTextFmg.Entries.Clear(); | ||
|
|
||
| int id = 1; |
There was a problem hiding this comment.
You forgot to increment this per loop.
these are pretty simple, since there's already ways to write custom param rows, meaning that there can be more than what came with the base game,
as well as writing to the hi/solo and low/solo files in the icon manager, but those are limited to 34 as far I know