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

Main sprite disappears in some games #69

Closed
YouMakeTech opened this issue Dec 11, 2022 · 7 comments
Closed

Main sprite disappears in some games #69

YouMakeTech opened this issue Dec 11, 2022 · 7 comments
Labels
bug Something isn't working diff: complex A difficult issue; may require significant planning.

Comments

@YouMakeTech
Copy link

Sometimes, in some (of my favorite :-)) games (e.g. Metroid II and Batman The Animated Series), the main sprite disappears.
Please see example of the beginning of Metroid II, right at the beginning after the main menu:
Screenshot from 2022-12-11 08-27-32

@deltabeard
Copy link
Owner

I tested this with v1.0.0 and the problem occurs there too so I don't think that this is a new issue. I'm working on a debugger to make it easier to discover the reason for these issues. I'll get back to this once I've finished the debugger on branch https://github.com/deltabeard/Peanut-GB/tree/debugger.

@deltabeard deltabeard added bug Something isn't working diff: complex A difficult issue; may require significant planning. labels Dec 11, 2022
@deltabeard
Copy link
Owner

The sprites are loading correctly, which is good. So it must be an issue somewhere in __gb_draw_line(). Looking at the BGB VRAM viewer, it seems that the sprite is hidden when it has higher priority. This sprite priority setting must be incorrectly ignored by Peanut-GB somwhere.

Peanut-GB Debugger

deltabeard added a commit that referenced this issue Dec 11, 2022
Issue #69. The BG over OBJ priority now takes the tile address into
account. This fixes an issue whereby Samus could not be seen at the
start of Metroid II.

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
@deltabeard
Copy link
Owner

I think I've fixed the issue in commit 878bc90. Please check.

METROID2

The background draws over the sprite when required, making it look like Samus is walking behind the bush as shown in the animation above.
The extra logic required to get this working will have some impact on LCD drawing performance though.

@YouMakeTech
Copy link
Author

I'll check today. You're awesome. Thanks!

@YouMakeTech
Copy link
Author

Thanks Mahyar, it works great. No noticeable change in performance

@deltabeard
Copy link
Owner

deltabeard commented Dec 15, 2022

The changes made seem to introduce some drawing errors in other games now. In certain instances, the sprites will appear miscoloured or overlayed incorrectly. For example, in Super Mario Land 2 when Mario is going into a pipe, the sprite appears inverted colours:

MARIOLAND2_0000000015

The Jigglypuff in the opening animation in Pokemon R/B is incorrectly overlayed on Gengar on some frames.
POKEMON BLUE.webm
POKEMON BLUE

I'll reopen this issue so that I can find a better resolution than the current fix.

@deltabeard deltabeard reopened this Dec 15, 2022
deltabeard added a commit that referenced this issue Dec 17, 2022
Fixes issue #69 properly this time by performing a check with colour 0
in the BG palette.

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
@deltabeard
Copy link
Owner

The issue should be fixed properly now. Before, it was assumed that color 0 of the BG palette was transparent, but in some games like Metroid, colour 0 is black, and instead colour 3 is white.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working diff: complex A difficult issue; may require significant planning.
Projects
None yet
Development

No branches or pull requests

2 participants