Tremulous Forum
Mods => Mod Releases => HUDs => Topic started by: ULTRA Random ViruS on March 25, 2014, 02:13:11 pm
-
Say, does anyone know how to colour lagometers, I want it particularly so I'll be able to create a function that puts an alerting red colour on my screen whenever ping exceeds 400 (because unlagged ceases to exist beyond that).
This is the default HUD function that's available to me, given from Meisseli's Hud for 1.1:
//LAGOMETER
itemDef
{
name "lagometer"
rect 596 25 32 20
style WINDOW_STYLE_EMPTY
visible 1
cvartest meis_infopanel
showCvar { 1 }
decoration
forecolor 0.8 0.8 1.0 1.0
textscale 0.3
textalignx 1
textaligny 0.5
ownerdraw CG_LAGOMETER
}
And What I want to do, is give it colour ranges using this function:
addColorRange <rangestart> <rangeend> <r> <g> <b> <alpha/transparency>
but it doesn't seem to work for this one if I shove it in the lagometer draw function.
The attachment below is what my hud currently looks like on an impure server*:
(Note: I'm drawing fake ping using a custom client command)
From left to right, top to bottom of the top right of the screen:
Speed [Fake Graph] FPS
Inter/Extrapolation Ping
Clock
-
Say, does anyone know how to colour lagometers, I want it particularly so I'll be able to create a function that puts an alerting red colour on my screen whenever ping exceeds 400 (because unlagged ceases to exist beyond that).
[...]
What I want to do, is give it colour ranges using this function:
addColorRange <rangestart> <rangeend> <r> <g> <b> <alpha/transparency>
but it doesn't seem to work for this one if I shove it in the lagometer draw function.
unfortunately, there is no such functionality implemented in the cgame module, ie., lagometer colorizing cannot be done by editing HUD files. pingtime-based (or any other programmed) conditional HUD drawing is also not implemented. you'll need to edit the code of the cgame module and compile it; see the CG_DrawLagometer() function in the cg_draw.c file.
-
It works for health bars though.
What else would it work for without changing the cgame code?
-
It works for health bars though.
What else would it work for without changing the cgame code?
surprizingly, only health, ammo and clips. see the CG_GetValue() function. it would need to return a ping value if
ownerDraw == CG_LAGOMETER
(refer to the CG_DrawLagometer() function for the method to get the value).
-
I probably should start modding again, I haven't touched tremulous code since january :P
Thanks for the assistance :laugh:
-
Not many people in the forums. I've only just now downloaded Trem again . . So I hear ya.