diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 03db5b9fb..bfc762b12 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -2097,19 +2097,18 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm) } break; case CVAR_INT: - case CVAR_UINT: case CVAR_BOOL: { if (showval) { - OSD_Printf((osd->cvars[i].c.type & CVAR_UINT) ? "\"%s\" is \"%u\"\n%s: %s\n" : "\"%s\" is \"%d\"\n%s: %s\n",osd->cvars[i].c.name,*(int32_t *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,osd->cvars[i].c.desc); + OSD_Printf("\"%s\" is \"%d\"\n%s: %s\n",osd->cvars[i].c.name,*(int32_t *)osd->cvars[i].c.vptr,osd->cvars[i].c.name,osd->cvars[i].c.desc); return OSDCMD_OK; } int32_t val = Batoi(parm->parms[0]); if (osd->cvars[i].c.type & CVAR_BOOL) val = val != 0; - if (val < osd->cvars[i].c.min || ((osd->cvars[i].c.type & CVAR_UINT) ? ((unsigned) val > (unsigned) osd->cvars[i].c.max) : (val > osd->cvars[i].c.max))) + if (val < osd->cvars[i].c.min || ((val > osd->cvars[i].c.max))) { OSD_Printf("%s value out of range\n",osd->cvars[i].c.name); return OSDCMD_OK; @@ -2119,6 +2118,28 @@ int32_t osdcmd_cvar_set(const osdfuncparm_t *parm) OSD_Printf("%s %d",osd->cvars[i].c.name,val); } break; + case CVAR_UINT: + { + if (showval) + { + OSD_Printf("\"%s\" is \"%u\"\n%s: %s\n", osd->cvars[i].c.name, *(int32_t *) osd->cvars[i].c.vptr, osd->cvars[i].c.name, osd->cvars[i].c.desc); + return OSDCMD_OK; + } + + uint32_t val = Bstrtoul(parm->parms[0], NULL, 0); + + if (val < (unsigned)osd->cvars[i].c.min || val > (unsigned)osd->cvars[i].c.max) + { + OSD_Printf("%s value out of range\n", osd->cvars[i].c.name); + return OSDCMD_OK; + } + + *(uint32_t *) osd->cvars[i].c.vptr = val; + + if (!OSD_ParsingScript()) + OSD_Printf("%s %d", osd->cvars[i].c.name, val); + } + break; case CVAR_STRING: { if (showval)