From 5914b5779fdcbce33ea1b9c9d8ccaf91f0c30e24 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 7 Nov 2023 21:44:05 +0300 Subject: [PATCH 1/3] Allow ally human grunts have no weapons. Fix #401 (#403) --- dlls/gearbox/fgrunt.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index c7aa5a3c..841e11b5 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -1361,7 +1361,7 @@ int CHFGrunt :: ISoundMask ( void) //========================================================= void CHFGrunt :: CheckAmmo ( void ) { - if ( m_cAmmoLoaded <= 0 ) + if ( pev->weapons != 0 && m_cAmmoLoaded <= 0 ) { SetConditions(bits_COND_NO_AMMO_LOADED); } @@ -1530,7 +1530,7 @@ BOOL CHFGrunt :: CheckMeleeAttack1 ( float flDot, float flDist ) //========================================================= BOOL CHFGrunt :: CheckRangeAttack1 ( float flDot, float flDist ) { - if ( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 2048 && flDot >= 0.5 && NoFriendlyFire() && ( GetBodygroup( 3 ) != 3 ) ) + if ( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 2048 && flDot >= 0.5 && NoFriendlyFire() && GetBodygroup( FG_GUN_GROUP ) != FG_GUN_NONE ) { TraceResult tr; @@ -1991,33 +1991,38 @@ void CHFGrunt :: Spawn() { m_iHead = RANDOM_LONG(FG_HEAD_SAW, FG_HEAD_SAW_BLACK); } + else if (pev->weapons == 0) + { + m_iHead = FG_HEAD_MP; + } else m_iHead = FG_HEAD_MASK; } else if ( m_iHead >= FG_HEAD_COUNT ) m_iHead = FG_HEAD_MASK; - if ( pev->weapons <= 0 ) + if (FBitSet( pev->weapons, FGRUNT_9MMAR )) { - pev->weapons = FGRUNT_9MMAR; + SetBodygroup( FG_GUN_GROUP, FG_GUN_MP5 ); + m_cClipSize = FGRUNT_CLIP_SIZE; } - if (FBitSet( pev->weapons, FGRUNT_SHOTGUN )) + else if (FBitSet( pev->weapons, FGRUNT_SHOTGUN )) { SetBodygroup( FG_GUN_GROUP, FG_GUN_SHOTGUN ); SetBodygroup( FG_TORSO_GROUP, FG_TORSO_SHOTGUN ); m_cClipSize = 8; } - if (FBitSet( pev->weapons, FGRUNT_9MMAR )) - { - SetBodygroup( FG_GUN_GROUP, FG_GUN_MP5 ); - m_cClipSize = FGRUNT_CLIP_SIZE; - } - if (FBitSet( pev->weapons, FGRUNT_M249 )) + else if (FBitSet( pev->weapons, FGRUNT_M249 )) { SetBodygroup( FG_GUN_GROUP, FG_GUN_SAW ); SetBodygroup( FG_TORSO_GROUP, FG_TORSO_M249 ); m_cClipSize = FGRUNT_CLIP_SIZE; } + else + { + SetBodygroup( FG_GUN_GROUP, FG_GUN_NONE ); + m_cClipSize = 0; + } SetBodygroup( FG_HEAD_GROUP, m_iHead ); @@ -2372,7 +2377,7 @@ Schedule_t* CHFGrunt :: GetScheduleOfType ( int Type ) break; case SCHED_HGRUNT_ALLY_ELOF_FAIL: { - return GetScheduleOfType( SCHED_RANGE_ATTACK1 ); + return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ENEMY ); } break; case SCHED_HGRUNT_ALLY_ESTABLISH_LINE_OF_FIRE: From b22244139ceb5d20dc60fcce6ed730df908d034b Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 7 Nov 2023 21:44:19 +0300 Subject: [PATCH 2/3] Opfor grunts shouldn't ignore glass when checking for range attack. Fix #402 (#404) --- dlls/gearbox/fgrunt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index 841e11b5..21f1e889 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -1543,7 +1543,7 @@ BOOL CHFGrunt :: CheckRangeAttack1 ( float flDot, float flDist ) Vector vecSrc = GetGunPosition(); // verify that a bullet fired from the gun will hit the enemy before the world. - UTIL_TraceLine( vecSrc, m_hEnemy->BodyTarget(vecSrc), ignore_monsters, ignore_glass, ENT(pev), &tr); + UTIL_TraceLine( vecSrc, m_hEnemy->BodyTarget(vecSrc), ignore_monsters, ENT(pev), &tr); if ( tr.flFraction == 1.0 ) { From c417b06dbcca387b6b97498f49b54e6a6cf963bf Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Wed, 15 Nov 2023 15:37:30 +0300 Subject: [PATCH 3/3] Fix osprey save-restore. Fix #407 (#408) --- dlls/osprey.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/osprey.h b/dlls/osprey.h index 6ef7b8e0..5114d3b7 100644 --- a/dlls/osprey.h +++ b/dlls/osprey.h @@ -38,7 +38,7 @@ public: void EXPORT DeployThink(void); void Flight(void); void EXPORT HitTouch(CBaseEntity *pOther); - virtual void EXPORT FindAllThink(void); + void EXPORT FindAllThink(void); void EXPORT HoverThink(void); virtual CBaseMonster *MakeGrunt(Vector vecSrc); void EXPORT CrashTouch(CBaseEntity *pOther); @@ -86,4 +86,4 @@ public: int m_iDoRightSmokePuff; }; -#endif // OSPREY_H \ No newline at end of file +#endif // OSPREY_H