#include "quakedef.h"
+#ifdef CONFIG_MENU
+ #include "progsvm.h"
+#endif
+
const char *cvar_dummy_description = "custom cvar";
cvar_t *cvar_vars = NULL;
// LordHavoc: don't reallocate when there is no change
if (!changed)
return;
+
+ // Con_Printf("----> Changing \"%s\" value from \"%s\" to \"%s\"\n", var->name, var->string, value);
+
+#ifdef CONFIG_MENU
+ // prepare values to send into QC
+ prvm_prog_t *prog = MVM_prog;
+ qboolean qcSubscribed = PRVM_menufunction(m_cvar_changed);
+
+ if (qcSubscribed && prog->loaded)
+ {
+ prog->globals.ip[OFS_PARM0] = PRVM_SetTempString(prog, var->name);
+ prog->globals.ip[OFS_PARM1] = PRVM_SetTempString(prog, var->string);
+ prog->globals.ip[OFS_PARM2] = PRVM_SetTempString(prog, value);
+ }
+#endif
+
// LordHavoc: don't reallocate when the buffer is the same size
valuelen = strlen(value);
}
Cvar_UpdateAutoCvar(var);
+
+#ifdef CONFIG_MENU
+ // call "onCvarChanged" like event
+ if (qcSubscribed && prog->loaded)
+ {
+ prog->ExecuteProgram(prog, PRVM_menufunction(m_cvar_changed), "QC function m_cvar_changed is missing");
+ }
+#endif
}
void Cvar_SetQuick (cvar_t *var, const char *value)
void() m_init;
void(float keynr, float ascii) m_keydown;
+void(string cvarName, string oldValue, string newValue) m_cvar_changed;
void(float width, float height) m_draw;
void(float mode) m_toggle;
void() m_shutdown;
PRVM_DECLARE_function(m_gethostcachecategory)
PRVM_DECLARE_function(m_shutdown)
PRVM_DECLARE_function(m_toggle)
+PRVM_DECLARE_function(m_cvar_changed)
PRVM_DECLARE_function(main)
PRVM_DECLARE_global(SV_InitCmd)
PRVM_DECLARE_global(clientcommandframe)
PRVM_DECLARE_menufunction(m_newmap)
PRVM_DECLARE_menufunction(m_shutdown)
PRVM_DECLARE_menufunction(m_toggle)
+PRVM_DECLARE_menufunction(m_cvar_changed)
PRVM_DECLARE_menuglobaledict(self)
PRVM_DECLARE_menuglobalfloat(drawfont)
PRVM_DECLARE_menuglobalfloat(require_spawnfunc_prefix)