Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

djempuiw
Copy link
Contributor

  • 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
@@ -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;
Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Owner

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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;

@djempuiw
Copy link
Contributor Author

djempuiw commented Jun 8, 2024

Added skipping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants