mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
redo the cvar vector reading code to produce more useful results
This commit is contained in:
parent
ce1c2e0bd1
commit
45e98d80d9
1 changed files with 7 additions and 1 deletions
|
@ -45,6 +45,7 @@ static const char rcsid[] =
|
|||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/hash.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
@ -230,6 +231,7 @@ void
|
|||
Cvar_Set (cvar_t *var, const char *value)
|
||||
{
|
||||
int changed;
|
||||
int vals;
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
@ -245,7 +247,11 @@ Cvar_Set (cvar_t *var, const char *value)
|
|||
var->string = strdup (value);
|
||||
var->value = atof (var->string);
|
||||
var->int_val = atoi (var->string);
|
||||
sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]);
|
||||
VectorZero (var->vec);
|
||||
vals = sscanf (var->string, "%f %f %f",
|
||||
&var->vec[0], &var->vec[1], &var->vec[2]);
|
||||
if (vals == 1)
|
||||
var->vec[2] = var->vec[1] = var->vec[0];
|
||||
|
||||
if (changed && var->callback)
|
||||
var->callback (var);
|
||||
|
|
Loading…
Reference in a new issue