diff options
author | Robert Špalek | 2009-10-11 23:01:59 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-11 23:01:59 +0000 |
commit | f71b32dd96cc524fbb433752ea2ead51e1cf02a4 (patch) | |
tree | 51ad784a13c13329955c7859aef83862b790983b /engines/draci/game.cpp | |
parent | e2db155b1a82150a4c651a643b6a4343e810b8e9 (diff) | |
download | scummvm-rg350-f71b32dd96cc524fbb433752ea2ead51e1cf02a4.tar.gz scummvm-rg350-f71b32dd96cc524fbb433752ea2ead51e1cf02a4.tar.bz2 scummvm-rg350-f71b32dd96cc524fbb433752ea2ead51e1cf02a4.zip |
Loading and caching sound samples in memory.
The sounds are not played yet, but the infrastructure is getting ready.
svn-id: r44957
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r-- | engines/draci/game.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 1b51bd9142..34549df416 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -177,25 +177,25 @@ void Game::init() { // Initialize animation for object / room titles Animation *titleAnim = _vm->_anims->addText(kTitleText, true); Text *title = new Text("", _vm->_smallFont, kTitleColour, 0, 0); - titleAnim->addFrame(title); + titleAnim->addFrame(title, NULL); // Initialize animation for speech text Animation *speechAnim = _vm->_anims->addText(kSpeechText, true); Text *speech = new Text("", _vm->_bigFont, kFontColour1, 0, 0); - speechAnim->addFrame(speech); + speechAnim->addFrame(speech, NULL); // Initialize inventory animation const BAFile *f = _vm->_iconsArchive->getFile(13); Animation *inventoryAnim = _vm->_anims->addAnimation(kInventorySprite, 255, false); Sprite *inventorySprite = new Sprite(f->_data, f->_length, 0, 0, true); - inventoryAnim->addFrame(inventorySprite); + inventoryAnim->addFrame(inventorySprite, NULL); inventoryAnim->setRelative((kScreenWidth - inventorySprite->getWidth()) / 2, (kScreenHeight - inventorySprite->getHeight()) / 2); for (uint i = 0; i < kDialogueLines; ++i) { _dialogueAnims[i] = _vm->_anims->addText(kDialogueLinesID - i, true); Text *dialogueLine = new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0); - _dialogueAnims[i]->addFrame(dialogueLine); + _dialogueAnims[i]->addFrame(dialogueLine, NULL); _dialogueAnims[i]->setZ(254); _dialogueAnims[i]->setRelative(1, @@ -644,7 +644,7 @@ void Game::putItem(int itemID, int position) { anim = _vm->_anims->addItem(anim_id); const BAFile *img = _vm->_itemImagesArchive->getFile(2 * itemID); Sprite *sp = new Sprite(img->_data, img->_length, 0, 0, true); - anim->addFrame(sp); + anim->addFrame(sp, NULL); } Drawable *frame = anim->getFrame(); @@ -1117,7 +1117,7 @@ void Game::loadRoom(int roomNum) { delete[] wlk; Animation *map = _vm->_anims->addAnimation(kWalkingMapOverlay, 255, false); - map->addFrame(ov); + map->addFrame(ov, NULL); } int Game::loadAnimation(uint animNum, uint z) { @@ -1145,8 +1145,8 @@ int Game::loadAnimation(uint animNum, uint z) { uint scaledWidth = animationReader.readUint16LE(); uint scaledHeight = animationReader.readUint16LE(); byte mirror = animationReader.readByte(); - /* uint sample = */ animationReader.readUint16LE(); - /* uint freq = */ animationReader.readUint16LE(); + uint sample = animationReader.readUint16LE(); + uint freq = animationReader.readUint16LE(); uint delay = animationReader.readUint16LE(); const BAFile *spriteFile = _vm->_spritesArchive->getFile(spriteNum); @@ -1171,7 +1171,9 @@ int Game::loadAnimation(uint animNum, uint z) { sp->setDelay(delay * 10); - anim->addFrame(sp); + const SoundSample *sam = _vm->_soundsArchive->getSample(sample, freq); + + anim->addFrame(sp, sam); } return animNum; @@ -1282,6 +1284,8 @@ void Game::enterNewRoom(bool force_reload) { _vm->_paletteArchive->clearCache(); _vm->_animationsArchive->clearCache(); _vm->_walkingMapsArchive->clearCache(); + _vm->_soundsArchive->clearCache(); + _vm->_dubbingArchive->clearCache(); _vm->_screen->clearScreen(); |