The Ur-Quan Masters bug database
Bugzilla Version 2.22.2
View Bug Activity | Format For Printing | XML | Clone This Bug
i think it would be teh kewl if rings around saturn ;)
Created an attachment (id=298) [details] rings.patch That first comment is always so hard to come up with... :) Here is a patch to draw "rings" around gas giant planets, it is very rough at this point, and I am seeking comments on it. Current known problems: - The rings obscure coarse scans. I'm not sure what can be done about this. - The method for picking a colour for the rings is pure voodoo. I wasn't able to determine how the colourmap stuff worked, so I stole code and glued it together in a manner that seems to work. - The algorithm may or may not be the best way to do things. It seemed like a good idea at the time.
Created an attachment (id=299) [details] screenshot Here is a screenshot of the code in action
Update: I have reworked my code to precompute and reuse values wherever possible, but I'll not submit the new patch as it does not address any of the issues listed above; it just makes it a bit faster and alot easier to read.
Created an attachment (id=300) [details] rings.patch (new) Here is a version of the patch with expanded comments/documentation, a more readable (and hopefully optimized) algorithm for drawing the rings, and the ability for coarse scans to print over the rings (with a nice 1-pixel black stroke for enhanced readability) The latter was done by pushing the PrintCoarseScan* functions down into RotatePlanet(), and making RotatePlanet() cognisant of a small part of the MenuState. Yes, this means that the Coarse Scan prints once per frame when the coarse scan is activated. No, there isn't a noticable performance hit for doing so, at least not on my machine. This patch is my final submission for the issue; I posit that it's ready to go in (coredev willing), despite the fact that some gas giants have funny coloured rings (Uranus, for example) but if anyone knows how that crazy pointer arithmetic goo in the colourmap works, they can patch over the top of it.
Created an attachment (id=301) [details] screenshot (new) Here is a screenshot of the new code.
Created an attachment (id=306) [details] rings.patch (new & improved) The rings patch suffered from an off-by-one error that would cause SEGVs if the player visited too many gas giants (5 or so); I've fixed the patch to correct this.
Looks pretty nice...
Created an attachment (id=329) [details] rings.patch (final) "final" submission for the rings patch. This is an improvement over previous versions, notable changes include: - added font_DrawTextWithStroke() function to font.c, modified coarse scan and subtitle functions to use it - mimicked Mika's technique for caching subtitles to cache the coarse scan; this allows the coarse scan to be drawn once per frame without clogging up the DCQ. - The ring creation code now properly retrieves a colour from the planet's colourmap, thus curing the "neon green rings" problem in previous patches. - rings don't appear around grey, cyan, and yellow gas giants, or any gas giant with an axial tilt of less than 5 degrees, in order to make for a bit of variety.
This patch has been rejected by coredev (to my immense regret) as it violates the "straight port doctrine" that the project operates currently under. Deferring this bug until after version 1.0 is released, and such deviations from the original might be considered in a new light.