Skip to content

Commit

Permalink
Merged in ez2/feature/corrected-zombie-variant-sounds (pull request m…
Browse files Browse the repository at this point in the history
…apbase-source#173)

Corrected zombie variant sounds issues

Approved-by: 1upD
  • Loading branch information
Blixibon authored and 1upD committed Aug 14, 2021
2 parents f081267 + 34330a9 commit 89a772a
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 11 deletions.
94 changes: 90 additions & 4 deletions sp/src/game/server/hl2/npc_fastzombie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ BEGIN_DATADESC( CFastZombie )
END_DATADESC()


#ifndef EZ
const char *CFastZombie::pMoanSounds[] =
{
"NPC_FastZombie.Moan1",
};
#ifndef EZ
//-----------------------------------------------------------------------------
// The model we use for our legs when we get blowed up.
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -441,6 +441,13 @@ const char *CFastZombie::pHeadcrabModelNames[EZ_VARIANT_COUNT] = {
"models/xencrab.mdl",
"models/glowcrab.mdl",
};

const char *CFastZombie::pMoanSounds[EZ_VARIANT_COUNT] =
{
"NPC_FastZombie.Moan1",
"NPC_FastXenbie.Moan1",
"NPC_FastGlowbie.Moan1",
};
#endif

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1054,7 +1061,11 @@ int CFastZombie::MeleeAttack1Conditions( float flDot, float flDist )
//-----------------------------------------------------------------------------
const char *CFastZombie::GetMoanSound( int nSound )
{
#ifdef EZ
return pMoanSounds[ m_tEzVariant ];
#else
return pMoanSounds[ nSound % ARRAYSIZE( pMoanSounds ) ];
#endif
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1245,13 +1256,13 @@ void CFastZombie::DeathSound( const CTakeDamageInfo &info )
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.Idle" );
EmitSound( "NPC_FastGlowbie.Die" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.Idle" );
EmitSound( "NPC_FastXenbie.Die" );
break;
default:
EmitSound( "NPC_FastZombie.Idle" );
EmitSound( "NPC_FastZombie.Die" );
break;
}
#else
Expand Down Expand Up @@ -1443,13 +1454,43 @@ void CFastZombie::HandleAnimEvent( animevent_t *pEvent )

if ( pEvent->event == AE_FASTZOMBIE_GALLOP_LEFT )
{
#ifdef EZ
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.GallopLeft" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.GallopLeft" );
break;
default:
EmitSound( "NPC_FastZombie.GallopLeft" );
break;
}
#else
EmitSound( "NPC_FastZombie.GallopLeft" );
#endif
return;
}

if ( pEvent->event == AE_FASTZOMBIE_GALLOP_RIGHT )
{
#ifdef EZ
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.GallopRight" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.GallopRight" );
break;
default:
EmitSound( "NPC_FastZombie.GallopRight" );
break;
}
#else
EmitSound( "NPC_FastZombie.GallopRight" );
#endif
return;
}

Expand Down Expand Up @@ -1787,12 +1828,42 @@ int CFastZombie::TranslateSchedule( int scheduleType )
if( !m_fHasScreamed )
{
// Only play that over-the-top attack scream once per combat state.
#ifdef EZ
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.Scream" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.Scream" );
break;
default:
EmitSound( "NPC_FastZombie.Scream" );
break;
}
#else
EmitSound( "NPC_FastZombie.Scream" );
#endif
m_fHasScreamed = true;
}
else
{
#ifdef EZ
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.RangeAttack" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.RangeAttack" );
break;
default:
EmitSound( "NPC_FastZombie.RangeAttack" );
break;
}
#else
EmitSound( "NPC_FastZombie.RangeAttack" );
#endif
}

