Skip to content

Commit 0edb64c

Browse files
committed
Add flipped property for flagstatus hud icons
1 parent 8dfb158 commit 0edb64c

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

code/cgame/cg_newdraw.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,8 +3252,14 @@ void CG_Q3F_DrawHUDIcons(rectDef_t *rect, float tscale, vec4_t color, int textSt
32523252
Com_sprintf(buf, sizeof(buf), "%d", (int)t/1000);
32533253
y += (h - CG_Text_Height(buf, tscale, 0, font)) / 2;
32543254

3255-
// TODO put the reverse'd text on left hand side of the icon as well
3256-
CG_Text_Paint(x + text_x + (w/2) + 7, y + text_y + 2, tscale, colorWhite, buf, 0, 0, textStyle, font, textalignment);
3255+
if (reverse) {;
3256+
float textWidth = CG_Text_Width(buf, tscale, 0, font);
3257+
CG_Text_Paint(x - textWidth - 7, y + text_y + 2, tscale, colorWhite, buf, 0, 0, textStyle, font, textalignment);
3258+
}
3259+
else {
3260+
3261+
CG_Text_Paint(x + text_x + (w / 2) + 7, y + text_y + 2, tscale, colorWhite, buf, 0, 0, textStyle, font, textalignment);
3262+
}
32573263
}
32583264
}
32593265
} else if( cent->currentState.eFlags & EF_VOTED ) {
@@ -3888,7 +3894,7 @@ void CG_OwnerDraw( itemDef_t *item, float x, float y, float w, float h, float te
38883894
CG_Q3F_DrawScoreboardTeamScores( &rect, scale, color, textStyle, textalignment, text_x, text_y, parentfont );
38893895
break;
38903896
case CG_HUDICONS:
3891-
CG_Q3F_DrawHUDIcons( &rect, scale, color, textStyle, textalignment, text_x, text_y, parentfont, item->special, qfalse );
3897+
CG_Q3F_DrawHUDIcons( &rect, scale, color, textStyle, textalignment, text_x, text_y, parentfont, item->special, item->flipped );
38923898
break;
38933899

38943900
case CG_LEVELSHOT:

code/ui_new/ui_shared.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5514,6 +5514,11 @@ qboolean ItemParse_feeder( itemDef_t *item, int handle ) {
55145514
return qtrue;
55155515
}
55165516

5517+
qboolean ItemParse_flipped( itemDef_t *item, int handle ) {
5518+
item->flipped = qtrue;
5519+
return qtrue;
5520+
}
5521+
55175522
// elementtype, used to specify what type of elements a listbox contains
55185523
// uses textstyle for storage
55195524
qboolean ItemParse_elementtype( itemDef_t *item, int handle ) {
@@ -6266,6 +6271,7 @@ static keywordHash_t itemParseKeywords[] = {
62666271
{ "scale", ItemParse_scale, NULL },
62676272
{ "class", ItemParse_class, NULL },
62686273
{ "weapon", ItemParse_weapon, NULL },
6274+
{ "flipped", ItemParse_flipped, NULL },
62696275
// djbob
62706276
{NULL, NULL, NULL}
62716277
};

code/ui_new/ui_shared.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ typedef struct itemDef_s {
354354
int classLimit; // slothy - show items only for specific classes
355355
int weaponLimit; // slothy - show item only for specific weapon
356356

357+
qboolean flipped; // Ensiform - flipped state for CG_HUDICONS if true the columns are swapped and the text is shown on left side of icon
358+
357359
} itemDef_t;
358360

359361
typedef struct fontStruct_s {

0 commit comments

Comments
 (0)