int i;
Con_Printf("3 %s\n%i\n", name, brush->numpoints);
for (i = 0;i < brush->numpoints;i++)
- Con_Printf("%g %g %g\n", brush->points[i].v[0], brush->points[i].v[1], brush->points[i].v[2]);
+ Con_Printf("%f %f %f\n", brush->points[i].v[0], brush->points[i].v[1], brush->points[i].v[2]);
// FIXME: optimize!
Con_Printf("4\n%i\n", brush->numplanes);
for (i = 0;i < brush->numplanes;i++)
- Con_Printf("%g %g %g %g\n", brush->planes[i].normal[0], brush->planes[i].normal[1], brush->planes[i].normal[2], brush->planes[i].dist);
+ Con_Printf("%f %f %f %f\n", brush->planes[i].normal[0], brush->planes[i].normal[1], brush->planes[i].normal[2], brush->planes[i].dist);
}
void Collision_ValidateBrush(colbrushf_t *brush)
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
Cvar_SetValue
============
*/
-void Cvar_SetValueQuick (cvar_t *var, float value)
+void Cvar_SetValueQuick(cvar_t *var, float value)
{
- char val[32];
+ char val[256];
- // LordHavoc: changed from %f to %g to use shortest representation
- sprintf (val, "%g",value);
- Cvar_SetQuick (var, val);
+ if ((float)((int)value) == value)
+ sprintf(val, "%i", (int)value);
+ else
+ sprintf(val, "%f", value);
+ Cvar_SetQuick(var, val);
}
-void Cvar_SetValue (const char *var_name, float value)
+void Cvar_SetValue(const char *var_name, float value)
{
- char val[32];
+ char val[256];
- // LordHavoc: changed from %f to %g to use shortest representation
- sprintf (val, "%g",value);
- Cvar_Set (var_name, val);
+ if ((float)((int)value) == value)
+ sprintf(val, "%i", (int)value);
+ else
+ sprintf(val, "%f", value);
+ Cvar_Set(var_name, val);
}
/*
M_DrawCharacter (x + i*8, y, 129);
M_DrawCharacter (x+i*8, y, 130);
M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131);
- sprintf(text, "%g", num);
+ sprintf(text, "%f", num);
M_Print(x + (SLIDER_RANGE+2) * 8, y, text);
}
v = G_FLOAT(OFS_PARM0);
s = PR_GetTempString();
- // LordHavoc: ftos improvement
- sprintf (s, "%g", v);
+ if ((float)((int)v) == v)
+ sprintf(s, "%i", (int)v);
+ else
+ sprintf(s, "%f", v);
G_INT(OFS_RETURN) = PR_SetString(s);
}
buf = NULL;
for (light = r_shadow_worldlightchain;light;light = light->next)
{
- sprintf(line, "%s%g %g %g %g %g %g %g %d %s\n", light->castshadows ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->lightradius / r_editlights_rtlightssizescale.value, light->light[0] / r_editlights_rtlightscolorscale.value, light->light[1] / r_editlights_rtlightscolorscale.value, light->light[2] / r_editlights_rtlightscolorscale.value, light->style, light->cubemapname ? light->cubemapname : "");
+ sprintf(line, "%s%f %f %f %f %f %f %f %d %s\n", light->castshadows ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->lightradius / r_editlights_rtlightssizescale.value, light->light[0] / r_editlights_rtlightscolorscale.value, light->light[1] / r_editlights_rtlightscolorscale.value, light->light[2] / r_editlights_rtlightscolorscale.value, light->style, light->cubemapname ? light->cubemapname : "");
if (bufchars + (int) strlen(line) > bufmaxchars)
{
bufmaxchars = bufchars + strlen(line) + 2048;