Tremulous Forum

Mods => Mod Releases => HUDs => Topic started by: ULTRA Random ViruS on March 25, 2014, 02:13:11 pm

Title: HUD - Colour Ranged numbers
Post 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:
Code: [Select]
   //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:
Code: [Select]
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
Title: Re: HUD - Colour Ranged numbers
Post by: /dev/humancontroller on March 26, 2014, 07:43:54 am
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:
Code: [Select]
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.
Title: Re: HUD - Colour Ranged numbers
Post by: ULTRA Random ViruS on March 26, 2014, 03:10:21 pm
It works for health bars though.

What else would it work for without changing the cgame code?
Title: Re: HUD - Colour Ranged numbers
Post by: /dev/humancontroller on March 26, 2014, 08:21:20 pm
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
Code: [Select]
ownerDraw == CG_LAGOMETER(refer to the CG_DrawLagometer() function for the method to get the value).
Title: Re: HUD - Colour Ranged numbers
Post by: ULTRA Random ViruS on March 27, 2014, 09:52:42 am
I probably should start modding again, I haven't touched tremulous code since january :P
Thanks for the assistance  :laugh:
Title: Re: HUD - Colour Ranged numbers
Post by: Xenina on June 13, 2015, 09:45:21 am
Not many people in the forums. I've only just now downloaded Trem again . . So I hear ya.