diff options
author | 2025-09-29 23:11:55 +0100 | |
---|---|---|
committer | 2025-10-01 21:37:26 +0100 | |
commit | b3c359826ae519ea2816128dfe641032b9e9e97f (patch) | |
tree | 065368fa828bbfc45ceddc58ef10dd82e02a3698 /src/engineapi.c | |
parent | 88f12ae363758c9214942335b4cdb4b5c0e559c9 (diff) | |
download | sst-b3c359826ae519ea2816128dfe641032b9e9e97f.tar.gz sst-b3c359826ae519ea2816128dfe641032b9e9e97f.zip |
While we're at it, come up with a way for certain gamedata matches to be
Windows-only. Somewhat reduces ifdef usage, although does not entirely
remove it of course.
Tested in HL2 2707. Haven't tested other HL2 builds, or Episode 1.
Doesn't seem to work in DMoMM yet either; not sure why.
A big list of stuff still to fix follows.
Hidden cvars are currently an issue. We still need to figure out what to
do with the flag bits because FCVAR_HIDDEN just doesn't exist in OE and
there's some other flag with the same value instead.
We also need to do something about the flag setting in fixes.c since
HIDDEN is again not a thing, and also DEVONLY is not a thing either.
When the plugin is autoloaded, all the initial log text gets eaten,
because there's some stupid crap we have to do to trick the engine into
displaying coloured text otherwise it just won't. Not even stuff from
Warning(). Very stupid, but Hayden already figured out a solution, so
that'll be done in another upcoming commit.
Apparently raw mouse input breaks the menu. We might need to bump up the
priority on making that hook only be active when there's no UI open -
something I wanted to do anyway due to the demo drive issues.
Big thanks to Hayden for doing a lot of the initial groundwork on this,
particularly the cvar registration stuff. He gets a copyright notice in
con_.c even though I ended up doing a lot of stuff differently because
quite a bit of his work is still in there.
Don't blame him for the self-modifying code though, that was my crazy
idea. Sorry, but, in my defence... Well, it works.
Diffstat (limited to 'src/engineapi.c')
-rw-r--r-- | src/engineapi.c | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/src/engineapi.c b/src/engineapi.c index 44713da..1893e0c 100644 --- a/src/engineapi.c +++ b/src/engineapi.c @@ -55,7 +55,9 @@ DECL_VFUNC_DYN(struct IServerGameDLL, struct ServerClass *, GetAllServerClasses) #include <gamedatainit.gen.h> // generated by build/mkgamedata.c bool engineapi_init(int pluginver) { - if_cold (!con_detect(pluginver)) return false; + // set up all these interfaces first, so con_detect can use them (currently + // it just uses engclient for OE, and arguably that usage should also be + // moved out of con_detect, but whatever, it'll do.) pluginhandler = factory_engine("ISERVERPLUGINHELPERS001", 0); if (engclient = factory_engine("VEngineClient015", 0)) { @@ -93,41 +95,9 @@ bool engineapi_init(int pluginver) { _gametype_tag |= _gametype_tag_SrvDLL005; } - // detect p1 for the benefit of specific features - if (!GAMETYPE_MATCHES(Portal2)) { - if (con_findcmd("upgrade_portalgun")) { - _gametype_tag |= _gametype_tag_Portal1; - if (!con_findvar("tf_escort_score_rate")) { - _gametype_tag |= _gametype_tag_Portal1_3420; - } - } - else if (con_findcmd("phys_swap")) { - _gametype_tag |= _gametype_tag_HL2series; - } - } - - if (GAMETYPE_MATCHES(L4D1)) { - // Crash Course update - if (con_findcmd("director_log_scavenge_items")) { - _gametype_tag |= _gametype_tag_L4D1_1015plus; - } - // seems there was some code shuffling in the Mac update (1022) - // this update came like 2-3 weeks after The Sacrifice itself released - if (con_findvar("tank_stasis_time_suicide")) { - _gametype_tag |= _gametype_tag_L4D1_1022plus; - } - } - - if (GAMETYPE_MATCHES(L4D2)) { - if (con_findvar("sv_zombie_touch_trigger_delay")) { - _gametype_tag |= _gametype_tag_L4D2_2125plus; - } - if (con_findvar("director_cs_weapon_spawn_chance")) { - _gametype_tag |= _gametype_tag_TheLastStand; - } - } + if_cold (!con_detect(pluginver)) return false; initgamedata(); - con_init(); + con_init(); // rest of console setup requires having gamedata in place if_cold (!gameinfo_init()) { con_disconnect(); return false; } return true; } |