-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fixes related to square geometry #98
base: master
Are you sure you want to change the base?
Conversation
djempuiw
commented
May 19, 2024
- Fixed loading of ART files with animation
- Fixed pathfinding for square geometry
- Fixed Map rendering for square geometry
- Fixed cursor offset
- Fixed pathfinding for square geometry - Fixed Map rendering for square geometry - Fixed cursor offset
Source/Tools/ImageBaker.cpp
Outdated
@@ -1050,7 +1052,7 @@ auto ImageBaker::LoadArt(string_view fname, string_view opt, File& file) -> Fram | |||
} | |||
} | |||
else { | |||
dir_art = (dir + 1) % 8; | |||
// dir_art = (dir + 1) % 8; |
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.
How it work before? I don't think that not necessary code.
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.
It was crashing, because offset in SetCurPos has to start with dir_art = 0, and then go through all pictures in order 0 ... 7, and have correct FrameSize shifts.
The correct art orientation is then set here: (dir_art + 6) % 8
But sorry I just realized there is a mistake now for hexagonal case, I will update soon.
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.
Done
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.
In your case we iterate 8 times but fill only 6 dirs, so two times is unnecessary.
We must use
auto& sequence = dir == 0 ? collection.Main : collection.Dirs[dir - 1];
and fill dirs one by one.
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.
You have to iterate 8 times anyway to apply correct file position shifts, they have different FrameSize. Can only skip processing pixels
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 lines have to run for every direction to correctly calculate data offset:
file.SetCurPos(curpos);
curpos += frame_info.FrameSize;
Added skipping |
- fix it in the correct place