@@ -3147,6 +3147,12 @@ void CItemModelPanel::UpdatePanels( void )
31473147 int iRGB0 = m_ItemData.GetModifiedRGBValue ( false ),
31483148 iRGB1 = m_ItemData.GetModifiedRGBValue ( true );
31493149
3150+ #ifdef BDSBASE
3151+ if (!bIsEconTool)
3152+ {
3153+ DrawPaintImage (iRGB0, iRGB1);
3154+ }
3155+ #else
31503156 if ( !bIsEconTool && (iRGB0 != 0 || iRGB1 != 0 ))
31513157 {
31523158 m_pPaintIcon->SetVisible ( true );
@@ -3156,6 +3162,7 @@ void CItemModelPanel::UpdatePanels( void )
31563162 m_pPaintIcon->m_colPaintColors .AddToTail ( Color ( clamp ( (iRGB1 & 0xFF0000 ) >> 16 , 0 , 255 ), clamp ( (iRGB1 & 0xFF00 ) >> 8 , 0 , 255 ), clamp ( (iRGB1 & 0xFF ), 0 , 255 ), 255 ) );
31573163 }
31583164 }
3165+ #endif
31593166 }
31603167 }
31613168
@@ -3409,19 +3416,68 @@ void CItemModelPanel::SetModelIsHidden( bool bHideModel )
34093416 }
34103417}
34113418
3419+ #ifdef BDSBASE
3420+ void CItemModelPanel::DrawPaintImage (int iRGB0, int iRGB1)
3421+ {
3422+ if (iRGB0 != 0 || iRGB1 != 0 )
3423+ {
3424+ m_pPaintIcon->SetVisible (true );
3425+ m_pPaintIcon->m_colPaintColors .AddToTail (Color (clamp ((iRGB0 & 0xFF0000 ) >> 16 , 0 , 255 ), clamp ((iRGB0 & 0xFF00 ) >> 8 , 0 , 255 ), clamp ((iRGB0 & 0xFF ), 0 , 255 ), 255 ));
3426+ if (iRGB0 != iRGB1)
3427+ {
3428+ m_pPaintIcon->m_colPaintColors .AddToTail (Color (clamp ((iRGB1 & 0xFF0000 ) >> 16 , 0 , 255 ), clamp ((iRGB1 & 0xFF00 ) >> 8 , 0 , 255 ), clamp ((iRGB1 & 0xFF ), 0 , 255 ), 255 ));
3429+ }
3430+ }
3431+ }
3432+
3433+ static CSchemaAttributeDefHandle pAttrDef_SpellColor (" SPELL: set item tint RGB" );
3434+ #endif
3435+
34123436void CItemModelPanel::OnTick ()
34133437{
34143438 bool bStillWorking = LoadData ();
3439+ #ifdef BDSBASE
3440+ if (m_pContainedItemPanel && bLoadingData)
3441+ #else
34153442 if ( m_pContainedItemPanel )
3443+ #endif
34163444 {
34173445 bStillWorking |= m_pContainedItemPanel->LoadData ();
34183446 }
34193447
3448+ #ifdef BDSBASE
3449+ // If we're done working, lets check if the item is spelled and can change colors!
3450+ // If it is not, lets stop ticking the panel and act like normal.
3451+ if (!bStillWorking)
3452+ {
3453+ bLoadingData = false ;
3454+ if (!pAttrDef_SpellColor || !m_ItemData.FindAttribute (pAttrDef_SpellColor))
3455+ {
3456+ RemovePanelTick ();
3457+ }
3458+ else if (m_pPaintIcon)
3459+ {
3460+ if (!m_bHideModel && !m_bHidePaintIcon)
3461+ {
3462+ // Empty out our list of paint colors. We may or may not put things back in -- an empty
3463+ // list at the end means "don't draw the paint icon".
3464+ m_pPaintIcon->m_colPaintColors .RemoveAll ();
3465+
3466+ // Has the item been painted?
3467+ int iRGB0 = m_ItemData.GetModifiedRGBValue (false ),
3468+ iRGB1 = m_ItemData.GetModifiedRGBValue (true );
3469+
3470+ DrawPaintImage (iRGB0, iRGB1);
3471+ }
3472+ }
3473+ }
3474+ #else
34203475 // If we're done working, we dont need to tick anymore
34213476 if ( !bStillWorking )
34223477 {
34233478 LoadDataCompleted ();
34243479 }
3480+ #endif
34253481
34263482 BaseClass::OnTick ();
34273483}
@@ -3529,7 +3585,11 @@ bool CItemModelPanel::LoadData()
35293585 return bStillWorking;
35303586}
35313587
3588+ #ifdef BDSBASE
3589+ void CItemModelPanel::RemovePanelTick ()
3590+ #else
35323591void CItemModelPanel::LoadDataCompleted ()
3592+ #endif
35333593{
35343594 vgui::ivgui ()->RemoveTickSignal ( GetVPanel () );
35353595}
0 commit comments