return SCHED_FASTZOMBIE_RANGE_ATTACK1;
Expand Down Expand Up @@ -2033,7 +2104,22 @@ void CFastZombie::OnChangeActivity( Activity NewActivity )
if ( NewActivity == ACT_FASTZOMBIE_FRENZY )
{
// Scream!!!!
#ifdef EZ
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
EmitSound( "NPC_FastGlowbie.Frenzy" );
break;
case EZ_VARIANT_XEN:
EmitSound( "NPC_FastXenbie.Frenzy" );
break;
default:
EmitSound( "NPC_FastZombie.Frenzy" );
break;
}
#else
EmitSound( "NPC_FastZombie.Frenzy" );
#endif
SetPlaybackRate( random->RandomFloat( .9, 1.1 ) );
}

Expand Down
24 changes: 17 additions & 7 deletions sp/src/game/server/hl2/npc_zombie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ void CZombie::Precache( void )
PrecacheScriptSound( "Glowbie.Idle" );
PrecacheScriptSound( "Glowbie.Attack" );
PrecacheScriptSound( "Glowbie.Alarm" );

PrecacheScriptSound( "NPC_BaseGlowbie.Moan1" );
PrecacheScriptSound( "NPC_BaseGlowbie.Moan2" );
PrecacheScriptSound( "NPC_BaseGlowbie.Moan3" );
PrecacheScriptSound( "NPC_BaseGlowbie.Moan4" );
break;
case EZ_VARIANT_XEN:
PrecacheScriptSound( "Xenbie.FootstepRight" );
Expand All @@ -357,6 +362,11 @@ void CZombie::Precache( void )
PrecacheScriptSound( "Xenbie.Idle" );
PrecacheScriptSound( "Xenbie.Attack" );
PrecacheScriptSound( "Xenbie.Alarm" );

PrecacheScriptSound( "NPC_BaseXenbie.Moan1" );
PrecacheScriptSound( "NPC_BaseXenbie.Moan2" );
PrecacheScriptSound( "NPC_BaseXenbie.Moan3" );
PrecacheScriptSound( "NPC_BaseXenbie.Moan4" );
break;
default:
PrecacheScriptSound( "Zombie.FootstepRight" );
Expand All @@ -372,6 +382,11 @@ void CZombie::Precache( void )
PrecacheScriptSound( "Zombie.Idle" );
PrecacheScriptSound( "Zombie.Attack" );
PrecacheScriptSound( "Zombie.Alarm" );

PrecacheScriptSound( "NPC_BaseZombie.Moan1" );
PrecacheScriptSound( "NPC_BaseZombie.Moan2" );
PrecacheScriptSound( "NPC_BaseZombie.Moan3" );
PrecacheScriptSound( "NPC_BaseZombie.Moan4" );
break;
}
if ( GetModelName() == NULL_STRING )
Expand All @@ -389,11 +404,6 @@ void CZombie::Precache( void )

PrecacheModel( STRING( GetModelName() ) );

PrecacheScriptSound( "NPC_BaseZombie.Moan1" );
PrecacheScriptSound( "NPC_BaseZombie.Moan2" );
PrecacheScriptSound( "NPC_BaseZombie.Moan3" );
PrecacheScriptSound( "NPC_BaseZombie.Moan4" );

BaseClass::Precache();
#endif
}
Expand Down Expand Up @@ -707,9 +717,9 @@ const char *CZombie::GetMoanSound( int nSound )
switch (m_tEzVariant)
{
case EZ_VARIANT_RAD:
return pMoanSounds[nSound % ARRAYSIZE( pMoanSoundsRad )];
return pMoanSoundsRad[nSound % ARRAYSIZE( pMoanSoundsRad )];
case EZ_VARIANT_XEN:
return pMoanSounds[nSound % ARRAYSIZE( pMoanSoundsXen )];
return pMoanSoundsXen[nSound % ARRAYSIZE( pMoanSoundsXen )];
default:
return pMoanSounds[nSound % ARRAYSIZE( pMoanSounds )];
}
Expand Down

0 comments on commit 89a772a

Please sign in to comment.