S_StartSoundAtVolume, K_PlayPainSound, K_PlayHitEmSound: Use user skin for sounds instead of mobj skin

So we'll always hear the clips we pick for Heavy Magician
This commit is contained in:
toaster 2023-01-21 12:58:06 +00:00
parent 3c79e32516
commit 0606fb50ba
2 changed files with 7 additions and 5 deletions

View file

@ -2515,8 +2515,8 @@ void K_PlayOvertakeSound(mobj_t *source)
void K_PlayPainSound(mobj_t *source, mobj_t *other)
{
sfxenum_t pick = P_RandomKey(PR_VOICES, 2); // Gotta roll the RNG every time this is called for sync reasons
sfxenum_t sfx_id = ((skin_t *)source->skin)->soundsid[S_sfx[sfx_khurt1 + pick].skinsound];
skin_t *skin = (source->player ? &skins[source->player->skin] : ((skin_t *)source->skin));
sfxenum_t sfx_id = skin->soundsid[S_sfx[sfx_khurt1 + pick].skinsound];
boolean alwaysHear = false;
if (other != NULL && P_MobjWasRemoved(other) == false && other->player != NULL)
@ -2534,7 +2534,8 @@ void K_PlayPainSound(mobj_t *source, mobj_t *other)
void K_PlayHitEmSound(mobj_t *source, mobj_t *other)
{
sfxenum_t sfx_id = ((skin_t *)source->skin)->soundsid[S_sfx[sfx_khitem].skinsound];
skin_t *skin = (source->player ? &skins[source->player->skin] : ((skin_t *)source->skin));
sfxenum_t sfx_id = skin->soundsid[S_sfx[sfx_khitem].skinsound];
boolean alwaysHear = false;
if (other != NULL && P_MobjWasRemoved(other) == false && other->player != NULL)

View file

@ -600,10 +600,11 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
sfx = &S_sfx[sfx_id];
if (sfx->skinsound != -1 && origin && origin->skin)
if (sfx->skinsound != -1 && origin && (origin->player || origin->skin))
{
// redirect player sound to the sound in the skin table
sfx_id = ((skin_t *)origin->skin)->soundsid[sfx->skinsound];
skin_t *skin = (origin->player ? &skins[origin->player->skin] : ((skin_t *)origin->skin));
sfx_id = skin->soundsid[sfx->skinsound];
sfx = &S_sfx[sfx_id];
}