From b32548aacf359dfae10dba6414373499e74b6fb8 Mon Sep 17 00:00:00 2001 From: leilei- Date: Tue, 14 May 2024 04:15:41 -0400 Subject: [PATCH] - forgot about q3_ui --- code/q3_ui/ui_addbots.c | 2 +- code/q3_ui/ui_ingame.c | 2 +- code/q3_ui/ui_local.h | 8 -------- code/q3_ui/ui_main.c | 5 ++--- code/q3_ui/ui_startserver.c | 31 ++++++++++++++++--------------- code/q3_ui/ui_teamorders.c | 16 ++++++++-------- 6 files changed, 28 insertions(+), 36 deletions(-) diff --git a/code/q3_ui/ui_addbots.c b/code/q3_ui/ui_addbots.c index ed72f4cc..afd2b900 100644 --- a/code/q3_ui/ui_addbots.c +++ b/code/q3_ui/ui_addbots.c @@ -333,7 +333,7 @@ static void UI_AddBotsMenu_Init( void ) { addBotsMenuInfo.team.generic.y = y; addBotsMenuInfo.team.generic.name = "Team: "; addBotsMenuInfo.team.generic.id = ID_TEAM; - if(UI_IsATeamGametype(gametype)) { + if( gametype >= GT_TEAM && gametype!=GT_LMS && gametype!=GT_POSSESSION) { addBotsMenuInfo.team.itemnames = teamNames2; } else { diff --git a/code/q3_ui/ui_ingame.c b/code/q3_ui/ui_ingame.c index 38f726d2..35758d6f 100644 --- a/code/q3_ui/ui_ingame.c +++ b/code/q3_ui/ui_ingame.c @@ -236,7 +236,7 @@ void InGame_MenuInit( void ) { s_ingame.teamorders.string = "TEAM ORDERS"; s_ingame.teamorders.color = color_red; s_ingame.teamorders.style = UI_CENTER|UI_SMALLFONT; - if(!UI_IsATeamGametype(gametype)) { + if( !(gametype >= GT_TEAM) || gametype == GT_LMS || gametype == GT_POSSESSION ) { s_ingame.teamorders.generic.flags |= QMF_GRAYED; } else { diff --git a/code/q3_ui/ui_local.h b/code/q3_ui/ui_local.h index b9b163fe..e5d88a48 100644 --- a/code/q3_ui/ui_local.h +++ b/code/q3_ui/ui_local.h @@ -112,7 +112,6 @@ extern vmCvar_t ui_server16; extern vmCvar_t ui_setupchecked; //new in beta 23: extern vmCvar_t ui_browserOnlyHumans; -extern vmCvar_t ui_developer; extern vmCvar_t ui_browserHidePrivate; // @@ -899,10 +898,3 @@ void RankStatus_Cache( void ); void UI_RankStatusMenu( void ); #endif - -/* Neon_Knight: Useful check in order to have code consistency. */ -qboolean UI_IsATeamGametype(int check); /* Whether the gametype is team-based or not.*/ -qboolean UI_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */ -qboolean UI_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */ -qboolean UI_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */ -/* /Neon_Knight */ diff --git a/code/q3_ui/ui_main.c b/code/q3_ui/ui_main.c index a5def943..1130f86d 100644 --- a/code/q3_ui/ui_main.c +++ b/code/q3_ui/ui_main.c @@ -173,7 +173,7 @@ vmCvar_t ui_server16; vmCvar_t ui_browserOnlyHumans; //new in beta 37: vmCvar_t ui_setupchecked; -vmCvar_t ui_developer; + vmCvar_t ui_browserHidePrivate; // bk001129 - made static to avoid aliasing. @@ -237,7 +237,7 @@ static cvarTable_t cvarTable[] = { { &ui_spSelection, "ui_spSelection", "", CVAR_ROM }, - { &ui_browserMaster, "ui_browserMaster", "1", CVAR_ARCHIVE }, + { &ui_browserMaster, "ui_browserMaster", "0", CVAR_ARCHIVE }, { &ui_browserGameType, "ui_browserGameType", "0", CVAR_ARCHIVE }, { &ui_browserSortKey, "ui_browserSortKey", "4", CVAR_ARCHIVE }, { &ui_browserShowFull, "ui_browserShowFull", "1", CVAR_ARCHIVE }, @@ -266,7 +266,6 @@ static cvarTable_t cvarTable[] = { { &ui_server16, "server16", "", CVAR_ARCHIVE }, { &ui_browserOnlyHumans, "ui_browserOnlyHumans", "0", CVAR_ARCHIVE }, { &ui_setupchecked, "ui_setupchecked", "0", CVAR_ARCHIVE }, - { &ui_developer, "developer", "0", CVAR_CHEAT }, { &ui_browserHidePrivate, "ui_browserHidePrivate", "1", CVAR_ARCHIVE }, { NULL, "g_localTeamPref", "", 0 } }; diff --git a/code/q3_ui/ui_startserver.c b/code/q3_ui/ui_startserver.c index 877cf91e..1f655e8a 100644 --- a/code/q3_ui/ui_startserver.c +++ b/code/q3_ui/ui_startserver.c @@ -877,7 +877,7 @@ static qboolean BotAlreadySelected( const char *checkName ) { if( s_serveroptions.playerType[n].curvalue != 1 ) { continue; } - if(UI_IsATeamGametype(s_serveroptions.gametype) && + if( (s_serveroptions.gametype >= GT_TEAM) && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION && (s_serveroptions.playerTeam[n].curvalue != s_serveroptions.playerTeam[s_serveroptions.newBotIndex].curvalue ) ) { continue; } @@ -1070,7 +1070,7 @@ static void ServerOptions_Start( void ) { if( s_serveroptions.playerNameBuffers[n][0] == '-' ) { continue; } - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { Com_sprintf( buf, sizeof(buf), "addbot %s %i %s\n", s_serveroptions.playerNameBuffers[n], skill, playerTeam_list[s_serveroptions.playerTeam[n].curvalue] ); } @@ -1081,8 +1081,9 @@ static void ServerOptions_Start( void ) { } // set player's team - if( UI_IsATeamGametype(s_serveroptions.gametype)) { - trap_Cvar_Set( "g_localTeamPref", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ); + if( /*dedicated == 0 &&*/ s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS + && s_serveroptions.gametype != GT_POSSESSION ) { + trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait 5; team %s\n", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ) ); } } @@ -1108,7 +1109,7 @@ static void ServerOptions_InitPlayerItems( void ) { s_serveroptions.playerType[n].curvalue = v; } - if(s_serveroptions.multiplayer && !UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.multiplayer && (s_serveroptions.gametype < GT_TEAM || s_serveroptions.gametype == GT_LMS ) ) { for( n = 8; n < PLAYER_SLOTS; n++ ) { s_serveroptions.playerType[n].curvalue = 2; } @@ -1122,7 +1123,7 @@ static void ServerOptions_InitPlayerItems( void ) { Q_CleanStr( s_serveroptions.playerNameBuffers[0] ); // init teams - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { for( n = 0; n < (PLAYER_SLOTS / 2); n++ ) { s_serveroptions.playerTeam[n].curvalue = 0; } @@ -1162,7 +1163,7 @@ static void ServerOptions_SetPlayerItems( void ) { } // teams - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_TEAM || s_serveroptions.gametype == GT_LMS || s_serveroptions.gametype == GT_POSSESSION ) { return; } for( n = start; n < PLAYER_SLOTS; n++ ) { @@ -1344,7 +1345,7 @@ static void ServerOptions_InitBotNames( void ) { char bots[MAX_INFO_STRING]; //this SHOULD work - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION ) { Q_strncpyz( s_serveroptions.playerNameBuffers[1], "gargoyle", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[2], "kyonshi", 16 ); Q_strncpyz( s_serveroptions.playerNameBuffers[3], "grism", 16 ); @@ -1660,7 +1661,7 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { s_serveroptions.picframe.focuspic = GAMESERVER_SELECT; y = 268; - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_CTF || s_serveroptions.gametype== GT_LMS) { s_serveroptions.fraglimit.generic.type = MTYPE_FIELD; s_serveroptions.fraglimit.generic.name = "Frag Limit:"; s_serveroptions.fraglimit.generic.flags = QMF_NUMBERSONLY|QMF_PULSEIFFOCUS|QMF_SMALLFONT; @@ -1701,8 +1702,8 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { s_serveroptions.timelimit.field.widthInChars = 3; s_serveroptions.timelimit.field.maxchars = 3; - if(UI_IsATeamGametype(s_serveroptions.gametype) && - !UI_IsARoundBasedGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION + && s_serveroptions.gametype != GT_ELIMINATION && s_serveroptions.gametype != GT_CTF_ELIMINATION) { y += BIGCHAR_HEIGHT+2; s_serveroptions.friendlyfire.generic.type = MTYPE_RADIOBUTTON; s_serveroptions.friendlyfire.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; @@ -1880,20 +1881,20 @@ static void ServerOptions_MenuInit( qboolean multiplayer ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerType[n] ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerName[n] ); - if(UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.playerTeam[n] ); } } - if(!UI_IsATeamGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype < GT_CTF || s_serveroptions.gametype == GT_LMS || s_serveroptions.gametype == GT_POSSESSION ) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.fraglimit ); } else { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.flaglimit ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.timelimit ); - if(UI_IsATeamGametype(s_serveroptions.gametype) && - !UI_IsARoundBasedGametype(s_serveroptions.gametype)) { + if( s_serveroptions.gametype >= GT_TEAM && s_serveroptions.gametype != GT_LMS && s_serveroptions.gametype != GT_POSSESSION + && s_serveroptions.gametype != GT_ELIMINATION && s_serveroptions.gametype != GT_CTF_ELIMINATION) { Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.friendlyfire ); } Menu_AddItem( &s_serveroptions.menu, &s_serveroptions.pure ); diff --git a/code/q3_ui/ui_teamorders.c b/code/q3_ui/ui_teamorders.c index fe0427d5..2025eecb 100644 --- a/code/q3_ui/ui_teamorders.c +++ b/code/q3_ui/ui_teamorders.c @@ -349,7 +349,7 @@ static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) int selection; char message[256]; - if (event != QM_ACTIVATED || !UI_IsATeamGametype(teamOrdersMenuInfo.gametype)) + if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; @@ -357,21 +357,21 @@ static void UI_TeamOrdersMenu_ListEvent( void *ptr, int event ) if( id == ID_LIST_BOTS ) { teamOrdersMenuInfo.selectedBot = selection; - if( UI_UsesTeamFlags(teamOrdersMenuInfo.gametype) && !UI_UsesTheWhiteFlag(teamOrdersMenuInfo.gametype) ) { + if( teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_CTF_ELIMINATION ) { UI_TeamOrdersMenu_SetList( ID_LIST_CTF_ORDERS ); } - if( UI_UsesTeamFlags(teamOrdersMenuInfo.gametype) && UI_UsesTheWhiteFlag(teamOrdersMenuInfo.gametype) ) { + if( teamOrdersMenuInfo.gametype == GT_1FCTF ) { UI_TeamOrdersMenu_SetList( ID_LIST_CTF1F_ORDERS ); } - if( teamOrdersMenuInfo.gametype == GT_HARVESTER || teamOrdersMenuInfo.gametype == GT_OBELISK ) { + if( teamOrdersMenuInfo.gametype == GT_OBELISK || teamOrdersMenuInfo.gametype == GT_HARVESTER ) { UI_TeamOrdersMenu_SetList( ID_LIST_BASE_ORDERS ); } + if( teamOrdersMenuInfo.gametype == GT_TEAM || teamOrdersMenuInfo.gametype == GT_ELIMINATION || teamOrdersMenuInfo.gametype == GT_DOMINATION ) { + UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); + } if( teamOrdersMenuInfo.gametype == GT_DOUBLE_D ) { UI_TeamOrdersMenu_SetList( ID_LIST_DD_ORDERS ); } - else { - UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS ); - } return; } @@ -550,7 +550,7 @@ void UI_TeamOrdersMenu_f( void ) // make sure it's a team game trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ); teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) ); - if(!UI_IsATeamGametype(teamOrdersMenuInfo.gametype)) { + if( teamOrdersMenuInfo.gametype < GT_TEAM || teamOrdersMenuInfo.gametype == GT_LMS || teamOrdersMenuInfo.gametype == GT_POSSESSION) { return; }