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

fix tic_modulo #2676

Merged
merged 3 commits into from
Sep 9, 2024
Merged

fix tic_modulo #2676

merged 3 commits into from
Sep 9, 2024

Conversation

anescient
Copy link
Contributor

@anescient anescient commented Sep 5, 2024

Large values for map offsets can cause slowdown due to being unwound with increment loops on each tile drawn. This change unwinds the coordinates with modulus instead.

Resolves #2678

Copy link
Collaborator

@joshgoebel joshgoebel left a comment

Choose a reason for hiding this comment

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

Wow. Looks pretty awesome to me.

@anescient
Copy link
Contributor Author

anescient commented Sep 6, 2024

I just found there's an existing function tic_modulo. This would be better:
s32 mi = tic_modulo(i, TIC_MAP_WIDTH);
s32 mj = tic_modulo(j, TIC_MAP_HEIGHT);

@anescient anescient marked this pull request as draft September 6, 2024 15:00
@anescient
Copy link
Contributor Author

I've changed this to a draft because tic_modulo may be broken; it produces out of range values if x is a negative multiple of m. I'm going to examine things and see if correcting this will break things or if things are currently broken.

@anescient anescient changed the title use modulus to loop map fix tic_modulo Sep 6, 2024
@anescient
Copy link
Contributor Author

From what I see nothing depends on broken behavior from tic_modulo, and I did find a related bug and created an issue for it.

@anescient anescient changed the title fix tic_modulo fix tic_modulo resolves #2678 Sep 6, 2024
@anescient anescient marked this pull request as ready for review September 6, 2024 17:04
@anescient anescient changed the title fix tic_modulo resolves #2678 fix tic_modulo Sep 8, 2024
@nesbox nesbox merged commit 794ee52 into nesbox:main Sep 9, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ttri renders junk for certain negative u and v
3 participants