From edba65625dd5823705619a2e682a99d6ad91ae8b Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 23:32:16 +0100 Subject: World: add prop tint and fog override - World tint now also colours prop materials (models/props*) with their own colour, covering static props and prop_physics while leaving NPC, player and weapon materials untouched. - New Fog card: fog_override colour/start/end via ClientCmd, optional skybox fog, and a Remove fog mode. Restores the map fog (fog_override 0) when disabled and re-applies after level changes. - Config sections [worldtint] prop/colour keys and [fog]. --- src/hl2h.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index dfe4e57..3f1acb4 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -130,17 +130,23 @@ static int g_modified_logged = 0; // ConCommandBase has two dtor slots, then IsCommand, IsFlagSet, AddFlags, // GetName, GetHelpText, IsRegistered, GetDLLIdentifier; ConVar then adds // SetValue(const char*), SetValue(float), SetValue(int) -> slot 11. +bool console_cmd(const char *cmd) { + if (!cmd || !*cmd || !g_iface.engine) + return false; + using CmdFn = void (*)(void *, const char *); + vfunc(g_iface.engine, 7)(g_iface.engine, cmd); + logd("cmd: %s", cmd); + return true; +} + bool cvar_set_int(const char *name, int value) { - if (!name || !g_iface.engine) + if (!name) return false; // Use the stable IVEngineClient ClientCmd slot rather than poking ConVar's // vtable; the installed VEngineCvar004 layout differs enough to crash. char cmd[96]; snprintf(cmd, sizeof(cmd), "%s %d", name, value); - using CmdFn = void (*)(void *, const char *); - vfunc(g_iface.engine, 7)(g_iface.engine, cmd); - logd("cvar: command '%s'", cmd); - return true; + return console_cmd(cmd); } void note_modified(const CUserCmd *cmd, int flags, const float *vel) { @@ -585,6 +591,7 @@ static void do_move(int seq, float frametime) { silentaim_reset_lock(); fullbright_invalidate(); world_tint_invalidate(); + fog_invalidate(); } if (feature_active(FEAT_SPREAD)) { -- cgit v1.2.3