mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-22 12:35:11 +00:00
actually obey the orders
This commit is contained in:
parent
13c6362edb
commit
d395abe47f
5 changed files with 31 additions and 9 deletions
|
@ -63,6 +63,7 @@ src/engine/blip_buf.c
|
|||
src/engine/safeReader.cpp
|
||||
src/engine/engine.cpp
|
||||
src/engine/macroInt.cpp
|
||||
src/engine/pattern.cpp
|
||||
src/engine/playback.cpp
|
||||
src/engine/platform/abstract.cpp
|
||||
src/engine/platform/genesis.cpp
|
||||
|
|
|
@ -293,9 +293,6 @@ bool DivEngine::load(void* f, size_t slen) {
|
|||
for (int i=0; i<getChannelCount(ds.system); i++) {
|
||||
for (int j=0; j<ds.ordersLen; j++) {
|
||||
ds.orders.ord[i][j]=reader.readC();
|
||||
if (ds.orders.ord[i][j]>ds.ordersLen) {
|
||||
logW("pattern %d exceeds order count %d!\n",ds.orders.ord[i][j],ds.ordersLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +537,7 @@ bool DivEngine::load(void* f, size_t slen) {
|
|||
return false;
|
||||
}
|
||||
for (int j=0; j<ds.ordersLen; j++) {
|
||||
DivPattern* pat=new DivPattern;
|
||||
DivPattern* pat=chan->getPattern(ds.orders.ord[i][j],true);
|
||||
for (int k=0; k<ds.patLen; k++) {
|
||||
// note
|
||||
pat->data[k][0]=reader.readS();
|
||||
|
@ -571,7 +568,6 @@ bool DivEngine::load(void* f, size_t slen) {
|
|||
// instrument
|
||||
pat->data[k][2]=reader.readS();
|
||||
}
|
||||
chan->data.push_back(pat);
|
||||
}
|
||||
ds.pat.push_back(chan);
|
||||
}
|
||||
|
|
22
src/engine/pattern.cpp
Normal file
22
src/engine/pattern.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include "engine.h"
|
||||
|
||||
static DivPattern emptyPat;
|
||||
|
||||
DivPattern::DivPattern() {
|
||||
memset(data,0,256*16);
|
||||
}
|
||||
|
||||
DivPattern* DivChannelData::getPattern(int index, bool create) {
|
||||
if (data[index]==NULL) {
|
||||
if (create) {
|
||||
data[index]=new DivPattern;
|
||||
} else {
|
||||
return &emptyPat;
|
||||
}
|
||||
}
|
||||
return data[index];
|
||||
}
|
||||
|
||||
DivChannelData::DivChannelData() {
|
||||
memset(data,0,128*sizeof(void*));
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
struct DivPattern {
|
||||
short data[256][16];
|
||||
DivPattern();
|
||||
};
|
||||
|
||||
struct DivChannelData {
|
||||
|
@ -11,5 +12,7 @@ struct DivChannelData {
|
|||
// 2: instrument
|
||||
// 3: volume
|
||||
// 4-5+: effect/effect value
|
||||
std::vector<DivPattern*> data;
|
||||
DivPattern* data[128];
|
||||
DivPattern* getPattern(int index, bool create);
|
||||
DivChannelData();
|
||||
};
|
||||
|
|
|
@ -278,7 +278,7 @@ bool DivEngine::perSystemPostEffect(int ch, unsigned char effect, unsigned char
|
|||
void DivEngine::processRow(int i, bool afterDelay) {
|
||||
int whatOrder=afterDelay?chan[i].delayOrder:curOrder;
|
||||
int whatRow=afterDelay?chan[i].delayRow:curRow;
|
||||
DivPattern* pat=song.pat[i]->data[whatOrder];
|
||||
DivPattern* pat=song.pat[i]->getPattern(song.orders.ord[i][whatOrder],false);
|
||||
// pre effects
|
||||
if (!afterDelay) for (int j=0; j<song.pat[i]->effectRows; j++) {
|
||||
short effect=pat->data[whatRow][4+(j<<1)];
|
||||
|
@ -515,7 +515,7 @@ void DivEngine::nextRow() {
|
|||
snprintf(pb,4095," %.2x",song.orders.ord[i][curOrder]);
|
||||
strcat(pb1,pb);
|
||||
|
||||
DivPattern* pat=song.pat[i]->data[curOrder];
|
||||
DivPattern* pat=song.pat[i]->getPattern(song.orders.ord[i][curOrder],false);
|
||||
snprintf(pb2,4095,"\x1b[37m %s",
|
||||
formatNote(pat->data[curRow][0],pat->data[curRow][1]));
|
||||
strcat(pb3,pb2);
|
||||
|
@ -579,7 +579,7 @@ void DivEngine::nextRow() {
|
|||
|
||||
// post row details
|
||||
for (int i=0; i<chans; i++) {
|
||||
DivPattern* pat=song.pat[i]->data[curOrder];
|
||||
DivPattern* pat=song.pat[i]->getPattern(song.orders.ord[i][curOrder],false);
|
||||
if (!(pat->data[curRow][0]==0 && pat->data[curRow][1]==0)) {
|
||||
if (pat->data[curRow][0]!=100) {
|
||||
dispatchCmd(DivCommand(DIV_CMD_PRE_NOTE,i,ticks));
|
||||
|
|
Loading…
Reference in a new issue