Skip to content

Commit

Permalink
- forgot about q3_ui
Browse files Browse the repository at this point in the history
  • Loading branch information
leilei- committed May 14, 2024
1 parent 120ecc5 commit b32548a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 36 deletions.
2 changes: 1 addition & 1 deletion code/q3_ui/ui_addbots.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion code/q3_ui/ui_ingame.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 0 additions & 8 deletions code/q3_ui/ui_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

//
Expand Down Expand Up @@ -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 */
5 changes: 2 additions & 3 deletions code/q3_ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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 }
};
Expand Down
31 changes: 16 additions & 15 deletions code/q3_ui/ui_startserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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] );
}
Expand All @@ -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] ) );
}
}

Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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++ ) {
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down
16 changes: 8 additions & 8 deletions code/q3_ui/ui_teamorders.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,29 +349,29 @@ 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;
selection = ((menulist_s *)ptr)->curvalue;

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;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b32548a

Please sign in to comment.