Bullet penetration for wood

This commit is contained in:
Marco Cawthorne 2017-01-07 18:01:44 +01:00
parent 5347482d9c
commit 735e6d5153
4 changed files with 7 additions and 8 deletions

View File

@ -142,7 +142,7 @@ void BaseMelee_Attack( void );
float Player_GetMaxSpeed( float fWeapon );
void Effect_Impact( int iType, vector vPos, vector vNormal );
void TraceAttack_FireBullets( int iShots );
void TraceAttack_FireBullets( int iShots, vector vPos );
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius );
void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos );

View File

@ -18,17 +18,15 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void TraceAttack_FireBullets( int iShots ) {
vector vSrc, vDir;
void TraceAttack_FireBullets( int iShots, vector vPos ) {
vector vDir;
makevectors(self.v_angle);
vSrc = self.origin + self.view_ofs;
while ( iShots > 0) {
vDir = aim( self, 100000 ) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up;
traceline( vSrc, vSrc + ( vDir * 2048 ), MOVE_HITMODEL, self);
traceline( vPos, vPos + ( vDir * 2048 ), MOVE_HITMODEL, self);
if (trace_fraction != 1.0) {
if ( trace_ent.takedamage == DAMAGE_YES ) {
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos );
@ -49,6 +47,7 @@ void TraceAttack_FireBullets( int iShots ) {
case 'D':
case 'W':
Effect_Impact( IMPACT_WOOD, trace_endpos, trace_plane_normal );
TraceAttack_FireBullets( iShots, trace_endpos + ( v_forward * 2 ) );
break;
case 'Y':
Effect_Impact( IMPACT_GLASS, trace_endpos, trace_plane_normal );

View File

@ -103,7 +103,7 @@ float OpenCSGunBase_PrimaryFire( void ) {
}
OpenCSGunBase_AccuracyCalc();
TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets );
TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets, ( self.origin + self.view_ofs ) );
self.(wptTable[ self.weapon ].iMagfld) -= 1;
self.fAttackFinished = time + wptTable[ self.weapon ].fAttackFinished;

View File

@ -93,7 +93,7 @@ void WeaponGLOCK18_PrimaryFire( void ) {
return FALSE;
}
OpenCSGunBase_AccuracyCalc();
TraceAttack_FireBullets( 3 );
TraceAttack_FireBullets( 3, ( self.origin + self.view_ofs ) );
self.iMag_GLOCK18 -= 3;
self.fAttackFinished = time + 0.5;