summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 12:35:04 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:05 +0000
commited3a99c42a9173e456620a63a91acb635d3ed94c (patch)
tree4842c5116e7a91c8b42cc4b4d15d102dacbc63ba
parent8bb863e005db6faf45e545a16ed66d552366d55f (diff)
* Fix text alignment of UI items that display cvar contents
* (bug 3952) display winning team string at the bottom of the scoreboard after a game * Prevent users from changing some ui communication cvars
-rw-r--r--src/cgame/cg_main.c15
-rw-r--r--src/ui/ui_main.c1
-rw-r--r--src/ui/ui_shared.c8
-rw-r--r--ui/teamscore.menu14
4 files changed, 27 insertions, 11 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 6fe7655d..deb19580 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -317,13 +317,14 @@ static cvarTable_t cvarTable[ ] =
{ &cg_debugVoices, "cg_debugVoices", "0", 0 },
- { &ui_currentClass, "ui_currentClass", "0", 0 },
- { &ui_carriage, "ui_carriage", "", 0 },
- { &ui_stages, "ui_stages", "0 0", 0 },
- { &ui_dialog, "ui_dialog", "Text not set", 0 },
- { &ui_voteActive, "ui_voteActive", "0", 0 },
- { &ui_humanTeamVoteActive, "ui_humanTeamVoteActive", "0", 0 },
- { &ui_alienTeamVoteActive, "ui_alienTeamVoteActive", "0", 0 },
+ // communication cvars set by the cgame to be read by ui
+ { &ui_currentClass, "ui_currentClass", "0", CVAR_ROM },
+ { &ui_carriage, "ui_carriage", "", CVAR_ROM },
+ { &ui_stages, "ui_stages", "0 0", CVAR_ROM },
+ { &ui_dialog, "ui_dialog", "Text not set", CVAR_ROM },
+ { &ui_voteActive, "ui_voteActive", "0", CVAR_ROM },
+ { &ui_humanTeamVoteActive, "ui_humanTeamVoteActive", "0", CVAR_ROM },
+ { &ui_alienTeamVoteActive, "ui_alienTeamVoteActive", "0", CVAR_ROM },
{ &cg_debugRandom, "cg_debugRandom", "0", 0 },
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index a741bf8c..d1af8f85 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -123,6 +123,7 @@ static cvarTable_t cvarTable[ ] =
{ &ui_textWrapCache, "ui_textWrapCache", "1", CVAR_ARCHIVE },
{ &ui_developer, "ui_developer", "0", CVAR_ARCHIVE | CVAR_CHEAT },
{ &ui_emoticons, "cg_emoticons", "1", CVAR_LATCH | CVAR_ARCHIVE },
+ { &ui_winner, "ui_winner", "", CVAR_ROM }
};
static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index f62f7385..8862f328 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -4466,15 +4466,15 @@ void Item_SetTextExtents( itemDef_t *item, int *width, int *height, const char *
*width = item->textRect.w;
*height = item->textRect.h;
+ // as long as the item isn't dynamic content (ownerdraw or cvar), this
// keeps us from computing the widths and heights more than once
-
- if( *width == 0 || ( item->type == ITEM_TYPE_OWNERDRAW && item->textalignment == ALIGN_CENTER ) )
+ if( *width == 0 || item->cvar || ( item->type == ITEM_TYPE_OWNERDRAW &&
+ item->textalignment != ALIGN_LEFT ) )
{
int originalWidth;
- if( item->type == ITEM_TYPE_EDITFIELD && item->textalignment == ALIGN_CENTER && item->cvar )
+ if( item->cvar && item->textalignment != ALIGN_LEFT )
{
- //FIXME: this will only be called once?
char buff[256];
DC->getCVarString( item->cvar, buff, 256 );
originalWidth = UI_Text_Width( item->text, item->textscale, 0 ) +
diff --git a/ui/teamscore.menu b/ui/teamscore.menu
index eac8f1f5..27528ea1 100644
--- a/ui/teamscore.menu
+++ b/ui/teamscore.menu
@@ -356,5 +356,19 @@
ownerdraw CG_SPECTATORS
decoration
}
+
+ itemDef
+ {
+ name winner
+ rect (W/2) (H+BAR_H) 0 0
+ style WINDOW_STYLE_EMPTY
+ forecolor 1 1 1 1
+ textscale 0.5
+ textalign ALIGN_CENTER
+ textvalign VALIGN_TOP
+ visible MENU_TRUE
+ cvar "ui_winner"
+ decoration
+ }
}
}