diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 16 | ||||
-rw-r--r-- | src/cgame/cg_drawtools.c | 30 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 22 |
4 files changed, 56 insertions, 13 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 1a96e75f..89740c7c 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -3048,6 +3048,7 @@ static void CG_DrawVote( void ) char *s; int sec; vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f }; + char yeskey[ 32 ], nokey[ 32 ]; if( !cgs.voteTime ) return; @@ -3063,8 +3064,10 @@ static void CG_DrawVote( void ) if( sec < 0 ) sec = 0; - - s = va( "VOTE(%i): \"%s\" Yes:%i No:%i", sec, cgs.voteString, cgs.voteYes, cgs.voteNo ); + Q_strncpyz( yeskey, CG_KeyBinding( "vote yes" ), sizeof( yeskey ) ); + Q_strncpyz( nokey, CG_KeyBinding( "vote no" ), sizeof( nokey ) ); + s = va( "VOTE(%i): \"%s\" [%s]Yes:%i [%s]No:%i", sec, cgs.voteString, + yeskey, cgs.voteYes, nokey, cgs.voteNo ); CG_Text_Paint( 8, 340, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); } @@ -3078,6 +3081,7 @@ static void CG_DrawTeamVote( void ) char *s; int sec, cs_offset; vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f }; + char yeskey[ 32 ], nokey[ 32 ]; if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS ) cs_offset = 0; @@ -3101,8 +3105,12 @@ static void CG_DrawTeamVote( void ) if( sec < 0 ) sec = 0; - s = va( "TEAMVOTE(%i): \"%s\" Yes:%i No:%i", sec, cgs.teamVoteString[ cs_offset ], - cgs.teamVoteYes[cs_offset], cgs.teamVoteNo[ cs_offset ] ); + Q_strncpyz( yeskey, CG_KeyBinding( "teamvote yes" ), sizeof( yeskey ) ); + Q_strncpyz( nokey, CG_KeyBinding( "teamvote no" ), sizeof( nokey ) ); + s = va( "TEAMVOTE(%i): \"%s\" [%s]Yes:%i [%s]No:%i", sec, + cgs.teamVoteString[ cs_offset ], + yeskey, cgs.teamVoteYes[cs_offset], + nokey, cgs.teamVoteNo[ cs_offset ] ); CG_Text_Paint( 8, 360, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL ); } diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c index 3151f66f..06ae0713 100644 --- a/src/cgame/cg_drawtools.c +++ b/src/cgame/cg_drawtools.c @@ -346,3 +346,33 @@ qboolean CG_WorldToScreen( vec3_t point, float *x, float *y ) return qtrue; } + +/* +================ +CG_KeyBinding +================ +*/ +char *CG_KeyBinding( const char *bind ) +{ + static char key[ 32 ]; + char bindbuff[ MAX_CVAR_VALUE_STRING ]; + int i; + + key[ 0 ] = '\0'; + // NOTE: change K_LAST_KEY to MAX_KEYS for full key support (eventually) + for( i = 0; i < K_LAST_KEY; i++ ) + { + trap_Key_GetBindingBuf( i, bindbuff, sizeof( bindbuff ) ); + if( !Q_stricmp( bindbuff, bind ) ) + { + trap_Key_KeynumToStringBuf( i, key, sizeof( key ) ); + break; + } + } + if( !key[ 0 ] ) + { + Q_strncpyz( key, "\\", sizeof( key ) ); + Q_strcat( key, sizeof( key ), bind ); + } + return key; +} diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 5bebfaf0..1f0fa005 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1595,6 +1595,7 @@ void CG_DrawRect( float x, float y, float width, float height, float size void CG_DrawSides(float x, float y, float w, float h, float size); void CG_DrawTopBottom(float x, float y, float w, float h, float size); qboolean CG_WorldToScreen( vec3_t point, float *x, float *y ); +char *CG_KeyBinding( const char *bind ); // diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 2665df16..6fcae7eb 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -377,8 +377,9 @@ static void CG_ConfigStringModified( void ) CG_NewClientInfo( num - CS_PLAYERS ); CG_BuildSpectatorString( ); } - else if( num == CS_FLAGSTATUS ) + else if( num == CS_WINNER ) { + trap_Cvar_Set( "ui_winner", str ); } else if( num == CS_SHADERSTATE ) { @@ -806,8 +807,9 @@ static void CG_ServerCommand( void ) { if( !cg_teamChatsOnly.integer ) { - trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); + if( Q_stricmpn( text, "[skipnotify]", 12 ) ) + trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); CG_RemoveChatEscapeChar( text ); CG_Printf( "%s\n", text ); } @@ -817,14 +819,16 @@ static void CG_ServerCommand( void ) if( !strcmp( cmd, "tchat" ) ) { - if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - trap_S_StartLocalSound( cgs.media.alienTalkSound, CHAN_LOCAL_SOUND ); - else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - trap_S_StartLocalSound( cgs.media.humanTalkSound, CHAN_LOCAL_SOUND ); - else - trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); - Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT ); + if( Q_stricmpn( text, "[skipnotify]", 12 ) ) + { + if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + trap_S_StartLocalSound( cgs.media.alienTalkSound, CHAN_LOCAL_SOUND ); + else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + trap_S_StartLocalSound( cgs.media.humanTalkSound, CHAN_LOCAL_SOUND ); + else + trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND ); + } CG_RemoveChatEscapeChar( text ); CG_Printf( "%s\n", text ); return; |