Skip to content

Fixes related to square geometry#98

Open
djempuiw wants to merge 5 commits intocvet:masterfrom
djempuiw:master
Open

Fixes related to square geometry#98
djempuiw wants to merge 5 commits intocvet:masterfrom
djempuiw:master

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
}
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.

3 participants