Fix iLevel parameter of SoundAt (#1681)

install-platforms
Julius Michaelis 2017-12-05 16:56:46 +01:00
parent 1ca46c80ad
commit d94dcc8267
3 changed files with 4 additions and 4 deletions

View File

@ -387,10 +387,10 @@ void C4SoundInstance::Execute()
}
}
void C4SoundInstance::SetVolumeByPos(int32_t x, int32_t y)
void C4SoundInstance::SetVolumeByPos(int32_t x, int32_t y, int32_t relative_vol)
{
int32_t vol_player = NO_OWNER;
iVolume = ::Viewports.GetAudibility(x, y, &iPan, 0, &vol_player);
iVolume = ::Viewports.GetAudibility(x, y, &iPan, 0, &vol_player) * relative_vol / 100.0f;
if (vol_player != player) SetPlayer(vol_player);
}

View File

@ -92,7 +92,7 @@ public:
void SetVolume(int32_t inVolume) { iVolume = inVolume; }
void SetPan(int32_t inPan) { iPan = inPan; }
void SetPitch(int32_t inPitch);
void SetVolumeByPos(int32_t x, int32_t y);
void SetVolumeByPos(int32_t x, int32_t y, int32_t relative_volume = 100);
void SetObj(C4Object *pnObj) { pObj = pnObj; }
void ClearPointers(C4Object *pObj);
bool Inside(int32_t iX, int32_t iY, int32_t iRad);

View File

@ -275,7 +275,7 @@ C4SoundInstance *StartSoundEffectAt(const char *szSndName, int32_t iX, int32_t i
// Create
C4SoundInstance *pInst = StartSoundEffect(szSndName, false, iVolume, nullptr, iCustomFallofDistance, iPitch, modifier);
// Set volume by position
if (pInst) pInst->SetVolumeByPos(iX, iY);
if (pInst) pInst->SetVolumeByPos(iX, iY, iVolume);
// Return
return pInst;
}