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

OAM priority calculation #54

Open
taylorplewe opened this issue Feb 21, 2024 · 1 comment
Open

OAM priority calculation #54

taylorplewe opened this issue Feb 21, 2024 · 1 comment

Comments

@taylorplewe
Copy link

taylorplewe commented Feb 21, 2024

As per these gbdev.io docs, when it comes to drawing an OAM pixel, the Gameboy first calculates which of 2 overlapping objects has higher priority; and THEN considers the winning object's BG priority bit. This can be exploited to "mask" objects (see INTERACTION WITH "BG OVER OBJ" FLAG in the article.)

Currently on binjgb, this behavior does not occur; it calculates the BG priority bit of all objects and renders whatever is on top.

On my local version of binjgb, I was able to fix this by inserting the following lines to emulator.c:
image
image
image
which seems like a hacky solution, but you can see a working version on my demo GB game.

I'm unable to open a pull request as I'm unable to create a branch but this is the issue and a potential solution!

@binji
Copy link
Owner

binji commented Mar 1, 2024

Thanks for reporting this! I probably should finally get around to implementing the proper rendering pipeline, which should fix issues like this. But in the meantime, I'll take a look at fixing this perhaps doing something simpler.

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

No branches or pull requests

2 participants