FF Diff Viewer

Comparing 2006 Base SDK to Fortress Forever 2.46

game_shared/basegrenade_shared.cpp

910111213141516171819
#include "basegrenade_shared.h" #include "shake.h" #include "engine/IEngineSound.h" #if !defined( CLIENT_DLL ) #include "soundent.h" #include "entitylist.h" #endif
910111213141516171819202122
#include "basegrenade_shared.h" #include "shake.h" #include "engine/IEngineSound.h" #include "ff_gamerules.h" #include "ff_grenade_base.h" #if !defined( CLIENT_DLL ) #include "soundent.h" #include "entitylist.h" #include "ff_entity_system.h" #endif
252627282930
extern short g_sModelIndexSmoke; // (in combatweapon.cpp) holds the index for the smoke cloud extern ConVar sk_plr_dmg_grenade; #if !defined( CLIENT_DLL ) // Global Savedata for friction modifier
28293031323334353637383940414243
extern short g_sModelIndexSmoke; // (in combatweapon.cpp) holds the index for the smoke cloud extern ConVar sk_plr_dmg_grenade; // --> Mirv: Gren optimisation class CRecvProxyData; extern void RecvProxy_LocalVelocityX(const CRecvProxyData *pData, void *pStruct, void *pOut); extern void RecvProxy_LocalVelocityY(const CRecvProxyData *pData, void *pStruct, void *pOut); extern void RecvProxy_LocalVelocityZ(const CRecvProxyData *pData, void *pStruct, void *pOut); // <-- // Forward declare class CFFGrenadeBase; #if !defined( CLIENT_DLL ) // Global Savedata for friction modifier
67686970717273
// SendPropTime( SENDINFO( m_flDetonateTime ) ), SendPropEHandle( SENDINFO( m_hThrower ) ), SendPropVector( SENDINFO( m_vecVelocity ), 0, SPROP_NOSCALE ), // HACK: Use same flag bits as player for now SendPropInt ( SENDINFO(m_fFlags), PLAYER_FLAG_BITS, SPROP_UNSIGNED, SendProxy_CropFlagsToPlayerFlagBitsLength ), #else
8081828384858687888990919293949596979899
// SendPropTime( SENDINFO( m_flDetonateTime ) ), SendPropEHandle( SENDINFO( m_hThrower ) ), // --> Mirv: Gren optimisation //SendPropVector( SENDINFO( m_vecVelocity ), 0, SPROP_NOSCALE ), SendPropExclude("DT_BaseEntity", "m_angRotation"), SendPropFloat ( SENDINFO_VECTORELEM(m_vecVelocity, 0), 13, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, -1024.0f, 1024.0f ), SendPropFloat ( SENDINFO_VECTORELEM(m_vecVelocity, 1), 13, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, -1024.0f, 1024.0f ), SendPropFloat ( SENDINFO_VECTORELEM(m_vecVelocity, 2), 14, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, -3072.0f, 1024.0f ), SendPropFloat ( SENDINFO_VECTORELEM(m_angRotation, 0), 9, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, 0.0f, 360.0f, SendProxy_AngleToFloat ), SendPropFloat ( SENDINFO_VECTORELEM(m_angRotation, 1), 9, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, 0.0f, 360.0f, SendProxy_AngleToFloat ), SendPropFloat ( SENDINFO_VECTORELEM(m_angRotation, 2), 9, SPROP_CHANGES_OFTEN|SPROP_ROUNDDOWN, 0.0f, 360.0f, SendProxy_AngleToFloat ), // <-- Mirv // HACK: Use same flag bits as player for now SendPropInt ( SENDINFO(m_fFlags), PLAYER_FLAG_BITS, SPROP_UNSIGNED, SendProxy_CropFlagsToPlayerFlagBitsLength ), #else
7879808182838485
RecvPropEHandle( RECVINFO( m_hThrower ) ), // Need velocity from grenades to make animation system work correctly when running RecvPropVector( RECVINFO(m_vecVelocity), 0, RecvProxy_LocalVelocity ), RecvPropInt( RECVINFO( m_fFlags ) ), #endif END_NETWORK_TABLE()
104105106107108109110111112113114115116117118119120
RecvPropEHandle( RECVINFO( m_hThrower ) ), // Need velocity from grenades to make animation system work correctly when running // --> Mirv: Gren optimisation //RecvPropVector( RECVINFO(m_vecVelocity), 0, RecvProxy_LocalVelocity ), RecvPropFloat ( RECVINFO(m_vecVelocity[0]), 0, RecvProxy_LocalVelocityX ), RecvPropFloat ( RECVINFO(m_vecVelocity[1]), 0, RecvProxy_LocalVelocityY ), RecvPropFloat ( RECVINFO(m_vecVelocity[2]), 0, RecvProxy_LocalVelocityZ ), RecvPropFloat ( RECVINFO_NAME(m_angNetworkAngles[0], m_angRotation[0]), 0 ), RecvPropFloat ( RECVINFO_NAME(m_angNetworkAngles[1], m_angRotation[1]), 0 ), RecvPropFloat ( RECVINFO_NAME(m_angNetworkAngles[2], m_angRotation[2]), 0 ), // <-- Mirv RecvPropInt( RECVINFO( m_fFlags ) ), #endif END_NETWORK_TABLE()
122123124125126127128
// Pull out of the wall a bit if ( pTrace->fraction != 1.0 ) { SetAbsOrigin( pTrace->endpos + (pTrace->plane.normal * 0.6) ); } Vector vecAbsOrigin = GetAbsOrigin();
157158159160161162163
// Pull out of the wall a bit if ( pTrace->fraction != 1.0 ) { SetLocalOrigin( pTrace->endpos + (pTrace->plane.normal * 32.0f) ); // |-- Mirv: 32 units used in TFC } Vector vecAbsOrigin = GetAbsOrigin();
143144145146147148149150151152153
te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, m_DmgRadius * .03, 25, TE_EXPLFLAG_NONE, m_DmgRadius, m_flDamage, &vecNormal, (char) pdata->game.material ); }
178179180181182183184185186187188
te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, /*m_DmgRadius * .03*/ m_flDamage / 128.0f, // scale 25, //framerate TE_EXPLFLAG_NONE, m_DmgRadius, //radius m_flDamage, //magnitude &vecNormal, (char) pdata->game.material ); }
157158159160161162163
te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, m_DmgRadius * .03, 25, TE_EXPLFLAG_NONE, m_DmgRadius,
192193194195196197198
te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, /*m_DmgRadius * .03*/ m_flDamage / 128.0f, 25, TE_EXPLFLAG_NONE, m_DmgRadius,
168169170171172173174175176177
CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 ); #endif // Use the thrower's position as the reported position Vector vecReported = m_hThrower ? m_hThrower->GetAbsOrigin() : vec3_origin; CTakeDamageInfo info( this, m_hThrower, GetBlastForce(), GetAbsOrigin(), m_flDamage, bitsDamageType, 0, &vecReported ); RadiusDamage( info, GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
203204205206207208209210211212213214
CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 ); #endif // We need to report where the explosion took place Vector vecReported = pTrace->endpos; //m_hThrower ? m_hThrower->GetAbsOrigin() : vec3_origin; // --> Mirv: #0000675: Killing people with certain weapons says the person killed themself CTakeDamageInfo info( this, /*m_hThrower*/ GetOwnerEntity(), GetBlastForce(), GetAbsOrigin(), m_flDamage, bitsDamageType, 0, &vecReported ); // <-- Mirv RadiusDamage( info, GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
213214215216217218219
void CBaseGrenade::Event_Killed( const CTakeDamageInfo &info ) { Detonate( ); } #if !defined( CLIENT_DLL )
250251252253254255256
void CBaseGrenade::Event_Killed( const CTakeDamageInfo &info ) { Detonate(); } #if !defined( CLIENT_DLL )
260261262263264265
void CBaseGrenade::Detonate( void ) { trace_t tr; Vector vecSpot;// trace starts here!
297298299300301302303304305306307308309310311
void CBaseGrenade::Detonate( void ) { #ifdef GAME_DLL // Verify our owner is still here! if( !GetOwnerEntity() ) { Remove(); return; } #endif trace_t tr; Vector vecSpot;// trace starts here!
270271272273274275276277278279
Explode( &tr, DMG_BLAST ); if ( GetShakeAmplitude() ) { UTIL_ScreenShake( GetAbsOrigin(), GetShakeAmplitude(), 150.0, 1.0, GetShakeRadius(), SHAKE_START ); } }
316317318319320321322323324325326327328
Explode( &tr, DMG_BLAST ); // No shake if in a no gren area #ifdef GAME_DLL if ( GetShakeAmplitude() && FFScriptRunPredicates( this, "onexplode", true ) ) { UTIL_ScreenShake( GetAbsOrigin(), GetShakeAmplitude(), 150.0, 1.0, GetShakeRadius(), SHAKE_START ); } #endif }
282283284285286287
// void CBaseGrenade::ExplodeTouch( CBaseEntity *pOther ) { trace_t tr; Vector vecSpot;// trace starts here!
331332333334335336337338339340341342343
// void CBaseGrenade::ExplodeTouch( CBaseEntity *pOther ) { // Verify our owner is still here! if( !GetOwnerEntity() ) { Remove(); return; } trace_t tr; Vector vecSpot;// trace starts here!
289290291292293294295296297298
if ( !pOther->IsSolid() ) return; Vector velDir = GetAbsVelocity(); VectorNormalize( velDir ); vecSpot = GetAbsOrigin() - velDir * 32; UTIL_TraceLine( vecSpot, vecSpot + velDir * 64, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr ); Explode( &tr, DMG_BLAST ); }
345346347348349350351352353354355356357358359360361
if ( !pOther->IsSolid() ) return; // --> Mirv: Check collision rules first if (!g_pGameRules->ShouldCollide(GetCollisionGroup(), pOther->GetCollisionGroup())) return; // <-- Mirv: Check collision rules first Vector velDir = GetAbsVelocity(); VectorNormalize( velDir ); vecSpot = GetAbsOrigin() - velDir * 32; // direct rocket hits were essentially inverting movement effects because the trace was going straight through players //UTIL_TraceLine( vecSpot, vecSpot + velDir * 64, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr ); UTIL_TraceLine( vecSpot, vecSpot + velDir * 64, MASK_SHOT_HULL, this, COLLISION_GROUP_NONE, &tr ); Explode( &tr, DMG_BLAST ); }
302303304305306307308
{ if (!IsInWorld()) { Remove( ); return; }
365366367368369370371
{ if (!IsInWorld()) { Remove(); return; }
321322323324325326
void CBaseGrenade::BounceTouch( CBaseEntity *pOther ) { if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER | FSOLID_VOLUME_CONTENTS) ) return;
384385386387388389390391392393394395396
void CBaseGrenade::BounceTouch( CBaseEntity *pOther ) { // Verify our owner is still here! if( !GetOwnerEntity() ) { Remove(); return; } if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER | FSOLID_VOLUME_CONTENTS) ) return;
393394395396397398
void CBaseGrenade::SlideTouch( CBaseEntity *pOther ) { // don't hit the guy that launched this grenade if ( pOther == GetThrower() ) return;
463464465466467468469470471472473474475
void CBaseGrenade::SlideTouch( CBaseEntity *pOther ) { // Verify our owner is still here! if( !GetOwnerEntity() ) { Remove(); return; } // don't hit the guy that launched this grenade if ( pOther == GetThrower() ) return;
422423424425426427
void CBaseGrenade ::TumbleThink( void ) { if (!IsInWorld()) { Remove( );
499500501502503504505506507508509510511
void CBaseGrenade ::TumbleThink( void ) { // Verify our owner is still here! if( !GetOwnerEntity() ) { Remove(); return; } if (!IsInWorld()) { Remove( );
505506507508509510511512513514515516517518519520521
SetSimulatedEveryTick( true ); };
589590591
SetSimulatedEveryTick( true ); };