Browse Source

Merge pull request #369 from FreeSlave/hgrunt_fix

Fix hgrunts dropping weapons again. Fix magical constants in hgrunt code.
fix-cwd-path
nekonomicon 2 years ago committed by GitHub
parent
commit
8d337020b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      dlls/hgrunt.cpp

41
dlls/hgrunt.cpp

@ -278,7 +278,7 @@ void CHGrunt::GibMonster( void )
Vector vecGunPos; Vector vecGunPos;
Vector vecGunAngles; Vector vecGunAngles;
if( GetBodygroup( 2 ) != 2 ) if( GetBodygroup( GUN_GROUP ) != GUN_NONE )
{ {
// throw a gun if the grunt has one // throw a gun if the grunt has one
GetAttachment( 0, vecGunPos, vecGunAngles ); GetAttachment( 0, vecGunPos, vecGunAngles );
@ -604,7 +604,7 @@ void CHGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
if( ptr->iHitgroup == 11 ) if( ptr->iHitgroup == 11 )
{ {
// make sure we're wearing one // make sure we're wearing one
if( GetBodygroup( 1 ) == HEAD_GRUNT && ( bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB ) ) ) if( GetBodygroup( HEAD_GROUP ) == HEAD_GRUNT && ( bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB ) ) )
{ {
// absorb damage // absorb damage
flDamage -= 20; flDamage -= 20;
@ -849,27 +849,30 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
{ {
case HGRUNT_AE_DROP_GUN: case HGRUNT_AE_DROP_GUN:
{ {
Vector vecGunPos; if ( GetBodygroup( GUN_GROUP ) != GUN_NONE )
Vector vecGunAngles; {
Vector vecGunPos;
Vector vecGunAngles;
GetAttachment( 0, vecGunPos, vecGunAngles ); GetAttachment( 0, vecGunPos, vecGunAngles );
// switch to body group with no gun. // switch to body group with no gun.
SetBodygroup( GUN_GROUP, GUN_NONE ); SetBodygroup( GUN_GROUP, GUN_NONE );
// now spawn a gun. // now spawn a gun.
if( FBitSet( pev->weapons, HGRUNT_SHOTGUN ) ) if( FBitSet( pev->weapons, HGRUNT_SHOTGUN ) )
{ {
DropItem( "weapon_shotgun", vecGunPos, vecGunAngles ); DropItem( "weapon_shotgun", vecGunPos, vecGunAngles );
} }
else else
{ {
DropItem( "weapon_9mmAR", vecGunPos, vecGunAngles ); DropItem( "weapon_9mmAR", vecGunPos, vecGunAngles );
} }
if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) ) if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) )
{ {
DropItem( "ammo_ARgrenades", BodyTarget( pev->origin ), vecGunAngles ); DropItem( "ammo_ARgrenades", BodyTarget( pev->origin ), vecGunAngles );
}
} }
} }
break; break;

Loading…
Cancel
Save