diff options
Diffstat (limited to 'engines/neverhood/diskplayerscene.cpp')
-rw-r--r-- | engines/neverhood/diskplayerscene.cpp | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/engines/neverhood/diskplayerscene.cpp b/engines/neverhood/diskplayerscene.cpp index d972943759..ef2b856b2f 100644 --- a/engines/neverhood/diskplayerscene.cpp +++ b/engines/neverhood/diskplayerscene.cpp @@ -61,7 +61,7 @@ static const uint32 kDiskplayerSmackerFileHashes[] = { 0x04002810 }; -static const uint32 kDiskplayerSlotFileHashes1[] = { +static const uint32 kDiskplayerSlotFileHashes1[] = { 0x81312280, 0x01312281, 0x01312282, @@ -84,7 +84,7 @@ static const uint32 kDiskplayerSlotFileHashes1[] = { 0x04312281 }; -static const uint32 kDiskplayerSlotFileHashes2[] = { +static const uint32 kDiskplayerSlotFileHashes2[] = { 0x90443A00, 0x90443A18, 0x90443A28, @@ -107,8 +107,8 @@ static const uint32 kDiskplayerSlotFileHashes2[] = { 0xC0443A18 }; -static const uint32 kDiskplayerSlotFileHashes3[] = { - 0x10357320, +static const uint32 kDiskplayerSlotFileHashes3[] = { + 0x10357320, 0x10557320, 0x10957320, 0x11157320, @@ -130,7 +130,7 @@ static const uint32 kDiskplayerSlotFileHashes3[] = { 0x10543320 }; -static const uint32 kDiskplayerSlotFileHashes4[] = { +static const uint32 kDiskplayerSlotFileHashes4[] = { 0xDC8020E4, 0xDC802164, 0xDC802264, @@ -155,7 +155,7 @@ static const uint32 kDiskplayerSlotFileHashes4[] = { AsDiskplayerSceneKey::AsDiskplayerSceneKey(NeverhoodEngine *vm) : AnimatedSprite(vm, 1100) { - + createSurface1(0x100B90B4, 1200); _x = 211; _y = 195; @@ -193,7 +193,7 @@ void AsDiskplayerSceneKey::stDropKeyDone() { DiskplayerPlayButton::DiskplayerPlayButton(NeverhoodEngine *vm, DiskplayerScene *diskplayerScene) : StaticSprite(vm, 1400), _diskplayerScene(diskplayerScene), _isPlaying(false) { - + loadSprite(0x24A4A664, kSLFDefDrawOffset | kSLFDefPosition | kSLFDefCollisionBoundsOffset, 400); setVisible(false); loadSound(0, 0x44043000); @@ -317,10 +317,10 @@ void DiskplayerSlot::stop() { DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int paletteIndex) : Scene(vm, parentModule), _diskIndex(0), _appearCountdown(0), _tuneInCountdown(0), - _hasAllDisks(false), _dropKey(false), _inputDisabled(true), _updateStatus(kUSStopped) { + _hasAllDisks(false), _dropKey(false), _inputDisabled(true), _updateStatus(kUSStopped) { int availableDisksCount = 0; - + setBackground(0x8A000044); setPalette(kDiskplayerPaletteFileHashes[paletteIndex]); @@ -344,7 +344,7 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int } _hasAllDisks = availableDisksCount == 20; - + if (_hasAllDisks && !getGlobalVar(V_HAS_FINAL_KEY)) _dropKey = true; @@ -354,16 +354,14 @@ DiskplayerScene::DiskplayerScene(NeverhoodEngine *vm, Module *parentModule, int insertPuzzleMouse(0x000408A8, 20, 620); showMouse(false); - _diskSmackerPlayer = new SmackerPlayer(_vm, this, 0x08288103, false, true); - addEntity(_diskSmackerPlayer); - addSurface(_diskSmackerPlayer->getSurface()); + _diskSmackerPlayer = addSmackerPlayer(new SmackerPlayer(_vm, this, 0x08288103, false, true)); _diskSmackerPlayer->setDrawPos(154, 86); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); - SetMessageHandler(&DiskplayerScene::handleMessage); - SetUpdateHandler(&DiskplayerScene::update); + SetMessageHandler(&DiskplayerScene::handleMessage); + SetUpdateHandler(&DiskplayerScene::update); _appearCountdown = 6; } @@ -419,7 +417,7 @@ void DiskplayerScene::update() { } _diskIndex++; while (!_diskAvailable[_diskIndex] && _diskIndex < 19) - _diskIndex++; + _diskIndex++; if (_diskIndex < 20) { _appearCountdown = 1; } else { @@ -450,7 +448,7 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, } else if (!_dropKey && param.asPoint().x > 38 && param.asPoint().x < 598 && param.asPoint().y > 400 && param.asPoint().y < 460) { - + _diskSlots[_diskIndex]->stop(); _diskIndex = (param.asPoint().x - 38) / 28; _diskSlots[_diskIndex]->activate(); @@ -464,45 +462,43 @@ uint32 DiskplayerScene::handleMessage(int messageNum, const MessageParam ¶m, break; case 0x2000: tuneIn(); - break; + break; case 0x2001: stop(); - break; + break; } } return 0; } -void DiskplayerScene::stop() { - _diskSmackerPlayer->open(0x08288103, true); +void DiskplayerScene::openSmacker(uint32 fileHash, bool keepLastFrame) { + _diskSmackerPlayer->open(fileHash, keepLastFrame); _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); _palette->usePalette(); +} + +void DiskplayerScene::stop() { + openSmacker(0x08288103, true); _ssPlayButton->release(); _updateStatus = kUSStopped; _diskSlots[_diskIndex]->activate(); } void DiskplayerScene::tuneIn() { - _diskSmackerPlayer->open(0x900001C1, false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); + openSmacker(0x900001C1, false); _ssPlayButton->release(); _updateStatus = kUSTuningIn; _diskSlots[_diskIndex]->activate(); } void DiskplayerScene::playDisk() { - _diskSmackerPlayer->open(kDiskplayerSmackerFileHashes[_diskIndex], false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); + openSmacker(kDiskplayerSmackerFileHashes[_diskIndex], false); _updateStatus = kUSPlaying; _diskSlots[_diskIndex]->play(); } void DiskplayerScene::playStatic() { - _diskSmackerPlayer->open(0x90000101, false); - _vm->_screen->setSmackerDecoder(_diskSmackerPlayer->getSmackerDecoder()); - _palette->usePalette(); + openSmacker(0x90000101, false); _ssPlayButton->release(); _updateStatus = kUSPlaying; _diskSlots[_diskIndex]->activate(); |