diff options
| -rw-r--r-- | engines/made/scriptfuncs.cpp | 10 | ||||
| -rw-r--r-- | engines/made/sound.cpp | 5 | ||||
| -rw-r--r-- | engines/made/sound.h | 2 | 
3 files changed, 11 insertions, 6 deletions
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index 72ce3e238c..e102a15487 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -34,6 +34,7 @@  #include "made/database.h"  #include "made/screen.h"  #include "made/script.h" +#include "made/sound.h"  #include "made/pmvplayer.h"  #include "made/scriptfuncs.h"  #include "made/music.h" @@ -596,12 +597,9 @@ int16 ScriptFunctions::sfClearMono(int16 argc, int16 *argv) {  }  int16 ScriptFunctions::sfGetSoundEnergy(int16 argc, int16 *argv) { -	// This is called while in-game voices are played -	// Not sure what it's used for -	// -> It's used to animate mouths when NPCs are talking -	// FIXME: This is a workaround for the "sound energy" problem -	// At least the characters move their lips when talking now -	return _vm->_rnd->getRandomNumber(5); +	// This is called while in-game voices are played to animate  +	// mouths when NPCs are talking +	return soundEnergy;  }  int16 ScriptFunctions::sfClearText(int16 argc, int16 *argv) { diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index 98426ea20b..a88274f205 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -30,6 +30,8 @@  namespace Made { +int soundEnergy = 0; +  void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCount) {  	int16 prevSample = 0, workSample = 0; @@ -67,6 +69,7 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou  		case 0:  			memset(soundBuffer, 0x80, workChunkSize);  			workSample = 0; +			soundEnergy = 0;  			break;  		case 1: @@ -93,12 +96,14 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou  				}  			} +			soundEnergy = type - 1;  			break;  		case 5:  			for (i = 0; i < workChunkSize; i++)  				soundBuffer[i] = *source++;  			workSample = soundBuffer[workChunkSize - 1] - 128; +			soundEnergy = 4;  			break;  		default: diff --git a/engines/made/sound.h b/engines/made/sound.h index 288dc38609..bca4987d20 100644 --- a/engines/made/sound.h +++ b/engines/made/sound.h @@ -32,6 +32,8 @@  namespace Made { +extern int soundEnergy; +  void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCount);  } // End of namespace Made  | 
