From: <sag...@us...> - 2009-07-11 16:47:58
|
Revision: 290 http://modplug.svn.sourceforge.net/modplug/?rev=290&view=rev Author: saga-games Date: 2009-07-11 16:47:56 +0000 (Sat, 11 Jul 2009) Log Message: ----------- [Fix] patterns.bmp was broken [Fix] IT / XM Compatibility: Out of range global volume, local global volume slides (Might need to re-align MODCHANNEL) [Fix] IT Compatibility: Retrigger effect behaved slightly wrong Modified Paths: -------------- trunk/OpenMPT/mptrack/res/patterns.bmp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/res/patterns.bmp =================================================================== (Binary files differ) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-11 16:27:29 UTC (rev 289) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-07-11 16:47:56 UTC (rev 290) @@ -295,13 +295,32 @@ break; // Global Volume case CMD_GLOBALVOLUME: + if (m_nTickCount) break; + if (!(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) param <<= 1; - if (param > 128) param = 128; - nGlbVol = param << 1; + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + // both FT2 and IT ignore out-of-range values + if (param <= 128) + nGlbVol = param << 1; + } + else + { + if (param > 128) param = 128; + nGlbVol = param << 1; + } break; // Global Volume Slide case CMD_GLOBALVOLSLIDE: - if (param) nOldGlbVolSlide = param; else param = nOldGlbVolSlide; + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + if (param) pChn->nOldGlobalVolSlide = param; else param = pChn->nOldGlobalVolSlide; + } + else + { + if (param) nOldGlbVolSlide = param; else param = nOldGlbVolSlide; + + } if (((param & 0x0F) == 0x0F) && (param & 0xF0)) { param >>= 4; @@ -727,7 +746,10 @@ pChn->nLeftVU = pChn->nRightVU = 0xFF; pChn->dwFlags &= ~CHN_FILTER; pChn->dwFlags |= CHN_FASTVOLRAMP; - pChn->nRetrigCount = 0; + if(!GetModFlag(MSF_COMPATIBLE_PLAY)) + { + pChn->nRetrigCount = 0; + } pChn->nTremorCount = 0; if (bResetEnv) { @@ -1513,6 +1535,8 @@ if (!(param & 0x0F)) param |= pChn->nRetrigParam & 0x0F; param |= 0x100; // increment retrig count on first row } + if(!GetModFlag(MSF_COMPATIBLE_PLAY)) + { if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); else param = pChn->nRetrigParam; //rewbs.volOffset //RetrigNote(nChn, param); @@ -1523,6 +1547,12 @@ else RetrigNote(nChn, param); //end rewbs.volOffset: + } + else + { + if (param) pChn->nRetrigParam = (BYTE)(param & 0xFF); + RetrigNote(nChn, pChn->nRetrigParam); + } break; // Tremor @@ -1537,13 +1567,25 @@ if (m_nTickCount) break; if (!(m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) param <<= 1; - if (param > 128) param = 128; - m_nGlobalVolume = param << 1; + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + { + // both FT2 and IT ignore out-of-range values + if (param <= 128) + m_nGlobalVolume = param << 1; + } + else + { + if (param > 128) param = 128; + m_nGlobalVolume = param << 1; + } break; // Global Volume Slide case CMD_GLOBALVOLSLIDE: - GlobalVolSlide(param); + if(GetModFlag(MSF_COMPATIBLE_PLAY)) + GlobalVolSlide(param, &pChn->nOldGlobalVolSlide); + else + GlobalVolSlide(param, &m_nOldGlbVolSlide); break; // Set 8-bit Panning @@ -2909,26 +2951,43 @@ UINT nRetrigCount = pChn->nRetrigCount; BOOL bDoRetrig = FALSE; - if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) + if(GetModFlag(MSF_COMPATIBLE_PLAY) && (m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) { - if (!nRetrigSpeed) nRetrigSpeed = 1; - if ((nRetrigCount) && (!(nRetrigCount % nRetrigSpeed))) bDoRetrig = TRUE; - nRetrigCount++; - } else + // IT retrigger behaviour + if (!m_nTickCount && pChn->nRowNote) + { + pChn->nRetrigCount = param & 0xf; + } + else if (!--pChn->nRetrigCount) + { + pChn->nRetrigCount = param & 0xf; + bDoRetrig = TRUE; + } + } + else { - UINT realspeed = nRetrigSpeed; - if ((param & 0x100) && (pChn->nRowVolCmd == VOLCMD_VOLUME) && (pChn->nRowParam & 0xF0)) realspeed++; - if ((m_nTickCount) || (param & 0x100)) + if (m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { - if (!realspeed) realspeed = 1; - if ((!(param & 0x100)) && (m_nMusicSpeed) && (!(m_nTickCount % realspeed))) bDoRetrig = TRUE; + if (!nRetrigSpeed) nRetrigSpeed = 1; + if ((nRetrigCount) && (!(nRetrigCount % nRetrigSpeed))) bDoRetrig = TRUE; nRetrigCount++; - } else if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) nRetrigCount = 0; - if (nRetrigCount >= realspeed) + } else { - if ((m_nTickCount) || ((param & 0x100) && (!pChn->nRowNote))) bDoRetrig = TRUE; + UINT realspeed = nRetrigSpeed; + if ((param & 0x100) && (pChn->nRowVolCmd == VOLCMD_VOLUME) && (pChn->nRowParam & 0xF0)) realspeed++; + if ((m_nTickCount) || (param & 0x100)) + { + if (!realspeed) realspeed = 1; + if ((!(param & 0x100)) && (m_nMusicSpeed) && (!(m_nTickCount % realspeed))) bDoRetrig = TRUE; + nRetrigCount++; + } else if (m_nType & (MOD_TYPE_XM|MOD_TYPE_MT2)) nRetrigCount = 0; + if (nRetrigCount >= realspeed) + { + if ((m_nTickCount) || ((param & 0x100) && (!pChn->nRowNote))) bDoRetrig = TRUE; + } } } + if (bDoRetrig) { UINT dv = (param >> 4) & 0x0F; @@ -2967,7 +3026,8 @@ SampleOffset(nChn, offset, false); } } - pChn->nRetrigCount = (BYTE)nRetrigCount; + if(!GetModFlag(MSF_COMPATIBLE_PLAY) || !(m_nType & (MOD_TYPE_IT | MOD_TYPE_MPT))) + pChn->nRetrigCount = (BYTE)nRetrigCount; } @@ -3191,11 +3251,11 @@ } -void CSoundFile::GlobalVolSlide(UINT param) +void CSoundFile::GlobalVolSlide(UINT param, UINT * nOldGlobalVolSlide) //----------------------------------------- { LONG nGlbSlide = 0; - if (param) m_nOldGlbVolSlide = param; else param = m_nOldGlbVolSlide; + if (param) *nOldGlobalVolSlide = param; else param = *nOldGlobalVolSlide; if (((param & 0x0F) == 0x0F) && (param & 0xF0)) { if (m_dwSongFlags & SONG_FIRSTTICK) nGlbSlide = (param >> 4) * 2; Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2009-07-11 16:27:29 UTC (rev 289) +++ trunk/OpenMPT/soundlib/Sndfile.h 2009-07-11 16:47:56 UTC (rev 290) @@ -530,6 +530,7 @@ LONG nVolSwing, nPanSwing; LONG nCutSwing, nResSwing; LONG nRestorePanOnNewNote; //If > 0, nPan should be set to nRestorePanOnNewNote - 1 on new note. Used to recover from panswing. + UINT nOldGlobalVolSlide; // 8-bit members BYTE nRestoreResonanceOnNewNote; //Like above BYTE nRestoreCutoffOnNewNote; //Like above @@ -1160,7 +1161,7 @@ // Global Effects void SetTempo(UINT param, bool setAsNonModcommand = false); void SetSpeed(UINT param); - void GlobalVolSlide(UINT param); + void GlobalVolSlide(UINT param, UINT * nOldGlobalVolSlide); DWORD IsSongFinished(UINT nOrder, UINT nRow) const; BOOL IsValidBackwardJump(UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow) const; // Read/Write sample functions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |