diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf/c_tf_death_callingcard.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/tf/c_tf_death_callingcard.cpp')
| -rw-r--r-- | game/client/tf/c_tf_death_callingcard.cpp | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/game/client/tf/c_tf_death_callingcard.cpp b/game/client/tf/c_tf_death_callingcard.cpp new file mode 100644 index 0000000..2e486ad --- /dev/null +++ b/game/client/tf/c_tf_death_callingcard.cpp @@ -0,0 +1,109 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: TF Death Calling card version based off the stickybolt code. +//=============================================================================// +#include "cbase.h" +#include "c_basetempentity.h" +#include "fx.h" +#include "decals.h" +#include "iefx.h" +#include "engine/IEngineSound.h" +#include "materialsystem/imaterialvar.h" +#include "IEffects.h" +#include "engine/IEngineTrace.h" +#include "vphysics/constraints.h" +#include "engine/ivmodelinfo.h" +#include "tempent.h" +#include "c_te_legacytempents.h" +#include "engine/ivdebugoverlay.h" +#include "c_te_effect_dispatch.h" +#include "c_tf_player.h" +#include "GameEventListener.h" +#include "tf_shareddefs.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +extern IPhysicsSurfaceProps *physprops; +IPhysicsObject *GetWorldPhysObject( void ); + +extern CBaseEntity *BreakModelCreateSingle( CBaseEntity *pOwner, breakmodel_t *pModel, const Vector &position, + const QAngle &angles, const Vector &velocity, const AngularImpulse &angVelocity, int nSkin, const breakablepropparams_t ¶ms ); + +//----------------------------------------------------------------------------- +// Purpose: Creates a "Calling Card" prop at the victim's location +//----------------------------------------------------------------------------- +void CreateDeathCallingCard( + const Vector &vecOrigin, + const QAngle &vAngle, + const int iVictimIndex, + const int iShooterIndex, + const int iCallingCardIndex +) { + if ( iCallingCardIndex < 1 || iCallingCardIndex > TF_CALLING_CARD_MODEL_COUNT ) + { + Warning( "Attempted to Call CreateDeathCallingCard With invalid index %d", iCallingCardIndex ); + return; + } + + const char* pszModelName = g_pszDeathCallingCardModels[iCallingCardIndex]; + + CTFPlayer *pVictim = ToTFPlayer( UTIL_PlayerByIndex( iVictimIndex ) ); + if ( !pVictim ) + return; + + breakablepropparams_t breakParams( vecOrigin, vAngle, vec3_origin, vec3_origin ); + breakParams.impactEnergyScale = 1.0f; + + breakmodel_t breakModel; + Q_strncpy( breakModel.modelName, pszModelName, sizeof(breakModel.modelName) ); + + breakModel.health = 1; + breakModel.fadeTime = RandomFloat(7,10); + breakModel.fadeMinDist = 0.0f; + breakModel.fadeMaxDist = 0.0f; + breakModel.burstScale = 1.0f; + breakModel.collisionGroup = COLLISION_GROUP_DEBRIS; + breakModel.isRagdoll = false; + breakModel.isMotionDisabled = false; + breakModel.placementName[0] = 0; + breakModel.placementIsBone = false; + breakModel.offset = Vector( 0, 0, 50 ); + + CBaseEntity * pBreakModel = BreakModelCreateSingle( + pVictim, + &breakModel, + pVictim->GetAbsOrigin() + Vector( 0, 0, 50 ), + QAngle(0, vAngle.y, 0 ), + vec3_origin, + vec3_origin, + 0, + breakParams + ); + + // Scale down the tombstones a bit + if ( pBreakModel ) + { + CBaseAnimating *pAnim = dynamic_cast < CBaseAnimating * > ( pBreakModel ); + if ( pAnim ) + { + pAnim->SetModelScale( 0.9f ); + } + } +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void DeathCallingCard( const CEffectData &data ) +{ + CreateDeathCallingCard( + data.m_vOrigin, + data.m_vAngles, + data.m_nAttachmentIndex, // Victim + data.m_nHitBox, // iShooter + data.m_fFlags // Calling card Index + ); +} + +DECLARE_CLIENT_EFFECT( "TFDeathCallingCard", DeathCallingCard );
\ No newline at end of file |