Tremulous Forum

General => Feedback => Topic started by: Vector_Matt on August 10, 2007, 04:12:22 pm

Title: Ui ownerdraw questions
Post by: Vector_Matt on August 10, 2007, 04:12:22 pm
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
Code: [Select]
//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?
Title: Ui ownerdraw questions
Post by: kevlarman on August 10, 2007, 04:24:26 pm
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)
Title: Ui ownerdraw questions
Post by: Vector_Matt on August 10, 2007, 05:52:55 pm
Thanks for the information. This is now a feature request then.
Title: Ui ownerdraw questions
Post by: Paradox on August 10, 2007, 09:11:50 pm
I asked for it a long time ago... good luck
Title: Ui ownerdraw questions
Post by: /dev/humancontroller on August 10, 2007, 09:18:51 pm
Use a pure server hack.
Title: Ui ownerdraw questions
Post by: Vector_Matt on August 11, 2007, 12:26:58 am
Quote from: "/dev/humancontroller"
Use 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: "Paradox"
I asked for it a long time ago... good luck
Mabey I'll submit a patch...eventually...mabey...
Title: Ui ownerdraw questions
Post by: Paradox on August 11, 2007, 12:38:04 am
http://svn.icculus.org/tremulous/trunk/src/cgame/cg_draw.c

Theres a list of all ownerdraws.
Title: Ui ownerdraw questions
Post by: Vector_Matt on August 11, 2007, 12:55:59 am
Quote from: "Paradox"
http://svn.icculus.org/tremulous/trunk/src/cgame/cg_draw.c

Theres a list of all ownerdraws.
Thanks.
Title: Ui ownerdraw questions
Post by: tehOen on August 11, 2007, 01:37:50 am
Quote from: "Paradox"
http://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
Title: Ui ownerdraw questions
Post by: benmachine on August 11, 2007, 02:38:15 am
Quote from: "tehOen"
imho 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=auto
look down a bit
Title: Ui ownerdraw questions
Post by: Paradox on August 11, 2007, 04:50:04 pm
I gave him the main view so he could select the revision he was using (likely 755)