OpenTTD

Tasklist

FS#6684 - Mimic original DOS behavior regarding music more closely

Attached to Project: OpenTTD
Opened by Niels M H (nielsm) - Monday, 05 March 2018, 21:53 GMT
Type Patch
Category Core
Status New
Assigned To No-one
Operating System Windows
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

The premise of this patch is that the DOS version of TTD is primary canon, while the Windows version is a port that didn't get everything perfectly accurate. I.e. when using data from the original game, it should act as closely to the DOS version as reasonably possible. However the game data must be used without direct modification.

This patch does three things:
1) Make the title screen music loop tightly, no pause between loops at all
2) Remove the long silence in "Can't Get There From Here", which wasn't there in the DOS version
3) Not play the theme song during regular gameplay

This patch only implements the changes for DirectMusic, since I don't have any systems at hand for attempting to replicate on. I quickly gave up on trying to do anything with the Win32 (MCI) music driver since MCI Sequencer appears to be broken in Windows 10, taking 5+ seconds just to load a single song.

Items 1 and 2 are achieved by adding new annotations to the orig_win.obm file that describes the MIDI timestamps the actual music runs from and to. This allows the music driver to accurately skip the unwanted silences. There is currently an assumption that this will only be used with the original files, to be fully general the code will need at least a partial MIDI file parser to read out the actual time division of the file.

Item 3 is handled by simply special-casing the first entry in the .obm file ("theme"), so if it exists it gets taken out of rotation from the "All" playlist, but still gets used on the title screen. Additionally, the music is restarted when changing game modes, so the theme song doesn't bleed into the gameplay.
This task depends upon

Comment by Niels M H (nielsm) - Tuesday, 06 March 2018, 21:33 GMT
I think this will also close FS#6582
Comment by Niels M H (nielsm) - Sunday, 11 March 2018, 15:29 GMT
Cleaned up version of the patchset, split out into multiple logical changes. Application order is music-1, music-2, music-3, music-4. The dmusic-3 patch also depends on patches in FS#6683 and FS#5807.
Comment by Niels M H (nielsm) - Sunday, 11 March 2018, 15:40 GMT
If the changes in FS#6685 are applied, this additional patch to the DirectMusic driver will use the MidiFile class to read correct time scale values from the MIDI file, instead of assuming only the TTD-Windows files are ever used.

Loading...