I have a graphic I want to move on the screen from xy (256.0, 128.0) to (190.0, 128.0) in 35 steps. The formula now is (a-b /steps), which produces quite a big decimal remainder. Because using SetHudSize is a requirement for this, I can't rely on decimal places. So when browsing the tutorial section of zdoom, the %= assigner caught my eye. I've never seen it used and have no idea if it is even supported, but it fits the current solution I have.
The way I see it, I can run a loop that keeps adding the remainder (if it can indeed be separated with the modulus Assigner) to its-self until the value goes over 1.0, then use the number of iterations it too to monitor the main variable. As the graphic moves along the steps, if the step number goes over the remainder iteration value, an extra 1 is added in to compensate for rendering errors. Not ideal, but it should look better than just dropping the remainder all together, which is what is happening now. In short, the code would look something like this:
Code: Select all
While(Somedecimil < 1.0)
{
rem_itr++;
Somedecimill += Somedecimil;
}
...
if(steps == rem_itr)
{
Xval += 1;
rem_itr += rem_itr;
}
Now, will this work? Does anybody else have any other solutions that might fit here? And, does the %= assignment exist and work the way I'm describing here?