FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

cl_dll/history_resource.cpp

121314151617
#include #include "iclientmode.h" #include "vgui_controls/AnimationController.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
121314151617181920
#include #include "iclientmode.h" #include "vgui_controls/AnimationController.h" #include "ammodef.h" #include "ff_hud_boxes.h" #include "ff_utils.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h"
656667686970
Reset(); } //----------------------------------------------------------------------------- // Purpose: //-----------------------------------------------------------------------------
68697071727374757677
Reset(); } // Need these for the texture caching void FreeHudTextureList(CUtlDict& list); CHudTexture *FindHudTextureInDict(CUtlDict& list, const char *psz); //----------------------------------------------------------------------------- // Purpose: //-----------------------------------------------------------------------------
737475767778
m_PickupHistory.RemoveAll(); m_iCurrentHistorySlot = 0; m_bDoNotDraw = true; } //-----------------------------------------------------------------------------
8081828384858687888990919293949596979899100101102103104105106107108109110111
m_PickupHistory.RemoveAll(); m_iCurrentHistorySlot = 0; m_bDoNotDraw = true; // --> Mirv: Get icon for each generic ammo type // Open up our dedicated ammo hud file CUtlDict tempList; LoadHudTextures(tempList, "scripts/ff_hud_genericammo", NULL); for (int i = 0; i < MAX_AMMO_TYPES; i++) { Ammo_t *pAmmo = GetAmmoDef()->GetAmmoOfIndex(i); if (pAmmo && pAmmo->pName) { CHudTexture *p = FindHudTextureInDict(tempList, pAmmo->pName); if (p) { m_pHudAmmoTypes[i] = gHUD.AddUnsearchableHudIconToList(*p); } else { Warning("Could not find entry for %s ammo in ff_hud_genericammo\n", pAmmo->pName); } } } FreeHudTextureList(tempList); // <-- Mirv: Get icon for each generic ammo type } //-----------------------------------------------------------------------------
878889909192
//----------------------------------------------------------------------------- void CHudHistoryResource::AddToHistory( C_BaseCombatWeapon *weapon ) { // don't draw exhaustable weapons (grenades) since they'll have an ammo pickup icon as well if ( weapon->GetWpnData().iFlags & ITEM_FLAG_EXHAUSTIBLE ) return;
120121122123124125126127
//----------------------------------------------------------------------------- void CHudHistoryResource::AddToHistory( C_BaseCombatWeapon *weapon ) { return; // |-- Mirv: Don't show any weapons as pickup icons // don't draw exhaustable weapons (grenades) since they'll have an ammo pickup icon as well if ( weapon->GetWpnData().iFlags & ITEM_FLAG_EXHAUSTIBLE ) return;
117118119120121122
if ( !iCount ) return; // clear out any ammo pickup denied icons, since we can obviously pickup again for ( int i = 0; i < m_PickupHistory.Count(); i++ ) {
152153154155156157158159160161
if ( !iCount ) return; /*// HACK HACK HACK Hide the addition of cells... if (iId == 4 && iCount == 3) return;*/ // clear out any ammo pickup denied icons, since we can obviously pickup again for ( int i = 0; i < m_PickupHistory.Count(); i++ ) {
131132133134135136137
} } AddIconToHistory( iType, iId, NULL, iCount, NULL ); } //-----------------------------------------------------------------------------
170171172173174175176177178179
} } // Get the item's icon CHudTexture *icon = gHUD.GetIcon( FF_GetAmmoName(iId) ); AddIconToHistory( iType, iId, NULL, iCount, icon ); } //-----------------------------------------------------------------------------
169170171172173174
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageLower" ); } // ensure the size m_PickupHistory.EnsureCount(m_iCurrentHistorySlot + 1);
211212213214215216217218219220221222223
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageLower" ); } // --> Mirv: Also limit to 8 icons if (m_iCurrentHistorySlot == 8) { m_iCurrentHistorySlot = 0; } // <-- Mirv // ensure the size m_PickupHistory.EnsureCount(m_iCurrentHistorySlot + 1);
318319320321322323324
{ case HISTSLOT_AMMO: { itemIcon = gWR.GetAmmoIconFromWeapon( m_PickupHistory[i].iId ); iAmount = m_PickupHistory[i].iCount; } break;
367368369370371372373374375376
{ case HISTSLOT_AMMO: { if (!m_PickupHistory[i].icon) itemIcon = gWR.GetAmmoIconFromWeapon( m_PickupHistory[i].iId ); else itemIcon = m_PickupHistory[i].icon; iAmount = m_PickupHistory[i].iCount; } break;
363364365366367368369370
break; } if ( !itemIcon ) continue; if ( clr[3] ) {
415416417418419420421
break; } // --> Mirv: Draw proper icons if ( clr[3] ) {
372373374375376377378379380381382
m_bNeedsDraw = true; } int ypos = tall - (m_flHistoryGap * (i + 1)); int xpos = wide - itemIcon->Width() - m_flIconInset; itemIcon->DrawSelf( xpos, ypos, clr ); if ( iAmount ) { wchar_t text[16];
423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
m_bNeedsDraw = true; } // We don't have a weapon for this item, so just show a generic one if (!itemIcon && m_PickupHistory[i].iId >= 0) itemIcon = m_pHudAmmoTypes[m_PickupHistory[i].iId]; // these will get changed later if there is an icon int iconTall = surface()->GetFontTall( m_hNumberFont ); int iconWide = 0; int ypos = tall - (m_flHistoryGap * (i + 1)); if (itemIcon) { if (itemIcon->bRenderUsingFont) { iconTall = itemIcon->Height(); iconWide = itemIcon->Width(); } else { float ratio = (float)itemIcon->Width() / (float)itemIcon->Height(); iconWide = iconTall * ratio; } int xpos = wide - iconWide - m_flIconInset; itemIcon->DrawSelf(xpos, ypos, iconWide, iconTall, clr); } // <-- Mirv: Draw proper icons if ( iAmount ) { wchar_t text[16];
383384385386387388389
_snwprintf( text, sizeof( text ) / sizeof(wchar_t), L"%i", m_PickupHistory[i].iCount ); // offset the number to sit properly next to the icon ypos -= ( surface()->GetFontTall( m_hNumberFont ) - itemIcon->Height() ) / 2; vgui::surface()->DrawSetTextFont( m_hNumberFont ); vgui::surface()->DrawSetTextColor( clr );
458459460461462463464
_snwprintf( text, sizeof( text ) / sizeof(wchar_t), L"%i", m_PickupHistory[i].iCount ); // offset the number to sit properly next to the icon ypos -= ( surface()->GetFontTall( m_hNumberFont ) - iconTall ) / 2; vgui::surface()->DrawSetTextFont( m_hNumberFont ); vgui::surface()->DrawSetTextColor( clr );
393394395396397398399
else if ( bUseAmmoFullMsg ) { // offset the number to sit properly next to the icon ypos -= ( surface()->GetFontTall( m_hTextFont ) - itemIcon->Height() ) / 2; vgui::surface()->DrawSetTextFont( m_hTextFont ); vgui::surface()->DrawSetTextColor( clr );
468469470471472473474
else if ( bUseAmmoFullMsg ) { // offset the number to sit properly next to the icon ypos -= ( surface()->GetFontTall( m_hTextFont ) - iconTall ) / 2; vgui::surface()->DrawSetTextFont( m_hTextFont ); vgui::surface()->DrawSetTextColor( clr );