mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Give the cvars generated from float+vector autocvars prettier default/initial values.
This commit is contained in:
parent
c0efc3bc9a
commit
8b08262ffb
1 changed files with 12 additions and 1 deletions
|
@ -8276,7 +8276,18 @@ void PR_EnableExtensions(ddef_t *pr_globaldefs)
|
||||||
if (!strncmp(n, "autocvar_", 9))
|
if (!strncmp(n, "autocvar_", 9))
|
||||||
{
|
{
|
||||||
//really crappy approach
|
//really crappy approach
|
||||||
cvar_t *var = Cvar_Create(n + 9, PR_UglyValueString (qcvm->globaldefs[i].type, (eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs)));
|
const char *def;
|
||||||
|
cvar_t *var;
|
||||||
|
switch(qcvm->globaldefs[i].type&~DEF_SAVEGLOBAL)
|
||||||
|
{
|
||||||
|
case ev_float: def = va("%g", ((eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs))->_float); break; //just to be a bit prettier. autocvars should not depend on denormals etc.
|
||||||
|
case ev_ext_double: def = va("%g", ((eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs))->_double); break;
|
||||||
|
case ev_vector: def = va("%g %g %g", ((eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs))->vector[0], ((eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs))->vector[1], ((eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs))->vector[2]); break;
|
||||||
|
default: //go generic
|
||||||
|
def = PR_UglyValueString (qcvm->globaldefs[i].type, (eval_t*)(qcvm->globals + qcvm->globaldefs[i].ofs));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var = Cvar_Create(n + 9, def);
|
||||||
numautocvars++;
|
numautocvars++;
|
||||||
if (!var)
|
if (!var)
|
||||||
continue; //name conflicts with a command?
|
continue; //name conflicts with a command?
|
||||||
|
|
Loading…
Reference in a new issue