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

ModBackground Rework #4156

Open
wants to merge 18 commits into
base: 1.4.4
Choose a base branch
from

Conversation

Lion8cake
Copy link
Contributor

(A while ago I cleaned up my forks to allow myself for easier forks for any new feature I wanted to add to tmodloader. This caused the last background rework to become closed as it used my 1.4.4 branch instead of its own.
This is a clone of #3889 )

What is the new feature?

This is a massive rework and change to ModSurface/UndergroundBackground. This contains both fixes to make modbackground easier to configure and edit as well as fixes to make this be on par with vanilla background drawing.

Why should this be part of tModLoader?

Currently ModSurfaceBackground has almost no customisability and when it does its only for the Close background stuff. Even the comment on the current close background texture hook mentions that whoever wrote the summary has no idea what half the parameters even do. Along with this, mod backgrounds are only limited to 3 layers (Far, Middle, Close) while vanilla has a maximum of 5.

This should make modding backgrounds easier and to allow those who want their backgrounds to have the same movement, styling, and height of vanilla bgs can do so.

Predraws have also been given to both the surface and underground background styles along allowing for extra drawing on top or in replacement of the mod background.

This also fixes World Globe changing forest backgrounds when in a mod biome.

Lastly this contains example mod additions to backgrounds to show how CloseMid and CloseFar work along with an extra part for the example mod underground transition between the lava and cavern layer.

Are there alternative designs?

A completely rewrite of the mod background. I’m not advanced enough to rewrite the background from scratch so someone more advanced may want to completely rewrite modbackground to do what i have done in addition with some additional content.

Sample usage for the new feature

Please see the following:
ExampleMod/Content/Biomes/ExampleSurfaceBackgroundStyle.cs
ExampleMod/Content/Biomes/ExampleUndergroundBackgroundStyle.cs

Lion8cake and others added 18 commits July 7, 2023 12:56
### What is the new feature?
Remix hallow worldgen now is properly included in the Hardmode Good genpass that tmod adds. This also makes the Hardmode Evil also run in remix seeds aswell

### Why should this be part of tModLoader?
This allows worldgen that relies on either one of the Hardmode Good and Hardmode Evil to be ran in remix seeds.

### Are there alternative designs?
Not that I can identify, the current patch for the remix seed was a bad fix when porting tmodloader to 1.4.4

### Sample usage for the new feature
Made a new mod, make worldgen that relies on the Hardmode Good pass to run. Results on the remix seed
Changed/fixed the following:
Renamed ModifyFarFades to ModifyStyleFade
Added scale, parallax, topY and loopWidth to all choose texture hooks
Added ChoseCloseMidTexture and ChooseCloseFarTexture
Added PredrawBackground hook to both Surface and underground backgrounds
Completely changed how Close Background is drawn
Fixed height with the close background in the menu
Fixed World Globe changing forest bgs when in modded biomes
Added lava layer showcase in example mod
Added CloseMid and CloseFar support in example mod

This may require tmodporter stuff due to surface mod backgrounds having almost all of its hooks changed in some way.
Added BackgroundLayerParams struct
~~copied the ug background code from the enabled backgrounds hook because they were literally the same~~
fixed some random code getting removed in a commit
@Lion8cake Lion8cake mentioned this pull request Apr 9, 2024
Comment on lines +5 to +8
internal float* ScalePtr { get; init; }
internal double* ParallaxPtr { get; init; }
internal int* TopYPtr { get; init; }
internal int* LoopWidthPtr { get; init; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this to ref fields/properties/whatever. Pointers are no longer needed.

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.

None yet

4 participants