I am trying to make my hud display an ammo bar similar to the CG_PLAYER_HEALTH_BAR thing.
The code for the health bar I have is
//HEALTH BAR LEFT
itemDef
{
name "healthbarleft"
rect 290 275 30 5
visible 1
decoration
forecolor 0.0 0.8 1.0 .3
align ITEM_ALIGN_RIGHT
textscale 0
ownerdraw CG_PLAYER_HEALTH_BAR
}
//HEALTH BAR RIGHT
itemDef
{
name "healthbarright"
rect 320 275 30 5
visible 1
decoration
forecolor 0.0 0.8 1.0 .3
align ITEM_ALIGN_LEFT
textscale 0
ownerdraw CG_PLAYER_HEALTH_BAR
}I want to make it display a bar like that for ammo, but CG_PLAYER_AMMO_BAR is not defined, and when I use CG_PLAYER_AMMO_VALUE it just displays a number there, instead of a bar.
Does anyone know what I should put in ownerdraw to make this work?
ownerdraw items on the hud are rendered by the cgame, you will need to add an additional function (and the associated entry in an enum and that 5 page long switch) to have an ammo bar. since you can't modify the cgame unless you play on unpure servers (or servers with a mod to make you download that cgame), you're pretty much out of luck. (i would have moved this to technical questions, but if this is going to become a feature request i'll move it to feedback instead)
Thanks for the information. This is now a feature request then.
I asked for it a long time ago... good luck
Use a pure server hack.
Quote from: /dev/humancontrollerUse a pure server hack.
:eek: Cheating is wrong.
That, and I'm too lazy to do a pure server hack just to have a nicer ui.Quote from: ParadoxI asked for it a long time ago... good luck
Mabey I'll submit a patch...eventually...mabey...
http://svn.icculus.org/tremulous/trunk/src/cgame/cg_draw.c
Theres a list of all ownerdraws.
Quote from: Paradoxhttp://svn.icculus.org/tremulous/trunk/src/cgame/cg_draw.c
Theres a list of all ownerdraws.
Thanks.
Quote from: Paradoxhttp://svn.icculus.org/tremulous/trunk/src/cgame/cg_draw.c
Theres a list of all ownerdraws.
imho trying a header file is better to find #define; you have to read less code
Quote from: tehOenimho trying a header file is better to find #define; you have to read less code
e.g.
http://svn.icculus.org/tremulous/trunk/ui/menudef.h?rev=925&view=autolook down a bit
I gave him the main view so he could select the revision he was using (likely 755)