[CHORE] Add null-safety to `PlayState` and `LoadingState`
A quite large contribution towards #4303.
~This still needs a bit of polishing so I'm making this a draft for the moment.~ I think I'm satisfied with how it turned out.
I've also included LoadingState here as it made sense for me since it's responsible for switching the game to the PlayState.
PlayState might've been the most troublesome class to add null-safety to since it has so many fields and whatnot. It isn't complete null-safety since ~some fields still need to be initialized later in create and also the fact~ the null-safety checker has many oddities. But some notes regarding it:
-
I've made it so
currentSongcannot be null at all, so there's gonna be errors thrown in the case something may set it null. -
I added a new optional parameter to Strumline's constructor,
scrollSpeed. This was done becauseresetScrollSpeedwould always get the current scroll value from the PlayState, which doesn't have itsinstanceset until it gets called oncreatewhich would cause the scroll speed to always be 1. I could just callresetScrollSpeedininitStrumlinebut I didn't like that. -
~
playerStrumline,opponentStrumline, and other fields I've disabled null-safety on would require moving their initialization tonew, I felt like the constructor was big enough already with the changes I made to ensure the cameras and the follow point are not nullable but if that is not a problem then I can move them there and remove their init functions. Unfortunately I cannot just move theirinitfunctions fromcreatetonewas the compiler requires explicitly setting the field in the constructor.~
Amazing work! It currently gives me this error when compiling, just another hole to patch up!
mfw NO_FEATURE_DISCORD_RPC
Will test this later but it makes me really happy to see PlayState get null safety!
Merge conflicts? In null-safe PlayState?
guuhh thanks to https://github.com/FunkinCrew/Funkin/pull/4318 I had to move some strumline shit to the constructor so I'm re-requesting review just to make sure nothing broke
This is huge.
