# HG changeset patch # User Adam Kaminski # Date 1631978868 14400 # Sat Sep 18 11:27:48 2021 -0400 # Node ID e623110839b225fd8978badf81aaba4ea9aa3670 # Parent b9fb5144d1844fff6c9a9bf8e2a32703b17ac5bd Removed the function V_GetColorChar, which was only used to get the color code of a team, and replaced it with the function TEAM_GetTextColorName. This fixes a compatibility issue with printing team-related messages on the screen using custom colors. diff -r b9fb5144d184 -r e623110839b2 docs/zandronum-history.txt --- a/docs/zandronum-history.txt Mon Sep 13 11:00:37 2021 -0400 +++ b/docs/zandronum-history.txt Sat Sep 18 11:27:48 2021 -0400 @@ -95,6 +95,7 @@ - - Fixed a player's old body from being frozen and not finishing their animation when they become a dead spectator. [Kaminsky] - - Fixed dead spectators not spawning where they died if sv_samespawnspot is enabled. [Kaminsky] - - Fixed ACS scripts puked by the server RCON from using player 0 as the activator. [Kaminsky] +- - Fixed a compatibility issue with printing team-related messages on the screen using custom colors. [Kaminsky] ! - sv_forcegldefaults renamed to sv_forcevideodefaults. The old name still exists for compatibility. [Dusk] ! - r_3dfloors is now forced to be true when sv_forcevideodefaults is true. [Dusk] ! - When the wad authentication fails for a connecting client, the client only reports the missing and incompatible PWADS instead of all of them. [Pol Marcet] diff -r b9fb5144d184 -r e623110839b2 src/chat.cpp --- a/src/chat.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/chat.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -928,7 +928,7 @@ else { OutString = TEXTCOLOR_ESCAPE; - OutString += V_GetColorChar( TEAM_GetTextColor( players[consoleplayer].Team )); + OutString += TEAM_GetTextColorName( players[consoleplayer].Team ); OutString += " "; } diff -r b9fb5144d184 -r e623110839b2 src/g_doom/doom_sbar.cpp --- a/src/g_doom/doom_sbar.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/g_doom/doom_sbar.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -822,7 +822,7 @@ if ( TEAM_CountPlayers( i ) < 1 ) continue; - sprintf( szString , "\\c%c%d\n", V_GetColorChar( TEAM_GetTextColor ( i ) ), static_cast (lPoints[i])); + sprintf( szString , "\\c%s%d\n", TEAM_GetTextColorName ( i ), static_cast (lPoints[i])); V_ColorizeString( szString ); HUD_DrawText( ConFont, CR_GRAY, diff -r b9fb5144d184 -r e623110839b2 src/g_shared/a_flags.cpp --- a/src/g_shared/a_flags.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/g_shared/a_flags.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -457,7 +457,7 @@ SERVERCOMMANDS_PrintHUDMessage( "", 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.5f, "SmallFont", MAKE_ID( 'S', 'U', 'B', 'S' ) ); // Create the "captured" message. - sprintf( szString, "\\c%c%s team scores!", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), TEAM_GetName( Owner->player->Team )); + sprintf( szString, "\\c%s%s team scores!", TEAM_GetTextColorName( Owner->player->Team ), TEAM_GetName( Owner->player->Team )); V_ColorizeString( szString ); // Now, print it. @@ -480,7 +480,7 @@ } // [RC] Create the "scored by" and "assisted by" message. - sprintf( szString, "\\c%cScored by: %s", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), Owner->player->userinfo.GetName() ); + sprintf( szString, "\\c%sScored by: %s", TEAM_GetTextColorName( Owner->player->Team ), Owner->player->userinfo.GetName() ); const bool bAssisted = (TEAM_GetAssistPlayer(Owner->player->Team) != MAXPLAYERS); if ( bAssisted ) { @@ -490,9 +490,9 @@ selfAssist = true; if ( selfAssist ) - sprintf( szString + strlen ( szString ), "\\n\\c%c[ Self-Assisted ]", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team ))); + sprintf( szString + strlen ( szString ), "\\n\\c%s[ Self-Assisted ]", TEAM_GetTextColorName( Owner->player->Team )); else - sprintf( szString + strlen ( szString ), "\\n\\c%cAssisted by: %s", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), players[TEAM_GetAssistPlayer( Owner->player->Team )].userinfo.GetName()); + sprintf( szString + strlen ( szString ), "\\n\\c%sAssisted by: %s", TEAM_GetTextColorName( Owner->player->Team ), players[TEAM_GetAssistPlayer( Owner->player->Team )].userinfo.GetName()); } V_ColorizeString( szString ); @@ -516,9 +516,9 @@ SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.5f, "SmallFont", MAKE_ID( 'S', 'U', 'B', 'S' ) ); if( ( bAssisted ) && ( ! selfAssist ) ) - SERVER_Printf( "%s and %s scored for the \034%c%s " TEXTCOLOR_NORMAL "team!\n", Owner->player->userinfo.GetName(), players[TEAM_GetAssistPlayer( Owner->player->Team )].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), TEAM_GetName( Owner->player->Team )); + SERVER_Printf( "%s and %s scored for the \034%s%s " TEXTCOLOR_NORMAL "team!\n", Owner->player->userinfo.GetName(), players[TEAM_GetAssistPlayer( Owner->player->Team )].userinfo.GetName(), TEAM_GetTextColorName( Owner->player->Team ), TEAM_GetName( Owner->player->Team )); else - SERVER_Printf( "%s scored for the \034%c%s " TEXTCOLOR_NORMAL "team!\n", Owner->player->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), TEAM_GetName( Owner->player->Team )); + SERVER_Printf( "%s scored for the \034%s%s " TEXTCOLOR_NORMAL "team!\n", Owner->player->userinfo.GetName(), TEAM_GetTextColorName( Owner->player->Team ), TEAM_GetName( Owner->player->Team )); } @@ -617,9 +617,9 @@ // Create the "pickup" message. if (( pToucher->player - players ) == consoleplayer ) - sprintf( szString, "\\c%cYou have the %s flag!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%sYou have the %s flag!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); else - sprintf( szString, "\\c%c%s flag taken!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s flag taken!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); @@ -639,18 +639,18 @@ // If necessary, send it to clients. else { - sprintf( szString, "\\c%cYou have the %s flag!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%sYou have the %s flag!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ), ULONG( pToucher->player - players ), SVCF_ONLYTHISCLIENT ); - sprintf( szString, "\\c%c%s flag taken!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s flag taken!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ), ULONG( pToucher->player - players ), SVCF_SKIPTHISCLIENT ); } // [RC] Create the "held by" message for the team. ULONG playerIndex = ULONG( pToucher->player - players ); - sprintf( szString, "\\c%cHeld by: %s", V_GetColorChar( TEAM_GetTextColor( players[playerIndex].Team )), players[playerIndex].userinfo.GetName() ); + sprintf( szString, "\\c%sHeld by: %s", TEAM_GetTextColorName( players[playerIndex].Team ), players[playerIndex].userinfo.GetName() ); V_ColorizeString( szString ); @@ -674,7 +674,7 @@ else { SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "SmallFont", MAKE_ID( 'S', 'U', 'B', 'S' ), ULONG( pToucher->player - players ), SVCF_SKIPTHISCLIENT ); - SERVER_Printf( PRINT_MEDIUM, "%s has taken the \034%c%s " TEXTCOLOR_NORMAL "flag.\n", players[playerIndex].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "%s has taken the \034%s%s " TEXTCOLOR_NORMAL "flag.\n", players[playerIndex].userinfo.GetName(), TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); } } @@ -753,7 +753,7 @@ { // [RC] Create the "returned by" message for this team. ULONG playerIndex = ULONG( pReturner->player - players ); - sprintf( szString, "\\c%cReturned by: %s", V_GetColorChar( TEAM_GetTextColor( players[playerIndex].Team )), players[playerIndex].userinfo.GetName() ); + sprintf( szString, "\\c%sReturned by: %s", TEAM_GetTextColorName( players[playerIndex].Team ), players[playerIndex].userinfo.GetName() ); // [CK] Send out an event that a flag/skull was returned, this is the easiest place to do it // Second argument is the team index, third argument is what kind of return it was @@ -762,7 +762,7 @@ else { // [RC] Create the "returned automatically" message for this team. - sprintf( szString, "\\c%cReturned automatically.", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this )))); + sprintf( szString, "\\c%sReturned automatically.", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this ))); // [CK] Indicate the server returned the flag/skull after a timeout GAMEMODE_HandleEvent ( GAMEEVENT_RETURNS, NULL, static_cast ( ulItemTeam ), GAMEEVENT_RETURN_TIMEOUTRETURN ); @@ -774,9 +774,9 @@ if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { if ( pReturner && pReturner->player ) - SERVER_Printf( PRINT_MEDIUM, "%s returned the \034%c%s " TEXTCOLOR_NORMAL "flag.\n", pReturner->player->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "%s returned the \034%s%s " TEXTCOLOR_NORMAL "flag.\n", pReturner->player->userinfo.GetName(), TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); else - SERVER_Printf( PRINT_MEDIUM, "\034%c%s " TEXTCOLOR_NORMAL "flag returned.\n", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "\034%s%s " TEXTCOLOR_NORMAL "flag returned.\n", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); } } @@ -813,7 +813,7 @@ char szString[256]; // Create the "returned" message. - sprintf( szString, "\\c%c%s flag returned", V_GetColorChar( TEAM_GetTextColor ( TEAM_GetTeamFromItem( this ))), TEAM_GetName ( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s flag returned", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName ( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); @@ -904,7 +904,7 @@ } // Create the "captured" message. - sprintf( szString, "\\c%c%s team scores!", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), TEAM_GetName( Owner->player->Team )); + sprintf( szString, "\\c%s%s team scores!", TEAM_GetTextColorName( Owner->player->Team ), TEAM_GetName( Owner->player->Team )); V_ColorizeString( szString ); // Now, print it. @@ -927,7 +927,7 @@ } // [BC] Rivecoder's "scored by" message. - sprintf( szString, "\\c%cScored by: %s", V_GetColorChar( TEAM_GetTextColor( Owner->player->Team )), Owner->player->userinfo.GetName() ); + sprintf( szString, "\\c%sScored by: %s", TEAM_GetTextColorName( Owner->player->Team ), Owner->player->userinfo.GetName() ); V_ColorizeString( szString ); // Now, print it. @@ -1065,7 +1065,7 @@ sprintf( szName, "%s", players[ulPlayer].userinfo.GetName() ); V_RemoveColorCodes( szName ); - sprintf( szString, "\\ccHeld by: \\c%c%s", V_GetColorChar( TEAM_GetTextColor( players[ulPlayer].Team )), szName ); + sprintf( szString, "\\ccHeld by: \\c%s%s", TEAM_GetTextColorName( players[ulPlayer].Team ), szName ); V_ColorizeString( szString ); // Now, print it. @@ -1235,9 +1235,9 @@ // Create the "pickup" message. if (( pToucher->player - players ) == consoleplayer ) - sprintf( szString, "\\c%cYou have the %s skull!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%sYou have the %s skull!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); else - sprintf( szString, "\\c%c%s skull taken!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s skull taken!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); @@ -1257,18 +1257,18 @@ // If necessary, send it to clients. else { - sprintf( szString, "\\c%cYou have the %s skull!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%sYou have the %s skull!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ), ULONG( pToucher->player - players ), SVCF_ONLYTHISCLIENT ); - sprintf( szString, "\\c%c%s skull taken!", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s skull taken!", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "BigFont", MAKE_ID( 'C', 'N', 'T', 'R' ), ULONG( pToucher->player - players ), SVCF_SKIPTHISCLIENT ); } // [RC] Create the "held by" message for this team. ULONG playerIndex = ULONG( pToucher->player - players ); - sprintf( szString, "\\c%cHeld by: %s", V_GetColorChar( TEAM_GetTextColor( players[playerIndex].Team )), players[playerIndex].userinfo.GetName()); + sprintf( szString, "\\c%sHeld by: %s", TEAM_GetTextColorName( players[playerIndex].Team ), players[playerIndex].userinfo.GetName()); V_ColorizeString( szString ); @@ -1292,7 +1292,7 @@ else { SERVERCOMMANDS_PrintHUDMessage( szString, 1.5f, TEAM_MESSAGE_Y_AXIS_SUB, 0, 0, HUDMESSAGETYPE_FADEOUT, CR_UNTRANSLATED, 3.0f, 0.0f, 0.25f, "SmallFont", MAKE_ID( 'S', 'U', 'B', 'S' ), ULONG( pToucher->player - players ), SVCF_SKIPTHISCLIENT ); - SERVER_Printf( PRINT_MEDIUM, "%s has taken the \034%c%s " TEXTCOLOR_NORMAL "skull.\n", players[playerIndex].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "%s has taken the \034%s%s " TEXTCOLOR_NORMAL "skull.\n", players[playerIndex].userinfo.GetName(), TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); } } @@ -1371,7 +1371,7 @@ { // [RC] Create the "returned by" message for this team. ULONG playerIndex = ULONG( pReturner->player - players ); - sprintf( szString, "\\c%cReturned by: %s", V_GetColorChar( TEAM_GetTextColor( players[playerIndex].Team )), players[playerIndex].userinfo.GetName() ); + sprintf( szString, "\\c%sReturned by: %s", TEAM_GetTextColorName( players[playerIndex].Team ), players[playerIndex].userinfo.GetName() ); // [AK] Trigger an event script indicating that a player returned the skull. GAMEMODE_HandleEvent( GAMEEVENT_RETURNS, pReturner, static_cast ( ulItemTeam ), GAMEEVENT_RETURN_PLAYERRETURN ); @@ -1379,7 +1379,7 @@ else { // [RC] Create the "returned automatically" message for this team. - sprintf( szString, "\\c%cReturned automatically.", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this )))); + sprintf( szString, "\\c%sReturned automatically.", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this ))); // [AK] Trigger an event script indicating that the skull was returned after a timeout. GAMEMODE_HandleEvent( GAMEEVENT_RETURNS, NULL, static_cast ( ulItemTeam ), GAMEEVENT_RETURN_TIMEOUTRETURN ); @@ -1391,9 +1391,9 @@ if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { if ( pReturner && pReturner->player ) - SERVER_Printf( PRINT_MEDIUM, "%s returned the \034%c%s " TEXTCOLOR_NORMAL "skull.\n", pReturner->player->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "%s returned the \034%s%s " TEXTCOLOR_NORMAL "skull.\n", pReturner->player->userinfo.GetName(), TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); else - SERVER_Printf( PRINT_MEDIUM, "\034%c%s " TEXTCOLOR_NORMAL "skull returned.\n", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + SERVER_Printf( PRINT_MEDIUM, "\034%s%s " TEXTCOLOR_NORMAL "skull returned.\n", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); } } @@ -1430,7 +1430,7 @@ char szString[256]; // Create the "returned" message. - sprintf( szString, "\\c%c%s skull returned", V_GetColorChar( TEAM_GetTextColor( TEAM_GetTeamFromItem( this ))), TEAM_GetName( TEAM_GetTeamFromItem( this ))); + sprintf( szString, "\\c%s%s skull returned", TEAM_GetTextColorName( TEAM_GetTeamFromItem( this )), TEAM_GetName( TEAM_GetTeamFromItem( this ))); V_ColorizeString( szString ); diff -r b9fb5144d184 -r e623110839b2 src/g_shared/shared_hud.cpp --- a/src/g_shared/shared_hud.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/g_shared/shared_hud.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -872,9 +872,9 @@ int leadingTeam = !!( scores[1] > scores[0] ); int losingTeam = 1 - leadingTeam; - text.Format ("\\c%c%d\\cC - \\c%c%d", - V_GetColorChar( TEAM_GetTextColor( leadingTeam )), scores[leadingTeam], - V_GetColorChar( TEAM_GetTextColor( losingTeam )), scores[losingTeam] ); + text.Format ("\\c%s%d\\cC - \\c%s%d", + TEAM_GetTextColorName( leadingTeam ), scores[leadingTeam], + TEAM_GetTextColorName( losingTeam ), scores[losingTeam] ); } else { @@ -887,7 +887,7 @@ text += "\\cC - "; text += "\\c"; - text += V_GetColorChar( TEAM_GetTextColor( teams[i] )); + text += TEAM_GetTextColorName( teams[i] ); text.AppendFormat( "%d", GetScoreForTeam( teams[i] )); } } diff -r b9fb5144d184 -r e623110839b2 src/g_shared/st_hud.cpp --- a/src/g_shared/st_hud.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/g_shared/st_hud.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -459,7 +459,7 @@ if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) { color = TEXTCOLOR_ESCAPE; - color += V_GetColorChar( TEAM_GetTextColor( players[ulDisplayPlayer].Team )); + color += TEAM_GetTextColorName( players[ulDisplayPlayer].Team ); } bottomString.AppendFormat( "%sFollowing - %s%s", color.GetChars( ), players[ulDisplayPlayer].userinfo.GetName( ), color.GetChars( )); @@ -1126,7 +1126,7 @@ // [AK] Reset the list of team names, starting with this team. teamName = TEXTCOLOR_ESCAPE; - teamName.AppendFormat( "%c%s", V_GetColorChar( TEAM_GetTextColor( ulTeam )), TEAM_GetName( ulTeam )); + teamName.AppendFormat( "%s%s", TEAM_GetTextColorName( ulTeam ), TEAM_GetName( ulTeam )); ulNumTeamsWithHighestScore = 1; } // [AK] If this team's score is equal to the current highest score, add their name to the end of the list. @@ -1139,7 +1139,7 @@ // [AK] Store this team's name and text color into a string, we'll need it later. lastTeamName = TEXTCOLOR_ESCAPE; - lastTeamName.AppendFormat( "%c%s", V_GetColorChar( TEAM_GetTextColor( ulTeam )), TEAM_GetName( ulTeam )); + lastTeamName.AppendFormat( "%s%s", TEAM_GetTextColorName( ulTeam ), TEAM_GetName( ulTeam )); ulNumTeamsWithHighestScore++; } diff -r b9fb5144d184 -r e623110839b2 src/lastmanstanding.cpp --- a/src/lastmanstanding.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/lastmanstanding.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -443,7 +443,7 @@ if ( ulWinner == teams.Size( ) ) sprintf( szString, "\\cdDraw Game!" ); else - sprintf( szString, "\\c%c%s Wins!", V_GetColorChar( TEAM_GetTextColor( ulWinner ) ), TEAM_GetName( ulWinner )); + sprintf( szString, "\\c%s%s Wins!", TEAM_GetTextColorName( ulWinner ), TEAM_GetName( ulWinner )); } else if ( ulWinner == MAXPLAYERS ) sprintf( szString, "\\cdDRAW GAME!" ); diff -r b9fb5144d184 -r e623110839b2 src/p_interaction.cpp --- a/src/p_interaction.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/p_interaction.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -641,7 +641,7 @@ if (( NETWORK_GetState( ) == NETSTATE_SINGLE_MULTIPLAYER ) && ( players[consoleplayer].mo->CheckLocalView( source->player - players ))) sprintf( szString, "\\cGYOU WIN!" ); else if (( teamplay ) && ( source->player->bOnTeam )) - sprintf( szString, "\\c%c%s wins!\n", V_GetColorChar( TEAM_GetTextColor( source->player->Team )), TEAM_GetName( source->player->Team )); + sprintf( szString, "\\c%s%s wins!\n", TEAM_GetTextColorName( source->player->Team ), TEAM_GetName( source->player->Team )); else sprintf( szString, "%s \\cGWINS!", players[source->player - players].userinfo.GetName() ); V_ColorizeString( szString ); @@ -2338,7 +2338,7 @@ if (( NETWORK_GetState() != NETSTATE_SERVER ) && pPlayer->mo->IsTeammate( players[consoleplayer].camera )) ANNOUNCER_PlayEntry( cl_announcer, "YouWin" ); - sprintf( szString, "\\c%c%s WINS!", V_GetColorChar( TEAM_GetTextColor( pPlayer->Team )), TEAM_GetName( pPlayer->Team )); + sprintf( szString, "\\c%s%s WINS!", TEAM_GetTextColorName( pPlayer->Team ), TEAM_GetName( pPlayer->Team )); V_ColorizeString( szString ); if ( NETWORK_GetState( ) != NETSTATE_SERVER ) @@ -2433,7 +2433,7 @@ // Player has changed his team! Tell clients. if ( bBroadcastChange ) { - SERVER_Printf( "%s joined the \034%c%s " TEXTCOLOR_NORMAL "team.\n", pPlayer->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( ulTeam ) ), TEAM_GetName( ulTeam )); + SERVER_Printf( "%s joined the \034%s%s " TEXTCOLOR_NORMAL "team.\n", pPlayer->userinfo.GetName(), TEAM_GetTextColorName( ulTeam ), TEAM_GetName( ulTeam )); } } diff -r b9fb5144d184 -r e623110839b2 src/possession.cpp --- a/src/possession.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/possession.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -720,8 +720,8 @@ // [RC] On team possession, state who scored. if ( teampossession && ( players[ulPlayer].bOnTeam )) { - sprintf( szString, "\\c%c%s %s!", V_GetColorChar( TEAM_GetTextColor( players[ulPlayer].Team )), TEAM_GetName( players[ulPlayer].Team ) ,bPointLimitReached ? "WINS" : "SCORES" ); - sprintf( szScorer, "\\c%cScored by: %s", V_GetColorChar( TEAM_GetTextColor( players[ulPlayer].Team )), players[ulPlayer].userinfo.GetName() ); + sprintf( szString, "\\c%s%s %s!", TEAM_GetTextColorName( players[ulPlayer].Team ), TEAM_GetName( players[ulPlayer].Team ) ,bPointLimitReached ? "WINS" : "SCORES" ); + sprintf( szScorer, "\\c%sScored by: %s", TEAM_GetTextColorName( players[ulPlayer].Team ), players[ulPlayer].userinfo.GetName() ); // [BB] I don't see why we should remove the player name's color codes here. It's not done in CTF either // and the player's team is apparent from the rest of the message. diff -r b9fb5144d184 -r e623110839b2 src/sv_main.cpp --- a/src/sv_main.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/sv_main.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -6245,12 +6245,12 @@ // Player was on a team, so tell everyone that he's changing teams. if ( bOnTeam ) { - SERVER_Printf( "%s defected to the \034%c%s " TEXTCOLOR_NORMAL "team.\n", players[g_lCurrentClient].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( players[g_lCurrentClient].Team )), TEAM_GetName( players[g_lCurrentClient].Team )); + SERVER_Printf( "%s defected to the \034%s%s " TEXTCOLOR_NORMAL "team.\n", players[g_lCurrentClient].userinfo.GetName(), TEAM_GetTextColorName( players[g_lCurrentClient].Team ), TEAM_GetName( players[g_lCurrentClient].Team )); } // Otherwise, tell everyone he's joining a team. else { - SERVER_Printf( "%s joined the \034%c%s " TEXTCOLOR_NORMAL "team.\n", players[g_lCurrentClient].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( players[g_lCurrentClient].Team )), TEAM_GetName( players[g_lCurrentClient].Team )); + SERVER_Printf( "%s joined the \034%s%s " TEXTCOLOR_NORMAL "team.\n", players[g_lCurrentClient].userinfo.GetName(), TEAM_GetTextColorName( players[g_lCurrentClient].Team ), TEAM_GetName( players[g_lCurrentClient].Team )); } if ( players[g_lCurrentClient].mo ) diff -r b9fb5144d184 -r e623110839b2 src/team.cpp --- a/src/team.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/team.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -500,15 +500,15 @@ // Create the console message. if( ( bAssisted ) && ( ! bSelfAssisted ) ) - sprintf(szString, "%s and %s scored for the \034%c%s " TEXTCOLOR_NORMAL "team!\n", pPlayer->userinfo.GetName(), players[TEAM_GetAssistPlayer( pPlayer->Team )].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( pPlayer->Team )), TEAM_GetName( pPlayer->Team )); + sprintf(szString, "%s and %s scored for the \034%s%s " TEXTCOLOR_NORMAL "team!\n", pPlayer->userinfo.GetName(), players[TEAM_GetAssistPlayer( pPlayer->Team )].userinfo.GetName(), TEAM_GetTextColorName( pPlayer->Team ), TEAM_GetName( pPlayer->Team )); else - sprintf(szString, "%s scored for the \034%c%s " TEXTCOLOR_NORMAL "team!\n", pPlayer->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( pPlayer->Team )), TEAM_GetName( pPlayer->Team )); + sprintf(szString, "%s scored for the \034%s%s " TEXTCOLOR_NORMAL "team!\n", pPlayer->userinfo.GetName(), TEAM_GetTextColorName( pPlayer->Team ), TEAM_GetName( pPlayer->Team )); if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_Print( szString, PRINT_HIGH ); // Create the fullscreen message. - FString coloredTeamName = V_GetColorChar( TEAM_GetTextColor( pPlayer->Team ) ); + FString coloredTeamName = TEAM_GetTextColorName( pPlayer->Team ); coloredTeamName += " "; coloredTeamName += TEAM_GetName( pPlayer->Team ); switch ( ulNumPoints ) @@ -564,14 +564,14 @@ } // Create the "scored by / assisted by" message. - sprintf( szString, "\\c%cScored by: %s", V_GetColorChar( TEAM_GetTextColor( pPlayer->Team ) ), pPlayer->userinfo.GetName()); + sprintf( szString, "\\c%sScored by: %s", TEAM_GetTextColorName( pPlayer->Team ), pPlayer->userinfo.GetName()); if ( bAssisted ) { if ( bSelfAssisted ) - sprintf( szString + strlen ( szString ), "\\n\\c%c( Self-Assisted )", V_GetColorChar( TEAM_GetTextColor( pPlayer->Team ) ) ); + sprintf( szString + strlen ( szString ), "\\n\\c%s( Self-Assisted )", TEAM_GetTextColorName( pPlayer->Team ) ); else - sprintf( szString + strlen ( szString ), "\\n\\c%cAssisted by: %s", V_GetColorChar( TEAM_GetTextColor( pPlayer->Team ) ), players[TEAM_GetAssistPlayer( pPlayer->Team )].userinfo.GetName()); + sprintf( szString + strlen ( szString ), "\\n\\c%sAssisted by: %s", TEAM_GetTextColorName( pPlayer->Team ), players[TEAM_GetAssistPlayer( pPlayer->Team )].userinfo.GetName()); } V_ColorizeString( szString ); @@ -683,7 +683,7 @@ return; // Create the message. - sprintf( szString, "\\c%cThe %s skull must be returned first!", V_GetColorChar( TEAM_GetTextColor( pPlayer->Team )), TEAM_GetName( pPlayer->Team )); + sprintf( szString, "\\c%sThe %s skull must be returned first!", TEAM_GetTextColorName( pPlayer->Team ), TEAM_GetName( pPlayer->Team )); V_ColorizeString( szString ); @@ -728,7 +728,7 @@ if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_TeamFlagDropped( ULONG( pPlayer - players ), ulTeamIdx ); - SERVER_Printf( PRINT_MEDIUM, "%s lost the \034%c%s " TEXTCOLOR_NORMAL "%s.\n", pPlayer->userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( ulTeamIdx)), TEAM_GetName( ulTeamIdx), ( skulltag ) ? "skull" : "flag" ); + SERVER_Printf( PRINT_MEDIUM, "%s lost the \034%s%s " TEXTCOLOR_NORMAL "%s.\n", pPlayer->userinfo.GetName(), TEAM_GetTextColorName( ulTeamIdx), TEAM_GetName( ulTeamIdx), ( skulltag ) ? "skull" : "flag" ); return; } @@ -736,7 +736,7 @@ Printf( "%s %s dropped!\n", TEAM_GetName( ulTeamIdx ), ( skulltag ) ? "skull" : "flag" ); // Next, build the dropped message. - sprintf( szString, "\\c%c%s %s dropped!", V_GetColorChar( TEAM_GetTextColor( ulTeamIdx )), TEAM_GetName( ulTeamIdx ), ( skulltag ) ? "skull" : "flag" ); + sprintf( szString, "\\c%s%s %s dropped!", TEAM_GetTextColorName( ulTeamIdx ), TEAM_GetName( ulTeamIdx ), ( skulltag ) ? "skull" : "flag" ); // Colorize it. V_ColorizeString( szString ); @@ -776,7 +776,7 @@ // Display "%s WINS!" HUD message. if ( ulTeamIdx < teams.Size( ) ) - sprintf( szString, "\\c%c%s WINS!", V_GetColorChar( TEAM_GetTextColor( ulTeamIdx ) ), TEAM_GetName( ulTeamIdx ) ); + sprintf( szString, "\\c%s%s WINS!", TEAM_GetTextColorName( ulTeamIdx ), TEAM_GetName( ulTeamIdx ) ); else sprintf( szString, "DRAW GAME!\n" ); @@ -962,6 +962,21 @@ //***************************************************************************** // +const char *TEAM_GetTextColorName( ULONG ulTeamIdx ) +{ + if ( TEAM_CheckIfValid( ulTeamIdx )) + { + if ( teams[ulTeamIdx].TextColor.IsEmpty( )) + return "Untranslated"; + + return ( teams[ulTeamIdx].TextColor.GetChars( )); + } + + return ( NULL ); +} + +//***************************************************************************** +// ULONG TEAM_GetTextColor( ULONG ulTeamIdx ) { if ( TEAM_CheckIfValid( ulTeamIdx )) @@ -1058,7 +1073,7 @@ if ( TEAM_GetScore( ulTeamIdx ) >= (LONG)pointlimit ) { - NETWORK_Printf( "\034%c%s " TEXTCOLOR_NORMAL "has won the game!\n", V_GetColorChar( TEAM_GetTextColor( ulTeamIdx )), TEAM_GetName( ulTeamIdx )); + NETWORK_Printf( "\034%s%s " TEXTCOLOR_NORMAL "has won the game!\n", TEAM_GetTextColorName( ulTeamIdx ), TEAM_GetName( ulTeamIdx )); // Do the win sequence for the winner. TEAM_DoWinSequence( ulTeamIdx ); @@ -2064,7 +2079,7 @@ { if ( players[consoleplayer].bOnTeam ) { - Printf( "You are on the \034%c%s " TEXTCOLOR_NORMAL "team.\n", V_GetColorChar( TEAM_GetTextColor( players[consoleplayer].Team ) ), TEAM_GetName( players[consoleplayer].Team ) ); + Printf( "You are on the \034%s%s " TEXTCOLOR_NORMAL "team.\n", TEAM_GetTextColorName( players[consoleplayer].Team ), TEAM_GetName( players[consoleplayer].Team ) ); } else Printf( "You are not currently on a team.\n" ); @@ -2266,12 +2281,12 @@ // Player was on a team, so tell everyone that he's changing teams. if ( bOnTeam ) { - Printf( "%s defected to the \034%c%s " TEXTCOLOR_NORMAL "team.\n", players[consoleplayer].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( players[consoleplayer].Team ) ), TEAM_GetName( players[consoleplayer].Team )); + Printf( "%s defected to the \034%s%s " TEXTCOLOR_NORMAL "team.\n", players[consoleplayer].userinfo.GetName(), TEAM_GetTextColorName( players[consoleplayer].Team ), TEAM_GetName( players[consoleplayer].Team )); } // Otherwise, tell everyone he's joining a team. else { - Printf( "%s joined the \034%c%s " TEXTCOLOR_NORMAL "team.\n", players[consoleplayer].userinfo.GetName(), V_GetColorChar( TEAM_GetTextColor( players[consoleplayer].Team ) ), TEAM_GetName( players[consoleplayer].Team )); + Printf( "%s joined the \034%s%s " TEXTCOLOR_NORMAL "team.\n", players[consoleplayer].userinfo.GetName(), TEAM_GetTextColorName( players[consoleplayer].Team ), TEAM_GetName( players[consoleplayer].Team )); } if ( players[consoleplayer].mo ) diff -r b9fb5144d184 -r e623110839b2 src/team.h --- a/src/team.h Mon Sep 13 11:00:37 2021 -0400 +++ b/src/team.h Sat Sep 18 11:27:48 2021 -0400 @@ -104,6 +104,7 @@ void TEAM_SetColor( ULONG ulTeamIdx, int r, int g, int b ); bool TEAM_IsCustomPlayerColorAllowed( ULONG ulTeamIdx ); +const char *TEAM_GetTextColorName( ULONG ulTeamIdx ); ULONG TEAM_GetTextColor( ULONG ulTeamIdx ); void TEAM_SetTextColor( ULONG ulTeamIdx, USHORT usColor ); diff -r b9fb5144d184 -r e623110839b2 src/v_text.cpp --- a/src/v_text.cpp Mon Sep 13 11:00:37 2021 -0400 +++ b/src/v_text.cpp Sat Sep 18 11:27:48 2021 -0400 @@ -699,12 +699,6 @@ String = "Player"; } -// [RC] Converts COL_ numbers to their \c counterparts. -char V_GetColorChar( ULONG ulColor ) -{ - return (char) ( 97 + (int) ulColor ); -} - // [RC] Escapes quotes and backslashes. void V_EscapeBacklashes( FString &String ) { diff -r b9fb5144d184 -r e623110839b2 src/v_text.h --- a/src/v_text.h Mon Sep 13 11:00:37 2021 -0400 +++ b/src/v_text.h Sat Sep 18 11:27:48 2021 -0400 @@ -86,7 +86,6 @@ void V_RemoveColorCodes( FString &String ); void V_RemoveColorCodes( char *pszString ); void V_StripColors( char *pszString ); -char V_GetColorChar( ULONG ulColor ); void V_EscapeBacklashes( FString &String ); void V_RemoveTrailingCrap( char *pszString ); void V_RemoveTrailingCrapFromFString( FString &String );