-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Cleans up UOP file handling. Adds automatic bounds.bin generation #1744
Conversation
516e6d8
to
2baacfe
Compare
2baacfe
to
eceb730
Compare
return xMax switch | ||
{ | ||
// If no non-black pixels were found, return an empty rectangle | ||
-1 => Rectangle2D.Empty, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that in RunUO/ServUO, this value is [0, 0, 0xFFFF, 0xFFFF]
. Intentionally different here. if the entire pic is black, there are no bounds, so we can keep it as all 00's. This also allows us to easily detect "empty" or "missing" entries without a validation structure.
private void ConvertToMapEntries(FileStream stream) | ||
{ | ||
// Sorting by offset to make seeking faster | ||
Array.Sort(_uopMapEntries, (a, b) => a.Offset.CompareTo(b.Offset)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only doable because I don't think the hashed file name order is important. I also don't think those files match the order field in the data block.
TODO: In the future we can memory map this and get good performance and wouldn't need the sort.
It allows for easy access to art dimensions and real bounds based on the pixel transparency.
Used for dynamically sized gumps and stuff.
Code is rough on the edges since it's almost untouched ServUO code, but System.Drawing.Imaging references are gone.
Tested and gives exactly the same results as original ServUO code.