From 412d3c9c3479012d687139f891d14cfe18b6e6ee Mon Sep 17 00:00:00 2001 From: "Tony J. White" Date: Sat, 3 Oct 2009 11:45:20 +0000 Subject: * 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 --- src/cgame/cg_local.h | 2 ++ src/cgame/cg_main.c | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index f090e928..9bdcb3b9 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1533,6 +1533,8 @@ extern vmCvar_t cg_projectileNudge; extern vmCvar_t cg_voice; +extern vmCvar_t cg_emoticons; + // // cg_main.c // diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index b239236d..9a40a5c3 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -214,6 +214,8 @@ vmCvar_t cg_projectileNudge; vmCvar_t cg_voice; +vmCvar_t cg_emoticons; + typedef struct { @@ -336,7 +338,9 @@ static cvarTable_t cvarTable[ ] = { &pmove_msec, "pmove_msec", "8", 0}, { &cg_noTaunt, "cg_noTaunt", "0", CVAR_ARCHIVE}, - { &cg_voice, "voice", "default", CVAR_USERINFO|CVAR_ARCHIVE} + { &cg_voice, "voice", "default", CVAR_USERINFO|CVAR_ARCHIVE}, + + { &cg_emoticons, "cg_emoticons", "1", CVAR_LATCH|CVAR_ARCHIVE} }; static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); @@ -1663,6 +1667,8 @@ void CG_LoadHudMenu( void ) void CG_AssetCache( void ) { + int i; + cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR ); cgDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR ); cgDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN ); @@ -1672,6 +1678,17 @@ void CG_AssetCache( void ) cgDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB ); cgDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR ); cgDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB ); + + if( cg_emoticons.integer ) + cgDC.Assets.emoticonCount = BG_LoadEmoticons( cgDC.Assets.emoticons ); + else + cgDC.Assets.emoticonCount = 0; + + for( i = 0; i < cgDC.Assets.emoticonCount; i++ ) + { + cgDC.Assets.emoticonShaders[ i ] = trap_R_RegisterShaderNoMip( + va( "emoticons/%s.tga", cgDC.Assets.emoticons[ i ] ) ); + } } /* -- cgit