diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2022-07-31 16:02:10 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2022-08-10 22:40:52 +0100 |
commit | 5e921bf59373d79d27c322ff86e8b5a37b151e45 (patch) | |
tree | 4d40e39543b085ce4c8cb9b1a7b3c0108de680c0 /src/portalcolours.c | |
parent | c8d7588251fd4fe63ac6afe2a90ca7066c786609 (diff) |
Add magical feature codegen system, at long last
Diffstat (limited to 'src/portalcolours.c')
-rw-r--r-- | src/portalcolours.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/portalcolours.c b/src/portalcolours.c index 750ee19..231aa01 100644 --- a/src/portalcolours.c +++ b/src/portalcolours.c @@ -21,13 +21,18 @@ #include "engineapi.h" #include "errmsg.h" #include "gametype.h" +#include "feature.h" #include "hook.h" #include "intdefs.h" #include "mem.h" #include "os.h" #include "ppmagic.h" +#include "sst.h" #include "vcall.h" +FEATURE("portal gun colour customisation") +REQUIRE_GLOBAL(clientlib) + // It's like the thing Portal Tools does, but at runtime! DEF_CVAR(sst_portal_colour0, "Crosshair colour for gravity beam (hex)", @@ -119,8 +124,11 @@ static bool find_UTIL_Portal_Color(void *base) { return false; } -bool portalcolours_init(void *clientlib) { // ... should libs be globals? - if (!GAMETYPE_MATCHES(Portal)) return false; +PREINIT { + return GAMETYPE_MATCHES(Portal1); +} + +INIT { #ifdef _WIN32 if (!find_UTIL_Portal_Color(clientlib)) { errmsg_errorx("couldn't find UTIL_Portal_Color"); @@ -145,7 +153,7 @@ bool portalcolours_init(void *clientlib) { // ... should libs be globals? #endif } -void portalcolours_end(void) { +END { unhook_inline((void *)orig_UTIL_Portal_Color); } |