Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 75 additions & 78 deletions src/game/shared/tf/tf_dropped_weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,115 +150,112 @@ void CTFDroppedWeapon::OnDataChanged( DataUpdateType_t updateType )
if ( updateType == DATA_UPDATE_CREATED )
{
// if its startrak attach a model to it
if ( m_Item.GetItemID() != INVALID_ITEM_ID )
int iStrangeType = -1;
for ( int i = 0; i < GetKillEaterAttrCount(); i++ )
{
int iStrangeType = -1;
for ( int i = 0; i < GetKillEaterAttrCount(); i++ )
if ( m_Item.FindAttribute( GetKillEaterAttr_Score( i ) ) )
{
if ( m_Item.FindAttribute( GetKillEaterAttr_Score( i ) ) )
{
iStrangeType = i;
break;
}
iStrangeType = i;
break;
}
}

// It's strange, does it have module as well?
if ( iStrangeType != -1 )
// It's strange, does it have module as well?
if ( iStrangeType != -1 )
{
CAttribute_String attrModule;
if ( GetStattrak( &m_Item, &attrModule ) )
{
CAttribute_String attrModule;
if ( GetStattrak( &m_Item, &attrModule ) )
static CSchemaAttributeDefHandle pAttr_moduleScale( "weapon_stattrak_module_scale" );
// Does it have a stat track module
float flScale = 1.0f;
uint32 unFloatAsUint32 = 1;
if ( m_Item.FindAttribute( pAttr_moduleScale, &unFloatAsUint32 ) )
{
static CSchemaAttributeDefHandle pAttr_moduleScale( "weapon_stattrak_module_scale" );
// Does it have a stat track module
float flScale = 1.0f;
uint32 unFloatAsUint32 = 1;
if ( m_Item.FindAttribute( pAttr_moduleScale, &unFloatAsUint32 ) )
{
flScale = (float&)unFloatAsUint32;
}
flScale = (float&)unFloatAsUint32;
}

C_BaseAnimating *pStatTrakEnt = new class C_BaseAnimating;
if ( pStatTrakEnt && pStatTrakEnt->InitializeAsClientEntity( attrModule.value().c_str(), RENDER_GROUP_OPAQUE_ENTITY ) )
{
pStatTrakEnt->AddEffects( EF_BONEMERGE );
pStatTrakEnt->AddEffects( EF_BONEMERGE_FASTCULL );
C_BaseAnimating *pStatTrakEnt = new class C_BaseAnimating;
if ( pStatTrakEnt && pStatTrakEnt->InitializeAsClientEntity( attrModule.value().c_str(), RENDER_GROUP_OPAQUE_ENTITY ) )
{
pStatTrakEnt->AddEffects( EF_BONEMERGE );
pStatTrakEnt->AddEffects( EF_BONEMERGE_FASTCULL );

m_worldmodelStatTrakAddon = pStatTrakEnt;
pStatTrakEnt->SetParent( this );
pStatTrakEnt->SetLocalOrigin( vec3_origin );
pStatTrakEnt->UpdatePartitionListEntry();
pStatTrakEnt->CollisionProp()->MarkPartitionHandleDirty();
pStatTrakEnt->SetModelScale( flScale );
pStatTrakEnt->UpdateVisibility();
m_worldmodelStatTrakAddon = pStatTrakEnt;
pStatTrakEnt->SetParent( this );
pStatTrakEnt->SetLocalOrigin( vec3_origin );
pStatTrakEnt->UpdatePartitionListEntry();
pStatTrakEnt->CollisionProp()->MarkPartitionHandleDirty();
pStatTrakEnt->SetModelScale( flScale );
pStatTrakEnt->UpdateVisibility();

pStatTrakEnt->SetBodygroup( 1, 1 );
pStatTrakEnt->SetBodygroup( 1, 1 );

pStatTrakEnt->m_nSkin = m_Item.GetTeamNumber(); // Use the "Sad" skin
pStatTrakEnt->m_nSkin = m_Item.GetTeamNumber(); // Use the "Sad" skin

//pStatTrakEnt->SetModelScale( 2.0f );
// //if ( !cl_righthand.GetBool() )
// //{
// // pStatTrakEnt->SetBodygroup( 0, 1 ); // use a special mirror-image stattrak module that appears correct for lefties
// //}
//pStatTrakEnt->SetModelScale( 2.0f );
// //if ( !cl_righthand.GetBool() )
// //{
// // pStatTrakEnt->SetBodygroup( 0, 1 ); // use a special mirror-image stattrak module that appears correct for lefties
// //}

RemoveEffects( EF_NODRAW );
}
RemoveEffects( EF_NODRAW );
}
}
}

// Normal Attached models (ie festive lights)
const CEconItemDefinition *pItemDef = m_Item.GetItemDefinition();
if ( pItemDef )
// Normal Attached models (ie festive lights)
const CEconItemDefinition *pItemDef = m_Item.GetItemDefinition();
if ( pItemDef )
{
// Update the state of additional model attachments
m_vecAttachedModels.Purge();
int iTeamNumber = m_Item.GetTeamNumber();
int iAttachedModels = pItemDef->GetNumAttachedModels( iTeamNumber );
for ( int i = 0; i < iAttachedModels; i++ )
{
// Update the state of additional model attachments
m_vecAttachedModels.Purge();
int iTeamNumber = m_Item.GetTeamNumber();
int iAttachedModels = pItemDef->GetNumAttachedModels( iTeamNumber );
for ( int i = 0; i < iAttachedModels; i++ )
{
attachedmodel_t *pModel = pItemDef->GetAttachedModelData( iTeamNumber, i );
attachedmodel_t *pModel = pItemDef->GetAttachedModelData( iTeamNumber, i );

int iModelIndex = modelinfo->GetModelIndex( pModel->m_pszModelName );
if ( iModelIndex >= 0 )
{
AttachedModelData_t attachedModelData;
attachedModelData.m_pModel = modelinfo->GetModel( iModelIndex );
attachedModelData.m_iModelDisplayFlags = pModel->m_iModelDisplayFlags;
m_vecAttachedModels.AddToTail( attachedModelData );
}
int iModelIndex = modelinfo->GetModelIndex( pModel->m_pszModelName );
if ( iModelIndex >= 0 )
{
AttachedModelData_t attachedModelData;
attachedModelData.m_pModel = modelinfo->GetModel( iModelIndex );
attachedModelData.m_iModelDisplayFlags = pModel->m_iModelDisplayFlags;
m_vecAttachedModels.AddToTail( attachedModelData );
}
}

// Festive
// Festive
{
static CSchemaAttributeDefHandle pAttr_is_festivized( "is_festivized" );
if ( pAttr_is_festivized && m_Item.FindAttribute( pAttr_is_festivized ) )
{
static CSchemaAttributeDefHandle pAttr_is_festivized( "is_festivized" );
if ( pAttr_is_festivized && m_Item.FindAttribute( pAttr_is_festivized ) )
int iAttachedFestiveModels = pItemDef->GetNumAttachedModelsFestivized( iTeamNumber );
if ( iAttachedFestiveModels )
{
int iAttachedFestiveModels = pItemDef->GetNumAttachedModelsFestivized( iTeamNumber );
if ( iAttachedFestiveModels )

for ( int i = 0; i < iAttachedFestiveModels; i++ )
{
attachedmodel_t *pModel = pItemDef->GetAttachedModelDataFestivized( iTeamNumber, i );

for ( int i = 0; i < iAttachedFestiveModels; i++ )
int iModelIndex = modelinfo->GetModelIndex( pModel->m_pszModelName );
if ( iModelIndex >= 0 )
{
attachedmodel_t *pModel = pItemDef->GetAttachedModelDataFestivized( iTeamNumber, i );

int iModelIndex = modelinfo->GetModelIndex( pModel->m_pszModelName );
if ( iModelIndex >= 0 )
{
AttachedModelData_t attachedModelData;
attachedModelData.m_pModel = modelinfo->GetModel( iModelIndex );
attachedModelData.m_iModelDisplayFlags = pModel->m_iModelDisplayFlags;
m_vecAttachedModels.AddToTail( attachedModelData );
}

AttachedModelData_t attachedModelData;
attachedModelData.m_pModel = modelinfo->GetModel( iModelIndex );
attachedModelData.m_iModelDisplayFlags = pModel->m_iModelDisplayFlags;
m_vecAttachedModels.AddToTail( attachedModelData );
}

}
}
}
}

SetupParticleEffect();
}

SetupParticleEffect();

SetNextClientThink( CLIENT_THINK_ALWAYS );
}

Expand Down