diff options
Diffstat (limited to 'mp/src/game/client/hud_basedeathnotice.cpp')
| -rw-r--r-- | mp/src/game/client/hud_basedeathnotice.cpp | 97 |
1 files changed, 80 insertions, 17 deletions
diff --git a/mp/src/game/client/hud_basedeathnotice.cpp b/mp/src/game/client/hud_basedeathnotice.cpp index c7499ac6..36a9cc3c 100644 --- a/mp/src/game/client/hud_basedeathnotice.cpp +++ b/mp/src/game/client/hud_basedeathnotice.cpp @@ -115,7 +115,9 @@ void CHudBaseDeathNotice::Paint() DeathNoticeItem &msg = m_DeathNotices[i]; CHudTexture *icon = msg.iconDeath; - CHudTexture *iconPrekiller = msg.iconPreKiller; + CHudTexture *iconPostKillerName = msg.iconPostKillerName; + CHudTexture *iconPreKillerName = msg.iconPreKillerName; + CHudTexture *iconPostVictimName = msg.iconPostVictimName; wchar_t victim[256]=L""; wchar_t killer[256]=L""; @@ -135,7 +137,11 @@ void CHudBaseDeathNotice::Paint() int iconWide = 0, iconTall = 0, iDeathInfoOffset = 0, iVictimTextOffset = 0, iconActualWide = 0; int iPreKillerTextWide = msg.wzPreKillerText[0] ? UTIL_ComputeStringWidth( m_hTextFont, msg.wzPreKillerText ) - xSpacing : 0; - int iconPrekillerWide = 0, iconPrekillerActualWide = 0, iconPreKillerTall = 0; + + int iconPrekillerWide = 0, iconPrekillerActualWide = 0, iconPrekillerTall = 0; + int iconPostkillerWide = 0, iconPostkillerActualWide = 0, iconPostkillerTall = 0; + + int iconPostVictimWide = 0, iconPostVictimActualWide = 0, iconPostVictimTall = 0; // Get the local position for this notice if ( icon ) @@ -153,23 +159,53 @@ void CHudBaseDeathNotice::Paint() iconWide *= flScale; } - if ( iconPrekiller ) + if ( iconPreKillerName ) { - iconPrekillerActualWide = iconPrekiller->EffectiveWidth( 1.0f ); + iconPrekillerActualWide = iconPreKillerName->EffectiveWidth( 1.0f ); iconPrekillerWide = iconPrekillerActualWide; - iconPreKillerTall = iconPrekiller->EffectiveHeight( 1.0f ); + iconPrekillerTall = iconPreKillerName->EffectiveHeight( 1.0f ); - int iconTallDesired = iLineTall-YRES(2); + int iconTallDesired = iLineTall - YRES( 2 ); Assert( 0 != iconTallDesired ); - float flScale = (float) iconTallDesired / (float) iconPreKillerTall; + float flScale = (float)iconTallDesired / (float)iconPrekillerTall; iconPrekillerActualWide *= flScale; - iconPreKillerTall *= flScale; + iconPrekillerTall *= flScale; iconPrekillerWide *= flScale; } + if ( iconPostKillerName ) + { + iconPostkillerActualWide = iconPostKillerName->EffectiveWidth( 1.0f ); + iconPostkillerWide = iconPostkillerActualWide; + iconPostkillerTall = iconPostKillerName->EffectiveHeight( 1.0f ); + + int iconTallDesired = iLineTall-YRES(2); + Assert( 0 != iconTallDesired ); + float flScale = (float) iconTallDesired / (float) iconPostkillerTall; + + iconPostkillerActualWide *= flScale; + iconPostkillerTall *= flScale; + iconPostkillerWide *= flScale; + } + + if ( iconPostVictimName ) + { + iconPostVictimActualWide = iconPostVictimName->EffectiveWidth( 1.0f ); + iconPostVictimWide = iconPostVictimActualWide; + iconPostVictimTall = iconPostVictimName->EffectiveHeight( 1.0f ); + + int iconTallDesired = iLineTall - YRES( 2 ); + Assert( 0 != iconTallDesired ); + float flScale = (float)iconTallDesired / (float)iconPostVictimTall; + + iconPostVictimActualWide *= flScale; + iconPostVictimTall *= flScale; + iconPostVictimWide *= flScale; + } + int iTotalWide = iKillerTextWide + iconWide + iVictimTextWide + iDeathInfoTextWide + iDeathInfoEndTextWide + ( xMargin * 2 ); - iTotalWide += iconPrekillerWide + iPreKillerTextWide; + iTotalWide += iconPrekillerWide + iconPostkillerWide + iPreKillerTextWide + iconPostVictimWide; int y = yStart + ( ( iLineTall + m_flLineSpacing ) * i ); int yText = y + ( ( iLineTall - iTextTall ) / 2 ); @@ -190,6 +226,14 @@ void CHudBaseDeathNotice::Paint() x += xMargin; + // prekiller icon + if ( iconPreKillerName ) + { + int yPreIconTall = y + ( ( iLineTall - iconPrekillerTall ) / 2 ); + iconPreKillerName->DrawSelf( x, yPreIconTall, iconPrekillerActualWide, iconPrekillerTall, m_clrIcon); + x += iconPrekillerWide + xSpacing; + } + if ( killer[0] ) { // Draw killer's name @@ -205,12 +249,12 @@ void CHudBaseDeathNotice::Paint() x += iPreKillerTextWide; } - // Prekiller icon - if ( iconPrekiller ) + // postkiller icon + if ( iconPostKillerName ) { - int yPreIconTall = y + ( ( iLineTall - iconPreKillerTall ) / 2 ); - iconPrekiller->DrawSelf( x, yPreIconTall, iconPrekillerActualWide, iconPreKillerTall, m_clrIcon ); - x += iconPrekillerWide + xSpacing; + int yPreIconTall = y + ( ( iLineTall - iconPostkillerTall ) / 2 ); + iconPostKillerName->DrawSelf( x, yPreIconTall, iconPostkillerActualWide, iconPostkillerTall, m_clrIcon ); + x += iconPostkillerWide + xSpacing; } // Draw glow behind weapon icon to show it was a crit death @@ -243,6 +287,14 @@ void CHudBaseDeathNotice::Paint() DrawText( x + iVictimTextOffset, yText, m_hTextFont, GetTeamColor( msg.Victim.iTeam, msg.bLocalPlayerInvolved ), victim ); x += iVictimTextWide; + // postkiller icon + if ( iconPostVictimName ) + { + int yPreIconTall = y + ( ( iLineTall - iconPostVictimTall ) / 2 ); + iconPostVictimName->DrawSelf( x, yPreIconTall, iconPostVictimActualWide, iconPostVictimTall, m_clrIcon ); + x += iconPostkillerWide + xSpacing; + } + // Draw Additional Text on the end of the victims name if ( msg.wzInfoTextEnd[0] ) { @@ -569,16 +621,27 @@ void CHudBaseDeathNotice::FireGameEvent( IGameEvent *event ) } } + bool bIsHalloween2014 = TFGameRules() && TFGameRules()->IsHalloweenScenario( CTFGameRules::HALLOWEEN_SCENARIO_DOOMSDAY ); + switch ( iEventType ) { case TF_FLAGEVENT_PICKUP: - pszMsgKey = "#Msg_PickedUpFlag"; + pszMsgKey = bIsHalloween2014 ? "#Msg_PickedUpFlagHalloween2014" : "#Msg_PickedUpFlag"; break; case TF_FLAGEVENT_CAPTURE: - pszMsgKey = "#Msg_CapturedFlag"; + pszMsgKey = bIsHalloween2014 ? "#Msg_CapturedFlagHalloween2014" : "#Msg_CapturedFlag"; break; case TF_FLAGEVENT_DEFEND: - pszMsgKey = bIsMvM ? "#Msg_DefendedBomb" : "#Msg_DefendedFlag"; + if ( bIsMvM ) + { + pszMsgKey = "#Msg_DefendedBomb"; + } + else + { + pszMsgKey = bIsHalloween2014 ? "#Msg_DefendedFlagHalloween2014" : "#Msg_DefendedFlag"; + } + + break; // Add this when we can get localization for it |