Skip to content

Commit

Permalink
Blood: Correct hearing velocity when transitioning through ror
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored and Hendricks266 committed Dec 18, 2024
1 parent c022985 commit 14f1f56
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/blood/src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4615,7 +4615,11 @@ void MoveDude(spritetype *pSprite)
if (VanillaMode())
playerResetInertia(pPlayer);
else
{
playerCorrectInertia(pPlayer, &oldpos);
if (pPlayer == gMe) // if player is listener, update ear position so audio pitch of surrounding sfx does not freak out when transitioning between ror sectors
sfxCorrectListenerPos();
}
}
switch (nLink) {
case kMarkerLowStack:
Expand Down
11 changes: 11 additions & 0 deletions source/blood/src/sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,17 @@ inline void sfxUpdateListenerVel(void)
earVR = {earR.x - earR0.x, earR.y - earR0.y};
}

void sfxCorrectListenerPos(void)
{
sfxUpdateListenerPos();
earL0 = earL;
earR0 = earR;
earL0.x += -earVL.dx;
earL0.y += -earVL.dy;
earR0.x += -earVR.dx;
earR0.y += -earVR.dy;
}

void sfxResetListener(void)
{
sfxUpdateListenerPos(); // update ear position
Expand Down
1 change: 1 addition & 0 deletions source/blood/src/sfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int chanId = -1, int nFl
void sfxKill3DSound(spritetype *pSprite, int chanId = -1, int soundId = -1);
void sfxKillAllSounds(void);
void sfxKillSpriteSounds(spritetype *pSprite);
void sfxCorrectListenerPos(void);
void sfxResetListener(void);
void sfxUpdate3DSounds(void);
void sfxSetReverb(bool toggle);
Expand Down

0 comments on commit 14f1f56

Please sign in to comment.