summaryrefslogtreecommitdiff
path: root/src/ui/ui_main.c
diff options
context:
space:
mode:
authorTony J. White <tjw@tjw.org>2009-10-03 11:45:20 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:18 +0000
commit412d3c9c3479012d687139f891d14cfe18b6e6ee (patch)
treec8ca701ac8e4ef8cac3a35fbe8460b058e25bbda /src/ui/ui_main.c
parenta60e24850d73f8d807bab40f256a3e017219f17e (diff)
* UI_Text_* emoticon drawing support (e.g. [dretch] draws
/emoticons/dretch.tga inline with text) * emoticons are square .tga images placed in the /emoticons dir of fs_game * emoticons should probably be 64x64 to look nice * g_emoticonsAllowedInNames (default ON) is an optional server setting to prevent players from using them in names * emoticons can be escaped by prefixing with an additional [ * cvars ui_emoticons and cg_emoticons can be set to 0 to disable drawing of emoticons in ui or cgame contexts respectively * fix color code continuation on wrapped lines * prefix all wrapped lines with a space to prevent chat shenanigans
Diffstat (limited to 'src/ui/ui_main.c')
-rw-r--r--src/ui/ui_main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index d8389c66..8d18372d 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -98,6 +98,8 @@ vmCvar_t ui_developer;
vmCvar_t ui_winner;
+vmCvar_t ui_emoticons;
+
static cvarTable_t cvarTable[ ] =
{
{ &ui_browserShowFull, "ui_browserShowFull", "1", CVAR_ARCHIVE },
@@ -120,6 +122,7 @@ static cvarTable_t cvarTable[ ] =
{ &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE},
{ &ui_textWrapCache, "ui_textWrapCache", "1", CVAR_ARCHIVE },
{ &ui_developer, "ui_developer", "0", CVAR_ARCHIVE | CVAR_CHEAT },
+ { &ui_emoticons, "ui_emoticons", "1", CVAR_LATCH | CVAR_ARCHIVE },
};
static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
@@ -190,6 +193,8 @@ intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3,
void AssetCache( void )
{
+ int i;
+
uiInfo.uiDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR );
uiInfo.uiDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR );
uiInfo.uiDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN );
@@ -199,6 +204,17 @@ void AssetCache( void )
uiInfo.uiDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB );
uiInfo.uiDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR );
uiInfo.uiDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB );
+
+ if( ui_emoticons.integer )
+ uiInfo.uiDC.Assets.emoticonCount = BG_LoadEmoticons( uiInfo.uiDC.Assets.emoticons );
+ else
+ uiInfo.uiDC.Assets.emoticonCount = 0;
+
+ for( i = 0; i < uiInfo.uiDC.Assets.emoticonCount; i++ )
+ {
+ uiInfo.uiDC.Assets.emoticonShaders[ i ] = trap_R_RegisterShaderNoMip(
+ va( "emoticons/%s.tga", uiInfo.uiDC.Assets.emoticons[ i ] ) );
+ }
}
void UI_DrawSides( float x, float y, float w, float h, float size )