From: <sag...@us...> - 2013-07-01 21:49:10
|
Revision: 2474 http://sourceforge.net/p/modplug/code/2474 Author: saga-games Date: 2013-07-01 21:49:02 +0000 (Mon, 01 Jul 2013) Log Message: ----------- [Imp] PTM: Directly support PTM's Nxx (reverse sample + offset) command without any workarounds Modified Paths: -------------- trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/EffectInfo.cpp trunk/OpenMPT/soundlib/Load_ptm.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/mod_specifications.cpp trunk/OpenMPT/soundlib/modcommand.cpp trunk/OpenMPT/soundlib/modcommand.h Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -124,7 +124,7 @@ MODCOLOR_GLOBALS, 0, MODCOLOR_PITCH, MODCOLOR_PANNING, MODCOLOR_PITCH, MODCOLOR_PANNING, 0, 0, 0, 0, 0, MODCOLOR_PITCH, - MODCOLOR_PITCH, + MODCOLOR_PITCH, 0, }; STATIC_ASSERT(CountOf(effectColors) == MAX_EFFECTS); Modified: trunk/OpenMPT/mptrack/EffectInfo.cpp =================================================================== --- trunk/OpenMPT/mptrack/EffectInfo.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/mptrack/EffectInfo.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -116,6 +116,7 @@ // -! NEW_FEATURE#0010 {CMD_NOTESLIDEUP, 0x00,0x00, 0, MOD_TYPE_NONE, "Note Slide Up"}, // .IMF effect {CMD_NOTESLIDEDOWN, 0x00,0x00, 0, MOD_TYPE_NONE, "Note Slide Down"}, // .IMF effect + {CMD_REVERSEOFFSET, 0x00,0x00, 0, MOD_TYPE_NONE, "Revert Sample + Offset"}, // .PTM effect }; Modified: trunk/OpenMPT/soundlib/Load_ptm.cpp =================================================================== --- trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/soundlib/Load_ptm.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -229,36 +229,18 @@ { m.command = file.ReadUint8(); m.param = file.ReadUint8(); + + const ModCommand::COMMAND effTrans[] = { CMD_GLOBALVOLUME, CMD_RETRIG, CMD_FINEVIBRATO, CMD_NONE, CMD_NONE, CMD_NONE, CMD_NONE, CMD_REVERSEOFFSET }; if(m.command < 0x10) { // Beware: Effect letters are as in MOD, but portamento and volume slides behave like in S3M (i.e. fine slides share the same effect letters) ConvertModCommand(m); + } else if(m.command < 0x10 + CountOf(effTrans)) + { + m.command = effTrans[m.command - 0x10]; } else { - switch(m.command) - { - case 0x10: - m.command = CMD_GLOBALVOLUME; - break; - case 0x11: - m.command = CMD_RETRIG; - break; - case 0x12: - m.command = CMD_FINEVIBRATO; - break; - case 0x17: - // Reverse sample + offset (start with offset 256 * xx bytes) -- is this an offset from the sample end...? - if(m.param) - { - m.volcmd = VOLCMD_OFFSET; - m.vol = m.param >> 3; - } - m.command = CMD_S3MCMDEX; - m.param = 0x9F; - break; - default: - m.command = CMD_NONE; - } + m.command = CMD_NONE; } } if(b & 0x80) Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -2623,6 +2623,17 @@ case CMD_NOTESLIDEDOWN: NoteSlide(pChn, param, false); break; + + // PTM Reverse sample + offset (executed on every tick) + case CMD_REVERSEOFFSET: + if(pChn->pModSample != nullptr) + { + pChn->dwFlags.set(CHN_PINGPONGFLAG); + pChn->dwFlags.reset(CHN_LOOP); + pChn->nPos = (pChn->pModSample->nLength - 1) - std::min<SmpLength>(SmpLength(pChn->rowCommand.param) << 8, pChn->pModSample->nLength); + pChn->nPosLo = 0; + } + break; } if(GetType() == MOD_TYPE_S3M && param != 0) Modified: trunk/OpenMPT/soundlib/mod_specifications.cpp =================================================================== --- trunk/OpenMPT/soundlib/mod_specifications.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/soundlib/mod_specifications.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -52,7 +52,7 @@ true, // Has song comments MAX_ENVPOINTS, // Envelope point count true, // Has envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#??", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\:#???", // Supported Effects " vpcdabuhlrgfe?o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has "---" pattern @@ -97,7 +97,7 @@ false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " 0123456789ABCD?FF?E?????????????????", // Supported Effects + " 0123456789ABCD?FF?E??????????????????", // Supported Effects " ???????????????", // Supported Volume Column commands false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern @@ -140,7 +140,7 @@ false, // No song comments 12, // Envelope point count false, // No envelope release node - " 0123456789ABCDRFFTE???GHK??XPL??????", // Supported Effects + " 0123456789ABCDRFFTE???GHK??XPL???????", // Supported Effects " vpcdabuhlrg????", // Supported Volume Column commands false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern @@ -183,7 +183,7 @@ true, // Has song comments 12, // Envelope point count false, // No envelope release node - " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#??", // Supported Effects + " 0123456789ABCDRFFTE???GHK?YXPLZ\\?#???", // Supported Effects " vpcdabuhlrgfe?o", // Supported Volume Column commands false, // Doesn't have "+++" pattern false, // Doesn't have "---" pattern @@ -225,7 +225,7 @@ false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?U??????????", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?U???????????", // Supported Effects " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern true, // Has "---" pattern @@ -268,7 +268,7 @@ false, // No song comments 0, // No instrument envelopes false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z?????", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z??????", // Supported Effects " vp?????????????", // Supported Volume Column commands true, // Has "+++" pattern true, // Has "---" pattern @@ -310,7 +310,7 @@ true, // Has song comments 25, // Envelope point count false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z?????", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z??????", // Supported Effects " vpcdab?h??gfe??", // Supported Volume Column commands true, // Has "+++" pattern true, // Has "--" pattern @@ -352,7 +352,7 @@ true, // Has song comments 25, // Envelope point count false, // No envelope release node - " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#??", // Supported Effects + " JFEGHLKRXODB?CQATI?SMNVW?UY?P?Z\\?#???", // Supported Effects " vpcdab?h??gfe?o", // Supported Volume Column commands true, // Has "+++" pattern true, // Has "---" pattern Modified: trunk/OpenMPT/soundlib/modcommand.cpp =================================================================== --- trunk/OpenMPT/soundlib/modcommand.cpp 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/soundlib/modcommand.cpp 2013-07-01 21:49:02 UTC (rev 2474) @@ -773,6 +773,7 @@ CMD_VOLUMESLIDE, CMD_VIBRATOVOL, CMD_VOLUME, + CMD_REVERSEOFFSET, CMD_OFFSET, CMD_TREMOR, CMD_RETRIG, Modified: trunk/OpenMPT/soundlib/modcommand.h =================================================================== --- trunk/OpenMPT/soundlib/modcommand.h 2013-07-01 17:38:20 UTC (rev 2473) +++ trunk/OpenMPT/soundlib/modcommand.h 2013-07-01 21:49:02 UTC (rev 2474) @@ -91,7 +91,8 @@ CMD_XPARAM = 34, // -> CODE#0010 -> DESC="add extended parameter mechanism to pattern effects" -! NEW_FEATURE#0010 CMD_NOTESLIDEUP = 35, // IMF Gxy CMD_NOTESLIDEDOWN = 36, // IMF Hxy - MAX_EFFECTS = 37 + CMD_REVERSEOFFSET = 37, // PTM Revert sample + offset + MAX_EFFECTS = 38 }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |