(svn r11656) -Codechange: add ZOOM_LVL_BEGIN and postfix operators so ZoomLevel can be used in some iterations

This commit is contained in:
smatz
2007-12-17 22:04:07 +00:00
parent 61dcdbf0e0
commit bda9d4a236
5 changed files with 23 additions and 18 deletions

View File

@@ -157,7 +157,7 @@ static void StartSound(uint sound, int panning, uint volume)
static const byte _vol_factor_by_zoom[] = {255, 190, 134, 87};
assert_compile(lengthof(_vol_factor_by_zoom) == ZOOM_LVL_END);
assert_compile(lengthof(_vol_factor_by_zoom) == ZOOM_LVL_END - ZOOM_LVL_BEGIN);
static const byte _sound_base_vol[] = {
128, 90, 128, 128, 128, 128, 128, 128,
@@ -216,7 +216,7 @@ static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
StartSound(
sound,
left / max(1, vp->virtual_width / ((PANNING_LEVELS << 1) + 1)) - PANNING_LEVELS,
(GetSound(sound)->volume * msf.effect_vol * _vol_factor_by_zoom[vp->zoom]) >> 15
(GetSound(sound)->volume * msf.effect_vol * _vol_factor_by_zoom[vp->zoom - ZOOM_LVL_BEGIN]) >> 15
);
return;
}