generalnmx
Playful/Fascist Mod
Since we can't use sprintf directly, here's the naive (really naive) way to do it:
Where percision is 1 or 0, 10, 100, 1000, 10000, etc.
I'm sure someone has some better code, but this'll work until they post it.
Code:
dword FloatToChar(byte* text, float f, const dword percision)
{
dword beDec, afDec;
beDec = sprintf(text, "%d", (dword)f );
text[beDec] = '.';
afDec = sprintf(&text[beDec+1], "%d", (dword)((f * (float)percision) - ((dword)f * percision)) );
return (beDec+afDec+1);
}
Where percision is 1 or 0, 10, 100, 1000, 10000, etc.
I'm sure someone has some better code, but this'll work until they post it.