aboutsummaryrefslogtreecommitdiff
path: root/src/inputhud.c
Commit message (Collapse)AuthorAgeFilesLines
* Tidy up some extensions and remove some ifdefsGravatar Michael Smith 2025-08-031-4/+0
| | | | | | | | | | | | | | | | | | | | | Since this codebase is already extremely nonportable, I've decided to relax the obsessive ifdef-else-error usage around all the extensions. From now on, if there's no alternative to using an extension, we can just use that extension. If it's possible to do something in a relatively portable way, we can still try to do that in order to make the code somewhat reusable, in contexts where that makes sense. I also decided to use langext.h for naked functions and tail calls. If that's used in another codebase build with a different compiler, those just won't work, but that's fine. The benefit is really just that there's less ceremony in places where those are used, because it's likely there'll be a few more such places in the future, and it gets annoying reading all the double-underscore stuff all over the place. I still kind of want to do something about all the _WIN32 ifdefs too, but I've realised that doing so will lead to almost nothing actually being built on Linux. Then again, none of it currently runs on Linux so I guess that's a moot point. Will worry about it later, anyway.
* Use shorter spellings of __asm and __attributeGravatar Michael Smith 2025-08-031-1/+1
| | | | | | | Turns out, there's no need for the trailing underscores. Plus, glibc does some stupid stuff with __attribute__ for non-GCC compilers. Not that that matters here, but it seems like a good practice just to use the forms that never have such problems. And it's shorter too.
* Switch to Intel assembly syntaxGravatar Michael Smith 2025-08-031-1/+1
|
* Abstract over con_var layout changes from OE to NEGravatar Michael Smith 2025-06-211-6/+8
| | | | | This doesn't allow us to support OE in and of itself but is part of the groundwork necessary to do so in the future.
* Add type-safety to virtual calls and accessorsGravatar Michael Smith 2025-04-171-19/+18
| | | | | | | | | | | | This probably should have been the design from the start. It's still possible to use void pointers, and this is done in a couple of places for simplicity, but wherever possible, we have actual structs for things now. Additionally, in places where vtables are fiddled with, e.g. vtable hooks, we have actual struct definitions with vtable pointers so there's need for pointer-casting horror.
* Fix major idiocy in inputhud (and hud kinda)Gravatar Michael Smith 2025-04-161-0/+1
| | | | Also pointed out by bill. D'oh, guess I'm fired.
* Remove years from copyright headersGravatar Michael Smith 2025-04-071-3/+3
| | | | | | | | 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.
* Reload inputhud fonts on resolution changeGravatar Michael Smith 2025-04-061-7/+14
| | | | | | | | | | | This checks off another bug that we knew about for ages and I never had time to fix. Note that I've since learned that font handles don't work the way I assumed they did; things get cached and reused so there's no need to worry about leaks. As such, we could probably revisit how fonts are done here. However, the current implementation does work so that's potentially a job for some future release after 0.9.
* Pass screen width and height into HudPaint eventsGravatar Michael Smith 2025-04-061-3/+1
| | | | | This makes it unnecessary to call hud_screensize in basically every handler.
* 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-31/+25
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Refine input HUD layoutsGravatar Michael Smith 2024-09-291-63/+77
| | | | | | | | | - Get rid of +left/+right things, as they were deemed unnecessary. - Add missing reload button in L4D games - Put a vertical gap between the group of directional buttons and attacks, and all the other buttons. While we're at it, add a few branch hints and fix up the includes.
* Add basic button input HUDGravatar Matthew Wozniak 2024-09-141-0/+443
Committer's note: this is heavily modified from the original code contributed by woz (and somewhat improved by bill and aciidz). Copyright notices reflect joint authorship accordingly. woz still gets commit authorship though because it feels wrong to yoink that from someone. :^) And yes, the original code was written in 2022. Time flies. A lot of the code is still kind of hacky and ugly and I'd like to improve it later but there's other things to do so that can wait.