ec- / baseq3a

Unofficial Quake III Arena gamecode patch
26 stars 24 forks source link

Classic colored crosshair feature #28

Closed LegendaryGuard closed 1 month ago

LegendaryGuard commented 1 year ago

I made the code from scratch. It's the crosshair color feature of the year 2002 and its true source was never shown. This classic feature has appeared in an old mod called Bid For Power.

You can find a table of colors and how works interacting the cgame and UI in the code: https://github.com/ec-/baseq3a/pull/28/files#diff-ef6b3d31ba308d431f88f4e4fd60e7a1899fb15d850a3f4eb74e227b7f783ec8R78

How it works?

In the official Quake 3 gfx.shader, the crosshair is "broken". What that does is making the crosshair unable to be interacted with the colors. So, cg_crosshairHealth has never done nothing since this official shader has been staying there.

The modified gfx.shader is added in the repository and in pk3 package and the crosshair color can be interacted without problems.

If you've your own gfx.shader or your own shader, what you can do: You need to remove in gfx.shader the following lines that impede colorizing the crosshair:

Click to toggle the removed contents of gfx.shader ``` gfx/2d/crosshair { nopicmip { map gfx/2d/crosshair.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairb { nopicmip { map gfx/2d/crosshairb.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairc { nopicmip { map gfx/2d/crosshairc.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshaird { nopicmip { map gfx/2d/crosshaird.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshaire { nopicmip { map gfx/2d/crosshaire.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairf { nopicmip { map gfx/2d/crosshairf.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairg { nopicmip { map gfx/2d/crosshairg.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairh { nopicmip { map gfx/2d/crosshairh.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairi { nopicmip { map gfx/2d/crosshairi.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairj { nopicmip { map gfx/2d/crosshairj.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } gfx/2d/crosshairk { nopicmip { map gfx/2d/crosshairk.tga blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA rgbGen identity } } ```

Keep in mind, cg_crosshairHealth must be disabled (0). Just set 2, 3, ..., 6, 7 or 8 the color you want to set for the crosshair.

How it is in the interactive UI and how it is in-game

crosshairColorUI crosshairColorPalettes crosshairColorInGame
ensiform commented 1 year ago

I feel like it would be better to be in sync with the other color customization instead of the 0-7 codes.

ghost commented 1 year ago

The position of the slider is wrong, maybe caused by what ensiform said (color codes sync).

LegendaryGuard commented 1 year ago

It works as it should, that's how it is. If the value is out from 2 - 8, the slider will set to white if you go in UI; after if you didn't change the value in UI and went in-game, your value remains unchanged (set to cvar value).

The slider is like Player effects one.

ghost commented 1 year ago

... ah, okay, but somehow it looks strange if the color of the slider doesn't match the color of the colorbar, I can't see this on player effect (colorbar/slider). Wouldn't it make more sense, if both represents the same color, not only the slider? This is how it is done with the player effect setting. For example, if the color of the crosshair should be cyan and the slider changes its color to cyan, the position of the slider should be at the cyan position as well (and not at the blue position).

LegendaryGuard commented 1 month ago

Gotta close the PR. I don't know what it could happen if it were merged (breaking incompatibility with Q3A, maybe?). I guess that isn't going anywhere. That was a demonstration of how the ancient mods used this feature before RGBA.

There's other PR opened from other guy who did another version using the code from here: https://github.com/ec-/baseq3a/pull/35