forked from Mirrors/openclonk
Fix iLevel parameter of SoundAt (#1681)
parent
1ca46c80ad
commit
d94dcc8267
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue