Hello, I've been coding along and am really enjoying the series, thank you Casey for all your hard work and for so gracefully sharing your knowledge.
On day 39 I noticed a bug in my code that caused a segfault when moving our Hero off the screen or back onto it on the Y axis, whilst writing the code to correct the display when the departing bitmap is no longer anchored on screen.
After some investigation in the visual studio debugger I noticed that the line:
int32 MaxY = RoundReal32ToInt32(RealY + (real32)Bitmap->Height);
Was causing the crash as the value of the addition of RealY and the cast to real of the Bitmap->Height were adding an additional line to the matrix for our Hero's display: Y was 163 not 162.
By replacing RealY with the previously calculated IntY, the problem was solved.
int32 MaxY = IntY + Bitmap->Height;
I have no idea why my machine generated this rounding result, and apparently not on other machines. The supplied source code does also show the same behaviour when I compile and run it locally; I would be fascinated to know why this is the case.
I thought it best to leave a note of this here, should anyone else experience the same thing; I could also be wrong about the risk of rounding errors, my machine is a very flawed intel machine, perhaps this is caused by my hardware not meeting the floating point specification too.
Thanks again.