diff options
Diffstat (limited to 'src/hl2h.cpp')
| -rw-r--r-- | src/hl2h.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
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; | |||
| 130 | // ConCommandBase has two dtor slots, then IsCommand, IsFlagSet, AddFlags, | 130 | // ConCommandBase has two dtor slots, then IsCommand, IsFlagSet, AddFlags, |
| 131 | // GetName, GetHelpText, IsRegistered, GetDLLIdentifier; ConVar then adds | 131 | // GetName, GetHelpText, IsRegistered, GetDLLIdentifier; ConVar then adds |
| 132 | // SetValue(const char*), SetValue(float), SetValue(int) -> slot 11. | 132 | // SetValue(const char*), SetValue(float), SetValue(int) -> slot 11. |
| 133 | bool console_cmd(const char *cmd) { | ||
| 134 | if (!cmd || !*cmd || !g_iface.engine) | ||
| 135 | return false; | ||
| 136 | using CmdFn = void (*)(void *, const char *); | ||
| 137 | vfunc<CmdFn>(g_iface.engine, 7)(g_iface.engine, cmd); | ||
| 138 | logd("cmd: %s", cmd); | ||
| 139 | return true; | ||
| 140 | } | ||
| 141 | |||
| 133 | bool cvar_set_int(const char *name, int value) { | 142 | bool cvar_set_int(const char *name, int value) { |
| 134 | if (!name || !g_iface.engine) | 143 | if (!name) |
| 135 | return false; | 144 | return false; |
| 136 | // Use the stable IVEngineClient ClientCmd slot rather than poking ConVar's | 145 | // Use the stable IVEngineClient ClientCmd slot rather than poking ConVar's |
| 137 | // vtable; the installed VEngineCvar004 layout differs enough to crash. | 146 | // vtable; the installed VEngineCvar004 layout differs enough to crash. |
| 138 | char cmd[96]; | 147 | char cmd[96]; |
| 139 | snprintf(cmd, sizeof(cmd), "%s %d", name, value); | 148 | snprintf(cmd, sizeof(cmd), "%s %d", name, value); |
| 140 | using CmdFn = void (*)(void *, const char *); | 149 | return console_cmd(cmd); |
| 141 | vfunc<CmdFn>(g_iface.engine, 7)(g_iface.engine, cmd); | ||
| 142 | logd("cvar: command '%s'", cmd); | ||
| 143 | return true; | ||
| 144 | } | 150 | } |
| 145 | 151 | ||
| 146 | void note_modified(const CUserCmd *cmd, int flags, const float *vel) { | 152 | void note_modified(const CUserCmd *cmd, int flags, const float *vel) { |
| @@ -585,6 +591,7 @@ static void do_move(int seq, float frametime) { | |||
| 585 | silentaim_reset_lock(); | 591 | silentaim_reset_lock(); |
| 586 | fullbright_invalidate(); | 592 | fullbright_invalidate(); |
| 587 | world_tint_invalidate(); | 593 | world_tint_invalidate(); |
| 594 | fog_invalidate(); | ||
| 588 | } | 595 | } |
| 589 | 596 | ||
| 590 | if (feature_active(FEAT_SPREAD)) { | 597 | if (feature_active(FEAT_SPREAD)) { |
