
ownerdraw



ownerdraw is the command that displays info on the screen.
For example: the weapon icon and ammo value


    menuDef {
    name "Ammo"
    visible 1
    rect 266 442 99 36

    itemDef {
    name "weapon icon"
    rect 12 0 24 24
    visible 1
    ownerdraw CG_PLAYER_AMMO_ICON2D
    }

    itemDef {
    name "ammo number value"
    rect 39 10 63 12
    visible 1
    textstyle ITEM_TEXTSTYLE_SHADOWED
    textscale .62
    forecolor 1 1 0 .5
    ownerdraw CG_PLAYER_AMMO_VALUE
    addColorRange -999 5 1 0 0 1
    }
    }


Note: for text items you can define
texstyle
textscale (size)
forecolor

To display your own text use this command

    text "your_text_here"




This is a list of the possible values for ownerdraw
(almost complete)
(alignment is relative to the area defined by itemDef)

CG_PLAYER_HEALTH
alignment: bottom center

CG_PLAYER_ARMOR_VALUE
alignment: bottom center

CG_PLAYER_AMMO_VALUE
alignment: bottom center

CG_PLAYER_ARMOR_ICON
CG_PLAYER_AMMO_ICON
CG_PLAYER_ARMOR_ICON2D
CG_PLAYER_AMMO_ICON2D

CG_PLAYER_HEALTH_BAR_100
CG_PLAYER_HEALTH_BAR_200
CG_PLAYER_ARMOR_BAR_100
CG_PLAYER_ARMOR_BAR_200
Bars consist of two items. One goes up to 100 and the other goes up to 200.
Each item requires a background image.
example:

    menuDef {
    name "Health Bars"
    fullScreen MENU_FALSE
    visible MENU_TRUE
    rect 130 435 142 32

    itemDef {
    name "health Fill 200"
    rect 85 0 64 32
    visible 1
    ownerdraw CG_PLAYER_HEALTH_BAR_200
    style WINDOW_STYLE_FILLED
    background "ui/assets/hud/h200.tga"
    }

    itemDef {
    name "health Fill 100"
    rect 0 27 128 16
    visible 1
    ownerdraw CG_PLAYER_HEALTH_BAR_100
    style WINDOW_STYLE_FILLED
    background "ui/assets/hud/h100.tga"
    }
    }



CG_GAME_TYPE_ICON
can't change the color.

CG_GAME_TYPE
name (example "Free For All")
alignment: on top - left

CG_CAPFRAGLIMIT
captures, frags or rounds limit.
alignment: on top - left

CG_LEVELTIMER
alignment: on top - left

CG_ROUNDTIMER
in CA, 30-second countdown to end of round
red text
alignment: on top-left

CG_1STPLACE
CG_2NDPLACE
numbers only
In team matches (CTF, CA, TDM)
CG_1STPLACE is red team
CG_2NDPLACE is blue team
In FFA these are the actual 1st place and 2nd place
alignment: on top - left

CG_1ST_PLACE_SCORE
CG_2ND_PLACE_SCORE
names and numbers
alignment: on top - center

CG_PLAYER_SCORE
individual score for team games
(it also shows your score in FFA)
alignment: bottom - center


CG_BLUE_SCORE
CG_RED_SCORE
numbers only
alignment: bottom - right

CG_MATCH_WINNER
"x wins with n"
alignment: on top - left

CG_PLAYER_HASFLAG
CG_PLAYER_HASFLAG2D
(icons) if you have the flag

CG_RED_CLAN_PLYRS
CG_BLUE_CLAN_PLYRS
for Clan Arena, number of survivors.
alignment: on top - left

CG_KILLER
who fragged you
alignment: bottom - center

CG_PLAYER_OBIT
constant update: who fragged who
can't change color.
alignment: on top - left

CG_MAP_NAME
alignment: on top - left

CG_PLAYER_LOCATION
works only for some maps.
alignment: bottom - left

CG_AREA_NEW_CHAT
area to show the chat messages.
can't change size or color.
alignment: bottom - left

CG_FOLLOW_PLAYER_NAME
"Following player_name - (Red/Blue)
alignment: on top - left

CG_PLAYER_HEAD
3D icon


CG_PLAYER_ITEM
Icon. Usable items: kamikaze, invulnerability, etc.

CG_CTF_POWERUP
Icon. Capture the Flag powerups: scout, guard, etc.

CG_AREA_POWERUP
Powerups: quad-damage, regeneration, etc.
take a look at the highlighted lines.

    itemDef {
    rect 0 0 35 35
    visible 1
    ownerdraw CG_AREA_POWERUP
    special 4 // space between icons
    align HUD_VERTICAL //or HUD_HORIZONTAL
    }


CG_TEAM_COLOR
adds a color background.
red/blue for team games, no background for non-team games.

CG_TEAM_COLORIZED
requires a background image.
displays the image using red/blue for team games, yellow for non-team games.
example:

    itemDef {
    rect 0 0 32 32
    visible 1
    ownerdraw CG_TEAM_COLORIZED
    style WINDOW_STYLE_FILLED
    background "icons/icon_time.tga"
    }

 
---




ownerdrawflag



ownerdrawflag is used to display items only when a certain condition is met.

One example: the following piece of code displays two messages
"OK" if you are in 1st place
"wtf ?" if you are not in 1st place

    menuDef {
    visible 1
    rect 300 240 20 20

    itemDef {
    rect 0 0 32 32
    visible 1
    text "OK"
    ownerdrawflag CG_SHOW_IF_PLYR_IS_FIRST_PLACE
    }

    itemDef {
    rect 0 0 32 32
    visible 1
    text "wtf ?"
    ownerdrawflag CG_SHOW_IF_PLYR_IS_NOT_FIRST_PLACE
    }

    }




This is a list of the possible values for ownerdrawflag (almost complete)


CG_SHOW_IF_PLYR_IS_FIRST_PLACE
CG_SHOW_IF_PLYR_IS_NOT_FIRST_PLACE
CG_SHOW_IF_RED_IS_FIRST_PLACE
CG_SHOW_IF_BLUE_IS_FIRST_PLACE


CG_SHOW_IF_PLYR_IS_ON_RED
CG_SHOW_IF_PLYR_IS_ON_BLUE


CG_SHOW_IF_PLAYER_HAS_FLAG
CG_SHOW_YOURTEAMHASENEMYFLAG
CG_SHOW_OTHERTEAMHASFLAG
CG_SHOW_BLUE_TEAM_HAS_REDFLAG
CG_SHOW_RED_TEAM_HAS_BLUEFLAG


CG_SHOW_ANYTEAMGAME
CG_SHOW_ANYNONTEAMGAME
CG_SHOW_CTF
CG_SHOW_CLAN_ARENA
CG_SHOW_TOURNAMENT
duel matches


CG_SHOW_HEALTHCRITICAL
(when your health is <= 25 )
CG_SHOW_HEALTHOK
(health > 25)


CG_SHOW_IF_WARMUP
CG_SHOW_IF_NOT_WARMUP 