diff options
author | Strangerke | 2018-04-16 06:54:04 +0200 |
---|---|---|
committer | Strangerke | 2018-04-16 06:54:04 +0200 |
commit | f01af1690e1e8f7169ba8b263e1c9cf71bdfe287 (patch) | |
tree | b1e8180a2d530a7f0708c583d0b38deb4dba7811 /engines/lilliput | |
parent | 0922d44199aa492cd57bc3fe1a40e0ff631e98ba (diff) | |
download | scummvm-rg350-f01af1690e1e8f7169ba8b263e1c9cf71bdfe287.tar.gz scummvm-rg350-f01af1690e1e8f7169ba8b263e1c9cf71bdfe287.tar.bz2 scummvm-rg350-f01af1690e1e8f7169ba8b263e1c9cf71bdfe287.zip |
LILLIPUT: Fix a regresssion in scrollToViewportCharacterTarget(), some more renaming
Diffstat (limited to 'engines/lilliput')
-rw-r--r-- | engines/lilliput/lilliput.cpp | 34 | ||||
-rw-r--r-- | engines/lilliput/script.cpp | 18 | ||||
-rw-r--r-- | engines/lilliput/sound.cpp | 54 | ||||
-rw-r--r-- | engines/lilliput/sound.h | 18 |
4 files changed, 81 insertions, 43 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 5aee74f56b..4fca379468 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -253,7 +253,7 @@ void LilliputEngine::update() { } void LilliputEngine::newInt8() { - _soundHandler->contentFct1(); + _soundHandler->refresh(); if (_byte12A05 != 0) --_byte12A05; @@ -1129,19 +1129,29 @@ void LilliputEngine::scrollToViewportCharacterTarget() { Common::Point newPos = _scriptHandler->_viewportPos; if (tileX >= 1) { - if (tileX > 6) - newPos.x = CLIP(newPos.x + 4, 0, 56); - } else - newPos.x = CLIP(newPos.x - 4, 0, 56); + if (tileX > 6){ + newPos.x += 4; + if (newPos.x > 56) + newPos.x = 56; + } + } else { + newPos.x -= 4; + if (newPos.x < 0) + newPos.x = 0; + } if ((tileY < 1) && (newPos.y < 4)) newPos.y = 0; - else if (tileY >= 1) - newPos.y = CLIP(newPos.y + 4, 0, 56); - else - // CHECKME: not clipped? - newPos.y -= 4; + else { + if (tileY < 1) + newPos.y -= 4; + if (tileY > 6) { + newPos.y += 4; + if (newPos.y >= 56) + newPos.y = 56; + } + } viewportScrollTo(newPos); } @@ -1182,7 +1192,7 @@ void LilliputEngine::viewportScrollTo(Common::Point goalPos) { dy = 0; } while ((dx != 0) || (dy != 0)); - _soundHandler->contentFct5(); + _soundHandler->update(); } void LilliputEngine::renderCharacters(byte *buf, Common::Point pos) { @@ -1664,7 +1674,7 @@ byte LilliputEngine::sequenceSound(int index, Common::Point var1) { debugC(2, kDebugEngine, "sequenceSound(%d, %d - %d)", index, var1.x, var1.y); int param4x = ((index | 0xFF00) >> 8); - _soundHandler->contentFct2(var1.y, _scriptHandler->_viewportPos, + _soundHandler->play(var1.y, _scriptHandler->_viewportPos, _scriptHandler->_characterTilePos[index], Common::Point(param4x, 0)); return kSeqRepeat; } diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index fb6a4b0d10..7025a6b087 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -2286,7 +2286,7 @@ void LilliputScript::OC_DisableCharacter() { void LilliputScript::OC_saveAndQuit() { warning("TODO: OC_saveAndQuit"); - _vm->_soundHandler->contentFct6(); // Kill music + _vm->_soundHandler->remove(); // Kill music // TODO: Save game _vm->_shouldQuit = true; } @@ -3213,7 +3213,7 @@ void LilliputScript::OC_initGameAreaDisplay() { OC_PaletteFadeIn(); _vm->_refreshScreenFlag = false; - _vm->_soundHandler->contentFct5(); + _vm->_soundHandler->update(); } void LilliputScript::OC_displayCharacterStatBar() { @@ -3291,7 +3291,7 @@ void LilliputScript::OC_playObjectSound() { Common::Point var4 = Common::Point(0xFF, index & 0xFF); int soundId = (_currScript->readUint16LE() & 0xFF); - _vm->_soundHandler->contentFct2(soundId, _viewportPos, _characterTilePos[index], var4); + _vm->_soundHandler->play(soundId, _viewportPos, _characterTilePos[index], var4); } void LilliputScript::OC_startLocationSound() { @@ -3302,7 +3302,7 @@ void LilliputScript::OC_startLocationSound() { Common::Point var2 = _viewportPos; int var1 = (_currScript->readUint16LE() & 0xFF); - _vm->_soundHandler->contentFct2(var1, var2, var3, var4); + _vm->_soundHandler->play(var1, var2, var3, var4); } void LilliputScript::OC_stopObjectSound() { @@ -3310,7 +3310,7 @@ void LilliputScript::OC_stopObjectSound() { Common::Point var4 = Common::Point(-1, getValue1() & 0xFF); - _vm->_soundHandler->contentFct3(var4); // Stop Sound + _vm->_soundHandler->stop(var4); // Stop Sound } void LilliputScript::OC_stopLocationSound() { @@ -3318,13 +3318,13 @@ void LilliputScript::OC_stopLocationSound() { Common::Point var4 = getPosFromScript(); - _vm->_soundHandler->contentFct3(var4); + _vm->_soundHandler->stop(var4); } void LilliputScript::OC_toggleSound() { debugC(1, kDebugScript, "OC_toggleSound()"); - _vm->_soundHandler->contentFct4(); + _vm->_soundHandler->toggleOnOff(); } void LilliputScript::OC_playMusic() { @@ -3336,13 +3336,13 @@ void LilliputScript::OC_playMusic() { warning("OC_playMusic: unknown value for var3"); Common::Point var3 = Common::Point(-1, -1); - _vm->_soundHandler->contentFct2(var1, var2, var3, var4); + _vm->_soundHandler->play(var1, var2, var3, var4); } void LilliputScript::OC_stopMusic() { debugC(1, kDebugScript, "OC_stopMusic()"); - _vm->_soundHandler->contentFct6(); + _vm->_soundHandler->remove(); } void LilliputScript::OC_setCharacterMapColor() { diff --git a/engines/lilliput/sound.cpp b/engines/lilliput/sound.cpp index d94cf1eb76..78de105784 100644 --- a/engines/lilliput/sound.cpp +++ b/engines/lilliput/sound.cpp @@ -31,35 +31,59 @@ LilliputSound::LilliputSound(LilliputEngine *vm) : _vm(vm) { } LilliputSound::~LilliputSound() { + free(_musicBuff); } -// Used during initialisation -void LilliputSound::contentFct0() { - debugC(1, kDebugSound, "contentFct0()"); +void LilliputSound::loadMusic(Common::String filename) { + debugC(1, kDebugSound, "loadMusic(%s)", filename.c_str()); + + Common::File f; + + if (!f.open(filename)) + error("Missing music file %s", filename.c_str()); + + byte *res = (byte *)malloc(sizeof(byte) * 50000); + for (int i = 0; i < 50000; ++i) + res[i] = f.readByte(); + +// f.close(); + f.seek(0); + int filenumb = f.readUint16LE(); + + + + free(res); +} + +// Used during initialization +void LilliputSound::init() { + debugC(1, kDebugSound, "LilliputSound::init()"); + + loadMusic("ROBIN.MUS"); } -void LilliputSound::contentFct1() { - debugC(1, kDebugSound, "contentFct1()"); +void LilliputSound::refresh() { + debugC(1, kDebugSound, "LilliputSound::refresh()"); } -void LilliputSound::contentFct2(int var1, Common::Point var2, Common::Point var3, Common::Point var4) { - debugC(1, kDebugSound, "contentFct2(%d, %d - %d, %d - %d, %d - %d)", var1, var2.x, var2.y, var3.x, var3.y, var4.x, var4.y); +void LilliputSound::play(int var1, Common::Point var2, Common::Point var3, Common::Point var4) { + debugC(1, kDebugSound, "LilliputSound::play(%d, %d - %d, %d - %d, %d - %d)", var1, var2.x, var2.y, var3.x, var3.y, var4.x, var4.y); } -void LilliputSound::contentFct3(Common::Point pos) { - debugC(1, kDebugSound, "contentFct3(%d - %d)", pos.x, pos.y); +void LilliputSound::stop(Common::Point pos) { + debugC(1, kDebugSound, "LilliputSound::stop(%d - %d)", pos.x, pos.y); } -void LilliputSound::contentFct4() { - debugC(1, kDebugSound, "contentFct4()"); +void LilliputSound::toggleOnOff() { + debugC(1, kDebugSound, "LilliputSound::toggleOnOff()"); } -void LilliputSound::contentFct5() { - debugC(1, kDebugSound, "contentFct5()"); +void LilliputSound::update() { + debugC(1, kDebugSound, "LilliputSound::update()"); } -void LilliputSound::contentFct6() { - debugC(1, kDebugSound, "contentFct6()"); +void LilliputSound::remove() { + debugC(1, kDebugSound, "Lilliput::remove()"); } } // End of namespace diff --git a/engines/lilliput/sound.h b/engines/lilliput/sound.h index 6d5bf6f556..ee052c4064 100644 --- a/engines/lilliput/sound.h +++ b/engines/lilliput/sound.h @@ -32,16 +32,20 @@ public: LilliputSound(LilliputEngine *vm); ~LilliputSound(); - void contentFct0(); - void contentFct1(); - void contentFct2(int var1, Common::Point var2, Common::Point var3, Common::Point var4); - void contentFct3(Common::Point pos); - void contentFct4(); - void contentFct5(); - void contentFct6(); + void init(); + void refresh(); + void play(int var1, Common::Point var2, Common::Point var3, Common::Point var4); + void stop(Common::Point pos); + void toggleOnOff(); + void update(); + void remove(); private: LilliputEngine *_vm; + + byte *_musicBuff; + + void loadMusic(Common::String filename); }; } // End of namespace Lilliput |