summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-04-26 17:23:51 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-04-26 17:23:51 +0100
commit1aaedffd8c68614936c59d4681e6dc111cb32691 (patch)
treed215f1667d82a6a1cd417383900e2f0a5b89666f
parentbdb4453a8fbe87247bfd6caf19a7d643144c0f84 (diff)
Fix a couple of bits of convar min/max brokenness
It's amazing how long these things can go unnoticed.
-rw-r--r--src/con_.h10
-rw-r--r--src/fixes.c1
2 files changed, 6 insertions, 5 deletions
diff --git a/src/con_.h b/src/con_.h
index a5d0c87..ed93bad 100644
--- a/src/con_.h
+++ b/src/con_.h
@@ -141,9 +141,9 @@ struct con_var { // ConVar in engine
int ival;
bool hasmin;
// bool hasmax; // better packing here, might break engine ABI
- int minval;
+ float minval;
bool hasmax; // just sticking to sdk position for now
- int maxval;
+ float maxval;
//void *cb; // we don't currently bother with callback support. add if needed!
};
@@ -253,15 +253,15 @@ extern void *_con_vtab_iconvar[];
_DEF_CVAR(name, desc, value, false, 0, false, 0, flags)
/* Defines a console variable with a given mininum numeric value. */
-#define DEF_CVAR_MIN(name_, desc, value, min, flags_) \
+#define DEF_CVAR_MIN(name, desc, value, min, flags) \
_DEF_CVAR(name, desc, value, true, min, false, 0, flags)
/* Defines a console variable with a given maximum numeric value. */
-#define DEF_CVAR_MAX(name_, desc, value, max, flags_) \
+#define DEF_CVAR_MAX(name, desc, value, max, flags) \
_DEF_CVAR(name, desc, value, false, 0, true, max, flags)
/* Defines a console variable in the given numeric value range. */
-#define DEF_CVAR_MINMAX(name_, desc, value, min, max, flags_) \
+#define DEF_CVAR_MINMAX(name, desc, value, min, max, flags) \
_DEF_CVAR(name, desc, value, true, min, true, max, flags)
#define _DEF_CCMD(varname, name_, desc, func, flags_) \
diff --git a/src/fixes.c b/src/fixes.c
index e1b4c0a..ca5aaf0 100644
--- a/src/fixes.c
+++ b/src/fixes.c
@@ -94,6 +94,7 @@ static void l4d2specific(void) {
if (v && !(v->parent->base.flags & CON_ARCHIVE)) { // not already fixed
v->parent->base.flags = v->parent->base.flags &
~(CON_HIDDEN | CON_DEVONLY) | CON_ARCHIVE;
+ v->parent->hasmin = true; v->parent->minval = -1;
v->parent->hasmax = true; v->parent->maxval = 0;
}