From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- game/shared/tf/tf_playerclass_shared.cpp | 228 +++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 game/shared/tf/tf_playerclass_shared.cpp (limited to 'game/shared/tf/tf_playerclass_shared.cpp') diff --git a/game/shared/tf/tf_playerclass_shared.cpp b/game/shared/tf/tf_playerclass_shared.cpp new file mode 100644 index 0000000..4365a20 --- /dev/null +++ b/game/shared/tf/tf_playerclass_shared.cpp @@ -0,0 +1,228 @@ +//========= 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; +} -- cgit v1.2.3