Author Topic: Feature proposal: Custom gauge color inheritance  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

Feature proposal: Custom gauge color inheritance
Saga usuas a custom gauge. We usually specify a color for it in hud_gauges.tbl but we noticed that the player cannot change that color like everything else in the HUD in the HUD options screen.
So we had the idea to specify a color-parent for custom gauges, so the gauge inherits the color of that main gauge and the player can change the color by changing the parent's color.

This should make sense for many mods, since a static gauge color is nearly never wanted, and a custom gauge is also nearly always related in function to some main gauge, so a color inheritance makes sense (in our case we inherit from the "center of reticle" gauge.

I implemented a patch for this (if the patch file doesn't work, tell me. I had SVN create it and had to manually erase changes from a different implementation to only leave the relevant lines in the patch file, should have worked, but if there's trouble I'll try to recreate it).

It basically works like this:

I added a hardcoded list of all gauge names, which are identical to the ones specified in the hud_#.hcf files in the players directory.
The modder can specify the color parent for a gauge like this:

Code: [Select]
$Default:                       (1024 768)
        $<GaugeName>:          (347 219)
;            +Color:                     175 230 175
            +ColorParent:           center of reticle
#End

If additional to the color parent a color is specified (the commented out line) then this color will be ignored unless the specified parent name is invalid.
The game does a simple for-loop lookup (only done once and there are only 39 gauges, so no performance issue noticable) to check the name to get the gauge index and stores that
for the custom gauge.

The HUD rendering code later checks if a parent gauge was specified. If not the index is -1. If one is specified its color will be used instead of the specified gauge color.
If not, or in case the index is invalid, the behavior as before is maintained.

maybe someone wants to check this out and maybe optimize it or change several things, but I think it works nicely like this and other mods might benefit from this, since up until now custom gauges were always static in terms of color, which is a clear drawback of using them.

[attachment deleted by admin]
« Last Edit: December 10, 2009, 10:01:57 pm by KeldorKatarn »