From bc63c357bf1ac3ef7f153408ad9b9c48e32bde23 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sun, 11 Jun 2023 10:55:38 +0100 Subject: Add a stupid hack fix for the autojump cheat check Of course, Portal doesn't actually check this properly, and it was never tested well enough until just now. This fixes it, albeit in a really stupid way. C'est la vie. --- src/autojump.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/autojump.c b/src/autojump.c index d26ab9e..1bfc170 100644 --- a/src/autojump.c +++ b/src/autojump.c @@ -73,6 +73,16 @@ static bool unprot(void *gm) { return ret; } +// reimplementing cheats check for dumb and bad reasons, see below +static struct con_var *sv_cheats; +static void cheatcb(struct con_var *this) { + if (this->ival && !con_getvari(sv_cheats)) { + con_warn("Can't use cheat cvar sst_autojump, unless server has " + "sv_cheats set to 1.\n"); + con_setvari(this, 0); + } +} + INIT { gmsv = factory_server("GameMovement001", 0); if (!gmsv) { @@ -97,10 +107,11 @@ INIT { // tried arguing about it already and with how long it takes to convince // the Portal guys of anything I'd rather concede for now and maybe try // and revert this later if anyone eventually decides to be sensible. - // the alternative is nobody's allowed to use SST in runs - except of - // course the couple of people who just roll the dice anyway, and - // thusfar haven't actually been told to stop. yeah, whatever. + // and annoyingly, since cheats aren't even checked properly in portal, + // it's also necessary to do this extremely stupid callback nonsense! sst_autojump->base.flags |= CON_CHEAT; + sv_cheats = con_findvar("sv_cheats"); + sst_autojump->cb = cheatcb; } return true; } -- cgit v1.2.3