Fixed "sv_spawnfarthest" not working in team-based game modes + major overhaul of player spawn code
First and foremost, this addresses 0002792 and fixes sv_spawnfarthest
not working in teamgame
game modes (e.g. CTF). The code to handle this flag was missing. Secondly, this does a much needed cleanup and improvement of the player spawn code:
-
I added a couple of helper functions (i.e.
SelectFarthestSpotHelper
andSelectRandomSpotHelper
) to eliminate the amount of duplicated code that existed. I also refactoredSelectRandomCooperativeSpot
in such a way that it could use the latter function as well (i.e. we're trying to spawn the player at any valid cooperative start randomly, so create aTArray
of all existing cooperative starts first). -
I removed the rather nuanced and hardcoded spawning behaviour used specifically for Team LMS. The biggest difference between it and
sv_spawnfarthest
is that the former spawns the player as far away from their enemies only, while the latter spawns them as far away from everyone else including teammates. However...- In my experience, nearly all Team LMS games that I've seen played over the years (e.g. Ghouls vs. Humans, Hell vs. Marines, MM8BDM Gondola, etc.) use team spawns in the map, so all players are going to (re)spawn near their teammates anyways.
- Even when that isn't the case, I don't believe the average player will notice themselves now spawning away from everyone instead of their enemies only, certainly not enough to justify keeping all of this extra code lying around and create more delta from GZDoom.
-
I rewrote some of the player spawn code in deathmatch so that it behaves almost like it does in GZDoom 1.8.6. Now, there's less delta from our GZDoom base, and after testing it, the spawning still works properly.
-
I cleaned up the remaining code so that the style fits closely to what's used in GZDoom. I noticed that the formatting of a few lines that originated from GZDoom were subtly changed before too, so I fixed that. Not to mention, a lot of our code was missing comments to distinguish it from GZDoom's (I had to keep referencing the original GZDoom code to see what we changed). I added a bunch of my own comments to make that more clear.