//========= Copyright Valve Corporation, All rights reserved. ============// // //============================================================================= #include "cbase.h" #include "KeyValues.h" #include "tf_playerclass_shared.h" #include "materialsystem/imaterialsystemhardwareconfig.h" #include "filesystem.h" #include "tier2/tier2.h" //============================================================================= // // Shared player class data. // //============================================================================= // // Tables. // #define CLASSMODEL_PARITY_BITS 3 #define CLASSMODEL_PARITY_MASK ((1<GetModelName(), sizeof( modelFilename ) ); #ifdef STAGING_ONLY if ( tf_player_use_female_models.GetBool() ) { // find the ".mdl" part char *ext; for( ext = modelFilename; *ext != '\000'; ++ext ) { if ( *ext == '.' ) { V_strncpy( ext, "_female.mdl", sizeof( modelFilename ) - ( ext - modelFilename ) ); break; } } // make sure the test model is precached bool bAllowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); CBaseEntity::PrecacheModel( modelFilename ); CBaseEntity::SetAllowPrecache( bAllowPrecache ); } #endif return modelFilename; } //----------------------------------------------------------------------------- // Purpose: Initialize the player class. //----------------------------------------------------------------------------- const char *g_HACK_GunslingerEngineerArmsOverride = "models\\weapons\\c_models\\c_engineer_gunslinger.mdl"; const char *CTFPlayerClassShared::GetHandModelName( int iHandIndex = 0 ) const { return iHandIndex == 0 ? GetPlayerClassData( m_iClass )->m_szHandModelName :g_HACK_GunslingerEngineerArmsOverride; // this is precached in the CTFRobotArm class } //----------------------------------------------------------------------------- // Purpose: Initialize the player class. //----------------------------------------------------------------------------- bool CTFPlayerClassShared::Init( int iClass ) { Assert ( ( iClass >= TF_FIRST_NORMAL_CLASS ) && ( iClass <= TF_LAST_NORMAL_CLASS ) ); Reset(); m_iClass = iClass; #ifdef CLIENT_DLL V_strncpy( m_iszCustomModel, g_aRawPlayerClassNamesShort[ m_iClass ], sizeof( m_iszCustomModel ) ); #else m_iszClassIcon.Set( AllocPooledString( g_aRawPlayerClassNamesShort[ m_iClass ] ) ); #endif return true; } // If needed, put this into playerclass scripts bool CTFPlayerClassShared::CanBuildObject( int iObjectType ) { bool bFound = false; TFPlayerClassData_t *pData = GetData(); int i; for ( i=0;im_aBuildable[i] ) { bFound = true; break; } } return bFound; }