General Fixes

The string dimension functions were using unsigned integers internally
whilst calculating the dimensions, what they should have been doing was
using a float and then returning the ceiled result. They now work
perfectly and I tested thoroughly with keyboard_string and various fonts.
I also reformatted this file it was kind of fucked up from the last time I
edited it, it is all good now.

The following code was used for testing.
```cpp
draw_text(0,0,keyboard_string);
draw_line(string_width(keyboard_string), 0, string_width(keyboard_string), string_height(keyboard_string));
```

* I also fixed the display reset issues, Direct3D had the depth buffer turned on by default in screen init,  OGL did not, and GM compatibility says it should be off by default.
* I have also committed quite a few improvements to the command line interface, basically getting it working, and starting on GMX handling.
* Makes window_set_cursor update immediately for Win32 like it should. The return types were also incorrect, I just made them return the result of SendMessage. Fixes #761
* Fixes display/device reset for D3D9, asside from having dangling pointers in a few places, I had to implement OnDeviceLost and OnDeviceReset() The actual surface data is saved system memory side and then restored, so no surface data is lost which was a bug in earlier versions of GM and is oddly still noted in the Studio manual.
* Attempts to fix up surface and screen saving a bit, I never fixed them when switching most of the engine to BGRA from RGBA. Also implements some of the functions for Direct3D9. More testing needs done, but also bmp is crashing again and OpenGL is upside down which is ok for bmp but needs reversed for png.