[Scummvm-cvs-logs] scummvm master -> b8354e27ae1c81578d9ac279dcba9bf09ccec058
bluegr
md5 at scummvm.org
Mon Jul 9 00:35:24 CEST 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
078c09c13e SCI: Update comments in kGetAngleWorker()
b8354e27ae TINSEL: Fix bug #3541230 - "DW: PSX version locks up after using the book"
Commit: 078c09c13e5ffa2266bccfd85c38a93d730a02e6
https://github.com/scummvm/scummvm/commit/078c09c13e5ffa2266bccfd85c38a93d730a02e6
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-08T15:33:38-07:00
Commit Message:
SCI: Update comments in kGetAngleWorker()
Changed paths:
engines/sci/engine/kmath.cpp
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index 05c8845..a643fbe 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -89,6 +89,9 @@ uint16 kGetAngleWorker(int16 x1, int16 y1, int16 x2, int16 y2) {
// differences from the original, which uses custom implementation of atan().
// The differences in the return values are the cause of bug #3540976
// and perhaps bug #3037267 as well.
+ // The results of this function match the expected results of SCI0, but not
+ // SCI1 (hence the bug in Longbow). We need to find the point in history
+ // when this function was changed.
// HACK: Return the expected value for Longbow, scene 150 (bug #3540976).
// This is a temporary solution, till the function returns the expected
@@ -128,7 +131,6 @@ uint16 kGetAngleWorker(int16 x1, int16 y1, int16 x2, int16 y2) {
// Convert from grads to degrees by merging grad 0 with grad 1,
// grad 10 with grad 11, grad 20 with grad 21, etc. This leads to
// "degrees" that equal either one or two grads.
- // This subtraction is meant to change from 400 "degrees" into 360 degrees
angle -= (angle + 9) / 10;
return angle;
}
Commit: b8354e27ae1c81578d9ac279dcba9bf09ccec058
https://github.com/scummvm/scummvm/commit/b8354e27ae1c81578d9ac279dcba9bf09ccec058
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-08T15:33:40-07:00
Commit Message:
TINSEL: Fix bug #3541230 - "DW: PSX version locks up after using the book"
Removed the superfluous MIDI offset storing code. Now, the MIDI buffer is
re-read when the music loops. This removes a static variable and also
fixes another bug in the SEQ decoder.
Changed paths:
engines/tinsel/music.cpp
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index fa5334a..a226feb 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -140,7 +140,6 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
}
// the index and length of the last tune loaded
- static uint32 dwLastMidiIndex = 0; // FIXME: Avoid non-const global vars
uint32 dwSeqLen = 0; // length of the sequence
// Support for external music from the music enhancement project
@@ -181,61 +180,53 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
if (dwFileOffset == 0)
return true;
- if (dwFileOffset != dwLastMidiIndex) {
- Common::File midiStream;
-
- // open MIDI sequence file in binary mode
- if (!midiStream.open(MIDI_FILE))
- error(CANNOT_FIND_FILE, MIDI_FILE);
-
- // update index of last tune loaded
- dwLastMidiIndex = dwFileOffset;
-
- // move to correct position in the file
- midiStream.seek(dwFileOffset, SEEK_SET);
-
- // read the length of the sequence
- dwSeqLen = midiStream.readUint32LE();
-
- // make sure buffer is large enough for this sequence
- assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size);
-
- // stop any currently playing tune
- _vm->_midiMusic->stop();
-
- // read the sequence
- if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen)
- error(FILE_IS_CORRUPT, MIDI_FILE);
-
- midiStream.close();
-
- // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii",
- // which actually affects all ports, since it's specific to the GRA version.
- //
- // The GRA version does not seem to set the channel volume at all for the first
- // intro track, thus we need to do that here. We only initialize the channels
- // used in that sequence. And we are using 127 as default channel volume.
- //
- // Only in the GRA version dwFileOffset can be "38888", just to be sure, we
- // check for the SCN files feature flag not being set though.
- if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) {
- _vm->_midiMusic->send(0x7F07B0 | 3);
- _vm->_midiMusic->send(0x7F07B0 | 5);
- _vm->_midiMusic->send(0x7F07B0 | 8);
- _vm->_midiMusic->send(0x7F07B0 | 10);
- _vm->_midiMusic->send(0x7F07B0 | 13);
- }
+ Common::File midiStream;
+
+ // open MIDI sequence file in binary mode
+ if (!midiStream.open(MIDI_FILE))
+ error(CANNOT_FIND_FILE, MIDI_FILE);
- _vm->_midiMusic->playMIDI(dwSeqLen, bLoop);
+ // move to correct position in the file
+ midiStream.seek(dwFileOffset, SEEK_SET);
- // Store the length
- //dwLastSeqLen = dwSeqLen;
- } else {
- // dwFileOffset == dwLastMidiIndex
- _vm->_midiMusic->stop();
- _vm->_midiMusic->playMIDI(dwSeqLen, bLoop);
+ // read the length of the sequence
+ dwSeqLen = midiStream.readUint32LE();
+
+ // make sure buffer is large enough for this sequence
+ assert(dwSeqLen > 0 && dwSeqLen <= g_midiBuffer.size);
+
+ // stop any currently playing tune
+ _vm->_midiMusic->stop();
+
+ // read the sequence. This needs to be read again before playSEQ() is
+ // called even if the music is restarting, as playSEQ() reads the file
+ // name off the buffer itself. However, that function adds SMF headers
+ // to the buffer, thus if it's read again, the SMF headers will be read
+ // and the filename will always be 'MThd'.
+ if (midiStream.read(g_midiBuffer.pDat, dwSeqLen) != dwSeqLen)
+ error(FILE_IS_CORRUPT, MIDI_FILE);
+
+ midiStream.close();
+
+ // WORKAROUND for bug #2820054 "DW1: No intro music at first start on Wii",
+ // which actually affects all ports, since it's specific to the GRA version.
+ //
+ // The GRA version does not seem to set the channel volume at all for the first
+ // intro track, thus we need to do that here. We only initialize the channels
+ // used in that sequence. And we are using 127 as default channel volume.
+ //
+ // Only in the GRA version dwFileOffset can be "38888", just to be sure, we
+ // check for the SCN files feature flag not being set though.
+ if (_vm->getGameID() == GID_DW1 && dwFileOffset == 38888 && !(_vm->getFeatures() & GF_SCNFILES)) {
+ _vm->_midiMusic->send(0x7F07B0 | 3);
+ _vm->_midiMusic->send(0x7F07B0 | 5);
+ _vm->_midiMusic->send(0x7F07B0 | 8);
+ _vm->_midiMusic->send(0x7F07B0 | 10);
+ _vm->_midiMusic->send(0x7F07B0 | 13);
}
+ _vm->_midiMusic->playMIDI(dwSeqLen, bLoop);
+
return true;
}
More information about the Scummvm-git-logs
mailing list