From: <sag...@us...> - 2009-10-15 20:21:38
|
Revision: 399 http://modplug.svn.sourceforge.net/modplug/?rev=399&view=rev Author: saga-games Date: 2009-10-15 20:21:28 +0000 (Thu, 15 Oct 2009) Log Message: ----------- [Fix] Increased "filename" string in instrument header field to 32, since CHAR[12] is not really enough for 12 letters... [Imp] Treeview: Update sequence names, indicate current sequence by bold text [Imp] MOD Playing: Some more (minor) tweaks for Invert Loop. Thanks again, bubsy! [Imp] Mod Conversion: Changing between MOD and XM format limits CMD_SPEED/CMD_TEMPO properly now. [Ref] Renamed undo functions from "Undo" to "PatternUndo", to avoid confusion with other possibly upcoming undo functions (sample editor, etc) [Ref] Some more internal refactoring Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/EffectVis.cpp trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/soundlib/Load_med.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h trunk/OpenMPT/soundlib/pattern.cpp Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -441,7 +441,7 @@ EndWaitCursor(); if ((nPatRemoved) || (bReordered)) { - m_pModDoc->ClearUndo(); + m_pModDoc->ClearPatternUndo(); if (nPatRemoved) { wsprintf(s, "%d pattern%s removed.\n", nPatRemoved, (nPatRemoved == 1) ? "" : "s"); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -377,7 +377,7 @@ } if (dwHintMask & (HINT_MODTYPE|HINT_UNDO)) { - m_ToolBar.EnableButton(ID_EDIT_UNDO, m_pModDoc->CanUndo()); + m_ToolBar.EnableButton(ID_EDIT_UNDO, m_pModDoc->CanPatternUndo()); } } @@ -1166,6 +1166,7 @@ { m_pSndFile->Order.m_sName = str; m_pModDoc->SetModified(); + m_pModDoc->UpdateAllViews(NULL, HINT_SEQNAMES, this); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2009-10-15 20:21:28 UTC (rev 399) @@ -17,7 +17,7 @@ CSpinButtonCtrl m_SpinFineTune, m_SpinSample; CComboBox m_ComboAutoVib, m_ComboLoopType, m_ComboSustainType, m_ComboZoom, m_CbnBaseNote; CButton m_CheckPanning; - UINT m_nSample; + SAMPLEINDEX m_nSample; double m_dTimeStretchRatio; //rewbs.timeStretchMods uint32 m_nStretchProcessStepLength; uint32 m_nSequenceMs; Modified: trunk/OpenMPT/mptrack/EffectVis.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/EffectVis.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -578,7 +578,7 @@ rect.SetRect(x-NODEHALF, y-NODEHALF, x+NODEHALF+1, y+NODEHALF+1); if (rect.PtInRect(point)) { - m_pModDoc->PrepareUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1); + m_pModDoc->PreparePatternUndo(m_nPattern, m_nChan, row, m_nChan+1, row+1); m_nDragItem = row; } } @@ -669,7 +669,7 @@ SetFocus(); SetCapture(); - m_pModDoc->PrepareUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow); + m_pModDoc->PreparePatternUndo(m_nPattern, m_nChan, m_startRow, m_nChan+1, m_endRow); m_dwStatus |= FXVSTATUS_LDRAGGING; } Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -113,7 +113,7 @@ CModDoc::~CModDoc() //----------------- { - ClearUndo(); + ClearPatternUndo(); ClearLog(); } Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/Moddoc.h 2009-10-15 20:21:28 UTC (rev 399) @@ -36,7 +36,8 @@ #define HINT_UNDO 0x10000 #define HINT_MIXPLUGINS 0x20000 #define HINT_SPEEDCHANGE 0x40000 //rewbs.envRowGrid -#define HINT_MAXHINTFLAG HINT_SPEEDCHANGE +#define HINT_SEQNAMES 0x80000 +#define HINT_MAXHINTFLAG HINT_SEQNAMES //Bits 0-18 are reserved. #define HINT_MASK_FLAGS (2*HINT_MAXHINTFLAG - 1) //When applied to hint parameter, should give the flag part. #define HINT_MASK_ITEM (~HINT_MASK_FLAGS) //To nullify update hintbits from hint parameter. @@ -89,6 +90,7 @@ // Undo #define MAX_UNDO_LEVEL 100 +// Pattern Undo typedef struct PATTERNUNDOBUFFER { UINT pattern, patternsize; @@ -243,10 +245,10 @@ BOOL CopyEnvelope(UINT nIns, UINT nEnv); BOOL PasteEnvelope(UINT nIns, UINT nEnv); - BOOL ClearUndo(); - BOOL PrepareUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy); - UINT DoUndo(); - BOOL CanUndo(); + BOOL ClearPatternUndo(); + BOOL PreparePatternUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy); + UINT DoPatternUndo(); + BOOL CanPatternUndo(); LRESULT ActivateView(UINT nIdView, DWORD dwParam); void UpdateAllViews(CView *pSender, LPARAM lHint=0L, CObject *pHint=NULL); HWND GetEditPosition(ROWINDEX &row, PATTERNINDEX &pat, ORDERINDEX &ord); //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -346,7 +346,7 @@ } SetModified(); - ClearUndo(); + ClearPatternUndo(); UpdateAllViews(NULL, HINT_MODTYPE | HINT_MODGENERAL); EndWaitCursor(); return TRUE; @@ -447,7 +447,7 @@ EndWaitCursor(); } SetModified(); - ClearUndo(); + ClearPatternUndo(); UpdateAllViews(NULL, HINT_MODTYPE); return TRUE; } @@ -520,7 +520,7 @@ END_CRITICAL(); EndWaitCursor(); SetModified(); - ClearUndo(); + ClearPatternUndo(); UpdateAllViews(NULL, HINT_MODTYPE); return FALSE; } @@ -1121,7 +1121,7 @@ if ((hCpy) && ((p = (LPSTR)GlobalLock(hCpy)) != NULL)) { - PrepareUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); + PreparePatternUndo(nPattern, 0, 0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); BYTE spdmax = (m_SndFile.m_nType & MOD_TYPE_MOD) ? 0x20 : 0x1F; DWORD dwMemSize = GlobalSize(hCpy); MODCOMMAND *m = m_SndFile.Patterns[nPattern]; @@ -1321,7 +1321,7 @@ nPattern = m_SndFile.Order[oNextOrder]; if(m_SndFile.Patterns.IsValidPat(nPattern) == false) goto PasteDone; m = m_SndFile.Patterns[nPattern]; - PrepareUndo(nPattern, 0,0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); + PreparePatternUndo(nPattern, 0,0, m_SndFile.m_nChannels, m_SndFile.PatternSize[nPattern]); oCurrentOrder = oNextOrder; } } @@ -1531,10 +1531,10 @@ ///////////////////////////////////////////////////////////////////////////////////////// -// Undo Functions +// Pattern Undo Functions -BOOL CModDoc::ClearUndo() -//----------------------- +BOOL CModDoc::ClearPatternUndo() +//------------------------------ { for (UINT i=0; i<MAX_UNDO_LEVEL; i++) { @@ -1547,15 +1547,15 @@ } -BOOL CModDoc::CanUndo() -//--------------------- +BOOL CModDoc::CanPatternUndo() +//---------------------------- { return (PatternUndo[0].pbuffer) ? TRUE : FALSE; } -BOOL CModDoc::PrepareUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy) -//----------------------------------------------------------------------- +BOOL CModDoc::PreparePatternUndo(UINT pattern, UINT x, UINT y, UINT cx, UINT cy) +//------------------------------------------------------------------------------ { MODCOMMAND *pUndo, *pPattern; UINT nRows; @@ -1604,8 +1604,8 @@ } -UINT CModDoc::DoUndo() -//-------------------- +UINT CModDoc::DoPatternUndo() +//--------------------------- { MODCOMMAND *pUndo, *pPattern; UINT nPattern, nRows; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -611,7 +611,7 @@ nChnEnd = GetChanFromCursor(dwEnd); nRowEnd = GetRowFromCursor(dwEnd); if( (nChnEnd < nChnBeg) || (nRowEnd < nRowBeg) ) return FALSE; - if (pModDoc) return pModDoc->PrepareUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1); + if (pModDoc) return pModDoc->PreparePatternUndo(m_nPattern, nChnBeg, nRowBeg, nChnEnd-nChnBeg+1, nRowEnd-nRowBeg+1); return FALSE; } @@ -752,7 +752,7 @@ DWORD startSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwBeginSel : m_dwEndSel; DWORD endSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16)) ? m_dwEndSel : m_dwBeginSel; - pModDoc->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]); + pModDoc->PreparePatternUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]); int finalDest = (startSel>>16)+((endSel>>16)-(startSel>>16))*2; for (int row=finalDest; row>(int)(startSel >> 16); row-=2) @@ -802,7 +802,7 @@ DWORD startSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16))?m_dwBeginSel:m_dwEndSel; DWORD endSel = ((m_dwBeginSel>>16)<(m_dwEndSel>>16))?m_dwEndSel:m_dwBeginSel; - pModDoc->PrepareUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]); + pModDoc->PreparePatternUndo(m_nPattern, 0, 0, pSndFile->m_nChannels, pSndFile->PatternSize[m_nPattern]); int finalDest = (startSel>>16)+((endSel>>16)-(startSel>>16))/2; @@ -1560,7 +1560,7 @@ maxrow = pSndFile->PatternSize[m_nPattern]; if (colmax >= pSndFile->m_nChannels) colmax = pSndFile->m_nChannels-1; if (colmin > colmax) return; - pModDoc->PrepareUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow); + pModDoc->PreparePatternUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow); for (UINT r=row; r<maxrow; r++) { MODCOMMAND *m = pSndFile->Patterns[m_nPattern] + r * pSndFile->m_nChannels + colmin; @@ -1626,7 +1626,7 @@ maxrow = pSndFile->PatternSize[m_nPattern]; if (colmax >= pSndFile->m_nChannels) colmax = pSndFile->m_nChannels-1; if (colmin > colmax) return; - pModDoc->PrepareUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow); + pModDoc->PreparePatternUndo(m_nPattern, 0,0, pSndFile->m_nChannels, maxrow); for (UINT r=maxrow; r>row; ) { @@ -2384,7 +2384,7 @@ dx = (int)((m_dwDragPos & 0xFFF8) >> 3) - (int)((m_dwStartSel & 0xFFF8) >> 3); dy = (int)(m_dwDragPos >> 16) - (int)(m_dwStartSel >> 16); if ((!dx) && (!dy)) return; - pModDoc->PrepareUndo(m_nPattern, 0,0, nChannels, nRows); + pModDoc->PreparePatternUndo(m_nPattern, 0,0, nChannels, nRows); pNewPattern = CSoundFile::AllocatePattern(nRows, nChannels); if (!pNewPattern) return; x1 = (m_dwBeginSel & 0xFFF8) >> 3; @@ -2563,7 +2563,7 @@ pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); pModDoc->SetModified(); - pModDoc->ClearUndo(); + pModDoc->ClearPatternUndo(); pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); //refresh channel headers pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); //updates(?) the channel number to general tab display SetCurrentPattern(m_nPattern); @@ -2586,7 +2586,7 @@ pSndFile->MoveChannel(pSndFile->m_nChannels-1, nChn); pModDoc->SetModified(); - pModDoc->ClearUndo(); + pModDoc->ClearPatternUndo(); pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); SetCurrentPattern(m_nPattern); @@ -2626,7 +2626,7 @@ if(nNumChnNew == vecChns.size()) { pModDoc->SetModified(); - pModDoc->ClearUndo(); + pModDoc->ClearPatternUndo(); pModDoc->UpdateAllViews(NULL, HINT_MODCHANNELS); pModDoc->UpdateAllViews(NULL, HINT_MODTYPE); SetCurrentPattern(m_nPattern); @@ -2696,7 +2696,7 @@ CModDoc *pModDoc = GetDocument(); if ((pCmdUI) && (pModDoc)) { - pCmdUI->Enable(pModDoc->CanUndo()); + pCmdUI->Enable(pModDoc->CanPatternUndo()); } } @@ -2707,7 +2707,7 @@ CModDoc *pModDoc = GetDocument(); if (pModDoc && IsEditingEnabled_bmsg()) { - UINT nPat = pModDoc->DoUndo(); + UINT nPat = pModDoc->DoPatternUndo(); if (nPat < pModDoc->GetSoundFile()->Patterns.Size()) { pModDoc->SetModified(); @@ -2966,7 +2966,7 @@ if(bUsePlaybackPosition == true) SetEditPos(*pSndFile, nRow, nPattern, pSndFile->m_nRow, pSndFile->m_nPattern); - pModDoc->PrepareUndo(nPattern, nChn, nRow, 1, 1); + pModDoc->PreparePatternUndo(nPattern, nChn, nRow, 1, 1); MODCOMMAND *pRow = pSndFile->Patterns[nPattern].GetpModCommand(nRow, nChn); @@ -3993,7 +3993,7 @@ } // Create undo-point. - pModDoc->PrepareUndo(nPat, nChn, nRow, 1, 1); + pModDoc->PreparePatternUndo(nPat, nChn, nRow, 1, 1); // -- write sdx if playing live if (usePlaybackPosition && nTick) { // avoid SD0 which will be mis-interpreted @@ -4141,7 +4141,7 @@ //Param control 'note' if((note == NOTE_PC || note == NOTE_PCS) && bRecordEnabled) { - pModDoc->PrepareUndo(m_nPattern, nChn, nRow, 1, 1); + pModDoc->PreparePatternUndo(m_nPattern, nChn, nRow, 1, 1); pSndFile->Patterns[m_nPattern].GetpModCommand(nRow, nChn)->note = note; const DWORD sel = (nRow << 16) | m_dwCursor; pModDoc->SetModified(); @@ -4174,7 +4174,7 @@ // If record is enabled, create undo point. if(bRecordEnabled) - pModDoc->PrepareUndo(nPat, nChn, nRow, 1, 1); + pModDoc->PreparePatternUndo(nPat, nChn, nRow, 1, 1); // -- write note and instrument data. const bool isSplit = HandleSplit(p, note); @@ -4331,7 +4331,7 @@ const CHANNELINDEX nChn = GetChanFromCursor(m_dwCursor); UINT nPlayIns = 0; // Simply backup the whole row. - pModDoc->PrepareUndo(m_nPattern, nChn, m_nRow, pSndFile->GetNumChannels(), 1); + pModDoc->PreparePatternUndo(m_nPattern, nChn, m_nRow, pSndFile->GetNumChannels(), 1); PatternRow prowbase = pSndFile->Patterns[m_nPattern].GetRow(m_nRow); MODCOMMAND* p = &prowbase[nChn]; @@ -4825,7 +4825,7 @@ AppendMenu(hMenu, MF_STRING, ID_EDIT_PASTE, "Paste\t" + ih->GetKeyTextFromCommand(kcEditPaste)); AppendMenu(hMenu, MF_STRING, ID_EDIT_MIXPASTE, "Mix Paste\t" + ih->GetKeyTextFromCommand(kcEditMixPaste)); - DWORD greyed = pModDoc->CanUndo()?FALSE:MF_GRAYED; + DWORD greyed = pModDoc->CanPatternUndo()?FALSE:MF_GRAYED; if (!greyed || !(CMainFrame::m_dwPatternSetup&PATTERN_OLDCTXMENUSTYLE)) { AppendMenu(hMenu, MF_STRING|greyed, ID_EDIT_UNDO, "Undo\t" + ih->GetKeyTextFromCommand(kcEditUndo)); } Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -178,8 +178,8 @@ } -BOOL CViewSample::SetCurrentSample(UINT nSmp) -//------------------------------------------- +BOOL CViewSample::SetCurrentSample(SAMPLEINDEX nSmp) +//-------------------------------------------------- { CModDoc *pModDoc = GetDocument(); CSoundFile *pSndFile; Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/View_smp.h 2009-10-15 20:21:28 UTC (rev 399) @@ -15,7 +15,8 @@ CImageList m_bmpEnvBar; CRect m_rcClient; SIZE m_sizeTotal; - UINT m_nSample, m_nZoom, m_nScrollPos, m_nScrollFactor, m_nBtnMouseOver; + SAMPLEINDEX m_nSample; + UINT m_nZoom, m_nScrollPos, m_nScrollFactor, m_nBtnMouseOver; DWORD m_dwStatus, m_dwBeginSel, m_dwEndSel, m_dwBeginDrag, m_dwEndDrag; DWORD m_dwMenuParam; DWORD m_NcButtonState[SMP_LEFTBAR_BUTTONS]; @@ -28,7 +29,7 @@ public: void UpdateScrollSize(); - BOOL SetCurrentSample(UINT nSmp); + BOOL SetCurrentSample(SAMPLEINDEX nSmp); BOOL SetZoom(UINT nZoom); LONG SampleToScreen(LONG n) const; DWORD ScreenToSample(LONG x) const; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -727,19 +727,29 @@ // go through all sequences for(SEQUENCEINDEX nSeq = 0; nSeq < pSndFile->Order.GetNumSequences(); nSeq++) { - // TODO update sequence names if(pSndFile->Order.GetNumSequences() > 1) { // more than one sequence -> add folder CString sSeqName = pSndFile->Order.GetSequence(nSeq).m_sName; if(sSeqName.IsEmpty()) sSeqName.Format("Sequence %d", nSeq); + UINT state = (nSeq == pSndFile->Order.GetCurrentSequenceIndex()) ? TVIS_BOLD : 0; + if(pInfo->tiSequences[nSeq] == NULL) { pInfo->tiSequences[nSeq] = InsertItem(sSeqName, IMAGE_FOLDER, IMAGE_FOLDER, pInfo->hOrders, TVI_LAST); - } else - { + } + // Update bold item + strcpy(stmp, sSeqName); + tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_STATE; + tvi.state = 0; + tvi.stateMask = TVIS_BOLD; + tvi.hItem = pInfo->tiSequences[nSeq]; + tvi.pszText = stmp; + tvi.cchTextMax = sizeof(stmp); + GetItem(&tvi); + if(tvi.state != state || tvi.pszText != sSeqName) + SetItem(pInfo->tiSequences[nSeq], TVIF_TEXT | TVIF_STATE, sSeqName, 0, 0, state, TVIS_BOLD, 0); - } hAncestorNode = pInfo->tiSequences[nSeq]; } @@ -2017,7 +2027,7 @@ void CModTree::OnUpdate(CModDoc *pModDoc, DWORD dwHint, CObject *pHint) //--------------------------------------------------------------------- { - dwHint &= (HINT_PATNAMES|HINT_SMPNAMES|HINT_INSNAMES|HINT_MODTYPE|HINT_MODGENERAL|HINT_MODSEQUENCE|HINT_MIXPLUGINS|HINT_MPTOPTIONS|HINT_MASK_ITEM); + dwHint &= (HINT_PATNAMES|HINT_SMPNAMES|HINT_INSNAMES|HINT_MODTYPE|HINT_MODGENERAL|HINT_MODSEQUENCE|HINT_MIXPLUGINS|HINT_MPTOPTIONS|HINT_MASK_ITEM|HINT_SEQNAMES); if ((pHint != this) && (dwHint & HINT_MASK_FLAGS)) { for (UINT i=0; i<MODTREE_MAX_DOCUMENTS; i++) Modified: trunk/OpenMPT/soundlib/Load_med.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/soundlib/Load_med.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -810,7 +810,7 @@ if ((!dwBlockArr) || (dwBlockArr > dwMemLength - 4*wNumBlocks)) return true; pdwTable = (LPDWORD)(lpStream + dwBlockArr); playtransp += (version == '3') ? 24 : 48; - for (UINT iBlk=0; iBlk<wNumBlocks; iBlk++) + for (PATTERNINDEX iBlk=0; iBlk<wNumBlocks; iBlk++) { UINT dwPos = BigEndian(pdwTable[iBlk]); if ((!dwPos) || (dwPos >= dwMemLength) || (dwPos >= dwMemLength - 8)) continue; Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -1172,6 +1172,9 @@ bPorta = false; } + // Process Invert Loop (MOD Effect, called every row) + InvertLoop(&Chn[nChn]); + // Process special effects (note delay, pattern delay, pattern loop) if ((cmd == CMD_MODCMDEX) || (cmd == CMD_S3MCMDEX)) { @@ -1870,9 +1873,6 @@ break; } - // MOD Effect (called every row) - InvertLoop(&Chn[nChn]); - } // for(...) end // Navigation Effects @@ -2695,18 +2695,17 @@ //-------------------------------------------------- { // EFx implementation for MOD files (PT 1.1A and up: Invert Loop) - // This effect trashes samples. Thanks to bubsy for making this work. :) + // This effect trashes samples. Thanks to 8bitbubsy for making this work. :) if((m_nType & MOD_TYPE_MOD) == 0 || pChn->nEFxSpeed == 0) return; - pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F]; - - if(pChn->nEFxDelay < 0x80) return; // only applied if the "delay" reaches 128 - pChn->nEFxDelay = 0; - // we obviously also need a sample for this MODSAMPLE *pModSample = pChn->pEFxSample; if(pModSample == nullptr || pModSample->pSample == nullptr || !(pModSample->uFlags & CHN_LOOP)) return; + pChn->nEFxDelay += ModEFxTable[pChn->nEFxSpeed & 0x0F]; + if((pChn->nEFxDelay & 0x80) == 0) return; // only applied if the "delay" reaches 128 + pChn->nEFxDelay = 0; + if (++pChn->nEFxOffset >= pModSample->nLoopEnd - pModSample->nLoopStart) pChn->nEFxOffset = 0; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -3469,6 +3469,25 @@ } } // End if (oldTypeIsIT_MPT && newTypeIsS3M) + /////////////////////////////////// + // MOD <-> XM: Speed/Tempo update + if(oldTypeIsMOD && newTypeIsXM) + { + switch(m->command) + { + case CMD_SPEED: + m->param = min(m->param, 0x1F); + break; + } + } else if(oldTypeIsXM && newTypeIsMOD) + { + switch(m->command) + { + case CMD_TEMPO: + m->param = max(m->param, 0x21); + break; + } + } /////////////////////////////////////////////////////////////////////// Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/soundlib/Sndfile.h 2009-10-15 20:21:28 UTC (rev 399) @@ -113,7 +113,7 @@ unsigned char nPPC; //Pitch Centre? CHAR name[32]; - CHAR filename[12]; + CHAR filename[32]; BYTE nMixPlug; //rewbs.instroVSTi // -> CODE#0027 @@ -566,8 +566,9 @@ BYTE m_nTempoMode; // rewbs.betterBPM BYTE m_nMixLevels; UINT m_nMusicSpeed, m_nMusicTempo; - UINT m_nNextRow, m_nRow; - UINT m_nPattern,m_nCurrentPattern,m_nNextPattern,m_nRestartPos, m_nSeqOverride; + ROWINDEX m_nNextRow, m_nRow; + PATTERNINDEX m_nPattern; + ORDERINDEX m_nCurrentPattern, m_nNextPattern, m_nRestartPos, m_nSeqOverride; //NOTE: m_nCurrentPattern and m_nNextPattern refer to order index - not pattern index. bool m_bPatternTransitionOccurred; UINT m_nMasterVolume, m_nGlobalVolume, m_nSamplesToGlobalVolRampDest, Modified: trunk/OpenMPT/soundlib/pattern.cpp =================================================================== --- trunk/OpenMPT/soundlib/pattern.cpp 2009-10-13 20:20:48 UTC (rev 398) +++ trunk/OpenMPT/soundlib/pattern.cpp 2009-10-15 20:21:28 UTC (rev 399) @@ -132,7 +132,7 @@ if (!newPattern) return true; const UINT nPattern = m_rPatternContainer.GetIndex(this); - rModDoc.PrepareUndo(nPattern, 0,0, nChns, nRows); + rModDoc.PreparePatternUndo(nPattern, 0,0, nChns, nRows); oldPattern = m_ModCommands; for (UINT y=0; y<nRows; y++) { @@ -163,7 +163,7 @@ nRows = m_Rows; nChns = sndFile.m_nChannels; const UINT nPattern = m_rPatternContainer.GetIndex(this); - rModDoc.PrepareUndo(nPattern, 0,0, nChns, nRows); + rModDoc.PreparePatternUndo(nPattern, 0,0, nChns, nRows); nRows /= 2; for (UINT y=0; y<nRows; y++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |