SCUMM: Change the HE lipsync timer math to a cleaner and safer version

This commit is contained in:
Filippos Karapetis 2022-05-23 23:21:42 +03:00
parent 1ae637fb57
commit 8d9dc02374

View File

@ -658,7 +658,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags,
// can do without it, using a LoopingAudioStream.
if (_heChannel[heChannel].timer)
_heChannel[heChannel].timer = size / nChan * samplesPerBlock / blockAlign * 1000 / rate;
_heChannel[heChannel].timer = (int)(((int64)size * samplesPerBlock * 1000) / ((int64)rate * blockAlign * nChan));
byte *sound = (byte *)malloc(size * 4);
/* On systems where it matters, malloc will return