diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_gameinfo.c | 29 | ||||
-rw-r--r-- | src/ui/ui_local.h | 6 | ||||
-rw-r--r-- | src/ui/ui_main.c | 165 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 23 |
4 files changed, 197 insertions, 26 deletions
diff --git a/src/ui/ui_gameinfo.c b/src/ui/ui_gameinfo.c index ab3ce6da..90047b9d 100644 --- a/src/ui/ui_gameinfo.c +++ b/src/ui/ui_gameinfo.c @@ -162,7 +162,7 @@ void UI_LoadArenas( void ) { strcat(filename, dirptr); UI_LoadArenasFromFile(filename); } - trap_Print( va( "%i arenas parsed\n", ui_numArenas ) ); + trap_Print( va( "[skipnotify]%i arenas parsed\n", ui_numArenas ) ); if (UI_OutOfMemory()) { trap_Print(S_COLOR_YELLOW"WARNING: not anough memory in pool to load all arenas\n"); } @@ -305,3 +305,30 @@ char *UI_GetBotNameByNumber( int num ) { } return "Sarge"; } + +void UI_ServerInfo( void ) +{ + char info[ MAX_INFO_VALUE ]; + int i; + + info[0] = '\0'; + if( trap_GetConfigString( CS_SERVERINFO, info, sizeof( info ) ) ) + { + trap_Cvar_Set( "ui_serverinfo_mapname", + Info_ValueForKey( info, "mapname" ) ); + trap_Cvar_Set( "ui_serverinfo_timelimit", + Info_ValueForKey( info, "timelimit" ) ); + trap_Cvar_Set( "ui_serverinfo_sd", + Info_ValueForKey( info, "g_suddenDeathTime" ) ); + trap_Cvar_Set( "ui_serverinfo_hostname", + Info_ValueForKey( info, "sv_hostname" ) ); + trap_Cvar_Set( "ui_serverinfo_maxclients", + Info_ValueForKey( info, "sv_maxclients" ) ); + trap_Cvar_Set( "ui_serverinfo_version", + Info_ValueForKey( info, "version" ) ); + trap_Cvar_Set( "ui_serverinfo_unlagged", + Info_ValueForKey( info, "g_unlagged" ) ); + trap_Cvar_Set( "ui_serverinfo_ff", + Info_ValueForKey( info, "ff" ) ); + } +} diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h index def61dc3..7afdf653 100644 --- a/src/ui/ui_local.h +++ b/src/ui/ui_local.h @@ -360,6 +360,7 @@ int UI_AdjustTimeByGame(int time); void UI_ShowPostGame(qboolean newHigh); void UI_ClearScores( void ); void UI_LoadArenas(void); +void UI_ServerInfo(void); // // ui_menu.c @@ -818,11 +819,16 @@ typedef struct { int playerRefresh; int playerIndex; int playerNumber; + int myPlayerIndex; + int ignoreIndex; qboolean teamLeader; char playerNames[MAX_CLIENTS][MAX_NAME_LENGTH]; + char rawPlayerNames[MAX_CLIENTS][MAX_NAME_LENGTH]; char teamNames[MAX_CLIENTS][MAX_NAME_LENGTH]; + char rawTeamNames[MAX_CLIENTS][MAX_NAME_LENGTH]; int clientNums[MAX_CLIENTS]; int teamClientNums[MAX_CLIENTS]; + clientList_t ignoreList[MAX_CLIENTS]; int mapCount; mapInfo mapList[MAX_MAPS]; diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index f3a81f5a..ea7f84f4 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1964,6 +1964,28 @@ static void UI_DrawAllMapsSelection(rectDef_t *rect, float scale, vec4_t color, } } +static void UI_DrawPlayerListSelection( rectDef_t *rect, float scale, + vec4_t color, int textStyle ) +{ + if( uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount ) + { + Text_Paint(rect->x, rect->y, scale, color, + uiInfo.rawPlayerNames[ uiInfo.playerIndex ], + 0, 0, textStyle); + } +} + +static void UI_DrawTeamListSelection( rectDef_t *rect, float scale, + vec4_t color, int textStyle ) +{ + if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount ) + { + Text_Paint(rect->x, rect->y, scale, color, + uiInfo.rawTeamNames[ uiInfo.teamIndex ], + 0, 0, textStyle); + } +} + static void UI_DrawOpponentName(rectDef_t *rect, float scale, vec4_t color, int textStyle) { Text_Paint(rect->x, rect->y, scale, color, UI_Cvar_VariableString("ui_opponentName"), 0, 0, textStyle); } @@ -2064,6 +2086,10 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) { break; case UI_ALLMAPS_SELECTION: break; + case UI_PLAYERLIST_SELECTION: + break; + case UI_TEAMLIST_SELECTION: + break; case UI_OPPONENT_NAME: break; case UI_KEYBINDSTATUS: @@ -2127,18 +2153,29 @@ static void UI_BuildPlayerList( void ) { count = atoi( Info_ValueForKey( info, "sv_maxclients" ) ); uiInfo.playerCount = 0; uiInfo.myTeamCount = 0; + uiInfo.myPlayerIndex = 0; playerTeamNumber = 0; for( n = 0; n < count; n++ ) { trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING ); if (info[0]) { - Q_strncpyz( uiInfo.playerNames[uiInfo.playerCount], Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); + BG_ClientListParse( &uiInfo.ignoreList[ uiInfo.playerCount ], + Info_ValueForKey( info, "ig" ) ); + Q_strncpyz( uiInfo.rawPlayerNames[uiInfo.playerCount], + Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); + Q_strncpyz( uiInfo.playerNames[uiInfo.playerCount], + Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); Q_CleanStr( uiInfo.playerNames[uiInfo.playerCount] ); uiInfo.clientNums[uiInfo.playerCount] = n; + if( n == uiInfo.playerNumber ) + uiInfo.myPlayerIndex = uiInfo.playerCount; uiInfo.playerCount++; team2 = atoi(Info_ValueForKey(info, "t")); if (team2 == team) { - Q_strncpyz( uiInfo.teamNames[uiInfo.myTeamCount], Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); + Q_strncpyz( uiInfo.rawTeamNames[uiInfo.myTeamCount], + Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); + Q_strncpyz( uiInfo.teamNames[uiInfo.myTeamCount], + Info_ValueForKey( info, "n" ), MAX_NAME_LENGTH ); Q_CleanStr( uiInfo.teamNames[uiInfo.myTeamCount] ); uiInfo.teamClientNums[uiInfo.myTeamCount] = n; if (uiInfo.playerNumber == n) { @@ -2164,11 +2201,19 @@ static void UI_BuildPlayerList( void ) { static void UI_DrawSelectedPlayer(rectDef_t *rect, float scale, vec4_t color, int textStyle) { + char name[ MAX_NAME_LENGTH ]; + char *s; + if (uiInfo.uiDC.realTime > uiInfo.playerRefresh) { uiInfo.playerRefresh = uiInfo.uiDC.realTime + 3000; UI_BuildPlayerList(); } - Text_Paint(rect->x, rect->y, scale, color, (uiInfo.teamLeader) ? UI_Cvar_VariableString("cg_selectedPlayerName") : UI_Cvar_VariableString("name") , 0, 0, textStyle); + if( uiInfo.teamLeader ) + s = UI_Cvar_VariableString("cg_selectedPlayerName"); + else + s = UI_Cvar_VariableString("name"); + Q_strncpyz( name, s, sizeof( name ) ); + Text_Paint(rect->x, rect->y, scale, color, name, 0, 0, textStyle); } static void UI_DrawServerRefreshDate(rectDef_t *rect, float scale, vec4_t color, int textStyle) { @@ -2478,6 +2523,12 @@ static void UI_OwnerDraw( float x, float y, float w, float h, case UI_MAPS_SELECTION: UI_DrawAllMapsSelection(&rect, scale, color, textStyle, qfalse); break; + case UI_PLAYERLIST_SELECTION: + UI_DrawPlayerListSelection(&rect, scale, color, textStyle); + break; + case UI_TEAMLIST_SELECTION: + UI_DrawTeamListSelection(&rect, scale, color, textStyle); + break; case UI_OPPONENT_NAME: UI_DrawOpponentName(&rect, scale, color, textStyle); break; @@ -3904,6 +3955,8 @@ static void UI_RunMenuScript(char **args) { UI_LoadArenas(); UI_MapCountByGameType(qfalse); Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "createserver"); + } else if (Q_stricmp(name, "loadServerInfo") == 0) { + UI_ServerInfo(); } else if (Q_stricmp(name, "saveControls") == 0) { Controls_SetConfig(qtrue); } else if (Q_stricmp(name, "loadControls") == 0) { @@ -4142,15 +4195,47 @@ static void UI_RunMenuScript(char **args) { { if( uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount ) { - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote clientkick %d\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote kick %d\n", + uiInfo.clientNums[ uiInfo.playerIndex ] ) ); + } + } + else if( Q_stricmp( name, "voteMute" ) == 0 ) + { + if( uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount ) + { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote mute %d\n", + uiInfo.clientNums[ uiInfo.playerIndex ] ) ); + } + } + else if( Q_stricmp( name, "voteUnMute" ) == 0 ) + { + if( uiInfo.playerIndex >= 0 && uiInfo.playerIndex < uiInfo.playerCount ) + { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callvote unmute %d\n", uiInfo.clientNums[ uiInfo.playerIndex ] ) ); } } else if( Q_stricmp( name, "voteTeamKick" ) == 0 ) { - if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.playerCount ) + if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount ) { - trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote teamclientkick %d\n", + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote kick %d\n", + uiInfo.teamClientNums[ uiInfo.teamIndex ] ) ); + } + } + else if( Q_stricmp( name, "voteTeamDenyBuild" ) == 0 ) + { + if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount ) + { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote denybuild %d\n", + uiInfo.teamClientNums[ uiInfo.teamIndex ] ) ); + } + } + else if( Q_stricmp( name, "voteTeamAllowBuild" ) == 0 ) + { + if( uiInfo.teamIndex >= 0 && uiInfo.teamIndex < uiInfo.myTeamCount ) + { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "callteamvote allowbuild %d\n", uiInfo.teamClientNums[ uiInfo.teamIndex ] ) ); } } @@ -4271,6 +4356,51 @@ static void UI_RunMenuScript(char **args) { } else if (Q_stricmp(name, "update") == 0) { if (String_Parse(args, &name2)) UI_Update(name2); + } else if (Q_stricmp(name, "InitIgnoreList") == 0) { + UI_BuildPlayerList(); + } else if (Q_stricmp(name, "ToggleIgnore") == 0) { + if( uiInfo.ignoreIndex >= 0 && uiInfo.ignoreIndex < uiInfo.playerCount ) + { + if( BG_ClientListTest( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ) + { + BG_ClientListRemove( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "unignore %i\n", + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ); + } + else + { + BG_ClientListAdd( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "ignore %i\n", + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ); + } + } + } else if (Q_stricmp(name, "IgnorePlayer") == 0) { + if( uiInfo.ignoreIndex >= 0 && uiInfo.ignoreIndex < uiInfo.playerCount ) + { + if( !BG_ClientListTest( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ) + { + BG_ClientListAdd( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "ignore %i\n", + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ); + } + } + } else if (Q_stricmp(name, "UnIgnorePlayer") == 0) { + if( uiInfo.ignoreIndex >= 0 && uiInfo.ignoreIndex < uiInfo.playerCount ) + { + if( BG_ClientListTest( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ) + { + BG_ClientListRemove( &uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ uiInfo.ignoreIndex ] ); + trap_Cmd_ExecuteText( EXEC_NOW, va( "unignore %i\n", + uiInfo.clientNums[ uiInfo.ignoreIndex ] ) ); + } + } } else if (Q_stricmp(name, "setPbClStatus") == 0) { int stat; if ( Int_Parse( args, &stat ) ) @@ -4917,6 +5047,7 @@ UI_FeederCount ================== */ static int UI_FeederCount(float feederID) { + if (feederID == FEEDER_HEADS) { return UI_HeadCountByTeam(); } else if (feederID == FEEDER_Q3HEADS) { @@ -4943,6 +5074,8 @@ static int UI_FeederCount(float feederID) { UI_BuildPlayerList(); } return uiInfo.myTeamCount; + } else if (feederID == FEEDER_IGNORE_LIST) { + return uiInfo.playerCount; } else if (feederID == FEEDER_MODS) { return uiInfo.modCount; } else if (feederID == FEEDER_DEMOS) { @@ -5114,6 +5247,22 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan if (index >= 0 && index < uiInfo.myTeamCount) { return uiInfo.teamNames[index]; } + } else if (feederID == FEEDER_IGNORE_LIST) { + if (index >= 0 && index < uiInfo.playerCount) { + switch( column ) + { + case 1: + // am I ignoring him + return ( BG_ClientListTest(&uiInfo.ignoreList[ uiInfo.myPlayerIndex ], + uiInfo.clientNums[ index ] ) ) ? "X" : ""; + case 2: + // is he ignoring me + return ( BG_ClientListTest( &uiInfo.ignoreList[ index ], + uiInfo.playerNumber ) ) ? "X" : ""; + default: + return uiInfo.playerNames[index]; + } + } } else if (feederID == FEEDER_MODS) { if (index >= 0 && index < uiInfo.modCount) { if (uiInfo.modList[index].modDescr && *uiInfo.modList[index].modDescr) { @@ -5277,6 +5426,8 @@ static void UI_FeederSelection(float feederID, int index) { uiInfo.playerIndex = index; } else if (feederID == FEEDER_TEAM_LIST) { uiInfo.teamIndex = index; + } else if (feederID == FEEDER_IGNORE_LIST) { + uiInfo.ignoreIndex = index; } else if (feederID == FEEDER_MODS) { uiInfo.modIndex = index; } else if (feederID == FEEDER_CINEMATICS) { @@ -6055,6 +6206,7 @@ vmCvar_t ui_serverStatusTimeOut; //TA: bank values vmCvar_t ui_bank; +vmCvar_t ui_winner; // bk001129 - made static to avoid aliasing @@ -6085,6 +6237,7 @@ static cvarTable_t cvarTable[] = { { &ui_spSkill, "g_spSkill", "2", CVAR_ARCHIVE }, { &ui_spSelection, "ui_spSelection", "", CVAR_ROM }, + { &ui_winner, "ui_winner", "", CVAR_ROM }, { &ui_browserMaster, "ui_browserMaster", "0", CVAR_ARCHIVE }, { &ui_browserGameType, "ui_browserGameType", "0", CVAR_ARCHIVE }, diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index f3132378..2ca88cb6 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -3436,25 +3436,10 @@ static bind_t g_bindings[] = { "weapnext", ']', -1, -1, -1 }, { "+button3", K_MOUSE3, -1, -1, -1 }, { "+button4", K_MOUSE4, -1, -1, -1 }, - { "prevTeamMember", 'w', -1, -1, -1 }, - { "nextTeamMember", 'r', -1, -1, -1 }, - { "nextOrder", 't', -1, -1, -1 }, - { "confirmOrder", 'y', -1, -1, -1 }, - { "denyOrder", 'n', -1, -1, -1 }, - { "taskOffense", 'o', -1, -1, -1 }, - { "taskDefense", 'd', -1, -1, -1 }, - { "taskPatrol", 'p', -1, -1, -1 }, - { "taskCamp", 'c', -1, -1, -1 }, - { "taskFollow", 'f', -1, -1, -1 }, - { "taskRetrieve", 'v', -1, -1, -1 }, - { "taskEscort", 'l', -1, -1, -1 }, - { "taskOwnFlag", 'i', -1, -1, -1 }, - { "taskSuicide", 'k', -1, -1, -1 }, - { "tauntKillInsult", K_F1, -1, -1, -1 }, - { "tauntPraise", K_F2, -1, -1, -1 }, - { "tauntTaunt", K_F3, -1, -1, -1 }, - { "tauntDeathInsult", K_F4, -1, -1, -1 }, - { "tauntGauntlet", K_F5, -1, -1, -1 }, + { "vote yes", K_F1, -1, -1, -1 }, + { "vote no", K_F2, -1, -1, -1 }, + { "teamvote yes", K_F3, -1, -1, -1 }, + { "teamvote no", K_F4, -1, -1, -1 }, { "scoresUp", K_KP_PGUP, -1, -1, -1 }, { "scoresDown", K_KP_PGDN, -1, -1, -1 }, // bk001205 - this one below was: '-1' |