Skip to content

Instantly share code, notes, and snippets.

@neuromancer

neuromancer/loom-music.patch Secret

Last active Jul 4, 2018
Embed
What would you like to do?
A patch to combine the best of Loom PC CD (“talkie” release) and FM-Towns (background music)
diff --git a/backends/audiocd/default/default-audiocd.cpp b/backends/audiocd/default/default-audiocd.cpp
index 003060c..3108983 100644
--- a/backends/audiocd/default/default-audiocd.cpp
+++ b/backends/audiocd/default/default-audiocd.cpp
@@ -24,6 +24,8 @@
#include "audio/audiostream.h"
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/textconsole.h"
+
DefaultAudioCDManager::DefaultAudioCDManager() {
_cd.playing = false;
@@ -56,7 +58,8 @@ void DefaultAudioCDManager::close() {
bool DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool onlyEmulate,
Audio::Mixer::SoundType soundType) {
- stop();
+
+ //stop();
if (numLoops != 0 || startFrame != 0) {
_cd.track = track;
@@ -87,6 +90,8 @@ bool DefaultAudioCDManager::play(int track, int numLoops, int startFrame, int du
_emulating = true;
_mixer->playStream(soundType, &_handle,
Audio::makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops), -1, _cd.volume, _cd.balance);
+ if (_cd.volume < 255)
+ _cd.volume = 255;
return true;
}
}
diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 9c5271e..398d3ab 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -545,6 +545,16 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) {
if (_game.id == GID_CMI)
mainmenuKeyEnabled = true;
+ if (_game.id == GID_LOOM && lastKeyHit.keycode >= Common::KEYCODE_1 && lastKeyHit.keycode <= Common::KEYCODE_9 && lastKeyHit.hasFlags(0)) {
+ int track = lastKeyHit.keycode - Common::KEYCODE_1 + 2;
+ _sound->setVolumeCDTrack(64);
+ _sound->playCDTrack(track, 1, 0, 0);
+ }
+ if (_game.id == GID_LOOM && lastKeyHit.keycode == Common::KEYCODE_0 && lastKeyHit.hasFlags(0)) {
+ _sound->stopCD();
+ }
+
+
if (mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(0))) {
if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0)
runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0);
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index c90b13c..98fc8cc 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1059,6 +1059,10 @@ void Sound::stopCDTimer() {
_vm->getTimerManager()->removeTimerProc(&cd_timer_handler);
}
+void Sound::setVolumeCDTrack(byte volume) {
+ g_system->getAudioCDManager()->setVolume(volume);
+}
+
void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) {
// Reset the music timer variable at the start of a new track
_vm->VAR(_vm->VAR_MUSIC_TIMER) = 0;
diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h
index 740420e..15e2e0b 100644
--- a/engines/scumm/sound.h
+++ b/engines/scumm/sound.h
@@ -125,6 +125,8 @@ public:
void stopCDTimer();
void playCDTrack(int track, int numLoops, int startFrame, int duration);
+ void setVolumeCDTrack(byte volume);
+
void playCDTrackInternal(int track, int numLoops, int startFrame, int duration);
void stopCD();
int pollCD() const;
@neuromancer

This comment has been minimized.

Copy link
Owner Author

@neuromancer neuromancer commented Jul 3, 2018

This patch allows to play the Loom PC CD version with the wonderfull music from the FM-Towns version.

Instructions:

  1. Patch and compile scummvm. To compile it faster, you can enable only the scummvm games using this command:
    $ ./configure --disable-all-engines --enable-engine=scumm
  2. Copy the ripped tracks from the FM-Towns to the Loom directory. Since the PC CD version uses a single track to play voices, each track from the FM-Towns version should be renamed with the next number. So track1.fla should be track2.fla, track2 should be track3.fla, etc.
  3. Run the PC CD version of Loom using the patched scummvm.
  4. Select the proper track for earch game setting. The selection of songs it is not automatic. You need to use keys 1 - 9 to select the melody for each screen. The Mobygames entry of Loom provides some clues on what scene you should play each track:
Loom Theme			Act 1 No. 4: Pas de trois: I. Intrada: Allegro
The Elders' Council		Act 4 No. 27: Danses des petits cygnes: Moderato
Crystalgard (The City of Glass)	Act 2 No. 13: Danses des cygnes: IV. Allegro Moderato
The Shepherds / The Dragon Cave	Act 1 No. 6: Pas d'action: Andantino Quasi Moderato
The Blacksmiths' Guild		Act 1 No. 4: Pas de trois: IV. Moderato
The Cathedral			Act 1 No. 4: Pas de trois: II. Andante sostenuto
The Loom (Finale)		Act 2 No. 14: Scene: Moderato

The 0 key will stop the current track.

@leshokunin

This comment has been minimized.

Copy link

@leshokunin leshokunin commented Jul 4, 2018

As people mentioned on Reddit:

  • "FM-Towns is the best version since all cutscenes/dialogues are there. It just has some worse backgrounds here and there, not a big thing."
  • "To get the best version we need the opposite, adding voices to the FMTowns version."

What do you think of that?

@neuromancer

This comment has been minimized.

Copy link
Owner Author

@neuromancer neuromancer commented Jul 4, 2018

I agree that the FMTowns versions is better in the sense of cutscenes/dialogues. But, I believe it is nearly impossible to add the voices into the FMTowns version: it requires to look for every piece of dialog and assign the right sound to it, manually. Moreover, the dialog lines in the two versions are different, so they cannot be synced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment