From: <sag...@us...> - 2013-04-17 23:31:31
|
Revision: 1902 http://sourceforge.net/p/modplug/code/1902 Author: saga-games Date: 2013-04-17 23:31:23 +0000 (Wed, 17 Apr 2013) Log Message: ----------- [Fix] Invalid instrument numbers do nothing, but they are remembered for upcoming notes and do not trigger a note in that case. [Mod] OpenMPT: Version is now 1.22.01.04 Modified Paths: -------------- trunk/OpenMPT/common/version.h trunk/OpenMPT/soundlib/ModChannel.cpp trunk/OpenMPT/soundlib/ModChannel.h trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/common/version.h =================================================================== --- trunk/OpenMPT/common/version.h 2013-04-17 21:08:11 UTC (rev 1901) +++ trunk/OpenMPT/common/version.h 2013-04-17 23:31:23 UTC (rev 1902) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 01 -#define VER_MINORMINOR 03 +#define VER_MINORMINOR 04 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/ModChannel.cpp =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.cpp 2013-04-17 21:08:11 UTC (rev 1901) +++ trunk/OpenMPT/soundlib/ModChannel.cpp 2013-04-17 23:31:23 UTC (rev 1902) @@ -17,7 +17,7 @@ { if(resetMask & resetSetPosBasic) { - nNote = nNewNote = nNewIns = 0; + nNote = nNewNote = nNewIns = nOldIns = 0; pModSample = nullptr; pModInstrument = nullptr; nPortamentoDest = 0; Modified: trunk/OpenMPT/soundlib/ModChannel.h =================================================================== --- trunk/OpenMPT/soundlib/ModChannel.h 2013-04-17 21:08:11 UTC (rev 1901) +++ trunk/OpenMPT/soundlib/ModChannel.h 2013-04-17 23:31:23 UTC (rev 1902) @@ -83,7 +83,7 @@ uint8 nRestoreCutoffOnNewNote; //Like above uint8 nNote, nNNA; uint8 nLastNote; // Last note, ignoring note offs and cuts - for MIDI macros - uint8 nNewNote, nNewIns, nCommand, nArpeggio; + uint8 nNewNote, nNewIns, nOldIns, nCommand, nArpeggio; uint8 nOldVolumeSlide, nOldFineVolUpDown; uint8 nOldPortaUpDown, nOldFinePortaUpDown, nOldExtraFinePortaUpDown; uint8 nOldPanSlide, nOldChnVolSlide; Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-17 21:08:11 UTC (rev 1901) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-04-17 23:31:23 UTC (rev 1902) @@ -1650,9 +1650,10 @@ // Additional test case: tickdelay.it if(instr) { - if(GetNumInstruments() < 1 && instr < MAX_SAMPLES) + if(GetNumInstruments() == 0) { - pChn->pModSample = &Samples[instr]; + if(instr < MAX_SAMPLES) + pChn->pModSample = &Samples[instr]; } else { if(instr < MAX_INSTRUMENTS) @@ -1762,6 +1763,16 @@ { note = NOTE_NONE; } + } else if(IsCompatibleMode(TRK_IMPULSETRACKER) && GetNumInstruments() != 0 && ModCommand::IsNoteOrEmpty(note)) + { + // IT compatibility: Invalid instrument numbers do nothing, but they are remembered for upcoming notes and do not trigger a note in that case. + // Test case: InstrumentNumberChange.it + INSTRUMENTINDEX instrToCheck = (instr != 0 ? instr : pChn->nOldIns); + if(instrToCheck != 0 && (instrToCheck > GetNumInstruments() || Instruments[instrToCheck] == nullptr)) + { + note = NOTE_NONE; + instr = 0; + } } // XM: FT2 ignores a note next to a K00 effect, and a fade-out seems to be done when no volume envelope is present (not exactly the Kxx behaviour) @@ -1928,7 +1939,7 @@ if(instr) { const ModSample *oldSample = pChn->pModSample; - const ModInstrument *oldInstrument = pChn->pModInstrument; + //const ModInstrument *oldInstrument = pChn->pModInstrument; InstrumentChange(pChn, instr, bPorta, true); pChn->nNewIns = 0; @@ -2550,6 +2561,12 @@ UpdateS3MEffectMemory(pChn, param); } + if(pChn->rowCommand.instr) + { + // Not necessarily consistent with actually playing instrument for IT compatibility + pChn->nOldIns = pChn->rowCommand.instr; + } + } // for(...) end // Navigation Effects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |