game_shared/basecombatweapon_shared.cpp
199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022
//Find the next sequence in the potential chain of sequences leading to our ideal one
int nextSequence = FindTransitionSequence( GetSequence(), m_nIdealSequence, NULL );
// Don't use transitions when we're deploying
if ( ideal != ACT_VM_DRAW && IsWeaponVisible() && nextSequence != m_nIdealSequence )
{
//Set our activity to the next transitional animation
SetActivity( ACT_TRANSITION );
SetSequence( nextSequence );
SendViewModelAnim( nextSequence );
}
else
{
//Set our activity to the ideal
SetActivity( m_IdealActivity );
SetSequence( m_nIdealSequence );
SendViewModelAnim( m_nIdealSequence );
}
//Set the next time the weapon will idle
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
return true;
}
1999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050
//Find the next sequence in the potential chain of sequences leading to our ideal one
int nextSequence = FindTransitionSequence( GetSequence(), m_nIdealSequence, NULL );
// --> Mirv: Fixed world model animations
// Must not send viewmodel sequences to the world model. The whole basecombatweapon
// this is done stupidly because it uses the viewmodel for all its stuff, even though
// it's actually a worldmodel on the client.
// Part of this fix is also in basecombatweapon.cpp
// Don't use transitions when we're deploying
if ( ideal != ACT_VM_DRAW && IsWeaponVisible() && nextSequence != m_nIdealSequence )
{
//Set our activity to the next transitional animation
// Timing has been moved into each conditional result now
SetActivity( ACT_TRANSITION );
SetSequence( nextSequence );
SendViewModelAnim( nextSequence );
SetWeaponIdleTime(gpGlobals->curtime + SequenceDuration(nextSequence));
}
else
{
//Set our activity to the ideal
SetActivity( m_IdealActivity );
// The weapon model sequence need clamping to either idle or firing for now
// Need to call ResetSequenceInfo for the muzzleflashes
// Melee weapons won't have a fire animation (for now)
if (m_IdealActivity == ACT_VM_PRIMARYATTACK && !IsMeleeWeapon())
{
SetSequence(1);
ResetSequenceInfo();
}
else
{
SetSequence(0);
}
// Send the correct sequences to the viewmodel.
// Also use the correct timing from the original sequence (not the one
// that is really set)
SendViewModelAnim( m_nIdealSequence );
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration(m_nIdealSequence));
}
//Set the next time the weapon will idle
// This has been moved into the conditional results above
//SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
// <-- Mirv
return true;
}
217021712172217321742175
#endif
}
//---------------------------------------------------------
// Count of all the weapons in the world of my type and
// see if we have a surplus. If there is a surplus, try
219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230
#endif
}
#ifdef GAME_DLL
//-----------------------------------------------------------------------------
// Purpose: Remove this weapon, now!
//-----------------------------------------------------------------------------
void CBaseCombatWeapon::ForceRemove( void )
{
SetRemoveable( true );
AddSpawnFlags( SF_NORESPAWN );
StopAnimation();
StopFollowingEntity();
SetMoveType( MOVETYPE_NONE );
SetGravity( 1.0 );
m_iState = WEAPON_NOT_CARRIED;
RemoveEffects( EF_NODRAW );
VPhysicsDestroyObject();
SetGroundEntity( NULL );
AddEFlags( EFL_NO_WEAPON_PICKUP );
SetThink( NULL );
SetTouch( NULL );
SetOwnerEntity( NULL );
SetOwner( NULL );
// Die!
UTIL_Remove( this );
}
#endif
//---------------------------------------------------------
// Count of all the weapons in the world of my type and
// see if we have a surplus. If there is a surplus, try
24992500250125022503250425052506
//-----------------------------------------------------------------------------
BEGIN_NETWORK_TABLE_NOBASE( CBaseCombatWeapon, DT_LocalWeaponData )
#if !defined( CLIENT_DLL )
SendPropIntWithMinusOneFlag( SENDINFO(m_iClip1 ), 8 ),
SendPropIntWithMinusOneFlag( SENDINFO(m_iClip2 ), 8 ),
SendPropInt( SENDINFO(m_iPrimaryAmmoType ), 8 ),
SendPropInt( SENDINFO(m_iSecondaryAmmoType ), 8 ),
255425552556255725582559
//-----------------------------------------------------------------------------
BEGIN_NETWORK_TABLE_NOBASE( CBaseCombatWeapon, DT_LocalWeaponData )
#if !defined( CLIENT_DLL )
SendPropInt( SENDINFO(m_iPrimaryAmmoType ), 8 ),
SendPropInt( SENDINFO(m_iSecondaryAmmoType ), 8 ),
25072508250925102511251225132514
SendPropInt( SENDINFO( m_nViewModelIndex ), VIEWMODEL_INDEX_BITS, SPROP_UNSIGNED ),
#else
RecvPropIntWithMinusOneFlag( RECVINFO(m_iClip1 )),
RecvPropIntWithMinusOneFlag( RECVINFO(m_iClip2 )),
RecvPropInt( RECVINFO(m_iPrimaryAmmoType )),
RecvPropInt( RECVINFO(m_iSecondaryAmmoType )),
256025612562256325642565
SendPropInt( SENDINFO( m_nViewModelIndex ), VIEWMODEL_INDEX_BITS, SPROP_UNSIGNED ),
#else
RecvPropInt( RECVINFO(m_iPrimaryAmmoType )),
RecvPropInt( RECVINFO(m_iSecondaryAmmoType )),
2517251825192520252125222523252425252526
#endif
END_NETWORK_TABLE()
BEGIN_NETWORK_TABLE(CBaseCombatWeapon, DT_BaseCombatWeapon)
#if !defined( CLIENT_DLL )
SendPropDataTable("LocalWeaponData", 0, &REFERENCE_SEND_TABLE(DT_LocalWeaponData), SendProxy_SendLocalWeaponDataTable ),
SendPropDataTable("LocalActiveWeaponData", 0, &REFERENCE_SEND_TABLE(DT_LocalActiveWeaponData), SendProxy_SendActiveLocalWeaponDataTable ),
SendPropModelIndex( SENDINFO(m_iViewModelIndex) ),
SendPropModelIndex( SENDINFO(m_iWorldModelIndex) ),
SendPropInt( SENDINFO(m_iState ), 8, SPROP_UNSIGNED ),
25682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593
#endif
END_NETWORK_TABLE()
//-----------------------------------------------------------------------------
// Purpose: Propagation data for weapons. Only sent when a player's holding it.
//-----------------------------------------------------------------------------
BEGIN_NETWORK_TABLE_NOBASE( CBaseCombatWeapon, DT_ObserverWeaponData )
#if !defined( CLIENT_DLL )
SendPropIntWithMinusOneFlag( SENDINFO(m_iClip1 ), 8 ),
SendPropIntWithMinusOneFlag( SENDINFO(m_iClip2 ), 8 ),
#else
RecvPropIntWithMinusOneFlag( RECVINFO(m_iClip1 )),
RecvPropIntWithMinusOneFlag( RECVINFO(m_iClip2 )),
#endif
END_NETWORK_TABLE()
BEGIN_NETWORK_TABLE(CBaseCombatWeapon, DT_BaseCombatWeapon)
#if !defined( CLIENT_DLL )
SendPropDataTable("LocalWeaponData", 0, &REFERENCE_SEND_TABLE(DT_LocalWeaponData), SendProxy_SendLocalWeaponDataTable ),
SendPropDataTable("LocalActiveWeaponData", 0, &REFERENCE_SEND_TABLE(DT_LocalActiveWeaponData), SendProxy_SendActiveLocalWeaponDataTable ),
// Data that only gets sent to the player as well as observers of the player
SendPropDataTable( "ObserverWeaponData", 0, &REFERENCE_SEND_TABLE(DT_ObserverWeaponData), SendProxy_OnlyToObservers ),
SendPropModelIndex( SENDINFO(m_iViewModelIndex) ),
SendPropModelIndex( SENDINFO(m_iWorldModelIndex) ),
SendPropInt( SENDINFO(m_iState ), 8, SPROP_UNSIGNED ),
252825292530253125322533
#else
RecvPropDataTable("LocalWeaponData", 0, 0, &REFERENCE_RECV_TABLE(DT_LocalWeaponData)),
RecvPropDataTable("LocalActiveWeaponData", 0, 0, &REFERENCE_RECV_TABLE(DT_LocalActiveWeaponData)),
RecvPropInt( RECVINFO(m_iViewModelIndex)),
RecvPropInt( RECVINFO(m_iWorldModelIndex)),
RecvPropInt( RECVINFO(m_iState )),
2595259625972598259926002601
#else
RecvPropDataTable("LocalWeaponData", 0, 0, &REFERENCE_RECV_TABLE(DT_LocalWeaponData)),
RecvPropDataTable("LocalActiveWeaponData", 0, 0, &REFERENCE_RECV_TABLE(DT_LocalActiveWeaponData)),
RecvPropDataTable( "ObserverWeaponData", 0, 0, &REFERENCE_RECV_TABLE(DT_ObserverWeaponData)),
RecvPropInt( RECVINFO(m_iViewModelIndex)),
RecvPropInt( RECVINFO(m_iWorldModelIndex)),
RecvPropInt( RECVINFO(m_iState )),