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

FadeOut() is broken on DMG #43

Open
mhughson opened this issue Dec 21, 2021 · 1 comment
Open

FadeOut() is broken on DMG #43

mhughson opened this issue Dec 21, 2021 · 1 comment

Comments

@mhughson
Copy link

The fade functions found in "Fade.h" appear to be broken when running the non-color version of a game. FadeIn() works (fading the screen to pure white, but FadeOut() appears to have no effect. If called after calling FadeIn() the screen stays pure white. If called without first calling FadeOut(), the color does not change.

I wrote a simple example game with this Update:

void UPDATE() {
	if(KEY_TICKED(J_START))
	{
		FadeIn();
	}
	
	if (KEY_TICKED(J_SELECT))
	{
		FadeOut();
	}

These 2 gifs are the same game compiled as Color and Non-Color. In both cases I press START and shortly after I press SELECT. Note that while both versions fade up to white, the DMG version does not fade back down.

gb1_dmg_broken_fade

gb1_color_working_fade

mhughson added a commit to mhughson/mbh-firstnes that referenced this issue Dec 21, 2021
NOTES:
* Fade broken on DMG. (Zal0/ZGB#43)
* pad_new is faked.
* Scroll into gameplay doesn't work in tight loop. (https://discord.com/channels/790342889318252555/790346049377927168/922735832954175529)
@mhughson
Copy link
Author

NOTE: This can be worked around by forcefully setting the DMG palettes prior to calling FadeOut() like so:

	FadeIn();
	DISPLAY_OFF;

	...

	// Fade function on DMG reads the colors directly from registers before fading.
	// As a result, the FadeOut fails when called after FadeIn() because it tries to fade to a solid
	// color.
	// To fix this, we set the real colors right before FadeOut to set the proper
	// destination colors.
	BGP_REG = OBP0_REG = OBP1_REG = PAL_DEF(0, 1, 2, 3);
	
	DISPLAY_ON;
	FadeOut();

mhughson added a commit to mhughson/mbh-firstnes that referenced this issue Jan 28, 2022
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

1 participant