This avoids an issue where the skins array takes up a fixed, but large
amount of memory at runtime. On x86_64 linux, that array is roughly 80
megabytes in memory, most of which is unused when the game is unmodded.
Instead, we treat `skins` as a dynamically resizing array, and it is an
array-of-pointers into separate allocated `skin_t`.
This is based on Lactozilla's skin limit MR for SRB2, but I've rewritten
it because RR has diverged quite a bit.
This was verified to check every access of `skins` by using clangd's
find-all-references function. However, I have only tested plain skins,
not Lua addons, so that could afford some extra checking.
- Cleans up codebase in some high density regions
- Prevents crashing on the title screen due to old demos being played before we replace staffghosts
- Guarantees nothing we don't want slips in
- Built off g_fast_forward to utilise a lot of existing structure
- Only does steps of 5 seconds and therefore isn't precise, but that's better than having to rewatch/fastforward through the entire thing
- No single frame step back or general in-motion rewind preview, but that was all overkill
- Demos/Ghosts that end before ticking once are now correctly ignored. (ResolvesKartKrew/RingRacers#168)
- There was code for discovering it on read! It was just placed slightly too early, probably due to the conversion for netreplays! I'm very mad!
- As a preventative measure, demos *recorded* before ticking will simply not save in the first place.
- This was also a frustratingly easy fix for the amount of headache it's caused us.
- Reduced the amount of copypasted boilerplate by simplifying the places where DEMOMARKER can be written (and therefore read).
- Previously, like half the write functions tried to guess their own output size and potentially end the demo at any point.
- At best, this will grant us a few tics of reprireve for large netgames and MAYBE a handful of seconds for time attack, The Mode In Which The Aim Is To Go Fast.
- Instead, double the size of the deadspace buffer extension and just check to see if we've crossed into that territory.
Replay code was not prepped for adding/removing RNG classes yet. Oops!
G_CompatLevel was not put on the changes from the previous commit, as we are planning on breaking all the compat for the new TA changes anyways. Just preventing this being a problem in the future.
- Empty `demo.titlename` case
- Don't try to save demo of name `.lmp`
- Doesn't fall back to anything, because emptying out the name field can be reasonably treated as not wanting to save
- `demo.titlename` consists only of invalid characters
- Don't try to save demo of name `-.lmp`
- Falls back to the default demo title, because the user clearly wanted to save and just happened to provide invalid text
Calls to F_ContinueCredits and D_StartTitle, even if deferred,
change the current gamestate. However, the tic loop in TryRunTics
may still have a couple tics to execute to catch up to current
time, and as a consequence G_Ticker may execute game logic while
the current state is not GS_LEVEL or equivalent. As a result, it is
highly likely for the game to crash.
This adds deferred credits start to the tic loop, and exits that
loop if either title or credits are supposed to start after the
current iteration, fixing this crash scenario.
FixesKartKrew/Kart#1185