aboutsummaryrefslogtreecommitdiff
path: root/src/l4dwarp.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove years from copyright headersGravatar Michael Smith 2025-04-071-2/+2
| | | | | | | | They're legally unnecessary as far as I know, and kind of annoying to maintain on a long-term basis. This was done with the consent of all 3 other contributors, in case anyone was wondering.
* Use C23 void-argument-free prototypesGravatar Michael Smith 2025-04-061-1/+1
| | | | | | | In the future we can also consider moving to {} instead of {0} for initialisers, but my old Clang (16) doesn't support this, so it might be wise to wait longer on that one so people don't need too bleeding-edge of a compiler just to build this thing.
* Rewrite and redesign codegen and feature systemGravatar Michael Smith 2025-04-061-19/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Also switch to somewhat proper C23 flags while we're at it. This is a huge change. It took me forever, in between being really busy. Sorry about that. But the good news is I'm now free to start integrating the various patches that have accumulated since last release. Well, at least in between still being really busy. Gotta manage expectations. The main benefit of introducing GAMESPECIFIC() is that features that don't apply to a particular game no longer show up *at all*, and less time is wasted on init. It also enables a cool optimisation wherein unnecessary REQUIRE_GAMEDATA() checks can elided at compile time whenever the gamedata is known up-front to always exist in supported games. The DEF_FEAT_CVAR macro family meanwhile makes it easier to manage the lifecycle of cvars/ccmds, with less manual registering, unhiding and such. Originally I was going to try and just hack these features into the existing codegen abomination, but it just got too terrible. This rewrite should make it easier to continue tweaking codegen behaviour in future. It also has slightly better error messages.
* Add missing newlines to clientcon messagesGravatar Michael Smith 2024-09-281-3/+3
| | | | | | Just had a brain fart when writing this code initially, woops. Just as well I have people pointing these things out to me before I end up making releases with such mistakes. At least, usually. :^)
* Create and use macros to define accessor functionsGravatar Michael Smith 2024-09-281-10/+15
| | | | | | | Avoids the need to manually mess around with mem_offset() and gamedata off_ and sz_ values as often, because that's kind of annoying. Should also make the codebase a little less confusing for new players.
* Use single-precision trig functions in testwarpGravatar Michael Smith 2024-09-251-3/+3
| | | | | There was never a need to calculate more precision and then throw it away again. This was just an oversight.
* Address some minor L4D warp testing oversightsGravatar Michael Smith 2024-09-161-4/+12
| | | | | | | - Check the player's team before attempting any form of warp prediction (as per the code bill wrote before) - Avoid overlapping boxes and an unnecessary line draw in the case where the player is never actually stuck.
* Improve L4D warp testing and add visualisationGravatar Willian Henrique 2024-08-301-11/+275
| | | | | | | | | | | | | | sst_l4d_testwarp will now unstick the player unless "staystuck" is specifed as an argument. Additionally, sst_l4d_previewwarp is added to show the positions checked by the unstuck logic as well as the line-of-sight traces performed. Committer's note: the actual box-drawing logic was essentially rewritten by me since I realised the order of drawing didn't matter at all. All the code-digging logic is more-or-less still what bill wrote, though. So, you could say we have joint authorship of this, I suppose. Not that that's a huge deal, but if anyone's ever curious or if it ever legally matters for some reason then, well, there you go.
* Rewrite the gamedata and entprops systems entirelyGravatar Michael Smith 2024-08-231-2/+2
| | | | | | | | | | | | This removes the horrible janky old KeyValues parser and replaces it with a couple of trivial ad-hoc text parsers. In doing so, make the format of the actual gamedata files more human-friendly too. We also gain support for nested SendTables in mkentprops, which are required to get at various things like player velocity. And, the actual string matching is made more efficient (or, at least, more scalable) by way of a cool radix tree thing which generates a bunch of switch cases on distinct characters.
* Revise syntax macros and add a ton of branch hintsGravatar Michael Smith 2024-08-231-2/+3
| | | | | | | | | My new programming style is branch hints. All non-confusing branches must be hinted when I can be bothered. It's faster, sometimes, maybe. Also, start trying to use more signed sizes in at least some of the places where it makes sense. Unsigned sizes are surprisingly error-prone!
* Prune some comments and tidy up other minor thingsGravatar Michael Smith 2023-06-101-4/+2
|
* Adapt vote reset code into fast campaign resettingGravatar Michael Smith 2023-06-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is kind of a breaking change but the other code was obviously never released or relied on by anyone - it will be pushed at the same time as this in fact. It still seems worth having the original committed separately to show the progression of development of the feature, however. Technically the standalone vote cooldown resetting could also be added back if ever desired however there doesn't seem to be that much of a use case for that at the moment. This feature ought to be a lot more convenient now as it allows for resetting back to a set starting point no matter where the player is in a run. It isn't universally useful as All Campaigns Legacy solo runs require switching to a different type of server and Main Campaigns co-op runs require restarting the game after Swamp Fever to work around the god mode bug, however it is still useful in a good few situations. Unfortunately this turned out to be pretty complex to implement, first requiring a bunch of interop with valve's rather wacky KeyValues stuff, and then requiring a bunch of especially difficult reverse engineering of L4D1 v1.0.0.5 because it doesn't use said KeyValues stuff and does something else completely different instead. A side effect of all this work is that the nag removal hack is now part of the KeyValues stuff in kvsys.c, which is kind of a comfier place for it than just kind of dumped in the middle of sst.c.
* Move towards C23, improve events and vcall macrosGravatar Michael Smith 2022-09-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Another big one. Here's a list of things: - Since the upcoming C23 standardises typeof(), use it as an extension for the time being in order to allow passing arbitrary types as macro/codegen parameters. It wouldn't have been a big leap to do this even without standardisation since it's apparently an easy extension to implement - and also, to be honest, this project is essentially glued to Clang anyway so who cares. - Likewise, bool, true and false are becoming pre-defined, so pre-pre-define them now in order to get the benefit of not having to remember one header everywhere. - Really ungodly/amazing vcall macro stuff now allows us to call C++ virtual functions like regular C functions. It's pretty cool! - Events can now take arbitrary parameters and come in two types: regular events and predicates. All this makes the base code even uglier but makes the feature implementation nicer. In other words, it places more of the cognitive burden on myself and less on other people who might want to contribute. This is a good tradeoff, because I'm a genius.
* Add magical feature codegen system, at long lastGravatar Michael Smith 2022-08-101-7/+11
|
* Change some warnings to errorsGravatar Michael Smith 2022-07-231-1/+1
|
* Solve the error logging situationGravatar Michael Smith 2022-06-021-2/+3
|
* Cheat-protect sst_l4d_testwarpGravatar Michael Smith 2022-05-041-1/+1
| | | | | Don't want people hitting a bind by accident and invalidating their runs instantly.
* Add entity property finding and L4D warp testingGravatar Michael Smith 2022-05-031-0/+60
This was a lot more code than expected, but it might be finally close to time to release the next beta... We'll see if any more rabbit holes present themselves to jump into, though.