#include "engine.h" static DivPattern emptyPat; DivPattern::DivPattern() { memset(data,-1,256*32*sizeof(short)); for (int i=0; i<256; i++) { data[i][0]=0; data[i][1]=0; } } DivPattern* DivChannelData::getPattern(int index, bool create) { if (data[index]==NULL) { if (create) { data[index]=new DivPattern; } else { return &emptyPat; } } return data[index]; } void DivChannelData::wipePatterns() { for (int i=0; i<128; i++) { if (data[i]!=NULL) { delete data[i]; data[i]=NULL; } } } SafeReader* DivPattern::compile(int len, int fxRows) { SafeWriter w; w.init(); short lastNote, lastOctave, lastInstr, lastVolume, lastEffect[8], lastEffectVal[8]; unsigned char rows=0; lastNote=0; lastOctave=0; lastInstr=-1; lastVolume=-1; memset(lastEffect,-1,8*sizeof(short)); memset(lastEffectVal,-1,8*sizeof(short)); for (int i=0; i