Пример #1
0
void DisplayWeaponModelPieces( LTObjRef hObject, HWEAPON hWeapon, const char* ModelPieceListAtt, bool bShow, bool bUseAIWeapons )
{
	if( !hWeapon || !hObject )
		return;

	// get the model interface
	ILTModel *pModelLT = g_pLTServer->GetModelLT();
	ASSERT( 0 != pModelLT );

	HWEAPONDATA hWpnData = g_pWeaponDB->GetWeaponData(hWeapon, bUseAIWeapons);

	uint32 NumPieces = g_pWeaponDB->GetNumValues(hWpnData,ModelPieceListAtt);
	for (uint32 PieceIndex=0; PieceIndex < NumPieces; PieceIndex++)
	{
		const char* pszPiece = g_pWeaponDB->GetString(hWpnData, ModelPieceListAtt, PieceIndex);

		HMODELPIECE hPiece = 0;
		if( LT_OK == pModelLT->GetPiece( hObject, pszPiece, hPiece ) )
		{
			// show or hide the model piece
			LTRESULT ltResult = pModelLT->SetPieceHideStatus( hObject, hPiece, !bShow );
			ASSERT( ( LT_OK == ltResult) || ( LT_NOCHANGE == ltResult ) );
		}
	}
}