Skip to content

Conversation

@MightyBurger
Copy link
Contributor

What?

This PR makes the Addons screen transparent.

Current:
image

After changes in this PR:
image

Why?

This is actually an indirect bugfix.

I noticed a bug with the Addons related to a recent change in commit c279f08. When you launch the game, select Addons, choose a level set you already have installed, and click "Start", it opens the level selection screen but with an incorrect background gradient:

image

I believe the bug is caused by the call back_init("back/gui.png") in the function package_enter. The background gradient gets set to back/gui.png, but it is not restored to the previous gradient when transitioning to the level selection screen.

This could be solved directly while keeping the blue background in the Addons screen, but I wanted to propose this change as an alternative solution. The aesthetic change fixes the bug since clicking the "Addons" button no longer changes the background gradient.

I think it's up to your personal preference, @parasti, whether you like this aesthetic change or would rather keep the blue background in the Addons screen.

How?

This PR makes the function package_paint() call shared_paint() instead of back_draw_easy(). This is the same behavior as other states like the "set" state.

Because package.c belongs in share/, I couldn't use shared_paint() directly. Instead, I made a new function package_set_paint_action() called by main_init() inside main.c. It uses the exact same pattern as the package_set_installed_action() function added in c279f08. (I probably could've chosen a better name.)

package_enter() no longer calls back_init("back/gui.png").

I added calls to load_title_background(); game_kill_fade(); to correctly load the title background when launching the game with the --link option.

Those are all the changes.

@parasti
Copy link
Member

parasti commented Aug 21, 2024

I worry that this gives "main screen energy" to the addons screen. It obviously looks better, but doesn't it look better than the set selection screen, now? That's my concern.

Gotta say, though, that this is the best formatted PR I've received in my life.

@parasti
Copy link
Member

parasti commented Aug 21, 2024

As an aside, passing shared_paint as a callback is definitely not what you want. Instead, there's a share/st_common.c that might have a similar function. Reason being, the callback really serves no purpose other than to cut across a code boundary.

@MightyBurger
Copy link
Contributor Author

Heh - do I get an award? I had a big wall of text when I first wrote this PR and it brought no joy, so I restructured it this way to make it clear. Perhaps it was overkill.

I agree the callback just because of the code boundary isn't the nicest. There is common_paint in share/st_common.c, but it doesn't work; the background just turns black. This is because common_paint does not call game_client_draw, unlike shared_paint.

I presume it's necessary to call game_client_draw, which is on the ball/ side of the code boundary, so either way some kind of callback is needed.

That's irrelevant though if we stick with the blue background. I see where you're coming from. If so, you can close this PR. Thanks!

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.

2 participants