This should avoid buffer overruns in the middle of
recording. There is already code that checks for buffer
size around ticcmd and ghost data write. Demo header is
still unsafe with many WAD filenames written, for example.
Ghost data and ticcmd should not come close to reaching
into this extra space. At the time of writing, ghost data
can write up to 102 bytes and ticcmd 20 bytes, per player.
Notable deletions:
- Metal Sonic Race
- Includes all the specialised recording/playback apparatus which made g_demo.c harder to read
- A bunch of hyperspecialised code inside several A_ actions
- EXCEPTION: intentfully left in the spriteless SMK stuff for Sal's add-on down the line.
FixesKartKrew/Kart#824
The for-loop attempts to read `g` after the object it points to has
already been freed by Z_Free. Instead, we add a new `done` field, and
mark it when hitting the end of the demo, and skip ghosts in the ghost
list which have it set.
There were a few remaining cases of bot ticcmd generation editing player structures directly. Fix all of this and make as much of it pass const player pointers so this physically can't be allowed to happen ever again. Appears to improve bot sync in netgames & demos bot support, but I have not tested extensively.
Fixes several things to do with the boss healthbar.
- Makes its randomised jitter work with interp/pause
- Constantly calling the external PRNG tanks performance, at least on Windows, so this solves that too
Done as a special non-netsynced random class so the author of this commit wouldn't have to create a third suite of duplicated Random functions.
Previously, there was a permanent exception for Eggrobo (the default bot skin).
Now that exception is generalised for the specific skin the bot is being assigned, which we assume is intentful and correct.
In addition, the randomclass PR_BOTS now controls K_RetireBots as well, matching the other two random calls done for bot skins.
- G_AddPlayer now contains CL_ClearPlayer, G_DestroyParty, and playeringame set
- Instead of a nasty, complicated block in P_SpawnPlayer, externalise it into G_SpectatePlayerOnJoin
- All mid-game human player-to-spectator transitions are handled by P_SetPlayerSpectator, instead of lots of `spectator = true` and associated boilerplate
- Simplifies Got_Teamchange MASSIVELY
- Of course this is helped by also stripping back team change
- This is called by P_KillPlayer, too
- P_KillPlayer no longer eats DMG_SPECTATOR when lightsnaking or exiting
- G_GametypeHasSpectators condition tidied
- No need to call CV_RegisterVar
- Cvar definitions live in only one file, easier to locate
- Organized into sections -- netvars, cheats, etc.
- Use builder pattern to initialize cvars
- Still need to extern if you want to read the cvar value
- Fix the last few bugs I could find with thing args
- Move version update code
- Rename internal variables to `thing_[string]args` to make older code merge issues more obvious
- Save retry condition in G_BeginLevelExit
- Apply condition in G_FinishExitLevel
Preparation for ACS level end scripts, since the exit
condition will need be known when the countdown starts,
not when it ends (that'd be too late to do anything in the
level).