# HG changeset patch # User Adam Kaminski # Date 1631473513 14400 # Sun Sep 12 15:05:13 2021 -0400 # Node ID 0a2e8279a17eb4a3575d32eb939d320beec96efc # Parent fe4e1d4fb4b16767d208f7e370686205ba244bab Removed some use of magic numbers for offsetting text on the medals screen and scoreboard. diff -r fe4e1d4fb4b1 -r 0a2e8279a17e src/medal.cpp --- a/src/medal.cpp Sun Sep 12 09:47:21 2021 -0400 +++ b/src/medal.cpp Sun Sep 12 15:05:13 2021 -0400 @@ -468,7 +468,7 @@ // Start by drawing "MEDALS" 4 pixels from the top. HUD_DrawTextCentered( BigFont, gameinfo.gametype == GAME_Doom ? CR_RED : CR_UNTRANSLATED, ulCurYPos, "MEDALS", g_bScale ); - ulCurYPos += 42; + ulCurYPos += BigFont->GetHeight( ) + 30; ULONG ulNumMedal = 0; ULONG ulMaxMedalHeight = 0; @@ -516,7 +516,7 @@ else string += " earned the following medals:"; - HUD_DrawTextCentered( SmallFont, CR_WHITE, 26, string, g_bScale ); + HUD_DrawTextCentered( SmallFont, CR_WHITE, BigFont->GetHeight( ) + 14, string, g_bScale ); } //***************************************************************************** diff -r fe4e1d4fb4b1 -r 0a2e8279a17e src/scoreboard.cpp --- a/src/scoreboard.cpp Sun Sep 12 09:47:21 2021 -0400 +++ b/src/scoreboard.cpp Sun Sep 12 15:05:13 2021 -0400 @@ -534,7 +534,7 @@ if ( gamestate == GS_LEVEL ) HUD_DrawTextCentered( BigFont, CR_RED, g_ulCurYPos, "RANKINGS", g_bScale ); - g_ulCurYPos += 18; + g_ulCurYPos += BigFont->GetHeight( ) + 6; // [AK] Draw the name of the server if we're in an online game. if ( NETWORK_InClientMode( )) @@ -542,12 +542,12 @@ FString hostName = sv_hostname.GetGenericRep( CVAR_String ).String; V_ColorizeString( hostName ); HUD_DrawTextCentered( SmallFont, CR_GREY, g_ulCurYPos, hostName, g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } // [AK] Draw the name of the current game mode. HUD_DrawTextCentered( SmallFont, CR_GOLD, g_ulCurYPos, GAMEMODE_GetCurrentName( ), g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; // Draw the time, frags, points, or kills we have left until the level ends. if ( gamestate == GS_LEVEL ) @@ -560,7 +560,7 @@ for ( std::list::iterator i = lines.begin( ); i != lines.end( ); i++ ) { HUD_DrawTextCentered( SmallFont, CR_GREY, g_ulCurYPos, *i, g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } } @@ -568,16 +568,16 @@ if ( GAMEMODE_GetCurrentFlags( ) & GMF_PLAYERSONTEAMS ) { if ( gamestate != GS_LEVEL ) - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; HUD_DrawTextCentered( SmallFont, CR_GREY, g_ulCurYPos, HUD_BuildPointString( ), g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } // Draw my rank and my frags, points, etc. Don't draw it if we're in the intermission. else if (( gamestate == GS_LEVEL ) && ( HUD_ShouldDrawRank( ulPlayer ))) { HUD_DrawTextCentered( SmallFont, CR_GREY, g_ulCurYPos, HUD_BuildPlaceString( ulPlayer ), g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } // [JS] Intermission countdown display. @@ -593,7 +593,7 @@ countdownMessage.AppendFormat( " in %d seconds", MAX( static_cast( WI_GetStopWatch( )) / TICRATE + 1, 1 )); HUD_DrawTextCentered( SmallFont, CR_GREEN, g_ulCurYPos, countdownMessage, g_bScale ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } } @@ -1000,12 +1000,12 @@ continue; scoreboard_RenderIndividualPlayer( ulPlayer, g_iSortedPlayers[ulIdx] ); - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; ulNumPlayers++; } if ( ulNumPlayers ) - g_ulCurYPos += 10; + g_ulCurYPos += SmallFont->GetHeight( ) + 1; } //*****************************************************************************