Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3233 closed enhancement (fixed)

[PATCH] Show capture bars when hoovering, similar to health bars

Reported by: sanderd17 Owned by: sanderd17
Priority: Should Have Milestone: Alpha 19
Component: Core engine Keywords:
Cc: Patch:

Description

When something is capturable, you should be able to see its state easily.

But sadly, the Engine only supports overlay textures. And as the capture bar needs player colours to represent the capture state, having textures is not versatile enough.

Included is a patch that should add CColor support, but sadly, I'm stumbling over OpenGL, and can only get black rectangles. The sprite->m_Color logged at the OverlayRenderer line 657 contains the wanted color, so it probably fails at the OpenGL commands trying to render the colour.

Another issue is that the bar doesn't get removed when unselecting the building. But maybe that's related.

Attachments (3)

color_sprite.diff (11.8 KB ) - added by sanderd17 9 years ago.
sprite_with_color_mul.patch (7.6 KB ) - added by Vladislav Belov 9 years ago.
Add to function "AddSprite" color param, which multiply texture value
sprite_with_color_mul.2.patch (7.7 KB ) - added by Vladislav Belov 9 years ago.

Download all attachments as: .zip

Change History (9)

by sanderd17, 9 years ago

Attachment: color_sprite.diff added

comment:1 by sanderd17, 9 years ago

To summarise some IRC comments from a week or two ago: It would be better to stick to one method, and require a texture and a colour. Then when displaying, the texture can be multiplied with the colour.

So when taking a more-or-less white texture, and the playercolour, it would result in a playercolour bar. While multiplying the existing textures with pure white, they wouldn't be altered.

by Vladislav Belov, 9 years ago

Attachment: sprite_with_color_mul.patch added

Add to function "AddSprite" color param, which multiply texture value

comment:2 by sanderd17, 9 years ago

Hmm, it looks like the ARB shader doesn't work. When launching a game (or even an empty map), I get

ERROR: Failed to compile fragment program 'shaders/arb/foreground_overlay.fp' (line 4):
line 4, char 19: error: syntax error, unexpected IDENTIFIER

So it appears that colorMul isn't defined there.

When I change the colorMul to fragment.color (and change the colorMul in the xml file to color), and add a TEMP variable (so it doesn't have to read the result), I don't get any errors anymore. But it appears that it's reading random memory (the textures flicker a bit like analog TV noise).

by Vladislav Belov, 9 years ago

comment:3 by sanderd17, 9 years ago

Owner: set to sanderd17
Resolution: fixed
Status: newclosed

In 16715:

Allow sprites to have color multiplication, which allows player-colored bars. Patch by Vladislav. Fixes #3233

comment:4 by sanderd17, 9 years ago

Milestone: BacklogAlpha 19

comment:5 by sanderd17, 9 years ago

In 16716:

Split up different status bars for even easier moddability + add a capture bar (thanks again to Vladislav for making this possible). Refs #3233

comment:6 by Palaxin, 8 years ago

Summary: [Patch] Show capture bars when hoovering, similar to health bars[PATCH] Show capture bars when hoovering, similar to health bars
Note: See TracTickets for help on using tickets.