summaryrefslogtreecommitdiff
path: root/src/music/win32_m.cpp
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2018-03-04 23:34:02 +0100
committerMichael Lutz <michi@icosahedron.de>2018-06-15 23:09:17 +0200
commit276192f714d6816088791435c1b70dfa7122cdbd (patch)
tree98ca1f899d2769c7538333617ee01db1bd2c68b7 /src/music/win32_m.cpp
parent836d25e738b78d1c8820ecab1f7bd90b0833ca17 (diff)
downloadopenttd-276192f714d6816088791435c1b70dfa7122cdbd.tar.xz
Change #6684: Cutting point overrides for music base sets
This improves bad looping of title screen song from Windows TTD, and fixes a long silence at the end of "Can't get there from here" from Windows TTD.
Diffstat (limited to 'src/music/win32_m.cpp')
-rw-r--r--src/music/win32_m.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp
index 51528133b..93991d88b 100644
--- a/src/music/win32_m.cpp
+++ b/src/music/win32_m.cpp
@@ -209,10 +209,6 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
while (_midi.current_block < _midi.current_file.blocks.size()) {
MidiFile::DataBlock &block = _midi.current_file.blocks[_midi.current_block];
- /* check that block is not in the future */
- if (block.realtime / 1000 > playback_time) {
- break;
- }
/* check that block isn't at end-of-song override */
if (_midi.current_segment.end > 0 && block.ticktime >= _midi.current_segment.end) {
if (_midi.current_segment.loop) {
@@ -223,6 +219,10 @@ void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DW
}
break;
}
+ /* check that block is not in the future */
+ if (block.realtime / 1000 > playback_time) {
+ break;
+ }
byte *data = block.data.Begin();
size_t remaining = block.data.Length();
@@ -315,8 +315,8 @@ void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
return;
}
- _midi.next_segment.start = 0;
- _midi.next_segment.end = 0;
+ _midi.next_segment.start = song.override_start;
+ _midi.next_segment.end = song.override_end;
_midi.next_segment.loop = false;
DEBUG(driver, 2, "Win32-MIDI: PlaySong: setting flag");