DLL to Rotate an RGSS Bitmap... Need a hand from C++ folks!

First off, I suck at C++ and have had some success in making a DLL but I dont know enough to make the rotated images look clean!  I have a ton of noise when the bitmap rotates!  I figure someone here will be more familiar with C++ and graphics so it looks way better!


LightNoise.jpg



DEMO and Sourcecode (Visual C++)


http://downloads.chaos-project.com/heretic86/LightDLL.zip


It compiles and works, sort of.  Game crashes if it is rotated to exactly 270 degrees, not sure why, division by zero?


And yes, for the record, i do know that sprites can use angles, but the trouble is in the RPG::Cache, all images stored there are non rotated versions.  I need the bitmap to be rotated for stretch_blt for another script Im working on...


Any advice?

Original thread: https://forums.rpgmakerweb.com/threads/dll-to-rotate-an-rgss-bitmap-need-a-hand-from-c-folks.64034/